brintos

brintos / linux-shallow public Read only

0
0
Text · 3.6 KiB · ea5ca58 Raw
136 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3=======================4Kernel driver bh1770glc5=======================6 7Supported chips:8 9- ROHM BH1770GLC10- OSRAM SFH777011 12Data sheet:13Not freely available14 15Author:16Samu Onkalo <samu.p.onkalo@nokia.com>17 18Description19-----------20BH1770GLC and SFH7770 are combined ambient light and proximity sensors.21ALS and proximity parts operates on their own, but they shares common I2C22interface 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 produce26low and high threshold interrupts.27 28Proximity part contains IR-led driver up to 3 IR leds. The chip measures29amount of reflected IR light and produces proximity result. Resolution is308 bit. Driver supports only one channel. Driver uses ALS results to estimate31reliability of the proximity results. Thus ALS is always running while32proximity 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 simulated36by using a delayed work. As long as there is proximity threshold above37interrupts the delayed work is pushed forward. So, when proximity level goes38below the threshold value, there is no interrupt and the delayed work will39finally 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 default44value 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 set46so that measurement produces about the expected lux value.47 48SYSFS49-----50 51chip_id52	RO - shows detected chip type and version53 54power_state55	RW - enable / disable chip56 57	Uses counting logic58 59	     - 1 enables the chip60	     - 0 disables the chip61 62lux0_input63	RO - measured lux value64 65	     sysfs_notify called when threshold interrupt occurs66 67lux0_sensor_range68	RO - lux0_input max value69 70lux0_rate71	RW - measurement rate in Hz72 73lux0_rate_avail74	RO - supported measurement rates75 76lux0_thresh_above_value77	RW - HI level threshold value78 79	     All results above the value80	     trigs an interrupt. 65535 (i.e. sensor_range) disables the above81	     interrupt.82 83lux0_thresh_below_value84	RW - LO level threshold value85 86	     All results below the value87	     trigs an interrupt. 0 disables the below interrupt.88 89lux0_calibscale90	RW - calibration value91 92	     Set to neutral value by default.93	     Output results are multiplied with calibscale / calibscale_default94	     value.95 96lux0_calibscale_default97	RO - neutral calibration value98 99prox0_raw100	RO - measured proximity value101 102	     sysfs_notify called when threshold interrupt occurs103 104prox0_sensor_range105	RO - prox0_raw max value106 107prox0_raw_en108	RW - enable / disable proximity109 110	     Uses counting logic111 112	     - 1 enables the proximity113	     - 0 disables the proximity114 115prox0_thresh_above_count116	RW - number of proximity interrupts needed before triggering the event117 118prox0_rate_above119	RW - Measurement rate (in Hz) when the level is above threshold120	i.e. when proximity on has been reported.121 122prox0_rate_below123	RW - Measurement rate (in Hz) when the level is below threshold124	i.e. when proximity off has been reported.125 126prox0_rate_avail127	RO - Supported proximity measurement rates in Hz128 129prox0_thresh_above0_value130	RW - threshold level which trigs proximity events.131 132	     Filtered by persistence filter (prox0_thresh_above_count)133 134prox0_thresh_above1_value135	RW - threshold level which trigs event immediately136