diff mbox series

[RESEND,v2,2/7] dt-bindings: usb: Add Qualcomm PMIC type C controller YAML schema

Message ID 20211028164941.831918-3-bryan.odonoghue@linaro.org (mailing list archive)
State Superseded
Headers show
Series Add pm8150b TPCM driver | expand

Commit Message

Bryan O'Donoghue Oct. 28, 2021, 4:49 p.m. UTC
Add a YAML binding for the type-c silicon interface inside Qualcomm's
pm8150b hardware block.

The type-c driver operates with a pdphy driver inside of a high level
single TCPM device.

Based on original work by Wesley.

Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 .../bindings/usb/qcom,pmic-typec.yaml         | 116 ++++++++++++++++++
 1 file changed, 116 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml

Comments

Rob Herring Oct. 28, 2021, 7:08 p.m. UTC | #1
On Thu, 28 Oct 2021 17:49:36 +0100, Bryan O'Donoghue wrote:
> Add a YAML binding for the type-c silicon interface inside Qualcomm's
> pm8150b hardware block.
> 
> The type-c driver operates with a pdphy driver inside of a high level
> single TCPM device.
> 
> Based on original work by Wesley.
> 
> Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  .../bindings/usb/qcom,pmic-typec.yaml         | 116 ++++++++++++++++++
>  1 file changed, 116 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-typec.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:
Documentation/devicetree/bindings/usb/qcom,pmic-typec.example.dt.yaml:0:0: /example-0/pm8150b/typec@1500: failed to match any schema with compatible: ['qcom,pm8150b-typec']

doc reference errors (make refcheckdocs):

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

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.
Rob Herring Oct. 28, 2021, 8:38 p.m. UTC | #2
On Thu, Oct 28, 2021 at 05:49:36PM +0100, Bryan O'Donoghue wrote:
> Add a YAML binding for the type-c silicon interface inside Qualcomm's
> pm8150b hardware block.
> 
> The type-c driver operates with a pdphy driver inside of a high level
> single TCPM device.
> 
> Based on original work by Wesley.
> 
> Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  .../bindings/usb/qcom,pmic-typec.yaml         | 116 ++++++++++++++++++
>  1 file changed, 116 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml
> 
> diff --git a/Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml b/Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml
> new file mode 100644
> index 0000000000000..72602daf910bb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml
> @@ -0,0 +1,116 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/usb/qcom,pmic-typec.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: Qualcomm PMIC based USB type C Detection Driver
> +
> +maintainers:
> +  - Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> +
> +description: |
> +  Qualcomm PMIC Type C Detect
> +
> +properties:
> +  compatible:
> +    enum:
> +      - qcom,pm8150b-usb-typec
> +
> +  reg:
> +    maxItems: 1
> +    description: Type C base address
> +
> +  interrupts:
> +    items:
> +      - description: Bitmask of CC attach, VBUS error, tCCDebounce done and more
> +      - description: VCONN Powered Detection
> +      - description: CC state change
> +      - description: VCONN over-current condition
> +      - description: VBUS state change
> +      - description: Attach Deteach notification
> +      - description: Legacy cable detect
> +      - description: Try.Src Try.Snk state change
> +
> +  interrupt-names:
> +    items:
> +      - const: pmic-typec-or-rid-detect-change
> +      - const: pmic-typec-vpd-detect
> +      - const: pmic-typec-cc-state-change
> +      - const: pmic-typec-vconn-oc
> +      - const: pmic-typec-vbus-change
> +      - const: pmic-typec-attach-detach
> +      - const: pmic-typec-legacy-cable-detect
> +      - const: pmic-typec-try-snk-src-detect

'pmic-typec-' is redundant, drop.

> +
> +  ports:
> +    description: Remote endpoint connections
> +    $ref: /connector/usb-connector.yaml#/properties/ports

No. Why don't you have a connector node that uses all of 
usb-connector.yaml? The schemas aren't designed to pick and chose 
properties out of them (usually).

> +
> +    properties:
> +      port@0:
> +        description: Remote endpoints for the TCPM driver

What kind of h/w is a 'TCPM driver'? port 0 already has a defined 
connection in usb-connector.yaml.

