OSDN Git Service

qcom: smb-lib: disable VCONN operations for micro USB mode
authorAshay Jaiswal <ashayj@codeaurora.org>
Fri, 31 Mar 2017 17:59:58 +0000 (23:29 +0530)
committerAshay Jaiswal <ashayj@codeaurora.org>
Tue, 4 Apr 2017 05:28:52 +0000 (10:58 +0530)
VCONN is not supported in micro USB mode, thus disable
registration and operations on VCONN regulator.

While at it, disable TRY.SOURCE while disabling typeC.

CRs-Fixed: 2027962
Change-Id: Ib92564160c48f52d77815b646b4cdd5c7d23e7b3
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
drivers/power/supply/qcom/qpnp-smb2.c
drivers/power/supply/qcom/smb-lib.c

index e824916..b4fb80a 100644 (file)
@@ -1133,6 +1133,9 @@ static int smb2_init_vconn_regulator(struct smb2 *chip)
        struct regulator_config cfg = {};
        int rc = 0;
 
+       if (chg->micro_usb_mode)
+               return 0;
+
        chg->vconn_vreg = devm_kzalloc(chg->dev, sizeof(*chg->vconn_vreg),
                                      GFP_KERNEL);
        if (!chg->vconn_vreg)
@@ -1344,9 +1347,10 @@ static int smb2_disable_typec(struct smb_charger *chg)
        int rc;
 
        /* Move to typeC mode */
-       /* configure FSM in idle state */
+       /* configure FSM in idle state and disable UFP_ENABLE bit */
        rc = smblib_masked_write(chg, TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG,
-                       TYPEC_DISABLE_CMD_BIT, TYPEC_DISABLE_CMD_BIT);
+                       TYPEC_DISABLE_CMD_BIT | UFP_EN_CMD_BIT,
+                       TYPEC_DISABLE_CMD_BIT);
        if (rc < 0) {
                dev_err(chg->dev, "Couldn't put FSM in idle rc=%d\n", rc);
                return rc;
@@ -2131,7 +2135,7 @@ static int smb2_probe(struct platform_device *pdev)
        rc = smb2_init_vconn_regulator(chip);
        if (rc < 0) {
                pr_err("Couldn't initialize vconn regulator rc=%d\n",
-                       rc);
+                               rc);
                goto cleanup;
        }
 
index 51c87f9..c74b310 100644 (file)
@@ -4117,6 +4117,9 @@ static void smblib_vconn_oc_work(struct work_struct *work)
        int rc, i;
        u8 stat;
 
+       if (chg->micro_usb_mode)
+               return;
+
        smblib_err(chg, "over-current detected on VCONN\n");
        if (!chg->vconn_vreg || !chg->vconn_vreg->rdev)
                return;