iio: light: Add support for TI OPT4060 color sensor
Add support for Texas Instruments OPT4060 RGBW Color sensor. Signed-off-by: Per-Daniel Olsson <perdaniel.olsson@axis.com> Link: https://patch.msgid.link/20241218104836.2784523-3-perdaniel.olsson@axis.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
8354dc8924
commit
0c6db4506a
6 changed files with 1426 additions and 0 deletions
|
@ -508,6 +508,9 @@ What: /sys/bus/iio/devices/iio:deviceX/in_angl_scale
|
|||
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_x_scale
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_y_scale
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_z_scale
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_red_scale
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_green_scale
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_blue_scale
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_concentration_co2_scale
|
||||
KernelVersion: 2.6.35
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
|
@ -1633,6 +1636,10 @@ What: /sys/.../iio:deviceX/in_intensityY_uv_raw
|
|||
What: /sys/.../iio:deviceX/in_intensityY_uva_raw
|
||||
What: /sys/.../iio:deviceX/in_intensityY_uvb_raw
|
||||
What: /sys/.../iio:deviceX/in_intensityY_duv_raw
|
||||
What: /sys/.../iio:deviceX/in_intensity_red_raw
|
||||
What: /sys/.../iio:deviceX/in_intensity_green_raw
|
||||
What: /sys/.../iio:deviceX/in_intensity_blue_raw
|
||||
What: /sys/.../iio:deviceX/in_intensity_clear_raw
|
||||
KernelVersion: 3.4
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
|
|
|
@ -29,3 +29,4 @@ Industrial I/O Kernel Drivers
|
|||
adxl380
|
||||
bno055
|
||||
ep93xx_adc
|
||||
opt4060
|
||||
|
|
61
Documentation/iio/opt4060.rst
Normal file
61
Documentation/iio/opt4060.rst
Normal file
|
@ -0,0 +1,61 @@
|
|||
==============================
|
||||
OPT4060 driver
|
||||
==============================
|
||||
|
||||
1. Overview
|
||||
=============================
|
||||
|
||||
This driver supports the Texas Instrument RGBW high resolution color sensor over
|
||||
I2C.
|
||||
https://www.ti.com/lit/gpn/opt4060
|
||||
|
||||
The driver supports:
|
||||
- Raw values for red, green, blue and clear.
|
||||
- Illuminance values.
|
||||
- Scaled color values for red, green and blue.
|
||||
- IIO events for thresholds.
|
||||
- IIO triggered buffer using both its own data ready trigger and triggers from
|
||||
other drivers.
|
||||
|
||||
2. Illuminance calculation
|
||||
=============================
|
||||
|
||||
Illuminance is calculated using the wide spectrum green channel.
|
||||
|
||||
lux = GREEN_RAW x 2.15e-3
|
||||
|
||||
The value is accessed from:
|
||||
/sys/bus/iio/devices/iio:deviceX/in_illuminance_input
|
||||
|
||||
See section 8.4.5.2 in the data sheet for additional details.
|
||||
|
||||
3. Color scale values
|
||||
=============================
|
||||
|
||||
The sensor has different sensitivity for the different color components and
|
||||
compensating factors are exposed from the driver.
|
||||
|
||||
The values are accessed from:
|
||||
/sys/bus/iio/devices/iio:deviceX/in_intensity_red_scale
|
||||
/sys/bus/iio/devices/iio:deviceX/in_intensity_green_scale
|
||||
/sys/bus/iio/devices/iio:deviceX/in_intensity_blue_scale
|
||||
|
||||
A userspace application can multiply the raw values with the scale values so
|
||||
that for a particular test light source, typically white, the measurement
|
||||
intensity is the same across the different color channels. This is calculated
|
||||
in the following way:
|
||||
|
||||
R = RED_RAW x SCALE_RED(2.4)
|
||||
G = GREEN_RAW x SCALE_GREEN(1.0)
|
||||
B = BLUE_RAW x SCALE_BLUE(1.3)
|
||||
|
||||
The data sheet suggests using the scaled values to normalize the scaled R, G
|
||||
and B values. This is useful to get a value for the ratio between colors
|
||||
independent of light intensity. A userspace application can do this in the
|
||||
following way:
|
||||
|
||||
R_NORMALIZED = R / (R + G + B)
|
||||
G_NORMALIZED = G / (R + G + B)
|
||||
B_NORMALIZED = B / (R + G + B)
|
||||
|
||||
See section 8.4.5.2 in the data sheet for additional details.
|
|
@ -475,6 +475,19 @@ config OPT4001
|
|||
If built as a dynamically linked module, it will be called
|
||||
opt4001.
|
||||
|
||||
config OPT4060
|
||||
tristate "Texas Instruments OPT4060 RGBW Color Sensor"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
select IIO_BUFFER
|
||||
select IIO_TRIGGERED_BUFFER
|
||||
help
|
||||
If you say Y or M here, you get support for Texas Instruments
|
||||
OPT4060 RGBW Color Sensor.
|
||||
|
||||
If built as a dynamically linked module, it will be called
|
||||
opt4060.
|
||||
|
||||
config PA12203001
|
||||
tristate "TXC PA12203001 light and proximity sensor"
|
||||
depends on I2C
|
||||
|
|
|
@ -42,6 +42,7 @@ obj-$(CONFIG_MAX44009) += max44009.o
|
|||
obj-$(CONFIG_NOA1305) += noa1305.o
|
||||
obj-$(CONFIG_OPT3001) += opt3001.o
|
||||
obj-$(CONFIG_OPT4001) += opt4001.o
|
||||
obj-$(CONFIG_OPT4060) += opt4060.o
|
||||
obj-$(CONFIG_PA12203001) += pa12203001.o
|
||||
obj-$(CONFIG_ROHM_BU27034) += rohm-bu27034.o
|
||||
obj-$(CONFIG_RPR0521) += rpr0521.o
|
||||
|
|
1343
drivers/iio/light/opt4060.c
Normal file
1343
drivers/iio/light/opt4060.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue