Re: [PATCH] drivers: iio: adc: add support for ad777x family

From: Andy Shevchenko
Date: Thu May 30 2024 - 11:08:16 EST


On Wed, May 29, 2024 at 03:45:58PM +0000, Nechita, Ramona wrote:
> >On Wed, May 29, 2024 at 03:01:06PM +0000, Nechita, Ramona wrote:

..

> >> >> + ret = ad777x_spi_write(st, AD777X_REG_SRC_N_LSB, lsb);
> >> >> + if (ret)
> >> >> + return ret;
> >> >> + ret = ad777x_spi_write(st, AD777X_REG_SRC_N_MSB, msb);
> >> >> + if (ret)
> >> >> + return ret;
> >> >
> >> >Can you use 16-bit writes?
> >> >Same Q to all similar LSB/MSB write groups.
> >>
> >> I cannot do 16-bit writes due to how the spi functions on the chip and
> >> because the registers for MSB/LSB are at different addresses.
> >
> >They are supposed to be on the different addresses.
> >You mean the distance between them > than stride?
>
> I may be misunderstanding this, but the spi read/write expects
> HeaderBit+Addr+/-Data+CRC. Writing two consecutive registers would mean
> creating a buffer with this format for each address and sending all of them
> at once, correct? I feel like that would overcomplicate the code a bit, but I
> can do it if it seems appropriate.

You can add a new ad777x_spi_bulk_write() where you perform needed magic.

--
With Best Regards,
Andy Shevchenko