diff options
| author | Hungyu Lin <dennylin0707@gmail.com> | 2026-05-11 14:06:41 +0000 |
|---|---|---|
| committer | Jonathan Cameron <jic23@kernel.org> | 2026-05-31 10:59:40 +0100 |
| commit | 8bf3e7a9defcfa889976258919d99fa2e8465189 (patch) | |
| tree | be5fec0a04cb7b0019850bbc9f788d07c3bb1d3e | |
| parent | 79ab48ae4f9e06512263377c81fad1ab1adace4c (diff) | |
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>
| -rw-r--r-- | drivers/staging/iio/addac/adt7316-spi.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/staging/iio/addac/adt7316-spi.c b/drivers/staging/iio/addac/adt7316-spi.c index f91325d11394..1debcc36c1af 100644 --- a/drivers/staging/iio/addac/adt7316-spi.c +++ b/drivers/staging/iio/addac/adt7316-spi.c @@ -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); |
