Skip to contentSkip to conversation

staging: typec: rt1711h typec driver and dt-bindings

PATCH Superseded ShuFan Lee 2 participants 6 messages Mar 20, 2018 – Mar 29, 2018

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

ShuFan Lee

author
#0 lore raw

v4 cover staging: typec: rt1711h typec driver and dt-bindings

From: ShuFan Lee <[email protected]>

This patch series add rt1711h typec chip driver and dt-bindings

changelogs between v1 & v2
- use gpiod_* instead of gpio_*

changelogs between v2 & v3
- add dt-bindings for rt1711h typec driver

changelogs between v3 & v4
- add definition of RT1711H_VID and RT1711H_PID
- modify the way of using RT1711H_RTCTRL8_SET in rt1711h_set_vconn

ShuFan Lee (2):
staging: typec: rt1711h typec chip driver
dt-bindings: usb: rt1711h device tree binding document

 .../devicetree/bindings/usb/richtek,rt1711h.txt    |  30 ++
 drivers/staging/typec/Kconfig                      |   8 +
 drivers/staging/typec/Makefile                     |   1 +
 drivers/staging/typec/tcpci.h                      |   1 +
 drivers/staging/typec/tcpci_rt1711h.c              | 332 +++++++++++++++++++++
 5 files changed, 372 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/richtek,rt1711h.txt
 create mode 100644 drivers/staging/typec/tcpci_rt1711h.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v4 1/2 staging: typec: rt1711h typec chip driver

From: ShuFan Lee <[email protected]>

Richtek RT1711H Type-C chip driver that works with Type-C Port Controller Manager to provide USB PD and USB Type-C functionalities.
Add definition of TCPC_CC_STATUS_TOGGLING.

---
 drivers/staging/typec/Kconfig         |   8 +
 drivers/staging/typec/Makefile        |   1 +
 drivers/staging/typec/tcpci.h         |   1 +
 drivers/staging/typec/tcpci_rt1711h.c | 332 ++++++++++++++++++++++++++++++++++
 4 files changed, 342 insertions(+)
 create mode 100644 drivers/staging/typec/tcpci_rt1711h.c

changelogs between v1 & v2
- use gpiod_* instead of gpio_*

changelogs between v3 & v4
- add definition of RT1711H_VID and RT1711H_PID
- modify the way of using RT1711H_RTCTRL8_SET in rt1711h_set_vconn

drivers/staging/typec/Kconfig +8 -0
index 5359f556d203..3aa981fbc8f5 100644
@@ -9,6 +9,14 @@ config TYPEC_TCPCI
 	help
 	  Type-C Port Controller driver for TCPCI-compliant controller.
 
+config TYPEC_RT1711H
+	tristate "Richtek RT1711H Type-C chip driver"
+	select TYPEC_TCPCI
+	help
+	  Richtek RT1711H Type-C chip driver that works with
+	  Type-C Port Controller Manager to provide USB PD and USB
+	  Type-C functionalities.
+
 endif
 
 endmenu
drivers/staging/typec/Makefile +1 -0
index 53d649abcb53..7803d485e1b3 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_TYPEC_TCPCI)	+= tcpci.o
+obj-$(CONFIG_TYPEC_RT1711H)	+= tcpci_rt1711h.o
drivers/staging/typec/tcpci.h +1 -0
index 34c865f0dcf6..303ebde26546 100644
@@ -59,6 +59,7 @@
 #define TCPC_POWER_CTRL_VCONN_ENABLE	BIT(0)
 
 #define TCPC_CC_STATUS			0x1d
+#define TCPC_CC_STATUS_TOGGLING		BIT(5)
 #define TCPC_CC_STATUS_TERM		BIT(4)
 #define TCPC_CC_STATUS_CC2_SHIFT	2
 #define TCPC_CC_STATUS_CC2_MASK		0x3
drivers/staging/typec/tcpci_rt1711h.c new file +332 -0

332 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v4 2/2 dt-bindings: usb: rt1711h device tree binding document

In reply to ShuFan Lee

From: ShuFan Lee <[email protected]>

Add device tree binding document for Richtek RT1711H Type-C chip driver

---
 .../devicetree/bindings/usb/richtek,rt1711h.txt    | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/richtek,rt1711h.txt

changelogs between v2 & v3
- add dt-bindings for rt1711h typec driver

Documentation/devicetree/bindings/usb/richtek,rt1711h.txt new file +30 -0
new file mode 100644
index 000000000000..7da4dac78ea7
@@ -0,0 +1,30 @@
+Richtek RT1711H TypeC PD Controller.
+
+Required properties:
+ - compatible : Must be "richtek,rt1711h".
+ - reg : Must be 0x4e, it's slave address of RT1711H.
+
+Recommended properties :
+ - interrupt-parent : the phandle for the interrupt controller that
+   provides interrupts for this device.
+ - interrupts : <a b> where a is the interrupt number and b represents an
+   encoding of the sense and level information for the interrupt.
+
+Optional properties :
+ - rt,intr-gpios : IRQ GPIO pin that's connected to RT1711H interrupt.
+   if interrupt-parent & interrupts are not defined, use this property instead.
+
+Example :
+rt1711h@4e {
+	compatible = "richtek,rt1711h";
+	reg = <0x4e>;
+	interrupt-parent = <&gpio26>;
+	interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+};
+
+Example using rt,intr-gpios :
+rt1711h@4e {
+	compatible = "richtek,rt1711h";
+	reg = <0x4e>;
+	rt,intr-gpios = <&gpio26 0 0x0>;
+};
Signature · 1 line
1.9.1
maintainer
#3 lore raw

