Message ID | 20240911000715.554184-2-amitsd@google.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [RFC,1/2] dt-bindings: connector: Add property to set pd timer values | expand |
On Tue, Sep 10, 2024 at 05:07:05PM GMT, Amit Sunil Dhamne wrote: > This commit adds a new property "pd-timers" to enable setting of > platform/board specific pd timer values for timers that have a range of > acceptable values. > > Cc: Badhri Jagan Sridharan <badhri@google.com> > Cc: linux-usb@vger.kernel.org > Cc: devicetree@vger.kernel.org > Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> > --- > .../bindings/connector/usb-connector.yaml | 23 +++++++++++++++++++ > include/dt-bindings/usb/pd.h | 8 +++++++ > 2 files changed, 31 insertions(+) > > diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml > index fb216ce68bb3..9be4ed12f13c 100644 > --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml > +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml > @@ -253,6 +253,16 @@ properties: > > additionalProperties: false > > + pd-timers: > + description: An array of u32 integers, where an even index (i) is the timer (referenced in > + dt-bindings/usb/pd.h) and the odd index (i+1) is the timer value in ms (refer > + "Table 6-68 Time Values" of "USB Power Delivery Specification Revision 3.0, Version 1.2 " for > + the appropriate value). For certain timers the PD spec defines a range rather than a fixed > + value. The timers may need to be tuned based on the platform. This dt property allows the user > + to assign specific values based on the platform. If these values are not explicitly defined, > + TCPM will use a valid default value for such timers. > + $ref: /schemas/types.yaml#/definitions/uint32-array Is it really necessary to use the array property? I think it's easier and more logical to define corresponding individual properties, one per the timer. > + > dependencies: > sink-vdos-v1: [ sink-vdos ] > sink-vdos: [ sink-vdos-v1 ] > @@ -478,3 +488,16 @@ examples: > }; > }; > }; > + > + # USB-C connector with PD timers > + - | > + #include <dt-bindings/usb/pd.h> > + usb { > + connector { > + compatible = "usb-c-connector"; > + label = "USB-C"; > + pd-timers = > + <PD_TIMER_SINK_WAIT_CAP 600>, > + <PD_TIMER_CC_DEBOUNCE 170>; > + }; > + }; > diff --git a/include/dt-bindings/usb/pd.h b/include/dt-bindings/usb/pd.h > index e6526b138174..6c58c30f3f39 100644 > --- a/include/dt-bindings/usb/pd.h > +++ b/include/dt-bindings/usb/pd.h > @@ -465,4 +465,12 @@ > | ((vbm) & 0x3) << 15 | (curr) << 14 | ((vbi) & 0x3f) << 7 \ > | ((gi) & 0x3f) << 1 | (ct)) > > +/* PD Timer definitions */ > +/* tTypeCSinkWaitCap (Table 6-68 Time Values, USB PD3.1 Spec) */ > +#define PD_TIMER_SINK_WAIT_CAP 0 > +/* tPSSourceOff (Table 6-68 Time Values, USB PD3.1 Spec) */ > +#define PD_TIMER_PS_SOURCE_OFF 1 > +/* tCCDebounce (Table 4-33 CC Timing, USB Type-C Cable & Connector Spec Rel2.2) */ > +#define PD_TIMER_CC_DEBOUNCE 2 > + > #endif /* __DT_POWER_DELIVERY_H */ > -- > 2.46.0.598.g6f2099f65c-goog >
Hi Dmitry, On 9/12/24 3:05 AM, Dmitry Baryshkov wrote: > On Tue, Sep 10, 2024 at 05:07:05PM GMT, Amit Sunil Dhamne wrote: >> This commit adds a new property "pd-timers" to enable setting of >> platform/board specific pd timer values for timers that have a range of >> acceptable values. >> >> Cc: Badhri Jagan Sridharan <badhri@google.com> >> Cc: linux-usb@vger.kernel.org >> Cc: devicetree@vger.kernel.org >> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> >> --- >> .../bindings/connector/usb-connector.yaml | 23 +++++++++++++++++++ >> include/dt-bindings/usb/pd.h | 8 +++++++ >> 2 files changed, 31 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml >> index fb216ce68bb3..9be4ed12f13c 100644 >> --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml >> +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml >> @@ -253,6 +253,16 @@ properties: >> >> additionalProperties: false >> >> + pd-timers: >> + description: An array of u32 integers, where an even index (i) is the timer (referenced in >> + dt-bindings/usb/pd.h) and the odd index (i+1) is the timer value in ms (refer >> + "Table 6-68 Time Values" of "USB Power Delivery Specification Revision 3.0, Version 1.2 " for >> + the appropriate value). For certain timers the PD spec defines a range rather than a fixed >> + value. The timers may need to be tuned based on the platform. This dt property allows the user >> + to assign specific values based on the platform. If these values are not explicitly defined, >> + TCPM will use a valid default value for such timers. >> + $ref: /schemas/types.yaml#/definitions/uint32-array > Is it really necessary to use the array property? I think it's easier > and more logical to define corresponding individual properties, one per > the timer. Thanks for the review. The reason I did it this way was for convenience. If in the future someone else wants add a new timer, it'd be convenient to just add it as a new macro definition in pd.h rather than having to define a new property each time, especially if folks want to add more timers (scales better). There are 3 timers already and I am working to add a fourth in a follow up patch if the current RFC gets accepted. Please let me know what do you think? Regards, Amit >> + >> dependencies: >> sink-vdos-v1: [ sink-vdos ] >> sink-vdos: [ sink-vdos-v1 ] >> @@ -478,3 +488,16 @@ examples: >> }; >> }; >> }; >> + >> + # USB-C connector with PD timers >> + - | >> + #include <dt-bindings/usb/pd.h> >> + usb { >> + connector { >> + compatible = "usb-c-connector"; >> + label = "USB-C"; >> + pd-timers = >> + <PD_TIMER_SINK_WAIT_CAP 600>, >> + <PD_TIMER_CC_DEBOUNCE 170>; >> + }; >> + }; >> diff --git a/include/dt-bindings/usb/pd.h b/include/dt-bindings/usb/pd.h >> index e6526b138174..6c58c30f3f39 100644 >> --- a/include/dt-bindings/usb/pd.h >> +++ b/include/dt-bindings/usb/pd.h >> @@ -465,4 +465,12 @@ >> | ((vbm) & 0x3) << 15 | (curr) << 14 | ((vbi) & 0x3f) << 7 \ >> | ((gi) & 0x3f) << 1 | (ct)) >> >> +/* PD Timer definitions */ >> +/* tTypeCSinkWaitCap (Table 6-68 Time Values, USB PD3.1 Spec) */ >> +#define PD_TIMER_SINK_WAIT_CAP 0 >> +/* tPSSourceOff (Table 6-68 Time Values, USB PD3.1 Spec) */ >> +#define PD_TIMER_PS_SOURCE_OFF 1 >> +/* tCCDebounce (Table 4-33 CC Timing, USB Type-C Cable & Connector Spec Rel2.2) */ >> +#define PD_TIMER_CC_DEBOUNCE 2 >> + >> #endif /* __DT_POWER_DELIVERY_H */ >> -- >> 2.46.0.598.g6f2099f65c-goog >>
On Thu, Sep 12, 2024 at 04:26:25PM GMT, Amit Sunil Dhamne wrote: > Hi Dmitry, > > On 9/12/24 3:05 AM, Dmitry Baryshkov wrote: > > On Tue, Sep 10, 2024 at 05:07:05PM GMT, Amit Sunil Dhamne wrote: > > > This commit adds a new property "pd-timers" to enable setting of > > > platform/board specific pd timer values for timers that have a range of > > > acceptable values. > > > > > > Cc: Badhri Jagan Sridharan <badhri@google.com> > > > Cc: linux-usb@vger.kernel.org > > > Cc: devicetree@vger.kernel.org > > > Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> > > > --- > > > .../bindings/connector/usb-connector.yaml | 23 +++++++++++++++++++ > > > include/dt-bindings/usb/pd.h | 8 +++++++ > > > 2 files changed, 31 insertions(+) > > > > > > diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml > > > index fb216ce68bb3..9be4ed12f13c 100644 > > > --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml > > > +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml > > > @@ -253,6 +253,16 @@ properties: > > > additionalProperties: false > > > + pd-timers: > > > + description: An array of u32 integers, where an even index (i) is the timer (referenced in > > > + dt-bindings/usb/pd.h) and the odd index (i+1) is the timer value in ms (refer > > > + "Table 6-68 Time Values" of "USB Power Delivery Specification Revision 3.0, Version 1.2 " for > > > + the appropriate value). For certain timers the PD spec defines a range rather than a fixed > > > + value. The timers may need to be tuned based on the platform. This dt property allows the user > > > + to assign specific values based on the platform. If these values are not explicitly defined, > > > + TCPM will use a valid default value for such timers. > > > + $ref: /schemas/types.yaml#/definitions/uint32-array > > Is it really necessary to use the array property? I think it's easier > > and more logical to define corresponding individual properties, one per > > the timer. > > Thanks for the review. The reason I did it this way was for > convenience. If in the future someone else wants add a new timer, > it'd be convenient to just add it as a new macro definition in pd.h > rather than having to define a new property each time, especially > if folks want to add more timers (scales better). > There are 3 timers already and I am working to add a fourth in a > follow up patch if the current RFC gets accepted. > > Please let me know what do you think? I'd leave the decision to DT maintainers, but in my opinion multiple properties scale better. Having a single value per property is easier to handle rather than changing the tagged array. > > Regards, > > Amit > > > > + > > > dependencies: > > > sink-vdos-v1: [ sink-vdos ] > > > sink-vdos: [ sink-vdos-v1 ] > > > @@ -478,3 +488,16 @@ examples: > > > }; > > > }; > > > }; > > > + > > > + # USB-C connector with PD timers > > > + - | > > > + #include <dt-bindings/usb/pd.h> > > > + usb { > > > + connector { > > > + compatible = "usb-c-connector"; > > > + label = "USB-C"; > > > + pd-timers = > > > + <PD_TIMER_SINK_WAIT_CAP 600>, > > > + <PD_TIMER_CC_DEBOUNCE 170>; > > > + }; > > > + }; > > > diff --git a/include/dt-bindings/usb/pd.h b/include/dt-bindings/usb/pd.h > > > index e6526b138174..6c58c30f3f39 100644 > > > --- a/include/dt-bindings/usb/pd.h > > > +++ b/include/dt-bindings/usb/pd.h > > > @@ -465,4 +465,12 @@ > > > | ((vbm) & 0x3) << 15 | (curr) << 14 | ((vbi) & 0x3f) << 7 \ > > > | ((gi) & 0x3f) << 1 | (ct)) > > > +/* PD Timer definitions */ > > > +/* tTypeCSinkWaitCap (Table 6-68 Time Values, USB PD3.1 Spec) */ > > > +#define PD_TIMER_SINK_WAIT_CAP 0 > > > +/* tPSSourceOff (Table 6-68 Time Values, USB PD3.1 Spec) */ > > > +#define PD_TIMER_PS_SOURCE_OFF 1 > > > +/* tCCDebounce (Table 4-33 CC Timing, USB Type-C Cable & Connector Spec Rel2.2) */ > > > +#define PD_TIMER_CC_DEBOUNCE 2 > > > + > > > #endif /* __DT_POWER_DELIVERY_H */ > > > -- > > > 2.46.0.598.g6f2099f65c-goog > > >
On 11/09/2024 02:07, Amit Sunil Dhamne wrote: > This commit adds a new property "pd-timers" to enable setting of > platform/board specific pd timer values for timers that have a range of > acceptable values. > > Cc: Badhri Jagan Sridharan <badhri@google.com> > Cc: linux-usb@vger.kernel.org > Cc: devicetree@vger.kernel.org > Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> Please work on mainline, not ancient tree. You cannot get my CC address like that from mainline. It's not possible. So either you don't develop on mainline or you don't use get_maintainers.pl/b4/patman. > --- > .../bindings/connector/usb-connector.yaml | 23 +++++++++++++++++++ > include/dt-bindings/usb/pd.h | 8 +++++++ > 2 files changed, 31 insertions(+) > > diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml > index fb216ce68bb3..9be4ed12f13c 100644 > --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml > +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml > @@ -253,6 +253,16 @@ properties: > > additionalProperties: false > > + pd-timers: > + description: An array of u32 integers, where an even index (i) is the timer (referenced in > + dt-bindings/usb/pd.h) and the odd index (i+1) is the timer value in ms (refer timer of what? OS behavior? > + "Table 6-68 Time Values" of "USB Power Delivery Specification Revision 3.0, Version 1.2 " for > + the appropriate value). For certain timers the PD spec defines a range rather than a fixed > + value. The timers may need to be tuned based on the platform. This dt property allows the user Do not describe what DT is. We all know what DT properties allow. Instead describe how this relates to hardware or boards. All this is wrongly wrapped. See Coding style (and I am not telling you the value on purpose, so you will read the coding style) . > + to assign specific values based on the platform. If these values are not explicitly defined, > + TCPM will use a valid default value for such timers. And what is the default? > + $ref: /schemas/types.yaml#/definitions/uint32-array I guess you want matrix here. > + > dependencies: > sink-vdos-v1: [ sink-vdos ] > sink-vdos: [ sink-vdos-v1 ] > @@ -478,3 +488,16 @@ examples: > }; > }; > }; > + > + # USB-C connector with PD timers > + - | > + #include <dt-bindings/usb/pd.h> > + usb { > + connector { > + compatible = "usb-c-connector"; > + label = "USB-C"; > + pd-timers = > + <PD_TIMER_SINK_WAIT_CAP 600>, > + <PD_TIMER_CC_DEBOUNCE 170>; Incorporate it into existing example. > + }; > + }; > diff --git a/include/dt-bindings/usb/pd.h b/include/dt-bindings/usb/pd.h > index e6526b138174..6c58c30f3f39 100644 > --- a/include/dt-bindings/usb/pd.h > +++ b/include/dt-bindings/usb/pd.h > @@ -465,4 +465,12 @@ > | ((vbm) & 0x3) << 15 | (curr) << 14 | ((vbi) & 0x3f) << 7 \ > | ((gi) & 0x3f) << 1 | (ct)) > > +/* PD Timer definitions */ > +/* tTypeCSinkWaitCap (Table 6-68 Time Values, USB PD3.1 Spec) */ Please expand this a bit, so we won't have to reach to external sources. > +#define PD_TIMER_SINK_WAIT_CAP 0 > +/* tPSSourceOff (Table 6-68 Time Values, USB PD3.1 Spec) */ > +#define PD_TIMER_PS_SOURCE_OFF 1 > +/* tCCDebounce (Table 4-33 CC Timing, USB Type-C Cable & Connector Spec Rel2.2) */ > +#define PD_TIMER_CC_DEBOUNCE 2 Best regards, Krzysztof
On 13/09/2024 01:26, Amit Sunil Dhamne wrote: > Hi Dmitry, > > On 9/12/24 3:05 AM, Dmitry Baryshkov wrote: >> On Tue, Sep 10, 2024 at 05:07:05PM GMT, Amit Sunil Dhamne wrote: >>> This commit adds a new property "pd-timers" to enable setting of >>> platform/board specific pd timer values for timers that have a range of >>> acceptable values. >>> >>> Cc: Badhri Jagan Sridharan <badhri@google.com> >>> Cc: linux-usb@vger.kernel.org >>> Cc: devicetree@vger.kernel.org >>> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> >>> --- >>> .../bindings/connector/usb-connector.yaml | 23 +++++++++++++++++++ >>> include/dt-bindings/usb/pd.h | 8 +++++++ >>> 2 files changed, 31 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml >>> index fb216ce68bb3..9be4ed12f13c 100644 >>> --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml >>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml >>> @@ -253,6 +253,16 @@ properties: >>> >>> additionalProperties: false >>> >>> + pd-timers: >>> + description: An array of u32 integers, where an even index (i) is the timer (referenced in >>> + dt-bindings/usb/pd.h) and the odd index (i+1) is the timer value in ms (refer >>> + "Table 6-68 Time Values" of "USB Power Delivery Specification Revision 3.0, Version 1.2 " for >>> + the appropriate value). For certain timers the PD spec defines a range rather than a fixed >>> + value. The timers may need to be tuned based on the platform. This dt property allows the user >>> + to assign specific values based on the platform. If these values are not explicitly defined, >>> + TCPM will use a valid default value for such timers. >>> + $ref: /schemas/types.yaml#/definitions/uint32-array >> Is it really necessary to use the array property? I think it's easier >> and more logical to define corresponding individual properties, one per >> the timer. > > Thanks for the review. The reason I did it this way was for > convenience. If in the future someone else wants add a new timer, > it'd be convenient to just add it as a new macro definition in pd.h > rather than having to define a new property each time, especially > if folks want to add more timers (scales better). > There are 3 timers already and I am working to add a fourth in a > follow up patch if the current RFC gets accepted. > > Please let me know what do you think? Binding is supposed to be complete. You already know this is not complete... Best regards, Krzysztof
On Fri, Sep 13, 2024 at 07:34:27AM +0300, Dmitry Baryshkov wrote: > On Thu, Sep 12, 2024 at 04:26:25PM GMT, Amit Sunil Dhamne wrote: > > Hi Dmitry, > > > > On 9/12/24 3:05 AM, Dmitry Baryshkov wrote: > > > On Tue, Sep 10, 2024 at 05:07:05PM GMT, Amit Sunil Dhamne wrote: > > > > This commit adds a new property "pd-timers" to enable setting of > > > > platform/board specific pd timer values for timers that have a range of > > > > acceptable values. > > > > > > > > Cc: Badhri Jagan Sridharan <badhri@google.com> > > > > Cc: linux-usb@vger.kernel.org > > > > Cc: devicetree@vger.kernel.org > > > > Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> > > > > --- > > > > .../bindings/connector/usb-connector.yaml | 23 +++++++++++++++++++ > > > > include/dt-bindings/usb/pd.h | 8 +++++++ > > > > 2 files changed, 31 insertions(+) > > > > > > > > diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml > > > > index fb216ce68bb3..9be4ed12f13c 100644 > > > > --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml > > > > +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml > > > > @@ -253,6 +253,16 @@ properties: > > > > additionalProperties: false > > > > + pd-timers: > > > > + description: An array of u32 integers, where an even index (i) is the timer (referenced in > > > > + dt-bindings/usb/pd.h) and the odd index (i+1) is the timer value in ms (refer > > > > + "Table 6-68 Time Values" of "USB Power Delivery Specification Revision 3.0, Version 1.2 " for > > > > + the appropriate value). For certain timers the PD spec defines a range rather than a fixed > > > > + value. The timers may need to be tuned based on the platform. This dt property allows the user > > > > + to assign specific values based on the platform. If these values are not explicitly defined, > > > > + TCPM will use a valid default value for such timers. > > > > + $ref: /schemas/types.yaml#/definitions/uint32-array > > > Is it really necessary to use the array property? I think it's easier > > > and more logical to define corresponding individual properties, one per > > > the timer. > > > > Thanks for the review. The reason I did it this way was for > > convenience. If in the future someone else wants add a new timer, > > it'd be convenient to just add it as a new macro definition in pd.h > > rather than having to define a new property each time, especially > > if folks want to add more timers (scales better). > > There are 3 timers already and I am working to add a fourth in a > > follow up patch if the current RFC gets accepted. > > > > Please let me know what do you think? > > I'd leave the decision to DT maintainers, but in my opinion multiple > properties scale better. Having a single value per property is easier to > handle rather than changing the tagged array. I agree. And it avoids what looks like a made up number space with the defines. And note that an array of tuples is a matrix in DT defined types, not an array. Rob
Hi Rob, On 9/16/24 9:33 AM, Rob Herring wrote: > On Fri, Sep 13, 2024 at 07:34:27AM +0300, Dmitry Baryshkov wrote: >> On Thu, Sep 12, 2024 at 04:26:25PM GMT, Amit Sunil Dhamne wrote: >>> Hi Dmitry, >>> >>> On 9/12/24 3:05 AM, Dmitry Baryshkov wrote: >>>> On Tue, Sep 10, 2024 at 05:07:05PM GMT, Amit Sunil Dhamne wrote: >>>>> This commit adds a new property "pd-timers" to enable setting of >>>>> platform/board specific pd timer values for timers that have a range of >>>>> acceptable values. >>>>> >>>>> Cc: Badhri Jagan Sridharan <badhri@google.com> >>>>> Cc: linux-usb@vger.kernel.org >>>>> Cc: devicetree@vger.kernel.org >>>>> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> >>>>> --- >>>>> .../bindings/connector/usb-connector.yaml | 23 +++++++++++++++++++ >>>>> include/dt-bindings/usb/pd.h | 8 +++++++ >>>>> 2 files changed, 31 insertions(+) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml >>>>> index fb216ce68bb3..9be4ed12f13c 100644 >>>>> --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml >>>>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml >>>>> @@ -253,6 +253,16 @@ properties: >>>>> additionalProperties: false >>>>> + pd-timers: >>>>> + description: An array of u32 integers, where an even index (i) is the timer (referenced in >>>>> + dt-bindings/usb/pd.h) and the odd index (i+1) is the timer value in ms (refer >>>>> + "Table 6-68 Time Values" of "USB Power Delivery Specification Revision 3.0, Version 1.2 " for >>>>> + the appropriate value). For certain timers the PD spec defines a range rather than a fixed >>>>> + value. The timers may need to be tuned based on the platform. This dt property allows the user >>>>> + to assign specific values based on the platform. If these values are not explicitly defined, >>>>> + TCPM will use a valid default value for such timers. >>>>> + $ref: /schemas/types.yaml#/definitions/uint32-array >>>> Is it really necessary to use the array property? I think it's easier >>>> and more logical to define corresponding individual properties, one per >>>> the timer. >>> Thanks for the review. The reason I did it this way was for >>> convenience. If in the future someone else wants add a new timer, >>> it'd be convenient to just add it as a new macro definition in pd.h >>> rather than having to define a new property each time, especially >>> if folks want to add more timers (scales better). >>> There are 3 timers already and I am working to add a fourth in a >>> follow up patch if the current RFC gets accepted. >>> >>> Please let me know what do you think? >> I'd leave the decision to DT maintainers, but in my opinion multiple >> properties scale better. Having a single value per property is easier to >> handle rather than changing the tagged array. > I agree. And it avoids what looks like a made up number space with the > defines. > > And note that an array of tuples is a matrix in DT defined types, not > an array. Thanks for the review! I will incorporate the suggested comments in the next revision by creating a "single value per timer" property. Regards, Amit > > Rob
Hi Krzysztof, Thanks for the review! On 9/16/24 9:05 AM, Krzysztof Kozlowski wrote: > On 11/09/2024 02:07, Amit Sunil Dhamne wrote: >> This commit adds a new property "pd-timers" to enable setting of >> platform/board specific pd timer values for timers that have a range of >> acceptable values. >> >> Cc: Badhri Jagan Sridharan <badhri@google.com> >> Cc: linux-usb@vger.kernel.org >> Cc: devicetree@vger.kernel.org >> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> > Please work on mainline, not ancient tree. You cannot get my CC address > like that from mainline. I was working off gregkh's tree on usb-next branch as that's suggested for USB development. > It's not possible. So either you don't develop > on mainline or you don't use get_maintainers.pl/b4/patman. > The above branch and even the tree on Linus' master branch has you listed as a maintainer (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/MAINTAINERS#n17181). I guess that's why the get_maintainers script probably returned your email id when I ran it. Please let me know if I missed something :). >> --- >> .../bindings/connector/usb-connector.yaml | 23 +++++++++++++++++++ >> include/dt-bindings/usb/pd.h | 8 +++++++ >> 2 files changed, 31 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml >> index fb216ce68bb3..9be4ed12f13c 100644 >> --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml >> +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml >> @@ -253,6 +253,16 @@ properties: >> >> additionalProperties: false >> >> + pd-timers: >> + description: An array of u32 integers, where an even index (i) is the timer (referenced in >> + dt-bindings/usb/pd.h) and the odd index (i+1) is the timer value in ms (refer > timer of what? OS behavior? In the context of USB Type C Power Delivery (PD), timers are run on the typec protocol driver (usb/typec/tcpm/tcpm.c). These are used to keep track of min/max or range of time required to enter a PD state with the goal of a successful USB typec capabilities negotiation. Eg., the timer PD_TIMER_SINK_WAIT_CAP (referred to as SinkWaitCapTimer in spec)would be responsible to keep track of whether a power source sent us (as sink) PD source capabilities pkts within 600ms (say), if yes, then we would transition to the next state or do a state machine reset. USB PD 3.1 spec refers to these elements as timers and therefore referred to as such here. >> + "Table 6-68 Time Values" of "USB Power Delivery Specification Revision 3.0, Version 1.2 " for >> + the appropriate value). For certain timers the PD spec defines a range rather than a fixed >> + value. The timers may need to be tuned based on the platform. This dt property allows the user > Do not describe what DT is. We all know what DT properties allow. > Instead describe how this relates to hardware or boards. > > All this is wrongly wrapped. See Coding style (and I am not telling you > the value on purpose, so you will read the coding style) . Ack. Thanks for pointing it out, I will fix both the above in the next revision. > >> + to assign specific values based on the platform. If these values are not explicitly defined, >> + TCPM will use a valid default value for such timers. > And what is the default? Defaults are given in (include/linux/usb/pd.h). But I guess I should have probably mentioned that here. > >> + $ref: /schemas/types.yaml#/definitions/uint32-array > I guess you want matrix here. Yes, I should have. Though, I will be re-implementing this such that each timer is represented as a separate property based on Rob and Dmitry's suggestion in https://lore.kernel.org/lkml/20240916163328.GA394032-robh@kernel.org/ . >> + >> dependencies: >> sink-vdos-v1: [ sink-vdos ] >> sink-vdos: [ sink-vdos-v1 ] >> @@ -478,3 +488,16 @@ examples: >> }; >> }; >> }; >> + >> + # USB-C connector with PD timers >> + - | >> + #include <dt-bindings/usb/pd.h> >> + usb { >> + connector { >> + compatible = "usb-c-connector"; >> + label = "USB-C"; >> + pd-timers = >> + <PD_TIMER_SINK_WAIT_CAP 600>, >> + <PD_TIMER_CC_DEBOUNCE 170>; > Incorporate it into existing example. > Ack. >> + }; >> + }; >> diff --git a/include/dt-bindings/usb/pd.h b/include/dt-bindings/usb/pd.h >> index e6526b138174..6c58c30f3f39 100644 >> --- a/include/dt-bindings/usb/pd.h >> +++ b/include/dt-bindings/usb/pd.h >> @@ -465,4 +465,12 @@ >> | ((vbm) & 0x3) << 15 | (curr) << 14 | ((vbi) & 0x3f) << 7 \ >> | ((gi) & 0x3f) << 1 | (ct)) >> >> +/* PD Timer definitions */ >> +/* tTypeCSinkWaitCap (Table 6-68 Time Values, USB PD3.1 Spec) */ > Please expand this a bit, so we won't have to reach to external sources. Ack. I will incorporate all of your review comments. Since you are no longer maintaining the "OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" component, please let me know if you'd still like to be CC'ed in the subsequent revisions. Thanks, Amit >> +#define PD_TIMER_SINK_WAIT_CAP 0 >> +/* tPSSourceOff (Table 6-68 Time Values, USB PD3.1 Spec) */ >> +#define PD_TIMER_PS_SOURCE_OFF 1 >> +/* tCCDebounce (Table 4-33 CC Timing, USB Type-C Cable & Connector Spec Rel2.2) */ >> +#define PD_TIMER_CC_DEBOUNCE 2 > > Best regards, > Krzysztof >
diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml index fb216ce68bb3..9be4ed12f13c 100644 --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml @@ -253,6 +253,16 @@ properties: additionalProperties: false + pd-timers: + description: An array of u32 integers, where an even index (i) is the timer (referenced in + dt-bindings/usb/pd.h) and the odd index (i+1) is the timer value in ms (refer + "Table 6-68 Time Values" of "USB Power Delivery Specification Revision 3.0, Version 1.2 " for + the appropriate value). For certain timers the PD spec defines a range rather than a fixed + value. The timers may need to be tuned based on the platform. This dt property allows the user + to assign specific values based on the platform. If these values are not explicitly defined, + TCPM will use a valid default value for such timers. + $ref: /schemas/types.yaml#/definitions/uint32-array + dependencies: sink-vdos-v1: [ sink-vdos ] sink-vdos: [ sink-vdos-v1 ] @@ -478,3 +488,16 @@ examples: }; }; }; + + # USB-C connector with PD timers + - | + #include <dt-bindings/usb/pd.h> + usb { + connector { + compatible = "usb-c-connector"; + label = "USB-C"; + pd-timers = + <PD_TIMER_SINK_WAIT_CAP 600>, + <PD_TIMER_CC_DEBOUNCE 170>; + }; + }; diff --git a/include/dt-bindings/usb/pd.h b/include/dt-bindings/usb/pd.h index e6526b138174..6c58c30f3f39 100644 --- a/include/dt-bindings/usb/pd.h +++ b/include/dt-bindings/usb/pd.h @@ -465,4 +465,12 @@ | ((vbm) & 0x3) << 15 | (curr) << 14 | ((vbi) & 0x3f) << 7 \ | ((gi) & 0x3f) << 1 | (ct)) +/* PD Timer definitions */ +/* tTypeCSinkWaitCap (Table 6-68 Time Values, USB PD3.1 Spec) */ +#define PD_TIMER_SINK_WAIT_CAP 0 +/* tPSSourceOff (Table 6-68 Time Values, USB PD3.1 Spec) */ +#define PD_TIMER_PS_SOURCE_OFF 1 +/* tCCDebounce (Table 4-33 CC Timing, USB Type-C Cable & Connector Spec Rel2.2) */ +#define PD_TIMER_CC_DEBOUNCE 2 + #endif /* __DT_POWER_DELIVERY_H */
This commit adds a new property "pd-timers" to enable setting of platform/board specific pd timer values for timers that have a range of acceptable values. Cc: Badhri Jagan Sridharan <badhri@google.com> Cc: linux-usb@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: Amit Sunil Dhamne <amitsd@google.com> --- .../bindings/connector/usb-connector.yaml | 23 +++++++++++++++++++ include/dt-bindings/usb/pd.h | 8 +++++++ 2 files changed, 31 insertions(+)