Skip to contentSkip to conversation

Rockchip Type-C and DispplayPort driver

PATCH Superseded Chris Zhong 6 participants 23 messages Jun 23, 2016 – Jul 11, 2016 1 message not in the archive

Subsystems (7)

v3 of 15 Superseded Latest is v15 →

lore
Share & tools
lore
#0 lore raw

v3 cover Rockchip Type-C and DispplayPort driver

Hi all

This series patch is for rockchip Type-C phy and DisplayPort controller driver.

The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates. The Type-C cable orientation detection and Power Delivery (PD) is accomplished using a PD PHY or a exernal PD chip.

The DP controller is compliant with DisplayPort Specification, Version 1.3, This IP is compatible with the rockchip type-c PHY IP. There is a uCPU in DP controller, it need a firmware to work, please put the firmware file to /lib/firmware/cdn/dptx.bin. The uCPU in charge of aux communication and link training, the host use mailbox to communicate with the ucpu.

The PHY driver has register a notification with extcon API, to get the alt mode from PD, the PD driver need call the devm_extcon_dev_allocate to create a extcon device and use extcon_set_state to notify PHY and DP controller.

About the DP audio, cdn-dp registered 2 DAIs: 0 is I2S, 1 is SPDIF. We can reference them in simple-card.

This series is based on Mark Yao's branch:
https://github.com/markyzq/kernel-drm-rockchip/tree/drm-rockchip-next-2016-05-23

I test this patches on the rk3399-evb board, with a fusb302 driver, this branch has no rk3399.dtsi, so the patch about dts is not included in this series.

Changes in v3:
- use compatible: rockchip,rk3399-typec-phy
- use dashes instead of underscores.
- remove the phy framework(Kishon Vijay Abraham I)
- add parentheses around the macro
- use a single space between type and name
- add spaces after opening and before closing braces.
- use u16 for register value
- remove type-c phy header file
- CodingStyle optimization
- use some cable extcon to get type-c port information
- add a extcon to notify Display Port
- add SoC specific compatible string
- remove reg = <1>;
- use EXTCON_DISP_DP and EXTCON_DISP_DP_ALT cable to get dp port state.
- reset spdif before config it
- modify the firmware clk to 100Mhz
- retry load firmware if fw file is requested too early

Changes in v2:
- add some registers description
- select RESET_CONTROLLER
- alphabetic order
- modify some spelling mistakes
- make mode cleaner
- use bool for enable/disable
- check all of the return value
- return a better err number
- use more readx_poll_timeout()
- clk_disable_unprepare(tcphy->clk_ref);
- remove unuse functions, rockchip_typec_phy_power_on/off
- remove unnecessary typecast from void *
- use dts node to distinguish between phys.
- Alphabetic order
- remove excess error message
- use define clk_rate
- check all return value
- remove dev_set_name(dp->dev, "cdn-dp");
- use schedule_delayed_work
- remove never-called functions
- remove some unnecessary ()

Changes in v1:
- add extcon node description
- move the registers in phy driver
- remove the suffix of reset
- update the licence note
- init core clock to 50MHz
- use extcon API
- remove unused global
- add some comments for magic num
- change usleep_range(1000, 2000) tousleep_range(1000, 1050)
- remove __func__ from dev_err
- return err number when get clk failed
- remove ADDR_ADJ define
- use devm_clk_get(&pdev->dev, "tcpdcore")
- add extcon node description
- add #sound-dai-cells description
- use extcon API
- use hdmi-codec for the DP Asoc
- do not initialize the "ret"
- printk a err log when drm_of_encoder_active_endpoint_id
- modify the dclk pin_pol to a single line

Chris Zhong (5):
extcon: Add Type-C and DP support
Documentation: bindings: add dt doc for Rockchip USB Type-C PHY
phy: Add USB Type-C PHY driver for rk3399
Documentation: bindings: add dt documentation for cdn DP controller drm/rockchip: cdn-dp: add cdn DP support for rk3399

 .../bindings/display/rockchip/cdn-dp-rockchip.txt  |   61 ++
 .../devicetree/bindings/phy/phy-rockchip-typec.txt |   74 ++
 drivers/extcon/extcon.c                            |    6 +
 drivers/gpu/drm/rockchip/Kconfig                   |    9 +
 drivers/gpu/drm/rockchip/Makefile                  |    1 +
 drivers/gpu/drm/rockchip/cdn-dp-core.c             |  722 ++++++++++++++
 drivers/gpu/drm/rockchip/cdn-dp-core.h             |  108 ++
 drivers/gpu/drm/rockchip/cdn-dp-reg.c              |  731 ++++++++++++++
 drivers/gpu/drm/rockchip/cdn-dp-reg.h              |  404 ++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c        |    6 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h        |    2 +
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c        |    2 +
 drivers/phy/Kconfig                                |    8 +
 drivers/phy/Makefile                               |    1 +
 drivers/phy/phy-rockchip-typec.c                   | 1027 ++++++++++++++++++++
 include/linux/extcon.h                             |    6 +
 16 files changed, 3167 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/cdn-dp-rockchip.txt
 create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-core.c
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-core.h
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-reg.c
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-reg.h
 create mode 100644 drivers/phy/phy-rockchip-typec.c
Signature · 1 line
2.6.3
#1 lore raw

PATCH v3 1/5 extcon: Add Type-C and DP support

Add EXTCON_DISP_DP and EXTCON_DISP_DP_ALT for the Display external connector. The EXTCON_DISP_DP is for DisplayPort, and the EXTCON_DISP_DP_ALT is the DisplayPort as an Alternate Mode for the USB Type-C connector (VESA DisplayPort Alt Mode on USB Type-C Standard).

And for the Type-C USB, there is some information need to be supplied by PowerDelivery or other mode detecter: port orientation and pin assignments, so add these 2 virtual cable: EXTCON_TYPEC_POLARITY and EXTCON_TYPEC_PIN_ASSIGN. If EXTCON_TYPEC_POLARITY is attached, the Type-C get flip orientation. IF EXTCON_TYPEC_PIN_ASSIGN is attached, Type-C get Pin_Assignment_C(for DP only mode) or Pin_Assignment_D(for DP alt mode), the default Assignment is A or B.

---

Changes in v3: None
Changes in v2: None
Changes in v1: None

 drivers/extcon/extcon.c | 6 ++++++
 include/linux/extcon.h  | 6 ++++++
 2 files changed, 12 insertions(+)
