2022-03-01 14:27:19

by Alvin Šipraga

[permalink] [raw]
Subject: [PATCH 0/4] usb: typec: add drivers for TUSB320xA and TS5USBA224

From: Alvin Šipraga <[email protected]>

This series adds a new typec class driver for the TUSB320xA family of
Type-C port controllers and a typec_mux class driver for the TS5USBA224
switch mux.

This series was bourne out of frustration with the existing extcon
driver for the TUSB320, which did not offer a convenient driver model
for the Audio Accessory mode muxing offered by the TS5USBA224. I found
the typec subsystem to be more suitable.

I have tested this on my i.MX8MM platform with USB OTG support and it
works as desired. However I am not very familiar with this part of the
kernel, so I welcome your critical feedback to this series. Thanks in
advance.


Alvin Šipraga (4):
dt-bindings: usb: add TUSB320xA Type-C port controller
dt-bindings: usb: add TS5USBA224 USB/Audio switch mux
usb: typec: add TUSB320xA driver
usb: typec: mux: add TS5USBA224 driver

.../bindings/usb/ti,ts5usba224.yaml | 56 ++
.../devicetree/bindings/usb/ti,tusb320xa.yaml | 78 +++
drivers/usb/typec/Kconfig | 12 +
drivers/usb/typec/Makefile | 1 +
drivers/usb/typec/mux/Kconfig | 10 +
drivers/usb/typec/mux/Makefile | 1 +
drivers/usb/typec/mux/ts5usba224.c | 102 ++++
drivers/usb/typec/tusb320xa.c | 517 ++++++++++++++++++
8 files changed, 777 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml
create mode 100644 Documentation/devicetree/bindings/usb/ti,tusb320xa.yaml
create mode 100644 drivers/usb/typec/mux/ts5usba224.c
create mode 100644 drivers/usb/typec/tusb320xa.c

--
2.35.1


2022-03-01 15:12:59

by Alvin Šipraga

[permalink] [raw]
Subject: [PATCH 4/4] usb: typec: mux: add TS5USBA224 driver

From: Alvin Šipraga <[email protected]>

The TS5USBA224 USB High Speed/Audio switch mux is typically used
together with a Type-C port controller such as the TUSB320LAI. Below is
a simplified typical application on an embedded platform:

┌─────────────────────┐ ┌───────────────────┐
│ │ I2C │ │
│ ├──────────────────────┤ I2C │
│ TUSB320LAI │ INT_N │ │
│ ├──────────────────────┤ System-on- │
│ │ │ Chip │
│ CC1 CC2 │ ┌──────────┤ GPIO │
└──┬───┬──────────────┘ │ │ │
│ │ │ │ USBOTG │
│ │ │ │ VBUS D+ D- │
│ │ │ └──────┬─────┬───┬──┘
│ │ ┌──────────────────────│─────────────────┘ │ │
│ │ │ ┌───────────┴──┐ │ │
│ │ │ │ A_SEL │ │ │
│ │ │ │ │ │ │
│ │ │ │ D+ ├────────────────────┘ │
│ │ │ │ │ │
│ │ │ ┌──────┤ D+/L D- ├────────────────────────┘
│ │ │ │ │ │
│ │ │ │ ┌──┤ D-/R │ Line_L
│ │ │ │ │ │ L ├─────────────────────────
┴ ┴ ┴ ┴ ┴ │ │ Line_R
USB Type-C port │ R ├─────────────────────────
│ │
│ TS5USBA224 │
└──────────────┘

This driver controls the TS5USBA224 via the A_SEL pin. In addition, it
registers itself as a Type-C mux device. In the above scenario, the
driver may be notified via the port controller driver if the CC pins
indicate that an Audio Accessory is connected or not.

