dt-bindings: connector: usb: provide bindings for altmodes
Subsystems (6)
v2 cover dt-bindings: connector: usb: provide bindings for altmodes
In some cases we need a way to specify USB-C AltModes that can be supportd on the particular USB-C connector. For example, x86 INT33FE driver does this by populating fwnode properties internally. For the Qualcomm Robotics RB5 platform (and several similar devices which use Qualcomm PMIC TCPM) we have to put this information to the DT.
Provide the DT bindings for this kind of information and while we are at it, change svid property to be 16-bit unsigned integer instead of a simple u32.
NOTE: usage of u16 is not compatible with the recenty extended qcom/qrb5165-rb5.dts DT file. I'm looking for the guidance from DT and USB maintainers whether to retain u32 usage or it's better to switch to u16.
Changes since v1:
- Added type:object and fixed 'description' string in the altmodes-list definition.
Dmitry Baryshkov (3):
dt-bindings: connector: usb: add altmodes description
usb: typec: change altmode SVID to u16 entry
arm64: dts: qcom: qrb5165-rb5: use u16 for DP altmode svid
.../bindings/connector/usb-connector.yaml | 36 +++++++++++++++++++ arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 2 +- drivers/platform/x86/intel/chtwc_int33fe.c | 2 +- drivers/usb/typec/class.c | 5 +-- 4 files changed, 41 insertions(+), 4 deletions(-)
Signature · 1 line
2.42.0
PATCH v2 1/3 dt-bindings: connector: usb: add altmodes description
Add description of the USB-C AltModes supported on the particular USB-C connector. This is required for devices like Qualcomm Robotics RB5, which have no other way to express alternative modes supported by the hardware platform.
--- .../bindings/connector/usb-connector.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+)
Documentation/devicetree/bindings/connector/usb-connector.yaml +36 -0
@@ -14,6 +14,31 @@ description: of a USB interface controller or a separate node when it is attached to both MUX and USB interface controller. +$defs: + altmode-desc: + type: object + description: + A single USB-C Alternative Mode as supported by the USB-C connector logic. + properties: + svid: + $ref: /schemas/types.yaml#/definitions/uint16 + description: Unique value assigned by USB-IF to the Vendor / AltMode. + vdo: + $ref: /schemas/types.yaml#/definitions/uint32 + description: VDO returned by Discover Modes USB PD command. + + altmodes-list: + type: object + description: List of Alternative Modes supported by the schematics on the + particular device. This is only necessary if there are no other means to + discover supported alternative modes (e.g. through the UCSI firmware + interface). + + patternProperties: + "^[a-z][a-z0-9]*$": + $ref: "#/$defs/altmode-desc" + unevaluatedProperties: false + properties: compatible: oneOf:
@@ -171,6 +196,10 @@ properties: offer the power, Capability Mismatch is set. Required for power sink and power dual role. + altmodes: + $ref: "#/$defs/altmodes-list" + unevaluatedProperties: false + port: $ref: /schemas/graph.yaml#/properties/port description: OF graph bindings modeling a data bus to the connector, e.g.
@@ -289,6 +318,13 @@ examples: compatible = "usb-c-connector"; label = "USB-C"; + altmodes { + displayport { + svid = /bits/ 16 <0xff01>; + vdo = <0x00001c46>; + }; + }; + ports { #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.42.0
Rob Herring
maintainerRe: [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description
Quoted 15 lines · Dmitry Baryshkov
Add description of the USB-C AltModes supported on the particular USB-C connector. This is required for devices like Qualcomm Robotics RB5, which have no other way to express alternative modes supported by the hardware platform.
Signed-off-by Dmitry Baryshkov <[email protected]>--- .../bindings/connector/usb-connector.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+)Documentation/devicetree/bindings/connector/usb-connector.yaml +0
-0
Documentation/devicetree/bindings/connector/usb-connector.yaml description: · line 17
Quoted 4 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml +1
-0@@ -14,6 +14,31 @@ description: of a USB interface controller or a separate node when it is attached to both MUX and USB interface controller. +$defs:
I fail to see why we need to use $defs here.
Documentation/devicetree/bindings/connector/usb-connector.yaml description: · line 28
Quoted 11 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml +11
-0+ altmode-desc: + type: object + description: + A single USB-C Alternative Mode as supported by the USB-C connector logic. + properties: + svid: + $ref: /schemas/types.yaml#/definitions/uint16 + description: Unique value assigned by USB-IF to the Vendor / AltMode. + vdo: + $ref: /schemas/types.yaml#/definitions/uint32 + description: VDO returned by Discover Modes USB PD command.
What's VDO?
These names are a bit short. Types for property names are global (mostly). Though this patch doesn't make it clear these were already in use.
Documentation/devicetree/bindings/connector/usb-connector.yaml description: · line 38
Quoted 10 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml +10
-0+ + altmodes-list: + type: object + description: List of Alternative Modes supported by the schematics on the + particular device. This is only necessary if there are no other means to + discover supported alternative modes (e.g. through the UCSI firmware + interface). + + patternProperties: + "^[a-z][a-z0-9]*$":
Are there standard id's and names? Should we define some so we don't get 'dp', 'displayport', etc.
Quoted 34 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml +14
-0+ $ref: "#/$defs/altmode-desc" + unevaluatedProperties: false + properties: compatible: oneOf:@@ -171,6 +196,10 @@ properties: offer the power, Capability Mismatch is set. Required for power sink and power dual role. + altmodes: + $ref: "#/$defs/altmodes-list" + unevaluatedProperties: false + port: $ref: /schemas/graph.yaml#/properties/port description: OF graph bindings modeling a data bus to the connector, e.g.@@ -289,6 +318,13 @@ examples: compatible = "usb-c-connector"; label = "USB-C"; + altmodes { + displayport { + svid = /bits/ 16 <0xff01>; + vdo = <0x00001c46>; + }; + }; + ports { #address-cells = <1>; #size-cells = <0>;Signature · 1 line
2.42.0
Re: [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description
Quoted 20 lines · Rob Herring
Quoted 18 lines · Dmitry Baryshkov
Add description of the USB-C AltModes supported on the particular USB-C connector. This is required for devices like Qualcomm Robotics RB5, which have no other way to express alternative modes supported by the hardware platform.
Signed-off-by Dmitry Baryshkov <[email protected]>--- .../bindings/connector/usb-connector.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+)Documentation/devicetree/bindings/connector/usb-connector.yaml +0
-0@@ -14,6 +14,31 @@ description: of a USB interface controller or a separate node when it is attached to both MUX and USB interface controller.
Quoted 3 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml description: · line 17
Quoted 1 line
Documentation/devicetree/bindings/connector/usb-connector.yaml +1
-0+$defs:I fail to see why we need to use $defs here.
I had an idea of defining a schema piece that can later be referenced from any other place. If you think this is an overkill, I can drop them.
Quoted 13 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml description: · line 28
Quoted 12 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml +11
-0+ altmode-desc: + type: object + description: + A single USB-C Alternative Mode as supported by the USB-C connector logic. + properties: + svid: + $ref: /schemas/types.yaml#/definitions/uint16 + description: Unique value assigned by USB-IF to the Vendor / AltMode. + vdo: + $ref: /schemas/types.yaml#/definitions/uint32 + description: VDO returned by Discover Modes USB PD command.
Quoted 1 line
What's VDO?
Ack, I'll expand it in v3
Quoted 5 lines
These names are a bit short. Types for property names are global (mostly). Though this patch doesn't make it clear these were already in use.
Quoted 13 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml description: · line 38
Quoted 10 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml +10
-0+ + altmodes-list: + type: object + description: List of Alternative Modes supported by the schematics on the + particular device. This is only necessary if there are no other means to + discover supported alternative modes (e.g. through the UCSI firmware + interface). + + patternProperties: + "^[a-z][a-z0-9]*$":Are there standard id's and names? Should we define some so we don't get 'dp', 'displayport', etc.
Indeed it might be better to enumerate them via string enumeration.
Quoted 36 lines
Quoted 36 lines
Documentation/devicetree/bindings/connector/usb-connector.yaml +14
-1+ $ref: "#/$defs/altmode-desc" + unevaluatedProperties: false + properties: compatible: oneOf:@@ -171,6 +196,10 @@ properties: offer the power, Capability Mismatch is set. Required for power sink and power dual role. + altmodes: + $ref: "#/$defs/altmodes-list" + unevaluatedProperties: false + port: $ref: /schemas/graph.yaml#/properties/port description: OF graph bindings modeling a data bus to the connector, e.g.@@ -289,6 +318,13 @@ examples: compatible = "usb-c-connector"; label = "USB-C"; + altmodes { + displayport { + svid = /bits/ 16 <0xff01>; + vdo = <0x00001c46>; + }; + }; + ports { #address-cells = <1>; #size-cells = <0>; --2.42.0
Signature · 2 lines
With best wishes Dmitry
PATCH v2 2/3 usb: typec: change altmode SVID to u16 entry
In reply to Dmitry BaryshkovAs stated in the changelog for the commit 7b458a4c5d73 ("usb: typec: Add typec_port_register_altmodes()"), the code should be adjusted according to the AltMode bindings. As the SVID is 16 bits wide (according to the USB PD Spec), use fwnode_property_read_u16() to read it.
--- drivers/platform/x86/intel/chtwc_int33fe.c | 2 +- drivers/usb/typec/class.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/platform/x86/intel/chtwc_int33fe.c +1 -1
@@ -136,7 +136,7 @@ static const struct software_node altmodes_node = { };static const struct property_entry dp_altmode_properties[] = { -PROPERTY_ENTRY_U32 ("svid" ,0xff01 ), +PROPERTY_ENTRY_U16 ("svid" ,0xff01 ),PROPERTY_ENTRY_U32 ("vdo" ,0x0c0086 ), { } };
drivers/usb/typec/class.c +3 -2
@@ -2238,7 +2238,8 @@ void typec_port_register_altmodes(struct typec_port *port,struct typec_altmode_desc desc;struct typec_altmode *alt;size_t index =0 ; -u32 svid, vdo; +u16 svid; +u32 vdo;int ret; altmodes_node =device_get_named_child_node (&port->dev,"altmodes" );
@@ -2246,7 +2247,7 @@ void typec_port_register_altmodes(struct typec_port *port,return ;/* No altmodes specified */ fwnode_for_each_child_node (altmodes_node, child) { - ret =fwnode_property_read_u32 (child,"svid" , &svid); + ret =fwnode_property_read_u16 (child,"svid" , &svid);if (ret) {dev_err (&port->dev,"Error reading svid for altmode %s\n" ,fwnode_get_name (child));
Signature · 1 line
2.42.0
Re: [PATCH v2 2/3] usb: typec: change altmode SVID to u16 entry
Quoted 7 lines · Dmitry Baryshkov
As stated in the changelog for the commit
7b458a4c5d73("usb: typec: Addtypec_port_register_altmodes()"), the code should be adjusted according to the AltMode bindings. As the SVID is 16 bits wide (according to the USB PD Spec), usefwnode_property_read_u16()to read it.Acked-by Hans de Goede <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>
Quoted 43 lines
--- drivers/platform/x86/intel/chtwc_int33fe.c | 2 +- drivers/usb/typec/class.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)drivers/platform/x86/intel/chtwc_int33fe.c +1
-1@@ -136,7 +136,7 @@ static const struct software_node altmodes_node = { };static const struct property_entry dp_altmode_properties[] = { -PROPERTY_ENTRY_U32 ("svid" ,0xff01 ), +PROPERTY_ENTRY_U16 ("svid" ,0xff01 ),PROPERTY_ENTRY_U32 ("vdo" ,0x0c0086 ), { } };drivers/usb/typec/class.c +3
-2@@ -2238,7 +2238,8 @@ void typec_port_register_altmodes(struct typec_port *port,struct typec_altmode_desc desc;struct typec_altmode *alt;size_t index =0 ; -u32 svid, vdo; +u16 svid; +u32 vdo;int ret; altmodes_node =device_get_named_child_node (&port->dev,"altmodes" );@@ -2246,7 +2247,7 @@ void typec_port_register_altmodes(struct typec_port *port,return ;/* No altmodes specified */ fwnode_for_each_child_node (altmodes_node, child) { - ret =fwnode_property_read_u32 (child,"svid" , &svid); + ret =fwnode_property_read_u16 (child,"svid" , &svid);if (ret) {dev_err (&port->dev,"Error reading svid for altmode %s\n" ,fwnode_get_name (child));Signature · 1 line
2.42.0
Signature · 1 line
heikki
PATCH v2 3/3 arm64: dts: qcom: qrb5165-rb5: use u16 for DP altmode svid
In reply to Dmitry BaryshkovFollow the bindings and use 16-bit value for AltMode SVID instead of using the full u32.
--- arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +1 -1
@@ -1425,7 +1425,7 @@ PDO_FIXED_USB_COMM | altmodes { displayport { - svid = <0xff01>; + svid = /bits/ 16 <0xff01>; vdo = <0x00001c46>; }; };
Signature · 1 line
2.42.0
Re: [PATCH v2 3/3] arm64: dts: qcom: qrb5165-rb5: use u16 for DP altmode svid
Quoted 5 lines · Dmitry Baryshkov
Follow the bindings and use 16-bit value for AltMode SVID instead of using the full u32.
Signed-off-by Dmitry Baryshkov <[email protected]>---
(because it was previously not compliant with bindings)
Konrad
Rob Herring
maintainerQuoted 6 lines · Dmitry Baryshkov
In some cases we need a way to specify USB-C AltModes that can be supportd on the particular USB-C connector. For example, x86 INT33FE driver does this by populating fwnode properties internally. For the Qualcomm Robotics RB5 platform (and several similar devices which use Qualcomm PMIC TCPM) we have to put this information to the DT.
Quoted 8 lines
Provide the DT bindings for this kind of information and while we are at it, change svid property to be 16-bit unsigned integer instead of a simple u32.
NOTE: usage of u16 is not compatible with the recenty extended
qcom/qrb5165-rb5.dtsDT file. I'm looking for the guidance from DT and USB maintainers whether to retain u32 usage or it's better to switch to u16.
Depends if you are fine with the ABI break on this platform...
Rob
Quoted 12 lines · Rob Herring
Quoted 10 lines · Dmitry Baryshkov
In some cases we need a way to specify USB-C AltModes that can be supportd on the particular USB-C connector. For example, x86 INT33FE driver does this by populating fwnode properties internally. For the Qualcomm Robotics RB5 platform (and several similar devices which use Qualcomm PMIC TCPM) we have to put this information to the DT.
Provide the DT bindings for this kind of information and while we are at it, change svid property to be 16-bit unsigned integer instead of a simple u32.
Quoted 6 lines
Quoted 4 lines
NOTE: usage of u16 is not compatible with the recenty extended
qcom/qrb5165-rb5.dtsDT file. I'm looking for the guidance from DT and USB maintainers whether to retain u32 usage or it's better to switch to u16.Depends if you are fine with the ABI break on this platform...
As much as I hate it, yes, we are.
Signature · 2 lines
With best wishes Dmitry