From 46a072a7ae48464c18a6f5c7d215141157664582 Mon Sep 17 00:00:00 2001
From: huangcm <1263938474@qq.com>
Date: Fri, 28 Mar 2025 03:34:08 +0000
Subject: [PATCH] feat(battery): fix battery boot on & cap

---
 longan/kernel/linux-4.9/drivers/power/supply/axp803_battery.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/longan/kernel/linux-4.9/drivers/power/supply/axp803_battery.c b/longan/kernel/linux-4.9/drivers/power/supply/axp803_battery.c
index 04f6af3..5f49c60 100644
--- a/longan/kernel/linux-4.9/drivers/power/supply/axp803_battery.c
+++ b/longan/kernel/linux-4.9/drivers/power/supply/axp803_battery.c
@@ -671,8 +671,10 @@
 	}
 
 	regmap_read(map, AXP803_BATCAP0, &val);
-	if ((axp_config->pmu_battery_cap) && (!(val & 0x80))) {
-		cur_coulomb_counter = axp_config->pmu_battery_cap
+	//if ((axp_config->pmu_battery_cap) && (!(val & 0x80))) {
+    // always update from dts
+    if ((axp_config->pmu_battery_cap)) {
+        cur_coulomb_counter = axp_config->pmu_battery_cap
 					* 1000 / 1456;
 		regmap_write(map, AXP803_BATCAP0, ((cur_coulomb_counter >> 8) | 0x80));
 		regmap_write(map, AXP803_BATCAP1, cur_coulomb_counter & 0x00FF);

--
Gitblit v1.6.2