bh1770glc.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. .. SPDX-License-Identifier: GPL-2.0
  2. =======================
  3. Kernel driver bh1770glc
  4. =======================
  5. Supported chips:
  6. - ROHM BH1770GLC
  7. - OSRAM SFH7770
  8. Data sheet:
  9. Not freely available
  10. Author:
  11. Samu Onkalo <samu.p.onkalo@nokia.com>
  12. Description
  13. -----------
  14. BH1770GLC and SFH7770 are combined ambient light and proximity sensors.
  15. ALS and proximity parts operates on their own, but they shares common I2C
  16. interface and interrupt logic. In principle they can run on their own,
  17. but ALS side results are used to estimate reliability of the proximity sensor.
  18. ALS produces 16 bit lux values. The chip contains interrupt logic to produce
  19. low and high threshold interrupts.
  20. Proximity part contains IR-led driver up to 3 IR leds. The chip measures
  21. amount of reflected IR light and produces proximity result. Resolution is
  22. 8 bit. Driver supports only one channel. Driver uses ALS results to estimate
  23. reliability of the proximity results. Thus ALS is always running while
  24. proximity detection is needed.
  25. Driver uses threshold interrupts to avoid need for polling the values.
  26. Proximity low interrupt doesn't exists in the chip. This is simulated
  27. by using a delayed work. As long as there is proximity threshold above
  28. interrupts the delayed work is pushed forward. So, when proximity level goes
  29. below the threshold value, there is no interrupt and the delayed work will
  30. finally run. This is handled as no proximity indication.
  31. Chip state is controlled via runtime pm framework when enabled in config.
  32. Calibscale factor is used to hide differences between the chips. By default
  33. value set to neutral state meaning factor of 1.00. To get proper values,
  34. calibrated source of light is needed as a reference. Calibscale factor is set
  35. so that measurement produces about the expected lux value.
  36. SYSFS
  37. -----
  38. chip_id
  39. RO - shows detected chip type and version
  40. power_state
  41. RW - enable / disable chip
  42. Uses counting logic
  43. - 1 enables the chip
  44. - 0 disables the chip
  45. lux0_input
  46. RO - measured lux value
  47. sysfs_notify called when threshold interrupt occurs
  48. lux0_sensor_range
  49. RO - lux0_input max value
  50. lux0_rate
  51. RW - measurement rate in Hz
  52. lux0_rate_avail
  53. RO - supported measurement rates
  54. lux0_thresh_above_value
  55. RW - HI level threshold value
  56. All results above the value
  57. trigs an interrupt. 65535 (i.e. sensor_range) disables the above
  58. interrupt.
  59. lux0_thresh_below_value
  60. RW - LO level threshold value
  61. All results below the value
  62. trigs an interrupt. 0 disables the below interrupt.
  63. lux0_calibscale
  64. RW - calibration value
  65. Set to neutral value by default.
  66. Output results are multiplied with calibscale / calibscale_default
  67. value.
  68. lux0_calibscale_default
  69. RO - neutral calibration value
  70. prox0_raw
  71. RO - measured proximity value
  72. sysfs_notify called when threshold interrupt occurs
  73. prox0_sensor_range
  74. RO - prox0_raw max value
  75. prox0_raw_en
  76. RW - enable / disable proximity
  77. Uses counting logic
  78. - 1 enables the proximity
  79. - 0 disables the proximity
  80. prox0_thresh_above_count
  81. RW - number of proximity interrupts needed before triggering the event
  82. prox0_rate_above
  83. RW - Measurement rate (in Hz) when the level is above threshold
  84. i.e. when proximity on has been reported.
  85. prox0_rate_below
  86. RW - Measurement rate (in Hz) when the level is below threshold
  87. i.e. when proximity off has been reported.
  88. prox0_rate_avail
  89. RO - Supported proximity measurement rates in Hz
  90. prox0_thresh_above0_value
  91. RW - threshold level which trigs proximity events.
  92. Filtered by persistence filter (prox0_thresh_above_count)
  93. prox0_thresh_above1_value
  94. RW - threshold level which trigs event immediately