aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchoongryeol.lee <choongryeol.lee@lge.com>2015-09-24 21:43:14 -0700
committerchoongryeol.lee <choongryeol.lee@lge.com>2015-09-25 09:41:57 -0700
commitea58e700dc91389d9822cf53c5392a553a6f0cb7 (patch)
tree44094a832fe0b37d6a1264cb07c136c4ca0b020f
parent86f8f5c14ae7259b5b59bde406405d99bb8bd359 (diff)
power: qpnp-smbcharger: update iusb only at beginning of chargingandroid-6.0.0_r0.8
Since AICL result cannot be larger than maximum input current setting, do not update maximum input current again when it is already determined. If not, maximum input current could be lower by a short input voltage drop and the AICL result never goes back to the higher value. Bug: 24372404 Change-Id: I20ef13f621d6b8cb95729f9d582639f7f6ab4b35 Signed-off-by: choongryeol.lee <choongryeol.lee@lge.com>
-rw-r--r--drivers/power/qpnp-smbcharger.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/power/qpnp-smbcharger.c b/drivers/power/qpnp-smbcharger.c
index 571493efdddf..0df90ccb668b 100644
--- a/drivers/power/qpnp-smbcharger.c
+++ b/drivers/power/qpnp-smbcharger.c
@@ -245,6 +245,7 @@ struct smbchg_chip {
int parallel_ibat_ma;
struct completion aicl_rerun_done;
bool disable_parallel_check;
+ bool iusb_update_done;
};
enum print_reason {
@@ -1663,6 +1664,7 @@ static void smbchg_parallel_usb_disable(struct smbchg_chip *chip)
taper_irq_en(chip, false);
chip->parallel.initial_aicl_ma = 0;
chip->parallel.current_max_ma = 0;
+ chip->iusb_update_done = true;
power_supply_set_current_limit(parallel_psy,
SUSPEND_CURRENT_MA * 1000);
power_supply_set_present(parallel_psy, false);
@@ -1917,6 +1919,7 @@ static void smbchg_parallel_usb_en_work(struct work_struct *work)
pr_smb(PR_STATUS, "parallel charging unavailable\n");
smbchg_parallel_usb_disable(chip);
}
+ chip->iusb_update_done = true;
mutex_unlock(&chip->parallel.lock);
}
@@ -1937,6 +1940,8 @@ static void smbchg_parallel_usb_check_ok(struct smbchg_chip *chip)
} else if (chip->parallel.current_max_ma != 0) {
pr_smb(PR_STATUS, "parallel charging unavailable\n");
smbchg_parallel_usb_disable(chip);
+ } else {
+ chip->iusb_update_done = true;
}
mutex_unlock(&chip->parallel.lock);
}
@@ -3178,8 +3183,10 @@ static void smbchg_external_power_changed(struct power_supply *psy)
if (rc < 0)
dev_err(chip->dev,
"Couldn't set usb current rc = %d\n", rc);
- if (chip->usb_cc_controller && current_limit > 0)
+ if (chip->usb_cc_controller && current_limit > 0) {
+ chip->iusb_update_done = false;
smbchg_wait_first_aicl_done(chip);
+ }
smbchg_parallel_usb_check_ok(chip);
}
mutex_unlock(&chip->current_change_lock);
@@ -4787,7 +4794,8 @@ static irqreturn_t aicl_done_handler(int irq, void *_chip)
if (chip->aicl_complete)
complete_all(&chip->aicl_rerun_done);
- if (chip->usb_cc_controller && !chip->parallel.initial_aicl_ma)
+ if (chip->usb_cc_controller && !chip->parallel.initial_aicl_ma
+ && !chip->iusb_update_done)
smbchg_update_input_max(chip);
if (usb_present)