devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes
@ 2023-11-13 22:13 Dmitry Baryshkov
  2023-11-13 22:13 ` [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description Dmitry Baryshkov
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Dmitry Baryshkov @ 2023-11-13 22:13 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
	Mark Gross, Heikki Krogerus, Greg Kroah-Hartman
  Cc: devicetree, linux-kernel, linux-arm-msm, platform-driver-x86,
	linux-usb

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(-)

-- 
2.42.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description
  2023-11-13 22:13 [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes Dmitry Baryshkov
@ 2023-11-13 22:13 ` Dmitry Baryshkov
  2023-11-16 18:38   ` Rob Herring
  2023-11-13 22:13 ` [PATCH v2 2/3] usb: typec: change altmode SVID to u16 entry Dmitry Baryshkov
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Dmitry Baryshkov @ 2023-11-13 22:13 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
	Mark Gross, Heikki Krogerus, Greg Kroah-Hartman
  Cc: devicetree, linux-kernel, linux-arm-msm, platform-driver-x86,
	linux-usb

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 <dmitry.baryshkov@linaro.org>
---
 .../bindings/connector/usb-connector.yaml     | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml
index 7c8a3e8430d3..1bd51b86906f 100644
--- a/Documentation/devicetree/bindings/connector/usb-connector.yaml
+++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml
@@ -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>;
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/3] usb: typec: change altmode SVID to u16 entry
  2023-11-13 22:13 [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes Dmitry Baryshkov
  2023-11-13 22:13 ` [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description Dmitry Baryshkov
@ 2023-11-13 22:13 ` Dmitry Baryshkov
  2023-11-15  7:27   ` Heikki Krogerus
  2023-11-13 22:13 ` [PATCH v2 3/3] arm64: dts: qcom: qrb5165-rb5: use u16 for DP altmode svid Dmitry Baryshkov
  2023-11-16 18:36 ` [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes Rob Herring
  3 siblings, 1 reply; 10+ messages in thread
From: Dmitry Baryshkov @ 2023-11-13 22:13 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
	Mark Gross, Heikki Krogerus, Greg Kroah-Hartman
  Cc: devicetree, linux-kernel, linux-arm-msm, platform-driver-x86,
	linux-usb

As 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.

Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/platform/x86/intel/chtwc_int33fe.c | 2 +-
 drivers/usb/typec/class.c                  | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/intel/chtwc_int33fe.c b/drivers/platform/x86/intel/chtwc_int33fe.c
index 848baecc1bb0..93f75ba1dafd 100644
--- a/drivers/platform/x86/intel/chtwc_int33fe.c
+++ b/drivers/platform/x86/intel/chtwc_int33fe.c
@@ -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),
 	{ }
 };
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 6ec2a94e6fad..4251d44137b6 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -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));
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/3] arm64: dts: qcom: qrb5165-rb5: use u16 for DP altmode svid
  2023-11-13 22:13 [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes Dmitry Baryshkov
  2023-11-13 22:13 ` [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description Dmitry Baryshkov
  2023-11-13 22:13 ` [PATCH v2 2/3] usb: typec: change altmode SVID to u16 entry Dmitry Baryshkov
@ 2023-11-13 22:13 ` Dmitry Baryshkov
  2023-11-15 16:17   ` Konrad Dybcio
  2023-11-16 18:36 ` [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes Rob Herring
  3 siblings, 1 reply; 10+ messages in thread
From: Dmitry Baryshkov @ 2023-11-13 22:13 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
	Mark Gross, Heikki Krogerus, Greg Kroah-Hartman
  Cc: devicetree, linux-kernel, linux-arm-msm, platform-driver-x86,
	linux-usb

Follow the bindings and use 16-bit value for AltMode SVID instead of
using the full u32.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
index c8cd40a462a3..88b37ceb13ed 100644
--- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
+++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
@@ -1425,7 +1425,7 @@ PDO_FIXED_USB_COMM |
 
 		altmodes {
 			displayport {
-				svid = <0xff01>;
+				svid = /bits/ 16 <0xff01>;
 				vdo = <0x00001c46>;
 			};
 		};
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/3] usb: typec: change altmode SVID to u16 entry
  2023-11-13 22:13 ` [PATCH v2 2/3] usb: typec: change altmode SVID to u16 entry Dmitry Baryshkov
@ 2023-11-15  7:27   ` Heikki Krogerus
  0 siblings, 0 replies; 10+ messages in thread
From: Heikki Krogerus @ 2023-11-15  7:27 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Hans de Goede, Ilpo Järvinen,
	Mark Gross, Greg Kroah-Hartman, devicetree, linux-kernel,
	linux-arm-msm, platform-driver-x86, linux-usb

On Tue, Nov 14, 2023 at 12:13:28AM +0200, Dmitry Baryshkov wrote:
> As 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.
> 
> Acked-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/platform/x86/intel/chtwc_int33fe.c | 2 +-
>  drivers/usb/typec/class.c                  | 5 +++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/chtwc_int33fe.c b/drivers/platform/x86/intel/chtwc_int33fe.c
> index 848baecc1bb0..93f75ba1dafd 100644
> --- a/drivers/platform/x86/intel/chtwc_int33fe.c
> +++ b/drivers/platform/x86/intel/chtwc_int33fe.c
> @@ -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),
>  	{ }
>  };
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 6ec2a94e6fad..4251d44137b6 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -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));
> -- 
> 2.42.0

-- 
heikki

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 3/3] arm64: dts: qcom: qrb5165-rb5: use u16 for DP altmode svid
  2023-11-13 22:13 ` [PATCH v2 3/3] arm64: dts: qcom: qrb5165-rb5: use u16 for DP altmode svid Dmitry Baryshkov
@ 2023-11-15 16:17   ` Konrad Dybcio
  0 siblings, 0 replies; 10+ messages in thread
