Manual Gain Setting

Which Firmware version supports manual setting of image gain? And which the smallest portion of code to do that?