Loading drivers/power/supply/qcom/battery.c +88 −26 Original line number Diff line number Diff line Loading @@ -150,12 +150,22 @@ static void split_settled(struct pl_data *chip) total_current_ua = pval.intval; } /* * If there is an increase in slave share * (Also handles parallel enable case) * Set Main ICL then slave ICL * else * (Also handles parallel disable case) * Set slave ICL then main ICL. */ if (slave_ua > chip->pl_settled_ua) { pval.intval = total_current_ua - slave_ua; /* Set ICL on main charger */ rc = power_supply_set_property(chip->main_psy, POWER_SUPPLY_PROP_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't change slave suspend state rc=%d\n", rc); pr_err("Couldn't change slave suspend state rc=%d\n", rc); return; } Loading @@ -167,6 +177,26 @@ static void split_settled(struct pl_data *chip) pr_err("Couldn't set parallel icl, rc=%d\n", rc); return; } } else { /* set parallel's ICL could be 0mA when pl is disabled */ pval.intval = slave_ua; rc = power_supply_set_property(chip->pl_psy, POWER_SUPPLY_PROP_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't set parallel icl, rc=%d\n", rc); return; } pval.intval = total_current_ua - slave_ua; /* Set ICL on main charger */ rc = power_supply_set_property(chip->main_psy, POWER_SUPPLY_PROP_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't change slave suspend state rc=%d\n", rc); return; } } chip->total_settled_ua = total_settled_ua; chip->pl_settled_ua = slave_ua; Loading Loading @@ -626,8 +656,15 @@ static int pl_disable_vote_callback(struct votable *votable, get_fcc_split(chip, total_fcc_ua, &master_fcc_ua, &slave_fcc_ua); chip->slave_fcc_ua = slave_fcc_ua; /* * If there is an increase in slave share * (Also handles parallel enable case) * Set Main ICL then slave FCC * else * (Also handles parallel disable case) * Set slave ICL then main FCC. */ if (slave_fcc_ua > chip->slave_fcc_ua) { pval.intval = master_fcc_ua; rc = power_supply_set_property(chip->main_psy, POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, Loading @@ -642,10 +679,35 @@ static int pl_disable_vote_callback(struct votable *votable, POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't set parallel fcc, rc=%d\n", rc); pr_err("Couldn't set parallel fcc, rc=%d\n", rc); return rc; } chip->slave_fcc_ua = slave_fcc_ua; } else { pval.intval = slave_fcc_ua; rc = power_supply_set_property(chip->pl_psy, POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't set parallel fcc, rc=%d\n", rc); return rc; } chip->slave_fcc_ua = slave_fcc_ua; pval.intval = master_fcc_ua; rc = power_supply_set_property(chip->main_psy, POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Could not set main fcc, rc=%d\n", rc); return rc; } } /* * Enable will be called with a valid pl_psy always. The * PARALLEL_PSY_VOTER keeps it disabled unless a pl_psy Loading Loading
drivers/power/supply/qcom/battery.c +88 −26 Original line number Diff line number Diff line Loading @@ -150,12 +150,22 @@ static void split_settled(struct pl_data *chip) total_current_ua = pval.intval; } /* * If there is an increase in slave share * (Also handles parallel enable case) * Set Main ICL then slave ICL * else * (Also handles parallel disable case) * Set slave ICL then main ICL. */ if (slave_ua > chip->pl_settled_ua) { pval.intval = total_current_ua - slave_ua; /* Set ICL on main charger */ rc = power_supply_set_property(chip->main_psy, POWER_SUPPLY_PROP_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't change slave suspend state rc=%d\n", rc); pr_err("Couldn't change slave suspend state rc=%d\n", rc); return; } Loading @@ -167,6 +177,26 @@ static void split_settled(struct pl_data *chip) pr_err("Couldn't set parallel icl, rc=%d\n", rc); return; } } else { /* set parallel's ICL could be 0mA when pl is disabled */ pval.intval = slave_ua; rc = power_supply_set_property(chip->pl_psy, POWER_SUPPLY_PROP_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't set parallel icl, rc=%d\n", rc); return; } pval.intval = total_current_ua - slave_ua; /* Set ICL on main charger */ rc = power_supply_set_property(chip->main_psy, POWER_SUPPLY_PROP_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't change slave suspend state rc=%d\n", rc); return; } } chip->total_settled_ua = total_settled_ua; chip->pl_settled_ua = slave_ua; Loading Loading @@ -626,8 +656,15 @@ static int pl_disable_vote_callback(struct votable *votable, get_fcc_split(chip, total_fcc_ua, &master_fcc_ua, &slave_fcc_ua); chip->slave_fcc_ua = slave_fcc_ua; /* * If there is an increase in slave share * (Also handles parallel enable case) * Set Main ICL then slave FCC * else * (Also handles parallel disable case) * Set slave ICL then main FCC. */ if (slave_fcc_ua > chip->slave_fcc_ua) { pval.intval = master_fcc_ua; rc = power_supply_set_property(chip->main_psy, POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, Loading @@ -642,10 +679,35 @@ static int pl_disable_vote_callback(struct votable *votable, POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't set parallel fcc, rc=%d\n", rc); pr_err("Couldn't set parallel fcc, rc=%d\n", rc); return rc; } chip->slave_fcc_ua = slave_fcc_ua; } else { pval.intval = slave_fcc_ua; rc = power_supply_set_property(chip->pl_psy, POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Couldn't set parallel fcc, rc=%d\n", rc); return rc; } chip->slave_fcc_ua = slave_fcc_ua; pval.intval = master_fcc_ua; rc = power_supply_set_property(chip->main_psy, POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, &pval); if (rc < 0) { pr_err("Could not set main fcc, rc=%d\n", rc); return rc; } } /* * Enable will be called with a valid pl_psy always. The * PARALLEL_PSY_VOTER keeps it disabled unless a pl_psy Loading