[PATCH 1/2] dt-bindings: iio: light: Add APDS9160 binding

Mikael Gonella-Bolduc via B4 Relay posted 2 patches 1 year, 2 months ago
There is a newer version of this series
[PATCH 1/2] dt-bindings: iio: light: Add APDS9160 binding
Posted by Mikael Gonella-Bolduc via B4 Relay 1 year, 2 months ago
From: Mikael Gonella-Bolduc <mgonellabolduc@dimonoff.com>

Add device tree bindings for APDS9160 driver

Signed-off-by: Mikael Gonella-Bolduc <mgonellabolduc@dimonoff.com>
---
 .../bindings/iio/light/avago,apds9160.yaml         | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml b/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..12e196b297fe523e4d324156041ef9c6900676eb
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/light/avago,apds9160.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom Combined Proximity & Ambient light sensor
+
+maintainers:
+  - Mikael Gonella-Bolduc <m.gonella.bolduc@gmail.com>
+
+description: |
+  Datasheet: https://docs.broadcom.com/docs/APDS-9160-003-DS
+
+properties:
+  compatible:
+    enum:
+      - avago,apds9160
+      - broadmobi,apds9160
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vdd-supply: true
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        apds9160@53 {
+          compatible = "broadmobi,apds9160";
+          reg = <0x53>;
+          interrupts = <29 IRQ_TYPE_EDGE_FALLING>;
+          interrupt-parent = <&pinctrl>;
+        };
+    };
+...

-- 
2.34.1
Re: [PATCH 1/2] dt-bindings: iio: light: Add APDS9160 binding
Posted by Krzysztof Kozlowski 1 year, 2 months ago
On 19/11/2024 21:36, Mikael Gonella-Bolduc via B4 Relay wrote:
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  vdd-supply: true
> +
> +additionalProperties: false

This goes after required:

> +
> +required:
> +  - compatible
> +  - reg

Supply not required?

> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        apds9160@53 {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


> +          compatible = "broadmobi,apds9160";

Use 4 spaces for example indentation. Or at least something consistent.


Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: iio: light: Add APDS9160 binding
Posted by Jonathan Cameron 1 year, 2 months ago
On Wed, 20 Nov 2024 18:22:43 +0100
Krzysztof Kozlowski <krzk@kernel.org> wrote:

> On 19/11/2024 21:36, Mikael Gonella-Bolduc via B4 Relay wrote:
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  vdd-supply: true
> > +
> > +additionalProperties: false  
> 
> This goes after required:
> 
> > +
> > +required:
> > +  - compatible
> > +  - reg  
> 
> Supply not required?

Just for background on this.  Linux will happily provide
you a stub regulator if the supply is not in dt, but we decided a while ago
that it was more accurate to have the supplies as required properties as that
would allow us to distinguish between those that are needed for operation
and those that are actually optional like reference voltages where there
is the option of an on chip reference if the external one isn't connected.

So almost certainly just make it required here.

Jonathan

> 
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/irq.h>
> > +
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        apds9160@53 {  
> 
> Node names should be generic. See also an explanation and list of
> examples (not exhaustive) in DT specification:
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
> 
> 
> > +          compatible = "broadmobi,apds9160";  
> 
> Use 4 spaces for example indentation. Or at least something consistent.
> 
> 
> Best regards,
> Krzysztof
>
Re: [PATCH 1/2] dt-bindings: iio: light: Add APDS9160 binding
Posted by Conor Dooley 1 year, 2 months ago
On Tue, Nov 19, 2024 at 03:36:56PM -0500, Mikael Gonella-Bolduc via B4 Relay wrote:
> From: Mikael Gonella-Bolduc <mgonellabolduc@dimonoff.com>
> 
> Add device tree bindings for APDS9160 driver
> 
> Signed-off-by: Mikael Gonella-Bolduc <mgonellabolduc@dimonoff.com>
> ---
>  .../bindings/iio/light/avago,apds9160.yaml         | 50 ++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml b/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..12e196b297fe523e4d324156041ef9c6900676eb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml
> @@ -0,0 +1,50 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/light/avago,apds9160.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Broadcom Combined Proximity & Ambient light sensor
> +
> +maintainers:
> +  - Mikael Gonella-Bolduc <m.gonella.bolduc@gmail.com>
> +
> +description: |
> +  Datasheet: https://docs.broadcom.com/docs/APDS-9160-003-DS
> +
> +properties:
> +  compatible:
> +    enum:
> +      - avago,apds9160
> +      - broadmobi,apds9160

What is the difference between these two devices? There's no match data,
makes it seem like there should be a fallback going on here.

> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  vdd-supply: true
> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        apds9160@53 {
> +          compatible = "broadmobi,apds9160";
> +          reg = <0x53>;
> +          interrupts = <29 IRQ_TYPE_EDGE_FALLING>;
> +          interrupt-parent = <&pinctrl>;
> +        };
> +    };
> +...
> 
> -- 
> 2.34.1
> 
> 
Re: [PATCH 1/2] dt-bindings: iio: light: Add APDS9160 binding
Posted by Krzysztof Kozlowski 1 year, 2 months ago
On 20/11/2024 18:18, Conor Dooley wrote:
> On Tue, Nov 19, 2024 at 03:36:56PM -0500, Mikael Gonella-Bolduc via B4 Relay wrote:
>> From: Mikael Gonella-Bolduc <mgonellabolduc@dimonoff.com>
>>
>> Add device tree bindings for APDS9160 driver
>>
>> Signed-off-by: Mikael Gonella-Bolduc <mgonellabolduc@dimonoff.com>
>> ---
>>  .../bindings/iio/light/avago,apds9160.yaml         | 50 ++++++++++++++++++++++
>>  1 file changed, 50 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml b/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..12e196b297fe523e4d324156041ef9c6900676eb
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml
>> @@ -0,0 +1,50 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/iio/light/avago,apds9160.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Broadcom Combined Proximity & Ambient light sensor
>> +
>> +maintainers:
>> +  - Mikael Gonella-Bolduc <m.gonella.bolduc@gmail.com>
>> +
>> +description: |
>> +  Datasheet: https://docs.broadcom.com/docs/APDS-9160-003-DS
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - avago,apds9160
>> +      - broadmobi,apds9160
> 
> What is the difference between these two devices? There's no match data,
> makes it seem like there should be a fallback going on here.
Same device names suggest this is some legacy. We don't take new
bindings for legacy stuff.

Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: iio: light: Add APDS9160 binding
Posted by Mikael Gonella-Bolduc 1 year, 2 months ago
On Wed, Nov 20, 2024 at 06:23:11PM +0100, Krzysztof Kozlowski wrote:
> On 20/11/2024 18:18, Conor Dooley wrote:
> > On Tue, Nov 19, 2024 at 03:36:56PM -0500, Mikael Gonella-Bolduc via B4 Relay wrote:
> >> From: Mikael Gonella-Bolduc <mgonellabolduc@dimonoff.com>
> >>
> >> Add device tree bindings for APDS9160 driver
> >>
> >> Signed-off-by: Mikael Gonella-Bolduc <mgonellabolduc@dimonoff.com>
> >> ---
> >>  .../bindings/iio/light/avago,apds9160.yaml         | 50 ++++++++++++++++++++++
> >>  1 file changed, 50 insertions(+)
> >>
> >> diff --git a/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml b/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml
> >> new file mode 100644
> >> index 0000000000000000000000000000000000000000..12e196b297fe523e4d324156041ef9c6900676eb
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/iio/light/avago,apds9160.yaml
> >> @@ -0,0 +1,50 @@
> >> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id: http://devicetree.org/schemas/iio/light/avago,apds9160.yaml#
> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >> +
> >> +title: Broadcom Combined Proximity & Ambient light sensor
> >> +
> >> +maintainers:
> >> +  - Mikael Gonella-Bolduc <m.gonella.bolduc@gmail.com>
> >> +
> >> +description: |
> >> +  Datasheet: https://docs.broadcom.com/docs/APDS-9160-003-DS
> >> +
> >> +properties:
> >> +  compatible:
> >> +    enum:
> >> +      - avago,apds9160
> >> +      - broadmobi,apds9160
> > 
> > What is the difference between these two devices? There's no match data,
> > makes it seem like there should be a fallback going on here.
> Same device names suggest this is some legacy. We don't take new
> bindings for legacy stuff.
> 
> Best regards,
> Krzysztof

Hi,
Thank you for the feedback.

There's no difference between these two devices, it's the same chip using two different names.
There's two names because the chip was first released before the Avago & Broadcom acquisition.

The datasheet available has the avago name in it and it's referenced using both names.
I did not know which name to include so I wrote both.

It's old but still being produced today and active for new designs.

Is it too old for the driver to be mainlined?
If not, which name should I use?

Best regards,
Mikael
Re: [PATCH 1/2] dt-bindings: iio: light: Add APDS9160 binding
Posted by Krzysztof Kozlowski 1 year, 2 months ago
On 20/11/2024 21:26, Mikael Gonella-Bolduc wrote:
>>>> +$id: http://devicetree.org/schemas/iio/light/avago,apds9160.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: Broadcom Combined Proximity & Ambient light sensor
>>>> +
>>>> +maintainers:
>>>> +  - Mikael Gonella-Bolduc <m.gonella.bolduc@gmail.com>
>>>> +
>>>> +description: |
>>>> +  Datasheet: https://docs.broadcom.com/docs/APDS-9160-003-DS
>>>> +
>>>> +properties:
>>>> +  compatible:
>>>> +    enum:
>>>> +      - avago,apds9160
>>>> +      - broadmobi,apds9160
>>>
>>> What is the difference between these two devices? There's no match data,
>>> makes it seem like there should be a fallback going on here.
>> Same device names suggest this is some legacy. We don't take new
>> bindings for legacy stuff.
>>
>> Best regards,
>> Krzysztof
> 
> Hi,
> Thank you for the feedback.
> 
> There's no difference between these two devices, it's the same chip using two different names.
> There's two names because the chip was first released before the Avago & Broadcom acquisition.
> 
> The datasheet available has the avago name in it and it's referenced using both names.
> I did not know which name to include so I wrote both.

Choose only one. Preferably newer one. Just notice that broadcom and
broadmobi are a bit different entities, according to vendor prefixes.

> 
> It's old but still being produced today and active for new designs.
> 
> Is it too old for the driver to be mainlined?

No, it is fine.

> If not, which name should I use?


Best regards,
Krzysztof