Signed-off-by: Alvin Šipraga <[email protected]>
---
drivers/usb/typec/mux/Kconfig | 10 +++
drivers/usb/typec/mux/Makefile | 1 +
drivers/usb/typec/mux/ts5usba224.c | 102 +++++++++++++++++++++++++++++
3 files changed, 113 insertions(+)
create mode 100644 drivers/usb/typec/mux/ts5usba224.c

diff --git a/drivers/usb/typec/mux/Kconfig b/drivers/usb/typec/mux/Kconfig
index edead555835e..82c25b117652 100644
--- a/drivers/usb/typec/mux/Kconfig
+++ b/drivers/usb/typec/mux/Kconfig
@@ -19,4 +19,14 @@ config TYPEC_MUX_INTEL_PMC
control the USB role switch and also the multiplexer/demultiplexer
switches used with USB Type-C Alternate Modes.

+config TYPEC_MUX_TS5USBA224
+ tristate "TI TS5USBA224 USB High Speed/Audio switch mux driver"
+ select GPIOLIB
+ help
+ Say Y or M if your system has a TI TS5USBA224 USB High Speed/Audio
+ switch mux controller paired with a USB Type-C port controller.
+
+ If you choose to build this driver as a dynamically linked module, the
+ module will be called ts5usba224.ko.
+
endmenu
diff --git a/drivers/usb/typec/mux/Makefile b/drivers/usb/typec/mux/Makefile
index 280a6f553115..4b5f318656a0 100644
--- a/drivers/usb/typec/mux/Makefile
+++ b/drivers/usb/typec/mux/Makefile
@@ -2,3 +2,4 @@

