Loading drivers/power/supply/qcom/qpnp-smb5.c +14 −5 Original line number Diff line number Diff line Loading @@ -1172,6 +1172,7 @@ static enum power_supply_property smb5_batt_props[] = { POWER_SUPPLY_PROP_CHARGE_COUNTER, POWER_SUPPLY_PROP_CYCLE_COUNT, POWER_SUPPLY_PROP_RECHARGE_SOC, POWER_SUPPLY_PROP_CHARGE_FULL, }; static int smb5_batt_get_prop(struct power_supply *psy, Loading Loading @@ -1222,14 +1223,16 @@ static int smb5_batt_get_prop(struct power_supply *psy, val->intval = chg->sw_jeita_enabled; break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: rc = smblib_get_prop_batt_voltage_now(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_VOLTAGE_NOW, val); break; case POWER_SUPPLY_PROP_VOLTAGE_MAX: val->intval = get_client_vote(chg->fv_votable, BATT_PROFILE_VOTER); break; case POWER_SUPPLY_PROP_CURRENT_NOW: rc = smblib_get_prop_batt_current_now(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CURRENT_NOW, val); break; case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: val->intval = get_client_vote(chg->fcc_votable, Loading @@ -1239,7 +1242,7 @@ static int smb5_batt_get_prop(struct power_supply *psy, rc = smblib_get_prop_batt_iterm(chg, val); break; case POWER_SUPPLY_PROP_TEMP: rc = smblib_get_prop_batt_temp(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_TEMP, val); break; case POWER_SUPPLY_PROP_TECHNOLOGY: val->intval = POWER_SUPPLY_TECHNOLOGY_LION; Loading Loading @@ -1268,10 +1271,12 @@ static int smb5_batt_get_prop(struct power_supply *psy, val->intval = 0; break; case POWER_SUPPLY_PROP_CHARGE_COUNTER: rc = smblib_get_prop_batt_charge_counter(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CHARGE_COUNTER, val); break; case POWER_SUPPLY_PROP_CYCLE_COUNT: rc = smblib_get_prop_batt_cycle_count(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CYCLE_COUNT, val); break; case POWER_SUPPLY_PROP_RECHARGE_SOC: val->intval = chg->auto_recharge_soc; Loading @@ -1279,6 +1284,10 @@ static int smb5_batt_get_prop(struct power_supply *psy, case POWER_SUPPLY_PROP_CHARGE_QNOVO_ENABLE: val->intval = 0; break; case POWER_SUPPLY_PROP_CHARGE_FULL: rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CHARGE_FULL, val); break; default: pr_err("batt power supply prop %d not supported\n", psp); return -EINVAL; Loading drivers/power/supply/qcom/smb5-lib.c +21 −71 Original line number Diff line number Diff line Loading @@ -629,6 +629,21 @@ static int smblib_set_usb_pd_allowed_voltage(struct smb_charger *chg, /******************** * HELPER FUNCTIONS * ********************/ int smblib_get_prop_from_bms(struct smb_charger *chg, enum power_supply_property psp, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, psp, val); return rc; } int smblib_configure_hvdcp_apsd(struct smb_charger *chg, bool enable) { int rc; Loading Loading @@ -859,7 +874,7 @@ void smblib_suspend_on_debug_battery(struct smb_charger *chg) int rc; union power_supply_propval val; rc = power_supply_get_property(chg->bms_psy, rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_DEBUG_BATTERY, &val); if (rc < 0) { smblib_err(chg, "Couldn't get debug battery prop rc=%d\n", rc); Loading Loading @@ -1328,9 +1343,8 @@ int smblib_get_prop_batt_capacity(struct smb_charger *chg, return 0; } if (chg->bms_psy) rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_CAPACITY, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CAPACITY, val); return rc; } Loading Loading @@ -1473,7 +1487,8 @@ int smblib_get_prop_batt_health(struct smb_charger *chg, stat); if (stat & CHARGER_ERROR_STATUS_BAT_OV_BIT) { rc = smblib_get_prop_batt_voltage_now(chg, &pval); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_VOLTAGE_NOW, &pval); if (!rc) { /* * If Vbatt is within 40mV above Vfloat, then don't Loading Loading @@ -1544,32 +1559,6 @@ int smblib_get_prop_input_current_limited(struct smb_charger *chg, return 0; } int smblib_get_prop_batt_voltage_now(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_VOLTAGE_NOW, val); return rc; } int smblib_get_prop_batt_current_now(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_CURRENT_NOW, val); return rc; } int smblib_get_prop_batt_iterm(struct smb_charger *chg, union power_supply_propval *val) { Loading Loading @@ -1609,19 +1598,6 @@ int smblib_get_prop_batt_iterm(struct smb_charger *chg, return rc; } int smblib_get_prop_batt_temp(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_TEMP, val); return rc; } int smblib_get_prop_batt_charge_done(struct smb_charger *chg, union power_supply_propval *val) { Loading @@ -1640,32 +1616,6 @@ int smblib_get_prop_batt_charge_done(struct smb_charger *chg, return 0; } int smblib_get_prop_batt_charge_counter(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_CHARGE_COUNTER, val); return rc; } int smblib_get_prop_batt_cycle_count(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_CYCLE_COUNT, val); return rc; } /*********************** * BATTERY PSY SETTERS * ***********************/ Loading Loading @@ -4379,7 +4329,7 @@ static void jeita_update_work(struct work_struct *work) if (!chg->bms_psy) return; rc = power_supply_get_property(chg->bms_psy, rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_RESISTANCE_ID, &val); if (rc < 0) { smblib_err(chg, "Failed to get batt-id rc=%d\n", rc); Loading drivers/power/supply/qcom/smb5-lib.h +3 −10 Original line number Diff line number Diff line Loading @@ -469,18 +469,8 @@ int smblib_get_prop_system_temp_level_max(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_input_current_limited(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_voltage_now(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_current_now(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_iterm(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_temp(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_charge_counter(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_cycle_count(struct smb_charger *chg, union power_supply_propval *val); int smblib_set_prop_input_suspend(struct smb_charger *chg, const union power_supply_propval *val); int smblib_set_prop_batt_capacity(struct smb_charger *chg, Loading Loading @@ -572,6 +562,9 @@ int smblib_get_prop_pr_swap_in_progress(struct smb_charger *chg, union power_supply_propval *val); int smblib_set_prop_pr_swap_in_progress(struct smb_charger *chg, const union power_supply_propval *val); int smblib_get_prop_from_bms(struct smb_charger *chg, enum power_supply_property psp, union power_supply_propval *val); int smblib_configure_hvdcp_apsd(struct smb_charger *chg, bool enable); int smblib_icl_override(struct smb_charger *chg, bool override); Loading Loading
drivers/power/supply/qcom/qpnp-smb5.c +14 −5 Original line number Diff line number Diff line Loading @@ -1172,6 +1172,7 @@ static enum power_supply_property smb5_batt_props[] = { POWER_SUPPLY_PROP_CHARGE_COUNTER, POWER_SUPPLY_PROP_CYCLE_COUNT, POWER_SUPPLY_PROP_RECHARGE_SOC, POWER_SUPPLY_PROP_CHARGE_FULL, }; static int smb5_batt_get_prop(struct power_supply *psy, Loading Loading @@ -1222,14 +1223,16 @@ static int smb5_batt_get_prop(struct power_supply *psy, val->intval = chg->sw_jeita_enabled; break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: rc = smblib_get_prop_batt_voltage_now(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_VOLTAGE_NOW, val); break; case POWER_SUPPLY_PROP_VOLTAGE_MAX: val->intval = get_client_vote(chg->fv_votable, BATT_PROFILE_VOTER); break; case POWER_SUPPLY_PROP_CURRENT_NOW: rc = smblib_get_prop_batt_current_now(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CURRENT_NOW, val); break; case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: val->intval = get_client_vote(chg->fcc_votable, Loading @@ -1239,7 +1242,7 @@ static int smb5_batt_get_prop(struct power_supply *psy, rc = smblib_get_prop_batt_iterm(chg, val); break; case POWER_SUPPLY_PROP_TEMP: rc = smblib_get_prop_batt_temp(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_TEMP, val); break; case POWER_SUPPLY_PROP_TECHNOLOGY: val->intval = POWER_SUPPLY_TECHNOLOGY_LION; Loading Loading @@ -1268,10 +1271,12 @@ static int smb5_batt_get_prop(struct power_supply *psy, val->intval = 0; break; case POWER_SUPPLY_PROP_CHARGE_COUNTER: rc = smblib_get_prop_batt_charge_counter(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CHARGE_COUNTER, val); break; case POWER_SUPPLY_PROP_CYCLE_COUNT: rc = smblib_get_prop_batt_cycle_count(chg, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CYCLE_COUNT, val); break; case POWER_SUPPLY_PROP_RECHARGE_SOC: val->intval = chg->auto_recharge_soc; Loading @@ -1279,6 +1284,10 @@ static int smb5_batt_get_prop(struct power_supply *psy, case POWER_SUPPLY_PROP_CHARGE_QNOVO_ENABLE: val->intval = 0; break; case POWER_SUPPLY_PROP_CHARGE_FULL: rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CHARGE_FULL, val); break; default: pr_err("batt power supply prop %d not supported\n", psp); return -EINVAL; Loading
drivers/power/supply/qcom/smb5-lib.c +21 −71 Original line number Diff line number Diff line Loading @@ -629,6 +629,21 @@ static int smblib_set_usb_pd_allowed_voltage(struct smb_charger *chg, /******************** * HELPER FUNCTIONS * ********************/ int smblib_get_prop_from_bms(struct smb_charger *chg, enum power_supply_property psp, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, psp, val); return rc; } int smblib_configure_hvdcp_apsd(struct smb_charger *chg, bool enable) { int rc; Loading Loading @@ -859,7 +874,7 @@ void smblib_suspend_on_debug_battery(struct smb_charger *chg) int rc; union power_supply_propval val; rc = power_supply_get_property(chg->bms_psy, rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_DEBUG_BATTERY, &val); if (rc < 0) { smblib_err(chg, "Couldn't get debug battery prop rc=%d\n", rc); Loading Loading @@ -1328,9 +1343,8 @@ int smblib_get_prop_batt_capacity(struct smb_charger *chg, return 0; } if (chg->bms_psy) rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_CAPACITY, val); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_CAPACITY, val); return rc; } Loading Loading @@ -1473,7 +1487,8 @@ int smblib_get_prop_batt_health(struct smb_charger *chg, stat); if (stat & CHARGER_ERROR_STATUS_BAT_OV_BIT) { rc = smblib_get_prop_batt_voltage_now(chg, &pval); rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_VOLTAGE_NOW, &pval); if (!rc) { /* * If Vbatt is within 40mV above Vfloat, then don't Loading Loading @@ -1544,32 +1559,6 @@ int smblib_get_prop_input_current_limited(struct smb_charger *chg, return 0; } int smblib_get_prop_batt_voltage_now(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_VOLTAGE_NOW, val); return rc; } int smblib_get_prop_batt_current_now(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_CURRENT_NOW, val); return rc; } int smblib_get_prop_batt_iterm(struct smb_charger *chg, union power_supply_propval *val) { Loading Loading @@ -1609,19 +1598,6 @@ int smblib_get_prop_batt_iterm(struct smb_charger *chg, return rc; } int smblib_get_prop_batt_temp(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_TEMP, val); return rc; } int smblib_get_prop_batt_charge_done(struct smb_charger *chg, union power_supply_propval *val) { Loading @@ -1640,32 +1616,6 @@ int smblib_get_prop_batt_charge_done(struct smb_charger *chg, return 0; } int smblib_get_prop_batt_charge_counter(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_CHARGE_COUNTER, val); return rc; } int smblib_get_prop_batt_cycle_count(struct smb_charger *chg, union power_supply_propval *val) { int rc; if (!chg->bms_psy) return -EINVAL; rc = power_supply_get_property(chg->bms_psy, POWER_SUPPLY_PROP_CYCLE_COUNT, val); return rc; } /*********************** * BATTERY PSY SETTERS * ***********************/ Loading Loading @@ -4379,7 +4329,7 @@ static void jeita_update_work(struct work_struct *work) if (!chg->bms_psy) return; rc = power_supply_get_property(chg->bms_psy, rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_RESISTANCE_ID, &val); if (rc < 0) { smblib_err(chg, "Failed to get batt-id rc=%d\n", rc); Loading
drivers/power/supply/qcom/smb5-lib.h +3 −10 Original line number Diff line number Diff line Loading @@ -469,18 +469,8 @@ int smblib_get_prop_system_temp_level_max(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_input_current_limited(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_voltage_now(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_current_now(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_iterm(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_temp(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_charge_counter(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_batt_cycle_count(struct smb_charger *chg, union power_supply_propval *val); int smblib_set_prop_input_suspend(struct smb_charger *chg, const union power_supply_propval *val); int smblib_set_prop_batt_capacity(struct smb_charger *chg, Loading Loading @@ -572,6 +562,9 @@ int smblib_get_prop_pr_swap_in_progress(struct smb_charger *chg, union power_supply_propval *val); int smblib_set_prop_pr_swap_in_progress(struct smb_charger *chg, const union power_supply_propval *val); int smblib_get_prop_from_bms(struct smb_charger *chg, enum power_supply_property psp, union power_supply_propval *val); int smblib_configure_hvdcp_apsd(struct smb_charger *chg, bool enable); int smblib_icl_override(struct smb_charger *chg, bool override); Loading