Re: [RFC PATCH 7/7] dt-bindings: motion: Add motion-simple-pwm bindings

Krzysztof Kozlowski
2025-02-28T07:12:49Z

On Thu, Feb 27, 2025 at 05:28:23PM +0100, David Jander wrote:
> Add device-tree bindings for simple Linux Motion Control devices that
> are based on 1 or 2 PWM outputs.
>
> Signed-off-by: David Jander <david@protonic.nl>
> ---
> .../bindings/motion/motion-simple-pwm.yaml | 55 +++++++++++++++++++
> 1 file changed, 55 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/motion/motion-simple-pwm.yaml
>
> diff --git a/Documentation/devicetree/bindings/motion/motion-simple-pwm.yaml b/Documentation/devicetree/bindings/motion/motion-simple-pwm.yaml
> new file mode 100644
> index 000000000000..409e3aef6f3f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/motion/motion-simple-pwm.yaml
> @@ -0,0 +1,55 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/motion/motion-simple-pwm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Simple PWM based motor controller
> +
> +maintainers:
> + - David Jander <david@protonic>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.

> + Simple motor control device based on 1 or 2 PWM outputs

Your schema does not allow 1. Test it.

> +
> +properties:
> + compatible:
> + enum:
> + - motion-simple-pwm
> +
> + pwms:
> + maxItems: 2

List and describe items instead.

> +
> + pwm-names:
> + maxItems: 2

List items instead.

> +
> + motion,pwm-inverted:
> + $ref: /schemas/types.yaml#/definitions/flag

And PWM flag does not work?

Anyway, there is no "motion" company.

> + description:
> + If present, this flag indicates that the PWM signal should be inverted.
> + The duty-cycle will be scaled from 100% down to 0% instead 0% to 100%.
> +
> +required:
> + - compatible
> + - pwms
> +
> +allOf:
> + - $ref: /schemas/motion/common.yaml#
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + // This example shows how to use the TI DRV8873 or similar motor controllers
> + // with this driver
> + motion-simple-pwm0 {

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

e.g. motor {

Best regards,
Krzysztof