power: bq25700: add power_supply property for CTS.

Change-Id: I1b496dc8b3c4c53e54f40e07801cda419f654dfd
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
This commit is contained in:
Shunqing Chen
2018-05-18 09:51:35 +08:00
committed by 陈顺庆
parent 3dd9af3221
commit 91b9c4cb57

View File

@@ -1115,6 +1115,8 @@ static enum power_supply_property bq25700_power_supply_props[] = {
POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
POWER_SUPPLY_PROP_VOLTAGE_MAX,
POWER_SUPPLY_PROP_CURRENT_MAX,
};
static int bq25700_power_supply_get_property(struct power_supply *psy,
@@ -1195,6 +1197,16 @@ static int bq25700_power_supply_get_property(struct power_supply *psy,
val->intval = bq25700_tables[TBL_INPUTCUR].rt.max;
break;
case POWER_SUPPLY_PROP_VOLTAGE_MAX:
ret = bq25700_field_read(bq, MAX_CHARGE_VOLTAGE);
val->intval = ret * 16;
break;
case POWER_SUPPLY_PROP_CURRENT_MAX:
ret = bq25700_field_read(bq, CHARGE_CURRENT);
val->intval = ret * 64;
break;
default:
return -EINVAL;
}