Skip to content

Commit ec1fcd7

Browse files
Enric Balletbo i Serrakishon
authored andcommitted
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: c301b32 ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399") Reported-by: Vicente Bergas <[email protected]> Signed-off-by: Enric Balletbo i Serra <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Signed-off-by: Kishon Vijay Abraham I <[email protected]>
1 parent 21bf9bc commit ec1fcd7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,9 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
821821
u8 mode;
822822
int ret;
823823

824+
if (!edev)
825+
return MODE_DFP_USB;
826+
824827
ufp = extcon_get_state(edev, EXTCON_USB);
825828
dp = extcon_get_state(edev, EXTCON_DISP_DP);
826829

@@ -1159,9 +1162,13 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
11591162

11601163
tcphy->extcon = extcon_get_edev_by_phandle(dev, 0);
11611164
if (IS_ERR(tcphy->extcon)) {
1162-
if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
1163-
dev_err(dev, "Invalid or missing extcon\n");
1164-
return PTR_ERR(tcphy->extcon);
1165+
if (PTR_ERR(tcphy->extcon) == -ENODEV) {
1166+
tcphy->extcon = NULL;
1167+
} else {
1168+
if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
1169+
dev_err(dev, "Invalid or missing extcon\n");
1170+
return PTR_ERR(tcphy->extcon);
1171+
}
11651172
}
11661173

11671174
pm_runtime_enable(dev);

0 commit comments

Comments
 (0)