<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          SWT 重啟案例分析(三)

          共 5727字,需瀏覽 12分鐘

           ·

          2020-10-25 16:46

          和你一起終身學(xué)習(xí),這里是程序員Android

          經(jīng)典好文推薦,通過閱讀本文,您將收獲以下知識點:

          一、高溫觸發(fā) Kernel Exception 重啟問題
          二、解決方案
          三、提高電池溫度方案

          一、 高溫觸發(fā) Kernel Exception 重啟問題

          手機 電池溫度 默認60度以上高溫會觸發(fā)手機安全機制,讓手機管家或者重啟。

          由溫度異常導(dǎo)致手機重啟的部分?Log?如下:

          高溫情況下,Kernel Exception引起的重啟問題

          二、解決方案

          此問題 需要驅(qū)動同事修改底層battery.c?文件中的一個地址,不讓其寫為dead,就不會重啟?;蛘咛岣唠姵販囟葏?shù)。

          三、提高電池溫度方案

          提高電池溫度的方案如下:

          1.修改mtk_battery_table.h

          /alps/kernel-4.4/drivers/misc/mediatek/include/mt-plat/mt6739/include/mach/mtk_battery_table.h

            * ============================================================

          */

          +//#define SPROCOMM_NTC //wang add

          +#ifdef SPROCOMM_NTC

          +#define NTC_COMP_RES 42

          +#endif

          +

          /* Qmax for battery */

          #define Q_MAX_L_CURRENT 0

          #define Q_MAX_H_CURRENT 10000

          @@ [-111,7](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/misc/mediatek/include/mt-plat/mt6739/include/mach/mtk_battery_table.h;h=7cb7b5e7e735a1907b941a6df5755c582ffca0ac;hb=7cb7b5e7e735a1907b941a6df5755c582ffca0ac#l111) [+116,8](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/misc/mediatek/include/mt-plat/mt6739/include/mach/mtk_battery_table.h;h=76ef73904571e7abf677cf9b73783b52131c467a;hb=76ef73904571e7abf677cf9b73783b52131c467a#l116) @@ int g_QMAX_SYS_VOL_T4[TOTAL_BATTERY_NUMBER] = {36000, 36010, 36020, 36030};

          #define BIF_NTC_R 16000

          #if (BAT_NTC_10 == 1)

          -struct FUELGAUGE_TEMPERATURE Fg_Temperature_Table[21] = {

          +#define NTC_NUM 25 //wang add 20180528

          +struct FUELGAUGE_TEMPERATURE Fg_Temperature_Table[NTC_NUM] = {

          {-40, 195652},

          {-35, 148171},

          {-30, 113347},

          @@ [-132,12](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/misc/mediatek/include/mt-plat/mt6739/include/mach/mtk_battery_table.h;h=7cb7b5e7e735a1907b941a6df5755c582ffca0ac;hb=7cb7b5e7e735a1907b941a6df5755c582ffca0ac#l132) [+138,17](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/misc/mediatek/include/mt-plat/mt6739/include/mach/mtk_battery_table.h;h=76ef73904571e7abf677cf9b73783b52131c467a;hb=76ef73904571e7abf677cf9b73783b52131c467a#l138) @@ struct FUELGAUGE_TEMPERATURE Fg_Temperature_Table[21] = {

          {45, 4917},

          {50, 4161},

          {55, 3535},

          - {60, 3014}

          + {60, 3014},

          + {65, 2586},

          + {70, 2228},

          + {75, 1925},

          + {80, 1669}

          };

          #endif

          #if (BAT_NTC_47 == 1)

          -struct FUELGAUGE_TEMPERATURE Fg_Temperature_Table[21] = {

          +#define NTC_NUM 21 //wang add 20180528

          +struct FUELGAUGE_TEMPERATURE Fg_Temperature_Table[NTC_NUM] = {

          {-40, 1747920},

          {-35, 1245428},

          {-30, 898485},

          2. 修改mtk_ts_battery.c

          /alps/kernel-4.4/drivers/misc/mediatek/thermal/common/thermal_zones/mtk_ts_battery.c

          @@ [-134,7](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/misc/mediatek/thermal/common/thermal_zones/mtk_ts_battery.c;h=f807c7272f610a9e61307eaebe0057ee0f157490;hb=f807c7272f610a9e61307eaebe0057ee0f157490#l134) [+134,7](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/misc/mediatek/thermal/common/thermal_zones/mtk_ts_battery.c;h=e201c1fc84ba09e04f8d53a5ca11993848df1feb;hb=e201c1fc84ba09e04f8d53a5ca11993848df1feb#l134) @@ static int bat_temp = 21234;

          /* static int battery_write_flag=0; */

          -#define mtktsbattery_TEMP_CRIT 60000 /* 60.000 degree Celsius */

          +#define mtktsbattery_TEMP_CRIT 80000 /* 60.000 degree Celsius */ //wang add 20180528

          #define mtktsbattery_dprintk(fmt, args...) \

          do { \

          @@ [-455,8](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/misc/mediatek/thermal/common/thermal_zones/mtk_ts_battery.c;h=f807c7272f610a9e61307eaebe0057ee0f157490;hb=f807c7272f610a9e61307eaebe0057ee0f157490#l455) [+455,8](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/misc/mediatek/thermal/common/thermal_zones/mtk_ts_battery.c;h=e201c1fc84ba09e04f8d53a5ca11993848df1feb;hb=e201c1fc84ba09e04f8d53a5ca11993848df1feb#l455) @@ static int tsbat_sysrst_set_cur_state(struct thermal_cooling_device *cdev, unsig

          pr_debug("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");

          pr_debug("*****************************************");

          pr_debug("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");

          -

          - *(unsigned int *)0x0 = 0xdead; /* To trigger data abort to reset the system for thermal protection. */

          + //wang add 20180528

          + //*(unsigned int *)0x0 = 0xdead; /* To trigger data abort to reset the system for thermal protection. */

          }

          return 0;

          }

          3. 修改 mtk_battery.c

          alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery.c

          @@ [-2041,15](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery.c;h=424147210393fd33fb205b40414683f5549b3cc2;hb=424147210393fd33fb205b40414683f5549b3cc2#l2041) [+2041,15](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery.c;h=97a739dc0bbddd02b32c85c1c99da6006e81e746;hb=97a739dc0bbddd02b32c85c1c99da6006e81e746#l2041) @@ unsigned int TempConverBattThermistor(int temp)

          int i;

          unsigned int TBatt_R_Value = 0xffff;

          - if (temp >= Fg_Temperature_Table[20].BatteryTemp) {

          - TBatt_R_Value = Fg_Temperature_Table[20].TemperatureR;

          + if (temp >= Fg_Temperature_Table[NTC_NUM - 1].BatteryTemp) {

          + TBatt_R_Value = Fg_Temperature_Table[NTC_NUM - 1].TemperatureR;

          } else if (temp <= Fg_Temperature_Table[0].BatteryTemp) {

          TBatt_R_Value = Fg_Temperature_Table[0].TemperatureR;

          } else {

          RES1 = Fg_Temperature_Table[0].TemperatureR;

          TMP1 = Fg_Temperature_Table[0].BatteryTemp;

          - for (i = 0; i <= 20; i++) {

          + for (i = 0; i < NTC_NUM; i++) {

          if (temp <= Fg_Temperature_Table[i].BatteryTemp) {

          RES2 = Fg_Temperature_Table[i].TemperatureR;

          TMP2 = Fg_Temperature_Table[i].BatteryTemp;

          @@ [-2078,13](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery.c;h=424147210393fd33fb205b40414683f5549b3cc2;hb=424147210393fd33fb205b40414683f5549b3cc2#l2078) [+2078,13](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery.c;h=97a739dc0bbddd02b32c85c1c99da6006e81e746;hb=97a739dc0bbddd02b32c85c1c99da6006e81e746#l2078) @@ int BattThermistorConverTemp(int Res)

          if (Res >= Fg_Temperature_Table[0].TemperatureR) {

          TBatt_Value = -40;

          - } else if (Res <= Fg_Temperature_Table[20].TemperatureR) {

          - TBatt_Value = 60;

          + } else if (Res <= Fg_Temperature_Table[NTC_NUM - 1].TemperatureR) {

          + TBatt_Value = 80;

          } else {

          RES1 = Fg_Temperature_Table[0].TemperatureR;

          TMP1 = Fg_Temperature_Table[0].BatteryTemp;

          - for (i = 0; i <= 20; i++) {

          + for (i = 0; i < (NTC_NUM - 1); i++) {

          if (Res >= Fg_Temperature_Table[i].TemperatureR) {

          RES2 = Fg_Temperature_Table[i].TemperatureR;

          TMP2 = Fg_Temperature_Table[i].BatteryTemp;

          @@ [-2098,7](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery.c;h=424147210393fd33fb205b40414683f5549b3cc2;hb=424147210393fd33fb205b40414683f5549b3cc2#l2098) [+2098,7](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery.c;h=97a739dc0bbddd02b32c85c1c99da6006e81e746;hb=97a739dc0bbddd02b32c85c1c99da6006e81e746#l2098) @@ int BattThermistorConverTemp(int Res)

          TBatt_Value = (((Res - RES2) * TMP1) + ((RES1 - Res) * TMP2)) / (RES1 - RES2);

          }

          - bm_trace("[BattThermistorConverTemp] %d %d %d %d %d %d\n", RES1, RES2, Res, TMP1, TMP2, TBatt_Value);

          + bm_trace("[BattThermistorConverTemp] %d %d %d %d %d %d, wwwwwNTC_NUM = %d\n", RES1, RES2, Res, TMP1, TMP2, TBatt_Value, NTC_NUM);

          return TBatt_Value;

          }

          @@ [-2334,8](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery.c;h=424147210393fd33fb205b40414683f5549b3cc2;hb=424147210393fd33fb205b40414683f5549b3cc2#l2334) [+2334,8](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery.c;h=97a739dc0bbddd02b32c85c1c99da6006e81e746;hb=97a739dc0bbddd02b32c85c1c99da6006e81e746#l2334) @@ int force_get_tbat(bool update)

          bat_temperature_val = force_get_tbat_internal(update);

          - while (counts < 5 && bat_temperature_val >= 60) {

          - bm_err("[force_get_tbat]over60 count=%d, bat_temp=%d\n", counts, bat_temperature_val);

          + while (counts < 5 && bat_temperature_val >= 80) {//wang submit 20180524

          + bm_err("[force_get_tbat]over80 count=%d, bat_temp=%d\n", counts, bat_temperature_val);

          bat_temperature_val = force_get_tbat_internal(true);

          counts++;

          }

          4.修改 mtk_battery_internal.h

          alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery_internal.h

          @@ [-34,7](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery_internal.h;h=6c2293cbfad5a14e479c095779d82e88d1032bcb;hb=6c2293cbfad5a14e479c095779d82e88d1032bcb#l34) [+34,7](http://192.168.11.104/gitweb/?p=alps-mp-o1.mp1-V1.git;a=blob;f=alps/kernel-4.4/drivers/power/mediatek/battery/mtk_battery_internal.h;h=304fc84470f8bdfdece2439cc5376b15c0b4dfba;hb=304fc84470f8bdfdece2439cc5376b15c0b4dfba#l34) @@

          #define SHUTDOWN_TIME 40

          #define AVGVBAT_ARRAY_SIZE 30

          #define INIT_VOLTAGE 3450

          -#define BATTERY_SHUTDOWN_TEMPERATURE 60

          +#define BATTERY_SHUTDOWN_TEMPERATURE 80

          /* ============================================================ */

          /* typedef and Struct*/

          至此,本篇已結(jié)束。轉(zhuǎn)載網(wǎng)絡(luò)的文章,小編覺得很優(yōu)秀,歡迎點擊閱讀原文,支持原創(chuàng)作者,如有侵權(quán),懇請聯(lián)系小編刪除。同時感謝您的閱讀,期待您的關(guān)注。

          瀏覽 52
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  大香蕉综合视频 | 亚洲色爽视频 | 婷婷五月在线 | 性一区 | 激情深爱最新网址 |