linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] arm64: qcom: sm8550: retrieve USB-C port orientation from gpio
@ 2023-10-02 10:20 Neil Armstrong
  2023-10-02 10:20 ` [PATCH v2 1/4] dt-bindings: soc: qcom: qcom,pmic-glink: add a gpio used to determine the Type-C port plug orientation Neil Armstrong
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Neil Armstrong @ 2023-10-02 10:20 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-usb,
	Neil Armstrong

This patchset is derived from [1], with only the GPIO orientation.

On the SM8550 platform, the PMIC Glink firmware doesn't emit
ALTMODE events for all USB-C port changes like it was done
for older platforms (like SM8450).
This means we only have a valid orientation when an Altmode
compliant device is inserted, but not for all the other devices,
including USB cables, dongles and non-altmode Hubs.

But the actual orientation is shared by the PM8550B by
a signal called CC_OUT which can be read on a gpio of the SM8550
SoC.

Let's add support for this feature by using the UCSI PMIC
Glink driver events to read and dispatch the orientation
to the USB-C connector devices on the DT graph.

While everybody would prefer having a proper PMIC Glink event
for an orientation change, this is not implemented and not
planned for future platforms either.

[1] https://lore.kernel.org/all/20230601-topic-sm8550-upstream-type-c-v3-0-22c9973012b6@linaro.org/

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
Changes in v2:
- Update bindings property description to describe how multi-port is handled
- Link to v1: https://lore.kernel.org/r/20230804-topic-sm8550-upstream-type-c-orientation-v1-0-36dd3edec7bf@linaro.org

---
Neil Armstrong (4):
      dt-bindings: soc: qcom: qcom,pmic-glink: add a gpio used to determine the Type-C port plug orientation
      usb: ucsi: glink: use the connector orientation GPIO to provide switch events
      arm64: dts: qcom: sm8550-mtp: add orientation gpio
      arm64: dts: qcom: sm8550-qrd: add orientation gpio

 .../bindings/soc/qcom/qcom,pmic-glink.yaml         | 19 ++++++++
 arch/arm64/boot/dts/qcom/sm8550-mtp.dts            |  1 +
 arch/arm64/boot/dts/qcom/sm8550-qrd.dts            |  1 +
 drivers/usb/typec/ucsi/ucsi_glink.c                | 54 +++++++++++++++++++++-
 4 files changed, 74 insertions(+), 1 deletion(-)
---
base-commit: df964ce9ef9fea10cf131bf6bad8658fde7956f6
change-id: 20230804-topic-sm8550-upstream-type-c-orientation-0bbbb360d3f7

Best regards,
-- 
Neil Armstrong <neil.armstrong@linaro.org>


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

* [PATCH v2 1/4] dt-bindings: soc: qcom: qcom,pmic-glink: add a gpio used to determine the Type-C port plug orientation
  2023-10-02 10:20 [PATCH v2 0/4] arm64: qcom: sm8550: retrieve USB-C port orientation from gpio Neil Armstrong
@ 2023-10-02 10:20 ` Neil Armstrong
  2023-10-06 15:40   ` Rob Herring
  2023-10-02 10:20 ` [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events Neil Armstrong
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Neil Armstrong @ 2023-10-02 10:20 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-usb,
	Neil Armstrong

On SM8450 and SM8550 based platforms, the Type-C plug orientation is given on a
GPIO line for each connector which are set by the PMIC(s).

Document this optional Type-C connector property, and take the
assumption an active level represents an inverted/flipped orientation.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 .../devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml
index bceb479f74c5..422921cf1f82 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml
@@ -35,6 +35,12 @@ properties:
   '#size-cells':
     const: 0
 
+  orientation-gpios:
+    description: Array of input gpios for the Type-C connector orientation indication.
+      The GPIO indication is used to detect the orientation of the Type-C connector.
+      The array should contain a gpio entry for each PMIC Glink connector, in reg order.
+      It is defined that GPIO active level means "CC2" or Reversed/Flipped orientation.
+
 patternProperties:
   '^connector@\d$':
     $ref: /schemas/connector/usb-connector.yaml#
@@ -44,6 +50,19 @@ patternProperties:
 required:
   - compatible
 
+allOf:
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - qcom,sm8450-pmic-glink
+                - qcom,sm8550-pmic-glink
+    then:
+      properties:
+        orientation-gpios: false
+
 additionalProperties: false
 
 examples:

-- 
2.34.1


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

* [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events
  2023-10-02 10:20 [PATCH v2 0/4] arm64: qcom: sm8550: retrieve USB-C port orientation from gpio Neil Armstrong
  2023-10-02 10:20 ` [PATCH v2 1/4] dt-bindings: soc: qcom: qcom,pmic-glink: add a gpio used to determine the Type-C port plug orientation Neil Armstrong
@ 2023-10-02 10:20 ` Neil Armstrong
  2023-10-02 10:27   ` Konrad Dybcio
  2023-10-02 17:26   ` Dmitry Baryshkov
  2023-10-02 10:20 ` [PATCH v2 3/4] arm64: dts: qcom: sm8550-mtp: add orientation gpio Neil Armstrong
  2023-10-02 10:20 ` [PATCH v2 4/4] arm64: dts: qcom: sm8550-qrd: " Neil Armstrong
  3 siblings, 2 replies; 13+ messages in thread
From: Neil Armstrong @ 2023-10-02 10:20 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-usb,
	Neil Armstrong

On SM8550, the non-altmode orientation is not given anymore within
altmode events, even with USB SVIDs events.

On the other side, the Type-C connector orientation is correctly
reported by a signal from the PMIC.

Take this gpio signal when we detect some Type-C port activity
to notify any Type-C switches tied to the Type-C port connectors.

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 drivers/usb/typec/ucsi/ucsi_glink.c | 54 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 53 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
index bb1854b3311d..db6e248f8208 100644
--- a/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -8,9 +8,13 @@
 #include <linux/mutex.h>
 #include <linux/property.h>
 #include <linux/soc/qcom/pdr.h>
+#include <linux/usb/typec_mux.h>
+#include <linux/gpio/consumer.h>
 #include <linux/soc/qcom/pmic_glink.h>
 #include "ucsi.h"
 
+#define PMIC_GLINK_MAX_PORTS	2
+
 #define UCSI_BUF_SIZE                   48
 
 #define MSG_TYPE_REQ_RESP               1
@@ -52,6 +56,9 @@ struct ucsi_notify_ind_msg {
 struct pmic_glink_ucsi {
 	struct device *dev;
 
+	struct gpio_desc *port_orientation[PMIC_GLINK_MAX_PORTS];
+	struct typec_switch *port_switch[PMIC_GLINK_MAX_PORTS];
+
 	struct pmic_glink_client *client;
 
 	struct ucsi *ucsi;
@@ -220,8 +227,20 @@ static void pmic_glink_ucsi_notify(struct work_struct *work)
 	}
 
 	con_num = UCSI_CCI_CONNECTOR(cci);
-	if (con_num)
+	if (con_num) {
+		if (con_num < PMIC_GLINK_MAX_PORTS &&
+		    ucsi->port_orientation[con_num - 1]) {
+			int orientation = gpiod_get_value(ucsi->port_orientation[con_num - 1]);
+
+			if (orientation >= 0) {
+				typec_switch_set(ucsi->port_switch[con_num - 1],
+						 orientation ? TYPEC_ORIENTATION_REVERSE
+							     : TYPEC_ORIENTATION_NORMAL);
+			}
+		}
+
 		ucsi_connector_change(ucsi->ucsi, con_num);
+	}
 
 	if (ucsi->sync_pending && cci & UCSI_CCI_BUSY) {
 		ucsi->sync_val = -EBUSY;
@@ -282,6 +301,7 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev,
 {
 	struct pmic_glink_ucsi *ucsi;
 	struct device *dev = &adev->dev;
+	struct fwnode_handle *fwnode;
 	int ret;
 
 	ucsi = devm_kzalloc(dev, sizeof(*ucsi), GFP_KERNEL);
@@ -309,6 +329,38 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev,
 
 	ucsi_set_drvdata(ucsi->ucsi, ucsi);
 
+	device_for_each_child_node(dev, fwnode) {
+		struct gpio_desc *desc;
+		u32 port;
+
+		ret = fwnode_property_read_u32(fwnode, "reg", &port);
+		if (ret < 0) {
+			dev_err(dev, "missing reg property of %pOFn\n", fwnode);
+			return ret;
+		}
+
+		if (port >= PMIC_GLINK_MAX_PORTS) {
+			dev_warn(dev, "invalid connector number, ignoring\n");
+			continue;
+		}
+
+		desc = devm_gpiod_get_index_optional(&adev->dev, "orientation", port, GPIOD_IN);
+
+		/* If GPIO isn't found, continue */
+		if (!desc)
+			continue;
+
+		if (IS_ERR(desc))
+			return dev_err_probe(dev, PTR_ERR(desc),
+					     "unable to acquire orientation gpio\n");
+		ucsi->port_orientation[port] = desc;
+
+		ucsi->port_switch[port] = fwnode_typec_switch_get(fwnode);
+		if (IS_ERR(ucsi->port_switch[port]))
+			return dev_err_probe(dev, PTR_ERR(ucsi->port_switch[port]),
+					"failed to acquire orientation-switch\n");
+	}
+
 	ucsi->client = devm_pmic_glink_register_client(dev,
 						       PMIC_GLINK_OWNER_USBC,
 						       pmic_glink_ucsi_callback,

-- 
2.34.1


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

* [PATCH v2 3/4] arm64: dts: qcom: sm8550-mtp: add orientation gpio
  2023-10-02 10:20 [PATCH v2 0/4] arm64: qcom: sm8550: retrieve USB-C port orientation from gpio Neil Armstrong
  2023-10-02 10:20 ` [PATCH v2 1/4] dt-bindings: soc: qcom: qcom,pmic-glink: add a gpio used to determine the Type-C port plug orientation Neil Armstrong
  2023-10-02 10:20 ` [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events Neil Armstrong
@ 2023-10-02 10:20 ` Neil Armstrong
  2023-10-02 10:27   ` Konrad Dybcio
  2023-10-02 10:20 ` [PATCH v2 4/4] arm64: dts: qcom: sm8550-qrd: " Neil Armstrong
  3 siblings, 1 reply; 13+ messages in thread
From: Neil Armstrong @ 2023-10-02 10:20 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-usb,
	Neil Armstrong

Specify orientation GPIO in the PMIC GLINK node.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 arch/arm64/boot/dts/qcom/sm8550-mtp.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8550-mtp.dts b/arch/arm64/boot/dts/qcom/sm8550-mtp.dts
index 5b3488736fbe..9a70875028b7 100644
--- a/arch/arm64/boot/dts/qcom/sm8550-mtp.dts
+++ b/arch/arm64/boot/dts/qcom/sm8550-mtp.dts
@@ -59,6 +59,7 @@ pmic-glink {
 		compatible = "qcom,sm8550-pmic-glink", "qcom,pmic-glink";
 		#address-cells = <1>;
 		#size-cells = <0>;
+		orientation-gpios = <&tlmm 11 GPIO_ACTIVE_HIGH>;
 
 		connector@0 {
 			compatible = "usb-c-connector";

-- 
2.34.1


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

* [PATCH v2 4/4] arm64: dts: qcom: sm8550-qrd: add orientation gpio
  2023-10-02 10:20 [PATCH v2 0/4] arm64: qcom: sm8550: retrieve USB-C port orientation from gpio Neil Armstrong
                   ` (2 preceding siblings ...)
  2023-10-02 10:20 ` [PATCH v2 3/4] arm64: dts: qcom: sm8550-mtp: add orientation gpio Neil Armstrong
@ 2023-10-02 10:20 ` Neil Armstrong
  2023-10-02 10:28   ` Konrad Dybcio
  3 siblings, 1 reply; 13+ messages in thread
From: Neil Armstrong @ 2023-10-02 10:20 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-usb,
	Neil Armstrong

Specify orientation GPIO to the PMIC GLINK node.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 arch/arm64/boot/dts/qcom/sm8550-qrd.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8550-qrd.dts b/arch/arm64/boot/dts/qcom/sm8550-qrd.dts
index 320662024e89..eef811def39b 100644
--- a/arch/arm64/boot/dts/qcom/sm8550-qrd.dts
+++ b/arch/arm64/boot/dts/qcom/sm8550-qrd.dts
@@ -77,6 +77,7 @@ pmic-glink {
 		compatible = "qcom,sm8550-pmic-glink", "qcom,pmic-glink";
 		#address-cells = <1>;
 		#size-cells = <0>;
+		orientation-gpios = <&tlmm 11 GPIO_ACTIVE_HIGH>;
 
 		connector@0 {
 			compatible = "usb-c-connector";

-- 
2.34.1


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

* Re: [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events
  2023-10-02 10:20 ` [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events Neil Armstrong
@ 2023-10-02 10:27   ` Konrad Dybcio
  2023-10-02 17:26   ` Dmitry Baryshkov
  1 sibling, 0 replies; 13+ messages in thread
From: Konrad Dybcio @ 2023-10-02 10:27 UTC (permalink / raw)
  To: Neil Armstrong, Andy Gross, Bjorn Andersson, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-usb



On 10/2/23 12:20, Neil Armstrong wrote:
> On SM8550, the non-altmode orientation is not given anymore within
> altmode events, even with USB SVIDs events.
> 
> On the other side, the Type-C connector orientation is correctly
> reported by a signal from the PMIC.
> 
> Take this gpio signal when we detect some Type-C port activity
> to notify any Type-C switches tied to the Type-C port connectors.
> 
> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
[...]

> +	device_for_each_child_node(dev, fwnode) {
> +		struct gpio_desc *desc;
> +		u32 port;
> +
> +		ret = fwnode_property_read_u32(fwnode, "reg", &port);
> +		if (ret < 0) {
> +			dev_err(dev, "missing reg property of %pOFn\n", fwnode);
> +			return ret;
> +		}
> +
> +		if (port >= PMIC_GLINK_MAX_PORTS) {
> +			dev_warn(dev, "invalid connector number, ignoring\n");
> +			continue;
> +		}
> +
> +		desc = devm_gpiod_get_index_optional(&adev->dev, "orientation", port, GPIOD_IN);
Personally, I'd add a comment about this being a lookup on the 
pmic-glink node, as dev is reused throughout this function

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

Konrad

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

* Re: [PATCH v2 3/4] arm64: dts: qcom: sm8550-mtp: add orientation gpio
  2023-10-02 10:20 ` [PATCH v2 3/4] arm64: dts: qcom: sm8550-mtp: add orientation gpio Neil Armstrong
@ 2023-10-02 10:27   ` Konrad Dybcio
  0 siblings, 0 replies; 13+ messages in thread
From: Konrad Dybcio @ 2023-10-02 10:27 UTC (permalink / raw)
  To: Neil Armstrong, Andy Gross, Bjorn Andersson, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-usb



On 10/2/23 12:20, Neil Armstrong wrote:
> Specify orientation GPIO in the PMIC GLINK node.
You should answer "why", not "what"
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
With that fixed:

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

Konrad

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

* Re: [PATCH v2 4/4] arm64: dts: qcom: sm8550-qrd: add orientation gpio
  2023-10-02 10:20 ` [PATCH v2 4/4] arm64: dts: qcom: sm8550-qrd: " Neil Armstrong
@ 2023-10-02 10:28   ` Konrad Dybcio
  0 siblings, 0 replies; 13+ messages in thread
From: Konrad Dybcio @ 2023-10-02 10:28 UTC (permalink / raw)
  To: Neil Armstrong, Andy Gross, Bjorn Andersson, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman
  Cc: linux-arm-msm, devicetree, linux-kernel, linux-usb



On 10/2/23 12:20, Neil Armstrong wrote:
> Specify orientation GPIO to the PMIC GLINK node.
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
w/ fixed commit msg


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

Konrad

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

* Re: [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events
  2023-10-02 10:20 ` [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events Neil Armstrong
  2023-10-02 10:27   ` Konrad Dybcio
@ 2023-10-02 17:26   ` Dmitry Baryshkov
  2023-10-03  7:13     ` Neil Armstrong
  1 sibling, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2023-10-02 17:26 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman, linux-arm-msm, devicetree, linux-kernel,
	linux-usb

On Mon, 2 Oct 2023 at 13:21, Neil Armstrong <neil.armstrong@linaro.org> wrote:
>
> On SM8550, the non-altmode orientation is not given anymore within
> altmode events, even with USB SVIDs events.
>
> On the other side, the Type-C connector orientation is correctly
> reported by a signal from the PMIC.
>
> Take this gpio signal when we detect some Type-C port activity
> to notify any Type-C switches tied to the Type-C port connectors.

Have you checked, which UCSI version is implemented on SM8550?
Is there any chance of GET_CONNECTOR_STATUS / bit 86 actually
reflecting the correct orientation?

>
> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---


-- 
With best wishes
Dmitry

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

* Re: [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events
  2023-10-02 17:26   ` Dmitry Baryshkov
@ 2023-10-03  7:13     ` Neil Armstrong
  2023-10-03  8:05       ` Dmitry Baryshkov
  0 siblings, 1 reply; 13+ messages in thread
From: Neil Armstrong @ 2023-10-03  7:13 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman, linux-arm-msm, devicetree, linux-kernel,
	linux-usb

On 02/10/2023 19:26, Dmitry Baryshkov wrote:
> On Mon, 2 Oct 2023 at 13:21, Neil Armstrong <neil.armstrong@linaro.org> wrote:
>>
>> On SM8550, the non-altmode orientation is not given anymore within
>> altmode events, even with USB SVIDs events.
>>
>> On the other side, the Type-C connector orientation is correctly
>> reported by a signal from the PMIC.
>>
>> Take this gpio signal when we detect some Type-C port activity
>> to notify any Type-C switches tied to the Type-C port connectors.
> 
> Have you checked, which UCSI version is implemented on SM8550?
> Is there any chance of GET_CONNECTOR_STATUS / bit 86 actually
> reflecting the correct orientation?

I checked, and no, the UCSI implementation is based on the UCSI 1.x spec,
and doesn't have the UCSI 2.x new bits.

Neil

> 
>>
>> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> ---
> 
> 


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

* Re: [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events
  2023-10-03  7:13     ` Neil Armstrong
@ 2023-10-03  8:05       ` Dmitry Baryshkov
  0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2023-10-03  8:05 UTC (permalink / raw)
  To: neil.armstrong
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus,
	Greg Kroah-Hartman, linux-arm-msm, devicetree, linux-kernel,
	linux-usb

On Tue, 3 Oct 2023 at 10:13, Neil Armstrong <neil.armstrong@linaro.org> wrote:
>
> On 02/10/2023 19:26, Dmitry Baryshkov wrote:
> > On Mon, 2 Oct 2023 at 13:21, Neil Armstrong <neil.armstrong@linaro.org> wrote:
> >>
> >> On SM8550, the non-altmode orientation is not given anymore within
> >> altmode events, even with USB SVIDs events.
> >>
> >> On the other side, the Type-C connector orientation is correctly
> >> reported by a signal from the PMIC.
> >>
> >> Take this gpio signal when we detect some Type-C port activity
> >> to notify any Type-C switches tied to the Type-C port connectors.
> >
> > Have you checked, which UCSI version is implemented on SM8550?
> > Is there any chance of GET_CONNECTOR_STATUS / bit 86 actually
> > reflecting the correct orientation?
>
> I checked, and no, the UCSI implementation is based on the UCSI 1.x spec,
> and doesn't have the UCSI 2.x new bits.

Ack, thanks for the confirmation.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

>
> Neil
>
> >
> >>
> >> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> >> ---
> >
> >
>


-- 
With best wishes
Dmitry

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

* Re: [PATCH v2 1/4] dt-bindings: soc: qcom: qcom,pmic-glink: add a gpio used to determine the Type-C port plug orientation
  2023-10-02 10:20 ` [PATCH v2 1/4] dt-bindings: soc: qcom: qcom,pmic-glink: add a gpio used to determine the Type-C port plug orientation Neil Armstrong
@ 2023-10-06 15:40   ` Rob Herring
  2023-10-12 16:48     ` Bjorn Andersson
  0 siblings, 1 reply; 13+ messages in thread
From: Rob Herring @ 2023-10-06 15:40 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Krzysztof Kozlowski,
	Conor Dooley, Heikki Krogerus, Greg Kroah-Hartman, linux-arm-msm,
	devicetree, linux-kernel, linux-usb

On Mon, Oct 02, 2023 at 12:20:21PM +0200, Neil Armstrong wrote:
> On SM8450 and SM8550 based platforms, the Type-C plug orientation is given on a
> GPIO line for each connector which are set by the PMIC(s).
> 
> Document this optional Type-C connector property, and take the
> assumption an active level represents an inverted/flipped orientation.
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
>  .../devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml
> index bceb479f74c5..422921cf1f82 100644
> --- a/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml
> +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml
> @@ -35,6 +35,12 @@ properties:
>    '#size-cells':
>      const: 0
>  
> +  orientation-gpios:
> +    description: Array of input gpios for the Type-C connector orientation indication.
> +      The GPIO indication is used to detect the orientation of the Type-C connector.
> +      The array should contain a gpio entry for each PMIC Glink connector, in reg order.
> +      It is defined that GPIO active level means "CC2" or Reversed/Flipped orientation.

Shouldn't this node then have 'orientation-switch'?

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

* Re: [PATCH v2 1/4] dt-bindings: soc: qcom: qcom,pmic-glink: add a gpio used to determine the Type-C port plug orientation
  2023-10-06 15:40   ` Rob Herring
@ 2023-10-12 16:48     ` Bjorn Andersson
  0 siblings, 0 replies; 13+ messages in thread
From: Bjorn Andersson @ 2023-10-12 16:48 UTC (permalink / raw)
  To: Rob Herring
  Cc: Neil Armstrong, Andy Gross, Konrad Dybcio, Krzysztof Kozlowski,
	Conor Dooley, Heikki Krogerus, Greg Kroah-Hartman, linux-arm-msm,
	devicetree, linux-kernel, linux-usb

On Fri, Oct 06, 2023 at 10:40:35AM -0500, Rob Herring wrote:
> On Mon, Oct 02, 2023 at 12:20:21PM +0200, Neil Armstrong wrote:
> > On SM8450 and SM8550 based platforms, the Type-C plug orientation is given on a
> > GPIO line for each connector which are set by the PMIC(s).
> > 
> > Document this optional Type-C connector property, and take the
> > assumption an active level represents an inverted/flipped orientation.
> > 
> > Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> > ---
> >  .../devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml b/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml
> > index bceb479f74c5..422921cf1f82 100644
> > --- a/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml
> > +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml
> > @@ -35,6 +35,12 @@ properties:
> >    '#size-cells':
> >      const: 0
> >  
> > +  orientation-gpios:
> > +    description: Array of input gpios for the Type-C connector orientation indication.
> > +      The GPIO indication is used to detect the orientation of the Type-C connector.
> > +      The array should contain a gpio entry for each PMIC Glink connector, in reg order.
> > +      It is defined that GPIO active level means "CC2" or Reversed/Flipped orientation.
> 
> Shouldn't this node then have 'orientation-switch'?

The 'orientation-switch' property denotes that the node is the sink of a
orientation switching event, but this node represents the source of such
events (i.e. the connector-side).

The array defines the gpio signal providing the current orientation for
each of the listed usb-c-connectors under the node.

Regards,
Bjorn

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

end of thread, other threads:[~2023-10-12 16:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-02 10:20 [PATCH v2 0/4] arm64: qcom: sm8550: retrieve USB-C port orientation from gpio Neil Armstrong
2023-10-02 10:20 ` [PATCH v2 1/4] dt-bindings: soc: qcom: qcom,pmic-glink: add a gpio used to determine the Type-C port plug orientation Neil Armstrong
2023-10-06 15:40   ` Rob Herring
2023-10-12 16:48     ` Bjorn Andersson
2023-10-02 10:20 ` [PATCH v2 2/4] usb: ucsi: glink: use the connector orientation GPIO to provide switch events Neil Armstrong
2023-10-02 10:27   ` Konrad Dybcio
2023-10-02 17:26   ` Dmitry Baryshkov
2023-10-03  7:13     ` Neil Armstrong
2023-10-03  8:05       ` Dmitry Baryshkov
2023-10-02 10:20 ` [PATCH v2 3/4] arm64: dts: qcom: sm8550-mtp: add orientation gpio Neil Armstrong
2023-10-02 10:27   ` Konrad Dybcio
2023-10-02 10:20 ` [PATCH v2 4/4] arm64: dts: qcom: sm8550-qrd: " Neil Armstrong
2023-10-02 10:28   ` Konrad Dybcio

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