battery: sec_battery: export {CURRENT/VOLTAGE}_MAX to sysfs

Change-Id: I54c775bb80c2151bdc69ea9fb53a48a34327bbef
This commit is contained in:
Jesse Chan 2018-04-21 00:08:51 -07:00 committed by Ksawlii
parent 95be6620aa
commit 2bda4b9d8f

View file

@ -94,6 +94,8 @@ static enum power_supply_property sec_battery_props[] = {
static enum power_supply_property sec_power_props[] = {
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_VOLTAGE_MAX,
POWER_SUPPLY_PROP_CURRENT_MAX,
};
static enum power_supply_property sec_wireless_props[] = {
@ -104,6 +106,8 @@ static enum power_supply_property sec_wireless_props[] = {
static enum power_supply_property sec_ac_props[] = {
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_TEMP,
POWER_SUPPLY_PROP_VOLTAGE_MAX,
POWER_SUPPLY_PROP_CURRENT_MAX,
};
static enum power_supply_property sec_otg_props[] = {
@ -6825,6 +6829,7 @@ static int sec_usb_get_property(struct power_supply *psy,
default:
return -EINVAL;
}
if ((battery->health == POWER_SUPPLY_HEALTH_OVERVOLTAGE) ||
(battery->health == POWER_SUPPLY_EXT_HEALTH_UNDERVOLTAGE)) {
val->intval = 0;
@ -6927,6 +6932,14 @@ static int sec_ac_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;
}