How does the iso work in ccd\cmos array detectors
There is a programmable gain amplification stage of some sort between the sensor readout electronics and the ADC.  The readout electronics are basically gigantic buffered mux (or cascade of muxes) with one input for every pixel.  Generally the gain stage beween the readout circuitry and the ADC is built with a series of switchable amplifier stages so the adjustment works in a series of discrete 'steps'.  No, you cannot select whatever gain you want, you can only select gains that the sensor readout is wired to support.  However, it is possible for a sensor to have readout electronics that support setting different gain settings in different ways.  In principle, it is possible to change the gain setting pixel by pixel.  Unfortunatley, the readout electronics are usually not designed so that the gain changes can be synchronized with the pixel outputs on a pixel by pixel basis.  However, some cameras read out more than one line at a time through separate gain stages and ADCs.  The Magic Lantern firmware for some Canon DSLRs supports configuring the readout electronics in those cameras to read out alternating rows in two different ISO settings.  See: http://www.magiclantern.fm/forum/index.php?topic=7139.0

Actually, most DSLR cameras do not support all of the ISO selections natively.  They perform some futzing around after the ADC that results in some ISO settings having a better dynamic range and noise level than others.  

http://shootintheshot.joshsilfen.com/2010/05/13/canon-hd-dslr-native-iso/