* [PATCH] power: supply: max77693: Fix wrong conversion of charge input threshold value
@ 2025-03-16 20:11 Artur Weber
2025-03-17 7:37 ` Krzysztof Kozlowski
2025-03-17 15:21 ` Sebastian Reichel
0 siblings, 2 replies; 3+ messages in thread
From: Artur Weber @ 2025-03-16 20:11 UTC (permalink / raw)
To: Krzysztof Kozlowski, Sebastian Reichel
Cc: linux-pm, linux-kernel, ~postmarketos/upstreaming, Artur Weber
The charge input threshold voltage register on the MAX77693 PMIC accepts
four values: 0x0 for 4.3v, 0x1 for 4.7v, 0x2 for 4.8v and 0x3 for 4.9v.
Due to an oversight, the driver calculated the values for 4.7v and above
starting from 0x0, rather than from 0x1 ([(4700000 - 4700000) / 100000]
gives 0).
Add 1 to the calculation to ensure that 4.7v is converted to a register
value of 0x1 and that the other two voltages are converted correctly as
well.
Fixes: 87c2d9067893 ("power: max77693: Add charger driver for Maxim 77693")
Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
The charge input threshold voltage register on the MAX77693 PMIC accepts
four values: 0x0 for 4.3v, 0x1 for 4.7v, 0x2 for 4.8v and 0x3 for 4.9v.
Due to an oversight, the driver calculated the values for 4.7v and above
starting from 0x0, rather than from 0x1 ([(4700000 - 4700000) / 100000]
gives 0).
Add 1 to the calculation to ensure that 4.7v is converted to a register
value of 0x1 and that the other two voltages are converted correctly as
well.
Fixes: 87c2d9067893 ("power: max77693: Add charger driver for Maxim 77693")
---
drivers/power/supply/max77693_charger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c
index cdea35c0d1de1111311d198d042bfa5b10da52b7..027d6a539b65a2fe423f90bab27d705a8145f7e7 100644
--- a/drivers/power/supply/max77693_charger.c
+++ b/drivers/power/supply/max77693_charger.c
@@ -608,7 +608,7 @@ static int max77693_set_charge_input_threshold_volt(struct max77693_charger *chg
case 4700000:
case 4800000:
case 4900000:
- data = (uvolt - 4700000) / 100000;
+ data = ((uvolt - 4700000) / 100000) + 1;
break;
default:
dev_err(chg->dev, "Wrong value for charge input voltage regulation threshold\n");
---
base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04
change-id: 20250316-max77693-charger-input-threshold-fix-992f56783586
Best regards,
--
Artur Weber <aweber.kernel@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: max77693: Fix wrong conversion of charge input threshold value
2025-03-16 20:11 [PATCH] power: supply: max77693: Fix wrong conversion of charge input threshold value Artur Weber
@ 2025-03-17 7:37 ` Krzysztof Kozlowski
2025-03-17 15:21 ` Sebastian Reichel
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-17 7:37 UTC (permalink / raw)
To: Artur Weber, Sebastian Reichel
Cc: linux-pm, linux-kernel, ~postmarketos/upstreaming
On 16/03/2025 21:11, Artur Weber wrote:
> The charge input threshold voltage register on the MAX77693 PMIC accepts
> four values: 0x0 for 4.3v, 0x1 for 4.7v, 0x2 for 4.8v and 0x3 for 4.9v.
> Due to an oversight, the driver calculated the values for 4.7v and above
> starting from 0x0, rather than from 0x1 ([(4700000 - 4700000) / 100000]
> gives 0).
>
> Add 1 to the calculation to ensure that 4.7v is converted to a register
> value of 0x1 and that the other two voltages are converted correctly as
> well.
>
> Fixes: 87c2d9067893 ("power: max77693: Add charger driver for Maxim 77693")
> Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: max77693: Fix wrong conversion of charge input threshold value
2025-03-16 20:11 [PATCH] power: supply: max77693: Fix wrong conversion of charge input threshold value Artur Weber
2025-03-17 7:37 ` Krzysztof Kozlowski
@ 2025-03-17 15:21 ` Sebastian Reichel
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2025-03-17 15:21 UTC (permalink / raw)
To: Krzysztof Kozlowski, Sebastian Reichel, Artur Weber
Cc: linux-pm, linux-kernel, ~postmarketos/upstreaming
On Sun, 16 Mar 2025 21:11:49 +0100, Artur Weber wrote:
> The charge input threshold voltage register on the MAX77693 PMIC accepts
> four values: 0x0 for 4.3v, 0x1 for 4.7v, 0x2 for 4.8v and 0x3 for 4.9v.
> Due to an oversight, the driver calculated the values for 4.7v and above
> starting from 0x0, rather than from 0x1 ([(4700000 - 4700000) / 100000]
> gives 0).
>
> Add 1 to the calculation to ensure that 4.7v is converted to a register
> value of 0x1 and that the other two voltages are converted correctly as
> well.
>
> [...]
Applied, thanks!
[1/1] power: supply: max77693: Fix wrong conversion of charge input threshold value
commit: 30cc7b0d0e9341d419eb7da15fb5c22406dbe499
Best regards,
--
Sebastian Reichel <sebastian.reichel@collabora.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-17 15:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-16 20:11 [PATCH] power: supply: max77693: Fix wrong conversion of charge input threshold value Artur Weber
2025-03-17 7:37 ` Krzysztof Kozlowski
2025-03-17 15:21 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox