temp = udc_readl(udc, USB_CMD_REG_OFFSET);
temp &= ~USB_CMD_ITC;
temp |= USB_CMD_ITC_1_MICRO_FRM;
- if (can_pullup(udc))
+ if (can_pullup(udc)) {
temp |= USB_CMD_RUN_STOP;
+ if (udc->connect_type == CONNECT_TYPE_SDP)
+ schedule_delayed_work(&udc->non_std_charger_work,
+ msecs_to_jiffies(NON_STD_CHARGER_DET_TIME_MS));
+ }
else
temp &= ~USB_CMD_RUN_STOP;
udc_writel(udc, temp, USB_CMD_REG_OFFSET);
if ((udc->connect_type == CONNECT_TYPE_SDP) ||
(udc->connect_type == CONNECT_TYPE_CDP))
dr_controller_run(udc);
-
- /*
- * We cannot tell difference between a SDP and non-standard
- * charger (which has D+/D- line floating) based on line status.
- * Schedule a 7sec delayed work and verify it is an
- * non-standard charger if no setup packet is received.
- */
- if (udc->connect_type == CONNECT_TYPE_SDP)
- schedule_delayed_work(&udc->non_std_charger_work,
- msecs_to_jiffies(NON_STD_CHARGER_DET_TIME_MS));
}
mutex_unlock(&udc->sync_lock);
tmp = udc_readl(udc, USB_CMD_REG_OFFSET);
tmp &= ~USB_CMD_ITC;
tmp |= USB_CMD_ITC_1_MICRO_FRM;
- if (can_pullup(udc))
+ if (can_pullup(udc)) {
udc_writel(udc, tmp | USB_CMD_RUN_STOP, USB_CMD_REG_OFFSET);
- else
+ /*
+ * We cannot tell difference between a SDP and non-standard
+ * charger (which has D+/D- line floating) based on line status
+ * at the time VBUS is detected.
+ *
+ * We can schedule a 4s delayed work and verify it is an
+ * non-standard charger if no setup packet is received after
+ * enumeration started.
+ */
+ if (udc->connect_type == CONNECT_TYPE_SDP)
+ schedule_delayed_work(&udc->non_std_charger_work,
+ msecs_to_jiffies(NON_STD_CHARGER_DET_TIME_MS));
+ } else
udc_writel(udc, (tmp & ~USB_CMD_RUN_STOP), USB_CMD_REG_OFFSET);
DBG("%s(%d) END\n", __func__, __LINE__);
#define USB_CHARGING_NV_CHARGER_CURRENT_LIMIT_UA 2000000u
#define USB_CHARGING_NON_STANDARD_CHARGER_CURRENT_LIMIT_UA 500000u
- /* 7 sec wait time for non-std charger detection after vbus is detected */
-#define NON_STD_CHARGER_DET_TIME_MS 7000
+ /* 1 sec wait time for non-std charger detection after vbus is detected */
+#define NON_STD_CHARGER_DET_TIME_MS 1000
#define BOOST_TRIGGER_SIZE 4096
#define UDC_RESET_TIMEOUT_MS 1000