extcon: add Realtek DHC RTD SoC Type-C driver
Subsystems (3)
PATCH v2 1/2 extcon: add Realtek DHC RTD SoC Type-C driver
This patch adds the extcon driver for Realtek DHC (digital home center) RTD SoCs type-c module. This can be used to detect whether the port is configured as a downstream or upstream facing port. And notify the status of extcon to listeners.
---
v1 to v2 change:
1. added "depends on TYPEC" and "select USB_COMMON" in Kconfig
2. revised the code about gpio.
3. revised the definitions to keep the left-aligned of value
4. add the comment for delay or sleep
5. changed some functions to connector_attached/connector_detached
6. removed to check 'CONFIG_TYPEC' definition with ifdef
--- drivers/extcon/Kconfig | 11 + drivers/extcon/Makefile | 1 + drivers/extcon/extcon-rtk-type-c.c | 1801 ++++++++++++++++++++++++++++ 3 files changed, 1813 insertions(+) create mode 100644 drivers/extcon/extcon-rtk-type-c.c
drivers/extcon/Kconfig +11 -0
@@ -190,4 +190,15 @@ config EXTCON_USBC_TUSB320 Say Y here to enable support for USB Type C cable detection extcon support using a TUSB320. +config EXTCON_RTK_TYPE_C + tristate "Realtek RTD SoC extcon Type-C Driver" + depends on ARCH_REALTEK || COMPILE_TEST + depends on TYPEC + select USB_COMMON + help + Say Y here to enable extcon support for USB Type C cable detection + when using the Realtek RTD SoC USB Type-C port. + The DHC (Digital Home Hub) RTD series SoC contains a type c module. + This driver will detect the status of the type-c port. + endif
drivers/extcon/Makefile +1 -0
@@ -25,3 +25,4 @@ obj-$(CONFIG_EXTCON_SM5502) += extcon-sm5502.o obj-$(CONFIG_EXTCON_USB_GPIO) += extcon-usb-gpio.o obj-$(CONFIG_EXTCON_USBC_CROS_EC) += extcon-usbc-cros-ec.o obj-$(CONFIG_EXTCON_USBC_TUSB320) += extcon-usbc-tusb320.o +obj-$(CONFIG_EXTCON_RTK_TYPE_C) += extcon-rtk-type-c.o
drivers/extcon/extcon-rtk-type-c.c new file +1801 -0
1,801 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 2/2 dt-bindings: extcon: Add Realtek DHC RTD SoC Type-C
Document the device-tree bindings for Realtek SoCs Type-C. Realtek DHC (digital home center) RTD SoCs support a Type-C module.
---
v1 to v2 change:
1. moved this binding from extcon to usb.
2. removed the property of pinctrl.
3. revised the properties of nvmem and gpio.
4. added connector node.
5. revised the example.
--- .../bindings/usb/realtek,rtd-type-c.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/realtek,rtd-type-c.yaml
Documentation/devicetree/bindings/usb/realtek,rtd-type-c.yaml new file +82 -0
@@ -0,0 +1,82 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2023 Realtek Semiconductor Corporation +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/realtek,rtd-type-c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Realtek DHC RTD SoCs USB Type-C Connector detection + +maintainers: + - Stanley Chang <[email protected]> + +description: + Realtek digital home center (DHC) RTD series SoCs include a type c module. + This module is able to detect the state of type c connector. + +properties: + compatible: + enum: + - realtek,rtd1295-type-c + - realtek,rtd1312c-type-c + - realtek,rtd1315e-type-c + - realtek,rtd1319-type-c + - realtek,rtd1319d-type-c + - realtek,rtd1395-type-c + - realtek,rtd1619-type-c + - realtek,rtd1619b-type-c + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + nvmem-cell-names: + items: + - const: usb-cal + + nvmem-cells: + maxItems: 1 + description: + The phandle to nvmem cell that contains the trimming data. + The type c parameter trimming data specified via efuse. + If unspecified, default value is used. + + realtek,rd-ctrl-gpios: + description: The gpio node to control external Rd on board. + maxItems: 1 + + connector: + $ref: /schemas/connector/usb-connector.yaml# + description: Properties for usb c connector. + type: object + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + type-c@7220 { + compatible = "realtek,rtd1619b-type-c"; + reg = <0x7220 0x20>; + interrupts = <0 60 IRQ_TYPE_LEVEL_HIGH>; + + pinctrl-names = "default"; + pinctrl-0 = <&usb_cc1_pins>, <&usb_cc2_pins>; + nvmem-cells = <&otp_usb_cal>; + nvmem-cell-names = "usb-cal"; + + connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "dual"; + }; + };
Signature · 1 line
2.34.1