From: Konrad Dybcio @ 2023-11-15 16:17 UTC (permalink / raw)
  To: Dmitry Baryshkov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Andy Gross, Bjorn Andersson, Hans de Goede, Ilpo Järvinen,
	Mark Gross, Heikki Krogerus, Greg Kroah-Hartman
  Cc: devicetree, linux-kernel, linux-arm-msm, platform-driver-x86,
	linux-usb



On 11/13/23 23:13, Dmitry Baryshkov wrote:
> Follow the bindings and use 16-bit value for AltMode SVID instead of
> using the full u32.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Fixes: b3dea914127e ("arm64: dts: qcom: qrb5165-rb5: enable DP altmode")

(because it was previously not compliant with bindings)

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes
  2023-11-13 22:13 [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes Dmitry Baryshkov
                   ` (2 preceding siblings ...)
  2023-11-13 22:13 ` [PATCH v2 3/3] arm64: dts: qcom: qrb5165-rb5: use u16 for DP altmode svid Dmitry Baryshkov
@ 2023-11-16 18:36 ` Rob Herring
  2023-11-16 20:39   ` Dmitry Baryshkov
  3 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2023-11-16 18:36 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Hans de Goede, Ilpo Järvinen, Mark Gross,
	Heikki Krogerus, Greg Kroah-Hartman, devicetree, linux-kernel,
	linux-arm-msm, platform-driver-x86, linux-usb

On Tue, Nov 14, 2023 at 12:13:26AM +0200, Dmitry Baryshkov wrote:
> 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.

Depends if you are fine with the ABI break on this platform...

Rob

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description
  2023-11-13 22:13 ` [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description Dmitry Baryshkov
@ 2023-11-16 18:38   ` Rob Herring
  2023-11-16 20:48     ` Dmitry Baryshkov
  0 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2023-11-16 18:38 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Hans de Goede, Ilpo Järvinen, Mark Gross,
	Heikki Krogerus, Greg Kroah-Hartman, devicetree, linux-kernel,
	linux-arm-msm, platform-driver-x86, linux-usb

On Tue, Nov 14, 2023 at 12:13:27AM +0200, Dmitry Baryshkov wrote:
> 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 <dmitry.baryshkov@linaro.org>
> ---
>  .../bindings/connector/usb-connector.yaml     | 36 +++++++++++++++++++
>  1 file changed, 36 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml
> index 7c8a3e8430d3..1bd51b86906f 100644
> --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml
> +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml
> @@ -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.

> +  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.

> +
> +  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.


> +        $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
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes
  2023-11-16 18:36 ` [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes Rob Herring
@ 2023-11-16 20:39   ` Dmitry Baryshkov
  0 siblings, 0 replies; 10+ messages in thread
From: Dmitry Baryshkov @ 2023-11-16 20:39 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Hans de Goede, Ilpo Järvinen, Mark Gross,
	Heikki Krogerus, Greg Kroah-Hartman, devicetree, linux-kernel,
	linux-arm-msm, platform-driver-x86, linux-usb

On Thu, 16 Nov 2023 at 20:36, Rob Herring <robh@kernel.org> wrote:
>
> On Tue, Nov 14, 2023 at 12:13:26AM +0200, Dmitry Baryshkov wrote:
> > 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.
>
> Depends if you are fine with the ABI break on this platform...

As much as I hate it, yes, we are.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description
  2023-11-16 18:38   ` Rob Herring
@ 2023-11-16 20:48     ` Dmitry Baryshkov
  0 siblings, 0 replies; 10+ messages in thread
From: Dmitry Baryshkov @ 2023-11-16 20:48 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Hans de Goede, Ilpo Järvinen, Mark Gross,
	Heikki Krogerus, Greg Kroah-Hartman, devicetree, linux-kernel,
	linux-arm-msm, platform-driver-x86, linux-usb

On Thu, 16 Nov 2023 at 20:38, Rob Herring <robh@kernel.org> wrote:
>
> On Tue, Nov 14, 2023 at 12:13:27AM +0200, Dmitry Baryshkov wrote:
> > 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 <dmitry.baryshkov@linaro.org>
> > ---
> >  .../bindings/connector/usb-connector.yaml     | 36 +++++++++++++++++++
> >  1 file changed, 36 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml
> > index 7c8a3e8430d3..1bd51b86906f 100644
> > --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml
> > +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml
> > @@ -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.

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.

>
> > +  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?

Ack, I'll expand it in v3

>
> 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.
>
> > +
> > +  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.

>
>
> > +        $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
> >



-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-11-16 20:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13 22:13 [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes Dmitry Baryshkov
2023-11-13 22:13 ` [PATCH v2 1/3] dt-bindings: connector: usb: add altmodes description Dmitry Baryshkov
2023-11-16 18:38   ` Rob Herring
2023-11-16 20:48     ` Dmitry Baryshkov
2023-11-13 22:13 ` [PATCH v2 2/3] usb: typec: change altmode SVID to u16 entry Dmitry Baryshkov
2023-11-15  7:27   ` Heikki Krogerus
2023-11-13 22:13 ` [PATCH v2 3/3] arm64: dts: qcom: qrb5165-rb5: use u16 for DP altmode svid Dmitry Baryshkov
2023-11-15 16:17   ` Konrad Dybcio
2023-11-16 18:36 ` [PATCH v2 0/3] dt-bindings: connector: usb: provide bindings for altmodes Rob Herring
2023-11-16 20:39   ` Dmitry Baryshkov

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).