Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1471419
| From | Paul Kocialkowski <contact@paulk.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] power: bq24735-charger: Assume not charging when charger is missing |
| Date | 2016-08-28 19:50 +0200 |
| Message-ID | <sbcnw-4H8-35@gated-at.bofh.it> (permalink) |
| References | <sbcnw-4H8-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
When the charger is missing (disconnected), it is safe to assume that
the charger chip is no charging.
This is especially relevant when a status GPIO is present and the
charger is getting disconnected. bq24735_charger_is_charging will be
triggered due to the interrupt then, it will attempt to read whether it
is charging through i2c, which will fail as the charger is disconnected.
This also fixes that specific issue.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
drivers/power/bq24735-charger.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/power/bq24735-charger.c b/drivers/power/bq24735-charger.c
index 361a047..0b5b247 100644
--- a/drivers/power/bq24735-charger.c
+++ b/drivers/power/bq24735-charger.c
@@ -201,8 +201,12 @@ static bool bq24735_charger_is_present(struct bq24735 *charger)
static int bq24735_charger_is_charging(struct bq24735 *charger)
{
- int ret = bq24735_read_word(charger->client, BQ24735_CHG_OPT);
+ int ret;
+
+ if (!bq24735_charger_is_present(charger))
+ return 0;
+ ret = bq24735_read_word(charger->client, BQ24735_CHG_OPT);
if (ret < 0)
return ret;
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/2] power: bq24735-charger: Request status GPIO with initial input setup Paul Kocialkowski <contact@paulk.fr> - 2016-08-28 19:50 +0200
[PATCH 2/2] power: bq24735-charger: Assume not charging when charger is missing Paul Kocialkowski <contact@paulk.fr> - 2016-08-28 19:50 +0200
Re: [PATCH 2/2] power: bq24735-charger: Assume not charging when charger is missing Sebastian Reichel <sre@kernel.org> - 2016-08-29 02:50 +0200
Re: [PATCH 1/2] power: bq24735-charger: Request status GPIO with initial input setup Sebastian Reichel <sre@kernel.org> - 2016-08-29 02:40 +0200
Re: [PATCH 1/2] power: bq24735-charger: Request status GPIO with initial input setup Paul Kocialkowski <contact@paulk.fr> - 2016-08-29 20:20 +0200
csiph-web