From 5d0eed59107d458d92183660ebf4b15c25f5aad7 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Fri, 27 May 2022 03:07:54 +0200
Subject: [PATCH 331/463] 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 e0e5ed0e3d2a9..9323666491db7 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.46.0

