2023-12-04 17:23:15

by Kyle Tso

[permalink] [raw]
Subject: [PATCH v4 1/2] dt-bindings: connector: Add child nodes for multiple PD capabilities

The realtime Power Delivery capabilities of a port may not be always the
same under different hardware status such as the port usage of a
multiple port system or the status of the battery pack. Define the PD
capability sets in DT for better configurability in Type-C/PD port
drivers.

Define an optional child node "capabilities" to contain multiple USB
Power Delivery capabilities.

Define child nodes with pattern (e.g. caps-0, caps-1) under
"capabilities". Each node contains PDO data of a selectable Power
Delivery capability.

Also define common properties for source-pdos, sink-pdos, and
op-sink-microwatt that can be referenced.

Signed-off-by: Kyle Tso <[email protected]>
---
v3 -> v4
- modified the structure of the bindings as corrected in v2
- modified the commit message to better describe the reason of this
change

.../bindings/connector/usb-connector.yaml | 78 ++++++++++++-------
1 file changed, 49 insertions(+), 29 deletions(-)

diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml
index 7c8a3e8430d3..50fec97436d8 100644
--- a/Documentation/devicetree/bindings/connector/usb-connector.yaml
+++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml
@@ -14,6 +14,8 @@ description:
of a USB interface controller or a separate node when it is attached to both
MUX and USB interface controller.

+$ref: "#/$defs/capabilities"
+
properties:
compatible:
oneOf:
@@ -119,30 +121,6 @@ properties:

# The following are optional properties for "usb-c-connector" with power
# delivery support.
- source-pdos:
- description: An array of u32 with each entry providing supported power
- source data object(PDO), the detailed bit definitions of PDO can be found
- in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.2
- Source_Capabilities Message, the order of each entry(PDO) should follow
- the PD spec chapter 6.4.1. Required for power source and power dual role.
- User can specify the source PDO array via PDO_FIXED/BATT/VAR/PPS_APDO()
- defined in dt-bindings/usb/pd.h.
- minItems: 1
- maxItems: 7
- $ref: /schemas/types.yaml#/definitions/uint32-array
-
- sink-pdos:
- description: An array of u32 with each entry providing supported power sink
- data object(PDO), the detailed bit definitions of PDO can be found in
- "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.3
- Sink Capabilities Message, the order of each entry(PDO) should follow the
- PD spec chapter 6.4.1. Required for power sink and power dual role. User
- can specify the sink PDO array via PDO_FIXED/BATT/VAR/PPS_APDO() defined
- in dt-bindings/usb/pd.h.
- minItems: 1
- maxItems: 7
- $ref: /schemas/types.yaml#/definitions/uint32-array
-
sink-vdos:
description: An array of u32 with each entry, a Vendor Defined Message Object (VDO),
providing additional information corresponding to the product, the detailed bit
@@ -166,11 +144,6 @@ properties:
maxItems: 6
$ref: /schemas/types.yaml#/definitions/uint32-array

- op-sink-microwatt:
- description: Sink required operating power in microwatt, if source can't
- offer the power, Capability Mismatch is set. Required for power sink and
- power dual role.
-
port:
$ref: /schemas/graph.yaml#/properties/port
description: OF graph bindings modeling a data bus to the connector, e.g.
@@ -231,6 +204,21 @@ properties:
SNK_READY for non-pd link.
type: boolean

+ capabilities:
+ description: A child node to contain all the selectable USB Power Delivery capabilities.
+ type: object
+
+ patternProperties:
+ "^caps-[0-9]+$":
+ description: Child nodes under "capabilities" node. Each node contains a selectable USB
+ Power Delivery capability.
+ type: object
+ $ref: "#/$defs/capabilities"
+
+ unevaluatedProperties: false
+
+ additionalProperties: false
+
dependencies:
sink-vdos-v1: [ sink-vdos ]
sink-vdos: [ sink-vdos-v1 ]
@@ -238,6 +226,38 @@ dependencies:
required:
- compatible

+$defs:
+ capabilities:
+ properties:
+ source-pdos:
+ description: An array of u32 with each entry providing supported power
+ source data object(PDO), the detailed bit definitions of PDO can be found
+ in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.2
+ Source_Capabilities Message, the order of each entry(PDO) should follow
+ the PD spec chapter 6.4.1. Required for power source and power dual role.
+ User can specify the source PDO array via PDO_FIXED/BATT/VAR/PPS_APDO()
+ defined in dt-bindings/usb/pd.h.
+ minItems: 1
+ maxItems: 7
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+
+ sink-pdos:
+ description: An array of u32 with each entry providing supported power sink
+ data object(PDO), the detailed bit definitions of PDO can be found in
+ "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.3
+ Sink Capabilities Message, the order of each entry(PDO) should follow the
+ PD spec chapter 6.4.1. Required for power sink and power dual role. User
+ can specify the sink PDO array via PDO_FIXED/BATT/VAR/PPS_APDO() defined
+ in dt-bindings/usb/pd.h.
+ minItems: 1
+ maxItems: 7
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+
+ op-sink-microwatt:
+ description: Sink required operating power in microwatt, if source can't
+ offer the power, Capability Mismatch is set. Required for power sink and
+ power dual role.
+
allOf:
- if:
properties:
--
2.43.0.rc2.451.g8631bc7472-goog


