[PATCH v1 0/5] Update APDS990x ALS to support device trees

Svyatoslav Ryhel posted 5 patches 2 months ago
There is a newer version of this series
.../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
[PATCH v1 0/5] Update APDS990x ALS to support device trees
Posted by Svyatoslav Ryhel 2 months ago
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
Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
Posted by David Lechner 2 months ago
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
>
Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
Posted by Arnd Bergmann 2 months ago
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
Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
Posted by Svyatoslav Ryhel 2 months ago
сб, 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
Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
Posted by Svyatoslav Ryhel 2 months ago
сб, 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
> >
>
Re: [PATCH v1 0/5] Update APDS990x ALS to support device trees
Posted by David Lechner 2 months ago
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
>>>
>>