drivers: battery_v2: sec_battery: export {CURRENT/VOLTAGE}_MAX to sysfs

Inform the system if we are charging normal, fast or rapidly. It will be
displayed in the locksreen.

Change-Id: Id0de196e02bd5393cb4fb90835f18caa1d2fe20d
This commit is contained in:
Jesse Chan 2018-04-21 00:08:51 -07:00 committed by Ksawlii
parent e9ed6faf2c
commit b422cd8b8a

View file

@ -6811,9 +6811,20 @@ static int sec_usb_get_property(struct power_supply *psy,
{
struct sec_battery_info *battery = power_supply_get_drvdata(psy);
if (psp != POWER_SUPPLY_PROP_ONLINE)
switch (psp) {
case POWER_SUPPLY_PROP_ONLINE:
break;
case POWER_SUPPLY_PROP_VOLTAGE_MAX:
/* V -> uV */
val->intval = battery->input_voltage * 1000000;
return 0;
case POWER_SUPPLY_PROP_CURRENT_MAX:
/* mA -> uA */
val->intval = battery->pdata->charging_current[battery->cable_type].input_current_limit * 1000;
return 0;
default:
return -EINVAL;
}
if ((battery->health == POWER_SUPPLY_HEALTH_OVERVOLTAGE) ||
(battery->health == POWER_SUPPLY_EXT_HEALTH_UNDERVOLTAGE)) {
val->intval = 0;
@ -6893,6 +6904,14 @@ static int sec_ac_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_TEMP:
val->intval = battery->chg_temp;
break;
case POWER_SUPPLY_PROP_VOLTAGE_MAX:
/* V -> uV */
val->intval = battery->input_voltage * 1000000;
return 0;
case POWER_SUPPLY_PROP_CURRENT_MAX:
/* mA -> uA */
val->intval = battery->pdata->charging_current[battery->cable_type].input_current_limit * 1000;
return 0;
case POWER_SUPPLY_EXT_PROP_MIN ... POWER_SUPPLY_EXT_PROP_MAX:
switch (ext_psp) {
case POWER_SUPPLY_EXT_PROP_WATER_DETECT:
@ -6953,6 +6972,14 @@ static int sec_wireless_get_property(struct power_supply *psy,
return -EINVAL;
}
break;
case POWER_SUPPLY_PROP_VOLTAGE_MAX:
/* V -> uV */
val->intval = battery->input_voltage * 1000000;
return 0;
case POWER_SUPPLY_PROP_CURRENT_MAX:
/* mA -> uA */
val->intval = battery->pdata->charging_current[battery->cable_type].input_current_limit * 1000;
return 0;
default:
return -EINVAL;
}