From: David Lechner <dlechner@baylibre.com>
To: David Jander <david@protonic.nl>, linux-kernel@vger.kernel.org
Cc: linux-iio@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
Nuno Sa <nuno.sa@analog.com>, Jonathan Cameron <jic23@kernel.org>,
Oleksij Rempel <o.rempel@pengutronix.de>
Subject: Re: [RFC PATCH 7/7] dt-bindings: motion: Add motion-simple-pwm bindings
Date: Fri, 28 Feb 2025 16:41:29 -0600 [thread overview]
Message-ID: <8db96db5-c258-4c42-a70a-56fdf24ecdc6@baylibre.com> (raw)
In-Reply-To: <20250227162823.3585810-8-david@protonic.nl>
On 2/27/25 10:28 AM, 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
I think it has been said many times before, in DT, there is no such thing as
a simple device! It will be much more future-proof if we write bindings for
actual individual motor controller chips than try to generalize all in a single
binding. The chip you gave as an example is far from the simplest H-bridge I
have seen!
> +
> +maintainers:
> + - David Jander <david@protonic>
> +
> +description: |
> + Simple motor control device based on 1 or 2 PWM outputs
> +
> +properties:
> + compatible:
> + enum:
> + - motion-simple-pwm
This should be e.g. ti,drv8873-q1. This device has much more pins that is given
in these bindings.
If we find more devices that have similar functionality/pinout we can add them
to the same bindings, but we will likely find that trying to cram all H-bridges
into a single binding is too much.
For starters, every H-bridge chip is going to have one or more power supplies.
ti,drv8873-q1 would need dvdd-supply and vm-supply properties for the DVDD and
VM pins.
Many have inputs for disabling the chip, e.g. for power management. And some
have outputs to indicate faults.
The TI DRV8873 in particular has an nSLEEP, DISABLE, nOL, SR, MODE and nITRIP
inputs in addition to the IN1 and IN2 that would be connected to the PWMs.
So we would have properties for all of these to either say how the pin is
hardwired or a *-gpios property if it needs to be controlled by the driver.
The fault output would generally be an interrupts property.
The IPROPI1 and IPROPI2 output pins look like they would be connected to an
ADC, so it would make sense to have an io-channels property show that
connection.
This chip also has a SPI interface. So it needs to have the possibility of
being a SPI peripheral node.
And even if the Linux driver doesn't implement all of these features, we still
want the DT bindings to be as complete as possible, so we shouldn't be leaving
these out, at least for the trivial ones where there is an obvious correct
binding (which I think is the case for most of what I suggested).
> +
> + pwms:
> + maxItems: 2
> +
> + pwm-names:
> + maxItems: 2
Specifying what is wired up to the IN pins can be tricky. Using two PWMs is
the most sensible. But I've also seen devices where there was a single PWM
gated by two gpios. And for very basic H-bridges, there might not even be a
PWM. Just gpios to turn it on or off.
> +
> + motion,pwm-inverted:
> + $ref: /schemas/types.yaml#/definitions/flag
> + 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 {
> + compatible = "motion-simple-pwm";
> + pwms = <&hpdcm0_pwm 0 50000 0>,
> + <&hpdcm0_pwm 1 50000 0>;
> + pwm-names = "left", "right";
> + motion,pwm-inverted;
> + motion,speed-conv-mul = <3600>;
> + motion,speed-conv-div = <100000>;
> + motion,acceleration-conv-mul = <3600>;
> + motion,acceleration-conv-div = <100000>;
This H-bridge controller doesn't have any kind of speed sensors that I can see
so these properties don't make sense to me. The H-bridge can control the voltage
sent to the motor, but there are more variables involved to convert voltage to
speed. It isn't a constant.
> + };
next prev parent reply other threads:[~2025-02-28 22:41 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 16:28 [RFC PATCH 0/7] Add Linux Motion Control subsystem David Jander
2025-02-27 16:28 ` [RFC PATCH 1/7] drivers: Add motion control subsystem David Jander
2025-02-28 16:44 ` Uwe Kleine-König
2025-03-05 15:40 ` David Jander
2025-03-05 23:21 ` Uwe Kleine-König
2025-03-06 7:18 ` Greg Kroah-Hartman
2025-03-06 8:20 ` David Jander
2025-03-06 9:03 ` Greg Kroah-Hartman
2025-03-06 9:34 ` David Jander
2025-03-06 13:39 ` Greg Kroah-Hartman
2025-03-06 14:25 ` David Jander
2025-03-06 14:54 ` Greg Kroah-Hartman
2025-03-06 9:25 ` David Jander
2025-03-09 17:32 ` Jonathan Cameron
2025-03-10 8:45 ` David Jander
2025-02-28 22:36 ` David Lechner
2025-03-03 8:36 ` David Jander
2025-03-03 11:01 ` Pavel Pisa
2025-03-03 16:04 ` David Jander
2025-02-27 16:28 ` [RFC PATCH 2/7] motion: Add ADI/Trinamic TMC5240 stepper motor controller David Jander
2025-02-27 16:28 ` [RFC PATCH 3/7] motion: Add simple-pwm.c PWM based DC motor controller driver David Jander
2025-02-27 16:28 ` [RFC PATCH 4/7] Documentation: Add Linux Motion Control documentation David Jander
2025-02-27 16:37 ` Jonathan Corbet
2025-02-28 13:02 ` David Jander
2025-02-28 14:42 ` Jonathan Corbet
2025-02-28 15:06 ` David Jander
2025-02-27 16:28 ` [RFC PATCH 5/7] dt-bindings: motion: Add common motion device properties David Jander
2025-02-28 7:06 ` Krzysztof Kozlowski
2025-02-28 7:13 ` Krzysztof Kozlowski
2025-02-27 16:28 ` [RFC PATCH 6/7] dt-bindings: motion: Add adi,tmc5240 bindings David Jander
2025-02-28 7:11 ` Krzysztof Kozlowski
2025-02-28 8:48 ` David Jander
2025-02-28 9:35 ` Krzysztof Kozlowski
2025-02-28 9:51 ` David Jander
2025-02-28 14:01 ` Krzysztof Kozlowski
2025-02-28 22:38 ` David Lechner
2025-03-03 11:22 ` David Jander
2025-03-03 12:28 ` David Lechner
2025-03-03 13:18 ` David Jander
2025-02-27 16:28 ` [RFC PATCH 7/7] dt-bindings: motion: Add motion-simple-pwm bindings David Jander
2025-02-27 17:38 ` Rob Herring (Arm)
2025-02-28 7:12 ` Krzysztof Kozlowski
2025-02-28 9:22 ` David Jander
2025-02-28 9:37 ` Krzysztof Kozlowski
2025-02-28 10:09 ` David Jander
2025-02-28 15:18 ` Uwe Kleine-König
2025-03-03 10:53 ` Maud Spierings
2025-03-03 11:40 ` David Jander
2025-03-03 14:18 ` Krzysztof Kozlowski
2025-03-03 16:09 ` David Jander
2025-02-28 22:41 ` David Lechner [this message]
2025-03-03 12:54 ` David Jander
2025-02-28 9:34 ` [RFC PATCH 0/7] Add Linux Motion Control subsystem Pavel Pisa
2025-02-28 9:35 ` Pavel Pisa
2025-02-28 11:57 ` David Jander
2025-02-28 15:23 ` Pavel Pisa
2025-03-03 10:45 ` David Jander
2025-02-28 22:36 ` David Lechner
2025-03-03 8:28 ` David Jander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8db96db5-c258-4c42-a70a-56fdf24ecdc6@baylibre.com \
--to=dlechner@baylibre.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=david@protonic.nl \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=o.rempel@pengutronix.de \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).