Re: [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence
From: Maxwell Doose
Date: Sun May 10 2026 - 04:20:35 EST
On Sun, May 10, 2026 at 3:11 AM Hungyu Lin <dennylin0707@xxxxxxxxx> wrote:
>
> The device powers up in I2C mode. Switching to SPI mode
> requires sending a sequence of SPI writes as described in
> the datasheet.
>
> During this sequence, the device may still be in I2C mode,
> so SPI transactions may not be recognized and can fail.
> Such errors are expected and are ignored.
>
> Add a comment to clarify this behavior.
>
> Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>
> ---
> Changes in v2:
> - Add datasheet reference
> - Add TL;DR note
>
> drivers/staging/iio/addac/adt7316-spi.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/addac/adt7316-spi.c b/drivers/staging/iio/addac/adt7316-spi.c
> index f91325d11394..980532b7fa1e 100644
> --- a/drivers/staging/iio/addac/adt7316-spi.c
> +++ b/drivers/staging/iio/addac/adt7316-spi.c
> @@ -106,7 +106,17 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
> return -EINVAL;
> }
>
> - /* switch from default I2C protocol to SPI protocol */
> + /*
> + * The device powers up in I2C mode. Switching to SPI mode
> + * requires sending a sequence of SPI writes as described in
> + * the datasheet ("Serial Interface Selection" section).
> + *
> + * During this sequence, the device may still be in I2C mode,
> + * so SPI transactions may not be recognized and can fail.
> + * Such errors are expected and are ignored.
> + *
> + * TL;DR: Do not change this!
> + */
> adt7316_spi_write(spi_dev, 0, 0);
> adt7316_spi_write(spi_dev, 0, 0);
> adt7316_spi_write(spi_dev, 0, 0);
> --
> 2.34.1
>
>
Reviewed-by: Maxwell Doose <m32285159@xxxxxxxxx>
but please, wait at least 24hrs before submitting a new version...
best regards,
max