drivers/extcon/extcon.c +6 -0
index 21a123c..0522b4d 100644
@@ -53,6 +53,10 @@ static const char *extcon_name[] =  {
 	[EXTCON_CHG_USB_FAST]		= "FAST-CHARGER",
 	[EXTCON_CHG_USB_SLOW]		= "SLOW-CHARGER",
 
+	/* Type-c connector */
+	[EXTCON_TYPEC_POLARITY]		= "TYPE-C-POLARITY",
+	[EXTCON_TYPEC_PIN_ASSIGN]	= "TYPE-C-PIN-ASSIGN",
+
 	/* Jack external connector */
 	[EXTCON_JACK_MICROPHONE]	= "MICROPHONE",
 	[EXTCON_JACK_HEADPHONE]		= "HEADPHONE",
@@ -68,6 +72,8 @@ static const char *extcon_name[] =  {
 	[EXTCON_DISP_MHL]		= "MHL",
 	[EXTCON_DISP_DVI]		= "DVI",
 	[EXTCON_DISP_VGA]		= "VGA",
+	[EXTCON_DISP_DP]		= "DP",
+	[EXTCON_DISP_DP_ALT]		= "DP-ALT",
 
 	/* Miscellaneous external connector */
 	[EXTCON_DOCK]			= "DOCK",
include/linux/extcon.h +6 -0
index 7abf674..98039ad 100644
@@ -45,6 +45,10 @@
 #define EXTCON_CHG_USB_FAST	9
 #define EXTCON_CHG_USB_SLOW	10
 
+/* Type-c connector */
+#define EXTCON_TYPEC_POLARITY	11	/* Typec-C plug orientation */
+#define EXTCON_TYPEC_PIN_ASSIGN	12	/* Typec-C pin Assignment */
+
 /* Jack external connector */
 #define EXTCON_JACK_MICROPHONE	20
 #define EXTCON_JACK_HEADPHONE	21
@@ -60,6 +64,8 @@
 #define EXTCON_DISP_MHL		41	/* Mobile High-Definition Link */
 #define EXTCON_DISP_DVI		42	/* Digital Visual Interface */
 #define EXTCON_DISP_VGA		43	/* Video Graphics Array */
+#define EXTCON_DISP_DP		44	/* Display Port */
+#define EXTCON_DISP_DP_ALT	45	/* Display Port Type-C Alternate Mode */
 
 /* Miscellaneous external connector */
 #define EXTCON_DOCK		60
Signature · 1 line
2.6.3
#8 lore raw

PATCH v3 2/5 Documentation: bindings: add dt doc for Rockchip USB Type-C PHY

In reply to Chris Zhong

This patch adds a binding that describes the Rockchip USB Type-C PHY for rk3399

---

Changes in v3:
- use compatible: rockchip,rk3399-typec-phy
- use dashes instead of underscores.

Changes in v2:
- add some registers description

Changes in v1:
- add extcon node description
- move the registers in phy driver
- remove the suffix of reset

 .../devicetree/bindings/phy/phy-rockchip-typec.txt | 74 ++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt new file +74 -0
new file mode 100644
index 0000000..0c5b333
@@ -0,0 +1,74 @@
+* ROCKCHIP type-c PHY
+---------------------
+
+Required properties:
+ - compatible : must be "rockchip,rk3399-typec-phy"
+ - reg: Address and length of the usb phy control register set
+ - rockchip,grf : phandle to the syscon managing the "general
+   register files"
+ - clocks : phandle + clock specifier for the phy clocks
+ - clock-names : string, clock name, must be "tcpdcore", "tcpdphy-ref";
+ - resets : a list of phandle + reset specifier pairs
+ - reset-names : string reset name, must be:
+		 "uphy", "uphy-pipe", "uphy-tcphy"
+ - extcon : extcon specifier for the Power Delivery
+
+Note, there are 2 type-c phys for RK3399, and they are almost identical, except
+these registers(description below), every register node contains 3 sections:
+offset, enable bit, write mask bit.
+ - rockchip,typec-conn-dir : the register of type-c connector direction,
+   for type-c phy0, it must be <0xe580 0 16>;
+   for type-c phy1, it must be <0xe58c 0 16>;
+ - rockchip,usb3tousb2-en : the register of type-c force usb3 to usb2 enable
+   control.
+   for type-c phy0, it must be <0xe580 3 19>;
+   for type-c phy1, it must be <0xe58c 3 19>;
+ - rockchip,external-psm : the register of type-c phy external psm clock
+   selection.
+   for type-c phy0, it must be <0xe588 14 30>;
+   for type-c phy1, it must be <0xe594 14 30>;
+ - rockchip,pipe-status : the register of type-c phy pipe status.
+   for type-c phy0, it must be <0xe5c0 0 0>;
+   for type-c phy1, it must be <0xe5c0 16 16>;
+ - rockchip,uphy-dp-sel : the register of type-c phy selection for DP
+   for type-c phy0, it must be <0x6268 19 19>;
+   for type-c phy1, it must be <0x6268 3 19>;
+
+Example:
+	tcphy0: phy at ff7c0000 {
+		compatible = "rockchip,rk3399-typec-phy";
+		reg = <0x0 0xff7c0000 0x0 0x40000>;
+		extcon = <&fusb0>;
+		rockchip,grf = <&grf>;
+		clocks = <&cru SCLK_UPHY0_TCPDCORE>,
+			 <&cru SCLK_UPHY0_TCPDPHY_REF>;
+		clock-names = "tcpdcore", "tcpdphy-ref";
+		resets = <&cru SRST_UPHY0>,
+			 <&cru SRST_UPHY0_PIPE_L00>,
+			 <&cru SRST_P_UPHY0_TCPHY>;
+		reset-names = "uphy", "uphy-pipe", "uphy-tcphy";
+		rockchip,typec-conn-dir = <0xe580 0 16>;
+		rockchip,usb3tousb2-en = <0xe580 3 19>;
+		rockchip,external-psm = <0xe588 14 30>;
+		rockchip,pipe-status = <0xe5c0 0 0>;
+		rockchip,uphy-dp-sel = <0x6268 19 19>;
+	};
+
+	tcphy1: phy at ff800000 {
+		compatible = "rockchip,rk3399-typec-phy";
+		reg = <0x0 0xff800000 0x0 0x40000>;
+		extcon = <&fusb1>;
+		rockchip,grf = <&grf>;
+		clocks = <&cru SCLK_UPHY1_TCPDCORE>,
+			 <&cru SCLK_UPHY1_TCPDPHY_REF>;
+		clock-names = "tcpdcore", "tcpdphy-ref";
+		resets = <&cru SRST_UPHY1>,
+		         <&cru SRST_UPHY1_PIPE_L00>,
+			 <&cru SRST_P_UPHY1_TCPHY>;
+		reset-names = "uphy", "uphy-pipe", "uphy-tcphy";
+		rockchip,typec-conn-dir = <0xe58c 0 16>;
+		rockchip,usb3tousb2-en = <0xe58c 3 19>;
+		rockchip,external-psm = <0xe594 14 30>;
+		rockchip,pipe-status = <0xe5c0 16 16>;
+		rockchip,uphy-dp-sel = <0x6268 3 19>;
+	};
Signature · 1 line
2.6.3
#10 lore raw

PATCH v3 3/5 phy: Add USB Type-C PHY driver for rk3399

In reply to Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

---

Changes in v3:
- remove the phy framework(Kishon Vijay Abraham I)
- add parentheses around the macro
- use a single space between type and name
- add spaces after opening and before closing braces.
- use u16 for register value
- remove type-c phy header file
- CodingStyle optimization
- use some cable extcon to get type-c port information
- add a extcon to notify Display Port

Changes in v2:
- select RESET_CONTROLLER
- alphabetic order
- modify some spelling mistakes
- make mode cleaner
- use bool for enable/disable
- check all of the return value
- return a better err number
- use more readx_poll_timeout()
- clk_disable_unprepare(tcphy->clk_ref);
- remove unuse functions, rockchip_typec_phy_power_on/off
- remove unnecessary typecast from void *
- use dts node to distinguish between phys.

Changes in v1:
- update the licence note
- init core clock to 50MHz
- use extcon API
- remove unused global
- add some comments for magic num
- change usleep_range(1000, 2000) tousleep_range(1000, 1050)
- remove __func__ from dev_err
- return err number when get clk failed
- remove ADDR_ADJ define
- use devm_clk_get(&pdev->dev, "tcpdcore")

 drivers/phy/Kconfig              |    8 +
 drivers/phy/Makefile             |    1 +
 drivers/phy/phy-rockchip-typec.c | 1027 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 1036 insertions(+)
 create mode 100644 drivers/phy/phy-rockchip-typec.c
drivers/phy/Kconfig +8 -0
index 26566db..ec87b3a 100644
@@ -351,6 +351,14 @@ config PHY_ROCKCHIP_DP
 	help
 	  Enable this to support the Rockchip Display Port PHY.
 
+config PHY_ROCKCHIP_TYPEC
+	tristate "Rockchip TYPEC PHY Driver"
+	depends on ARCH_ROCKCHIP && OF
+	select GENERIC_PHY
+	select RESET_CONTROLLER
+	help
+	  Enable this to support the Rockchip USB TYPEC PHY.
+
 config PHY_ST_SPEAR1310_MIPHY
 	tristate "ST SPEAR1310-MIPHY driver"
 	select GENERIC_PHY
drivers/phy/Makefile +1 -0
index 24596a9..91fa413 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)	+= phy-qcom-apq8064-sata.o
 obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o
 obj-$(CONFIG_PHY_ROCKCHIP_EMMC) += phy-rockchip-emmc.o
 obj-$(CONFIG_PHY_ROCKCHIP_DP)		+= phy-rockchip-dp.o
+obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o
 obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)	+= phy-qcom-ipq806x-sata.o
 obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY)	+= phy-spear1310-miphy.o
 obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY)	+= phy-spear1340-miphy.o
drivers/phy/phy-rockchip-typec.c new file +1027 -0

1,027 lines not on this page · raw message

Signature · 1 line
2.6.3
#21 lore raw

PATCH v3 4/5 Documentation: bindings: add dt documentation for cdn DP controller

In reply to Chris Zhong

This patch adds a binding that describes the cdn DP controller for rk3399.

---

Changes in v3:
- add SoC specific compatible string
- remove reg = <1>;

Changes in v2: None
Changes in v1:
- add extcon node description
- add #sound-dai-cells description

 .../bindings/display/rockchip/cdn-dp-rockchip.txt  | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/cdn-dp-rockchip.txt
