mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 14:50:19 +00:00
power supply and reset changes for the 6.10 series
* core: simplify POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR handling * test-power: add POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR support * chrome EC drivers: add ID based probing * bq27xxx: simplify update loop to reduce I2C traffic * max8903 binding: fix GPIO polarity description -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmZHe7IACgkQ2O7X88g7 +ppzRw/7BndhO6gBQEIRsM+elBE3GkFfdvAjfkjn3756mJZpTI0zhcOSQWHIJ6TA 6MRU2CDrG4eXuhkoJ1bsXa9+gSTuKBBBV41BNoUdBqTlg/i8D8T1U97Ofjxf5+4w zcd1GYndzaTMakC3Pn18sg026+QI3n31wl8LyvrfrP3fv2VMmHOQ3mg0AxyxhtzE cWc2Qi4lpVH456vR9LYTSmJhxph5mF5ZQ0sfx/s8OO4si6GGLV1l9KrR2NxW1bAY 6ZCT8C56KWddQqGOPE5kz9XLzc1j0EYyoMzxr9UwNYSgZroHgjj2bmQMRgsTWpC0 cZ9NOtxv+Xlnio7H1SNhgVwGnesw3nFZz7IgdGBcMZhJzwt+rG3h4OfoaGEr0arZ fN2lnJXU6Tjs7ArYVJjGLGqx9HdG1LKsLsFFSeWU+zwqOAhLCveXha9oJsulkHta zjrG0pYjexCM6YF/2kp5jwpDln9pWJ7AeuP2ZH57/kaREdl79qU6oEosVZuB+cy8 Zkf09dy3ZAI/gBL73dIOK0blaSY4A36CyWCZGQvhn8x6Ai0AecxcV8y136pdfFjH 7C17/DUtbUfclEyp2IlO/EIKPv/aZVs4x57tUcwlNomjG7Pe1Qw3wnrUV7ZAOAx7 tihCn8mDFj46MCE+CsmdK4YAAGuVR44llQv3t249Yxm1mEEB79E= =T4Sm -----END PGP SIGNATURE----- Merge tag 'for-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: - core: simplify POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR handling - test-power: add POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR support - chrome EC drivers: add ID based probing - bq27xxx: simplify update loop to reduce I2C traffic - max8903 binding: fix GPIO polarity description * tag 'for-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: dt-bindings: power: supply: max8903: specify flt-gpios as input power: supply: bq27xxx: Move health reading out of update loop power: supply: bq27xxx: Move cycle count reading out of update loop power: supply: bq27xxx: Move energy reading out of update loop power: supply: bq27xxx: Move charge reading out of update loop power: supply: bq27xxx: Move time reading out of update loop power: supply: bq27xxx: Move temperature reading out of update loop power: supply: cros_pchg: provide ID table for avoiding fallback match power: supply: cros_usbpd: provide ID table for avoiding fallback match power: supply: core: simplify charge_behaviour formatting power: supply: test-power: implement charge_behaviour property
This commit is contained in:
commit
85d46148f8
@ -34,7 +34,7 @@ properties:
|
||||
|
||||
flt-gpios:
|
||||
maxItems: 1
|
||||
description: Fault pin (active low, output)
|
||||
description: Fault pin (active low, input)
|
||||
|
||||
dcm-gpios:
|
||||
maxItems: 1
|
||||
|
@ -1545,7 +1545,8 @@ static int bq27xxx_battery_read_soc(struct bq27xxx_device_info *di)
|
||||
* Return a battery charge value in µAh
|
||||
* Or < 0 if something fails.
|
||||
*/
|
||||
static int bq27xxx_battery_read_charge(struct bq27xxx_device_info *di, u8 reg)
|
||||
static int bq27xxx_battery_read_charge(struct bq27xxx_device_info *di, u8 reg,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
int charge;
|
||||
|
||||
@ -1561,34 +1562,39 @@ static int bq27xxx_battery_read_charge(struct bq27xxx_device_info *di, u8 reg)
|
||||
else
|
||||
charge *= 1000;
|
||||
|
||||
return charge;
|
||||
val->intval = charge;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the battery Nominal available capacity in µAh
|
||||
* Or < 0 if something fails.
|
||||
*/
|
||||
static inline int bq27xxx_battery_read_nac(struct bq27xxx_device_info *di)
|
||||
static inline int bq27xxx_battery_read_nac(struct bq27xxx_device_info *di,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
return bq27xxx_battery_read_charge(di, BQ27XXX_REG_NAC);
|
||||
return bq27xxx_battery_read_charge(di, BQ27XXX_REG_NAC, val);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the battery Remaining Capacity in µAh
|
||||
* Or < 0 if something fails.
|
||||
*/
|
||||
static inline int bq27xxx_battery_read_rc(struct bq27xxx_device_info *di)
|
||||
static inline int bq27xxx_battery_read_rc(struct bq27xxx_device_info *di,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
return bq27xxx_battery_read_charge(di, BQ27XXX_REG_RC);
|
||||
return bq27xxx_battery_read_charge(di, BQ27XXX_REG_RC, val);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the battery Full Charge Capacity in µAh
|
||||
* Or < 0 if something fails.
|
||||
*/
|
||||
static inline int bq27xxx_battery_read_fcc(struct bq27xxx_device_info *di)
|
||||
static inline int bq27xxx_battery_read_fcc(struct bq27xxx_device_info *di,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
return bq27xxx_battery_read_charge(di, BQ27XXX_REG_FCC);
|
||||
return bq27xxx_battery_read_charge(di, BQ27XXX_REG_FCC, val);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1633,7 +1639,8 @@ static int bq27xxx_battery_read_dcap(struct bq27xxx_device_info *di,
|
||||
* Return the battery Available energy in µWh
|
||||
* Or < 0 if something fails.
|
||||
*/
|
||||
static int bq27xxx_battery_read_energy(struct bq27xxx_device_info *di)
|
||||
static int bq27xxx_battery_read_energy(struct bq27xxx_device_info *di,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
int ae;
|
||||
|
||||
@ -1648,14 +1655,17 @@ static int bq27xxx_battery_read_energy(struct bq27xxx_device_info *di)
|
||||
else
|
||||
ae *= 1000;
|
||||
|
||||
return ae;
|
||||
val->intval = ae;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the battery temperature in tenths of degree Kelvin
|
||||
* Return the battery temperature in tenths of degree Celsius
|
||||
* Or < 0 if something fails.
|
||||
*/
|
||||
static int bq27xxx_battery_read_temperature(struct bq27xxx_device_info *di)
|
||||
static int bq27xxx_battery_read_temperature(struct bq27xxx_device_info *di,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
int temp;
|
||||
|
||||
@ -1668,14 +1678,20 @@ static int bq27xxx_battery_read_temperature(struct bq27xxx_device_info *di)
|
||||
if (di->opts & BQ27XXX_O_ZERO)
|
||||
temp = 5 * temp / 2;
|
||||
|
||||
return temp;
|
||||
/* Convert decidegree Kelvin to Celsius */
|
||||
temp -= 2731;
|
||||
|
||||
val->intval = temp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the battery Cycle count total
|
||||
* Or < 0 if something fails.
|
||||
*/
|
||||
static int bq27xxx_battery_read_cyct(struct bq27xxx_device_info *di)
|
||||
static int bq27xxx_battery_read_cyct(struct bq27xxx_device_info *di,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
int cyct;
|
||||
|
||||
@ -1683,14 +1699,17 @@ static int bq27xxx_battery_read_cyct(struct bq27xxx_device_info *di)
|
||||
if (cyct < 0)
|
||||
dev_err(di->dev, "error reading cycle count total\n");
|
||||
|
||||
return cyct;
|
||||
val->intval = cyct;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read a time register.
|
||||
* Return < 0 if something fails.
|
||||
*/
|
||||
static int bq27xxx_battery_read_time(struct bq27xxx_device_info *di, u8 reg)
|
||||
static int bq27xxx_battery_read_time(struct bq27xxx_device_info *di, u8 reg,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
int tval;
|
||||
|
||||
@ -1704,7 +1723,9 @@ static int bq27xxx_battery_read_time(struct bq27xxx_device_info *di, u8 reg)
|
||||
if (tval == 65535)
|
||||
return -ENODATA;
|
||||
|
||||
return tval * 60;
|
||||
val->intval = tval * 60;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1756,19 +1777,26 @@ static bool bq27xxx_battery_capacity_inaccurate(struct bq27xxx_device_info *di,
|
||||
return false;
|
||||
}
|
||||
|
||||
static int bq27xxx_battery_read_health(struct bq27xxx_device_info *di)
|
||||
static int bq27xxx_battery_read_health(struct bq27xxx_device_info *di,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
int health;
|
||||
|
||||
/* Unlikely but important to return first */
|
||||
if (unlikely(bq27xxx_battery_overtemp(di, di->cache.flags)))
|
||||
return POWER_SUPPLY_HEALTH_OVERHEAT;
|
||||
if (unlikely(bq27xxx_battery_undertemp(di, di->cache.flags)))
|
||||
return POWER_SUPPLY_HEALTH_COLD;
|
||||
if (unlikely(bq27xxx_battery_dead(di, di->cache.flags)))
|
||||
return POWER_SUPPLY_HEALTH_DEAD;
|
||||
if (unlikely(bq27xxx_battery_capacity_inaccurate(di, di->cache.flags)))
|
||||
return POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED;
|
||||
health = POWER_SUPPLY_HEALTH_OVERHEAT;
|
||||
else if (unlikely(bq27xxx_battery_undertemp(di, di->cache.flags)))
|
||||
health = POWER_SUPPLY_HEALTH_COLD;
|
||||
else if (unlikely(bq27xxx_battery_dead(di, di->cache.flags)))
|
||||
health = POWER_SUPPLY_HEALTH_DEAD;
|
||||
else if (unlikely(bq27xxx_battery_capacity_inaccurate(di, di->cache.flags)))
|
||||
health = POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED;
|
||||
else
|
||||
health = POWER_SUPPLY_HEALTH_GOOD;
|
||||
|
||||
return POWER_SUPPLY_HEALTH_GOOD;
|
||||
val->intval = health;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool bq27xxx_battery_is_full(struct bq27xxx_device_info *di, int flags)
|
||||
@ -1851,22 +1879,8 @@ static void bq27xxx_battery_update_unlocked(struct bq27xxx_device_info *di)
|
||||
if ((cache.flags & 0xff) == 0xff)
|
||||
cache.flags = -1; /* read error */
|
||||
if (cache.flags >= 0) {
|
||||
cache.temperature = bq27xxx_battery_read_temperature(di);
|
||||
if (di->regs[BQ27XXX_REG_TTE] != INVALID_REG_ADDR)
|
||||
cache.time_to_empty = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTE);
|
||||
if (di->regs[BQ27XXX_REG_TTECP] != INVALID_REG_ADDR)
|
||||
cache.time_to_empty_avg = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTECP);
|
||||
if (di->regs[BQ27XXX_REG_TTF] != INVALID_REG_ADDR)
|
||||
cache.time_to_full = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTF);
|
||||
|
||||
cache.charge_full = bq27xxx_battery_read_fcc(di);
|
||||
cache.capacity = bq27xxx_battery_read_soc(di);
|
||||
if (di->regs[BQ27XXX_REG_AE] != INVALID_REG_ADDR)
|
||||
cache.energy = bq27xxx_battery_read_energy(di);
|
||||
di->cache.flags = cache.flags;
|
||||
cache.health = bq27xxx_battery_read_health(di);
|
||||
if (di->regs[BQ27XXX_REG_CYCT] != INVALID_REG_ADDR)
|
||||
cache.cycle_count = bq27xxx_battery_read_cyct(di);
|
||||
|
||||
/*
|
||||
* On gauges with signed current reporting the current must be
|
||||
@ -2038,18 +2052,16 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
|
||||
ret = bq27xxx_battery_capacity_level(di, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TEMP:
|
||||
ret = bq27xxx_simple_value(di->cache.temperature, val);
|
||||
if (ret == 0)
|
||||
val->intval -= 2731; /* convert decidegree k to c */
|
||||
ret = bq27xxx_battery_read_temperature(di, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
|
||||
ret = bq27xxx_simple_value(di->cache.time_to_empty, val);
|
||||
ret = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTE, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
|
||||
ret = bq27xxx_simple_value(di->cache.time_to_empty_avg, val);
|
||||
ret = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTECP, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW:
|
||||
ret = bq27xxx_simple_value(di->cache.time_to_full, val);
|
||||
ret = bq27xxx_battery_read_time(di, BQ27XXX_REG_TTF, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TECHNOLOGY:
|
||||
if (di->opts & BQ27XXX_O_MUL_CHEM)
|
||||
@ -2059,12 +2071,12 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGE_NOW:
|
||||
if (di->regs[BQ27XXX_REG_NAC] != INVALID_REG_ADDR)
|
||||
ret = bq27xxx_simple_value(bq27xxx_battery_read_nac(di), val);
|
||||
ret = bq27xxx_battery_read_nac(di, val);
|
||||
else
|
||||
ret = bq27xxx_simple_value(bq27xxx_battery_read_rc(di), val);
|
||||
ret = bq27xxx_battery_read_rc(di, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGE_FULL:
|
||||
ret = bq27xxx_simple_value(di->cache.charge_full, val);
|
||||
ret = bq27xxx_battery_read_fcc(di, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
|
||||
ret = bq27xxx_battery_read_dcap(di, val);
|
||||
@ -2077,16 +2089,16 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
|
||||
case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
|
||||
return -EINVAL;
|
||||
case POWER_SUPPLY_PROP_CYCLE_COUNT:
|
||||
ret = bq27xxx_simple_value(di->cache.cycle_count, val);
|
||||
ret = bq27xxx_battery_read_cyct(di, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_ENERGY_NOW:
|
||||
ret = bq27xxx_simple_value(di->cache.energy, val);
|
||||
ret = bq27xxx_battery_read_energy(di, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_POWER_AVG:
|
||||
ret = bq27xxx_battery_pwr_avg(di, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_HEALTH:
|
||||
ret = bq27xxx_simple_value(di->cache.health, val);
|
||||
ret = bq27xxx_battery_read_health(di, val);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_MANUFACTURER:
|
||||
val->strval = BQ27XXX_MANUFACTURER;
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Copyright 2020 Google LLC.
|
||||
*/
|
||||
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/platform_data/cros_ec_commands.h>
|
||||
@ -367,16 +368,22 @@ static int __maybe_unused cros_pchg_resume(struct device *dev)
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(cros_pchg_pm_ops, NULL, cros_pchg_resume);
|
||||
|
||||
static const struct platform_device_id cros_pchg_id[] = {
|
||||
{ DRV_NAME, 0 },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, cros_pchg_id);
|
||||
|
||||
static struct platform_driver cros_pchg_driver = {
|
||||
.driver = {
|
||||
.name = DRV_NAME,
|
||||
.pm = &cros_pchg_pm_ops,
|
||||
},
|
||||
.probe = cros_pchg_probe
|
||||
.probe = cros_pchg_probe,
|
||||
.id_table = cros_pchg_id,
|
||||
};
|
||||
|
||||
module_platform_driver(cros_pchg_driver);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("ChromeOS EC peripheral device charger");
|
||||
MODULE_ALIAS("platform:" DRV_NAME);
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Copyright (c) 2014 - 2018 Google, Inc
|
||||
*/
|
||||
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_data/cros_ec_commands.h>
|
||||
#include <linux/platform_data/cros_ec_proto.h>
|
||||
@ -711,16 +712,22 @@ static int cros_usbpd_charger_resume(struct device *dev)
|
||||
static SIMPLE_DEV_PM_OPS(cros_usbpd_charger_pm_ops, NULL,
|
||||
cros_usbpd_charger_resume);
|
||||
|
||||
static const struct platform_device_id cros_usbpd_charger_id[] = {
|
||||
{ DRV_NAME, 0 },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, cros_usbpd_charger_id);
|
||||
|
||||
static struct platform_driver cros_usbpd_charger_driver = {
|
||||
.driver = {
|
||||
.name = DRV_NAME,
|
||||
.pm = &cros_usbpd_charger_pm_ops,
|
||||
},
|
||||
.probe = cros_usbpd_charger_probe
|
||||
.probe = cros_usbpd_charger_probe,
|
||||
.id_table = cros_usbpd_charger_id,
|
||||
};
|
||||
|
||||
module_platform_driver(cros_usbpd_charger_driver);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("ChromeOS EC USBPD charger");
|
||||
MODULE_ALIAS("platform:" DRV_NAME);
|
||||
|
@ -271,23 +271,6 @@ static ssize_t power_supply_show_usb_type(struct device *dev,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t power_supply_show_charge_behaviour(struct device *dev,
|
||||
struct power_supply *psy,
|
||||
union power_supply_propval *value,
|
||||
char *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = power_supply_get_property(psy,
|
||||
POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR,
|
||||
value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return power_supply_charge_behaviour_show(dev, psy->desc->charge_behaviours,
|
||||
value->intval, buf);
|
||||
}
|
||||
|
||||
static ssize_t power_supply_show_property(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf) {
|
||||
@ -321,7 +304,8 @@ static ssize_t power_supply_show_property(struct device *dev,
|
||||
&value, buf);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR:
|
||||
ret = power_supply_show_charge_behaviour(dev, psy, &value, buf);
|
||||
ret = power_supply_charge_behaviour_show(dev, psy->desc->charge_behaviours,
|
||||
value.intval, buf);
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER:
|
||||
ret = sysfs_emit(buf, "%s\n", value.strval);
|
||||
|
@ -35,6 +35,8 @@ static int battery_capacity = 50;
|
||||
static int battery_voltage = 3300;
|
||||
static int battery_charge_counter = -1000;
|
||||
static int battery_current = -1600;
|
||||
static enum power_supply_charge_behaviour battery_charge_behaviour =
|
||||
POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO;
|
||||
|
||||
static bool module_initialized;
|
||||
|
||||
@ -123,6 +125,9 @@ static int test_power_get_battery_property(struct power_supply *psy,
|
||||
case POWER_SUPPLY_PROP_CURRENT_NOW:
|
||||
val->intval = battery_current;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR:
|
||||
val->intval = battery_charge_behaviour;
|
||||
break;
|
||||
default:
|
||||
pr_info("%s: some properties deliberately report errors.\n",
|
||||
__func__);
|
||||
@ -131,6 +136,31 @@ static int test_power_get_battery_property(struct power_supply *psy,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_power_battery_property_is_writeable(struct power_supply *psy,
|
||||
enum power_supply_property psp)
|
||||
{
|
||||
return psp == POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR;
|
||||
}
|
||||
|
||||
static int test_power_set_battery_property(struct power_supply *psy,
|
||||
enum power_supply_property psp,
|
||||
const union power_supply_propval *val)
|
||||
{
|
||||
switch (psp) {
|
||||
case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR:
|
||||
if (val->intval < 0 ||
|
||||
val->intval >= BITS_PER_TYPE(typeof(psy->desc->charge_behaviours)) ||
|
||||
!(BIT(val->intval) & psy->desc->charge_behaviours)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
battery_charge_behaviour = val->intval;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static enum power_supply_property test_power_ac_props[] = {
|
||||
POWER_SUPPLY_PROP_ONLINE,
|
||||
};
|
||||
@ -156,6 +186,7 @@ static enum power_supply_property test_power_battery_props[] = {
|
||||
POWER_SUPPLY_PROP_VOLTAGE_NOW,
|
||||
POWER_SUPPLY_PROP_CURRENT_AVG,
|
||||
POWER_SUPPLY_PROP_CURRENT_NOW,
|
||||
POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR,
|
||||
};
|
||||
|
||||
static char *test_power_ac_supplied_to[] = {
|
||||
@ -178,6 +209,11 @@ static const struct power_supply_desc test_power_desc[] = {
|
||||
.properties = test_power_battery_props,
|
||||
.num_properties = ARRAY_SIZE(test_power_battery_props),
|
||||
.get_property = test_power_get_battery_property,
|
||||
.set_property = test_power_set_battery_property,
|
||||
.property_is_writeable = test_power_battery_property_is_writeable,
|
||||
.charge_behaviours = BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO)
|
||||
| BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_INHIBIT_CHARGE)
|
||||
| BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_FORCE_DISCHARGE),
|
||||
},
|
||||
[TEST_USB] = {
|
||||
.name = "test_usb",
|
||||
|
@ -47,16 +47,8 @@ struct bq27xxx_access_methods {
|
||||
};
|
||||
|
||||
struct bq27xxx_reg_cache {
|
||||
int temperature;
|
||||
int time_to_empty;
|
||||
int time_to_empty_avg;
|
||||
int time_to_full;
|
||||
int charge_full;
|
||||
int cycle_count;
|
||||
int capacity;
|
||||
int energy;
|
||||
int flags;
|
||||
int health;
|
||||
};
|
||||
|
||||
struct bq27xxx_device_info {
|
||||
|
Loading…
x
Reference in New Issue
Block a user