0001 .. SPDX-License-Identifier: GPL-2.0
0002
0003 =======================
0004 Kernel driver bh1770glc
0005 =======================
0006
0007 Supported chips:
0008
0009 - ROHM BH1770GLC
0010 - OSRAM SFH7770
0011
0012 Data sheet:
0013 Not freely available
0014
0015 Author:
0016 Samu Onkalo <samu.p.onkalo@nokia.com>
0017
0018 Description
0019 -----------
0020 BH1770GLC and SFH7770 are combined ambient light and proximity sensors.
0021 ALS and proximity parts operates on their own, but they shares common I2C
0022 interface and interrupt logic. In principle they can run on their own,
0023 but ALS side results are used to estimate reliability of the proximity sensor.
0024
0025 ALS produces 16 bit lux values. The chip contains interrupt logic to produce
0026 low and high threshold interrupts.
0027
0028 Proximity part contains IR-led driver up to 3 IR leds. The chip measures
0029 amount of reflected IR light and produces proximity result. Resolution is
0030 8 bit. Driver supports only one channel. Driver uses ALS results to estimate
0031 reliability of the proximity results. Thus ALS is always running while
0032 proximity detection is needed.
0033
0034 Driver uses threshold interrupts to avoid need for polling the values.
0035 Proximity low interrupt doesn't exists in the chip. This is simulated
0036 by using a delayed work. As long as there is proximity threshold above
0037 interrupts the delayed work is pushed forward. So, when proximity level goes
0038 below the threshold value, there is no interrupt and the delayed work will
0039 finally run. This is handled as no proximity indication.
0040
0041 Chip state is controlled via runtime pm framework when enabled in config.
0042
0043 Calibscale factor is used to hide differences between the chips. By default
0044 value set to neutral state meaning factor of 1.00. To get proper values,
0045 calibrated source of light is needed as a reference. Calibscale factor is set
0046 so that measurement produces about the expected lux value.
0047
0048 SYSFS
0049 -----
0050
0051 chip_id
0052 RO - shows detected chip type and version
0053
0054 power_state
0055 RW - enable / disable chip
0056
0057 Uses counting logic
0058
0059 - 1 enables the chip
0060 - 0 disables the chip
0061
0062 lux0_input
0063 RO - measured lux value
0064
0065 sysfs_notify called when threshold interrupt occurs
0066
0067 lux0_sensor_range
0068 RO - lux0_input max value
0069
0070 lux0_rate
0071 RW - measurement rate in Hz
0072
0073 lux0_rate_avail
0074 RO - supported measurement rates
0075
0076 lux0_thresh_above_value
0077 RW - HI level threshold value
0078
0079 All results above the value
0080 trigs an interrupt. 65535 (i.e. sensor_range) disables the above
0081 interrupt.
0082
0083 lux0_thresh_below_value
0084 RW - LO level threshold value
0085
0086 All results below the value
0087 trigs an interrupt. 0 disables the below interrupt.
0088
0089 lux0_calibscale
0090 RW - calibration value
0091
0092 Set to neutral value by default.
0093 Output results are multiplied with calibscale / calibscale_default
0094 value.
0095
0096 lux0_calibscale_default
0097 RO - neutral calibration value
0098
0099 prox0_raw
0100 RO - measured proximity value
0101
0102 sysfs_notify called when threshold interrupt occurs
0103
0104 prox0_sensor_range
0105 RO - prox0_raw max value
0106
0107 prox0_raw_en
0108 RW - enable / disable proximity
0109
0110 Uses counting logic
0111
0112 - 1 enables the proximity
0113 - 0 disables the proximity
0114
0115 prox0_thresh_above_count
0116 RW - number of proximity interrupts needed before triggering the event
0117
0118 prox0_rate_above
0119 RW - Measurement rate (in Hz) when the level is above threshold
0120 i.e. when proximity on has been reported.
0121
0122 prox0_rate_below
0123 RW - Measurement rate (in Hz) when the level is below threshold
0124 i.e. when proximity off has been reported.
0125
0126 prox0_rate_avail
0127 RO - Supported proximity measurement rates in Hz
0128
0129 prox0_thresh_above0_value
0130 RW - threshold level which trigs proximity events.
0131
0132 Filtered by persistence filter (prox0_thresh_above_count)
0133
0134 prox0_thresh_above1_value
0135 RW - threshold level which trigs event immediately