ANDROID: GKI: power: supply: Add capacity and resistance estimates

Partially taken from commit 5b4457baf0e32ba6a6a8d0933328189ff7335e4
("qpnp-qg: add properities for google_battery requirement")

Signed-off-by: Jack Wu <wjack@google.com>
Bug: 139264914
(cherry picked from commit 5b4457baf0e32ba6a6a8d0933328189ff7335e44)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 150789066
Change-Id: I92678ec7228a46ceb870f41e3acf2f790633fc2a
This commit is contained in:
Mark Salyzyn
2020-02-24 14:40:49 -08:00
parent cd5c0c7938
commit d8fb4a9362
2 changed files with 19 additions and 1 deletions

View File

@ -215,9 +215,15 @@ static ssize_t power_supply_show_property(struct device *dev,
case POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT:
ret = sprintf(buf, "%lld\n", value.int64val);
break;
case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER:
case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_CYCLE_COUNTS:
ret = sprintf(buf, "%s\n", value.strval);
break;
/*
* FIXME: b/139264914, ignore it temporarily to avoid hit NULL point.
* will review it
*/
case POWER_SUPPLY_PROP_SERIAL_NUMBER:
break;
default:
ret = sprintf(buf, "%d\n", value.intval);
}
@ -467,6 +473,12 @@ static struct device_attribute power_supply_attrs[] = {
POWER_SUPPLY_ATTR(charge_disable),
POWER_SUPPLY_ATTR(adapter_details),
POWER_SUPPLY_ATTR(dead_battery),
/* Capacity Estimation */
POWER_SUPPLY_ATTR(batt_ce_ctrl),
POWER_SUPPLY_ATTR(batt_ce_full),
/* Resistance Estimaton */
POWER_SUPPLY_ATTR(resistance_avg),
POWER_SUPPLY_ATTR(batt_res_filt_cnts),
/* Charge pump properties */
POWER_SUPPLY_ATTR(cp_status1),
POWER_SUPPLY_ATTR(cp_status2),

View File

@ -338,6 +338,12 @@ enum power_supply_property {
POWER_SUPPLY_PROP_CHARGE_DISABLE,
POWER_SUPPLY_PROP_ADAPTER_DETAILS,
POWER_SUPPLY_PROP_DEAD_BATTERY,
/* Capacity Estimation */
POWER_SUPPLY_PROP_BATT_CE_CTRL,
POWER_SUPPLY_PROP_CHARGE_FULL_ESTIMATE,
/* Resistance Estimaton */
POWER_SUPPLY_PROP_RESISTANCE_AVG,
POWER_SUPPLY_PROP_RES_FILTER_COUNT,
/* Charge pump properties */
POWER_SUPPLY_PROP_CP_STATUS1,
POWER_SUPPLY_PROP_CP_STATUS2,