obj-$(CONFIG_TYPEC_MUX_PI3USB30532) += pi3usb30532.o
obj-$(CONFIG_TYPEC_MUX_INTEL_PMC) += intel_pmc_mux.o
+obj-$(CONFIG_TYPEC_MUX_TS5USBA224) += ts5usba224.o
diff --git a/drivers/usb/typec/mux/ts5usba224.c b/drivers/usb/typec/mux/ts5usba224.c
new file mode 100644
index 000000000000..4935dc8a0725
--- /dev/null
+++ b/drivers/usb/typec/mux/ts5usba224.c
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * TI TS5USBA224 USB 2.0/audio switch mux driver
+ *
+ * Copyright (c) 2021 Alvin Šipraga <[email protected]>
+ */
+
+#include <linux/gpio/consumer.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/usb/typec_altmode.h>
+#include <linux/usb/typec_mux.h>
+
+struct ts5usba224 {
+ struct device *dev;
+ struct typec_mux *mux;
+ struct gpio_desc *a_sel;
+};
+
+static int ts5usba224_mux_set(struct typec_mux *mux,
+ struct typec_mux_state *state)
+{
+ struct ts5usba224 *chip = typec_mux_get_drvdata(mux);
+
+ switch (state->mode) {
+ case TYPEC_MODE_AUDIO:
+ gpiod_set_value_cansleep(chip->a_sel, 1);
+ dev_dbg(chip->dev, "audio switch enabled\n");
+ break;
+ case TYPEC_STATE_USB:
+ case TYPEC_MODE_USB2:
+ default:
+ dev_dbg(chip->dev, "audio switch disabled\n");
+ gpiod_set_value_cansleep(chip->a_sel, 0);
+ break;
+ }
+
+ return 0;
+}
+
+static int ts5usba224_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct typec_mux_desc mux_desc = {};
+ struct ts5usba224 *chip;
+ int ret;
+
+ chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
+ if (!chip)
+ return -ENOMEM;
+
+ chip->dev = dev;
+
+ chip->a_sel = devm_gpiod_get(dev, "asel", GPIOD_OUT_LOW);
+ if (IS_ERR(chip->a_sel)) {
+ ret = PTR_ERR(chip->a_sel);
+ return dev_err_probe(dev, ret, "failed to get A_SEL GPIO\n");
+ }
+
+ mux_desc.drvdata = chip;
+ mux_desc.fwnode = dev->fwnode;
+ mux_desc.set = ts5usba224_mux_set;
+
+ chip->mux = typec_mux_register(dev, &mux_desc);
+ if (IS_ERR(chip->mux))
+ return PTR_ERR(chip->mux);
+
+ platform_set_drvdata(pdev, chip);
+
+ return 0;
+}
+
+static int ts5usba224_remove(struct platform_device *pdev)
+{
+ struct ts5usba224 *chip = platform_get_drvdata(pdev);
+
+ typec_mux_unregister(chip->mux);
+
+ return 0;
+}
+
+static const struct of_device_id ts5usba224_of_match[] = {
+ { .compatible = "ti,ts5usba224", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, ts5usba224_of_match);
+
+static struct platform_driver ts5usba224_driver = {
+ .driver = {
+ .name = "ts5usba224",
+ .of_match_table = of_match_ptr(ts5usba224_of_match),
+ },
+ .probe = ts5usba224_probe,
+ .remove = ts5usba224_remove,
+};
+
+module_platform_driver(ts5usba224_driver);
+
+MODULE_AUTHOR("Alvin Šipraga <[email protected]>");
+MODULE_DESCRIPTION("TI TS5USBA224 mux driver");
+MODULE_LICENSE("GPL");
--
2.35.1

2022-03-01 19:42:45

by Alvin Šipraga

[permalink] [raw]
Subject: [PATCH 1/4] dt-bindings: usb: add TUSB320xA Type-C port controller

From: Alvin Šipraga <[email protected]>

The TUSB320xA is a non-PD Type-C port controller managed over I2C.

Signed-off-by: Alvin Šipraga <[email protected]>
---
.../devicetree/bindings/usb/ti,tusb320xa.yaml | 78 +++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/ti,tusb320xa.yaml

diff --git a/Documentation/devicetree/bindings/usb/ti,tusb320xa.yaml b/Documentation/devicetree/bindings/usb/ti,tusb320xa.yaml
new file mode 100644
index 000000000000..a93d53ddd01c
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/ti,tusb320xa.yaml
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/ti,tusb320xa.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TUSB320xA Type-C port controller DT bindings
+
+description:
+ The Texas Instruments TUSB320xA is a USB Type-C port controller which
+ supports role and plug orientation detection using the CC pins. It is
+ compatible with the USB Type-C Cable and Connector Specification v1.1.
+
+maintainers:
+ - Alvin Šipraga <[email protected]>
+
+properties:
+ compatible:
+ enum:
+ - ti,tusb320la
+ - ti,tusb320ha
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ ports:
+ $ref: /schemas/graph.yaml#/properties/ports
+
+ patternProperties:
+ '^port@':
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ OF graph bindings modelling any "usb-role-switch" or "accessory" mux.
+
+required:
+ - compatible
+ - reg
+ - interrupts
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ tcpc@47 {
+ compatible = "ti,tusb320la";
+ reg = <0x47>;
+ interrupt-parent = <&gpio5>;
+ interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ typec1_mux: endpoint {
+ remote-endpoint = <&usb_audio_mux1>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ typec1_dr_sw: endpoint {
+ remote-endpoint = <&usbotg1_drd_sw>;
+ };
+ };
+ };
+ };
+ };
--
2.35.1

2022-03-01 19:50:30

by Alvin Šipraga

[permalink] [raw]
Subject: [PATCH 2/4] dt-bindings: usb: add TS5USBA224 USB/Audio switch mux

From: Alvin Šipraga <[email protected]>

The TS5USBA224 is a USB High Speed/Audio switch mux IC controlled via
GPIO. It is typically composed with a Type-C port controller with Audio
Accessory mode detection.

Signed-off-by: Alvin Šipraga <[email protected]>
---
.../bindings/usb/ti,ts5usba224.yaml | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml

