2022-05-09 02:02:02

by Cixi Geng

[permalink] [raw]
Subject: [PATCH 1/2] dt-bindings: usb: Add documentation for sc27xx typec controller

From: Cixi Geng <[email protected]>

The Spreadtrum PMIC SC27xx integrated typec port controller.
add the bindings to describe sc27xx typec controller.

Signed-off-by: Cixi Geng <[email protected]>
---
.../bindings/usb/sprd,sc27xx-typec.yaml | 72 +++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/sprd,sc27xx-typec.yaml

diff --git a/Documentation/devicetree/bindings/usb/sprd,sc27xx-typec.yaml b/Documentation/devicetree/bindings/usb/sprd,sc27xx-typec.yaml
new file mode 100644
index 000000000000..6e49198c88da
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/sprd,sc27xx-typec.yaml
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2022 Unisoc Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/sprd,sc27xx-typec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SC27XX Type-C port controller
+
+description:
+ The UNISOC, also know as Spreadtrum, SC27XX is a USB Type-C port controller which
+ supports role and plug orientation detection using the CC pins. It is
+ compatible with the USB Type-C Cable and Connector Specification v1.2.
+
+maintainers:
+ - Cixi Geng <[email protected]>
+
+properties:
+ compatible:
+ enum:
+ - sprd,sc2730-typec
+ - sprd,sc2721-typec
+ - sprd,ump96xx-typec
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ sprd,mode:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ The Type-C port mode type
+
+ nvmem-cells:
+ maxItems: 2
+ description:
+ Reference to an nvmem node for the calibration data.
+
+ nvmem-cell-names:
+ items:
+ - const: typec_cc1_cal
+ - const: typec_cc2_cal
+
+required:
+ - compatible
+ - reg
+ - sprd,mode
+ - nvmem-cells
+ - nvmem-cell-names
+
+additionalProperties: false
+
+examples:
+ - |
+ pmic {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pmic_typec: typec@380 {
+ compatible = "sprd,sc2730-typec";
+ interrupt-parent = <&sc2730_pmic>;
+ interrupts = <8>;
+ reg = <0x380>;
+ sprd,mode = <2>;
+ nvmem-cells = <&typec_cc1_cal>, <&typec_cc2_cal>;
+ nvmem-cell-names = "typec_cc1_cal", "typec_cc2_cal";
+ status = "okay";
+ };
+ };
+...
--
2.25.1



2022-05-09 06:47:19

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 1/2] dt-bindings: usb: Add documentation for sc27xx typec controller

On 07/05/2022 11:29, Cixi Geng wrote:
> From: Cixi Geng <[email protected]>
>
> The Spreadtrum PMIC SC27xx integrated typec port controller.
> add the bindings to describe sc27xx typec controller.
>
> Signed-off-by: Cixi Geng <[email protected]>
> ---
> .../bindings/usb/sprd,sc27xx-typec.yaml | 72 +++++++++++++++++++
> 1 file changed, 72 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/usb/sprd,sc27xx-typec.yaml
>
> diff --git a/Documentation/devicetree/bindings/usb/sprd,sc27xx-typec.yaml b/Documentation/devicetree/bindings/usb/sprd,sc27xx-typec.yaml
> new file mode 100644
> index 000000000000..6e49198c88da
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/sprd,sc27xx-typec.yaml
> @@ -0,0 +1,72 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +# Copyright 2022 Unisoc Inc.
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/usb/sprd,sc27xx-typec.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: SC27XX Type-C port controller
> +
> +description:
> + The UNISOC, also know as Spreadtrum, SC27XX is a USB Type-C port controller which
> + supports role and plug orientation detection using the CC pins. It is
> + compatible with the USB Type-C Cable and Connector Specification v1.2.
> +
> +maintainers:
> + - Cixi Geng <[email protected]>
> +
> +properties:
> + compatible:
> + enum:
> + - sprd,sc2730-typec
> + - sprd,sc2721-typec

Order alphabetically, please.

> + - sprd,ump96xx-typec
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + sprd,mode:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + The Type-C port mode type

This does not look appropriate. You need to use usb-connector.yaml and
its power-role property. Check existing examples.

Even without usb-connector.yaml schema, you should not hard-code some
magical 32-bit unknown numbers without any documented meaning (bindings)...

> +
> + nvmem-cells:
> + maxItems: 2
> + description:
> + Reference to an nvmem node for the calibration data.
> +
> + nvmem-cell-names:
> + items:
> + - const: typec_cc1_cal
> + - const: typec_cc2_cal
> +
> +required:
> + - compatible
> + - reg
> + - sprd,mode
> + - nvmem-cells
> + - nvmem-cell-names
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + pmic {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + pmic_typec: typec@380 {
> + compatible = "sprd,sc2730-typec";
> + interrupt-parent = <&sc2730_pmic>;
> + interrupts = <8>;
> + reg = <0x380>;

Put reg just after compatible.

> + sprd,mode = <2>;
> + nvmem-cells = <&typec_cc1_cal>, <&typec_cc2_cal>;
> + nvmem-cell-names = "typec_cc1_cal", "typec_cc2_cal";
> + status = "okay";

Examples do not have status. No point.

> + };
> + };
> +...


Best regards,
Krzysztof