35 lines
1.1 KiB
Diff
35 lines
1.1 KiB
Diff
From ccfcfcd330233db8f186b6040ae8de80f0f8158f Mon Sep 17 00:00:00 2001
|
|
From: Casey Connolly <[email protected]>
|
|
Date: Fri, 20 Jun 2025 14:38:01 +0200
|
|
Subject: [PATCH 30/62] power: supply: qcom_fg: invert charging current
|
|
|
|
battery current should be negative for charging batteries, inevrt it so
|
|
it's correct. Fixes upower charging status reporting.
|
|
|
|
Signed-off-by: Casey Connolly <[email protected]>
|
|
Signed-off-by: Jiali Chen <[email protected]>
|
|
---
|
|
drivers/power/supply/qcom_fg.c | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/drivers/power/supply/qcom_fg.c b/drivers/power/supply/qcom_fg.c
|
|
index 6bfffa97107e..6423b0798ae3 100644
|
|
--- a/drivers/power/supply/qcom_fg.c
|
|
+++ b/drivers/power/supply/qcom_fg.c
|
|
@@ -718,6 +718,12 @@ static int qcom_fg_gen3_get_current(struct qcom_fg_chip *chip, int *val)
|
|
temp = (s16)(readval[1] << 8 | readval[0]);
|
|
*val = div_s64((s64)temp * 488281, 1000);
|
|
|
|
+ /*
|
|
+ * PSY API expects charging batteries to report a positive current, which is inverted
|
|
+ * to what the PMIC reports.
|
|
+ */
|
|
+ *val = -*val;
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
--
|
|
2.47.3
|
|
|