[PATCH v2 1/2] dt-bindings: Add binding document for cm36686

Erikas Bitovtas posted 2 patches 1 day, 1 hour ago
[PATCH v2 1/2] dt-bindings: Add binding document for cm36686
Posted by Erikas Bitovtas 1 day, 1 hour ago
Document the Capella cm36686 ambient light and proximity sensor devicetree
bindings.

Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
---
 .../bindings/iio/light/capella,cm36686.yaml        | 97 ++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/light/capella,cm36686.yaml b/Documentation/devicetree/bindings/iio/light/capella,cm36686.yaml
new file mode 100644
index 000000000000..0e54b681e197
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/light/capella,cm36686.yaml
@@ -0,0 +1,97 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/light/capella,cm36686.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Capella cm36686 I2C Ambient Light and Proximity sensor
+
+maintainers:
+  - Erikas Bitovtas <xerikasxx@gmail.com>
+
+properties:
+  compatible:
+    oneOf:
+      - const: capella,cm36672p
+      - items:
+          - const: capella,cm36686
+          - const: capella,cm36672p
+
+  reg:
+    maxItems: 1
+    description: I2C address of the device. Must be 0x60 for both cm36686
+      and cm36672p sensors.
+
+  interrupts:
+    maxItems: 1
+
+  vdd-supply:
+    description:
+      Regulator that provides power to the sensor.
+
+  vddio-supply:
+    description:
+      Regulator used to power IO and I2C bus.
+
+  vled-supply:
+    description:
+      Regulator used to power proximity LED
+
+  proximity-near-level: true
+
+  capella,proximity-led-current-microamp:
+    description:
+      Current for proximity IR LED
+    enum: [50000, 75000, 100000, 120000, 140000, 160000, 180000, 200000]
+    default: 50000
+
+  capella,glass-factor:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Lux amplification factor to account for packaging - a number by which a
+      lux reading is multiplied.
+    default: 1
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - capella,cm36672p
+    then:
+      properties:
+        capella,glass-factor: false
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - vdd-supply
+  - vddio-supply
+  - vled-supply
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      light-sensor@60 {
+        compatible = "capella,cm36686", "capella,cm36672p";
+        reg = <0x60>;
+
+        vdd-supply = <&pm8916_l8>;
+        vddio-supply = <&pm8916_l6>;
+        vled-supply = <&reg_prox_vled>;
+
+        interrupts-extended = <&tlmm 113 IRQ_TYPE_EDGE_FALLING>;
+
+        proximity-near-level = <30>;
+
+        capella,glass-factor = <16>;
+        capella,proximity-led-current-microamp = <100000>;
+      };
+    };

-- 
2.53.0
Re: [PATCH v2 1/2] dt-bindings: Add binding document for cm36686
Posted by Krzysztof Kozlowski 1 day, 1 hour ago
On 09/02/2026 15:23, Erikas Bitovtas wrote:
> Document the Capella cm36686 ambient light and proximity sensor devicetree
> bindings.

Please use subject prefixes matching the subsystem. You can get them for
example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
your patch is touching. For bindings, the preferred subjects are
explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

A nit, subject: drop second/last, redundant "bindings document". The
"dt-bindings" prefix is already stating that these are bindings.
See also:
https://elixir.bootlin.com/linux/v6.17-rc3/source/Documentation/devicetree/bindings/submitting-patches.rst#L18

You are just missing one redundant name for the redundant-subject-bingo.

dt-bindings: iio: Add Capella CM....

> 
> Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
> ---
>  .../bindings/iio/light/capella,cm36686.yaml        | 97 ++++++++++++++++++++++
>  1 file changed, 97 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/light/capella,cm36686.yaml b/Documentation/devicetree/bindings/iio/light/capella,cm36686.yaml
> new file mode 100644
> index 000000000000..0e54b681e197
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/light/capella,cm36686.yaml

cm36672p instead, since that's the fallback... although


> @@ -0,0 +1,97 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/light/capella,cm36686.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Capella cm36686 I2C Ambient Light and Proximity sensor

Compatible says cm36672p... Confusing.

> +
> +maintainers:
> +  - Erikas Bitovtas <xerikasxx@gmail.com>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - const: capella,cm36672p
> +      - items:
> +          - const: capella,cm36686
> +          - const: capella,cm36672p

Why higher number is the fallback? Explain this in the commit msg.

> +
> +  reg:
> +    maxItems: 1
> +    description: I2C address of the device. Must be 0x60 for both cm36686
> +      and cm36672p sensors.
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  vdd-supply:
> +    description:
> +      Regulator that provides power to the sensor.
> +
> +  vddio-supply:
> +    description:
> +      Regulator used to power IO and I2C bus.
> +
> +  vled-supply:
> +    description:
> +      Regulator used to power proximity LED
> +
> +  proximity-near-level: true

Drop

> +
> +  capella,proximity-led-current-microamp:
> +    description:
> +      Current for proximity IR LED
> +    enum: [50000, 75000, 100000, 120000, 140000, 160000, 180000, 200000]
> +    default: 50000
> +
> +  capella,glass-factor:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      Lux amplification factor to account for packaging - a number by which a
> +      lux reading is multiplied.
> +    default: 1
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          enum:
> +            - capella,cm36672p
> +    then:
> +      properties:
> +        capella,glass-factor: false
> +

Missing ref to common.yaml.

> +additionalProperties: false

And this goes after required as unevaluatedProperties.

> +
> +required:
> +  - compatible
> +  - reg
> +  - vdd-supply
> +  - vddio-supply
> +  - vled-supply
> +


Best regards,
Krzysztof
Re: [PATCH v2 1/2] dt-bindings: Add binding document for cm36686
Posted by Erikas Bitovtas 1 day, 1 hour ago
> Compatible says cm36672p... Confusing. 
> Why higher number is the fallback? Explain this in the commit msg.

This driver was initially written for cm36686, which is an ambient light and
proximity sensor. But cm36672p shares the same register and regfield layout, it
is just missing an ambient light channel, because it is a proximity-only sensor
and has no ambient light registers.
In v1 the compatible looked like this:
  compatible:
    enum:
      - capella,cm36686
      - capella,cm36672p
Re: [PATCH v2 1/2] dt-bindings: Add binding document for cm36686
Posted by Krzysztof Kozlowski 1 day ago
On 09/02/2026 16:02, Erikas Bitovtas wrote:
>> Compatible says cm36672p... Confusing. 
>> Why higher number is the fallback? Explain this in the commit msg.
> 
> This driver was initially written for cm36686, which is an ambient light and
> proximity sensor. But cm36672p shares the same register and regfield layout, it
> is just missing an ambient light channel, because it is a proximity-only sensor
> and has no ambient light registers.

so cm36672p is the base and cm36686 is superset? Then the binding should
be named as the base. Just like the compatible list.

> In v1 the compatible looked like this:
>   compatible:
>     enum:
>       - capella,cm36686
>       - capella,cm36672p
> 

You just removed entire context except my comment, so what do you refer
to exactly? I have many of such emails per day.

Best regards,
Krzysztof