Commit 45d9c273 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Jiri Kosina

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: default avatarJeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 7c7ed8ec
...@@ -279,7 +279,8 @@ static enum power_supply_property hidinput_battery_props[] = { ...@@ -279,7 +279,8 @@ static enum power_supply_property hidinput_battery_props[] = {
POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_MODEL_NAME, 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 */ #define HID_BATTERY_QUIRK_PERCENT (1 << 0) /* always reports percent */
...@@ -344,6 +345,10 @@ static int hidinput_get_battery_property(struct power_supply *psy, ...@@ -344,6 +345,10 @@ static int hidinput_get_battery_property(struct power_supply *psy,
val->intval = POWER_SUPPLY_STATUS_DISCHARGING; val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
break; break;
case POWER_SUPPLY_PROP_SCOPE:
val->intval = POWER_SUPPLY_SCOPE_DEVICE;
break;
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -403,6 +408,8 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type, ...@@ -403,6 +408,8 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
battery->name = NULL; battery->name = NULL;
} }
power_supply_powers(battery, &dev->dev);
out: out:
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment