diff options
author | Harry Yang <harryy@codeaurora.org> | 2016-10-14 09:31:15 -0700 |
---|---|---|
committer | Abhijeet Dharmapurikar <adharmap@codeaurora.org> | 2016-10-19 16:27:10 -0700 |
commit | 8a09bace078ef3a454fd5f1d09b269ac978714af (patch) | |
tree | 589997d0ff1a014ec8b25b557e0d50af6822264e /drivers/power | |
parent | 757155c6d6067e8980ca290a934859de50787fad (diff) |
qpnp-smb2: support setting FCC and float voltage in battery power supply
Fast charge current (FCC) and float voltage are parameters that
are battery specific and needs to be set based on the profile
detected by Fuel Gauge driver. Expose the following properties
from battery power supply so that FG can set them.
- POWER_SUPPLY_PROP_VOLTAGE_MAX
- POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX
Change-Id: I72465484b154b1a758285d58906ce7661a246767
Signed-off-by: Harry Yang <harryy@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/qcom-charger/qpnp-smb2.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/power/qcom-charger/qpnp-smb2.c b/drivers/power/qcom-charger/qpnp-smb2.c index 4cb4c2bd665c..a7f907dbcbea 100644 --- a/drivers/power/qcom-charger/qpnp-smb2.c +++ b/drivers/power/qcom-charger/qpnp-smb2.c @@ -637,7 +637,9 @@ static enum power_supply_property smb2_batt_props[] = { POWER_SUPPLY_PROP_CHARGER_TEMP_MAX, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED, POWER_SUPPLY_PROP_VOLTAGE_NOW, + POWER_SUPPLY_PROP_VOLTAGE_MAX, POWER_SUPPLY_PROP_CURRENT_NOW, + POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_STEP_CHARGING_ENABLED, @@ -694,9 +696,16 @@ static int smb2_batt_get_prop(struct power_supply *psy, case POWER_SUPPLY_PROP_VOLTAGE_NOW: rc = smblib_get_prop_batt_voltage_now(chg, val); break; + case POWER_SUPPLY_PROP_VOLTAGE_MAX: + val->intval = get_client_vote(chg->fv_votable, DEFAULT_VOTER); + break; case POWER_SUPPLY_PROP_CURRENT_NOW: rc = smblib_get_prop_batt_current_now(chg, val); break; + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: + val->intval = get_client_vote(chg->fcc_max_votable, + DEFAULT_VOTER); + break; case POWER_SUPPLY_PROP_TEMP: rc = smblib_get_prop_batt_temp(chg, val); break; @@ -752,6 +761,12 @@ static int smb2_batt_set_prop(struct power_supply *psy, chg->pl.slave_pct = val->intval; rerun_election(chg->fcc_votable); break; + case POWER_SUPPLY_PROP_VOLTAGE_MAX: + vote(chg->fv_votable, DEFAULT_VOTER, true, val->intval); + break; + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: + vote(chg->fcc_max_votable, DEFAULT_VOTER, true, val->intval); + break; default: rc = -EINVAL; } |