public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/5] Update APDS990x ALS to support device trees
@ 2026-04-18 14:47 Svyatoslav Ryhel
  2026-04-18 14:47 ` [PATCH v1 1/5] dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor Svyatoslav Ryhel
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Svyatoslav Ryhel @ 2026-04-18 14:47 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Svyatoslav Ryhel, Randy Dunlap
  Cc: linux-iio, devicetree, linux-kernel

Document Avago APDS9900/9901 ALS/Proximity sensor in schema and modernize
its driver to support OF bindings.

Svyatoslav Ryhel (5):
  dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity
    sensor
  misc: apds990x: Use more device managed approach in the probe
  misc: apds990x: Drop Vled supply
  misc: apds990x: Convert to use OF bindings
  misc: apds990x: Drop IRQF_TRIGGER_LOW trigger

 .../bindings/iio/light/avago,apds9900.yaml    |  83 ++++++++
 drivers/misc/apds990x.c                       | 197 +++++++++---------
 include/linux/platform_data/apds990x.h        |  65 ------
 3 files changed, 187 insertions(+), 158 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml
 delete mode 100644 include/linux/platform_data/apds990x.h

-- 
2.51.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v1 1/5] dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor
  2026-04-18 14:47 [PATCH v1 0/5] Update APDS990x ALS to support device trees Svyatoslav Ryhel
@ 2026-04-18 14:47 ` Svyatoslav Ryhel
  2026-04-18 16:21   ` David Lechner
  2026-04-18 14:47 ` [PATCH v1 2/5] misc: apds990x: Use more device managed approach in the probe Svyatoslav Ryhel
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Svyatoslav Ryhel @ 2026-04-18 14:47 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Svyatoslav Ryhel, Randy Dunlap
  Cc: linux-iio, devicetree, linux-kernel

Document Avago APDS-9900/9901 combined ALS/IR-LED/Proximity sensor.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 .../bindings/iio/light/avago,apds9900.yaml    | 83 +++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml

