diff mbox series

[1/2] dt-bindings: pwm: add bindings for PWM modules inside QCOM PMICs

Message ID 20210427102247.822-2-fenglinw@codeaurora.org (mailing list archive)
State Not Applicable, archived
Headers show
Series Add QCOM PMIC PWM driver | expand

Commit Message

Fenglin Wu April 27, 2021, 10:22 a.m. UTC
Add bindings for QCOM PMIC PWM modules which are accessed through SPMI
bus.

Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
---
 .../devicetree/bindings/pwm/pwm-qcom.yaml          | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-qcom.yaml

Comments

Rob Herring (Arm) April 27, 2021, 12:57 p.m. UTC | #1
On Tue, 27 Apr 2021 18:22:09 +0800, Fenglin Wu wrote:
> Add bindings for QCOM PMIC PWM modules which are accessed through SPMI
> bus.
> 
> Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
> ---
>  .../devicetree/bindings/pwm/pwm-qcom.yaml          | 51 ++++++++++++++++++++++
>  1 file changed, 51 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pwm-qcom.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:
./Documentation/devicetree/bindings/pwm/pwm-qcom.yaml:29:6: [warning] wrong indentation: expected 4 but found 5 (indentation)

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml: Additional properties are not allowed ('Properties' was unexpected)
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml: Additional properties are not allowed ('Properties' was unexpected)
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml: 'anyOf' conditional failed, one must be fixed:
	'properties' is a required property
	'patternProperties' is a required property
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml: ignoring, error in schema: 
warning: no schema found in file: ./Documentation/devicetree/bindings/pwm/pwm-qcom.yaml
Documentation/devicetree/bindings/pwm/pwm-qcom.example.dts:21.13-28: Warning (reg_format): /example-0/pwms@e800:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml: Warning (pci_device_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml: example-0: pwms@e800:reg:0: [59392] is too short
	From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yaml
Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml:0:0: /example-0/pwms@e800: failed to match any schema with compatible: ['qcom,pwm']

See https://patchwork.ozlabs.org/patch/1470623

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

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.
Fenglin Wu April 28, 2021, 10:54 a.m. UTC | #2
On 2021-04-27 20:57, Rob Herring wrote:
> On Tue, 27 Apr 2021 18:22:09 +0800, Fenglin Wu wrote:
>> Add bindings for QCOM PMIC PWM modules which are accessed through SPMI
>> bus.
>> 
>> Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
>> ---
>>  .../devicetree/bindings/pwm/pwm-qcom.yaml          | 51 
>> ++++++++++++++++++++++
>>  1 file changed, 51 insertions(+)
>>  create mode 100644 
>> Documentation/devicetree/bindings/pwm/pwm-qcom.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:
> ./Documentation/devicetree/bindings/pwm/pwm-qcom.yaml:29:6: [warning]
> wrong indentation: expected 4 but found 5 (indentation)
> 
> dtschema/dtc warnings/errors:
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml:
> Additional properties are not allowed ('Properties' was unexpected)
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml:
> Additional properties are not allowed ('Properties' was unexpected)
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml:
> 'anyOf' conditional failed, one must be fixed:
> 	'properties' is a required property
> 	'patternProperties' is a required property
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml:
> ignoring, error in schema:
> warning: no schema found in file:
> ./Documentation/devicetree/bindings/pwm/pwm-qcom.yaml
> Documentation/devicetree/bindings/pwm/pwm-qcom.example.dts:21.13-28:
> Warning (reg_format): /example-0/pwms@e800:reg: property has invalid
> length (4 bytes) (#address-cells == 1, #size-cells == 1)
> Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml:
> Warning (pci_device_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml:
> Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml:
> Warning (simple_bus_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml:
> Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml:
> Warning (spi_bus_reg): Failed prerequisite 'reg_format'
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml:
> example-0: pwms@e800:reg:0: [59392] is too short
> 	From schema: 
> /usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yaml
> Documentation/devicetree/bindings/pwm/pwm-qcom.example.dt.yaml:0:0:
> /example-0/pwms@e800: failed to match any schema with compatible:
> ['qcom,pwm']
> 
> See https://patchwork.ozlabs.org/patch/1470623
> 
> This check can fail if there are any dependencies. The base for a patch
> series is generally the most recent rc1.
> 
> 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.

Thanks for the information. It's my 1st time to write binding using yaml 
format, I hadn't noticed there was a checker can be used for sanity 
test. I will update and run the dt_binding_check at my side before 
uploading new patchset.
Thierry Reding April 28, 2021, 5:38 p.m. UTC | #3
On Tue, Apr 27, 2021 at 06:22:09PM +0800, Fenglin Wu wrote:
> Add bindings for QCOM PMIC PWM modules which are accessed through SPMI
> bus.
> 
> Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
> ---
>  .../devicetree/bindings/pwm/pwm-qcom.yaml          | 51 ++++++++++++++++++++++
>  1 file changed, 51 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pwm-qcom.yaml
> 
> diff --git a/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml b/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml
> new file mode 100644
> index 0000000..e8d8ed6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml
> @@ -0,0 +1,51 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/pwm/pwm-qcom.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm Technologies, Inc. PMIC PWM bindings
> +
> +maintainers:
> +  - Fenglin Wu <fenglinw@codeaurora.org>
> +
> +description:
> +  PWM modules inside Qualcomm Technologies, Inc. PMICs can be accessed through
> +  SPMI bus and normally one PMIC would have multiple PWM modules with adjacent
> +  SPMI address space.
> +
> +Properties:
> +  compatible:
> +    const: qcom,pwm

This seems a bit vague. What if Qualcomm ever designs a different PWM?
How are you going to tell them apart? Typically this would include some
sort of ID for the SoC family, or the first SoC that this was introduced
on. That way you can more easily distinguish between different designs
later on.

> +
> +  reg:
> +    description:
> +      The SPMI address base of the PWM module, if there are multiple PWM
> +      modules present with adjacent SPMI address space, only need to specify
> +      the address base of the 1st PWM module.

That seems like an odd way to define these. It looks like this is a bus
with #address-cells = <1> and #size-cells = <0>. Such busses are usually
assumed to have a single address per device (see for example I2C). How
does the SPMI addressing work? Is there a specification somewhere?

Actually, Documentation/devicetree/bindings/spmi/spmi.yaml says that
SPMI child devices should have two address cells, so this seesm to be at
odds with that specification.

Thierry
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml b/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml
new file mode 100644
index 0000000..e8d8ed6
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pwm-qcom.yaml
@@ -0,0 +1,51 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/pwm-qcom.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Technologies, Inc. PMIC PWM bindings
+
+maintainers:
+  - Fenglin Wu <fenglinw@codeaurora.org>
+
+description:
+  PWM modules inside Qualcomm Technologies, Inc. PMICs can be accessed through
+  SPMI bus and normally one PMIC would have multiple PWM modules with adjacent
+  SPMI address space.
+
+Properties:
+  compatible:
+    const: qcom,pwm
+
+  reg:
+    description:
+      The SPMI address base of the PWM module, if there are multiple PWM
+      modules present with adjacent SPMI address space, only need to specify
+      the address base of the 1st PWM module.
+
+  "#pwm-cells":
+     # See pwm.yaml in this directory for a description of the cells format.
+     const: 2
+
+  qcom,num-channels:
+    description:
+      The number of the PWM channels (modules) with the adjacent SPMI address
+      space following the address base in "reg" property.
+
+required:
+  - compatible
+  - reg
+  - "#pwm-cells"
+  - qcom,num-channels
+
+additionalProperties: false
+
+examples:
+  - |
+    pm8350c_pwm: pwms@e800 {
+        compatible = "qcom,pwm";
+        reg = <0xe800>;
+        #pwm-cells = <2>;
+        qcom,num-channels = <4>;
+    };