From 2142069a88ea13f98ffd55c5e87263c2e4e469e6 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Fri, 3 Jun 2016 18:43:08 -0700 Subject: [PATCH] usb: dwc3: Fix extcon notification for non-type-c usb cable In case of non-type-c usb cable extcon cable state for EXTCON_USB_CC returns error and driver bails out. This causes usb enumeration failure. Hence set the typec_orientation to ORIENTATION_NONE and continue with usb enumeration. In case of super speed mode with type-c usb cable even if extcon cable state return error for EXTCON_USB_CC then also usb device will get enumerated falling back to high speed mode. Change-Id: Ibc0b0506b2090f4c090d649f6e3ae7d42b102c93 Signed-off-by: Hemant Kumar --- drivers/usb/dwc3/dwc3-msm.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 13ba52ad7b62..f9c0b6a04224 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -2360,12 +2360,11 @@ static int dwc3_msm_id_notifier(struct notifier_block *nb, dev_dbg(mdwc->dev, "host:%ld (id:%d) event received\n", event, id); cc_state = extcon_get_cable_state_(edev, EXTCON_USB_CC); - if (cc_state < 0) { - dev_err(mdwc->dev, "%s: failed to get cc state\n", __func__); - goto done; - } - - mdwc->typec_orientation = cc_state ? ORIENTATION_CC2 : ORIENTATION_CC1; + if (cc_state < 0) + mdwc->typec_orientation = ORIENTATION_NONE; + else + mdwc->typec_orientation = + cc_state ? ORIENTATION_CC2 : ORIENTATION_CC1; dbg_event(0xFF, "cc_state", mdwc->typec_orientation); @@ -2398,12 +2397,11 @@ static int dwc3_msm_vbus_notifier(struct notifier_block *nb, return NOTIFY_DONE; cc_state = extcon_get_cable_state_(edev, EXTCON_USB_CC); - if (cc_state < 0) { - dev_err(mdwc->dev, "%s: failed to get cc state\n", __func__); - goto done; - } - - mdwc->typec_orientation = cc_state ? ORIENTATION_CC2 : ORIENTATION_CC1; + if (cc_state < 0) + mdwc->typec_orientation = ORIENTATION_NONE; + else + mdwc->typec_orientation = + cc_state ? ORIENTATION_CC2 : ORIENTATION_CC1; dbg_event(0xFF, "cc_state", mdwc->typec_orientation);