dt-bindings: pwm: Convert NXP PCA9685 PWM controller to DT schema
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 dt-bindings: pwm: Convert NXP PCA9685 PWM controller to DT schema
Convert the NXP PCA9685 PWM controller binding to DT schema format.
Changes from the text binding:
Document the 'reg' property and make it required. It was missing from the text binding, although the example used it and the device cannot work without the I2C address.
Rename the example node to the generic 'pwm', as required by pwm.yaml.
Describe both cells of the PWM specifier, and state that 'invert' and 'open-drain' apply to all outputs, as per the datasheet (INVRT and OUTDRV bits in MODE2).
---
The schema was generated with an AI assistant (Claude). I verified the properties against the driver source, the PCA9685 datasheet, and the text binding. Passes make dt_binding_check.
.../bindings/pwm/nxp,pca9685-pwm.txt | 27 -------- .../bindings/pwm/nxp,pca9685-pwm.yaml | 62 +++++++++++++++++++ 2 files changed, 62 insertions(+), 27 deletions(-) delete mode 100644 Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.txt create mode 100644 Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.txt deleted +0 -27
@@ -1,27 +0,0 @@ -NXP PCA9685 16-channel 12-bit PWM LED controller -================================================ - -Required properties: - - compatible: "nxp,pca9685-pwm" - - #pwm-cells: Should be 2. See pwm.yaml in this directory for a description of - the cells format. - The index 16 is the ALLCALL channel, that sets all PWM channels at the same - time. - -Optional properties: - - invert (bool): boolean to enable inverted logic - - open-drain (bool): boolean to configure outputs with open-drain structure; - if omitted use totem-pole structure - -Example: - -For LEDs that are directly connected to the PCA, the following setting is -applicable: - -pca: pca@41 { - compatible = "nxp,pca9685-pwm"; - #pwm-cells = <2>; - reg = <0x41>; - invert; - open-drain; -};
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml new file +62 -0
62 lines not on this page · raw message
base-commit: bf1ee2bd5c2da8992f33c8950ef194aaff74ed6c
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] dt-bindings: pwm: missing #pwm-cells in required properties - [Low] dt-bindings: pwm…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] dt-bindings: pwm: missing #pwm-cells in required properties
- [Low] dt-bindings: pwm: hallucinated maintainer name in YAML schema
--
commit 2d85be96eb45879405596ef1a5131c2b3425b8ed
Author: Jeremy Dean <[email protected]>
dt-bindings: pwm: Convert NXP PCA9685 PWM controller to DT schema
Convert the NXP PCA9685 PWM controller binding to DT schema format. The conversion documents the reg property and makes it required, updates the example node, and describes the PWM specifier cells and properties.
Quoted 6 lines
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml new file +0
-0
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml new file +10
-0@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pwm/nxp,pca9685-pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP PCA9685 16-channel 12-bit PWM LED controller + +maintainers: + - Jeremy Clifton <[email protected]>
[Severity: Low]
Is this the correct maintainer name? It looks like the name listed here does not match the name of the patch submitter. Could this result in incorrect attribution and metadata parsing by get_maintainer.pl?
[ ... ]
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml line 45
Quoted 3 lines
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml new file +3
-0+required: + - compatible + - reg
[Severity: Medium]
Should #pwm-cells be included in this required block?
The original text binding correctly mandated #pwm-cells since the PCA9685 acts as a PWM provider. Omitting it from the required list here reduces schema validation coverage, allowing device trees that are missing the property to silently pass.
Quoted 2 lines
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml new file +2
-0+ +unevaluatedProperties: false
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 3 lines · Jeremy Dean
Assisted-by LLMSigned-off-by Jeremy Dean <[email protected]>
...
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml line 10
Quoted 2 lines
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml new file +2
-0+maintainers: + - Jeremy Clifton <[email protected]>
I think we are done on these hallucinations.
There is little point for beginner contributors to send us DT binding conversions generated by LLM.
Best regards,
Krzysztof
Hello Krzysztof + all,
Dean is a middle name I use in place of my surname, Clifton, so both names are mine. I should have used the same one in both places; that mismatch is my mistake.
The goal was to bring this binding up to par with the rest of the PWM bindings, so that device trees and overlays using the PCA9685 can be validated with dtbs_check. It's a common chip in beginner robotics projects, and the schema means the beginners who run dtbs_check can be sure their DTS has no mismatches.
For reference, I put together a template for DT schemas:
https://drive.google.com/file/d/183T6W73x45-0WRpo372I1OMeQZop-XzQ/view?usp=drive_link
and a requirements document which could be a starter guide for someone putting together such a schema:
https://drive.google.com/file/d/1K_pfVIZ6u9GjD5tL4TJ40qOHM-_eWe4O/view?usp=sharing
Look out for a v2 with zero hallucination sashiko flags (My middle name is Dean).
Jeremy
Quoted 17 lines · Krzysztof Kozlowski
Quoted 3 lines · Jeremy Dean
Assisted-by LLMSigned-off-by Jeremy Dean <[email protected]>...
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml line 10
Quoted 2 lines
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.yaml new file +2
-0+maintainers: + - Jeremy Clifton <[email protected]>I think we are done on these hallucinations.
There is little point for beginner contributors to send us DT binding conversions generated by LLM.
Best regards,
Krzysztof