summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorNicholas Troast <ntroast@codeaurora.org>2017-02-17 11:51:32 -0800
committerNicholas Troast <ntroast@codeaurora.org>2017-02-22 14:25:34 -0800
commitaecaaa7d1c02f94dcd599bbd44f58ed310f8f4a7 (patch)
tree3dc58aeadd4db12734540820587eb3bab84727ce /drivers/power
parentd72462d943ee499ac17a485bdacca60c0db31c04 (diff)
supply: qcom: battery: re-split FCC when ICL changes
Currently the notifier does not respond to main psy changed events, so changes in ICL will not schedule the status change work. Furthermore, the status change work does not re-run the FCC splitting which is dependent on the settled ICL. First, add the main psy as one of the triggers for the status changed work. Second, re-run the FCC and FV voteable elections to re-split the FCC based on the new ICL. Change-Id: I1f5f2e176ec470c9c71ff4a0787ffa0cc5828ebc Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/qcom/battery.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/power/supply/qcom/battery.c b/drivers/power/supply/qcom/battery.c
index 4039b4312e93..4973f91c8af1 100644
--- a/drivers/power/supply/qcom/battery.c
+++ b/drivers/power/supply/qcom/battery.c
@@ -635,14 +635,16 @@ static void handle_main_charge_type(struct pl_data *chip)
}
#define MIN_ICL_CHANGE_DELTA_UA 300000
-static void handle_settled_aicl_split(struct pl_data *chip)
+static void handle_settled_icl_change(struct pl_data *chip)
{
union power_supply_propval pval = {0, };
int rc;
- if (!get_effective_result(chip->pl_disable_votable)
- && (chip->pl_mode == POWER_SUPPLY_PL_USBIN_USBIN
- || chip->pl_mode == POWER_SUPPLY_PL_USBIN_USBIN_EXT)) {
+ if (get_effective_result(chip->pl_disable_votable))
+ return;
+
+ if (chip->pl_mode == POWER_SUPPLY_PL_USBIN_USBIN
+ || chip->pl_mode == POWER_SUPPLY_PL_USBIN_USBIN_EXT) {
/*
* call aicl split only when USBIN_USBIN and enabled
* and if aicl changed
@@ -659,6 +661,8 @@ static void handle_settled_aicl_split(struct pl_data *chip)
if (abs((chip->main_settled_ua - chip->pl_settled_ua)
- pval.intval) > MIN_ICL_CHANGE_DELTA_UA)
split_settled(chip);
+ } else {
+ rerun_election(chip->fcc_votable);
}
}
@@ -705,7 +709,7 @@ static void status_change_work(struct work_struct *work)
is_parallel_available(chip);
handle_main_charge_type(chip);
- handle_settled_aicl_split(chip);
+ handle_settled_icl_change(chip);
handle_parallel_in_taper(chip);
}
@@ -719,7 +723,8 @@ static int pl_notifier_call(struct notifier_block *nb,
return NOTIFY_OK;
if ((strcmp(psy->desc->name, "parallel") == 0)
- || (strcmp(psy->desc->name, "battery") == 0))
+ || (strcmp(psy->desc->name, "battery") == 0)
+ || (strcmp(psy->desc->name, "main") == 0))
schedule_work(&chip->status_change_work);
return NOTIFY_OK;