iio: adc: ti-lmp92064: add buffering support
authorLeonard Göhrs <l.goehrs@pengutronix.de>
Fri, 7 Jul 2023 06:36:35 +0000 (08:36 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 20 Jul 2023 18:21:30 +0000 (19:21 +0100)
commit6c7bc1d27bb227da89aa7e1be71d01b92719551d
tree1b4f6d5d452f8b81e4cfaaaae05a1cbde80272c5
parent1f2a4d506f47200550b1dbf9e77e2a3d0ffec7b2
iio: adc: ti-lmp92064: add buffering support

Enable buffered reading of samples from the LMP92064 ADC.
The main benefit of this change is being able to read out current and
voltage measurements in a single transfer, allowing instantaneous power
measurements.

Reads into the buffer can be triggered by any software triggers, e.g.
the iio-trig-hrtimer:

    $ mkdir /sys/kernel/config/iio/triggers/hrtimer/my-trigger
    $ cat /sys/bus/iio/devices/iio\:device3/name
    lmp92064
    $ iio_readdev -t my-trigger -b 16 iio:device3 | hexdump
    WARNING: High-speed mode not enabled
    0000000 0000 0176 0101 0001 5507 abd5 7645 1768
    0000010 0000 016d 0101 0001 ee1e ac6b 7645 1768
    ...

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20230707063635.1496437-1-l.goehrs@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ti-lmp92064.c