diff --git a/Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml b/Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml
new file mode 100644
index 000000000000..0a488b961906
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/ti,ts5usba224.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TS5USBA224 USB 2.0 High Speed and Audio mux DT bindings
+
+description:
+ The Texas Instruments TS5USBA224 is a double-pole, double throw
+ (DPDT) multiplexer that includes a low-distortion audio switch and a
+ USB 2.0 High Speed switch in the same package.
+
+maintainers:
+ - Alvin Šipraga <[email protected]>
+
+properties:
+ compatible:
+ enum:
+ - ti,ts5usba224
+
+ asel-gpio:
+ description: Output GPIO for A_SEL signal
+ maxItems: 1
+
+ accessory:
+ type: boolean
+ description:
+ Indicates that this is an Accessory Mode mux.
+
+ port:
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ OF graph bindings modelling a Type-C port controller.
+
+required:
+ - compatible
+ - asel-gpio
+ - accessory
+ - port
+
+additionalProperties: false
+
+examples:
+ - |
+ usbaudiomux@0 {
+ compatible = "ti,ts5usba224";
+ asel-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
+ accessory;
+
+ port {
+ usb_audio_mux1: endpoint {
+ remote-endpoint = <&typec1_mux>;
+ };
+ };
+ };
--
2.35.1

2022-03-02 22:08:34

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 1/4] dt-bindings: usb: add TUSB320xA Type-C port controller

On Tue, Mar 01, 2022 at 02:20:05PM +0100, Alvin Šipraga wrote:
> From: Alvin Šipraga <[email protected]>
>
> The TUSB320xA is a non-PD Type-C port controller managed over I2C.
>
> Signed-off-by: Alvin Šipraga <[email protected]>
> ---
> .../devicetree/bindings/usb/ti,tusb320xa.yaml | 78 +++++++++++++++++++
> 1 file changed, 78 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/usb/ti,tusb320xa.yaml
>
> diff --git a/Documentation/devicetree/bindings/usb/ti,tusb320xa.yaml b/Documentation/devicetree/bindings/usb/ti,tusb320xa.yaml
> new file mode 100644
> index 000000000000..a93d53ddd01c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/ti,tusb320xa.yaml
> @@ -0,0 +1,78 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/usb/ti,tusb320xa.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TUSB320xA Type-C port controller DT bindings
> +
> +description:
> + The Texas Instruments TUSB320xA is a USB Type-C port controller which
> + supports role and plug orientation detection using the CC pins. It is
> + compatible with the USB Type-C Cable and Connector Specification v1.1.
> +
> +maintainers:
> + - Alvin Šipraga <[email protected]>
> +
> +properties:
> + compatible:
> + enum:
> + - ti,tusb320la
> + - ti,tusb320ha
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + ports:
> + $ref: /schemas/graph.yaml#/properties/ports
> +
> + patternProperties:
> + '^port@':

Exact port numbers need to be defined. What does port@0 represent?
port@1?

> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + OF graph bindings modelling any "usb-role-switch" or "accessory" mux.
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/irq.h>
> +
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + tcpc@47 {
> + compatible = "ti,tusb320la";
> + reg = <0x47>;
> + interrupt-parent = <&gpio5>;
> + interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + typec1_mux: endpoint {
> + remote-endpoint = <&usb_audio_mux1>;
> + };
> + };
> +
> + port@1 {
> + reg = <1>;
> + typec1_dr_sw: endpoint {
> + remote-endpoint = <&usbotg1_drd_sw>;
> + };
> + };
> + };
> + };
> + };
> --
> 2.35.1
>

2022-03-02 23:21:39

by Alvin Šipraga

[permalink] [raw]
Subject: Re: [PATCH 2/4] dt-bindings: usb: add TS5USBA224 USB/Audio switch mux

Rob Herring <[email protected]> writes:

> On Tue, Mar 01, 2022 at 02:20:06PM +0100, Alvin Šipraga wrote:
>> From: Alvin Šipraga <[email protected]>
>>
>> The TS5USBA224 is a USB High Speed/Audio switch mux IC controlled via
>> GPIO. It is typically composed with a Type-C port controller with Audio
>> Accessory mode detection.
>>
>> Signed-off-by: Alvin Šipraga <[email protected]>
>> ---
>> .../bindings/usb/ti,ts5usba224.yaml | 56 +++++++++++++++++++
>> 1 file changed, 56 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml b/Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml
>> new file mode 100644
>> index 000000000000..0a488b961906
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml
>> @@ -0,0 +1,56 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/usb/ti,ts5usba224.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: TS5USBA224 USB 2.0 High Speed and Audio mux DT bindings
>> +
>> +description:
>> + The Texas Instruments TS5USBA224 is a double-pole, double throw
>> + (DPDT) multiplexer that includes a low-distortion audio switch and a
>> + USB 2.0 High Speed switch in the same package.
>> +
>> +maintainers:
>> + - Alvin Šipraga <[email protected]>
>> +
>> +properties:
>> + compatible:
>> + enum:
>> + - ti,ts5usba224
>> +
>> + asel-gpio:
>> + description: Output GPIO for A_SEL signal
>> + maxItems: 1
>> +
>> + accessory:
>> + type: boolean
>> + description:
>> + Indicates that this is an Accessory Mode mux.
>> +
>> + port:
>> + $ref: /schemas/graph.yaml#/properties/port
>> + description:
>> + OF graph bindings modelling a Type-C port controller.
>
> What does that mean?
>
> There's a couple of Type-C bindings on the list ATM. Without block
> diagrams of all the relevant components and the corresponding graph, I
> can't say whether any of this graph usage makes sense.

Thanks for your review. Maybe I need some help with this but I'll try
and explain according to my understanding.

The series adds two drivers:

- tusb320xa - a USB Type-C port controller driver
- ts5usba224 - a USB Type-C multiplexer (for Audio Accessory mode)

These handle different classes of device: typec (the port controller)
and typec_mux (the multiplexer) respectively.

The typec driver is responsible for determining what is connected on the
other end of the Type-C port. It informs the typec subsystem of what
role is detected (UFP or DFP), the orientation, and whether or not
certain accessories (Audio or Debug) are connected.

The typec_mux driver is interested in whether an Audio Accessory has
been connected to the Type-C port. Depending on whether it is or not, it
will assert a GPIO controlling the TS5USBA224 mux chip.

Additionally, an OTG capable USB controller might like to be informed so
that it can configure itself correctly as a host (and enable VBUS etc.)
or peripheral.

Here is a simplified block diagram with my i.MX8MM SoC:

┌─────────────────────┐ ┌───────────────────┐
│ │ I2C │ │
│ ├────────────────────┤ I2C │
│ TUSB320LAI │ INT_N │ │
│ ├────────────────────┤ i.MX8MM │
│ │ │ │
│ CC1 CC2 │ ┌────────┤ GPIO │
└──┬───┬──────────────┘ │ │ │
│ │ │ │ USBOTG │
│ │ │ │ VBUS D+ D- │
│ │ │ └──────┬─────┬───┬──┘
│ │ ┌──────────────────────│───────────────┘ │ │
│ │ │ ┌───────────┴──┐ │ │
│ │ │ │ A_SEL │ │ │
│ │ │ │ │ │ │
│ │ │ │ D+ ├──────────────────┘ │
│ │ │ │ │ │
│ │ │ ┌──────┤ D+/L D- ├──────────────────────┘
│ │ │ │ │ │
│ │ │ │ ┌──┤ D-/R │ Line_L
│ │ │ │ │ │ L ├───────────────────────
┴ ┴ ┴ ┴ ┴ │ │ Line_R
USB Type-C port │ R ├───────────────────────
│ │
│ TS5USBA224 │
└──────────────┘


Line_{L,R} here are handled by some alternative circuitry which is not
relevant to this discussion.

