phy: phy-rockchip-typec: support Type-C phy work without extcon
authorMeng Dongyang <daniel.meng@rock-chips.com>
Thu, 18 Aug 2016 03:45:01 +0000 (11:45 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 12 Sep 2016 03:31:31 +0000 (11:31 +0800)
There is a Standard-A receptacle on the rk3399 box platform with
Type-C phy, which does not have an extern Type-C controller
(e.g. FUSB302), this result in failure when typec probe, this patch
add support without extcon for usb3.0, support of dp is not included
in this patch.

Change-Id: I1af87d311707a5d385017e10478f992d940000b8
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
drivers/phy/phy-rockchip-typec.c

index 420cd13bcb7cc5d461d1d873c2223d4c04161800..1ce45773948b3f2aa6003b25110884bafe86be2a 100644 (file)
@@ -602,6 +602,13 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
        u8 mode;
        int ret;
 
+       if (!edev) {
+               mode = MODE_DFP_USB;
+               id = EXTCON_USB_HOST;
+               tcphy->flip = 0;
+               return mode;
+       }
+
        ufp = extcon_get_state(edev, EXTCON_USB);
        dfp = extcon_get_state(edev, EXTCON_USB_HOST);
        dp = extcon_get_state(edev, EXTCON_DISP_DP);
@@ -950,11 +957,13 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
 
        typec_phy_pre_init(tcphy);
 
-       tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
-       if (IS_ERR(tcphy->extcon)) {
-               if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
-                       dev_err(dev, "Invalid or missing extcon\n");
-               return PTR_ERR(tcphy->extcon);
+       if (device_property_read_bool(dev, "extcon")) {
+               tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
+               if (IS_ERR(tcphy->extcon)) {
+                       if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
+                               dev_err(dev, "Invalid or missing extcon\n");
+                       return PTR_ERR(tcphy->extcon);
+               }
        }
 
        tcphy->phy[0] = devm_phy_create(dev, NULL, &rockchip_dp_phy_ops);