1 Kernel driver bh1770glc
2 =======================
12 Samu Onkalo <samu.p.onkalo@nokia.com>
16 BH1770GLC and SFH7770 are combined ambient light and proximity sensors.
17 ALS and proximity parts operates on their own, but they shares common I2C
18 interface and interrupt logic. In principle they can run on their own,
19 but ALS side results are used to estimate reliability of the proximity sensor.
21 ALS produces 16 bit lux values. The chip contains interrupt logic to produce
22 low and high threshold interrupts.
24 Proximity part contains IR-led driver up to 3 IR leds. The chip measures
25 amount of reflected IR light and produces proximity result. Resolution is
26 8 bit. Driver supports only one channel. Driver uses ALS results to estimate
27 reliability of the proximity results. Thus ALS is always running while
28 proximity detection is needed.
30 Driver uses threshold interrupts to avoid need for polling the values.
31 Proximity low interrupt doesn't exists in the chip. This is simulated
32 by using a delayed work. As long as there is proximity threshold above
33 interrupts the delayed work is pushed forward. So, when proximity level goes
34 below the threshold value, there is no interrupt and the delayed work will
35 finally run. This is handled as no proximity indication.
37 Chip state is controlled via runtime pm framework when enabled in config.
39 Calibscale factor is used to hide differences between the chips. By default
40 value set to neutral state meaning factor of 1.00. To get proper values,
41 calibrated source of light is needed as a reference. Calibscale factor is set
42 so that measurement produces about the expected lux value.
48 RO - shows detected chip type and version
51 RW - enable / disable chip. Uses counting logic
56 RO - measured lux value
57 sysfs_notify called when threshold interrupt occurs
60 RO - lux0_input max value
63 RW - measurement rate in Hz
66 RO - supported measurement rates
68 lux0_thresh_above_value
69 RW - HI level threshold value. All results above the value
70 trigs an interrupt. 65535 (i.e. sensor_range) disables the above
73 lux0_thresh_below_value
74 RW - LO level threshold value. All results below the value
75 trigs an interrupt. 0 disables the below interrupt.
78 RW - calibration value. Set to neutral value by default.
79 Output results are multiplied with calibscale / calibscale_default
82 lux0_calibscale_default
83 RO - neutral calibration value
86 RO - measured proximity value
87 sysfs_notify called when threshold interrupt occurs
90 RO - prox0_raw max value
93 RW - enable / disable proximity - uses counting logic
94 1 enables the proximity
95 0 disables the proximity
97 prox0_thresh_above_count
98 RW - number of proximity interrupts needed before triggering the event
101 RW - Measurement rate (in Hz) when the level is above threshold
102 i.e. when proximity on has been reported.
105 RW - Measurement rate (in Hz) when the level is below threshold
106 i.e. when proximity off has been reported.
109 RO - Supported proximity measurement rates in Hz
111 prox0_thresh_above0_value
112 RW - threshold level which trigs proximity events.
113 Filtered by persistence filter (prox0_thresh_above_count)
115 prox0_thresh_above1_value
116 RW - threshold level which trigs event immediately