@@ -153,14 +153,15 @@ static int cht_wc_extcon_get_charger(struct cht_wc_extcon_data *ext,
} while (time_before(jiffies, timeout));
if (status != CHT_WC_USBSRC_STS_SUCCESS) {
- if (ignore_errors)
- return EXTCON_CHG_USB_SDP; /* Save fallback */
+ if (!ignore_errors) {
+ if (status == CHT_WC_USBSRC_STS_FAIL)
+ dev_warn(ext->dev, "Could not detect charger type\n");
+ else
+ dev_warn(ext->dev, "Timeout detecting charger type\n");
+ }
- if (status == CHT_WC_USBSRC_STS_FAIL)
- dev_warn(ext->dev, "Could not detect charger type\n");
- else
- dev_warn(ext->dev, "Timeout detecting charger type\n");
- return EXTCON_CHG_USB_SDP; /* Save fallback */
+ /* Safe fallback */
+ usbsrc = CHT_WC_USBSRC_TYPE_SDP << CHT_WC_USBSRC_TYPE_SHIFT;
}
usbsrc = (usbsrc & CHT_WC_USBSRC_TYPE_MASK) >> CHT_WC_USBSRC_TYPE_SHIFT;