diff --git a/Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml b/Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml
new file mode 100644
index 000000000000..f5fb79439e56
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/light/avago,apds9900.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Avago APDS-9900/9901 combined ALS/IR-LED/Proximity sensor
+
+maintainers:
+  - Svyatoslav Ryhel <clamor95@gmail.com>
+
+description: |
+  The APDS-9900/9901 provides digital ambient light sensing (ALS),
+  IR LED and a complete proximity detection system in a single
+  8 pin package over I2C interface.
+  Datasheet at https://docs.broadcom.com/doc/AV02-2867EN
+
+properties:
+  compatible:
+    enum:
+      - avago,apds9900
+      - avago,apds9901
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vdd-supply: true
+
+  avago,pdrive-microamp:
+    description:
+      The LED drive current is controlled by a regulated current
+      sink on the LDR pin. This feature eliminates the need to use
+      a current limiting resistor to control LED current. The LED
+      drive current can be configured for 12.5 mA, 25 mA, 50 mA
+      or 100 mA. For higher LED drive requirements, an external
+      P type transistor can be used to control the LED current.
+    enum: [12500, 25000, 50000, 100000]
+    default: 100000
+
+  avago,ppcount:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      The number of LED pulses can be programmed to a value of 1 to
+      255 pulses as needed. Increasing the number of LED pulses at a
+      given current will increase the sensor sensitivity. Sensitivity
+      grows by the square root of the number of pulses. Each pulse
+      has a 16 mS period.
+    minimum: 1
+    maximum: 255
+    default: 1
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        light-sensor@39 {
+            compatible = "avago,apds9900";
+            reg = <0x39>;
+
+            interrupt-parent = <&gpio>;
+            interrupts = <82 IRQ_TYPE_EDGE_RISING>;
+
+            vdd-supply = <&vdd_2v85_als>;
+
+            avago,pdrive-microamp = <100000>;
+            avago,ppcount = <3>;
+        };
+    };
+...
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 2/5] misc: apds990x: Use more device managed approach in the probe
  2026-04-18 14:47 [PATCH v1 0/5] Update APDS990x ALS to support device trees Svyatoslav Ryhel
  2026-04-18 14:47 ` [PATCH v1 1/5] dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor Svyatoslav Ryhel
@ 2026-04-18 14:47 ` Svyatoslav Ryhel
  2026-04-18 14:47 ` [PATCH v1 3/5] misc: apds990x: Drop Vled supply Svyatoslav Ryhel
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Svyatoslav Ryhel @ 2026-04-18 14:47 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Svyatoslav Ryhel, Randy Dunlap
  Cc: linux-iio, devicetree, linux-kernel

No functional changes to the driver. The probe code was refactored to
switch to devm_ versions of functions and reduce the nesting of labels.
This is in preparation for OF conversion and platform data removal.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/misc/apds990x.c | 80 +++++++++++++++--------------------------
 1 file changed, 28 insertions(+), 52 deletions(-)

diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index b69c3a1c94d1..742ab331a221 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -1053,9 +1053,10 @@ static const struct attribute_group apds990x_attribute_group[] = {
 static int apds990x_probe(struct i2c_client *client)
 {
 	struct apds990x_chip *chip;
+	struct device *dev = &client->dev;
 	int err;
 
-	chip = kzalloc_obj(*chip);
+	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
 	if (!chip)
 		return -ENOMEM;
 
@@ -1066,11 +1067,8 @@ static int apds990x_probe(struct i2c_client *client)
 	mutex_init(&chip->mutex);
 	chip->pdata	= client->dev.platform_data;
 
-	if (chip->pdata == NULL) {
-		dev_err(&client->dev, "platform data is mandatory\n");
-		err = -EINVAL;
-		goto fail1;
-	}
+	if (chip->pdata == NULL)
+		return dev_err_probe(dev, -EINVAL, "platform data is mandatory\n");
 
 	if (chip->pdata->cf.ga == 0) {
 		/* set uncovered sensor default parameters */
@@ -1113,75 +1111,61 @@ static int apds990x_probe(struct i2c_client *client)
 	chip->regs[0].supply = reg_vcc;
 	chip->regs[1].supply = reg_vled;
 
-	err = regulator_bulk_get(&client->dev,
-				 ARRAY_SIZE(chip->regs), chip->regs);
-	if (err < 0) {
-		dev_err(&client->dev, "Cannot get regulators\n");
-		goto fail1;
-	}
+	err = devm_regulator_bulk_get(dev, ARRAY_SIZE(chip->regs), chip->regs);
+	if (err)
+		return dev_err_probe(dev, err, "failed to get supplies\n");
 
 	err = regulator_bulk_enable(ARRAY_SIZE(chip->regs), chip->regs);
-	if (err < 0) {
-		dev_err(&client->dev, "Cannot enable regulators\n");
-		goto fail2;
-	}
+	if (err < 0)
+		return dev_err_probe(dev, err, "cannot enable regulators\n");
 
 	usleep_range(APDS_STARTUP_DELAY, 2 * APDS_STARTUP_DELAY);
 
 	err = apds990x_detect(chip);
 	if (err < 0) {
-		dev_err(&client->dev, "APDS990X not found\n");
-		goto fail3;
+		dev_err(dev, "APDS990X not found\n");
+		goto error_regulator;
 	}
 
-	pm_runtime_set_active(&client->dev);
+	pm_runtime_set_active(dev);
 
 	apds990x_configure(chip);
 	apds990x_set_arate(chip, APDS_LUX_DEFAULT_RATE);
 	apds990x_mode_on(chip);
 
-	pm_runtime_enable(&client->dev);
+	pm_runtime_enable(dev);
 
 	if (chip->pdata->setup_resources) {
 		err = chip->pdata->setup_resources();
 		if (err) {
 			err = -EINVAL;
-			goto fail4;
+			goto error_pm;
 		}
 	}
 
-	err = sysfs_create_group(&chip->client->dev.kobj,
-				apds990x_attribute_group);
+	err = devm_device_add_group(dev, apds990x_attribute_group);
 	if (err < 0) {
-		dev_err(&chip->client->dev, "Sysfs registration failed\n");
-		goto fail5;
+		dev_err(dev, "Sysfs registration failed\n");
+		goto error_resourses;
 	}
 
-	err = request_threaded_irq(client->irq, NULL,
-				apds990x_irq,
-				IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW |
-				IRQF_ONESHOT,
-				"apds990x", chip);
+	err = devm_request_threaded_irq(dev, client->irq, NULL, apds990x_irq,
+					IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW |
+					IRQF_ONESHOT, "apds990x", chip);
 	if (err) {
-		dev_err(&client->dev, "could not get IRQ %d\n",
-			client->irq);
-		goto fail6;
+		dev_err(dev, "could not get IRQ %d\n", client->irq);
+		goto error_resourses;
 	}
+
 	return err;
-fail6:
-	sysfs_remove_group(&chip->client->dev.kobj,
-			&apds990x_attribute_group[0]);
-fail5:
+error_resourses:
 	if (chip->pdata && chip->pdata->release_resources)
 		chip->pdata->release_resources();
-fail4:
-	pm_runtime_disable(&client->dev);
-fail3:
+error_pm:
+	pm_runtime_disable(dev);
+error_regulator:
 	regulator_bulk_disable(ARRAY_SIZE(chip->regs), chip->regs);
-fail2:
-	regulator_bulk_free(ARRAY_SIZE(chip->regs), chip->regs);
-fail1:
-	kfree(chip);
+
 	return err;
 }
 
@@ -1189,10 +1173,6 @@ static void apds990x_remove(struct i2c_client *client)
 {
 	struct apds990x_chip *chip = i2c_get_clientdata(client);
 
-	free_irq(client->irq, chip);
-	sysfs_remove_group(&chip->client->dev.kobj,
-			apds990x_attribute_group);
-
 	if (chip->pdata && chip->pdata->release_resources)
 		chip->pdata->release_resources();
 
@@ -1201,10 +1181,6 @@ static void apds990x_remove(struct i2c_client *client)
 
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
-
-	regulator_bulk_free(ARRAY_SIZE(chip->regs), chip->regs);
-
-	kfree(chip);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 3/5] misc: apds990x: Drop Vled supply
  2026-04-18 14:47 [PATCH v1 0/5] Update APDS990x ALS to support device trees Svyatoslav Ryhel
  2026-04-18 14:47 ` [PATCH v1 1/5] dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor Svyatoslav Ryhel
  2026-04-18 14:47 ` [PATCH v1 2/5] misc: apds990x: Use more device managed approach in the probe Svyatoslav Ryhel
@ 2026-04-18 14:47 ` Svyatoslav Ryhel
  2026-04-18 14:47 ` [PATCH v1 4/5] misc: apds990x: Convert to use OF bindings Svyatoslav Ryhel
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Svyatoslav Ryhel @ 2026-04-18 14:47 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Svyatoslav Ryhel, Randy Dunlap
  Cc: linux-iio, devicetree, linux-kernel

According to the APDS9900/9901 documentation, this chip has only one
supply, VDD; hence, drop the Vled supply. Additionally, supply has been
set to lowercase for consistency.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/misc/apds990x.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index 742ab331a221..264335b581c1 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -113,7 +113,7 @@ struct apds990x_chip {
 	struct apds990x_platform_data	*pdata;
 	struct i2c_client		*client;
 	struct mutex			mutex; /* avoid parallel access */
-	struct regulator_bulk_data	regs[2];
+	struct regulator		*vdd_supply;
 	wait_queue_head_t		wait;
 
 	int	prox_en;
@@ -179,10 +179,6 @@ static const u8 again[]	= {1, 8, 16, 120}; /* ALS gain steps */
 static const u16 arates_hz[] = {10, 5, 2, 1};
 static const u8 apersis[] = {1, 2, 4, 5};
 
-/* Regulators */
-static const char reg_vcc[] = "Vdd";
-static const char reg_vled[] = "Vled";
-
 static int apds990x_read_byte(struct apds990x_chip *chip, u8 reg, u8 *data)
 {
 	struct i2c_client *client = chip->client;
@@ -597,8 +593,9 @@ static int apds990x_detect(struct apds990x_chip *chip)
 #ifdef CONFIG_PM
 static int apds990x_chip_on(struct apds990x_chip *chip)
 {
-	int err	 = regulator_bulk_enable(ARRAY_SIZE(chip->regs),
-					chip->regs);
+	int err;
+
+	err = regulator_enable(chip->vdd_supply);
 	if (err < 0)
 		return err;
 
@@ -615,7 +612,7 @@ static int apds990x_chip_on(struct apds990x_chip *chip)
 static int apds990x_chip_off(struct apds990x_chip *chip)
 {
 	apds990x_write_byte(chip, APDS990X_ENABLE, APDS990X_EN_DISABLE_ALL);
-	regulator_bulk_disable(ARRAY_SIZE(chip->regs), chip->regs);
+	regulator_disable(chip->vdd_supply);
 	return 0;
 }
 
@@ -1108,14 +1105,12 @@ static int apds990x_probe(struct i2c_client *client)
 	chip->prox_persistence = APDS_DEFAULT_PROX_PERS;
 	chip->prox_continuous_mode = false;
 
-	chip->regs[0].supply = reg_vcc;
-	chip->regs[1].supply = reg_vled;
-
-	err = devm_regulator_bulk_get(dev, ARRAY_SIZE(chip->regs), chip->regs);
-	if (err)
-		return dev_err_probe(dev, err, "failed to get supplies\n");
+	chip->vdd_supply = devm_regulator_get(dev, "vdd");
+	if (IS_ERR(chip->vdd_supply))
+		return dev_err_probe(dev, PTR_ERR(chip->vdd_supply),
+				     "failed to get vdd-supply\n");
 
-	err = regulator_bulk_enable(ARRAY_SIZE(chip->regs), chip->regs);
+	err = regulator_enable(chip->vdd_supply);
 	if (err < 0)
 		return dev_err_probe(dev, err, "cannot enable regulators\n");
 
@@ -1164,7 +1159,7 @@ static int apds990x_probe(struct i2c_client *client)
 error_pm:
 	pm_runtime_disable(dev);
 error_regulator:
-	regulator_bulk_disable(ARRAY_SIZE(chip->regs), chip->regs);
+	regulator_disable(chip->vdd_supply);
 
 	return err;
 }
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 4/5] misc: apds990x: Convert to use OF bindings
  2026-04-18 14:47 [PATCH v1 0/5] Update APDS990x ALS to support device trees Svyatoslav Ryhel
                   ` (2 preceding siblings ...)
  2026-04-18 14:47 ` [PATCH v1 3/5] misc: apds990x: Drop Vled supply Svyatoslav Ryhel
@ 2026-04-18 14:47 ` Svyatoslav Ryhel
  2026-04-18 14:47 ` [PATCH v1 5/5] misc: apds990x: Drop IRQF_TRIGGER_LOW trigger Svyatoslav Ryhel
  2026-04-18 16:24 ` [PATCH v1 0/5] Update APDS990x ALS to support device trees David Lechner
  5 siblings, 0 replies; 12+ messages in thread
