Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: rockchip-typec: fall back to working in host-mode if extcon is missing.

Right now the rockchip type-c phy does fail probing when no extcon is
detected. Some boards get the cable-state via the extcon interface and
have this supported, other boards seem to use the fusb302 chip or
another but the driver currently does not seem to utilize the extcon
interface to report the cable-state. And, other, just connect the type-c
to a standard USB-A port so use no controller at all. A missing extcon
shouldn't fail to probe, instead, should just fall back to working in
host-mode if it cannot get the extcon.

Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399")
Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Enric Balletbo i Serra and committed by
Kishon Vijay Abraham I
ec1fcd7b 21bf9bc2

+10 -3
+10 -3
drivers/phy/rockchip/phy-rockchip-typec.c
··· 821 821 u8 mode; 822 822 int ret; 823 823 824 + if (!edev) 825 + return MODE_DFP_USB; 826 + 824 827 ufp = extcon_get_state(edev, EXTCON_USB); 825 828 dp = extcon_get_state(edev, EXTCON_DISP_DP); 826 829 ··· 1162 1159 1163 1160 tcphy->extcon = extcon_get_edev_by_phandle(dev, 0); 1164 1161 if (IS_ERR(tcphy->extcon)) { 1165 - if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER) 1166 - dev_err(dev, "Invalid or missing extcon\n"); 1167 - return PTR_ERR(tcphy->extcon); 1162 + if (PTR_ERR(tcphy->extcon) == -ENODEV) { 1163 + tcphy->extcon = NULL; 1164 + } else { 1165 + if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER) 1166 + dev_err(dev, "Invalid or missing extcon\n"); 1167 + return PTR_ERR(tcphy->extcon); 1168 + } 1168 1169 } 1169 1170 1170 1171 pm_runtime_enable(dev);