Linux 6.14-rc1
[linux.git] / Documentation / iio / opt4060.rst
blobeb155089b6d27017578ed569d7d4ccc082f1bae2
1 ==============================
2 OPT4060 driver
3 ==============================
5 1. Overview
6 =============================
8 This driver supports the Texas Instrument RGBW high resolution color sensor over
9 I2C.
10 https://www.ti.com/lit/gpn/opt4060
12 The driver supports:
13 - Raw values for red, green, blue and clear.
14 - Illuminance values.
15 - Scaled color values for red, green and blue.
16 - IIO events for thresholds.
17 - IIO triggered buffer using both its own data ready trigger and triggers from
18 other drivers.
20 2. Illuminance calculation
21 =============================
23 Illuminance is calculated using the wide spectrum green channel.
25 lux = GREEN_RAW x 2.15e-3
27 The value is accessed from:
28 /sys/bus/iio/devices/iio:deviceX/in_illuminance_input
30 See section 8.4.5.2 in the data sheet for additional details.
32 3. Color scale values
33 =============================
35 The sensor has different sensitivity for the different color components and
36 compensating factors are exposed from the driver.
38 The values are accessed from:
39 /sys/bus/iio/devices/iio:deviceX/in_intensity_red_scale
40 /sys/bus/iio/devices/iio:deviceX/in_intensity_green_scale
41 /sys/bus/iio/devices/iio:deviceX/in_intensity_blue_scale
43 A userspace application can multiply the raw values with the scale values so
44 that for a particular test light source, typically white, the measurement
45 intensity is the same across the different color channels. This is calculated
46 in the following way:
48 R = RED_RAW x SCALE_RED(2.4)
49 G = GREEN_RAW x SCALE_GREEN(1.0)
50 B = BLUE_RAW x SCALE_BLUE(1.3)
52 The data sheet suggests using the scaled values to normalize the scaled R, G
53 and B values. This is useful to get a value for the ratio between colors
54 independent of light intensity. A userspace application can do this in the
55 following way:
57 R_NORMALIZED = R / (R + G + B)
58 G_NORMALIZED = G / (R + G + B)
59 B_NORMALIZED = B / (R + G + B)
61 See section 8.4.5.2 in the data sheet for additional details.