diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2011-12-08 02:31:43 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-02-03 23:54:58 +0100 |
commit | 45d9c273b262cde84bb6bb3fc02c01d07da76936 (patch) | |
tree | 67eabe354730dd6e113c5edbced66a0e7e91e7f2 /drivers/hid/hid-input.c | |
parent | Merge tag 'kmemleak-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/c... (diff) | |
download | linux-45d9c273b262cde84bb6bb3fc02c01d07da76936.tar.xz linux-45d9c273b262cde84bb6bb3fc02c01d07da76936.zip |
HID: hid-input/battery: set scope and powered device for HID battery
Set the battery's power supply scope to "Device" and point the power
supply to the powered device.
Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r-- | drivers/hid/hid-input.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 9333d692a786..af0200f061c0 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -279,7 +279,8 @@ static enum power_supply_property hidinput_battery_props[] = { POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_MODEL_NAME, - POWER_SUPPLY_PROP_STATUS + POWER_SUPPLY_PROP_STATUS, + POWER_SUPPLY_PROP_SCOPE, }; #define HID_BATTERY_QUIRK_PERCENT (1 << 0) /* always reports percent */ @@ -344,6 +345,10 @@ static int hidinput_get_battery_property(struct power_supply *psy, val->intval = POWER_SUPPLY_STATUS_DISCHARGING; break; + case POWER_SUPPLY_PROP_SCOPE: + val->intval = POWER_SUPPLY_SCOPE_DEVICE; + break; + default: ret = -EINVAL; break; @@ -403,6 +408,8 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type, battery->name = NULL; } + power_supply_powers(battery, &dev->dev); + out: return true; } |