Thread (17 messages) 17 messages, 5 authors, 2016-06-27

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

From: Guenter Roeck <hidden>
Date: 2016-06-23 21:47:22
Also in: linux-rockchip, lkml

Hi Chris,

On Thu, Jun 23, 2016 at 5:51 AM, Chris Zhong [off-list ref] wrote:
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.

Signed-off-by: Chris Zhong <redacted>
Signed-off-by: Kever Yang <redacted>
[ ... ]
+
+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) {
+               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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help