2023-12-04 19:29:36

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v4 1/2] dt-bindings: connector: Add child nodes for multiple PD capabilities


On Tue, 05 Dec 2023 01:22:46 +0800, Kyle Tso wrote:
> The realtime Power Delivery capabilities of a port may not be always the
> same under different hardware status such as the port usage of a
> multiple port system or the status of the battery pack. Define the PD
> capability sets in DT for better configurability in Type-C/PD port
> drivers.
>
> Define an optional child node "capabilities" to contain multiple USB
> Power Delivery capabilities.
>
> Define child nodes with pattern (e.g. caps-0, caps-1) under
> "capabilities". Each node contains PDO data of a selectable Power
> Delivery capability.
>
> Also define common properties for source-pdos, sink-pdos, and
> op-sink-microwatt that can be referenced.
>
> Signed-off-by: Kyle Tso <[email protected]>
> ---
> v3 -> v4
> - modified the structure of the bindings as corrected in v2
> - modified the commit message to better describe the reason of this
> change
>
> .../bindings/connector/usb-connector.yaml | 78 ++++++++++++-------
> 1 file changed, 49 insertions(+), 29 deletions(-)
>

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/connector/usb-connector.yaml: $defs:capabilities: 'anyOf' conditional failed, one must be fixed:
'sink-pdos' 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
hint: $defs entries must contain schemas
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/connector/usb-connector.yaml: $defs:capabilities: 'anyOf' conditional failed, one must be fixed:
'op-sink-microwatt' 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
hint: $defs entries must contain schemas
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6370.example.dtb: pmic@34: tcpc:connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/mfd/mediatek,mt6370.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6370.example.dtb: pmic@34: tcpc:connector: Unevaluated properties are not allowed ('op-sink-microwatt', 'sink-pdos' were unexpected)
from schema $id: http://devicetree.org/schemas/mfd/mediatek,mt6370.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6370.example.dtb: tcpc: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/usb/mediatek,mt6370-tcpc.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6370.example.dtb: tcpc: connector: Unevaluated properties are not allowed ('op-sink-microwatt', 'sink-pdos' were unexpected)
from schema $id: http://devicetree.org/schemas/usb/mediatek,mt6370-tcpc.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6370.example.dtb: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/connector/usb-connector.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6360.example.dtb: pmic@34: tcpc:connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/mfd/mediatek,mt6360.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6360.example.dtb: tcpc: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/usb/mediatek,mt6360-tcpc.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/mediatek,mt6360.example.dtb: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/connector/usb-connector.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/mediatek,mt6360-tcpc.example.dtb: mt6360@34: tcpc:connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/mfd/mediatek,mt6360.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/mediatek,mt6360-tcpc.example.dtb: tcpc: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/usb/mediatek,mt6360-tcpc.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/mediatek,mt6360-tcpc.example.dtb: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/connector/usb-connector.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/nxp,ptn5110.example.dtb: tcpci@50: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/usb/nxp,ptn5110.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/nxp,ptn5110.example.dtb: tcpci@50: connector: Unevaluated properties are not allowed ('op-sink-microwatt', 'sink-pdos' were unexpected)
from schema $id: http://devicetree.org/schemas/usb/nxp,ptn5110.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/nxp,ptn5110.example.dtb: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/connector/usb-connector.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/maxim,max33359.example.dtb: maxtcpc@25: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/usb/maxim,max33359.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/maxim,max33359.example.dtb: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/connector/usb-connector.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/richtek,rt1711h.example.dtb: rt1711h@4e: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/usb/richtek,rt1711h.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/richtek,rt1711h.example.dtb: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/connector/usb-connector.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/qcom,pmic-typec.example.dtb: typec@1500: connector: 'source-pdos' does not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/usb/qcom,pmic-typec.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/qcom,pmic-typec.example.dtb: connector: 'source-pdos' does not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/connector/usb-connector.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/fcs,fusb302.example.dtb: typec-portc@54: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/usb/fcs,fusb302.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/fcs,fusb302.example.dtb: typec-portc@54: connector: Unevaluated properties are not allowed ('op-sink-microwatt', 'sink-pdos' were unexpected)
from schema $id: http://devicetree.org/schemas/usb/fcs,fusb302.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/fcs,fusb302.example.dtb: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/connector/usb-connector.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/connector/usb-connector.example.dtb: connector: 'op-sink-microwatt', 'sink-pdos', 'source-pdos' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/connector/usb-connector.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

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.