Skip to content

Commit 8bf3e7a

Browse files
Denny-Linjic23
authored andcommitted
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 Reviewed-by: Maxwell Doose <m32285159@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 79ab48a commit 8bf3e7a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

drivers/staging/iio/addac/adt7316-spi.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,18 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
106106
return -EINVAL;
107107
}
108108

109-
/* switch from default I2C protocol to SPI protocol */
109+
/*
110+
* The device powers up in I2C mode. Switching to SPI mode
111+
* requires sending a sequence of SPI writes as described in
112+
* the datasheet "ADT7316/ADT7317/ADT7318", Rev. B,
113+
* in the "Serial Interface Selection" section.
114+
*
115+
* During this sequence, the device may still be in I2C mode,
116+
* so SPI transactions may not be recognized and can fail.
117+
* Such errors are therefore ignored.
118+
*
119+
* TL;DR: Do not change this!
120+
*/
110121
adt7316_spi_write(spi_dev, 0, 0);
111122
adt7316_spi_write(spi_dev, 0, 0);
112123
adt7316_spi_write(spi_dev, 0, 0);

0 commit comments

Comments
 (0)