usb: fix charger detect timing
authorlyz <lyz@rock-chips.com>
Wed, 26 Mar 2014 09:40:51 +0000 (17:40 +0800)
committerlyz <lyz@rock-chips.com>
Fri, 28 Mar 2014 03:37:34 +0000 (11:37 +0800)
drivers/usb/dwc_otg_310/usbdev_bc.c

index d08d894336c35988f2e9a2f064ffbf6532b38db8..d108867fa4218e1ae9c9a1bafab2156b2eac8480 100755 (executable)
@@ -146,7 +146,7 @@ int usb_battery_charger_detect_synop(bool wait)
         BC_SET(SYNOP_BC_VDATDETENB, 1);
         BC_SET(SYNOP_BC_CHRGSEL, 0);
 
-        timeout = T_BC_WAIT_CHGDET;
+        timeout = wait ? T_BC_WAIT_CHGDET : 1;
         while(timeout--) {
             if(BC_GET(SYNOP_BC_CHGDET))
                 break;
@@ -159,7 +159,7 @@ int usb_battery_charger_detect_synop(bool wait)
             BC_SET(SYNOP_BC_VDATSRCENB, 0);
             BC_SET(SYNOP_BC_VDATDETENB, 0);
 
-            timeout = T_BC_SRC_OFF;
+            timeout = wait ? T_BC_SRC_OFF : 1;
             while(timeout--) {
                 if(!BC_GET(SYNOP_BC_CHGDET))
                     break;
@@ -170,7 +170,7 @@ int usb_battery_charger_detect_synop(bool wait)
             BC_SET(SYNOP_BC_VDATSRCENB, 1);
             BC_SET(SYNOP_BC_VDATDETENB, 1);
             BC_SET(SYNOP_BC_CHRGSEL, 1);
-
+            udelay(200);
             if(BC_GET(SYNOP_BC_CHGDET))
                 port_type = USB_BC_TYPE_DCP;
             else
@@ -184,7 +184,7 @@ int usb_battery_charger_detect_synop(bool wait)
 
     }
 
-    //printk("%s , battery_charger_detect %d\n", __func__, port_type);
+    printk("%s , battery_charger_detect %d\n", __func__, port_type);
     return port_type;
 }