Short reason:
Without swapping the SBU lanes, on QCM6490 Fairphone 5 the
DisplayPort-over-USB-C doesn't work.
The Orient-Chip OCP96011 used in this phone is generally compatible with
FSA4480 but has a difference how AUX+/- should be connected to SBU1/2.
Long explanation, with my current understanding:
* FSA4480 block diagram shows AUX+ connected to SBU2 and AUX- to SBU1.
* OCP96011 block diagram shows AUX+ connected to SBU1 and AUX- to SBU2
(it's not 100% clear though in the picture but makes sense with the
observed behavior)
* Fairphone 5 schematics have AUX+ connected to SBU2 and AUX- to SBU1,
which would be correct for FSA4480 but since OCP96011 is used (which
expects it to be the other way around) the Linux driver needs to
reverse it.
If AUX+ would be connected to SBU1 and AUX- to SBU2 as shown in the
OCP96011 block diagram, then no driver/dts change would be needed.
Not sure if I've implemented the best solution in this patch. Other
solutions I could think of are:
* Add some custom boolean property to the node, e.g. 'fsa,swap-sbu'
* Reverse when ocs,ocp96011 compatible is used. This would be incorrect
since when following the OCP96011 block diagram no reversing would be
needed, as explained above.
However I think the current solution with data-lanes in the endpoint is
the best fit and is also already used for a similar purpose in another
USB mux driver.
Signed-off-by: Luca Weiss <[email protected]>
---
Changes in v2:
- Expand commit message for first dt-bindings patch incl. ASCII art
- Use fwnode_* instead of_* APIs
- Drop manual check for data-lanes property length, read_u32_array will
already error on too short or too long property.
- Drop dev_info for reversed data-lanes mapping
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Luca Weiss (3):
dt-bindings: usb: fsa4480: Add data-lanes property to endpoint
usb: typec: fsa4480: Add support to swap SBU orientation
dt-bindings: usb: fsa4480: Add compatible for OCP96011
.../devicetree/bindings/usb/fcs,fsa4480.yaml | 43 ++++++++++++-
drivers/usb/typec/mux/fsa4480.c | 71 ++++++++++++++++++++++
2 files changed, 111 insertions(+), 3 deletions(-)
---
base-commit: e3b18f7200f45d66f7141136c25554ac1e82009b
change-id: 20231013-fsa4480-swap-9b0f76d73c19
Best regards,
--
Luca Weiss <[email protected]>
Allow specifying data-lanes to reverse the muxing orientation between
AUX+/- and SBU1/2 where necessary by the hardware design.
In the mux there's a switch that needs to be controlled from the OS, and
it either connects AUX+ -> SBU1 and AUX- -> SBU2, or the reverse: AUX+
-> SBU2 and AUX- -> SBU1, depending on the orientation of how the USB-C
connector is plugged in.
With this data-lanes property we can now specify that AUX+ and AUX-
connections are swapped between the SoC and the mux, therefore the OS
needs to consider this and reverse the direction of this switch in the
mux.
_______ _______
| | |
|-- HP --| |
|-- MIC --| |or
SoC | | MUX |-- SBU1 ---> To the USB-C
Codec |-- AUX+ --| |-- SBU2 ---> connected
|-- AUX- --| |
______| |_____|
(thanks to Neil Armstrong for this ASCII art)
Signed-off-by: Luca Weiss <[email protected]>
---
.../devicetree/bindings/usb/fcs,fsa4480.yaml | 29 +++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml b/Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml
index f6e7a5c1ff0b..86f6d633c2fb 100644
--- a/Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml
+++ b/Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml
@@ -32,10 +32,37 @@ properties:
type: boolean
port:
- $ref: /schemas/graph.yaml#/properties/port
+ $ref: /schemas/graph.yaml#/$defs/port-base
description:
A port node to link the FSA4480 to a TypeC controller for the purpose of
handling altmode muxing and orientation switching.
+ unevaluatedProperties: false
+
+ properties:
+ endpoint:
+ $ref: /schemas/graph.yaml#/$defs/endpoint-base
+ unevaluatedProperties: false
+
+ properties:
+ data-lanes:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description:
+ Specifies how the AUX+/- lines are connected to SBU1/2.
+ oneOf:
+ - items:
+ - const: 0
+ - const: 1
+ description: |
+ Default AUX/SBU layout
+ - AUX+ connected to SBU2
+ - AUX- connected to SBU1
+ - items:
+ - const: 1
+ - const: 0
+ description: |
+ Swapped AUX/SBU layout
+ - AUX+ connected to SBU1
+ - AUX- connected to SBU2
required:
- compatible
--
2.42.0
The Orient-Chip OCP96011 is generally compatible with the FSA4480, add a
compatible for it with the fallback on fsa4480.
However the AUX/SBU connections are expected to be swapped compared to
FSA4480, so document this in the data-lanes description.
Signed-off-by: Luca Weiss <[email protected]>
---
Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml b/Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml
index 86f6d633c2fb..f9410eb76a62 100644
--- a/Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml
+++ b/Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml
@@ -11,8 +11,12 @@ maintainers:
properties:
compatible:
- enum:
- - fcs,fsa4480
+ oneOf:
+ - const: fcs,fsa4480
+ - items:
+ - enum:
+ - ocs,ocp96011
+ - const: fcs,fsa4480
reg:
maxItems: 1
@@ -53,16 +57,22 @@ properties:
- const: 0
- const: 1
description: |
- Default AUX/SBU layout
+ Default AUX/SBU layout (FSA4480)
- AUX+ connected to SBU2
- AUX- connected to SBU1
+ Default AUX/SBU layout (OCP96011)
+ - AUX+ connected to SBU1
+ - AUX- connected to SBU2
- items:
- const: 1
- const: 0
description: |
- Swapped AUX/SBU layout
+ Swapped AUX/SBU layout (FSA4480)
- AUX+ connected to SBU1
- AUX- connected to SBU2
+ Swapped AUX/SBU layout (OCP96011)
+ - AUX+ connected to SBU2
+ - AUX- connected to SBU1
required:
- compatible
--
2.42.0
On Fri, 20 Oct 2023 11:33:18 +0200, Luca Weiss wrote:
> Allow specifying data-lanes to reverse the muxing orientation between
> AUX+/- and SBU1/2 where necessary by the hardware design.
>
> In the mux there's a switch that needs to be controlled from the OS, and
> it either connects AUX+ -> SBU1 and AUX- -> SBU2, or the reverse: AUX+
> -> SBU2 and AUX- -> SBU1, depending on the orientation of how the USB-C
> connector is plugged in.
>
> With this data-lanes property we can now specify that AUX+ and AUX-
> connections are swapped between the SoC and the mux, therefore the OS
> needs to consider this and reverse the direction of this switch in the
> mux.
>
> _______ _______
> | | |
> |-- HP --| |
> |-- MIC --| |or
> SoC | | MUX |-- SBU1 ---> To the USB-C
> Codec |-- AUX+ --| |-- SBU2 ---> connected
> |-- AUX- --| |
> ______| |_____|
>
> (thanks to Neil Armstrong for this ASCII art)
>
> Signed-off-by: Luca Weiss <[email protected]>
> ---
> .../devicetree/bindings/usb/fcs,fsa4480.yaml | 29 +++++++++++++++++++++-
> 1 file changed, 28 insertions(+), 1 deletion(-)
>
Reviewed-by: Rob Herring <[email protected]>
On Fri, 20 Oct 2023 11:33:20 +0200, Luca Weiss wrote:
> The Orient-Chip OCP96011 is generally compatible with the FSA4480, add a
> compatible for it with the fallback on fsa4480.
>
> However the AUX/SBU connections are expected to be swapped compared to
> FSA4480, so document this in the data-lanes description.
>
> Signed-off-by: Luca Weiss <[email protected]>
> ---
> Documentation/devicetree/bindings/usb/fcs,fsa4480.yaml | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
Reviewed-by: Rob Herring <[email protected]>