linux-loongson/Documentation/iio/opt4060.rst
Per-Daniel Olsson 0c6db4506a 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>
2024-12-28 14:28:13 +00:00

62 lines
1.9 KiB
ReStructuredText

==============================
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.