* [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence
@ 2026-05-10 8:10 Hungyu Lin
2026-05-10 8:20 ` Maxwell Doose
2026-05-10 8:55 ` Andy Shevchenko
0 siblings, 2 replies; 7+ messages in thread
From: Hungyu Lin @ 2026-05-10 8:10 UTC (permalink / raw)
To: jic23, lars, Michael.Hennerich, gregkh
Cc: dlechner, nuno.sa, andy, linux-iio, linux-staging, linux-kernel,
Hungyu Lin
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@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence
2026-05-10 8:10 [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence Hungyu Lin
@ 2026-05-10 8:20 ` Maxwell Doose
2026-05-10 8:55 ` Andy Shevchenko
1 sibling, 0 replies; 7+ messages in thread
From: Maxwell Doose @ 2026-05-10 8:20 UTC (permalink / raw)
To: Hungyu Lin
Cc: jic23, lars, Michael.Hennerich, gregkh, dlechner, nuno.sa, andy,
linux-iio, linux-staging, linux-kernel
On Sun, May 10, 2026 at 3:11 AM Hungyu Lin <dennylin0707@gmail.com> 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@gmail.com>
> ---
> 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@gmail.com>
but please, wait at least 24hrs before submitting a new version...
best regards,
max
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence
2026-05-10 8:10 [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence Hungyu Lin
2026-05-10 8:20 ` Maxwell Doose
@ 2026-05-10 8:55 ` Andy Shevchenko
2026-05-10 9:22 ` Denny Lin
1 sibling, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-05-10 8:55 UTC (permalink / raw)
To: Hungyu Lin
Cc: jic23, lars, Michael.Hennerich, gregkh, dlechner, nuno.sa, andy,
linux-iio, linux-staging, linux-kernel
On Sun, May 10, 2026 at 08:10:41AM +0000, Hungyu Lin 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.
...
> Changes in v2:
> - Add datasheet reference
This is still odd. Please, put in a format
$SNUM "$STITLE"
where $SNUM is the section number (like 2.1.4) and "$STITLE" as currently done
in this version, Ideally the datasheet also needs a versioning.
...
With that being addressed,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence
2026-05-10 8:55 ` Andy Shevchenko
@ 2026-05-10 9:22 ` Denny Lin
2026-05-10 9:26 ` Andy Shevchenko
0 siblings, 1 reply; 7+ messages in thread
From: Denny Lin @ 2026-05-10 9:22 UTC (permalink / raw)
To: Andy Shevchenko
Cc: jic23, lars, Michael.Hennerich, gregkh, dlechner, nuno.sa, andy,
linux-iio, linux-staging, linux-kernel
> This is still odd. Please, put in a format
>
> $SNUM "$STITLE"
>
> where $SNUM is the section number (like 2.1.4) and "$STITLE" as currently done
> in this version, Ideally the datasheet also needs a versioning.
The ADT7316 datasheet does not seem to provide explicit section
numbering for the "Serial Interface Selection" section, only the
section title.
Would it be acceptable to reference it using just the section
title, or would you prefer using the page number instead?
Thanks,
Hungyu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence
2026-05-10 9:22 ` Denny Lin
@ 2026-05-10 9:26 ` Andy Shevchenko
2026-05-10 9:31 ` Denny Lin
0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-05-10 9:26 UTC (permalink / raw)
To: Denny Lin
Cc: jic23, lars, Michael.Hennerich, gregkh, dlechner, nuno.sa, andy,
linux-iio, linux-staging, linux-kernel
On Sun, May 10, 2026 at 02:22:02AM -0700, Denny Lin wrote:
> > This is still odd. Please, put in a format
> >
> > $SNUM "$STITLE"
> >
> > where $SNUM is the section number (like 2.1.4) and "$STITLE" as currently done
> > in this version, Ideally the datasheet also needs a versioning.
>
> The ADT7316 datasheet does not seem to provide explicit section
> numbering for the "Serial Interface Selection" section, only the
> section title.
>
> Would it be acceptable to reference it using just the section
> title, or would you prefer using the page number instead?
Do you have the Datasheet version? Maybe URL?
(Yeah, that's unfortunate they do not provide numbering, in such a case
it's acceptable to have reduced reference.)
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence
2026-05-10 9:26 ` Andy Shevchenko
@ 2026-05-10 9:31 ` Denny Lin
2026-05-10 10:04 ` Andy Shevchenko
0 siblings, 1 reply; 7+ messages in thread
From: Denny Lin @ 2026-05-10 9:31 UTC (permalink / raw)
To: Andy Shevchenko
Cc: jic23, lars, Michael.Hennerich, gregkh, dlechner, nuno.sa, andy,
linux-iio, linux-staging, linux-kernel
> Do you have the Datasheet version? Maybe URL?
The datasheet I am referring to is:
https://www.analog.com/en/products/adt7316.html
(ADT7316/ADT7317/ADT7318, Rev. B)
Thanks,
Hungyu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence
2026-05-10 9:31 ` Denny Lin
@ 2026-05-10 10:04 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-05-10 10:04 UTC (permalink / raw)
To: Denny Lin
Cc: jic23, lars, Michael.Hennerich, gregkh, dlechner, nuno.sa, andy,
linux-iio, linux-staging, linux-kernel
On Sun, May 10, 2026 at 02:31:31AM -0700, Denny Lin wrote:
> > Do you have the Datasheet version? Maybe URL?
>
> The datasheet I am referring to is:
> https://www.analog.com/en/products/adt7316.html
>
> (ADT7316/ADT7317/ADT7318, Rev. B)
OK! Put the URL in the commit message as Datasheet tag and use the name in the
comment in the code
Datasheet: $URL
Signed-off-by: ...
...
/*
*...datasheet "ADT7316/ADT7317/ADT7318", Rev. B...
*/
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-05-10 10:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-10 8:10 [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence Hungyu Lin
2026-05-10 8:20 ` Maxwell Doose
2026-05-10 8:55 ` Andy Shevchenko
2026-05-10 9:22 ` Denny Lin
2026-05-10 9:26 ` Andy Shevchenko
2026-05-10 9:31 ` Denny Lin
2026-05-10 10:04 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox