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 <[email protected]>
---
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 <[email protected]>
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 <[email protected]>
---
.../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
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 <[email protected]>
> ---
> .../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'?
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 <[email protected]>
> > ---
> > .../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