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 <hemantk@codeaurora.org>
This commit is contained in:
Hemant Kumar 2016-06-03 18:43:08 -07:00 committed by Kyle Yan
parent aab29b0769
commit 2142069a88

View file

@ -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);