1 .. SPDX-License-Identifier: GPL-2.0
3 =======================
4 Kernel driver bh1770glc
5 =======================
16 Samu Onkalo <samu.p.onkalo@nokia.com>
20 BH1770GLC and SFH7770 are combined ambient light and proximity sensors.
21 ALS and proximity parts operates on their own, but they shares common I2C
22 interface and interrupt logic. In principle they can run on their own,
23 but ALS side results are used to estimate reliability of the proximity sensor.
25 ALS produces 16 bit lux values. The chip contains interrupt logic to produce
26 low and high threshold interrupts.
28 Proximity part contains IR-led driver up to 3 IR leds. The chip measures
29 amount of reflected IR light and produces proximity result. Resolution is
30 8 bit. Driver supports only one channel. Driver uses ALS results to estimate
31 reliability of the proximity results. Thus ALS is always running while
32 proximity detection is needed.
34 Driver uses threshold interrupts to avoid need for polling the values.
35 Proximity low interrupt doesn't exists in the chip. This is simulated
36 by using a delayed work. As long as there is proximity threshold above
37 interrupts the delayed work is pushed forward. So, when proximity level goes
38 below the threshold value, there is no interrupt and the delayed work will
39 finally run. This is handled as no proximity indication.
41 Chip state is controlled via runtime pm framework when enabled in config.
43 Calibscale factor is used to hide differences between the chips. By default
44 value set to neutral state meaning factor of 1.00. To get proper values,
45 calibrated source of light is needed as a reference. Calibscale factor is set
46 so that measurement produces about the expected lux value.
52 RO - shows detected chip type and version
55 RW - enable / disable chip
63 RO - measured lux value
65 sysfs_notify called when threshold interrupt occurs
68 RO - lux0_input max value
71 RW - measurement rate in Hz
74 RO - supported measurement rates
76 lux0_thresh_above_value
77 RW - HI level threshold value
79 All results above the value
80 trigs an interrupt. 65535 (i.e. sensor_range) disables the above
83 lux0_thresh_below_value
84 RW - LO level threshold value
86 All results below the value
87 trigs an interrupt. 0 disables the below interrupt.
90 RW - calibration value
92 Set to neutral value by default.
93 Output results are multiplied with calibscale / calibscale_default
96 lux0_calibscale_default
97 RO - neutral calibration value
100 RO - measured proximity value
102 sysfs_notify called when threshold interrupt occurs
105 RO - prox0_raw max value
108 RW - enable / disable proximity
112 - 1 enables the proximity
113 - 0 disables the proximity
115 prox0_thresh_above_count
116 RW - number of proximity interrupts needed before triggering the event
119 RW - Measurement rate (in Hz) when the level is above threshold
120 i.e. when proximity on has been reported.
123 RW - Measurement rate (in Hz) when the level is below threshold
124 i.e. when proximity off has been reported.
127 RO - Supported proximity measurement rates in Hz
129 prox0_thresh_above0_value
130 RW - threshold level which trigs proximity events.
132 Filtered by persistence filter (prox0_thresh_above_count)
134 prox0_thresh_above1_value
135 RW - threshold level which trigs event immediately