blob: ea5ca58bb958512d9bb5c8265882ee5e373f5666 [file] [log] [blame]
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +02001.. SPDX-License-Identifier: GPL-2.0
2
3=======================
Samu Onkalo3f0f4a32010-10-26 14:22:39 -07004Kernel driver bh1770glc
5=======================
6
7Supported chips:
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +02008
9- ROHM BH1770GLC
10- OSRAM SFH7770
Samu Onkalo3f0f4a32010-10-26 14:22:39 -070011
12Data sheet:
13Not freely available
14
15Author:
16Samu Onkalo <samu.p.onkalo@nokia.com>
17
18Description
19-----------
20BH1770GLC and SFH7770 are combined ambient light and proximity sensors.
21ALS and proximity parts operates on their own, but they shares common I2C
22interface and interrupt logic. In principle they can run on their own,
23but ALS side results are used to estimate reliability of the proximity sensor.
24
25ALS produces 16 bit lux values. The chip contains interrupt logic to produce
26low and high threshold interrupts.
27
28Proximity part contains IR-led driver up to 3 IR leds. The chip measures
29amount of reflected IR light and produces proximity result. Resolution is
308 bit. Driver supports only one channel. Driver uses ALS results to estimate
31reliability of the proximity results. Thus ALS is always running while
32proximity detection is needed.
33
34Driver uses threshold interrupts to avoid need for polling the values.
35Proximity low interrupt doesn't exists in the chip. This is simulated
36by using a delayed work. As long as there is proximity threshold above
37interrupts the delayed work is pushed forward. So, when proximity level goes
38below the threshold value, there is no interrupt and the delayed work will
39finally run. This is handled as no proximity indication.
40
41Chip state is controlled via runtime pm framework when enabled in config.
42
43Calibscale factor is used to hide differences between the chips. By default
44value set to neutral state meaning factor of 1.00. To get proper values,
45calibrated source of light is needed as a reference. Calibscale factor is set
46so that measurement produces about the expected lux value.
47
48SYSFS
49-----
50
51chip_id
52 RO - shows detected chip type and version
53
54power_state
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +020055 RW - enable / disable chip
56
57 Uses counting logic
58
59 - 1 enables the chip
60 - 0 disables the chip
Samu Onkalo3f0f4a32010-10-26 14:22:39 -070061
62lux0_input
63 RO - measured lux value
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +020064
Samu Onkalo3f0f4a32010-10-26 14:22:39 -070065 sysfs_notify called when threshold interrupt occurs
66
67lux0_sensor_range
68 RO - lux0_input max value
69
70lux0_rate
71 RW - measurement rate in Hz
72
73lux0_rate_avail
74 RO - supported measurement rates
75
76lux0_thresh_above_value
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +020077 RW - HI level threshold value
78
79 All results above the value
Samu Onkalo3f0f4a32010-10-26 14:22:39 -070080 trigs an interrupt. 65535 (i.e. sensor_range) disables the above
81 interrupt.
82
83lux0_thresh_below_value
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +020084 RW - LO level threshold value
85
86 All results below the value
Samu Onkalo3f0f4a32010-10-26 14:22:39 -070087 trigs an interrupt. 0 disables the below interrupt.
88
89lux0_calibscale
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +020090 RW - calibration value
91
92 Set to neutral value by default.
Samu Onkalo3f0f4a32010-10-26 14:22:39 -070093 Output results are multiplied with calibscale / calibscale_default
94 value.
95
96lux0_calibscale_default
97 RO - neutral calibration value
98
99prox0_raw
100 RO - measured proximity value
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +0200101
Samu Onkalo3f0f4a32010-10-26 14:22:39 -0700102 sysfs_notify called when threshold interrupt occurs
103
104prox0_sensor_range
105 RO - prox0_raw max value
106
107prox0_raw_en
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +0200108 RW - enable / disable proximity
109
110 Uses counting logic
111
112 - 1 enables the proximity
113 - 0 disables the proximity
Samu Onkalo3f0f4a32010-10-26 14:22:39 -0700114
115prox0_thresh_above_count
116 RW - number of proximity interrupts needed before triggering the event
117
118prox0_rate_above
119 RW - Measurement rate (in Hz) when the level is above threshold
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +0200120 i.e. when proximity on has been reported.
Samu Onkalo3f0f4a32010-10-26 14:22:39 -0700121
122prox0_rate_below
123 RW - Measurement rate (in Hz) when the level is below threshold
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +0200124 i.e. when proximity off has been reported.
Samu Onkalo3f0f4a32010-10-26 14:22:39 -0700125
126prox0_rate_avail
127 RO - Supported proximity measurement rates in Hz
128
129prox0_thresh_above0_value
130 RW - threshold level which trigs proximity events.
Mauro Carvalho Chehab0e7ade42020-06-15 08:50:16 +0200131
Samu Onkalo3f0f4a32010-10-26 14:22:39 -0700132 Filtered by persistence filter (prox0_thresh_above_count)
133
134prox0_thresh_above1_value
135 RW - threshold level which trigs event immediately