mtk 手机低电无法关机,电池容量一直显示1%
2019-04-14 17:32发布
生成海报
mtk 手机低电无法关机,电池容量一直显示1%
[DESCRIPTION]
手机低电无法关机,电池容量一直显示1%,但是kernel log中可以看到soc = 0;vbat 已经小于3.4V。
[SOLUTION]
修改mt_battery_update_EM()函数:
#ifdef CONFIG_MTK_DISABLE_POWER_ON_OFF_VOLTAGE_LIMITATION
//if (bat_data->BAT_CAPACITY <= 0)
//bat_data->BAT_CAPACITY = 1;
//battery_log(BAT_LOG_CRTI,
//"BAT_CAPACITY=1, due to define CONFIG_MTK_DISABLE_POWER_ON_OFF_VOLTAGE_LIMITATION
");
#endif
/* Tracking TIME */
#define ONEHUNDRED_PERCENT_TRACKING_TIME 10 /* 10 second*/
#define NPERCENT_TRACKING_TIME 20 /* 20 second*/
#define SYNC_TO_REAL_TRACKING_TIME 60 /* 60 second*/
#define V_0PERCENT_TRACKING 3400 /*3400mV*/
int __batt_init_cust_data_from_cust_header(void)
{
#if defined(V_0PERCENT_TRACKING)
//#define V_0PERCENT_TRACKING 3400 /*3400mV*/
batt_cust_data.v_0percent_tracking = V_0PERCENT_TRACKING;
#endif
}
static int battery_probe(struct platform_device *dev)
|
kthread_run(bat_thread_kthread, NULL, "bat_thread_kthread");
int bat_thread_kthread(void *x)
|
BAT_thread();
void BAT_thread(void)
|
mt_battery_update_status();
static void mt_battery_update_status(void)
|
battery_update(&battery_main);
static void battery_update(struct battery_data *bat_data)
static void battery_update(struct battery_data *bat_data)
{
#ifdef SOC_BY_HW_FG
if (BMT_status.ZCV <= batt_cust_data.v_0percent_tracking)
#else
//#define V_0PERCENT_TRACKING 3400 /*3400mV*/
if (BMT_status.bat_vol <= batt_cust_data.v_0percent_tracking)
#endif
// modifiled end >>>//BMT_status.bat_vol低于3.4v进去判断到达0%检测函数
resetBatteryMeter = mt_battery_0Percent_tracking_check();
static kal_bool mt_battery_0Percent_tracking_check(void)
{
//#define SYSTEM_OFF_VOLTAGE (3400)
if (BMT_status.bat_vol > SYSTEM_OFF_VOLTAGE && BMT_status.UI_SOC > 1)
BMT_status.UI_SOC--;
else if (BMT_status.bat_vol <= SYSTEM_OFF_VOLTAGE)
BMT_status.UI_SOC--;
}
else
resetBatteryMeter = mt_battery_100Percent_tracking_check();
//电池容量一直显示1%,但是kernel log中可以看到soc = 0
mt_battery_update_EM(bat_data);
static void mt_battery_update_EM(struct battery_data *bat_data)
{
#ifdef CONFIG_MTK_DISABLE_POWER_ON_OFF_VOLTAGE_LIMITATION
if (bat_data->BAT_CAPACITY <= 0)
bat_data->BAT_CAPACITY = 1;
battery_log(BAT_LOG_CRTI,
"BAT_CAPACITY=1, due to define CONFIG_MTK_DISABLE_POWER_ON_OFF_VOLTAGE_LIMITATION
");
#endif
}
}
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