• Julien Stephan's avatar
    iio: adc: ad7380: add support for single-ended parts · ae20f31d
    Julien Stephan authored
    Adding ad7386/7/8 (16/14/12 bits) unsigned, dual simultaneous sampling,
    single-ended compatible parts, and the corresponding ad7386-4/7-4/8-4
    4 channels.
    
    These parts have a 2:1 multiplexer in front of each ADC. They also include
    additional configuration registers that allow for either manual selection
    or automatic switching (sequencer mode), of the multiplexer inputs.
    This commit focus on integrating manual selection. Sequencer mode will
    be implemented later.
    
    >From an IIO point of view, all inputs are exported, i.e ad7386/7/8
    export 4 channels and ad7386-4/7-4/8-4 export 8 channels.
    
    Inputs AinX0 of multiplexers correspond to the first half of IIO channels
    (i.e 0-1 or 0-3) and inputs AinX1 correspond to second half (i.e 2-3 or
    4-7). Example for AD7386/7/8 (2 channels parts):
    
              IIO   | AD7386/7/8
                    |         +----------------------------
                    |         |     _____        ______
                    |         |    |     |      |      |
           voltage0 | AinA0 --|--->|     |      |      |
                    |         |    | mux |----->| ADCA |---
           voltage2 | AinA1 --|--->|     |      |      |
                    |         |    |_____|      |_____ |
                    |         |     _____        ______
                    |         |    |     |      |      |
           voltage1 | AinB0 --|--->|     |      |      |
                    |         |    | mux |----->| ADCB |---
           voltage3 | AinB1 --|--->|     |      |      |
                    |         |    |_____|      |______|
                    |         |
                    |         +----------------------------
    
    When switching channel, the ADC require an additional settling time.
    According to the datasheet, data is valid on the third CS low. We already
    have an extra toggle before each read (either direct reads or buffered
    reads) to sample correct data, so we just add a single CS toggle at the
    end of the register write.
    Signed-off-by: default avatarJulien Stephan <jstephan@baylibre.com>
    Reviewed-by: default avatarDavid Lechner <dlechner@baylibre.com>
    Link: https://patch.msgid.link/20240731-ad7380-add-single-ended-chips-v2-5-cd63bf05744c@baylibre.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    ae20f31d
ad7380.c 31.3 KB