mbox series

[v4,0/2] mutiple selectable capabilities in tcpm

Message ID 20231204172247.1087152-1-kyletso@google.com
Headers show
Series mutiple selectable capabilities in tcpm | expand

Message

Kyle Tso Dec. 4, 2023, 5:22 p.m. UTC
updates in v4

dt-bindings: connector: Add child nodes for multiple PD capabilities
  - Modified the structure as corrected in v2
  - Modified the commit message

usb: typec: tcpm: Support multiple capabilities
  - no change

---
updates in v3

dt-bindings: connector: Add child nodes for multiple PD capabilities
  - Updated the commit message
  - Remain unchanged for the comments about the property/node
    refactor

usb: typec: tcpm: Support multiple capabilities
  - Changed the error handling and the usage of the APIs
  - Updated the commit message

---
updates in v2

dt-bindings: connector: Add child nodes for multiple PD capabilities
  - revised the dt-bindings

usb: typec: tcpm: Support multiple capabilities
  - Added missing cleanups in the function tcpm_port_unregister_pd

---
Original cover letter:

In commit a7cff92f0635 ("usb: typec: USB Power Delivery helpers for
ports and partners"), typec_operations has two new ops .pd_get and
.pd_set providing selection of different PD capabilities. This commit
implements these two ops in tcpm.

To support multiple capabilities, new dt-binding properties need to be
defined to create a tree structure for the driver to get each set of
capabilities one by one. The first tier of the child node under
connector is called "capabilities". Under this child node lies several
2nd tier of child nodes whose names are in the pattern of ^caps[0-9]+$.
And the source and sink capabilities are placed in these nodes.

Kyle Tso (2):
  dt-bindings: connector: Add child nodes for multiple PD capabilities
  usb: typec: tcpm: Support multiple capabilities

 .../bindings/connector/usb-connector.yaml     |  78 ++--
 drivers/usb/typec/tcpm/tcpm.c                 | 389 ++++++++++++++----
 2 files changed, 352 insertions(+), 115 deletions(-)

Comments

Rob Herring (Arm) Dec. 4, 2023, 7:29 p.m. UTC | #1
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 <kyletso@google.com>
> ---
> 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/20231204172247.1087152-2-kyletso@google.com

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.