> +
> +    required:
> +      - port@0
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - interrupt-names
> +  - ports
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    #include <dt-bindings/usb/typec/tcpm/qcom,pmic-usb-typec.h>
> +    pm8150b {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        pm8150b_typec: typec@1500 {
> +            compatible = "qcom,pm8150b-typec";
> +            reg = <0x1500>;
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +            interrupts = <0x2 0x15 PMIC_TYPEC_OR_RID_IRQ
> +                          IRQ_TYPE_EDGE_RISING>,
> +                         <0x2 0x15 PMIC_TYPEC_VPD_IRQ
> +                          IRQ_TYPE_EDGE_BOTH>,
> +                         <0x2 0x15 PMIC_TYPEC_CC_STATE_IRQ
> +                          IRQ_TYPE_EDGE_RISING>,
> +                         <0x2 0x15 PMIC_TYPEC_VCONN_OC_IRQ
> +                          IRQ_TYPE_EDGE_BOTH>,
> +                         <0x2 0x15 PMIC_TYPEC_VBUS_IRQ
> +                          IRQ_TYPE_EDGE_RISING>,
> +                         <0x2 0x15 PMIC_TYPEC_ATTACH_DETACH_IRQ
> +                          IRQ_TYPE_EDGE_RISING>,
> +                         <0x2 0x15 PMIC_TYPEC_LEGACY_CABLE_IRQ
> +                          IRQ_TYPE_EDGE_BOTH>,
> +                         <0x2 0x15 PMIC_TYPEC_TRY_SNK_SRC_IRQ
> +                          IRQ_TYPE_EDGE_RISING>;
> +            interrupt-names = "pmic-typec-or-rid-detect-change",
> +                              "pmic-typec-vpd-detect",
> +                              "pmic-typec-cc-state-change",
> +                              "pmic-typec-vconn-oc",
> +                              "pmic-typec-vbus-change",
> +                              "pmic-typec-attach-detach",
> +                              "pmic-typec-legacy-cable-detect",
> +                              "pmic-typec-try-snk-src-detect";
> +            ports {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                port@0 {
> +                    reg = <0>;
> +                    pmic_typec: endpoint {
> +                        remote-endpoint = <&pmic_tcpm_typec>;
> +                    };
> +                };
> +            };
> +        };
> +    };
> +...
> -- 
> 2.33.0
> 
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml b/Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml
new file mode 100644
index 0000000000000..72602daf910bb
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml
@@ -0,0 +1,116 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/usb/qcom,pmic-typec.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Qualcomm PMIC based USB type C Detection Driver
+
+maintainers:
+  - Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+
+description: |
+  Qualcomm PMIC Type C Detect
+
+properties:
+  compatible:
+    enum:
+      - qcom,pm8150b-usb-typec
+
+  reg:
+    maxItems: 1
+    description: Type C base address
+
+  interrupts:
+    items:
+      - description: Bitmask of CC attach, VBUS error, tCCDebounce done and more
+      - description: VCONN Powered Detection
+      - description: CC state change
+      - description: VCONN over-current condition
+      - description: VBUS state change
+      - description: Attach Deteach notification
+      - description: Legacy cable detect
+      - description: Try.Src Try.Snk state change
+
+  interrupt-names:
+    items:
+      - const: pmic-typec-or-rid-detect-change
+      - const: pmic-typec-vpd-detect
+      - const: pmic-typec-cc-state-change
+      - const: pmic-typec-vconn-oc
+      - const: pmic-typec-vbus-change
+      - const: pmic-typec-attach-detach
+      - const: pmic-typec-legacy-cable-detect
+      - const: pmic-typec-try-snk-src-detect
+
+  ports:
+    description: Remote endpoint connections
+    $ref: /connector/usb-connector.yaml#/properties/ports
+
+    properties:
+      port@0:
+        description: Remote endpoints for the TCPM driver
+
+    required:
+      - port@0
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/usb/typec/tcpm/qcom,pmic-usb-typec.h>
+    pm8150b {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pm8150b_typec: typec@1500 {
+            compatible = "qcom,pm8150b-typec";
+            reg = <0x1500>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+            interrupts = <0x2 0x15 PMIC_TYPEC_OR_RID_IRQ
+                          IRQ_TYPE_EDGE_RISING>,
+                         <0x2 0x15 PMIC_TYPEC_VPD_IRQ
+                          IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x15 PMIC_TYPEC_CC_STATE_IRQ
+                          IRQ_TYPE_EDGE_RISING>,
+                         <0x2 0x15 PMIC_TYPEC_VCONN_OC_IRQ
+                          IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x15 PMIC_TYPEC_VBUS_IRQ
+                          IRQ_TYPE_EDGE_RISING>,
+                         <0x2 0x15 PMIC_TYPEC_ATTACH_DETACH_IRQ
+                          IRQ_TYPE_EDGE_RISING>,
+                         <0x2 0x15 PMIC_TYPEC_LEGACY_CABLE_IRQ
+                          IRQ_TYPE_EDGE_BOTH>,
+                         <0x2 0x15 PMIC_TYPEC_TRY_SNK_SRC_IRQ
+                          IRQ_TYPE_EDGE_RISING>;
+            interrupt-names = "pmic-typec-or-rid-detect-change",
+                              "pmic-typec-vpd-detect",
+                              "pmic-typec-cc-state-change",
+                              "pmic-typec-vconn-oc",
+                              "pmic-typec-vbus-change",
+                              "pmic-typec-attach-detach",
+                              "pmic-typec-legacy-cable-detect",
+                              "pmic-typec-try-snk-src-detect";
+            ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@0 {
+                    reg = <0>;
+                    pmic_typec: endpoint {
+                        remote-endpoint = <&pmic_tcpm_typec>;
+                    };
+                };
+            };
+        };
+    };
+...