OSDN Git Service

qcom: smblib: supsend USB input during boost
authorHarry Yang <harryy@codeaurora.org>
Thu, 23 Mar 2017 05:45:25 +0000 (22:45 -0700)
committerHarry Yang <harryy@codeaurora.org>
Wed, 29 Mar 2017 21:52:01 +0000 (14:52 -0700)
In parallel configuration, suspend one charger usb input before the
other enters boost mode. Even more so in USBIN-USBIN mode.

Change-Id: I63728421b7697e70bbd83c4c82203b7ebafdaa9f
Signed-off-by: Harry Yang <harryy@codeaurora.org>
drivers/power/supply/qcom/smb-lib.c
drivers/power/supply/qcom/smb-lib.h

index 50af108..6dceff8 100644 (file)
@@ -1346,6 +1346,14 @@ int smblib_vbus_regulator_enable(struct regulator_dev *rdev)
        if (chg->otg_en)
                goto unlock;
 
+       if (!chg->usb_icl_votable) {
+               chg->usb_icl_votable = find_votable("USB_ICL");
+
+               if (!chg->usb_icl_votable)
+                       return -EINVAL;
+       }
+       vote(chg->usb_icl_votable, USBIN_USBIN_BOOST_VOTER, true, 0);
+
        rc = _smblib_vbus_regulator_enable(rdev);
        if (rc >= 0)
                chg->otg_en = true;
@@ -1409,6 +1417,8 @@ int smblib_vbus_regulator_disable(struct regulator_dev *rdev)
        if (rc >= 0)
                chg->otg_en = false;
 
+       if (chg->usb_icl_votable)
+               vote(chg->usb_icl_votable, USBIN_USBIN_BOOST_VOTER, false, 0);
 unlock:
        mutex_unlock(&chg->otg_oc_lock);
        return rc;
index 0645b60..edae5fc 100644 (file)
@@ -50,6 +50,7 @@ enum print_reason {
 #define VBUS_CC_SHORT_VOTER            "VBUS_CC_SHORT_VOTER"
 #define PD_INACTIVE_VOTER              "PD_INACTIVE_VOTER"
 #define BOOST_BACK_VOTER               "BOOST_BACK_VOTER"
+#define USBIN_USBIN_BOOST_VOTER                "USBIN_USBIN_BOOST_VOTER"
 #define HVDCP_INDIRECT_VOTER           "HVDCP_INDIRECT_VOTER"
 #define MICRO_USB_VOTER                        "MICRO_USB_VOTER"
 #define DEBUG_BOARD_VOTER              "DEBUG_BOARD_VOTER"