power: supply: max17042_battery: Add external_power_changed callback

If our supplier changes status, chances are we've changed status too,
let any listeners know about this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
This commit is contained in:
Hans de Goede 2017-04-14 20:32:52 +02:00 committed by Sebastian Reichel
parent a9df22c00d
commit dcdddda8fd
1 changed files with 6 additions and 0 deletions

View File

@ -429,6 +429,11 @@ static int max17042_property_is_writeable(struct power_supply *psy,
return ret; return ret;
} }
static void max17042_external_power_changed(struct power_supply *psy)
{
power_supply_changed(psy);
}
static int max17042_write_verify_reg(struct regmap *map, u8 reg, u32 value) static int max17042_write_verify_reg(struct regmap *map, u8 reg, u32 value)
{ {
int retries = 8; int retries = 8;
@ -917,6 +922,7 @@ static const struct power_supply_desc max17042_psy_desc = {
.get_property = max17042_get_property, .get_property = max17042_get_property,
.set_property = max17042_set_property, .set_property = max17042_set_property,
.property_is_writeable = max17042_property_is_writeable, .property_is_writeable = max17042_property_is_writeable,
.external_power_changed = max17042_external_power_changed,
.properties = max17042_battery_props, .properties = max17042_battery_props,
.num_properties = ARRAY_SIZE(max17042_battery_props), .num_properties = ARRAY_SIZE(max17042_battery_props),
}; };