Skip to contentSkip to conversation

dt-bindings: usb: add documentation for typec switch via GPIO

PATCH Superseded Jun Li 3 participants 6 messages Feb 25, 2019 – Feb 28, 2019

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jun Li

author
#0 lore raw

PATCH 1/2 dt-bindings: usb: add documentation for typec switch via GPIO

Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumre.

---
 .../devicetree/bindings/usb/typec-switch-gpio.txt  | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/typec-switch-gpio.txt
Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file +30 -0
new file mode 100644
index 0000000..4ef76cf
@@ -0,0 +1,30 @@
+Typec orientation switch via a GPIO
+-----------------------------------
+
+Required properties:
+- compatible: should be set one of following:
+	- "nxp,ptn36043" for NXP Type-C SuperSpeed active switch.
+
+- gpios: the GPIO used to switch the super speed active channel,
+		GPIO_ACTIVE_HIGH: GPIO state high for cc1;
+		GPIO_ACTIVE_LOW:  GPIO state low for cc1.
+- orientation-switch: must be present.
+
+Required sub-node:
+- port: specify the remote endpoint of typec switch consumer.
+
+Example:
+
+ptn36043 {
+	compatible = "nxp,ptn36043";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ss_sel>;
+	gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
+	orientation-switch;
+
+	port {
+		usb3_data_ss: endpoint {
+			remote-endpoint = <&typec_con_ss>;
+		};
+	};
+};
author
#1 lore raw

PATCH 2/2 usb: typec: add typec switch via GPIO control

This patch adds a simple typec switch driver which only needs a GPIO to switch the super speed active channel according to typec orientation.

---
 drivers/usb/typec/mux/Kconfig       |   6 +++
 drivers/usb/typec/mux/Makefile      |   1 +
 drivers/usb/typec/mux/gpio-switch.c | 105 ++++++++++++++++++++++++++++++++++++
 3 files changed, 112 insertions(+)
 create mode 100644 drivers/usb/typec/mux/gpio-switch.c
drivers/usb/typec/mux/Kconfig +6 -0
index 01ed0d5..bc7d3c7 100644
@@ -9,4 +9,10 @@ config TYPEC_MUX_PI3USB30532
 	  Say Y or M if your system has a Pericom PI3USB30532 Type-C cross
 	  switch / mux chip found on some devices with a Type-C port.
 
+config TYPEC_SWITCH_GPIO
+	tristate "Simple Super Speed Active Switch via GPIO"
+	help
+	  Say Y or M if your system has a typec super speed channel
+	  switch via a simple GPIO control.
+
 endmenu
drivers/usb/typec/mux/Makefile +1 -0
index 1332e46..e29377c 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_TYPEC_MUX_PI3USB30532)	+= pi3usb30532.o
+obj-$(CONFIG_TYPEC_SWITCH_GPIO)		+= gpio-switch.o
drivers/usb/typec/mux/gpio-switch.c new file +105 -0

105 lines not on this page · raw message

#2 lore raw

Re: [PATCH 2/2] usb: typec: add typec switch via GPIO control

drivers/usb/typec/mux/gpio-switch.c line 15

Quoted 12 lines · Jun Li

This patch adds a simple typec switch driver which only needs a GPIO to switch the super speed active channel according to typec orientation.

drivers/usb/typec/mux/gpio-switch.c new file +6 -0
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
 
+#include <linux/of.h>
+#include <linux/of_gpio.h>

I don't see how these are in use.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#3 lore raw

RE: [PATCH 2/2] usb: typec: add typec switch via GPIO control

Hi

Quoted 20 lines

-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: 2019年2月26日 15:25
To: Jun Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH 2/2] usb: typec: add typec switch via GPIO control

Quoted 9 lines · Jun Li

This patch adds a simple typec switch driver which only needs a GPIO to switch the super speed active channel according to typec orientation.

drivers/usb/typec/mux/gpio-switch.c new file +4 -0
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
Quoted 4 lines

drivers/usb/typec/mux/gpio-switch.c line 15

