From: Hungyu Lin <dennylin0707@gmail.com>
To: jic23@kernel.org, lars@metafoo.de, Michael.Hennerich@analog.com,
gregkh@linuxfoundation.org
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
linux-iio@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, Hungyu Lin <dennylin0707@gmail.com>
Subject: [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence
Date: Sun, 10 May 2026 08:10:41 +0000 [thread overview]
Message-ID: <20260510081041.85880-1-dennylin0707@gmail.com> (raw)
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
next reply other threads:[~2026-05-10 8:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-10 8:10 Hungyu Lin [this message]
2026-05-10 8:20 ` [PATCH v2] staging: iio: addac: adt7316: document SPI interface switching sequence 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260510081041.85880-1-dennylin0707@gmail.com \
--to=dennylin0707@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox