On Fri, 29 Nov 2024 10:13:52 -0300 Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx> wrote: > The ADC data is pushed to the IIO buffer along with timestamp but no > timestamp channel was provided to retried the time data. > Add a timestamp channel to provide sample capture time. > > Suggested-by: David Lechner <dlechner@xxxxxxxxxxxx> > Reviewed-by: David Lechner <dlechner@xxxxxxxxxxxx> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx> H Marcelo, Given you are going to be spinning a v6 anyway, trivial comments inline. Thanks, Jonathan > --- > drivers/iio/adc/ad4000.c | 98 +++++++++++++++++++++++----------------- > 1 file changed, 56 insertions(+), 42 deletions(-) > > diff --git a/drivers/iio/adc/ad4000.c b/drivers/iio/adc/ad4000.c > index b3b82535f5c1..21731c4d31ee 100644 > --- a/drivers/iio/adc/ad4000.c > +++ b/drivers/iio/adc/ad4000.c > @@ -49,6 +49,7 @@ > .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ > BIT(IIO_CHAN_INFO_SCALE), \ > .info_mask_separate_available = _reg_access ? BIT(IIO_CHAN_INFO_SCALE) : 0,\ > + .scan_index = 0, \ > .scan_type = { \ > .sign = _sign, \ > .realbits = _real_bits, \ > @@ -62,6 +63,12 @@ > __AD4000_DIFF_CHANNEL((_sign), (_real_bits), \ > ((_real_bits) > 16 ? 32 : 16), (_reg_access)) > > +#define AD4000_DIFF_CHANNELS(_sign, _real_bits, _reg_access) \ > +{ \ > + AD4000_DIFF_CHANNEL(_sign, _real_bits, _reg_access), \ > + IIO_CHAN_SOFT_TIMESTAMP(1) \ Add a trailing , In theory we can add more channels after this. > +} > + > #define __AD4000_PSEUDO_DIFF_CHANNEL(_sign, _real_bits, _storage_bits, _reg_access)\ > { \ > .type = IIO_VOLTAGE, \ > @@ -71,6 +78,7 @@ > BIT(IIO_CHAN_INFO_SCALE) | \ > BIT(IIO_CHAN_INFO_OFFSET), \ > .info_mask_separate_available = _reg_access ? BIT(IIO_CHAN_INFO_SCALE) : 0,\ > + .scan_index = 0, \ > .scan_type = { \ > .sign = _sign, \ > .realbits = _real_bits, \ > @@ -84,6 +92,12 @@ > __AD4000_PSEUDO_DIFF_CHANNEL((_sign), (_real_bits), \ > ((_real_bits) > 16 ? 32 : 16), (_reg_access)) > > +#define AD4000_PSEUDO_DIFF_CHANNELS(_sign, _real_bits, _reg_access) \ > +{ \ > + AD4000_PSEUDO_DIFF_CHANNEL(_sign, _real_bits, _reg_access), \ > + IIO_CHAN_SOFT_TIMESTAMP(1) \ As above. Trailing comma should be here. The only exception to that is when we have a terminator entry (NULL or similar) where we want to make it hard to add anything after it. > +} > +