aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2011-12-07 17:31:43 -0800
committerJeremy Fitzhardinge <jeremy@goop.org>2012-01-08 18:54:01 +1100
commit170d4f2846d77a62aac12bf5695b9b46046a4602 (patch)
tree65a853e96cd27c446188749260d476d231d6e66d
parentf9dbd715395137aa46bb67becbf26b789f1199d3 (diff)
hid-input/battery: set scope and powered device for HID batteryhid-battery-scope
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>
-rw-r--r--drivers/hid/hid-input.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 0f1250d10ea14..a9f72f22fadc8 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;
}