iio: light: as73211: add support for as7331
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Wed, 3 Jan 2024 12:08:53 +0000 (13:08 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 22 Jan 2024 18:58:44 +0000 (18:58 +0000)
commit02324a09cbe2ae38ab081dd5a1f620ccfd3c62b7
tree5de102e1e84f37d1c5fb3d7d119203f5e340b5c5
parentb4d971656407a888df111c8334e46f35cee0368d
iio: light: as73211: add support for as7331

The AMS AS7331 is a UV light sensor with three channels: UVA, UVB and
UVC (also known as deep UV and referenced as DUV in the iio core).
Its internal structure and forming blocks are practically identical to
the ones the AS73211 contains: API, internal DAC, I2C interface and
registers, measurement modes, number of channels and pinout.

The only difference between them is the photodiodes used to acquire
light, which means that only some modifications are required to add
support for the AS7331 in the existing driver.

The temperature channel is identical for both devices and only the
channel modifiers of the IIO_INTENSITY channels need to account for the
device type.

The scale values have been obtained from the chapter "7.5 Transfer
Function" of the official datasheet[1] for the configuration chosen as
basis (Nclk = 1024 and GAIN = 1). Those values keep the units from the
datasheet (nW/cm^2), as opposed to the units used for the AS73211
(nW/m^2).

Add a new device-specific data structure to account for the device
differences: channel types and scale of LSB per channel.

[1] https://ams.com/documents/20143/9106314/AS7331_DS001047_4-00.pdf

Tested-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/Kconfig
drivers/iio/light/as73211.c