Documentation/devicetree/bindings/display/rockchip/cdn-dp-rockchip.txt new file +61 -0
new file mode 100644
index 0000000..b14b2b2
@@ -0,0 +1,61 @@
+Rockchip RK3399 specific extensions to the cdn Display Port
+================================
+
+Required properties:
+- compatible: must be "rockchip,rk3399-cdn-dp"
+
+- reg: physical base address of the controller and length
+
+- clocks: from common clock binding: handle to dp clock.
+
+- clock-names: from common clock binding:
+	       Required elements: "core-clk" "pclk" "spdif"
+
+- rockchip,grf: this soc should set GRF regs, so need get grf here.
+
+- ports: contain a port nodes with endpoint definitions as defined in
+	 Documentation/devicetree/bindings/media/video-interfaces.txt.
+	 contained 2 endpoints, connecting to the output of vop.
+
+- phys: from general PHY binding: the phandle for the PHY device.
+
+- extcon: extcon specifier for the Power Delivery
+
+- #sound-dai-cells = it must be 1 if your system is using 2 DAIs: I2S, SPDIF
+
+-------------------------------------------------------------------------------
+
+Example:
+	cdn_dp: dp at fec00000 {
+		compatible = "rockchip,rk3399-cdn-dp";
+		reg = <0x0 0xfec00000 0x0 0x100000>;
+		interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_DP_CORE>, <&cru PCLK_DP_CTRL>,
+			 <&cru SCLK_SPDIF_REC_DPTX>;
+		clock-names = "core-clk", "pclk", "spdif";
+		phys = <&tcphy0>;
+		extcon = <&fusb1>;
+		rockchip,grf = <&grf>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		#sound-dai-cells = <1>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			dp_in: port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				dp_in_vopb: endpoint at 0 {
+					reg = <0>;
+					remote-endpoint = <&vopb_out_dp>;
+				};
+
+				dp_in_vopl: endpoint at 1 {
+					reg = <1>;
+					remote-endpoint = <&vopl_out_dp>;
+				};
+			};
+		};
+	};
Signature · 1 line
2.6.3
#23 lore raw

PATCH v3 5/5 drm/rockchip: cdn-dp: add cdn DP support for rk3399

In reply to Chris Zhong

Add support for cdn DP controller which is embedded in the rk3399 SoCs. The DP is compliant with DisplayPort Specification, Version 1.3, This IP is compatible with the rockchip type-c PHY IP. There is a uCPU in DP controller, it need a firmware to work, please put the firmware file to /lib/firmware/cdn/dptx.bin. The uCPU in charge of aux communication and link training, the host use mailbox to communicate with the ucpu.
The dclk pin_pol of vop must not be invert for DP.

---

Changes in v3:
- use EXTCON_DISP_DP and EXTCON_DISP_DP_ALT cable to get dp port state.
- reset spdif before config it
- modify the firmware clk to 100Mhz
- retry load firmware if fw file is requested too early

Changes in v2:
- Alphabetic order
- remove excess error message
- use define clk_rate
- check all return value
- remove dev_set_name(dp->dev, "cdn-dp");
- use schedule_delayed_work
- remove never-called functions
- remove some unnecessary ()

Changes in v1:
- use extcon API
- use hdmi-codec for the DP Asoc
- do not initialize the "ret"
- printk a err log when drm_of_encoder_active_endpoint_id
- modify the dclk pin_pol to a single line

 drivers/gpu/drm/rockchip/Kconfig            |   9 +
 drivers/gpu/drm/rockchip/Makefile           |   1 +
 drivers/gpu/drm/rockchip/cdn-dp-core.c      | 722 +++++++++++++++++++++++++++
 drivers/gpu/drm/rockchip/cdn-dp-core.h      | 108 ++++
 drivers/gpu/drm/rockchip/cdn-dp-reg.c       | 731 ++++++++++++++++++++++++++++
 drivers/gpu/drm/rockchip/cdn-dp-reg.h       | 404 +++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h |   2 +
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c |   2 +
 9 files changed, 1984 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-core.c
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-core.h
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-reg.c
 create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-reg.h
drivers/gpu/drm/rockchip/Kconfig +9 -0
index d30bdc3..20da9a8 100644
@@ -25,6 +25,15 @@ config ROCKCHIP_ANALOGIX_DP
 	  for the Analogix Core DP driver. If you want to enable DP
 	  on RK3288 based SoC, you should selet this option.
 
+config ROCKCHIP_CDN_DP
+        tristate "Rockchip cdn DP"
+        depends on DRM_ROCKCHIP
+        help
+	  This selects support for Rockchip SoC specific extensions
+	  for the cdn Dp driver. If you want to enable Dp on
+	  RK3399 based SoC, you should selet this
+	  option.
+
 config ROCKCHIP_DW_HDMI
         tristate "Rockchip specific extensions for Synopsys DW HDMI"
         depends on DRM_ROCKCHIP
drivers/gpu/drm/rockchip/Makefile +1 -0
index 05d0713..abdecd5 100644
@@ -7,6 +7,7 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
 rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o
 
 obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
+obj-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
 obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
 obj-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o
 obj-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
drivers/gpu/drm/rockchip/cdn-dp-core.c new file +722 -0

722 lines not on this page · raw message

drivers/gpu/drm/rockchip/cdn-dp-core.h new file +108 -0

108 lines not on this page · raw message

drivers/gpu/drm/rockchip/cdn-dp-reg.c new file +731 -0

731 lines not on this page · raw message

drivers/gpu/drm/rockchip/cdn-dp-reg.h new file +404 -0

404 lines not on this page · raw message

drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5 -1
index edd7ec2..98302b3 100644
@@ -969,7 +969,7 @@ static void vop_crtc_enable(struct drm_crtc *crtc)
 		vop_dsp_hold_valid_irq_disable(vop);
 	}
 
-	pin_pol = 0x8;
+	pin_pol = (s->output_type == DRM_MODE_CONNECTOR_DisplayPort) ? 0 : 0x8;
 	pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) ? 0 : 1;
 	pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) ? 0 : (1 << 1);
 	VOP_CTRL_SET(vop, pin_pol, pin_pol);
@@ -991,6 +991,10 @@ static void vop_crtc_enable(struct drm_crtc *crtc)
 		VOP_CTRL_SET(vop, mipi_pin_pol, pin_pol);
 		VOP_CTRL_SET(vop, mipi_en, 1);
 		break;
+	case DRM_MODE_CONNECTOR_DisplayPort:
+		VOP_CTRL_SET(vop, dp_pin_pol, pin_pol);
+		VOP_CTRL_SET(vop, dp_en, 1);
+		break;
 	default:
 		DRM_ERROR("unsupport connector_type[%d]\n", s->output_type);
 	}
drivers/gpu/drm/rockchip/rockchip_drm_vop.h +2 -0
index ff4f52e..50a045c 100644
@@ -45,6 +45,7 @@ struct vop_ctrl {
 	struct vop_reg edp_en;
 	struct vop_reg hdmi_en;
 	struct vop_reg mipi_en;
+	struct vop_reg dp_en;
 	struct vop_reg out_mode;
 	struct vop_reg dither_down;
 	struct vop_reg dither_up;
@@ -53,6 +54,7 @@ struct vop_ctrl {
 	struct vop_reg hdmi_pin_pol;
 	struct vop_reg edp_pin_pol;
 	struct vop_reg mipi_pin_pol;
+	struct vop_reg dp_pin_pol;
 
 	struct vop_reg htotal_pw;
 	struct vop_reg hact_st_end;
drivers/gpu/drm/rockchip/rockchip_vop_reg.c +2 -0
index 5b1ae1f..dcf172e 100644
@@ -281,6 +281,7 @@ static const struct vop_data rk3288_vop = {
 static const struct vop_ctrl rk3399_ctrl_data = {
 	.standby = VOP_REG(RK3399_SYS_CTRL, 0x1, 22),
 	.gate_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 23),
+	.dp_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 11),
 	.rgb_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 12),
 	.hdmi_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 13),
 	.edp_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 14),
@@ -290,6 +291,7 @@ static const struct vop_ctrl rk3399_ctrl_data = {
 	.data_blank = VOP_REG(RK3399_DSP_CTRL0, 0x1, 19),
 	.out_mode = VOP_REG(RK3399_DSP_CTRL0, 0xf, 0),
 	.rgb_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 16),
+	.dp_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 16),
 	.hdmi_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 20),
 	.edp_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 24),
 	.mipi_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 28),
Signature · 1 line
2.6.3
#11 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

In reply to Chris Zhong

Hi,

Quoted 59 lines · Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

---

Changes in v3:
- remove the phy framework(Kishon Vijay Abraham I)
- add parentheses around the macro
- use a single space between type and name
- add spaces after opening and before closing braces.
- use u16 for register value
- remove type-c phy header file
- CodingStyle optimization
- use some cable extcon to get type-c port information
- add a extcon to notify Display Port

Changes in v2:
- select RESET_CONTROLLER
- alphabetic order
- modify some spelling mistakes
- make mode cleaner
- use bool for enable/disable
- check all of the return value
- return a better err number
- use more readx_poll_timeout()
- clk_disable_unprepare(tcphy->clk_ref);
- remove unuse functions, rockchip_typec_phy_power_on/off
- remove unnecessary typecast from void *
- use dts node to distinguish between phys.

Changes in v1:
- update the licence note
- init core clock to 50MHz
- use extcon API
- remove unused global
- add some comments for magic num
- change usleep_range(1000, 2000) tousleep_range(1000, 1050)
- remove __func__ from dev_err
- return err number when get clk failed
- remove ADDR_ADJ define
- use devm_clk_get(&pdev->dev, "tcpdcore")

 drivers/phy/Kconfig              |    8 +
 drivers/phy/Makefile             |    1 +
 drivers/phy/phy-rockchip-typec.c | 1027 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 1036 insertions(+)
 create mode 100644 drivers/phy/phy-rockchip-typec.c
drivers/phy/Kconfig +0 -0
index 26566db..ec87b3a 100644

drivers/phy/Kconfig config PHY_ROCKCHIP_DP · line 357

Quoted 7 lines
drivers/phy/Kconfig +4 -0
@@ -351,6 +351,14 @@ config PHY_ROCKCHIP_DP
 	help
 	  Enable this to support the Rockchip Display Port PHY.
 
+config PHY_ROCKCHIP_TYPEC
+	tristate "Rockchip TYPEC PHY Driver"
+	depends on ARCH_ROCKCHIP && OF
+	select GENERIC_PHY

Why? None of the generic PHY API's are used here. Why do you want select generic PHY?

drivers/phy/Kconfig config PHY_ROCKCHIP_DP · line 358

Quoted 1 line
drivers/phy/Kconfig +1 -0
+	select RESET_CONTROLLER

The driver also uses extcon. That has to be selected as well.

And since this driver doesn't use phy framework, I feel this should probably end up in drivers/extcon and not drivers/phy.

Thanks
Kishon

#16 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

In reply to Chris Zhong

Hi Chris,

[ ... ]

Quoted 11 lines
drivers/phy/phy-rockchip-typec.c new file +11 -0
+       ret = extcon_register_notifier(tcphy->pd_extcon, EXTCON_USB,
+                                      &tcphy->event_nb);
+       if (ret) {
+               dev_err(dev, "regitster EXTCON_USB notifer failed\n");
+               return ret;
+       }
+
+       ret = extcon_register_notifier(tcphy->pd_extcon, EXTCON_USB_HOST,
+                                      &tcphy->event_nb);
+       if (ret) {
+               dev_err(dev, "regitster EXTCON_USB_HOST notifer failed\n");

drivers/phy/phy-rockchip-typec.c line 979

Quoted 10 lines
drivers/phy/phy-rockchip-typec.c new file +10 -0
+               return ret;
+       }
+
+       ret = extcon_register_notifier(tcphy->pd_extcon, EXTCON_DISP_DP,
+                                      &tcphy->event_nb);
+       if (ret) {
+               dev_err(dev, "regitster EXTCON_DISP_DP notifer failed\n");
+               return ret;
+       }
+

I don't think you can register multiple notifiers with the same notifier block. It may work by chance, but at least the 'next' object in notifier_clock is set in notifier_chain_register(). Best case it may work, but worst case it might cause a loop in the list of notifiers.

Guenter

#17 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

In reply to Chris Zhong

Hi Chris,

Quoted 9 lines · Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

[ ... ]

