EM/Charger: Fix the VBUS disconnect after 30s issue on CLV
authorPandey Raj <raj.pandey@intel.com>
Mon, 21 May 2012 11:45:43 +0000 (17:15 +0530)
committerbuildbot <buildbot@intel.com>
Wed, 30 May 2012 16:09:11 +0000 (09:09 -0700)
BZ: 34940

This patch fixes the VBUS disconnect issue on CLV platform by disabling the
WD timer as soon as host mode cable is inserted to the platform. This issue
happens only if the user connects the host mode cable before the charger cable.

Change-Id: I26c97af48bf366a2132f80e6cebc8acb92c9a480
Signed-off-by: Pandey Raj <raj.pandey@intel.com>
Reviewed-on: http://android.intel.com:8080/49524
Reviewed-by: Hegde Kota, VinayX <vinayx.hegde.kota@intel.com>
Reviewed-by: Wu, Hao <hao.wu@intel.com>
Reviewed-by: Tc, Jenny <jenny.tc@intel.com>
Reviewed-by: Prasad, Lakshmi G <lakshmi.g.prasad@intel.com>
Reviewed-by: Meng, Zhe <zhe.meng@intel.com>
Tested-by: Meng, Zhe <zhe.meng@intel.com>
Tested-by: Kallappa Manjanna, MadhukumarX <madhukumarx.kallappa.manjanna@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/power/bq24192_charger.c

index fe2a168..f3ecd75 100644 (file)
@@ -1463,6 +1463,21 @@ static int turn_otg_vbus(struct bq24192_chip *chip, bool votg_on)
        int ret = 0;
 
        if (votg_on) {
+                       /*
+                        * Disable WD timer to make sure the WD timer doesn't
+                        * expire and put the charger chip into default state
+                        * which will bring down the VBUS. The issue will arise
+                        * only when the host mode cable is plugged in before
+                        * USB charging cable (SDP/DCP/CDP/ACA).
+                        */
+                       ret = program_wdt_timer(chip,
+                                       CHRG_TIMER_EXP_CNTL_WDTDISABLE);
+                       if (ret < 0) {
+                               dev_warn(&chip->client->dev,
+                                       "I2C write failed:%s\n", __func__);
+                               goto i2c_write_fail;
+                       }
+
                        /* Configure the charger in OTG mode */
                        ret = bq24192_reg_read_modify(chip->client,
                                        BQ24192_POWER_ON_CFG_REG,