[PATCH v3 1/2] dt-bindings: pwm: Convert PWM bindings to json-schema
robh at kernel.org
Thu Oct 10 18:54:32 UTC 2019
On Wed, Oct 02, 2019 at 06:40:46PM +0200, Krzysztof Kozlowski wrote:
> Convert generic PWM bindings to DT schema format using json-schema. The
> consumer bindings are split to separate file.
> Signed-off-by: Krzysztof Kozlowski <krzk at kernel.org>
> Changes since v2:
> 1. Change also pwm-sprd.txt
> Changes since v1:
> 1. Indent example with four spaces (more readable),
> 2. Change pattern for pwm nodes,
> 3. Remove $ref from #cells.
> diff --git a/Documentation/devicetree/bindings/pwm/pwm-consumers.yaml b/Documentation/devicetree/bindings/pwm/pwm-consumers.yaml
> new file mode 100644
> index 000000000000..39c844fe6338
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/pwm-consumers.yaml
> @@ -0,0 +1,76 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +$id: http://devicetree.org/schemas/pwm/pwm-consumers.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +title: Specifying PWM information for devices
> + - Thierry Reding <thierry.reding at gmail.com>
> +description: |
> + PWM properties should be named "pwms". The exact meaning of each pwms
> + property must be documented in the device tree binding for each device.
> + An optional property "pwm-names" may contain a list of strings to label
> + each of the PWM devices listed in the "pwms" property. If no "pwm-names"
> + property is given, the name of the user node will be used as fallback.
> + Drivers for devices that use more than a single PWM device can use the
> + "pwm-names" property to map the name of the PWM device requested by the
> + pwm_get() call to an index into the list given by the "pwms" property.
> + pwms:
> + $ref: /schemas/types.yaml#/definitions/phandle-array
> + description: |
> + Phandle to PWM controller node and pwm-specifier (controller specific).
> + pwm-specifier typically encodes the chip-relative PWM number and the PWM
> + period in nanoseconds.
> + Optionally, the pwm-specifier can encode a number of flags (defined in
> + <dt-bindings/pwm/pwm.h>) in a third cell:
> + - PWM_POLARITY_INVERTED: invert the PWM signal polarity
> + pwm-names:
> + $ref: /schemas/types.yaml#/definitions/string-array
> + description:
> + A list of strings to label each of the PWM devices listed in the "pwms"
> + property. If no "pwm-names" property is given, the name of the user node
> + will be used as fallback.
> + - pwms
This schema is never applied because it has no 'select' which is only
automatic for $nodename or compatible. You could include this from other
schemas, but why? Any consumer still has to list these properties to
define their specific constraints.
We already have a schema in dtschema for consumer side. It's just
missing descriptions which needs relicensing from this.
> + pwm-names: [ pwms ]
More information about the dri-devel