2024-02-22 21:10:22

by Marco Felsch

[permalink] [raw]
Subject: [PATCH v3 0/4] USB-C TCPM Orientation Support

Hi,

this adds the support to control the optional connector-orientation
available on some TCPC from the TCPM.

I used an custom board with OnSemi FUSB307B TCPC which is spec [1]
compatible but albeit the spec [1] says that this pin is controlled by
the TCPC if 'TCPC_CONTROL.DebugAccessoryControl = 0' it isn't at least
for this device.

I'm unsure if the usb tcpci spec has an copy'n'paste failure since
'TCPC_CONTROL.DebugAccessoryControl' shouldn't control the state of the
'connector orientation' pin or if the OnSemi FUSB307B has an HW bug.
Since on my device the 'TCPC_CONTROL.DebugAccessoryControl' is set to
0 but the register wasn't updated automatically.

The patch adapting the existing dts files is send separately, as
requested.

Regards,
Marco

[1] https://www.usb.org/sites/default/files/documents/usb-port_controller_specification_rev2.0_v1.0_0.pdf

Marco Felsch (4):
dt-bindings: usb: typec-tcpci: add tcpci fallback binding
usb: typec: tcpci: add generic tcpci fallback compatible
usb: typec: tcpm: add support to set tcpc connector orientatition
usb: typec: tcpci: add support to set connector orientation

.../devicetree/bindings/usb/nxp,ptn5110.yaml | 6 ++-
drivers/usb/typec/tcpm/tcpci.c | 45 +++++++++++++++++++
drivers/usb/typec/tcpm/tcpm.c | 6 +++
include/linux/usb/tcpci.h | 8 ++++
include/linux/usb/tcpm.h | 2 +
5 files changed, 65 insertions(+), 2 deletions(-)

--
2.39.2



2024-02-22 21:10:38

by Marco Felsch

[permalink] [raw]
Subject: [PATCH v3 1/4] dt-bindings: usb: typec-tcpci: add tcpci fallback binding

The NXP PTN5110 [1] is an TCPCI [2] compatible chip, so add the fallback
binding.

[1] https://www.nxp.com/docs/en/data-sheet/PTN5110.pdf
[2] https://www.usb.org/sites/default/files/documents/usb-port_controller_specification_rev2.0_v1.0_0.pdf

Signed-off-by: Marco Felsch <[email protected]>
---
v3:
- use items
- adapt example

v2:
- rephrase commit message

Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml b/Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml
index eaedb4cc6b6c..65a8632b4d9e 100644
--- a/Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml
+++ b/Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml
@@ -11,7 +11,9 @@ maintainers:

properties:
compatible:
- const: nxp,ptn5110
+ items:
+ - const: nxp,ptn5110
+ - const: tcpci

reg:
maxItems: 1
@@ -41,7 +43,7 @@ examples:
#size-cells = <0>;

tcpci@50 {
- compatible = "nxp,ptn5110";
+ compatible = "nxp,ptn5110", "tcpci";
reg = <0x50>;
interrupt-parent = <&gpio3>;
interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
--
2.39.2


2024-02-22 21:10:52

by Marco Felsch

[permalink] [raw]
Subject: [PATCH v3 2/4] usb: typec: tcpci: add generic tcpci fallback compatible

The driver already support the tcpci binding for the i2c_device_id so
add the support for the of_device_id too.

Signed-off-by: Marco Felsch <[email protected]>
---
v3:
- no changes
v2:
- no changes

drivers/usb/typec/tcpm/tcpci.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index 0ee3e6e29bb1..7118551827f6 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -889,6 +889,7 @@ MODULE_DEVICE_TABLE(i2c, tcpci_id);
#ifdef CONFIG_OF
static const struct of_device_id tcpci_of_match[] = {
{ .compatible = "nxp,ptn5110", },
+ { .compatible = "tcpci", },
{},
};
MODULE_DEVICE_TABLE(of, tcpci_of_match);
--
2.39.2


2024-02-26 08:03:01

by Heikki Krogerus

[permalink] [raw]
Subject: Re: [PATCH v3 2/4] usb: typec: tcpci: add generic tcpci fallback compatible

On Thu, Feb 22, 2024 at 10:09:01PM +0100, Marco Felsch wrote:
> The driver already support the tcpci binding for the i2c_device_id so
> add the support for the of_device_id too.
>
> Signed-off-by: Marco Felsch <[email protected]>

Reviewed-by: Heikki Krogerus <[email protected]>

> ---
> v3:
> - no changes
> v2:
> - no changes
>
> drivers/usb/typec/tcpm/tcpci.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index 0ee3e6e29bb1..7118551827f6 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -889,6 +889,7 @@ MODULE_DEVICE_TABLE(i2c, tcpci_id);
> #ifdef CONFIG_OF
> static const struct of_device_id tcpci_of_match[] = {
> { .compatible = "nxp,ptn5110", },
> + { .compatible = "tcpci", },
> {},
> };
> MODULE_DEVICE_TABLE(of, tcpci_of_match);
> --
> 2.39.2

--
heikki

2024-02-26 09:58:58

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 1/4] dt-bindings: usb: typec-tcpci: add tcpci fallback binding

On 22/02/2024 22:09, Marco Felsch wrote:
> The NXP PTN5110 [1] is an TCPCI [2] compatible chip, so add the fallback
> binding.
>

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof