public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
To: Angelo Compagnucci <angelo@amarulasolutions.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/3] dt-bindings: leds: servo-pwm: Add new bindings for servo-pwm
Date: Fri, 17 Feb 2023 15:57:30 +0100	[thread overview]
Message-ID: <20230217145731.3018148-3-angelo@amarulasolutions.com> (raw)
In-Reply-To: <20230217145731.3018148-1-angelo@amarulasolutions.com>

This binding describes the binding for controlling servo motors through
pwm.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 .../devicetree/bindings/misc/servo-pwm.yaml   | 59 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/servo-pwm.yaml

diff --git a/Documentation/devicetree/bindings/misc/servo-pwm.yaml b/Documentation/devicetree/bindings/misc/servo-pwm.yaml
new file mode 100644
index 000000000000..faa8d4734817
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/servo-pwm.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/servo-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Servo motor connected to PWM
+
+maintainers:
+  - Angelo Compagnucci <angelo@amarulasolutions.com>
+
+description:
+  Each servo is represented as a servo-pwm device.
+  The 20ms period is the accepted standard and so most of the motors
+  support it, while the positioning min/max duty cycle or the motor
+  degrees aperture vary lot between manufacturers.
+  The most common type of servo (SG90) has 180 degrees of movement
+  and moves between 0.5ms and 2.5ms duty cycle.
+
+properties:
+  compatible:
+    const: servo-pwm
+
+patternProperties:
+  properties:
+    pwms:
+      maxItems: 1
+
+    pwm-names: true
+
+    degrees:
+      description:
+        How many degrees the motor can move.
+      $ref: /schemas/types.yaml#/definitions/uint32
+
+    duty-min:
+      description:
+        Duty cycle for position the motor at 0 degrees.
+      $ref: /schemas/types.yaml#/definitions/uint32
+
+    duty-max:
+      description:
+        Duty cycle for positioning the motor at "degrees" angle.
+      $ref: /schemas/types.yaml#/definitions/uint32
+
+additionalProperties: false
+
+examples:
+  - |
+
+    servo: servo@0 {
+      compatible = "servo-pwm";
+      pwms = <&pwm 0 20000000 0>;
+      degrees = <180>;
+      duty-min = <500000>;
+      duty-max = <2500000>;
+    };
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 356daea0861d..8f41daee62fc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8742,6 +8742,7 @@ M:	"Angelo Compagnucci" <angelo@amarulasolutions.com>
 L:	linux-pwm@vger.kernel.org
 S:	Maintained
 F:	Documentation/ABI/testing/sysfs-driver-servo-pwm
+F:	Documentation/devicetree/bindings/misc/servo-pwm.yaml
 F:	drivers/misc/servo-pwm.c
 
 GENERIC RESISTIVE TOUCHSCREEN ADC DRIVER
-- 
2.34.1


  parent reply	other threads:[~2023-02-17 14:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 14:57 [PATCH v2 1/3] misc: servo-pwm: driver for controlling servo motors via PWM Angelo Compagnucci
2023-02-17 14:57 ` [PATCH v2 2/3] misc: servo-pwm: Add sysfs entries to control motor angle Angelo Compagnucci
2023-02-17 14:57 ` Angelo Compagnucci [this message]
2023-02-17 15:22   ` [PATCH v2 3/3] dt-bindings: leds: servo-pwm: Add new bindings for servo-pwm Rob Herring
2023-02-17 23:23   ` Rob Herring
2023-02-17 15:36 ` [PATCH v2 1/3] misc: servo-pwm: driver for controlling servo motors via PWM Greg Kroah-Hartman
2023-02-17 15:41   ` Angelo Compagnucci
     [not found]   ` <CA+_SqVYMZ7MErNr-HrbHj-=Q-5u1PizHQ_6TFkTOxB5=E8+9Dg@mail.gmail.com>
2023-02-17 15:48     ` Greg Kroah-Hartman
2023-02-17 16:12       ` Angelo Compagnucci
2023-02-17 15:50 ` Greg Kroah-Hartman

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=20230217145731.3018148-3-angelo@amarulasolutions.com \
    --to=angelo.compagnucci@gmail.com \
    --cc=angelo@amarulasolutions.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=robh+dt@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