• Lukas Wunner's avatar
    iio: adc: mcp320x: Speed up readout of single-channel ADCs · ea910318
    Lukas Wunner authored
    Single-channel converters such as mcp3001, mcp3201, mcp3301 and the
    upcoming mcp3550/1/3 lack a MOSI pin, so there's no need to call
    mcp320x_channel_to_tx_data() for them.
    
    Moreover, instead of calling spi_read() for these converters, which
    generates an spi_message and spi_transfer on the stack on every readout,
    it's more efficient to use the spi_message and spi_transfer[] included
    in struct mcp320x (as we do for multi-channel ADCs), but initialize the
    spi_message only with the receive transfer.
    Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    ea910318
mcp320x.c 10.7 KB