[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8dd5ede84b19ca24c0ee7fa00746923650070536.1588621247.git.mirq-linux@rere.qmqm.pl>
Date: Mon, 04 May 2020 21:47:45 +0200
From: Michał Mirosław <mirq-linux@...e.qmqm.pl>
To: Angus Ainslie <angus@...ea.ca>, Rob Herring <robh+dt@...nel.org>,
Sebastian Reichel <sre@...nel.org>,
Yauhen Kharuzhy <jekhor@...il.com>
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: [PATCH v3 3/8] 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@...e.qmqm.pl>
---
drivers/power/supply/bq25890_charger.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 325fdd1b1d23..322d48d28fe5 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)
--
2.20.1
Powered by blists - more mailing lists