From: Svyatoslav Ryhel @ 2026-04-18 14:47 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Svyatoslav Ryhel, Randy Dunlap
  Cc: linux-iio, devicetree, linux-kernel

Since there are no users of this driver via platform data, remove platform
data and switch to using device tree bindings.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/misc/apds990x.c                | 112 +++++++++++++++++--------
 include/linux/platform_data/apds990x.h |  65 --------------
 2 files changed, 76 insertions(+), 101 deletions(-)
 delete mode 100644 include/linux/platform_data/apds990x.h

diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index 264335b581c1..557c8476ea80 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -12,13 +12,14 @@
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
+#include <linux/mod_devicetable.h>
 #include <linux/mutex.h>
+#include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/delay.h>
 #include <linux/wait.h>
 #include <linux/slab.h>
-#include <linux/platform_data/apds990x.h>
 
 /* Register map */
 #define APDS990X_ENABLE	 0x00 /* Enable of states and interrupts */
@@ -100,6 +101,36 @@
 
 #define APDS990X_LUX_OUTPUT_SCALE 10
 
+#define APDS_IRLED_CURR_12mA	0x3
+#define APDS_IRLED_CURR_25mA	0x2
+#define APDS_IRLED_CURR_50mA	0x1
+#define APDS_IRLED_CURR_100mA	0x0
+
+#define APDS_PARAM_SCALE	4096
+
+/**
+ * struct apds990x_chip_factors - defines effect of the cover window
+ * @ga: Total glass attenuation
+ * @cf1: clear channel factor 1 for raw to lux conversion
+ * @irf1: IR channel factor 1 for raw to lux conversion
+ * @cf2: clear channel factor 2 for raw to lux conversion
+ * @irf2: IR channel factor 2 for raw to lux conversion
+ * @df: device factor for conversion formulas
+ *
+ * Structure for tuning ALS calculation to match with environment.
+ * Values depend on the material above the sensor and the sensor
+ * itself. If the GA is zero, driver will use uncovered sensor default values
+ * format: decimal value * APDS_PARAM_SCALE except df which is plain integer.
+ */
+struct apds990x_chip_factors {
+	int ga;
+	int cf1;
+	int irf1;
+	int cf2;
+	int irf2;
+	int df;
+};
+
 /* Reverse chip factors for threshold calculation */
 struct reverse_factors {
 	u32 afactor;
@@ -110,7 +141,6 @@ struct reverse_factors {
 };
 
 struct apds990x_chip {
-	struct apds990x_platform_data	*pdata;
 	struct i2c_client		*client;
 	struct mutex			mutex; /* avoid parallel access */
 	struct regulator		*vdd_supply;
@@ -131,6 +161,7 @@ struct apds990x_chip {
 	u8	pgain;
 	u8	pdiode;
 	u8	pdrive;
+	u8	ppcount;
 	u8	lux_persistence;
 	u8	prox_persistence;
 
@@ -546,7 +577,7 @@ static int apds990x_configure(struct apds990x_chip *chip)
 			(chip->lux_persistence << APDS990X_APERS_SHIFT) |
 			(chip->prox_persistence << APDS990X_PPERS_SHIFT));
 
-	apds990x_write_byte(chip, APDS990X_PPCOUNT, chip->pdata->ppcount);
+	apds990x_write_byte(chip, APDS990X_PPCOUNT, chip->ppcount);
 
 	/* Start with relatively small gain */
 	chip->again_meas = 1;
@@ -1051,6 +1082,7 @@ static int apds990x_probe(struct i2c_client *client)
 {
 	struct apds990x_chip *chip;
 	struct device *dev = &client->dev;
+	u32 pdrive_ua = 100000, ppcount = 1;
 	int err;
 
 	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
@@ -1062,22 +1094,14 @@ static int apds990x_probe(struct i2c_client *client)
 
 	init_waitqueue_head(&chip->wait);
 	mutex_init(&chip->mutex);
-	chip->pdata	= client->dev.platform_data;
-
-	if (chip->pdata == NULL)
-		return dev_err_probe(dev, -EINVAL, "platform data is mandatory\n");
-
-	if (chip->pdata->cf.ga == 0) {
-		/* set uncovered sensor default parameters */
-		chip->cf.ga = 1966; /* 0.48 * APDS_PARAM_SCALE */
-		chip->cf.cf1 = 4096; /* 1.00 * APDS_PARAM_SCALE */
-		chip->cf.irf1 = 9134; /* 2.23 * APDS_PARAM_SCALE */
-		chip->cf.cf2 = 2867; /* 0.70 * APDS_PARAM_SCALE */
-		chip->cf.irf2 = 5816; /* 1.42 * APDS_PARAM_SCALE */
-		chip->cf.df = 52;
-	} else {
-		chip->cf = chip->pdata->cf;
-	}
+
+	/* set uncovered sensor default parameters */
+	chip->cf.ga = 1966; /* 0.48 * APDS_PARAM_SCALE */
+	chip->cf.cf1 = 4096; /* 1.00 * APDS_PARAM_SCALE */
+	chip->cf.irf1 = 9134; /* 2.23 * APDS_PARAM_SCALE */
+	chip->cf.cf2 = 2867; /* 0.70 * APDS_PARAM_SCALE */
+	chip->cf.irf2 = 5816; /* 1.42 * APDS_PARAM_SCALE */
+	chip->cf.df = 52;
 
 	/* precalculate inverse chip factors for threshold control */
 	chip->rcf.afactor =
@@ -1098,13 +1122,35 @@ static int apds990x_probe(struct i2c_client *client)
 	chip->lux_calib = APDS_LUX_NEUTRAL_CALIB_VALUE;
 
 	chip->prox_thres = APDS_PROX_DEF_THRES;
-	chip->pdrive = chip->pdata->pdrive;
 	chip->pdiode = APDS_PDIODE_IR;
 	chip->pgain = APDS_PGAIN_1X;
 	chip->prox_calib = APDS_PROX_NEUTRAL_CALIB_VALUE;
 	chip->prox_persistence = APDS_DEFAULT_PROX_PERS;
 	chip->prox_continuous_mode = false;
 
+	err = device_property_read_u32(dev, "avago,pdrive-microamp", &pdrive_ua);
+	if (!err) {
+		switch (pdrive_ua) {
+		case 12500:
+			chip->pdrive = APDS_IRLED_CURR_12mA;
+			break;
+		case 25000:
+			chip->pdrive = APDS_IRLED_CURR_25mA;
+			break;
+		case 50000:
+			chip->pdrive = APDS_IRLED_CURR_50mA;
+			break;
+		case 100000:
+			chip->pdrive = APDS_IRLED_CURR_100mA;
+			break;
+		default:
+			return -EINVAL;
+		}
+	}
+
+	device_property_read_u32(dev, "avago,ppcount", &ppcount);
+	chip->ppcount = ppcount;
+
 	chip->vdd_supply = devm_regulator_get(dev, "vdd");
 	if (IS_ERR(chip->vdd_supply))
 		return dev_err_probe(dev, PTR_ERR(chip->vdd_supply),
@@ -1130,18 +1176,10 @@ static int apds990x_probe(struct i2c_client *client)
 
 	pm_runtime_enable(dev);
 
-	if (chip->pdata->setup_resources) {
-		err = chip->pdata->setup_resources();
-		if (err) {
-			err = -EINVAL;
-			goto error_pm;
-		}
-	}
-
 	err = devm_device_add_group(dev, apds990x_attribute_group);
 	if (err < 0) {
 		dev_err(dev, "Sysfs registration failed\n");
-		goto error_resourses;
+		goto error_pm;
 	}
 
 	err = devm_request_threaded_irq(dev, client->irq, NULL, apds990x_irq,
@@ -1149,13 +1187,10 @@ static int apds990x_probe(struct i2c_client *client)
 					IRQF_ONESHOT, "apds990x", chip);
 	if (err) {
 		dev_err(dev, "could not get IRQ %d\n", client->irq);
-		goto error_resourses;
+		goto error_pm;
 	}
 
 	return err;
-error_resourses:
-	if (chip->pdata && chip->pdata->release_resources)
-		chip->pdata->release_resources();
 error_pm:
 	pm_runtime_disable(dev);
 error_regulator:
@@ -1168,9 +1203,6 @@ static void apds990x_remove(struct i2c_client *client)
 {
 	struct apds990x_chip *chip = i2c_get_clientdata(client);
 
-	if (chip->pdata && chip->pdata->release_resources)
-		chip->pdata->release_resources();
-
 	if (!pm_runtime_suspended(&client->dev))
 		apds990x_chip_off(chip);
 
@@ -1224,6 +1256,13 @@ static int apds990x_runtime_resume(struct device *dev)
 
 #endif
 
+static const struct of_device_id apds990x_of_match[] = {
+	{ .compatible = "avago,apds9900" },
+	{ .compatible = "avago,apds9901" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, apds990x_of_match);
+
 static const struct i2c_device_id apds990x_id[] = {
 	{ "apds990x" },
 	{}
@@ -1242,6 +1281,7 @@ static struct i2c_driver apds990x_driver = {
 	.driver	  = {
 		.name	= "apds990x",
 		.pm	= &apds990x_pm_ops,
+		.of_match_table = apds990x_of_match,
 	},
 	.probe    = apds990x_probe,
 	.remove	  = apds990x_remove,
diff --git a/include/linux/platform_data/apds990x.h b/include/linux/platform_data/apds990x.h
deleted file mode 100644
index 37684f68c04f..000000000000
--- a/include/linux/platform_data/apds990x.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * This file is part of the APDS990x sensor driver.
- * Chip is combined proximity and ambient light sensor.
- *
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
- *
- * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
- */
-
-#ifndef __APDS990X_H__
-#define __APDS990X_H__
-
-
-#define APDS_IRLED_CURR_12mA	0x3
-#define APDS_IRLED_CURR_25mA	0x2
-#define APDS_IRLED_CURR_50mA	0x1
-#define APDS_IRLED_CURR_100mA	0x0
-
-/**
- * struct apds990x_chip_factors - defines effect of the cover window
- * @ga: Total glass attenuation
- * @cf1: clear channel factor 1 for raw to lux conversion
- * @irf1: IR channel factor 1 for raw to lux conversion
- * @cf2: clear channel factor 2 for raw to lux conversion
- * @irf2: IR channel factor 2 for raw to lux conversion
- * @df: device factor for conversion formulas
- *
- * Structure for tuning ALS calculation to match with environment.
- * Values depend on the material above the sensor and the sensor
- * itself. If the GA is zero, driver will use uncovered sensor default values
- * format: decimal value * APDS_PARAM_SCALE except df which is plain integer.
- */
-struct apds990x_chip_factors {
-	int ga;
-	int cf1;
-	int irf1;
-	int cf2;
-	int irf2;
-	int df;
-};
-#define APDS_PARAM_SCALE 4096
-
-/**
- * struct apds990x_platform_data - platform data for apsd990x.c driver
- * @cf: chip factor data
- * @pdrive: IR-led driving current
- * @ppcount: number of IR pulses used for proximity estimation
- * @setup_resources: interrupt line setup call back function
- * @release_resources: interrupt line release call back function
- *
- * Proximity detection result depends heavily on correct ppcount, pdrive
- * and cover window.
- *
- */
-
-struct apds990x_platform_data {
-	struct apds990x_chip_factors cf;
-	u8     pdrive;
-	u8     ppcount;
-	int    (*setup_resources)(void);
-	int    (*release_resources)(void);
-};
-
-#endif
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 5/5] misc: apds990x: Drop IRQF_TRIGGER_LOW trigger
  2026-04-18 14:47 [PATCH v1 0/5] Update APDS990x ALS to support device trees Svyatoslav Ryhel
                   ` (3 preceding siblings ...)
  2026-04-18 14:47 ` [PATCH v1 4/5] misc: apds990x: Convert to use OF bindings Svyatoslav Ryhel
@ 2026-04-18 14:47 ` Svyatoslav Ryhel
  2026-04-18 16:24 ` [PATCH v1 0/5] Update APDS990x ALS to support device trees David Lechner
  5 siblings, 0 replies; 12+ messages in thread
From: Svyatoslav Ryhel @ 2026-04-18 14:47 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Svyatoslav Ryhel, Randy Dunlap
  Cc: linux-iio, devicetree, linux-kernel

Predefined IRQF_TRIGGER_LOW causes a conflict when setting triggers in the
device tree node. Remove IRQF_TRIGGER_LOW from the interrupt; it can be
specified in the device tree if needed.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/misc/apds990x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index 557c8476ea80..51037cdc2c47 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -1183,8 +1183,8 @@ static int apds990x_probe(struct i2c_client *client)
 	}
 
 	err = devm_request_threaded_irq(dev, client->irq, NULL, apds990x_irq,
-					IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW |
-					IRQF_ONESHOT, "apds990x", chip);
+					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+					"apds990x", chip);
 	if (err) {
 		dev_err(dev, "could not get IRQ %d\n", client->irq);
 		goto error_pm;
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 1/5] dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor
  2026-04-18 14:47 ` [PATCH v1 1/5] dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor Svyatoslav Ryhel
@ 2026-04-18 16:21   ` David Lechner
  0 siblings, 0 replies; 12+ messages in thread
From: David Lechner @ 2026-04-18 16:21 UTC (permalink / raw)
  To: Svyatoslav Ryhel, Jonathan Cameron, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Randy Dunlap
  Cc: linux-iio, devicetree, linux-kernel

On 4/18/26 9:47 AM, Svyatoslav Ryhel wrote:
> Document Avago APDS-9900/9901 combined ALS/IR-LED/Proximity sensor.

I think we can just add this to iio/light/tsl2772.yaml. It already has
avago,apds9930 which looks similar.

> 
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
>  .../bindings/iio/light/avago,apds9900.yaml    | 83 +++++++++++++++++++
>  1 file changed, 83 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml b/Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml
> new file mode 100644
> index 000000000000..f5fb79439e56
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml
> @@ -0,0 +1,83 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/light/avago,apds9900.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Avago APDS-9900/9901 combined ALS/IR-LED/Proximity sensor
> +
> +maintainers:
> +  - Svyatoslav Ryhel <clamor95@gmail.com>
> +
> +description: |
> +  The APDS-9900/9901 provides digital ambient light sensing (ALS),
> +  IR LED and a complete proximity detection system in a single
> +  8 pin package over I2C interface.
> +  Datasheet at https://docs.broadcom.com/doc/AV02-2867EN
> +
> +properties:
> +  compatible:
> +    enum:
> +      - avago,apds9900
> +      - avago,apds9901
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  vdd-supply: true
> +
> +  avago,pdrive-microamp:

In tsl2772, this is called led-max-microamp.

> +    description:
> +      The LED drive current is controlled by a regulated current
> +      sink on the LDR pin. This feature eliminates the need to use
> +      a current limiting resistor to control LED current. The LED
> +      drive current can be configured for 12.5 mA, 25 mA, 50 mA
> +      or 100 mA. For higher LED drive requirements, an external
> +      P type transistor can be used to control the LED current.
> +    enum: [12500, 25000, 50000, 100000]
> +    default: 100000
> +
> +  avago,ppcount:

This sounds like something that should be programmed at runtime, not
fixed to a single value in the devicetree. One can easily imaging an
application where the sensitivity needs to be changed as the environment
changes.

> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      The number of LED pulses can be programmed to a value of 1 to
> +      255 pulses as needed. Increasing the number of LED pulses at a
> +      given current will increase the sensor sensitivity. Sensitivity
> +      grows by the square root of the number of pulses. Each pulse
> +      has a 16 mS period.
> +    minimum: 1
> +    maximum: 255
> +    default: 1
> +

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
  2026-04-18 14:47 [PATCH v1 0/5] Update APDS990x ALS to support device trees Svyatoslav Ryhel
                   ` (4 preceding siblings ...)
  2026-04-18 14:47 ` [PATCH v1 5/5] misc: apds990x: Drop IRQF_TRIGGER_LOW trigger Svyatoslav Ryhel
@ 2026-04-18 16:24 ` David Lechner
  2026-04-18 19:48   ` Svyatoslav Ryhel
  2026-04-18 20:18   ` Arnd Bergmann
  5 siblings, 2 replies; 12+ messages in thread
From: David Lechner @ 2026-04-18 16:24 UTC (permalink / raw)
  To: Svyatoslav Ryhel, Jonathan Cameron, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Randy Dunlap
  Cc: linux-iio, devicetree, linux-kernel

On 4/18/26 9:47 AM, Svyatoslav Ryhel wrote:
> Document Avago APDS9900/9901 ALS/Proximity sensor in schema and modernize
> its driver to support OF bindings.
> 
> Svyatoslav Ryhel (5):
>   dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity
>     sensor
>   misc: apds990x: Use more device managed approach in the probe
>   misc: apds990x: Drop Vled supply
>   misc: apds990x: Convert to use OF bindings
>   misc: apds990x: Drop IRQF_TRIGGER_LOW trigger
> 
>  .../bindings/iio/light/avago,apds9900.yaml    |  83 ++++++++
>  drivers/misc/apds990x.c                       | 197 +++++++++---------

As mentioned in my reply to the dt-bindings patch, there is already an
IIO driver that looks like it could be compatible. I'm guessing that
this misc driver pre-dates the IIO subsystem. I would have a look at it
instead (drivers/iio/light/tsl2772.c).

>  include/linux/platform_data/apds990x.h        |  65 ------
>  3 files changed, 187 insertions(+), 158 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml
>  delete mode 100644 include/linux/platform_data/apds990x.h
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
  2026-04-18 16:24 ` [PATCH v1 0/5] Update APDS990x ALS to support device trees David Lechner
@ 2026-04-18 19:48   ` Svyatoslav Ryhel
  2026-04-18 22:18     ` David Lechner
  2026-04-18 20:18   ` Arnd Bergmann
  1 sibling, 1 reply; 12+ messages in thread
From: Svyatoslav Ryhel @ 2026-04-18 19:48 UTC (permalink / raw)
  To: David Lechner
  Cc: Jonathan Cameron, Nuno Sá, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Randy Dunlap, linux-iio, devicetree,
	linux-kernel

сб, 18 квіт. 2026 р. о 19:24 David Lechner <dlechner@baylibre.com> пише:
>
> On 4/18/26 9:47 AM, Svyatoslav Ryhel wrote:
> > Document Avago APDS9900/9901 ALS/Proximity sensor in schema and modernize
> > its driver to support OF bindings.
> >
> > Svyatoslav Ryhel (5):
> >   dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity
> >     sensor
> >   misc: apds990x: Use more device managed approach in the probe
> >   misc: apds990x: Drop Vled supply
> >   misc: apds990x: Convert to use OF bindings
> >   misc: apds990x: Drop IRQF_TRIGGER_LOW trigger
> >
> >  .../bindings/iio/light/avago,apds9900.yaml    |  83 ++++++++
> >  drivers/misc/apds990x.c                       | 197 +++++++++---------
>
> As mentioned in my reply to the dt-bindings patch, there is already an
> IIO driver that looks like it could be compatible. I'm guessing that
> this misc driver pre-dates the IIO subsystem. I would have a look at it
> instead (drivers/iio/light/tsl2772.c).
>

tsl2772 driver fits, thanks for pointing out. Maybe you know how
apds9930 lux table was calculated? It is quite obscure to me.

Obviously this patchset is obsolete and different set of changes is required.

> >  include/linux/platform_data/apds990x.h        |  65 ------
> >  3 files changed, 187 insertions(+), 158 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml
> >  delete mode 100644 include/linux/platform_data/apds990x.h
> >
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
  2026-04-18 16:24 ` [PATCH v1 0/5] Update APDS990x ALS to support device trees David Lechner
  2026-04-18 19:48   ` Svyatoslav Ryhel
@ 2026-04-18 20:18   ` Arnd Bergmann
  2026-04-19  8:00     ` Svyatoslav Ryhel
  1 sibling, 1 reply; 12+ messages in thread
From: Arnd Bergmann @ 2026-04-18 20:18 UTC (permalink / raw)
  To: David Lechner, Svyatoslav Ryhel, Jonathan Cameron, Nuno Sá,
	Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Greg Kroah-Hartman, Randy Dunlap
  Cc: linux-iio, devicetree, linux-kernel

On Sat, Apr 18, 2026, at 18:24, David Lechner wrote:
> On 4/18/26 9:47 AM, Svyatoslav Ryhel wrote:
>> Document Avago APDS9900/9901 ALS/Proximity sensor in schema and modernize
>> its driver to support OF bindings.
>> 
>> Svyatoslav Ryhel (5):
>>   dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity
>>     sensor
>>   misc: apds990x: Use more device managed approach in the probe
>>   misc: apds990x: Drop Vled supply
>>   misc: apds990x: Convert to use OF bindings
>>   misc: apds990x: Drop IRQF_TRIGGER_LOW trigger
>> 
>>  .../bindings/iio/light/avago,apds9900.yaml    |  83 ++++++++
>>  drivers/misc/apds990x.c                       | 197 +++++++++---------
>
> As mentioned in my reply to the dt-bindings patch, there is already an
> IIO driver that looks like it could be compatible. I'm guessing that
> this misc driver pre-dates the IIO subsystem. I would have a look at it
> instead (drivers/iio/light/tsl2772.c).

I see that we have a number of ALS drivers like this one in drivers/misc:

drivers/misc/apds9802als.c
drivers/misc/apds990x.c
drivers/misc/bh1770glc.c
drivers/misc/isl29020.c
drivers/misc/isl29003.c

As far as I can tell, all of these are entirely unused, with nothing
in the kernel creating the platform devices. The drivers that used
instead have all been converted to drivers/iio a long time ago.

Is it time to remove all of the above?

The notable exception is drivers/misc/tsl2550.c, which is instantiated
from both arch/arm/boot/dts/ti/omap/am335x-evm.dts and
drivers/i2c/busses/i2c-taos-evm.c. There is a similarly named
drivers/iio/light/tsl2563.c driver, but unfortunately that uses
a completely different register level interface.

      Arnd

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
  2026-04-18 19:48   ` Svyatoslav Ryhel
@ 2026-04-18 22:18     ` David Lechner
  0 siblings, 0 replies; 12+ messages in thread
From: David Lechner @ 2026-04-18 22:18 UTC (permalink / raw)
  To: Svyatoslav Ryhel
  Cc: Jonathan Cameron, Nuno Sá, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Arnd Bergmann,
	Greg Kroah-Hartman, Randy Dunlap, linux-iio, devicetree,
	linux-kernel

On 4/18/26 2:48 PM, Svyatoslav Ryhel wrote:
> сб, 18 квіт. 2026 р. о 19:24 David Lechner <dlechner@baylibre.com> пише:
>>
>> On 4/18/26 9:47 AM, Svyatoslav Ryhel wrote:
>>> Document Avago APDS9900/9901 ALS/Proximity sensor in schema and modernize
>>> its driver to support OF bindings.
>>>
>>> Svyatoslav Ryhel (5):
>>>   dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity
>>>     sensor
>>>   misc: apds990x: Use more device managed approach in the probe
>>>   misc: apds990x: Drop Vled supply
>>>   misc: apds990x: Convert to use OF bindings
>>>   misc: apds990x: Drop IRQF_TRIGGER_LOW trigger
>>>
>>>  .../bindings/iio/light/avago,apds9900.yaml    |  83 ++++++++
>>>  drivers/misc/apds990x.c                       | 197 +++++++++---------
>>
>> As mentioned in my reply to the dt-bindings patch, there is already an
>> IIO driver that looks like it could be compatible. I'm guessing that
>> this misc driver pre-dates the IIO subsystem. I would have a look at it
>> instead (drivers/iio/light/tsl2772.c).
>>
> 
> tsl2772 driver fits, thanks for pointing out. Maybe you know how
> apds9930 lux table was calculated? It is quite obscure to me.

The tsl2772 driver says:

/*
 * Different devices require different coefficents, and these numbers were
 * derived from the 'Lux Equation' section of the various device datasheets.
 * All of these coefficients assume a Glass Attenuation (GA) factor of 1.
 * The coefficients are multiplied by 1000 to avoid floating point operations.
 * The two rows in each table correspond to the Lux1 and Lux2 equations from
 * the datasheets.
 */

So probably just need to look up the A tsl datasheet and compare it to the
apds datasheet. The apds has some equations with GA, so just need to figure
out what Lux1 and Lux2 correspond to.

> 
> Obviously this patchset is obsolete and different set of changes is required.
> 
>>>  include/linux/platform_data/apds990x.h        |  65 ------
>>>  3 files changed, 187 insertions(+), 158 deletions(-)
>>>  create mode 100644 Documentation/devicetree/bindings/iio/light/avago,apds9900.yaml
>>>  delete mode 100644 include/linux/platform_data/apds990x.h
>>>
>>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
  2026-04-18 20:18   ` Arnd Bergmann
@ 2026-04-19  8:00     ` Svyatoslav Ryhel
  0 siblings, 0 replies; 12+ messages in thread
From: Svyatoslav Ryhel @ 2026-04-19  8:00 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David Lechner, Jonathan Cameron, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Greg Kroah-Hartman, Randy Dunlap, linux-iio, devicetree,
	linux-kernel

сб, 18 квіт. 2026 р. о 23:21 Arnd Bergmann <arnd@arndb.de> пише:
>
> On Sat, Apr 18, 2026, at 18:24, David Lechner wrote:
> > On 4/18/26 9:47 AM, Svyatoslav Ryhel wrote:
> >> Document Avago APDS9900/9901 ALS/Proximity sensor in schema and modernize
> >> its driver to support OF bindings.
> >>
> >> Svyatoslav Ryhel (5):
> >>   dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity
> >>     sensor
> >>   misc: apds990x: Use more device managed approach in the probe
> >>   misc: apds990x: Drop Vled supply
> >>   misc: apds990x: Convert to use OF bindings
> >>   misc: apds990x: Drop IRQF_TRIGGER_LOW trigger
> >>
> >>  .../bindings/iio/light/avago,apds9900.yaml    |  83 ++++++++
> >>  drivers/misc/apds990x.c                       | 197 +++++++++---------
> >
> > As mentioned in my reply to the dt-bindings patch, there is already an
> > IIO driver that looks like it could be compatible. I'm guessing that
> > this misc driver pre-dates the IIO subsystem. I would have a look at it
> > instead (drivers/iio/light/tsl2772.c).
>
> I see that we have a number of ALS drivers like this one in drivers/misc:
>
> drivers/misc/apds9802als.c
> drivers/misc/apds990x.c
> drivers/misc/bh1770glc.c
> drivers/misc/isl29020.c
> drivers/misc/isl29003.c
>
> As far as I can tell, all of these are entirely unused, with nothing
> in the kernel creating the platform devices. The drivers that used
> instead have all been converted to drivers/iio a long time ago.
>
> Is it time to remove all of the above?
>

I will remove APDS990x from misc in v2 since this one I can convert it
to use tsl2772 instead.

> The notable exception is drivers/misc/tsl2550.c, which is instantiated
> from both arch/arm/boot/dts/ti/omap/am335x-evm.dts and
> drivers/i2c/busses/i2c-taos-evm.c. There is a similarly named
> drivers/iio/light/tsl2563.c driver, but unfortunately that uses
> a completely different register level interface.
>
>       Arnd

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-04-19  8:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-18 14:47 [PATCH v1 0/5] Update APDS990x ALS to support device trees Svyatoslav Ryhel
2026-04-18 14:47 ` [PATCH v1 1/5] dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor Svyatoslav Ryhel
2026-04-18 16:21   ` David Lechner
2026-04-18 14:47 ` [PATCH v1 2/5] misc: apds990x: Use more device managed approach in the probe Svyatoslav Ryhel
2026-04-18 14:47 ` [PATCH v1 3/5] misc: apds990x: Drop Vled supply Svyatoslav Ryhel
2026-04-18 14:47 ` [PATCH v1 4/5] misc: apds990x: Convert to use OF bindings Svyatoslav Ryhel
2026-04-18 14:47 ` [PATCH v1 5/5] misc: apds990x: Drop IRQF_TRIGGER_LOW trigger Svyatoslav Ryhel
2026-04-18 16:24 ` [PATCH v1 0/5] Update APDS990x ALS to support device trees David Lechner
2026-04-18 19:48   ` Svyatoslav Ryhel
2026-04-18 22:18     ` David Lechner
2026-04-18 20:18   ` Arnd Bergmann
2026-04-19  8:00     ` Svyatoslav Ryhel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox