From 978e10ffd82a44ef1f0a86476ec6a89aedc01483 Mon Sep 17 00:00:00 2001 From: Meng Dongyang Date: Thu, 18 Aug 2016 11:45:01 +0800 Subject: [PATCH] phy: phy-rockchip-typec: support Type-C phy work without extcon 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 --- drivers/phy/phy-rockchip-typec.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/phy/phy-rockchip-typec.c b/drivers/phy/phy-rockchip-typec.c index 420cd13bcb7c..1ce45773948b 100644 --- a/drivers/phy/phy-rockchip-typec.c +++ b/drivers/phy/phy-rockchip-typec.c @@ -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); -- 2.34.1