Skip to content

Commit 0ba68e2

Browse files
committed
battery: ignore cold temp block
1 parent 6d8e3cd commit 0ba68e2

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

drivers/battery_v2/sec_battery.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,6 +2678,7 @@ static bool sec_bat_temperature_check(
26782678
struct sec_battery_info *battery)
26792679
{
26802680
int pre_health = POWER_SUPPLY_HEALTH_GOOD;
2681+
const bool ignore_cold = true;
26812682

26822683
if (battery->status == POWER_SUPPLY_STATUS_DISCHARGING) {
26832684
battery->health_change = false;
@@ -2782,11 +2783,11 @@ static bool sec_bat_temperature_check(
27822783
"%s: recovery count = %d\n",
27832784
__func__, battery->temp_recover_cnt);
27842785
}
2785-
} else if (battery->temperature <= battery->temp_low_threshold) {
2786-
if (battery->health != POWER_SUPPLY_HEALTH_COLD) {
2787-
if (battery->temp_low_cnt <
2788-
battery->pdata->temp_check_count) {
2789-
battery->temp_low_cnt++;
2786+
} else if (!ignore_cold && battery->temperature <= battery->temp_low_threshold) {
2787+
if (battery->health != POWER_SUPPLY_HEALTH_COLD) {
2788+
if (battery->temp_low_cnt <
2789+
battery->pdata->temp_check_count) {
2790+
battery->temp_low_cnt++;
27902791
battery->temp_highlimit_cnt = 0;
27912792
battery->temp_high_cnt = 0;
27922793
battery->temp_recover_cnt = 0;
@@ -2863,8 +2864,8 @@ static bool sec_bat_temperature_check(
28632864
battery->pdata->temp_check_count) {
28642865
battery->health = POWER_SUPPLY_HEALTH_OVERHEAT;
28652866
battery->temp_high_cnt = 0;
2866-
} else if (battery->temp_low_cnt >=
2867-
battery->pdata->temp_check_count) {
2867+
} else if (!ignore_cold && battery->temp_low_cnt >=
2868+
battery->pdata->temp_check_count) {
28682869
battery->health = POWER_SUPPLY_HEALTH_COLD;
28692870
battery->temp_low_cnt = 0;
28702871
} else if (battery->temp_recover_cnt >=
@@ -2885,6 +2886,11 @@ static bool sec_bat_temperature_check(
28852886
battery->health_change = false;
28862887
}
28872888

2889+
if (ignore_cold && battery->health == POWER_SUPPLY_HEALTH_COLD) {
2890+
battery->health = POWER_SUPPLY_HEALTH_GOOD;
2891+
battery->temp_low_cnt = 0;
2892+
}
2893+
28882894
if ((battery->health == POWER_SUPPLY_HEALTH_OVERHEAT) ||
28892895
(battery->health == POWER_SUPPLY_HEALTH_COLD) ||
28902896
(battery->health == POWER_SUPPLY_HEALTH_OVERHEATLIMIT)) {

0 commit comments

Comments
 (0)