Quoted 17 lines
drivers/phy/phy-rockchip-typec.c new file +17 -0
+
+static void tcphy_get_state(struct rockchip_typec_phy *tcphy,
+                           struct extcon_dev *edev)
+{
+       int mode;
+       bool plugged, flip, pin_assign, dfp, ufp, dp;
+
+       ufp = extcon_get_cable_state_(edev, EXTCON_USB);
+       dfp = extcon_get_cable_state_(edev, EXTCON_USB_HOST);
+       dp = extcon_get_cable_state_(edev, EXTCON_DISP_DP);
+       flip = extcon_get_cable_state_(edev, EXTCON_TYPEC_POLARITY);
+       pin_assign = extcon_get_cable_state_(edev, EXTCON_TYPEC_PIN_ASSIGN);
+
+       plugged = ufp | dfp | dp;
+       tcphy->flip = flip;
+
+       if (plugged) {

drivers/phy/phy-rockchip-typec.c line 765

Quoted 10 lines
drivers/phy/phy-rockchip-typec.c new file +10 -0
+               if (ufp) {
+                       mode = MODE_UFP_USB;
+               } else if (dfp && !dp) {
+                       mode = MODE_DFP_USB;
+               } else if (dfp && dp) {
+                       mode = MODE_DFP_USB | MODE_DFP_DP;
+                       tcphy->pin_assign = pin_assign ? PIN_MAP_D : PIN_MAP_B;
+               } else {
+                       mode = MODE_DFP_DP;
+                       tcphy->pin_assign = pin_assign ? PIN_MAP_C : PIN_MAP_A;

I am having trouble extracting pin_assign from our code. What determines if map A or C should be selected ?

Thanks,
Guenter

#18 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

Hi Guenter

Quoted 44 lines · Guenter Roeck

Hi Chris,

Quoted 9 lines · Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

[ ... ]

Quoted 17 lines
drivers/phy/phy-rockchip-typec.c new file +17 -0
+
+static void tcphy_get_state(struct rockchip_typec_phy *tcphy,
+                           struct extcon_dev *edev)
+{
+       int mode;
+       bool plugged, flip, pin_assign, dfp, ufp, dp;
+
+       ufp = extcon_get_cable_state_(edev, EXTCON_USB);
+       dfp = extcon_get_cable_state_(edev, EXTCON_USB_HOST);
+       dp = extcon_get_cable_state_(edev, EXTCON_DISP_DP);
+       flip = extcon_get_cable_state_(edev, EXTCON_TYPEC_POLARITY);
+       pin_assign = extcon_get_cable_state_(edev, EXTCON_TYPEC_PIN_ASSIGN);
+
+       plugged = ufp | dfp | dp;
+       tcphy->flip = flip;
+
+       if (plugged) {

drivers/phy/phy-rockchip-typec.c line 765

Quoted 10 lines
drivers/phy/phy-rockchip-typec.c new file +10 -0
+               if (ufp) {
+                       mode = MODE_UFP_USB;
+               } else if (dfp && !dp) {
+                       mode = MODE_DFP_USB;
+               } else if (dfp && dp) {
+                       mode = MODE_DFP_USB | MODE_DFP_DP;
+                       tcphy->pin_assign = pin_assign ? PIN_MAP_D : PIN_MAP_B;
+               } else {
+                       mode = MODE_DFP_DP;
+                       tcphy->pin_assign = pin_assign ? PIN_MAP_C : PIN_MAP_A;

I am having trouble extracting pin_assign from our code. What determines if map A or C should be selected ?

Quoted 2 lines

Thanks,
Guenter

Oh, forgot rename the macro:

PIN_MAP_ should be PIN_ASSIGN_

IF EXTCON_TYPEC_PIN_ASSIGN is attached, Type-C get Pin_Assignment_C(for DP only mode) or Pin_Assignment_D(for DP alt mode),
if detached, it get the default Assignment: A(for DP only mode) or
B(for DP alt mode),.

I am going to add a comment for describe which PIN_ASSIGN_ should be selected
in next version, if no one disagrees the usage of cable

Quoted 2 lines
#19 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

Hi Chris,

Quoted 59 lines · Chris Zhong

Hi Guenter

Quoted 50 lines · Guenter Roeck

Hi Chris,

Quoted 10 lines · Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

[ ... ]

Quoted 29 lines
drivers/phy/phy-rockchip-typec.c new file +12 -0
+
+static void tcphy_get_state(struct rockchip_typec_phy *tcphy,
+                           struct extcon_dev *edev)
+{
+       int mode;
+       bool plugged, flip, pin_assign, dfp, ufp, dp;
+
+       ufp = extcon_get_cable_state_(edev, EXTCON_USB);
+       dfp = extcon_get_cable_state_(edev, EXTCON_USB_HOST);
+       dp = extcon_get_cable_state_(edev, EXTCON_DISP_DP);
+       flip = extcon_get_cable_state_(edev, EXTCON_TYPEC_POLARITY);
+       pin_assign = extcon_get_cable_state_(edev,

EXTCON_TYPEC_PIN_ASSIGN);

drivers/phy/phy-rockchip-typec.c new file +12 -0
+
+       plugged = ufp | dfp | dp;
+       tcphy->flip = flip;
+
+       if (plugged) {
+               if (ufp) {
+                       mode = MODE_UFP_USB;
+               } else if (dfp && !dp) {
+                       mode = MODE_DFP_USB;
+               } else if (dfp && dp) {
+                       mode = MODE_DFP_USB | MODE_DFP_DP;
+                       tcphy->pin_assign = pin_assign ? PIN_MAP_D :

PIN_MAP_B;

drivers/phy/phy-rockchip-typec.c new file +3 -0
+               } else {
+                       mode = MODE_DFP_DP;
+                       tcphy->pin_assign = pin_assign ? PIN_MAP_C :
Quoted 1 line

PIN_MAP_A;

I am having trouble extracting pin_assign from our code. What determines if map A or C should be selected ?

Quoted 2 lines

Thanks,
Guenter

Oh, forgot rename the macro:

Quoted 8 lines

PIN_MAP_ should be PIN_ASSIGN_

IF EXTCON_TYPEC_PIN_ASSIGN is attached, Type-C get Pin_Assignment_C(for DP only mode) or Pin_Assignment_D(for DP alt mode),
if detached, it get the default Assignment: A(for DP only mode) or B(for
DP alt mode),.

So we are really talking about DP only vs. DP Alt mode ? If so, do we even need PIN_ASSIGN ? Why not just use EXTCON_DISP_DP_ALT directly ?

Also, I'll have to get a better understanding what "DP only mode" and "DP Alt mode" actually means. DisplayPort is already a Type-C alternate mode, so the terminology is a bit confusing. Do you happen to have a description somewhere, by any chance ?

Thanks,
Guenter

Quoted 9 lines

I am going to add a comment for describe which PIN_ASSIGN_ should be selected
in next version, if no one disagrees the usage of cable

Quoted 2 lines
#20 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

Hi Guenter

Quoted 69 lines · Guenter Roeck

Hi Chris,

Quoted 55 lines · Chris Zhong

Hi Guenter

Quoted 47 lines · Guenter Roeck

Hi Chris,

Quoted 9 lines · Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

[ ... ]

Quoted 29 lines
drivers/phy/phy-rockchip-typec.c new file +12 -0
+
+static void tcphy_get_state(struct rockchip_typec_phy *tcphy,
+                           struct extcon_dev *edev)
+{
+       int mode;
+       bool plugged, flip, pin_assign, dfp, ufp, dp;
+
+       ufp = extcon_get_cable_state_(edev, EXTCON_USB);
+       dfp = extcon_get_cable_state_(edev, EXTCON_USB_HOST);
+       dp = extcon_get_cable_state_(edev, EXTCON_DISP_DP);
+       flip = extcon_get_cable_state_(edev, EXTCON_TYPEC_POLARITY);
+       pin_assign = extcon_get_cable_state_(edev,

EXTCON_TYPEC_PIN_ASSIGN);

drivers/phy/phy-rockchip-typec.c new file +12 -0
+
+       plugged = ufp | dfp | dp;
+       tcphy->flip = flip;
+
+       if (plugged) {
+               if (ufp) {
+                       mode = MODE_UFP_USB;
+               } else if (dfp && !dp) {
+                       mode = MODE_DFP_USB;
+               } else if (dfp && dp) {
+                       mode = MODE_DFP_USB | MODE_DFP_DP;
+                       tcphy->pin_assign = pin_assign ? PIN_MAP_D :

PIN_MAP_B;

drivers/phy/phy-rockchip-typec.c new file +3 -0
+               } else {
+                       mode = MODE_DFP_DP;
+                       tcphy->pin_assign = pin_assign ? PIN_MAP_C :
Quoted 1 line

PIN_MAP_A;

I am having trouble extracting pin_assign from our code. What determines if map A or C should be selected ?

Quoted 2 lines

Thanks,
Guenter

Oh, forgot rename the macro:

Quoted 8 lines

PIN_MAP_ should be PIN_ASSIGN_

IF EXTCON_TYPEC_PIN_ASSIGN is attached, Type-C get Pin_Assignment_C(for DP only mode) or Pin_Assignment_D(for DP alt mode),
if detached, it get the default Assignment: A(for DP only mode) or B(for
DP alt mode),.

So we are really talking about DP only vs. DP Alt mode ? If so, do we even need PIN_ASSIGN ? Why not just use EXTCON_DISP_DP_ALT directly ?

Quoted 7 lines

Also, I'll have to get a better understanding what "DP only mode" and "DP Alt mode" actually means. DisplayPort is already a Type-C alternate mode, so the terminology is a bit confusing. Do you happen to have a description somewhere, by any chance ?

Thanks,
Guenter

The Pin Assignments is come from:
VESA DisplayPort Alt Mode on USB Type-C Standard

There are 2 mode for DP: DP only mode, and DP+USB3 mode(EXTCON_DISP_DP_ALT ) At DP only mode, DP has 4 lanes of Type-C;
At DP+USB3 mode, DP has 2 lanes, and USB3 has the other 2 lanes.

For DP only mode, there are 3 kind of pin assignments: A, C, E. For DP + USB3 mode, there are 3 kind of pin assignments: B, D, F.

Pin Assignments C and D use the same assignments as Pin Assignments E and F. Thence, we just need to distinguish A and C for DP only mode. and distinguish B and D for DP + USB3 mode.
That why the phy need a PIN_ASSIGN cable.

The name of "DP Alt mode", it is DP+USB3 mode, actually.
I think if the name makes anyone confused, it can be changed to DP_USB3 mode:
The cable list could be:
EXTCON_DISP_DP
EXTCON_DISP_DP_USB3

Quoted 10 lines
Quoted 8 lines

I am going to add a comment for describe which PIN_ASSIGN_ should be selected
in next version, if no one disagrees the usage of cable

Quoted 1 line
maintainer Acked-by on v3 2/5
#9 lore raw

Re: [v3 PATCH 2/5] Documentation: bindings: add dt doc for Rockchip USB Type-C PHY

In reply to Chris Zhong
Quoted 16 lines · Chris Zhong

This patch adds a binding that describes the Rockchip USB Type-C PHY for rk3399

---

Changes in v3:
- use compatible: rockchip,rk3399-typec-phy
- use dashes instead of underscores.

Changes in v2:
- add some registers description

Quoted 8 lines

Changes in v1:
- add extcon node description
- move the registers in phy driver
- remove the suffix of reset

 .../devicetree/bindings/phy/phy-rockchip-typec.txt | 74 ++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt
maintainer Acked-by on v3 4/5
#22 lore raw

Re: [v3 PATCH 4/5] Documentation: bindings: add dt documentation for cdn DP controller

In reply to Chris Zhong
Quoted 11 lines · Chris Zhong

This patch adds a binding that describes the cdn DP controller for rk3399.

---

Changes in v3:
- add SoC specific compatible string
- remove reg = <1>;

Quoted 8 lines

Changes in v2: None
Changes in v1:
- add extcon node description
- add #sound-dai-cells description

 .../bindings/display/rockchip/cdn-dp-rockchip.txt  | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/cdn-dp-rockchip.txt
maintainer
#12 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

In reply to Kishon Vijay Abraham I

Am Donnerstag, 23. Juni 2016, 18:27:52 schrieb Kishon Vijay Abraham I:

Quoted 68 lines

Hi,

Quoted 65 lines · Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

---

Changes in v3:
- remove the phy framework(Kishon Vijay Abraham I)
- add parentheses around the macro
- use a single space between type and name
- add spaces after opening and before closing braces.
- use u16 for register value
- remove type-c phy header file
- CodingStyle optimization
- use some cable extcon to get type-c port information
- add a extcon to notify Display Port

Changes in v2:
- select RESET_CONTROLLER
- alphabetic order
- modify some spelling mistakes
- make mode cleaner
- use bool for enable/disable
- check all of the return value
- return a better err number
- use more readx_poll_timeout()
- clk_disable_unprepare(tcphy->clk_ref);
- remove unuse functions, rockchip_typec_phy_power_on/off
- remove unnecessary typecast from void *
- use dts node to distinguish between phys.

Changes in v1:
- update the licence note
- init core clock to 50MHz
- use extcon API
- remove unused global
- add some comments for magic num
- change usleep_range(1000, 2000) tousleep_range(1000, 1050)
- remove __func__ from dev_err
- return err number when get clk failed
- remove ADDR_ADJ define
- use devm_clk_get(&pdev->dev, "tcpdcore")

 drivers/phy/Kconfig              |    8 +
 drivers/phy/Makefile             |    1 +
 drivers/phy/phy-rockchip-typec.c | 1027
 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 1036
 insertions(+)
 create mode 100644 drivers/phy/phy-rockchip-typec.c
drivers/phy/Kconfig +0 -0
index 26566db..ec87b3a 100644
@@ -351,6 +351,14 @@ config PHY_ROCKCHIP_DP
 
 	help
 
 	  Enable this to support the Rockchip Display Port PHY.
 
Quoted 7 lines

drivers/phy/Kconfig config PHY_ROCKCHIP_DP · line 357

Quoted 4 lines
drivers/phy/Kconfig +4 -0
+config PHY_ROCKCHIP_TYPEC
+	tristate "Rockchip TYPEC PHY Driver"
+	depends on ARCH_ROCKCHIP && OF
+	select GENERIC_PHY

Why? None of the generic PHY API's are used here. Why do you want select generic PHY?

I'm actually wondering, why there are no phy ops to start and stop the py. Right now the device seems to be on and handling all the extcon notifies all the time even if no-one is using the phy.

There are two users of this phy, the dp-controller as well as some usb component. The phy framework is nicely refcounted, so can handle any number of phy users and somehow I'd expect the phy to do nothing (and try to not consume power) if neither the dp-controller nor the usb-part is actually running.

It may very well be my ignorance, but Chris could you explain, if there is a reason for this?

Thanks
Heiko

#13 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

Hi Heiko

Quoted 85 lines · Heiko Stuebner

Am Donnerstag, 23. Juni 2016, 18:27:52 schrieb Kishon Vijay Abraham I:

Quoted 66 lines

Hi,

Quoted 63 lines · Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

---

Changes in v3:
- remove the phy framework(Kishon Vijay Abraham I)
- add parentheses around the macro
- use a single space between type and name
- add spaces after opening and before closing braces.
- use u16 for register value
- remove type-c phy header file
- CodingStyle optimization
- use some cable extcon to get type-c port information
- add a extcon to notify Display Port

Changes in v2:
- select RESET_CONTROLLER
- alphabetic order
- modify some spelling mistakes
- make mode cleaner
- use bool for enable/disable
- check all of the return value
- return a better err number
- use more readx_poll_timeout()
- clk_disable_unprepare(tcphy->clk_ref);
- remove unuse functions, rockchip_typec_phy_power_on/off
- remove unnecessary typecast from void *
- use dts node to distinguish between phys.

Changes in v1:
- update the licence note
- init core clock to 50MHz
- use extcon API
- remove unused global
- add some comments for magic num
- change usleep_range(1000, 2000) tousleep_range(1000, 1050)
- remove __func__ from dev_err
- return err number when get clk failed
- remove ADDR_ADJ define
- use devm_clk_get(&pdev->dev, "tcpdcore")

  drivers/phy/Kconfig              |    8 +
  drivers/phy/Makefile             |    1 +
  drivers/phy/phy-rockchip-typec.c | 1027

++++++++++++++++++++++++++++++++++++++ 3 files changed, 1036 insertions(+)
create mode 100644 drivers/phy/phy-rockchip-typec.c

drivers/phy/Kconfig +0 -0
index 26566db..ec87b3a 100644
@@ -351,6 +351,14 @@ config PHY_ROCKCHIP_DP
 
  	help
 
Quoted 8 lines

drivers/phy/Kconfig config PHY_ROCKCHIP_DP · line 357

Quoted 6 lines
drivers/phy/Kconfig +4 -0
  	  Enable this to support the Rockchip Display Port PHY.
 
+config PHY_ROCKCHIP_TYPEC
+	tristate "Rockchip TYPEC PHY Driver"
+	depends on ARCH_ROCKCHIP && OF
+	select GENERIC_PHY

Why? None of the generic PHY API's are used here. Why do you want select generic PHY?

I'm actually wondering, why there are no phy ops to start and stop the py. Right now the device seems to be on and handling all the extcon notifies all the time even if no-one is using the phy.

There are two users of this phy, the dp-controller as well as some usb component. The phy framework is nicely refcounted, so can handle any number of phy users and somehow I'd expect the phy to do nothing (and try to not consume power) if neither the dp-controller nor the usb-part is actually running.

Quoted 8 lines

It may very well be my ignorance, but Chris could you explain, if there is a reason for this?

Thanks
Heiko

It is good idea, The USB3 and DP controller detect the extcon cable
state: USB/USB HOST/DP. If a Type-C device plugged, call phy power on, the phy driver get all the state of extcon: dfp, ufp, dp, flip, pin assignment, and then finish the phy init. So the phy driver need not register extcon notification.
But this mechanism allows phy driver only focus plug/unplug event, if some other things happen, such as data role change, the phy will not be notified. I'm not sure if this situation exists.
Hi Guenter,
Do you have any ohter concerns?

Quoted 1 line
#14 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

Quoted 105 lines · Chris Zhong

Hi Heiko

Quoted 92 lines · Heiko Stuebner

Am Donnerstag, 23. Juni 2016, 18:27:52 schrieb Kishon Vijay Abraham I:

Quoted 70 lines

Hi,

Quoted 66 lines · Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

---

Changes in v3:
- remove the phy framework(Kishon Vijay Abraham I)
- add parentheses around the macro
- use a single space between type and name
- add spaces after opening and before closing braces.
- use u16 for register value
- remove type-c phy header file
- CodingStyle optimization
- use some cable extcon to get type-c port information
- add a extcon to notify Display Port

Changes in v2:
- select RESET_CONTROLLER
- alphabetic order
- modify some spelling mistakes
- make mode cleaner
- use bool for enable/disable
- check all of the return value
- return a better err number
- use more readx_poll_timeout()
- clk_disable_unprepare(tcphy->clk_ref);
- remove unuse functions, rockchip_typec_phy_power_on/off
- remove unnecessary typecast from void *
- use dts node to distinguish between phys.

Changes in v1:
- update the licence note
- init core clock to 50MHz
- use extcon API
- remove unused global
- add some comments for magic num
- change usleep_range(1000, 2000) tousleep_range(1000, 1050)
- remove __func__ from dev_err
- return err number when get clk failed
- remove ADDR_ADJ define
- use devm_clk_get(&pdev->dev, "tcpdcore")

  drivers/phy/Kconfig              |    8 +
  drivers/phy/Makefile             |    1 +
  drivers/phy/phy-rockchip-typec.c | 1027

++++++++++++++++++++++++++++++++++++++ 3 files changed, 1036 insertions(+)
create mode 100644 drivers/phy/phy-rockchip-typec.c

drivers/phy/Kconfig +0 -0
index 26566db..ec87b3a 100644
@@ -351,6 +351,14 @@ config PHY_ROCKCHIP_DP
 
        help
 
          Enable this to support the Rockchip Display Port PHY.
 
Quoted 7 lines

drivers/phy/Kconfig config PHY_ROCKCHIP_DP · line 357

Quoted 4 lines
drivers/phy/Kconfig +4 -0
+config PHY_ROCKCHIP_TYPEC
+       tristate "Rockchip TYPEC PHY Driver"
+       depends on ARCH_ROCKCHIP && OF
+       select GENERIC_PHY

Why? None of the generic PHY API's are used here. Why do you want select generic PHY?

I'm actually wondering, why there are no phy ops to start and stop the py. Right now the device seems to be on and handling all the extcon notifies all
the time even if no-one is using the phy.

There are two users of this phy, the dp-controller as well as some usb component. The phy framework is nicely refcounted, so can handle any number
of phy users and somehow I'd expect the phy to do nothing (and try to not consume power) if neither the dp-controller nor the usb-part is actually running.

Quoted 9 lines

It may very well be my ignorance, but Chris could you explain, if there is a
reason for this?

Thanks
Heiko

Quoted 8 lines

It is good idea, The USB3 and DP controller detect the extcon cable state:
USB/USB HOST/DP. If a Type-C device plugged, call phy power on, the phy driver get all the state of extcon: dfp, ufp, dp, flip, pin assignment, and then finish the phy init. So the phy driver need not register extcon notification.
But this mechanism allows phy driver only focus plug/unplug event, if some other things happen, such as data role change, the phy will not be notified. I'm not sure if this situation exists.

Sorry, I think I am lost (again).

All roles can change on the fly. Role changes can be triggered from user space, or by the remote partner. If we restrict such role changes, we would have to reject all locally triggered role change requests, as well as all role change requests from the remote, after the initial connection was established. I don't really see the point of doing that, though. Wasn't this what the notifications were all about ?

Guenter

#15 lore raw

Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399

Hi Guenter

Quoted 119 lines · Guenter Roeck
Quoted 100 lines · Chris Zhong

Hi Heiko

Quoted 87 lines · Heiko Stuebner

Am Donnerstag, 23. Juni 2016, 18:27:52 schrieb Kishon Vijay Abraham I:

Quoted 66 lines

Hi,

Quoted 63 lines · Chris Zhong

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB Type-C PHY is designed to support the USB3 and DP applications. The PHY basically has two main components: USB3 and DisplyPort. USB3 operates in SuperSpeed mode and the DP can operate at RBR, HBR and HBR2 data rates.

---

Changes in v3:
- remove the phy framework(Kishon Vijay Abraham I)
- add parentheses around the macro
- use a single space between type and name
- add spaces after opening and before closing braces.
- use u16 for register value
- remove type-c phy header file
- CodingStyle optimization
- use some cable extcon to get type-c port information
- add a extcon to notify Display Port

Changes in v2:
- select RESET_CONTROLLER
- alphabetic order
- modify some spelling mistakes
- make mode cleaner
- use bool for enable/disable
- check all of the return value
- return a better err number
- use more readx_poll_timeout()
- clk_disable_unprepare(tcphy->clk_ref);
- remove unuse functions, rockchip_typec_phy_power_on/off
- remove unnecessary typecast from void *
- use dts node to distinguish between phys.

Changes in v1:
- update the licence note
- init core clock to 50MHz
- use extcon API
- remove unused global
- add some comments for magic num
- change usleep_range(1000, 2000) tousleep_range(1000, 1050)
- remove __func__ from dev_err
- return err number when get clk failed
- remove ADDR_ADJ define
- use devm_clk_get(&pdev->dev, "tcpdcore")

   drivers/phy/Kconfig              |    8 +
   drivers/phy/Makefile             |    1 +
   drivers/phy/phy-rockchip-typec.c | 1027

++++++++++++++++++++++++++++++++++++++ 3 files changed, 1036 insertions(+)
create mode 100644 drivers/phy/phy-rockchip-typec.c

drivers/phy/Kconfig +0 -0
index 26566db..ec87b3a 100644
@@ -351,6 +351,14 @@ config PHY_ROCKCHIP_DP
 
         help
 
Quoted 8 lines

drivers/phy/Kconfig config PHY_ROCKCHIP_DP · line 357

Quoted 6 lines
drivers/phy/Kconfig +4 -0
           Enable this to support the Rockchip Display Port PHY.
 
+config PHY_ROCKCHIP_TYPEC
+       tristate "Rockchip TYPEC PHY Driver"
+       depends on ARCH_ROCKCHIP && OF
+       select GENERIC_PHY

Why? None of the generic PHY API's are used here. Why do you want select generic PHY?

I'm actually wondering, why there are no phy ops to start and stop the py. Right now the device seems to be on and handling all the extcon notifies all
the time even if no-one is using the phy.

There are two users of this phy, the dp-controller as well as some usb component. The phy framework is nicely refcounted, so can handle any number
of phy users and somehow I'd expect the phy to do nothing (and try to not consume power) if neither the dp-controller nor the usb-part is actually running.

Quoted 9 lines

It may very well be my ignorance, but Chris could you explain, if there is a
reason for this?

Thanks
Heiko

Quoted 8 lines

It is good idea, The USB3 and DP controller detect the extcon cable state:
USB/USB HOST/DP. If a Type-C device plugged, call phy power on, the phy driver get all the state of extcon: dfp, ufp, dp, flip, pin assignment, and then finish the phy init. So the phy driver need not register extcon notification.
But this mechanism allows phy driver only focus plug/unplug event, if some other things happen, such as data role change, the phy will not be notified. I'm not sure if this situation exists.

Sorry, I think I am lost (again).

All roles can change on the fly. Role changes can be triggered from user space, or by the remote partner. If we restrict such role changes, we would have to reject all locally triggered role change requests, as well as all role change requests from the remote, after the initial connection was established. I don't really see the point of doing that, though. Wasn't this what the notifications were all about ?

Quoted 2 lines

Guenter

The following are the all 3 cases about data role changing:

1. "USB host only" mode(power_count ==1), switch to "USB device" mode we can re-init phy by phy_power_off and then phy_power_on

2. "USB host + DP" mode(power_count ==2), switch to "USB device" mode The phy can not support ufp+dp, so it is reasonable to do nothing. Moreover, does this situation exist?

3. "USB device" mode (power_count ==1), switch to "USB host only" or "USB host + DP"
it is similar with case 1, dp or usb host can re-init the phy again.

Quoted 1 line
#2 lore raw

Re: [v3 PATCH 1/5] extcon: Add Type-C and DP support

In reply to Chris Zhong

Hi Chris,

I agree to add the new EXTCON_DISP_DP connector.
But, other new definition should be discussed.
- EXTCON_DISP_DP_ALT
- EXTCON_TYPEC_POLARITY
- EXTCON_TYPEC_PIN_ASSIGN

I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate as the new external connector definition. These are the property or attribute of USB connector with C-type.

Also, EXTCON_DISP_DP_ALT is not a new type of connector. It is just one of the mode for DP connector.

As I knew, DP alternative mode use the USB connector with C-type. So, DP alternative mode can be expressed on following:
= EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type

Thanks,
Chanwoo Choi

2016-06-23 21:51 GMT+09:00 Chris Zhong <[email protected]>:

Quoted 76 lines

Add EXTCON_DISP_DP and EXTCON_DISP_DP_ALT for the Display external connector. The EXTCON_DISP_DP is for DisplayPort, and the EXTCON_DISP_DP_ALT is the DisplayPort as an Alternate Mode for the USB Type-C connector (VESA DisplayPort Alt Mode on USB Type-C Standard).

And for the Type-C USB, there is some information need to be supplied by PowerDelivery or other mode detecter: port orientation and pin assignments, so add these 2 virtual cable: EXTCON_TYPEC_POLARITY and EXTCON_TYPEC_PIN_ASSIGN. If EXTCON_TYPEC_POLARITY is attached, the Type-C get flip orientation. IF EXTCON_TYPEC_PIN_ASSIGN is attached, Type-C get Pin_Assignment_C(for DP only mode) or Pin_Assignment_D(for DP alt mode), the default Assignment is A or B.

---

Changes in v3: None
Changes in v2: None
Changes in v1: None

 drivers/extcon/extcon.c | 6 ++++++
 include/linux/extcon.h  | 6 ++++++
 2 files changed, 12 insertions(+)
drivers/extcon/extcon.c +6 -0
index 21a123c..0522b4d 100644
@@ -53,6 +53,10 @@ static const char *extcon_name[] =  {
        [EXTCON_CHG_USB_FAST]           = "FAST-CHARGER",
        [EXTCON_CHG_USB_SLOW]           = "SLOW-CHARGER",
 
+       /* Type-c connector */
+       [EXTCON_TYPEC_POLARITY]         = "TYPE-C-POLARITY",
+       [EXTCON_TYPEC_PIN_ASSIGN]       = "TYPE-C-PIN-ASSIGN",
+
        /* Jack external connector */
        [EXTCON_JACK_MICROPHONE]        = "MICROPHONE",
        [EXTCON_JACK_HEADPHONE]         = "HEADPHONE",
@@ -68,6 +72,8 @@ static const char *extcon_name[] =  {
        [EXTCON_DISP_MHL]               = "MHL",
        [EXTCON_DISP_DVI]               = "DVI",
        [EXTCON_DISP_VGA]               = "VGA",
+       [EXTCON_DISP_DP]                = "DP",
+       [EXTCON_DISP_DP_ALT]            = "DP-ALT",
 
        /* Miscellaneous external connector */
        [EXTCON_DOCK]                   = "DOCK",
include/linux/extcon.h +6 -1
index 7abf674..98039ad 100644
@@ -45,6 +45,10 @@
 #define EXTCON_CHG_USB_FAST    9
 #define EXTCON_CHG_USB_SLOW    10
 
+/* Type-c connector */
+#define EXTCON_TYPEC_POLARITY  11      /* Typec-C plug orientation */
+#define EXTCON_TYPEC_PIN_ASSIGN        12      /* Typec-C pin Assignment */
+
 /* Jack external connector */
 #define EXTCON_JACK_MICROPHONE 20
 #define EXTCON_JACK_HEADPHONE  21
@@ -60,6 +64,8 @@
 #define EXTCON_DISP_MHL                41      /* Mobile High-Definition Link */
 #define EXTCON_DISP_DVI                42      /* Digital Visual Interface */
 #define EXTCON_DISP_VGA                43      /* Video Graphics Array */
+#define EXTCON_DISP_DP         44      /* Display Port */
+#define EXTCON_DISP_DP_ALT     45      /* Display Port Type-C Alternate Mode */
 
 /* Miscellaneous external connector */
 #define EXTCON_DOCK            60
--

2.6.3

#3 lore raw

Re: [v3 PATCH 1/5] extcon: Add Type-C and DP support

Quoted 12 lines · Chanwoo Choi

Hi Chris,

I agree to add the new EXTCON_DISP_DP connector.
But, other new definition should be discussed.
- EXTCON_DISP_DP_ALT
- EXTCON_TYPEC_POLARITY
- EXTCON_TYPEC_PIN_ASSIGN

I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate as the new external connector definition. These are the property or attribute of USB connector with C-type.

Quoted 7 lines

Also, EXTCON_DISP_DP_ALT is not a new type of connector. It is just one of the mode for DP connector.

As I knew, DP alternative mode use the USB connector with C-type. So, DP alternative mode can be expressed on following:
= EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type

Problem is that extcon doesn't support exchanging cable properties between cable providers (extcon drivers) and consumers, other than cable states. In order to exchange properties such as polarity and pin assignments, we would need a separate infrastructure. But then the question would be why to use extcon in the first place.

If you have a solution for that puzzle, please let us know.

Thanks,
Guenter

Quoted 80 lines

Thanks,
Chanwoo Choi

2016-06-23 21:51 GMT+09:00 Chris Zhong <[email protected]>:

Quoted 76 lines

Add EXTCON_DISP_DP and EXTCON_DISP_DP_ALT for the Display external connector. The EXTCON_DISP_DP is for DisplayPort, and the EXTCON_DISP_DP_ALT is the DisplayPort as an Alternate Mode for the USB Type-C connector (VESA DisplayPort Alt Mode on USB Type-C Standard).

And for the Type-C USB, there is some information need to be supplied by PowerDelivery or other mode detecter: port orientation and pin assignments, so add these 2 virtual cable: EXTCON_TYPEC_POLARITY and EXTCON_TYPEC_PIN_ASSIGN. If EXTCON_TYPEC_POLARITY is attached, the Type-C get flip orientation. IF EXTCON_TYPEC_PIN_ASSIGN is attached, Type-C get Pin_Assignment_C(for DP only mode) or Pin_Assignment_D(for DP alt mode), the default Assignment is A or B.

---

Changes in v3: None
Changes in v2: None
Changes in v1: None

 drivers/extcon/extcon.c | 6 ++++++
 include/linux/extcon.h  | 6 ++++++
 2 files changed, 12 insertions(+)
drivers/extcon/extcon.c +6 -0
index 21a123c..0522b4d 100644
@@ -53,6 +53,10 @@ static const char *extcon_name[] =  {
        [EXTCON_CHG_USB_FAST]           = "FAST-CHARGER",
        [EXTCON_CHG_USB_SLOW]           = "SLOW-CHARGER",
 
+       /* Type-c connector */
+       [EXTCON_TYPEC_POLARITY]         = "TYPE-C-POLARITY",
+       [EXTCON_TYPEC_PIN_ASSIGN]       = "TYPE-C-PIN-ASSIGN",
+
        /* Jack external connector */
        [EXTCON_JACK_MICROPHONE]        = "MICROPHONE",
        [EXTCON_JACK_HEADPHONE]         = "HEADPHONE",
@@ -68,6 +72,8 @@ static const char *extcon_name[] =  {
        [EXTCON_DISP_MHL]               = "MHL",
        [EXTCON_DISP_DVI]               = "DVI",
        [EXTCON_DISP_VGA]               = "VGA",
+       [EXTCON_DISP_DP]                = "DP",
+       [EXTCON_DISP_DP_ALT]            = "DP-ALT",
 
        /* Miscellaneous external connector */
        [EXTCON_DOCK]                   = "DOCK",
include/linux/extcon.h +6 -1
index 7abf674..98039ad 100644
@@ -45,6 +45,10 @@
 #define EXTCON_CHG_USB_FAST    9
 #define EXTCON_CHG_USB_SLOW    10
 
+/* Type-c connector */
+#define EXTCON_TYPEC_POLARITY  11      /* Typec-C plug orientation */
+#define EXTCON_TYPEC_PIN_ASSIGN        12      /* Typec-C pin Assignment */
+
 /* Jack external connector */
 #define EXTCON_JACK_MICROPHONE 20
 #define EXTCON_JACK_HEADPHONE  21
@@ -60,6 +64,8 @@
 #define EXTCON_DISP_MHL                41      /* Mobile High-Definition Link */
 #define EXTCON_DISP_DVI                42      /* Digital Visual Interface */
 #define EXTCON_DISP_VGA                43      /* Video Graphics Array */
+#define EXTCON_DISP_DP         44      /* Display Port */
+#define EXTCON_DISP_DP_ALT     45      /* Display Port Type-C Alternate Mode */
 
 /* Miscellaneous external connector */
 #define EXTCON_DOCK            60
--

2.6.3

#5 lore raw

Re: [v3 PATCH 1/5] extcon: Add Type-C and DP support

In reply to a message not in the archive
Quoted 41 lines · Chanwoo Choi

Hi Guenter,

2016년 6월 29일 수요일, Guenter Roeck<[email protected]>님이 작성한 메시지:

Quoted 23 lines · Chanwoo Choi
Quoted 13 lines

Hi Chris,

I agree to add the new EXTCON_DISP_DP connector.
But, other new definition should be discussed.
- EXTCON_DISP_DP_ALT
- EXTCON_TYPEC_POLARITY
- EXTCON_TYPEC_PIN_ASSIGN

I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate as the new external connector definition. These are the property or attribute of
USB connector with C-type.

Quoted 7 lines

Also, EXTCON_DISP_DP_ALT is not a new type of connector. It is just one of the mode for DP connector.

As I knew, DP alternative mode use the USB connector with C-type. So, DP alternative mode can be expressed on following:
= EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type

Quoted 8 lines

Problem is that extcon doesn't support exchanging cable properties between cable providers (extcon drivers) and consumers, other than cable states. In order to exchange properties such as polarity and pin assignments, we would need a separate infrastructure. But then the question would be why to use extcon in the first place.

If you have a solution for that puzzle, please let us know.

You're right.
Current extcon don't support the cable properties.
The requirement about cables properties occur such as USB ID and VBUS pin. So, I'll support the cable properties in extcon framework and send the patches within this week.

Quoted 7 lines

Maybe, the function definitions are following:
(But, these may be changed on real patches)
- extcon_set_cable_property(struct extcon_dev *edev, unsigned int id, enum extcon_property prop, unsigned in prop_val)
- extcon_get_cable_property(struct extcon_dev *edev, unsigned int id, enum extcon_property prop)

Excellent idea. Couple of thoughts:

- We might need notifiers for property events. Not sure if the state notifiers are sufficient (properties might change independently of state). Or maybe state events could be used if a cable property (but not the state) changes ?

- It might possibly make sense to make the prop argument opaque (such as u32). Properties would still be defined in extcon (such as EXTCON_PROP_TYPEC_POLARITY), but this would leave more room for cable type specific properties. After all, the properties would be cable type specific.

Thanks,
Guenter

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#6 lore raw

Re: [v3 PATCH 1/5] extcon: Add Type-C and DP support

In reply to a message not in the archive

Hi,

Quoted 32 lines · Chanwoo Choi

Hi Guenter,

2016년 6월 29일 수요일, Guenter Roeck<[email protected]>님이 작성한 메시지:

Quoted 29 lines · Chanwoo Choi
Quoted 13 lines

Hi Chris,

I agree to add the new EXTCON_DISP_DP connector.
But, other new definition should be discussed.
- EXTCON_DISP_DP_ALT
- EXTCON_TYPEC_POLARITY
- EXTCON_TYPEC_PIN_ASSIGN

I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate as the new external connector definition. These are the property or attribute of
USB connector with C-type.

Quoted 7 lines

Also, EXTCON_DISP_DP_ALT is not a new type of connector. It is just one of the mode for DP connector.

As I knew, DP alternative mode use the USB connector with C-type. So, DP alternative mode can be expressed on following:
= EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type

Problem is that extcon doesn't support exchanging cable properties between cable providers (extcon drivers) and consumers, other than cable states. In order to exchange properties such as polarity and pin assignments, we would need a separate infrastructure. But then the question would be why to use extcon in the first place.

Quoted 9 lines
Quoted 2 lines

If you have a solution for that puzzle, please let us know.

You're right.
Current extcon don't support the cable properties.
The requirement about cables properties occur such as USB ID and VBUS pin. So, I'll support the cable properties in extcon framework and send the patches within this week.

Did you have time to look into this ? Any idea if/when you will send the patches ?

Thanks,
Guenter

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#7 lore raw

Re: [v3 PATCH 1/5] extcon: Add Type-C and DP support

Hi Guenter,

2016-07-07 5:22 GMT+09:00 Guenter Roeck <[email protected]>:

Quoted 45 lines

Hi,

Quoted 32 lines · Chanwoo Choi

Hi Guenter,

2016년 6월 29일 수요일, Guenter Roeck<[email protected]>님이 작성한 메시지:

Quoted 29 lines · Chanwoo Choi
Quoted 13 lines

Hi Chris,

I agree to add the new EXTCON_DISP_DP connector.
But, other new definition should be discussed.
- EXTCON_DISP_DP_ALT
- EXTCON_TYPEC_POLARITY
- EXTCON_TYPEC_PIN_ASSIGN

I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate as the new external connector definition. These are the property or attribute of
USB connector with C-type.

Quoted 7 lines

Also, EXTCON_DISP_DP_ALT is not a new type of connector. It is just one of the mode for DP connector.

As I knew, DP alternative mode use the USB connector with C-type. So, DP alternative mode can be expressed on following:
= EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type

Problem is that extcon doesn't support exchanging cable properties between cable providers (extcon drivers) and consumers, other than cable states. In order to exchange properties such as polarity and pin assignments, we would need a separate infrastructure. But then the question would be why to use extcon in the first place.

Quoted 9 lines
Quoted 2 lines

If you have a solution for that puzzle, please let us know.

You're right.
Current extcon don't support the cable properties.
The requirement about cables properties occur such as USB ID and VBUS pin. So, I'll support the cable properties in extcon framework and send the patches within this week.

Quoted 2 lines

Did you have time to look into this ? Any idea if/when you will send the patches ?

Firstly, I'm sorry for late reply.

I'm developing the suggested idea on extcon-test branch[1]. But, I have not yet completed.
There are issues about compatibility of existing notifier of extcon.

It[1] is not final version. I need more time to make the well design for extcon property.

[1] https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/log/?h=extcon-test
- usb: dwc3: omap: Support the changed method to get the state of connector
- usb: chipdata: Support the changed method to get the state of connector
- extcon: Add the support for extcon property according to type of connector
- extcon: Add the extcon_type to group each connector into five category

Thanks,
Chanwoo Choi