Skip to contentSkip to conversation

staging: iio: addac: adt7316: document SPI interface switching sequence

PATCH Applied Hungyu Lin 2 participants 2 messages May 11 – May 12

Subsystems (4)
lore
Share & tools
lore

Hungyu Lin

author
#0 lore raw

PATCH v4 1/1 staging: iio: addac: adt7316: document SPI interface switching sequence

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 therefore ignored.

Add a comment to clarify this behavior.

Datasheet: https://www.analog.com/en/products/adt7316.html

---
Changes in v4:
- Restore section title in datasheet reference
- Adjust wording per Jonathan's suggestion
- Add Reviewed-by tags

Changes in v3:
- Add Datasheet tag
- Use datasheet name in code comment

Changes in v2:
- Add datasheet reference
- Add TL;DR note

 drivers/staging/iio/addac/adt7316-spi.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/staging/iio/addac/adt7316-spi.c +12 -1
index f91325d11394..1debcc36c1af 100644
@@ -106,7 +106,18 @@ 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 "ADT7316/ADT7317/ADT7318", Rev. B,
+	 * in the "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 therefore 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);
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 8 lines · On Mon, 11 May 2026 14:06:41 +0000 Hungyu Lin <[email protected]> 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 therefore ignored.

Quoted 6 lines

Add a comment to clarify this behavior.

Datasheet: https://www.analog.com/en/products/adt7316.html

Applied!

Thanks

Jonathan