Re: [PATCH v4 2/2] dt-bindings: usb: rt1711h device tree binding document

Quoted 24 lines · ShuFan Lee

From: ShuFan Lee <[email protected]>

Add device tree binding document for Richtek RT1711H Type-C chip driver

---
 .../devicetree/bindings/usb/richtek,rt1711h.txt    | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/richtek,rt1711h.txt

changelogs between v2 & v3
- add dt-bindings for rt1711h typec driver

Documentation/devicetree/bindings/usb/richtek,rt1711h.txt new file +5 -0
new file mode 100644
index 000000000000..7da4dac78ea7
@@ -0,0 +1,30 @@
+Richtek RT1711H TypeC PD Controller.
+
+Required properties:
+ - compatible : Must be "richtek,rt1711h".
+ - reg : Must be 0x4e, it's slave address of RT1711H.

Documentation/devicetree/bindings/usb/richtek,rt1711h.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/usb/richtek,rt1711h.txt new file +10 -0
+
+Recommended properties :
+ - interrupt-parent : the phandle for the interrupt controller that
+   provides interrupts for this device.
+ - interrupts : <a b> where a is the interrupt number and b represents an
+   encoding of the sense and level information for the interrupt.
+
+Optional properties :
+ - rt,intr-gpios : IRQ GPIO pin that's connected to RT1711H interrupt.
+   if interrupt-parent & interrupts are not defined, use this property instead.

Drop this. You should simply always have interrupts property.

Rob

author
#4 lore raw

Re: [PATCH v4 2/2] dt-bindings: usb: rt1711h device tree binding document

Hi Rob,

2018-03-27 6:23 GMT+08:00 Rob Herring <[email protected]>:

Quoted 29 lines · ShuFan Lee
Quoted 28 lines

From: ShuFan Lee <[email protected]>

Add device tree binding document for Richtek RT1711H Type-C chip driver

---
 .../devicetree/bindings/usb/richtek,rt1711h.txt    | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/richtek,rt1711h.txt

changelogs between v2 & v3
- add dt-bindings for rt1711h typec driver

Documentation/devicetree/bindings/usb/richtek,rt1711h.txt new file +9 -0
new file mode 100644
index 000000000000..7da4dac78ea7
@@ -0,0 +1,30 @@
+Richtek RT1711H TypeC PD Controller.
+
+Required properties:
+ - compatible : Must be "richtek,rt1711h".
+ - reg : Must be 0x4e, it's slave address of RT1711H.
+
+Recommended properties :
+ - interrupt-parent : the phandle for the interrupt controller that
+   provides interrupts for this device.
Quoted 8 lines

Documentation/devicetree/bindings/usb/richtek,rt1711h.txt line 15

Quoted 6 lines
Documentation/devicetree/bindings/usb/richtek,rt1711h.txt new file +6 -0
+ - interrupts : <a b> where a is the interrupt number and b represents an
+   encoding of the sense and level information for the interrupt.
+
+Optional properties :
+ - rt,intr-gpios : IRQ GPIO pin that's connected to RT1711H interrupt.
+   if interrupt-parent & interrupts are not defined, use this property instead.

Drop this. You should simply always have interrupts property.

Does this also imply that we could always assume client->irq is ready for request?
Therefore, there's no need to check client->irq and get gpio through rt,intr-gpios.

Quoted 2 lines

Rob

Signature · 2 lines
Best Regards,
書帆
maintainer
#5 lore raw

Re: [PATCH v4 2/2] dt-bindings: usb: rt1711h device tree binding document

Quoted 40 lines · 李書帆

Hi Rob,

2018-03-27 6:23 GMT+08:00 Rob Herring <[email protected]>:

Quoted 29 lines · ShuFan Lee
Quoted 28 lines

From: ShuFan Lee <[email protected]>

Add device tree binding document for Richtek RT1711H Type-C chip driver

---
 .../devicetree/bindings/usb/richtek,rt1711h.txt    | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/richtek,rt1711h.txt

changelogs between v2 & v3
- add dt-bindings for rt1711h typec driver

Documentation/devicetree/bindings/usb/richtek,rt1711h.txt new file +9 -0
new file mode 100644
index 000000000000..7da4dac78ea7
@@ -0,0 +1,30 @@
+Richtek RT1711H TypeC PD Controller.
+
+Required properties:
+ - compatible : Must be "richtek,rt1711h".
+ - reg : Must be 0x4e, it's slave address of RT1711H.
+
+Recommended properties :
+ - interrupt-parent : the phandle for the interrupt controller that
+   provides interrupts for this device.
Quoted 8 lines

Documentation/devicetree/bindings/usb/richtek,rt1711h.txt line 15

Quoted 6 lines
Documentation/devicetree/bindings/usb/richtek,rt1711h.txt new file +6 -0
+ - interrupts : <a b> where a is the interrupt number and b represents an
+   encoding of the sense and level information for the interrupt.
+
+Optional properties :
+ - rt,intr-gpios : IRQ GPIO pin that's connected to RT1711H interrupt.
+   if interrupt-parent & interrupts are not defined, use this property instead.

Drop this. You should simply always have interrupts property.

Quoted 2 lines

Does this also imply that we could always assume client->irq is ready for request?

No idea.

Quoted 2 lines

Therefore, there's no need to check client->irq and get gpio through rt,intr-gpios.

Looked to me like the gpio is just converted to an irq and used for nothing else in the driver. If that's the case, then there's no point in it being a gpio.

Rob