build/patch/kernel/archive/sunxi-6.5/patches.megous/power-supply-rk818-battery-Speed-up-battery-current-readout.patch

37 lines
1.3 KiB
Diff

From 54457876e78454748a1284f844e053bcabf80532 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Fri, 27 May 2022 03:07:54 +0200
Subject: [PATCH 325/464] power: supply: rk818-battery: Speed up battery
current readout
PMIC does averaging, driver does averaging on top of that averaging,
and it's just too much averaging, and the speed suffers.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/power/supply/rk818_battery.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/power/supply/rk818_battery.c b/drivers/power/supply/rk818_battery.c
index e0e5ed0e3d2a..9323666491db 100644
--- a/drivers/power/supply/rk818_battery.c
+++ b/drivers/power/supply/rk818_battery.c
@@ -903,12 +903,12 @@ int rk818_battery_get_property(struct rk818_battery *di,
{
switch (psp) {
case POWER_SUPPLY_PROP_CURRENT_NOW:
- val->intval = di->current_avg * 1000;/*uA*/
+ val->intval = rk818_bat_get_avg_current(di) * 1000;/*uA*/
if (di->pdata->bat_mode == MODE_VIRTUAL)
val->intval = VIRTUAL_CURRENT * 1000;
break;
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
- val->intval = di->voltage_avg * 1000;/*uV*/
+ val->intval = rk818_bat_get_avg_voltage(di) * 1000;/*uV*/
if (di->pdata->bat_mode == MODE_VIRTUAL)
val->intval = VIRTUAL_VOLTAGE * 1000;
break;
--
2.34.1