mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
power: bq24735-charger: Assume not charging when charger is missing
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> Signed-off-by: Sebastian Reichel <sre@kernel.org>
This commit is contained in:
parent
1c4593edbd
commit
ae0f74be6e
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user