Loading drivers/power/supply/power_supply_sysfs.c +1 −0 Original line number Diff line number Diff line Loading @@ -464,6 +464,7 @@ static struct device_attribute power_supply_attrs[] = { POWER_SUPPLY_ATTR(comp_clamp_level), POWER_SUPPLY_ATTR(adapter_cc_mode), POWER_SUPPLY_ATTR(skin_health), POWER_SUPPLY_ATTR(aicl_done), /* Charge pump properties */ POWER_SUPPLY_ATTR(cp_status1), POWER_SUPPLY_ATTR(cp_status2), Loading drivers/power/supply/qcom/battery.c +16 −3 Original line number Diff line number Diff line Loading @@ -1152,7 +1152,7 @@ static int usb_icl_vote_callback(struct votable *votable, void *data, int rc; struct pl_data *chip = data; union power_supply_propval pval = {0, }; bool rerun_aicl = false; bool rerun_aicl = false, dc_present = false; if (!chip->main_psy) return 0; Loading Loading @@ -1214,8 +1214,21 @@ static int usb_icl_vote_callback(struct votable *votable, void *data, /* Configure ILIM based on AICL result only if input mode is USBMID */ if (cp_get_parallel_mode(chip, PARALLEL_INPUT_MODE) == POWER_SUPPLY_PL_USBMID_USBMID) == POWER_SUPPLY_PL_USBMID_USBMID) { if (chip->dc_psy) { rc = power_supply_get_property(chip->dc_psy, POWER_SUPPLY_PROP_PRESENT, &pval); if (rc < 0) { pr_err("Couldn't get DC PRESENT rc=%d\n", rc); return rc; } dc_present = pval.intval; } /* Don't configure ILIM if DC is present */ if (!dc_present) cp_configure_ilim(chip, ICL_CHANGE_VOTER, icl_ua); } return 0; } Loading drivers/power/supply/qcom/qpnp-smb5.c +4 −0 Original line number Diff line number Diff line Loading @@ -1413,6 +1413,7 @@ static enum power_supply_property smb5_dc_props[] = { POWER_SUPPLY_PROP_INPUT_VOLTAGE_REGULATION, POWER_SUPPLY_PROP_REAL_TYPE, POWER_SUPPLY_PROP_DC_RESET, POWER_SUPPLY_PROP_AICL_DONE, }; static int smb5_dc_get_prop(struct power_supply *psy, Loading Loading @@ -1451,6 +1452,9 @@ static int smb5_dc_get_prop(struct power_supply *psy, case POWER_SUPPLY_PROP_DC_RESET: val->intval = 0; break; case POWER_SUPPLY_PROP_AICL_DONE: val->intval = chg->dcin_aicl_done; break; default: return -EINVAL; } Loading drivers/power/supply/qcom/smb1390-charger-psy.c +15 −5 Original line number Diff line number Diff line Loading @@ -1068,7 +1068,7 @@ static void smb1390_status_change_work(struct work_struct *work) struct smb1390 *chip = container_of(work, struct smb1390, status_change_work); union power_supply_propval pval = {0, }; int rc; int rc, dc_current_max = 0; if (!is_psy_voter_available(chip)) goto out; Loading Loading @@ -1109,11 +1109,21 @@ static void smb1390_status_change_work(struct work_struct *work) vote(chip->ilim_votable, ICL_VOTER, false, 0); rc = power_supply_get_property(chip->dc_psy, POWER_SUPPLY_PROP_CURRENT_MAX, &pval); if (rc < 0) if (rc < 0) { pr_err("Couldn't get dc icl rc=%d\n", rc); else vote(chip->ilim_votable, WIRELESS_VOTER, true, pval.intval); } else { dc_current_max = pval.intval; rc = power_supply_get_property(chip->dc_psy, POWER_SUPPLY_PROP_AICL_DONE, &pval); if (rc < 0) pr_err("Couldn't get aicl done rc=%d\n", rc); else if (pval.intval) vote(chip->ilim_votable, WIRELESS_VOTER, true, dc_current_max); } } else { vote(chip->ilim_votable, WIRELESS_VOTER, false, 0); smb1390_configure_ilim(chip, pval.intval); Loading drivers/power/supply/qcom/smb5-lib.c +21 −7 Original line number Diff line number Diff line Loading @@ -3019,7 +3019,6 @@ int smblib_set_prop_voltage_wls_output(struct smb_charger *chg, * to supply more current, so allow it to do so. */ if ((val->intval > 0) && (val->intval < chg->last_wls_vout)) { /* Rerun AICL once after 10 s */ alarm_start_relative(&chg->dcin_aicl_alarm, ms_to_ktime(DCIN_AICL_RERUN_DELAY_MS)); } Loading Loading @@ -6046,6 +6045,7 @@ static void dcin_aicl(struct smb_charger *chg) { int rc, icl, icl_save; int input_present; bool aicl_done = true; /* * Hold awake votable to prevent pm_relax being called prior to Loading @@ -6058,11 +6058,16 @@ static void dcin_aicl(struct smb_charger *chg) rc = smblib_get_charge_param(chg, &chg->param.dc_icl, &icl); if (rc < 0) goto unlock; goto err; if (icl == chg->wls_icl_ua) { /* Upper limit reached; do nothing */ smblib_dbg(chg, PR_WLS, "hit max ICL: stop\n"); rc = smblib_is_input_present(chg, &input_present); if (rc < 0 || !(input_present & INPUT_PRESENT_DC)) aicl_done = false; goto unlock; } Loading @@ -6071,7 +6076,7 @@ static void dcin_aicl(struct smb_charger *chg) rc = smblib_set_charge_param(chg, &chg->param.dc_icl, icl); if (rc < 0) goto unlock; goto err; mutex_unlock(&chg->dcin_aicl_lock); Loading @@ -6079,8 +6084,10 @@ static void dcin_aicl(struct smb_charger *chg) /* Check to see if DC is still present before and after sleep */ rc = smblib_is_input_present(chg, &input_present); if (!(input_present & INPUT_PRESENT_DC) || rc < 0) if (rc < 0 || !(input_present & INPUT_PRESENT_DC)) { aicl_done = false; goto unvote; } /* * Wait awhile to check for any DCIN_UVs (the UV handler reduces the Loading @@ -6090,14 +6097,16 @@ static void dcin_aicl(struct smb_charger *chg) msleep(500); rc = smblib_is_input_present(chg, &input_present); if (!(input_present & INPUT_PRESENT_DC) || rc < 0) if (rc < 0 || !(input_present & INPUT_PRESENT_DC)) { aicl_done = false; goto unvote; } mutex_lock(&chg->dcin_aicl_lock); rc = smblib_get_charge_param(chg, &chg->param.dc_icl, &icl); if (rc < 0) goto unlock; goto err; if (icl < icl_save) { smblib_dbg(chg, PR_WLS, "done: icl: %d mA\n", (icl / 1000)); Loading @@ -6107,10 +6116,14 @@ static void dcin_aicl(struct smb_charger *chg) mutex_unlock(&chg->dcin_aicl_lock); goto increment; err: aicl_done = false; unlock: mutex_unlock(&chg->dcin_aicl_lock); unvote: vote(chg->awake_votable, DCIN_AICL_VOTER, false, 0); chg->dcin_aicl_done = aicl_done; } static void dcin_aicl_work(struct work_struct *work) Loading Loading @@ -6154,7 +6167,7 @@ static void dcin_icl_decrement(struct smb_charger *chg) /* Reduce ICL by 100 mA if 3 UVs happen in a row */ if (ktime_us_delta(now, chg->dcin_uv_last_time) > (200 * 1000)) { chg->dcin_uv_count = 0; } else if (chg->dcin_uv_count == 3) { } else if (chg->dcin_uv_count >= 3) { icl -= DCIN_ICL_STEP_UA; smblib_dbg(chg, PR_WLS, "icl: %d mA\n", (icl / 1000)); Loading Loading @@ -6314,6 +6327,7 @@ irqreturn_t dc_plugin_irq_handler(int irq, void *data) vote(chg->fcc_votable, FCC_STEPPER_VOTER, true, 1500000); chg->last_wls_vout = 0; chg->dcin_aicl_done = false; } if (chg->dc_psy) Loading Loading
drivers/power/supply/power_supply_sysfs.c +1 −0 Original line number Diff line number Diff line Loading @@ -464,6 +464,7 @@ static struct device_attribute power_supply_attrs[] = { POWER_SUPPLY_ATTR(comp_clamp_level), POWER_SUPPLY_ATTR(adapter_cc_mode), POWER_SUPPLY_ATTR(skin_health), POWER_SUPPLY_ATTR(aicl_done), /* Charge pump properties */ POWER_SUPPLY_ATTR(cp_status1), POWER_SUPPLY_ATTR(cp_status2), Loading
drivers/power/supply/qcom/battery.c +16 −3 Original line number Diff line number Diff line Loading @@ -1152,7 +1152,7 @@ static int usb_icl_vote_callback(struct votable *votable, void *data, int rc; struct pl_data *chip = data; union power_supply_propval pval = {0, }; bool rerun_aicl = false; bool rerun_aicl = false, dc_present = false; if (!chip->main_psy) return 0; Loading Loading @@ -1214,8 +1214,21 @@ static int usb_icl_vote_callback(struct votable *votable, void *data, /* Configure ILIM based on AICL result only if input mode is USBMID */ if (cp_get_parallel_mode(chip, PARALLEL_INPUT_MODE) == POWER_SUPPLY_PL_USBMID_USBMID) == POWER_SUPPLY_PL_USBMID_USBMID) { if (chip->dc_psy) { rc = power_supply_get_property(chip->dc_psy, POWER_SUPPLY_PROP_PRESENT, &pval); if (rc < 0) { pr_err("Couldn't get DC PRESENT rc=%d\n", rc); return rc; } dc_present = pval.intval; } /* Don't configure ILIM if DC is present */ if (!dc_present) cp_configure_ilim(chip, ICL_CHANGE_VOTER, icl_ua); } return 0; } Loading
drivers/power/supply/qcom/qpnp-smb5.c +4 −0 Original line number Diff line number Diff line Loading @@ -1413,6 +1413,7 @@ static enum power_supply_property smb5_dc_props[] = { POWER_SUPPLY_PROP_INPUT_VOLTAGE_REGULATION, POWER_SUPPLY_PROP_REAL_TYPE, POWER_SUPPLY_PROP_DC_RESET, POWER_SUPPLY_PROP_AICL_DONE, }; static int smb5_dc_get_prop(struct power_supply *psy, Loading Loading @@ -1451,6 +1452,9 @@ static int smb5_dc_get_prop(struct power_supply *psy, case POWER_SUPPLY_PROP_DC_RESET: val->intval = 0; break; case POWER_SUPPLY_PROP_AICL_DONE: val->intval = chg->dcin_aicl_done; break; default: return -EINVAL; } Loading
drivers/power/supply/qcom/smb1390-charger-psy.c +15 −5 Original line number Diff line number Diff line Loading @@ -1068,7 +1068,7 @@ static void smb1390_status_change_work(struct work_struct *work) struct smb1390 *chip = container_of(work, struct smb1390, status_change_work); union power_supply_propval pval = {0, }; int rc; int rc, dc_current_max = 0; if (!is_psy_voter_available(chip)) goto out; Loading Loading @@ -1109,11 +1109,21 @@ static void smb1390_status_change_work(struct work_struct *work) vote(chip->ilim_votable, ICL_VOTER, false, 0); rc = power_supply_get_property(chip->dc_psy, POWER_SUPPLY_PROP_CURRENT_MAX, &pval); if (rc < 0) if (rc < 0) { pr_err("Couldn't get dc icl rc=%d\n", rc); else vote(chip->ilim_votable, WIRELESS_VOTER, true, pval.intval); } else { dc_current_max = pval.intval; rc = power_supply_get_property(chip->dc_psy, POWER_SUPPLY_PROP_AICL_DONE, &pval); if (rc < 0) pr_err("Couldn't get aicl done rc=%d\n", rc); else if (pval.intval) vote(chip->ilim_votable, WIRELESS_VOTER, true, dc_current_max); } } else { vote(chip->ilim_votable, WIRELESS_VOTER, false, 0); smb1390_configure_ilim(chip, pval.intval); Loading
drivers/power/supply/qcom/smb5-lib.c +21 −7 Original line number Diff line number Diff line Loading @@ -3019,7 +3019,6 @@ int smblib_set_prop_voltage_wls_output(struct smb_charger *chg, * to supply more current, so allow it to do so. */ if ((val->intval > 0) && (val->intval < chg->last_wls_vout)) { /* Rerun AICL once after 10 s */ alarm_start_relative(&chg->dcin_aicl_alarm, ms_to_ktime(DCIN_AICL_RERUN_DELAY_MS)); } Loading Loading @@ -6046,6 +6045,7 @@ static void dcin_aicl(struct smb_charger *chg) { int rc, icl, icl_save; int input_present; bool aicl_done = true; /* * Hold awake votable to prevent pm_relax being called prior to Loading @@ -6058,11 +6058,16 @@ static void dcin_aicl(struct smb_charger *chg) rc = smblib_get_charge_param(chg, &chg->param.dc_icl, &icl); if (rc < 0) goto unlock; goto err; if (icl == chg->wls_icl_ua) { /* Upper limit reached; do nothing */ smblib_dbg(chg, PR_WLS, "hit max ICL: stop\n"); rc = smblib_is_input_present(chg, &input_present); if (rc < 0 || !(input_present & INPUT_PRESENT_DC)) aicl_done = false; goto unlock; } Loading @@ -6071,7 +6076,7 @@ static void dcin_aicl(struct smb_charger *chg) rc = smblib_set_charge_param(chg, &chg->param.dc_icl, icl); if (rc < 0) goto unlock; goto err; mutex_unlock(&chg->dcin_aicl_lock); Loading @@ -6079,8 +6084,10 @@ static void dcin_aicl(struct smb_charger *chg) /* Check to see if DC is still present before and after sleep */ rc = smblib_is_input_present(chg, &input_present); if (!(input_present & INPUT_PRESENT_DC) || rc < 0) if (rc < 0 || !(input_present & INPUT_PRESENT_DC)) { aicl_done = false; goto unvote; } /* * Wait awhile to check for any DCIN_UVs (the UV handler reduces the Loading @@ -6090,14 +6097,16 @@ static void dcin_aicl(struct smb_charger *chg) msleep(500); rc = smblib_is_input_present(chg, &input_present); if (!(input_present & INPUT_PRESENT_DC) || rc < 0) if (rc < 0 || !(input_present & INPUT_PRESENT_DC)) { aicl_done = false; goto unvote; } mutex_lock(&chg->dcin_aicl_lock); rc = smblib_get_charge_param(chg, &chg->param.dc_icl, &icl); if (rc < 0) goto unlock; goto err; if (icl < icl_save) { smblib_dbg(chg, PR_WLS, "done: icl: %d mA\n", (icl / 1000)); Loading @@ -6107,10 +6116,14 @@ static void dcin_aicl(struct smb_charger *chg) mutex_unlock(&chg->dcin_aicl_lock); goto increment; err: aicl_done = false; unlock: mutex_unlock(&chg->dcin_aicl_lock); unvote: vote(chg->awake_votable, DCIN_AICL_VOTER, false, 0); chg->dcin_aicl_done = aicl_done; } static void dcin_aicl_work(struct work_struct *work) Loading Loading @@ -6154,7 +6167,7 @@ static void dcin_icl_decrement(struct smb_charger *chg) /* Reduce ICL by 100 mA if 3 UVs happen in a row */ if (ktime_us_delta(now, chg->dcin_uv_last_time) > (200 * 1000)) { chg->dcin_uv_count = 0; } else if (chg->dcin_uv_count == 3) { } else if (chg->dcin_uv_count >= 3) { icl -= DCIN_ICL_STEP_UA; smblib_dbg(chg, PR_WLS, "icl: %d mA\n", (icl / 1000)); Loading Loading @@ -6314,6 +6327,7 @@ irqreturn_t dc_plugin_irq_handler(int irq, void *data) vote(chg->fcc_votable, FCC_STEPPER_VOTER, true, 1500000); chg->last_wls_vout = 0; chg->dcin_aicl_done = false; } if (chg->dc_psy) Loading