* bq24190_charger: no status updates
@ 2015-05-28 9:05 Thomas Elste
2015-05-28 9:05 ` [PATCH] power: bq24190_charger: Change first_time flag reset condition Thomas Elste
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Elste @ 2015-05-28 9:05 UTC (permalink / raw)
To: linux-pm; +Cc: thomas.elste
Hi,
while searching for the cause of charger events not being detected on a
custom board with a BQ24190 charger, I think a found a minor problem in
its driver:
The bq24190_charger driver uses a flag for preventing the first change
in charger status, which is generated by an initial register clear, to
reach power supply subsystem via power_supply_changed. This flag is set
in the probe function and is supposed to be reset after a first status
change. This never happens as the condition for reset depends already
on the flag not being set.
I made a short patch which changes the flags reset condition.
Best regards
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] power: bq24190_charger: Change first_time flag reset condition
2015-05-28 9:05 bq24190_charger: no status updates Thomas Elste
@ 2015-05-28 9:05 ` Thomas Elste
2015-05-29 2:34 ` Sebastian Reichel
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Elste @ 2015-05-28 9:05 UTC (permalink / raw)
To: linux-pm; +Cc: thomas.elste
The initial register reset of BQ24190 generates a charger status change
whose propagation via power_supply_changed is prevented using a flag.
This flag gets never reset so all following events are ignored as well
leading for example to userspace not detecting charger connects/disconnects.
Therefor change the reset condition of first_time flag, so only the
propagation of the first charger status change is prevented.
Signed-off-by: Thomas Elste <thomas.elste@imms.de>
---
drivers/power/bq24190_charger.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/power/bq24190_charger.c b/drivers/power/bq24190_charger.c
index 407c4af..052db78 100644
--- a/drivers/power/bq24190_charger.c
+++ b/drivers/power/bq24190_charger.c
@@ -1258,10 +1258,13 @@ static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
* register reset so we should ignore that one (the very first
* interrupt received).
*/
- if (alert_userspace && !bdi->first_time) {
- power_supply_changed(bdi->charger);
- power_supply_changed(bdi->battery);
- bdi->first_time = false;
+ if (alert_userspace) {
+ if (!bdi->first_time) {
+ power_supply_changed(bdi->charger);
+ power_supply_changed(bdi->battery);
+ } else {
+ bdi->first_time = false;
+ }
}
out:
--
2.0.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] power: bq24190_charger: Change first_time flag reset condition
2015-05-28 9:05 ` [PATCH] power: bq24190_charger: Change first_time flag reset condition Thomas Elste
@ 2015-05-29 2:34 ` Sebastian Reichel
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2015-05-29 2:34 UTC (permalink / raw)
To: Thomas Elste; +Cc: linux-pm
[-- Attachment #1: Type: text/plain, Size: 1508 bytes --]
Hi,
On Thu, May 28, 2015 at 11:05:32AM +0200, Thomas Elste wrote:
> The initial register reset of BQ24190 generates a charger status change
> whose propagation via power_supply_changed is prevented using a flag.
> This flag gets never reset so all following events are ignored as well
> leading for example to userspace not detecting charger connects/disconnects.
>
> Therefor change the reset condition of first_time flag, so only the
> propagation of the first charger status change is prevented.
>
> Signed-off-by: Thomas Elste <thomas.elste@imms.de>
> ---
> drivers/power/bq24190_charger.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/power/bq24190_charger.c b/drivers/power/bq24190_charger.c
> index 407c4af..052db78 100644
> --- a/drivers/power/bq24190_charger.c
> +++ b/drivers/power/bq24190_charger.c
> @@ -1258,10 +1258,13 @@ static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
> * register reset so we should ignore that one (the very first
> * interrupt received).
> */
> - if (alert_userspace && !bdi->first_time) {
> - power_supply_changed(bdi->charger);
> - power_supply_changed(bdi->battery);
> - bdi->first_time = false;
> + if (alert_userspace) {
> + if (!bdi->first_time) {
> + power_supply_changed(bdi->charger);
> + power_supply_changed(bdi->battery);
> + } else {
> + bdi->first_time = false;
> + }
> }
>
> out:
Thanks, queued for 4.2.
-- Sebastian
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-29 2:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-28 9:05 bq24190_charger: no status updates Thomas Elste
2015-05-28 9:05 ` [PATCH] power: bq24190_charger: Change first_time flag reset condition Thomas Elste
2015-05-29 2:34 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).