Loading drivers/power/supply/qcom/battery.c +37 −11 Original line number Original line Diff line number Diff line Loading @@ -98,6 +98,7 @@ struct pl_data { int fcc_step_delay_ms; int fcc_step_delay_ms; /* debugfs directory */ /* debugfs directory */ struct dentry *dfs_root; struct dentry *dfs_root; u32 float_voltage_uv; }; }; struct pl_data *the_chip; struct pl_data *the_chip; Loading Loading @@ -982,6 +983,17 @@ static void fcc_stepper_work(struct work_struct *work) vote(chip->pl_awake_votable, FCC_STEPPER_VOTER, false, 0); vote(chip->pl_awake_votable, FCC_STEPPER_VOTER, false, 0); } } static bool is_batt_available(struct pl_data *chip) { if (!chip->batt_psy) chip->batt_psy = power_supply_get_by_name("battery"); if (!chip->batt_psy) return false; return true; } #define PARALLEL_FLOAT_VOLTAGE_DELTA_UV 50000 #define PARALLEL_FLOAT_VOLTAGE_DELTA_UV 50000 static int pl_fv_vote_callback(struct votable *votable, void *data, static int pl_fv_vote_callback(struct votable *votable, void *data, int fv_uv, const char *client) int fv_uv, const char *client) Loading Loading @@ -1015,6 +1027,31 @@ static int pl_fv_vote_callback(struct votable *votable, void *data, } } } } /* * check for termination at reduced float voltage and re-trigger * charging if new float voltage is above last FV. */ if ((chip->float_voltage_uv < fv_uv) && is_batt_available(chip)) { rc = power_supply_get_property(chip->batt_psy, POWER_SUPPLY_PROP_STATUS, &pval); if (rc < 0) { pr_err("Couldn't get battery status rc=%d\n", rc); } else { if (pval.intval == POWER_SUPPLY_STATUS_FULL) { pr_debug("re-triggering charging\n"); pval.intval = 1; rc = power_supply_set_property(chip->batt_psy, POWER_SUPPLY_PROP_FORCE_RECHARGE, &pval); if (rc < 0) pr_err("Couldn't set force recharge rc=%d\n", rc); } } } chip->float_voltage_uv = fv_uv; return 0; return 0; } } Loading Loading @@ -1107,17 +1144,6 @@ static void pl_disable_forever_work(struct work_struct *work) vote(chip->hvdcp_hw_inov_dis_votable, PL_VOTER, false, 0); vote(chip->hvdcp_hw_inov_dis_votable, PL_VOTER, false, 0); } } static bool is_batt_available(struct pl_data *chip) { if (!chip->batt_psy) chip->batt_psy = power_supply_get_by_name("battery"); if (!chip->batt_psy) return false; return true; } static int pl_disable_vote_callback(struct votable *votable, static int pl_disable_vote_callback(struct votable *votable, void *data, int pl_disable, const char *client) void *data, int pl_disable, const char *client) { { Loading Loading
drivers/power/supply/qcom/battery.c +37 −11 Original line number Original line Diff line number Diff line Loading @@ -98,6 +98,7 @@ struct pl_data { int fcc_step_delay_ms; int fcc_step_delay_ms; /* debugfs directory */ /* debugfs directory */ struct dentry *dfs_root; struct dentry *dfs_root; u32 float_voltage_uv; }; }; struct pl_data *the_chip; struct pl_data *the_chip; Loading Loading @@ -982,6 +983,17 @@ static void fcc_stepper_work(struct work_struct *work) vote(chip->pl_awake_votable, FCC_STEPPER_VOTER, false, 0); vote(chip->pl_awake_votable, FCC_STEPPER_VOTER, false, 0); } } static bool is_batt_available(struct pl_data *chip) { if (!chip->batt_psy) chip->batt_psy = power_supply_get_by_name("battery"); if (!chip->batt_psy) return false; return true; } #define PARALLEL_FLOAT_VOLTAGE_DELTA_UV 50000 #define PARALLEL_FLOAT_VOLTAGE_DELTA_UV 50000 static int pl_fv_vote_callback(struct votable *votable, void *data, static int pl_fv_vote_callback(struct votable *votable, void *data, int fv_uv, const char *client) int fv_uv, const char *client) Loading Loading @@ -1015,6 +1027,31 @@ static int pl_fv_vote_callback(struct votable *votable, void *data, } } } } /* * check for termination at reduced float voltage and re-trigger * charging if new float voltage is above last FV. */ if ((chip->float_voltage_uv < fv_uv) && is_batt_available(chip)) { rc = power_supply_get_property(chip->batt_psy, POWER_SUPPLY_PROP_STATUS, &pval); if (rc < 0) { pr_err("Couldn't get battery status rc=%d\n", rc); } else { if (pval.intval == POWER_SUPPLY_STATUS_FULL) { pr_debug("re-triggering charging\n"); pval.intval = 1; rc = power_supply_set_property(chip->batt_psy, POWER_SUPPLY_PROP_FORCE_RECHARGE, &pval); if (rc < 0) pr_err("Couldn't set force recharge rc=%d\n", rc); } } } chip->float_voltage_uv = fv_uv; return 0; return 0; } } Loading Loading @@ -1107,17 +1144,6 @@ static void pl_disable_forever_work(struct work_struct *work) vote(chip->hvdcp_hw_inov_dis_votable, PL_VOTER, false, 0); vote(chip->hvdcp_hw_inov_dis_votable, PL_VOTER, false, 0); } } static bool is_batt_available(struct pl_data *chip) { if (!chip->batt_psy) chip->batt_psy = power_supply_get_by_name("battery"); if (!chip->batt_psy) return false; return true; } static int pl_disable_vote_callback(struct votable *votable, static int pl_disable_vote_callback(struct votable *votable, void *data, int pl_disable, const char *client) void *data, int pl_disable, const char *client) { { Loading