diff options
author | Jason Gerecke <killertofu@gmail.com> | 2017-04-28 19:25:33 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-05-05 22:46:10 +0300 |
commit | 16e4598905a9d7793350ffad2f627b3dfdb7b595 (patch) | |
tree | 6ca0b77aa2c2c093376cd163ec2fe57c34d96372 /drivers/hid/wacom_sys.c | |
parent | a7758702879e68d221cf6dd9844bf5b2a070c8cb (diff) | |
download | linux-16e4598905a9d7793350ffad2f627b3dfdb7b595.tar.xz |
HID: wacom: Add ability to provide explicit battery status info
At the moment, our driver relies on 'wacom_battery_get_property()' to
determine the most likely battery state (e.g charging, discharging, or
full) based on the information available. It is not always possible
for the function to properly determine this, however. For instance,
whenever an AES pen leaves proximity the battery state becomes
indeterminite. This commit adds the ability to provide it with explict
state information if desired. Whenever explicit state is not required
(the majority of circumstances), WACOM_POWER_SUPPLY_STATUS_AUTO can
be used in its place.
Three uses of explicit battery status are added: two wireless disconnect
paths and the AES case mentioned above.
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/wacom_sys.c')
-rw-r--r-- | drivers/hid/wacom_sys.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 0022c0dac88a..838c1ebfffa9 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1547,7 +1547,9 @@ static int wacom_battery_get_property(struct power_supply *psy, val->intval = battery->battery_capacity; break; case POWER_SUPPLY_PROP_STATUS: - if (battery->bat_charging) + if (battery->bat_status != WACOM_POWER_SUPPLY_STATUS_AUTO) + val->intval = battery->bat_status; + else if (battery->bat_charging) val->intval = POWER_SUPPLY_STATUS_CHARGING; else if (battery->battery_capacity == 100 && battery->ps_connected) |