* [PATCH] staging: iio: addac: adt7316: document SPI interface switching sequence
@ 2026-05-10 7:29 Hungyu Lin
2026-05-10 7:45 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-05-10 7:29 UTC (permalink / raw)
To: lars, Michael.Hennerich, jic23, 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>
---
drivers/staging/iio/addac/adt7316-spi.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/iio/addac/adt7316-spi.c b/drivers/staging/iio/addac/adt7316-spi.c
index f91325d11394..6d710e1d4aaa 100644
--- a/drivers/staging/iio/addac/adt7316-spi.c
+++ b/drivers/staging/iio/addac/adt7316-spi.c
@@ -106,7 +106,15 @@ 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.
+ *
+ * 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.
+ */
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] 2+ messages in thread
* Re: [PATCH] staging: iio: addac: adt7316: document SPI interface switching sequence
2026-05-10 7:29 [PATCH] staging: iio: addac: adt7316: document SPI interface switching sequence Hungyu Lin
@ 2026-05-10 7:45 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-05-10 7:45 UTC (permalink / raw)
To: Hungyu Lin
Cc: lars, Michael.Hennerich, jic23, gregkh, dlechner, nuno.sa, andy,
linux-iio, linux-staging, linux-kernel
On Sun, May 10, 2026 at 07:29:18AM +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.
...
> - /* 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.
Add a reference (Section number and title, and/or table / chart number
and its title).
> + * 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.
> + */
Otherwise it is indeed what we want to be here.
Perhaps also add a line closer to the code (that will be visible in the patch
in case someone ignores to read the comment)
*
* TL;DR: Do not change this!
*/
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-10 7:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-10 7:29 [PATCH] staging: iio: addac: adt7316: document SPI interface switching sequence Hungyu Lin
2026-05-10 7:45 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox