devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 3/3] dt-bindings: leds: servo-pwm: Add new bindings for servo-pwm
       [not found] <20230217145731.3018148-1-angelo@amarulasolutions.com>
@ 2023-02-17 14:57 ` Angelo Compagnucci
  2023-02-17 15:22   ` Rob Herring
  2023-02-17 23:23   ` Rob Herring
  0 siblings, 2 replies; 3+ messages in thread
From: Angelo Compagnucci @ 2023-02-17 14:57 UTC (permalink / raw)
  To: Angelo Compagnucci, Rob Herring, Krzysztof Kozlowski
  Cc: linux-pwm, devicetree, linux-kernel

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 3/3] dt-bindings: leds: servo-pwm: Add new bindings for servo-pwm
  2023-02-17 14:57 ` [PATCH v2 3/3] dt-bindings: leds: servo-pwm: Add new bindings for servo-pwm Angelo Compagnucci
@ 2023-02-17 15:22   ` Rob Herring
  2023-02-17 23:23   ` Rob Herring
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2023-02-17 15:22 UTC (permalink / raw)
  To: Angelo Compagnucci
  Cc: Angelo Compagnucci, Krzysztof Kozlowski, linux-pwm, linux-kernel,
	Rob Herring, devicetree


On Fri, 17 Feb 2023 15:57:30 +0100, Angelo Compagnucci wrote:
> 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
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/misc/servo-pwm.yaml: patternProperties: 'properties' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
	hint: A json-schema keyword was found instead of a DT property name.
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/misc/servo-pwm.yaml: patternProperties:properties: 'anyOf' conditional failed, one must be fixed:
	'pwms' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/misc/servo-pwm.yaml: patternProperties:properties: 'anyOf' conditional failed, one must be fixed:
	'pwm-names' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/misc/servo-pwm.yaml: patternProperties:properties: 'anyOf' conditional failed, one must be fixed:
	'degrees' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/misc/servo-pwm.yaml: patternProperties:properties: 'anyOf' conditional failed, one must be fixed:
	'duty-min' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/misc/servo-pwm.yaml: patternProperties:properties: 'anyOf' conditional failed, one must be fixed:
	'duty-max' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems']
	'type' was expected
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
Documentation/devicetree/bindings/misc/servo-pwm.example.dts:19.24-25.11: Warning (unit_address_vs_reg): /example-0/servo@0: node has a unit name, but no reg or ranges property
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/misc/servo-pwm.example.dtb: servo@0: 'degrees', 'duty-max', 'duty-min', 'pwms' do not match any of the regexes: 'pinctrl-[0-9]+', 'properties'
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/misc/servo-pwm.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230217145731.3018148-3-angelo@amarulasolutions.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 3/3] dt-bindings: leds: servo-pwm: Add new bindings for servo-pwm
  2023-02-17 14:57 ` [PATCH v2 3/3] dt-bindings: leds: servo-pwm: Add new bindings for servo-pwm Angelo Compagnucci
  2023-02-17 15:22   ` Rob Herring
@ 2023-02-17 23:23   ` Rob Herring
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2023-02-17 23:23 UTC (permalink / raw)
  To: Angelo Compagnucci
  Cc: Angelo Compagnucci, Krzysztof Kozlowski, linux-pwm, devicetree,
	linux-kernel

On Fri, Feb 17, 2023 at 03:57:30PM +0100, Angelo Compagnucci wrote:
> 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

Drop. '-names' is for when there is more than 1.
> +
> +    degrees:

Kind of vague: servo-degrees

> +      description:
> +        How many degrees the motor can move.
> +      $ref: /schemas/types.yaml#/definitions/uint32

0-2^32 are valid degrees?

> +
> +    duty-min:
> +      description:
> +        Duty cycle for position the motor at 0 degrees.

Units are ms? percent? Use standard unit suffix.

> +      $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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-17 23:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230217145731.3018148-1-angelo@amarulasolutions.com>
2023-02-17 14:57 ` [PATCH v2 3/3] dt-bindings: leds: servo-pwm: Add new bindings for servo-pwm Angelo Compagnucci
2023-02-17 15:22   ` Rob Herring
2023-02-17 23:23   ` Rob Herring

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).