Update APDS990x ALS to support device trees
Subsystems (4)
v3 cover Update APDS990x ALS to support device trees
Document Avago APDS9900/9901 ALS/Proximity sensor in schema and add its support to tsl2772 driver.
---
Changes in v3:
- switched from apds990x to apds9900 in the driver
- fixed misc-devices/index.rts
- expanded and adjusted commit descriptions
Changes in v2:
- dropped all previous patches
- apds990x was documented in tsl2772.yaml
- apds990x support was added to tsl2772.c
- original apds990x driver removed from misc
---
Svyatoslav Ryhel (3):
dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity
sensor
iio: tsl2772: Add support for Avago APDS9900/9901 ALS/Proximity sensor
misc: Remove old APDS990x driver
.../bindings/iio/light/tsl2772.yaml | 2 + Documentation/misc-devices/apds990x.rst | 128 -- Documentation/misc-devices/index.rst | 1 - drivers/iio/light/tsl2772.c | 16 + drivers/misc/Kconfig | 10 - drivers/misc/Makefile | 1 - drivers/misc/apds990x.c | 1284 ----------------- include/linux/platform_data/apds990x.h | 65 - 8 files changed, 18 insertions(+), 1489 deletions(-) delete mode 100644 Documentation/misc-devices/apds990x.rst delete mode 100644 drivers/misc/apds990x.c delete mode 100644 include/linux/platform_data/apds990x.h
Signature · 1 line
2.51.0
PATCH v3 1/3 dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor
Document Avago APDS-9900/9901 combined ALS/IR-LED/Proximity sensor.
--- Documentation/devicetree/bindings/iio/light/tsl2772.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/iio/light/tsl2772.yaml +2 -0
@@ -26,6 +26,8 @@ properties: - amstaos,tmd2672 - amstaos,tsl2772 - amstaos,tmd2772 + - avago,apds9900 + - avago,apds9901 - avago,apds9930 reg:
Signature · 1 line
2.51.0
PATCH v3 2/3 iio: tsl2772: Add support for Avago APDS9900/9901 ALS/Proximity sensor
In reply to Svyatoslav RyhelThe Avago APDS9900/9901 has a similar register layout to the TAOS/AMS TSL2772 but features a unique set of configurations. Add support for the APDS9900/9901 into the TSL2772 driver by adding the required device-specific configurations.
--- drivers/iio/light/tsl2772.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/iio/light/tsl2772.c +16 -0
@@ -127,6 +127,7 @@ enum { tmd2672, tsl2772, tmd2772, + apds9900, apds9930, };
@@ -221,6 +222,12 @@ static const struct tsl2772_lux tmd2x72_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = { { 0, 0 }, }; +static const struct tsl2772_lux apds9900_lux_table[TSL2772_DEF_LUX_TABLE_SZ ] = { + {52000 ,115960 }, + {36400 ,73840 }, + {0 ,0 }, +}; +static const struct tsl2772_lux apds9930_lux_table[TSL2772_DEF_LUX_TABLE_SZ ] = { {52000 ,96824 }, { 38792, 67132 },
@@ -238,6 +245,7 @@ static const struct tsl2772_lux *tsl2772_default_lux_table_group[] = { [tmd2672] = tmd2x72_lux_table, [tsl2772] = tsl2x72_lux_table, [tmd2772] = tmd2x72_lux_table, + [apds9900] = apds9900_lux_table, [apds9930] = apds9930_lux_table, };
@@ -289,6 +297,7 @@ static const int tsl2772_int_time_avail[][6] = { [tmd2672] = { 0, 2730, 0, 2730, 0, 699000 }, [tsl2772] = { 0, 2730, 0, 2730, 0, 699000 }, [tmd2772] = { 0, 2730, 0, 2730, 0, 699000 }, + [apds9900] = { 0, 2720, 0, 2720, 0, 696000 }, [apds9930] = { 0, 2730, 0, 2730, 0, 699000 }, };
@@ -316,6 +325,7 @@ static const u8 device_channel_config[] = { [tmd2672] = PRX2, [tsl2772] = ALSPRX2, [tmd2772] = ALSPRX2, + [apds9900] = ALSPRX, [apds9930] = ALSPRX2, };
@@ -530,6 +540,7 @@ static int tsl2772_get_prox(struct iio_dev *indio_dev)case tmd2672:case tsl2772:case tmd2772: +case apds9900:case apds9930:if (!(ret &TSL2772_STA_PRX_VALID )) { ret = -EINVAL ;
@@ -1367,6 +1378,7 @@ static int tsl2772_device_id_verif(int id, int target)return (id &0xf0 ) ==TRITON_ID ;case tmd2671:case tmd2771: +case apds9900:return (id &0xf0 ) ==HALIBUT_ID ;case tsl2572:case tsl2672:
@@ -1898,6 +1910,8 @@ static const struct i2c_device_id tsl2772_idtable[] = { { "tmd2672", tmd2672 }, { "tsl2772", tsl2772 }, { "tmd2772", tmd2772 }, + { "apds9900", apds9900 }, + { "apds9901", apds9900 }, { "apds9930", apds9930 }, { } };
@@ -1915,6 +1929,8 @@ static const struct of_device_id tsl2772_of_match[] = { { .compatible = "amstaos,tmd2672" }, { .compatible = "amstaos,tsl2772" }, { .compatible = "amstaos,tmd2772" }, + { .compatible = "avago,apds9900" }, + { .compatible = "avago,apds9901" }, { .compatible = "avago,apds9930" }, { } };
Signature · 1 line
2.51.0
PATCH v3 3/3 misc: Remove old APDS990x driver
In reply to Svyatoslav RyhelThe APDS990x driver in misc lacks DeviceTree support, and no mainline pre-DT board files configured this device using apds990x_platform_data.
This driver belongs to a legacy group of ambient light sensor drivers in drivers/misc/ that predates the migration to DT and the standard IIO ABI.
Since the Avago APDS9900/9901 ALS/Proximity sensor is now supported by the tsl2772 IIO driver and there are no active users in the kernel tree, remove this old implementation.
--- Documentation/misc-devices/apds990x.rst | 128 --- Documentation/misc-devices/index.rst | 1 - drivers/misc/Kconfig | 10 - drivers/misc/Makefile | 1 - drivers/misc/apds990x.c | 1284 ----------------------- include/linux/platform_data/apds990x.h | 65 -- 6 files changed, 1489 deletions(-) delete mode 100644 Documentation/misc-devices/apds990x.rst delete mode 100644 drivers/misc/apds990x.c delete mode 100644 include/linux/platform_data/apds990x.h
Documentation/misc-devices/apds990x.rst deleted +0 -128
@@ -1,128 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 - -====================== -Kernel driver apds990x -====================== - -Supported chips: -Avago APDS990X - -Data sheet: -Not freely available - -Author: -Samu Onkalo <[email protected]> - -Description ------------ - -APDS990x is a combined ambient light and proximity sensor. ALS and proximity -functionality are highly connected. ALS measurement path must be running -while the proximity functionality is enabled. - -ALS produces raw measurement values for two channels: Clear channel -(infrared + visible light) and IR only. However, threshold comparisons happen -using clear channel only. Lux value and the threshold level on the HW -might vary quite much depending the spectrum of the light source. - -Driver makes necessary conversions to both directions so that user handles -only lux values. Lux value is calculated using information from the both -channels. HW threshold level is calculated from the given lux value to match -with current type of the lightning. Sometimes inaccuracy of the estimations -lead to false interrupt, but that doesn't harm. - -ALS contains 4 different gain steps. Driver automatically -selects suitable gain step. After each measurement, reliability of the results -is estimated and new measurement is triggered if necessary. - -Platform data can provide tuned values to the conversion formulas if -values are known. Otherwise plain sensor default values are used. - -Proximity side is little bit simpler. There is no need for complex conversions. -It produces directly usable values. - -Driver controls chip operational state using pm_runtime framework. -Voltage regulators are controlled based on chip operational state. - -SYSFS ------ - - -chip_id - RO - shows detected chip type and version - -power_state - RW - enable / disable chip. Uses counting logic - - 1 enables the chip - 0 disables the chip -lux0_input - RO - measured lux value - - sysfs_notify called when threshold interrupt occurs - -lux0_sensor_range - RO - lux0_input max value. - - Actually never reaches since sensor tends - to saturate much before that. Real max value varies depending - on the light spectrum etc. - -lux0_rate - RW - measurement rate in Hz - -lux0_rate_avail - RO - supported measurement rates - -lux0_calibscale - RW - calibration value. - - Set to neutral value by default. - Output results are multiplied with calibscale / calibscale_default - value. - -lux0_calibscale_default - RO - neutral calibration value - -lux0_thresh_above_value - RW - HI level threshold value. - - All results above the value - trigs an interrupt. 65535 (i.e. sensor_range) disables the above - interrupt. - -lux0_thresh_below_value - RW - LO level threshold value. - - All results below the value - trigs an interrupt. 0 disables the below interrupt. - -prox0_raw - RO - measured proximity value - - sysfs_notify called when threshold interrupt occurs - -prox0_sensor_range - RO - prox0_raw max value (1023) - -prox0_raw_en - RW - enable / disable proximity - uses counting logic - - - 1 enables the proximity - - 0 disables the proximity - -prox0_reporting_mode - RW - trigger / periodic. - - In "trigger" mode the driver tells two possible - values: 0 or prox0_sensor_range value. 0 means no proximity, - 1023 means proximity. This causes minimal number of interrupts. - In "periodic" mode the driver reports all values above - prox0_thresh_above. This causes more interrupts, but it can give - _rough_ estimate about the distance. - -prox0_reporting_mode_avail - RO - accepted values to prox0_reporting_mode (trigger, periodic) - -prox0_thresh_above_value - RW - threshold level which trigs proximity events.
Documentation/misc-devices/index.rst +0 -1
@@ -13,7 +13,6 @@ fit into other categories. ad525x_dpot amd-sbi - apds990x bh1770glc c2port dw-xdata-pcie
drivers/misc/Kconfig +0 -10
@@ -381,16 +381,6 @@ config SENSORS_BH1770 To compile this driver as a module, choose M here: the module will be called bh1770glc. If unsure, say N here. -config SENSORS_APDS990X - tristate "APDS990X combined als and proximity sensors" - depends on I2C - help - Say Y here if you want to build a driver for Avago APDS990x - combined ambient light and proximity sensor chip. - - To compile this driver as a module, choose M here: the - module will be called apds990x. If unsure, say N here. - config HMC6352 tristate "Honeywell HMC6352 compass" depends on I2C
drivers/misc/Makefile +0 -1
@@ -20,7 +20,6 @@ obj-$(CONFIG_RPMB) += rpmb-core.o obj-$(CONFIG_QCOM_COINCELL) += qcom-coincell.o obj-$(CONFIG_QCOM_FASTRPC) += fastrpc.o obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o -obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o obj-$(CONFIG_KGDB_TESTS) += kgdbts.o obj-$(CONFIG_SGI_XP) += sgi-xp/
drivers/misc/apds990x.c deleted +0 -1284
1,284 lines not on this page · raw message
include/linux/platform_data/apds990x.h deleted +0 -65
65 lines not on this page · raw message
Signature · 1 line
2.51.0
Jonathan Cameron
maintainerQuoted 2 lines · On Sat, 25 Apr 2026 15:54:26 +0300 Svyatoslav Ryhel <[email protected]> wrote:
Document Avago APDS9900/9901 ALS/Proximity sensor in schema and add its support to tsl2772 driver.
Applied to the testing branch of iio.git. I'll rebase that on rc1 once available and then push it out as the togreg branch which linux-next picks up.
Thanks,
Jonathan
Quoted 33 lines
---
Changes in v3:
- switched from apds990x to apds9900 in the driver
- fixed misc-devices/index.rts
- expanded and adjusted commit descriptionsChanges in v2:
- dropped all previous patches
- apds990x was documented intsl2772.yaml
- apds990x support was added totsl2772.c
- original apds990x driver removed from misc
---Svyatoslav Ryhel (3):
dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity
sensor
iio: tsl2772: Add support for Avago APDS9900/9901 ALS/Proximity sensor
misc: Remove old APDS990x driver.../bindings/iio/light/tsl2772.yaml | 2 + Documentation/misc-devices/apds990x.rst | 128 -- Documentation/misc-devices/index.rst | 1 - drivers/iio/light/tsl2772.c | 16 + drivers/misc/Kconfig | 10 - drivers/misc/Makefile | 1 - drivers/misc/apds990x.c | 1284 ----------------- include/linux/platform_data/apds990x.h | 65 - 8 files changed, 18 insertions(+), 1489 deletions(-) delete mode 100644 Documentation/misc-devices/apds990x.rst delete mode 100644 drivers/misc/apds990x.c delete mode 100644 include/linux/platform_data/apds990x.h