Now back to the graph: I noticed while reading the generic typec code
that it is walking the child nodes and looking for particular endpoints
when registering a typec port. If a remote endpoint has the 'accessory'
property, it will pick up the corresponding device and inform it when
the port mode changes. If the new mode is TYPEC_MODE_AUDIO (as a result
of an Audio Accessory being detected by the port), then the typec_mux
driver will assert the A_SEL GPIO, otherwise it will deassert it.

Since this worked pretty automatically, my understanding was that this
was the correct way to "connect" these two devices in the device tree.

For the USB host/peripheral role switching, I use the
usb_role_switch_get() API in the probe function of the tusb320xa driver
to similarly walk the device tree and find a remote endpoint with the
'usb-role-switch' property.

So it could be a misunderstanding on my part, but what I'm trying to do
here with the bindings is offer the option to connect the various
devices together via the graph bindings. They are strictly optional
though - one might have a non-OTG capable USB controller, or perhaps not
care about Audio Accessories, etc. - so I did not specify specific port
numbering. I can of course do that, but it will be an arbitrary choice.

I hope that explains a bit better what I'm trying to do here. I don't
claim to have got it right though. Do you have any comments? Maybe
Heikki can chip in and explain if this is the right way to look at
things.

Kind regards,
Alvin

>
>> +
>> +required:
>> + - compatible
>> + - asel-gpio
>> + - accessory
>> + - port
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> + usbaudiomux@0 {
>> + compatible = "ti,ts5usba224";
>> + asel-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
>> + accessory;
>> +
>> + port {
>> + usb_audio_mux1: endpoint {
>> + remote-endpoint = <&typec1_mux>;
>> + };
>> + };
>> + };
>> --
>> 2.35.1
>>

2022-03-02 23:42:56

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 2/4] dt-bindings: usb: add TS5USBA224 USB/Audio switch mux

On Tue, Mar 01, 2022 at 02:20:06PM +0100, Alvin Šipraga wrote:
> From: Alvin Šipraga <[email protected]>
>
> The TS5USBA224 is a USB High Speed/Audio switch mux IC controlled via
> GPIO. It is typically composed with a Type-C port controller with Audio
> Accessory mode detection.
>
> Signed-off-by: Alvin Šipraga <[email protected]>
> ---
> .../bindings/usb/ti,ts5usba224.yaml | 56 +++++++++++++++++++
> 1 file changed, 56 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml
>
> diff --git a/Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml b/Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml
> new file mode 100644
> index 000000000000..0a488b961906
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/ti,ts5usba224.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/usb/ti,ts5usba224.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TS5USBA224 USB 2.0 High Speed and Audio mux DT bindings
> +
> +description:
> + The Texas Instruments TS5USBA224 is a double-pole, double throw
> + (DPDT) multiplexer that includes a low-distortion audio switch and a
> + USB 2.0 High Speed switch in the same package.
> +
> +maintainers:
> + - Alvin Šipraga <[email protected]>
> +
> +properties:
> + compatible:
> + enum:
> + - ti,ts5usba224
> +
> + asel-gpio:
> + description: Output GPIO for A_SEL signal
> + maxItems: 1
> +
> + accessory:
> + type: boolean
> + description:
> + Indicates that this is an Accessory Mode mux.
> +
> + port:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + OF graph bindings modelling a Type-C port controller.

What does that mean?

There's a couple of Type-C bindings on the list ATM. Without block
diagrams of all the relevant components and the corresponding graph, I
can't say whether any of this graph usage makes sense.

> +
> +required:
> + - compatible
> + - asel-gpio
> + - accessory
> + - port
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + usbaudiomux@0 {
> + compatible = "ti,ts5usba224";
> + asel-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
> + accessory;
> +
> + port {
> + usb_audio_mux1: endpoint {
> + remote-endpoint = <&typec1_mux>;
> + };
> + };
> + };
> --
> 2.35.1
>