devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Kyle Tso <kyletso@google.com>
Cc: krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	linux@roeck-us.net, heikki.krogerus@linux.intel.com,
	gregkh@linuxfoundation.org, badhri@google.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: connector: Add child nodes for multiple PD capabilities
Date: Fri, 14 Jul 2023 10:09:12 -0600	[thread overview]
Message-ID: <20230714160912.GA3920890-robh@kernel.org> (raw)
In-Reply-To: <20230712072853.1755559-2-kyletso@google.com>

On Wed, Jul 12, 2023 at 03:28:52PM +0800, Kyle Tso wrote:
> Define a new optional property "capabilities" which is a child node
> under connector to contain multiple USB Power Delivery capabilities.

Is multiple capabilities a USB spec thing or some Linux feature? I think 
DT should only define the limits of the h/w capabilities and if the OS 
wants to define multiple profiles within those limits that's its 
problem.

> 
> Define a new property with pattern (e.g. caps0, caps1) which is a child
> node under "capabilities". Each node contains PDO data of a selectable
> Power Delivery capability.
> 
> Signed-off-by: Kyle Tso <kyletso@google.com>
> ---
>  .../bindings/connector/usb-connector.yaml     | 44 +++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml
> index 1c4d3eb87763..b8c96d0a127a 100644
> --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml
> +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml
> @@ -228,6 +228,50 @@ 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]+$":

caps-[0-9] is more the convention.

> +        description: Child nodes under "capabilities" node. Each node contains a selectable USB
> +          Power Delivery capability.
> +        type: object
> +
> +        properties:
> +          source-pdos:

You are now defining the same property twice. You can use '$defs' to 
define common properties and then reference them. Or put all the PD 
properties into its own schema file and reference it.

> +            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.
> +            $ref: /schemas/types.yaml#/definitions/uint32-array
> +            minItems: 1
> +            maxItems: 7
> +
> +          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.
> +            $ref: /schemas/types.yaml#/definitions/uint32-array
> +            minItems: 1
> +            maxItems: 7
> +
> +          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.
> +
> +        additionalProperties: false
> +
> +    additionalProperties: false
> +
>  dependencies:
>    sink-vdos-v1: [ 'sink-vdos' ]
>    sink-vdos: [ 'sink-vdos-v1' ]
> -- 
> 2.41.0.255.g8b1d071c50-goog
> 

  reply	other threads:[~2023-07-14 16:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12  7:28 [PATCH 0/2] mutiple selectable capabilities in tcpm Kyle Tso
2023-07-12  7:28 ` [PATCH 1/2] dt-bindings: connector: Add child nodes for multiple PD capabilities Kyle Tso
2023-07-14 16:09   ` Rob Herring [this message]
2023-07-17 13:08     ` Kyle Tso
2023-07-12  7:28 ` [PATCH 2/2] usb: typec: tcpm: Support multiple capabilities Kyle Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230714160912.GA3920890-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=badhri@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).