Skip to content

ADPD188 linux driver

[email protected] linux-devicetree linux-iio lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2dt-bindings: add adpd188 schemaDocumentation/devicetree/bindings/iio/light/adi,adpd188.yaml+72 -02 replies
2/2drivers:iio:light: add ADPD188 driver supportdrivers/iio/light/Kconfig drivers/iio/light/Makefile drivers/iio/light/adpd188.c +3 more+1826 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] ADPD188 linux driver

From: Andrei Drimbarean <[email protected]>

The ADPD188BI is a complete photometric system for smoke detection using optical dual wavelength technology. The module integrates an efficient photometric front end, two light emitting diodes (LEDs), and two photodiodes (PDs).

The front end of the application specific integrated circuit (ASIC) consists of a control block, a 14-bit analog-to-digital converter (ADC) with a 20-bit burst accumulator, and three flexible, independently configurable LED drivers.

Datasheet information here: https://www.analog.com/media/en/technical-documentation/data-sheets/adpd188bi.pdf

The device is controlled via either SPI or I2C interface.

The first implementation used adpd188_spi/i2c.c to initialize regmap that was then used in the core driver source. But the I2C implementation needed to work with multiple daisy-chained devices. The properties of the daisy-chained devices is that only one of them sets the sampling rate automatically while the others sample when they receive a sample ready signal from the previous device and only the last of the chain forwards and interrupt to the host, which needs to read data from all devices at that point.

Moreover, all devices start on power-up with the same I2C address, which is not configurable in the hardware. It needs to be configured in software by changing a register. To differentiate between devices that need to change address and those that don't we set devices to change only when their GPIO1 is held high. Each device has its GPIO1 tied to GPIO0 of the previous device, except the first device, which has its GPIO1 tied low.

So the way to change the addresses is as follows:
1. Set all GPIO1 to high.
2. Change devices that have GPIO1 tied high to a new address.
3. Change GPIO1 to low for devices of the old address.
4. Go to new address and repeat from step 1.

Because of this, a single driver instance ends up controlling multiple physical devices that are daisy-chained at the same time.

Andrei Drimbarean (2):
dt-bindings: add adpd188 schema
drivers:iio:light: add ADPD188 driver support

 .../bindings/iio/light/adi,adpd188.yaml       |   72 +
 drivers/iio/light/Kconfig                     |   30 +
 drivers/iio/light/Makefile                    |    3 +
 drivers/iio/light/adpd188.c                   | 1389 +++++++++++++++++
 drivers/iio/light/adpd188.h                   |   64 +
 drivers/iio/light/adpd188_i2c.c               |  243 +++
 drivers/iio/light/adpd188_spi.c               |   97 ++
 7 files changed, 1898 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/light/adi,adpd188.yaml
 create mode 100644 drivers/iio/light/adpd188.c
 create mode 100644 drivers/iio/light/adpd188.h
 create mode 100644 drivers/iio/light/adpd188_i2c.c
 create mode 100644 drivers/iio/light/adpd188_spi.c
Signature · 1 line
2.25.1