mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
power: supply: bd71828: Fix current direction
Both the current and the average current registers contain same
'direction' -bit to denote the direction of the current. The code
reading these registers incorrectly caches the direction read from the
first register, and uses it also for the second.
Fix this by initializing the direction bit for both register reads.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Fixes: 5bff79dad2 ("power: supply: Add bd718(15/28/78) charger driver")
Tested-by: Andreas Kemnade <andreas@kemnade.info> # Kobo Clara 2e rev B
Tested-by: Kalle Niemi <kaleposti@gmail.com>
Link: https://patch.msgid.link/22c6816204b3f2a8b50df8171e384937822d195b.1786356145.git.mazziesaccount@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
c15f0eabec
commit
d012fab12f
|
|
@ -192,12 +192,13 @@ static int bd71828_get_current_ds_adc(struct bd71828_power *pwr, int *curr, int
|
|||
{
|
||||
__be16 tmp_curr;
|
||||
char *tmp = (char *)&tmp_curr;
|
||||
int dir = 1;
|
||||
int regs[] = { pwr->regs->ibat, pwr->regs->ibat_avg };
|
||||
int *vals[] = { curr, curr_avg };
|
||||
int ret, i;
|
||||
|
||||
for (dir = 1, i = 0; i < ARRAY_SIZE(regs); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(regs); i++) {
|
||||
int dir = 1;
|
||||
|
||||
ret = regmap_bulk_read(pwr->regmap, regs[i], &tmp_curr,
|
||||
sizeof(tmp_curr));
|
||||
if (ret)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user