diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2020-05-04 21:47:45 +0200 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2020-05-10 23:41:53 +0200 |
commit | 3b4df57bef695a41a23feb1017263be5f5f8d51c (patch) | |
tree | 348c53bc64a773c0ddc7ee5109bcbc94105efcb4 | |
parent | 21d90eda433f5d39930ca7133340225b8fb7940f (diff) |
power: bq25890: update state on property read
Edge interrupts from the charger may be lost or stuck in fault mode
since probe(). Check if something changed everytime userspace wants
some data.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-rw-r--r-- | drivers/power/supply/bq25890_charger.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index c9f7877ded95..be9de68a3fc2 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -387,6 +387,8 @@ static bool bq25890_is_adc_property(enum power_supply_property psp) } } +static irqreturn_t __bq25890_handle_irq(struct bq25890_device *bq); + static int bq25890_power_supply_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) @@ -397,6 +399,8 @@ static int bq25890_power_supply_get_property(struct power_supply *psy, int ret; mutex_lock(&bq->lock); + /* update state in case we lost an interrupt */ + __bq25890_handle_irq(bq); state = bq->state; do_adc_conv = !state.online && bq25890_is_adc_property(psp); if (do_adc_conv) |