Quoted 2 lines
drivers/usb/typec/mux/gpio-switch.c new file +2 -0
+#include <linux/of.h>
+#include <linux/of_gpio.h>

I don't see how these are in use.

I will use below 2 head files instead for v2.
#include <linux/gpio/consumer.h>
#include <linux/mod_devicetable.h>

Thanks
Li Jun

Quoted 4 lines

--
With Best Regards,
Andy Shevchenko

maintainer
#4 lore raw

Re: [PATCH 2/2] usb: typec: add typec switch via GPIO control

In reply to Jun Li
Quoted 17 lines · Jun Li

This patch adds a simple typec switch driver which only needs a GPIO to switch the super speed active channel according to typec orientation.

---
 drivers/usb/typec/mux/Kconfig       |   6 +++
 drivers/usb/typec/mux/Makefile      |   1 +
 drivers/usb/typec/mux/gpio-switch.c | 105 ++++++++++++++++++++++++++++++++++++
 3 files changed, 112 insertions(+)
 create mode 100644 drivers/usb/typec/mux/gpio-switch.c
drivers/usb/typec/mux/Kconfig +0 -0
index 01ed0d5..bc7d3c7 100644

drivers/usb/typec/mux/Kconfig config TYPEC_MUX_PI3USB30532 · line 13

Quoted 5 lines
drivers/usb/typec/mux/Kconfig +2 -0
@@ -9,4 +9,10 @@ config TYPEC_MUX_PI3USB30532
 	  Say Y or M if your system has a Pericom PI3USB30532 Type-C cross
 	  switch / mux chip found on some devices with a Type-C port.
 
+config TYPEC_SWITCH_GPIO
+	tristate "Simple Super Speed Active Switch via GPIO"

depends on GPIOLIB?

drivers/usb/typec/mux/Kconfig config TYPEC_MUX_PI3USB30532 · line 17

Quoted 4 lines
drivers/usb/typec/mux/Kconfig +4 -0
+	help
+	  Say Y or M if your system has a typec super speed channel
+	  switch via a simple GPIO control.
+

thanks,

Signature · 1 line
heikki
author
#5 lore raw

RE: [PATCH 2/2] usb: typec: add typec switch via GPIO control

Quoted 31 lines

-----Original Message-----
From: Heikki Krogerus <[email protected]>
Sent: 2019年2月27日 17:41
To: Jun Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH 2/2] usb: typec: add typec switch via GPIO control

Quoted 21 lines · Jun Li

This patch adds a simple typec switch driver which only needs a GPIO to switch the super speed active channel according to typec orientation.

---
 drivers/usb/typec/mux/Kconfig       |   6 +++
 drivers/usb/typec/mux/Makefile      |   1 +
 drivers/usb/typec/mux/gpio-switch.c | 105
++++++++++++++++++++++++++++++++++++
 3 files changed, 112 insertions(+)
 create mode 100644 drivers/usb/typec/mux/gpio-switch.c
(quoted diff) +0 -0

b/drivers/usb/typec/mux/Kconfig index 01ed0d5..bc7d3c7 100644

drivers/usb/typec/mux/Kconfig +0 -0
@@ -9,4 +9,10 @@ config TYPEC_MUX_PI3USB30532
 	  Say Y or M if your system has a Pericom PI3USB30532 Type-C cross
 	  switch / mux chip found on some devices with a Type-C port.
 
Quoted 4 lines

drivers/usb/typec/mux/Kconfig config TYPEC_MUX_PI3USB30532 · line 13

Quoted 2 lines
drivers/usb/typec/mux/Kconfig +2 -0
+config TYPEC_SWITCH_GPIO
+	tristate "Simple Super Speed Active Switch via GPIO"

depends on GPIOLIB?

Yes, you are right, will add it in v2.

Thanks
Li Jun

Quoted 10 lines

drivers/usb/typec/mux/Kconfig config TYPEC_MUX_PI3USB30532 · line 17

Quoted 5 lines
drivers/usb/typec/mux/Kconfig +4 -0
+	help
+	  Say Y or M if your system has a typec super speed channel
+	  switch via a simple GPIO control.
+

thanks,

--
heikki