From 1543e317f1da31b75942316931e8f491a8920811 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Thu, 04 Jan 2024 10:08:02 +0000
Subject: [PATCH] disable FB
---
kernel/drivers/power/supply/rk817_battery.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/kernel/drivers/power/supply/rk817_battery.c b/kernel/drivers/power/supply/rk817_battery.c
index 6979531..f6d4345 100644
--- a/kernel/drivers/power/supply/rk817_battery.c
+++ b/kernel/drivers/power/supply/rk817_battery.c
@@ -651,6 +651,9 @@
u8 i;
u16 d;
+ if (size < 2)
+ return 0;
+
for (i = 0; i < size; i++) {
if (value < table[i])
break;
@@ -1599,6 +1602,9 @@
battery->pwron_voltage) * 1000;/* uAH */
battery->dsoc = battery->rsoc;
battery->fcc = battery->pdata->design_capacity;
+ if (battery->fcc < MIN_FCC)
+ battery->fcc = MIN_FCC;
+
battery->nac = rk817_bat_vol_to_cap(battery, battery->pwron_voltage);
rk817_bat_update_qmax(battery, battery->qmax);
@@ -1801,7 +1807,7 @@
}
pdata->ocv_size = length / sizeof(u32);
- if (pdata->ocv_size <= 0) {
+ if (pdata->ocv_size < 2) {
dev_err(dev, "invalid ocv table\n");
return -EINVAL;
}
@@ -2773,6 +2779,8 @@
finish_sec = base2sec(battery->finish_base);
soc_sec = battery->fcc * 3600 / 100 / DIV(finish_current);
+ if (soc_sec == 0)
+ soc_sec = 1;
plus_soc = finish_sec / DIV(soc_sec);
if (finish_sec > soc_sec) {
rest = finish_sec % soc_sec;
--
Gitblit v1.6.2