aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos/midas-thermistor.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-exynos/midas-thermistor.c')
-rw-r--r--arch/arm/mach-exynos/midas-thermistor.c509
1 files changed, 487 insertions, 22 deletions
diff --git a/arch/arm/mach-exynos/midas-thermistor.c b/arch/arm/mach-exynos/midas-thermistor.c
index 999a56e..27c7e05 100644
--- a/arch/arm/mach-exynos/midas-thermistor.c
+++ b/arch/arm/mach-exynos/midas-thermistor.c
@@ -24,6 +24,11 @@
#include <mach/sec_thermistor.h>
#endif
+#if defined(CONFIG_MACH_C1_KOR_SKT) || defined(CONFIG_MACH_C1_KOR_KT) || \
+ defined(CONFIG_MACH_C1_KOR_LGT)
+extern int siopLevellimit;
+#endif
+
#ifdef CONFIG_S3C_ADC
#if defined(CONFIG_MACH_M0) || defined(CONFIG_MACH_P4NOTE)
static struct adc_table_data ap_adc_temper_table_battery[] = {
@@ -130,7 +135,6 @@ static struct adc_table_data ap_adc_temper_table_battery[] = {
{ 1856, -200 },
};
#elif defined(CONFIG_MACH_C1)
-#if defined(CONFIG_TARGET_LOCALE_KOR)
static struct adc_table_data ap_adc_temper_table_battery[] = {
{ 178, 800 },
{ 186, 790 },
@@ -234,21 +238,390 @@ static struct adc_table_data ap_adc_temper_table_battery[] = {
{ 1805, -190 },
{ 1824, -200 },
};
-#else
+#elif defined(CONFIG_MACH_GC1)/*Sample # 3*/
static struct adc_table_data ap_adc_temper_table_battery[] = {
- { 305, 650 },
- { 566, 430 },
- { 1494, 0 },
- { 1571, -50 },
+ { 250, 700 },
+ { 259, 690 },
+ { 270, 680 },
+ { 279, 670 },
+ { 289, 660 },
+ { 297, 650 },
+ { 312, 640 },
+ { 314, 630 },
+ { 324, 620 },
+ { 336, 610 },
+ { 344, 600 },
+ { 358, 590 },
+ { 369, 580 },
+ { 378, 570 },
+ { 390, 560 },
+ { 405, 550 },
+ { 419, 540 },
+ { 433, 530 },
+ { 447, 520 },
+ { 464, 510 },
+ { 471, 500 },
+ { 485, 490 },
+ { 510, 480 },
+ { 515, 470 },
+ { 537, 460 },
+ { 552, 450 },
+ { 577, 440 },
+ { 591, 430 },
+ { 606, 420 },
+ { 621, 410 },
+ { 636, 400 },
+ { 655, 390 },
+ { 677, 380 },
+ { 711, 370 },
+ { 727, 360 },
+ { 730, 350 },
+ { 755, 340 },
+ { 776, 330 },
+ { 795, 320 },
+ { 819, 310 },
+ { 832, 300 },
+ { 855, 290 },
+ { 883, 280 },
+ { 895, 270 },
+ { 939, 260 },
+ { 946, 250 },
+ { 958, 240 },
+ { 974, 230 },
+ { 986, 220 },
+ { 1023, 210 },
+ { 1055, 200 },
+ { 1065, 190 },
+ { 1118, 180 },
+ { 1147, 170 },
+ { 1171, 160 },
+ { 1190, 150 },
+ { 1220, 140 },
+ { 1224, 130 },
+ { 1251, 120 },
+ { 1271, 110 },
+ { 1316, 100 },
+ { 1325, 90 },
+ { 1333, 80 },
+ { 1365, 70 },
+ { 1382, 60 },
+ { 1404, 50 },
+ { 1445, 40 },
+ { 1461, 30 },
+ { 1469, 20 },
+ { 1492, 10 },
+ { 1518, 0 },
+ { 1552, -10 },
+ { 1560, -20 },
+ { 1588, -30 },
+ { 1592, -40 },
+ { 1613, -50 },
+ { 1632, -60 },
+ { 1647, -70 },
+ { 1661, -80 },
+ { 1685, -90 },
+ { 1692, -100 },
};
-#endif
-#elif defined(CONFIG_MACH_S2PLUS)
+#elif defined(CONFIG_MACH_M3)
static struct adc_table_data ap_adc_temper_table_battery[] = {
- { 305, 650 },
- { 566, 430 },
- { 1494, 0 },
- { 1571, -50 },
+ { 264, 700 },
+ { 293, 670 },
+ { 315, 650 },
+ { 338, 630 },
+ { 348, 620 },
+ { 371, 600 },
+ { 436, 550 },
+ { 509, 500 },
+ { 599, 450 },
+ { 629, 430 },
+ { 651, 420 },
+ { 692, 400 },
+ { 790, 350 },
+ { 909, 300 },
+ { 1027, 250 },
+ { 1141, 200 },
+ { 1246, 150 },
+ { 1364, 100 },
+ { 1460, 50 },
+ { 1573, 0 },
+ { 1614, -30 },
+ { 1650, -50 },
+ { 1735, -100 },
+ { 1800, -150 },
+ { 1857, -200 },
+ { 1910, -250 },
+ { 1970, -300 },
+};
+#elif defined(CONFIG_MACH_T0)
+#if defined(CONFIG_TARGET_LOCALE_KOR)
+static struct adc_table_data ap_adc_temper_table_battery[] = {
+ { 200, 800 },
+ { 207, 790 },
+ { 214, 780 },
+ { 221, 770 },
+ { 228, 760 },
+ { 235, 750 },
+ { 248, 740 },
+ { 260, 730 },
+ { 273, 720 },
+ { 286, 710 },
+ { 299, 700 },
+ { 310, 690 },
+ { 321, 680 },
+ { 332, 670 },
+ { 345, 660 },
+ { 355, 650 },
+ { 370, 640 },
+ { 381, 630 },
+ { 393, 620 },
+ { 406, 610 },
+ { 423, 600 },
+ { 435, 590 },
+ { 448, 580 },
+ { 460, 570 },
+ { 473, 560 },
+ { 485, 550 },
+ { 498, 540 },
+ { 511, 530 },
+ { 524, 520 },
+ { 537, 510 },
+ { 550, 500 },
+ { 566, 490 },
+ { 582, 480 },
+ { 598, 470 },
+ { 614, 460 },
+ { 630, 450 },
+ { 649, 440 },
+ { 668, 430 },
+ { 687, 420 },
+ { 706, 410 },
+ { 725, 400 },
+ { 744, 390 },
+ { 763, 380 },
+ { 782, 370 },
+ { 801, 360 },
+ { 820, 350 },
+ { 841, 340 },
+ { 862, 330 },
+ { 883, 320 },
+ { 904, 310 },
+ { 925, 300 },
+ { 946, 290 },
+ { 967, 280 },
+ { 988, 270 },
+ { 1009, 260 },
+ { 1030, 250 },
+ { 1050, 240 },
+ { 1070, 230 },
+ { 1090, 220 },
+ { 1110, 210 },
+ { 1130, 200 },
+ { 1154, 190 },
+ { 1178, 180 },
+ { 1202, 170 },
+ { 1226, 160 },
+ { 1250, 150 },
+ { 1272, 140 },
+ { 1294, 130 },
+ { 1315, 120 },
+ { 1337, 110 },
+ { 1359, 100 },
+ { 1381, 90 },
+ { 1403, 80 },
+ { 1424, 70 },
+ { 1446, 60 },
+ { 1468, 50 },
+ { 1489, 40 },
+ { 1510, 30 },
+ { 1532, 20 },
+ { 1553, 10 },
+ { 1574, 0 },
+ { 1591, -10 },
+ { 1609, -20 },
+ { 1626, -30 },
+ { 1644, -40 },
+ { 1661, -50 },
+ { 1676, -60 },
+ { 1691, -70 },
+ { 1707, -80 },
+ { 1722, -90 },
+ { 1737, -100 },
+ { 1749, -110 },
+ { 1760, -120 },
+ { 1772, -130 },
+ { 1783, -140 },
+ { 1795, -150 },
+ { 1803, -160 },
+ { 1811, -170 },
+ { 1819, -180 },
+ { 1827, -190 },
+ { 1836, -200 },
+};
+#elif defined(CONFIG_MACH_T0_EUR_LTE) || defined(CONFIG_MACH_T0_USA_ATT)
+static struct adc_table_data ap_adc_temper_table_battery[] = {
+ { 332, 650 },
+ { 389, 600 },
+ { 460, 550 },
+ { 530, 500 },
+ { 617, 450 },
+ { 735, 400 },
+ { 803, 350 },
+ { 913, 300 },
+ { 992, 250 },
+ { 1126, 200 },
+ { 1265, 150 },
+ { 1370, 100 },
+ { 1475, 50 },
+ { 1530, 0 },
+ { 1635, -50 },
+ { 1724, -100 },
+ { 1803, -150 },
+ { 1855, -200 },
+};
+#elif defined(CONFIG_MACH_T0_USA_VZW) || defined(CONFIG_MACH_T0_USA_SPR) || \
+ defined(CONFIG_MACH_T0_USA_USCC)
+static struct adc_table_data ap_adc_temper_table_battery[] = {
+ { 193, 800 },
+ { 222, 750 },
+ { 272, 700 },
+ { 320, 650 },
+ { 379, 600 },
+ { 439, 550 },
+ { 519, 500 },
+ { 555, 480 },
+ { 605, 450 },
+ { 698, 400 },
+ { 802, 350 },
+ { 906, 300 },
+ { 1016, 250 },
+ { 1127, 200 },
+ { 1247, 150 },
+ { 1360, 100 },
+ { 1467, 50 },
+ { 1567, 0 },
+ { 1633, -50 },
+ { 1725, -100 },
+ { 1790, -150 },
+ { 1839, -200 },
+ { 1903, -250 },
+};
+#elif defined(CONFIG_MACH_BAFFIN)
+static struct adc_table_data ap_adc_temper_table_battery[] = {
+ { 178, 800 },
+ { 186, 790 },
+ { 193, 780 },
+ { 198, 770 },
+ { 204, 760 },
+ { 210, 750 },
+ { 220, 740 },
+ { 226, 730 },
+ { 232, 720 },
+ { 247, 710 },
+ { 254, 700 },
+ { 261, 690 },
+ { 270, 680 },
+ { 278, 670 },
+ { 285, 660 },
+ { 292, 650 },
+ { 304, 640 },
+ { 319, 630 },
+ { 325, 620 },
+ { 331, 610 },
+ { 343, 600 },
+ { 354, 590 },
+ { 373, 580 },
+ { 387, 570 },
+ { 392, 560 },
+ { 408, 550 },
+ { 422, 540 },
+ { 433, 530 },
+ { 452, 520 },
+ { 466, 510 },
+ { 479, 500 },
+ { 497, 490 },
+ { 510, 480 },
+ { 529, 470 },
+ { 545, 460 },
+ { 562, 450 },
+ { 578, 440 },
+ { 594, 430 },
+ { 620, 420 },
+ { 632, 410 },
+ { 651, 400 },
+ { 663, 390 },
+ { 681, 380 },
+ { 705, 370 },
+ { 727, 360 },
+ { 736, 350 },
+ { 778, 340 },
+ { 793, 330 },
+ { 820, 320 },
+ { 834, 310 },
+ { 859, 300 },
+ { 872, 290 },
+ { 891, 280 },
+ { 914, 270 },
+ { 939, 260 },
+ { 951, 250 },
+ { 967, 240 },
+ { 999, 230 },
+ { 1031, 220 },
+ { 1049, 210 },
+ { 1073, 200 },
+ { 1097, 190 },
+ { 1128, 180 },
+ { 1140, 170 },
+ { 1171, 160 },
+ { 1188, 150 },
+ { 1198, 140 },
+ { 1223, 130 },
+ { 1236, 120 },
+ { 1274, 110 },
+ { 1290, 100 },
+ { 1312, 90 },
+ { 1321, 80 },
+ { 1353, 70 },
+ { 1363, 60 },
+ { 1404, 50 },
+ { 1413, 40 },
+ { 1444, 30 },
+ { 1461, 20 },
+ { 1470, 10 },
+ { 1516, 0 },
+ { 1522, -10 },
+ { 1533, -20 },
+ { 1540, -30 },
+ { 1558, -40 },
+ { 1581, -50 },
+ { 1595, -60 },
+ { 1607, -70 },
+ { 1614, -80 },
+ { 1627, -90 },
+ { 1655, -100 },
+ { 1664, -110 },
+ { 1670, -120 },
+ { 1676, -130 },
+ { 1692, -140 },
+ { 1713, -150 },
+ { 1734, -160 },
+ { 1746, -170 },
+ { 1789, -180 },
+ { 1805, -190 },
+ { 1824, -200 },
+};
+#else /* T0 3G(default) */
+static struct adc_table_data ap_adc_temper_table_battery[] = {
+ { 358, 600 },
+ { 500, 500 },
+ { 698, 400 },
+ { 898, 300 },
+ { 1132, 200 },
+ { 1363, 100 },
+ { 1574, 0 },
+ { 1732, -100 },
+ { 1860, -200 },
};
+#endif
#else /* sample */
static struct adc_table_data ap_adc_temper_table_battery[] = {
{ 305, 650 },
@@ -322,6 +695,39 @@ int convert_adc(int adc_data, int channel)
#endif
#ifdef CONFIG_SEC_THERMISTOR
+#if defined(CONFIG_MACH_GC1)
+static struct sec_therm_adc_table temper_table_ap[] = {
+ {241, 700},
+ {260, 650},
+ {301, 600},
+ {351, 550},
+ {367, 540},
+ {383, 530},
+ {399, 520},
+ {415, 510},
+ {431, 500},
+ {442, 490},
+ {454, 480},
+ {465, 470},
+ {477, 460},
+ {488, 450},
+ {508, 440},
+ {528, 430},
+ {548, 420},
+ {568, 410},
+ {587, 400},
+ {604, 390},
+ {622, 380},
+ {639, 370},
+ {657, 360},
+ {674, 350},
+ {696, 340},
+ {718, 330},
+ {740, 320},
+ {762, 310},
+ {784, 300},
+};
+#else
static struct sec_therm_adc_table temper_table_ap[] = {
{196, 700},
{211, 690},
@@ -347,8 +753,8 @@ static struct sec_therm_adc_table temper_table_ap[] = {
{498, 500},
{509, 490},
{520, 480},
- {529, 460},
- {538, 470},
+ {529, 470},
+ {538, 460},
{547, 450},
{556, 440},
{564, 430},
@@ -366,6 +772,7 @@ static struct sec_therm_adc_table temper_table_ap[] = {
{801, 310},
{822, 300},
};
+#endif
/* when the next level is same as prev, returns -1 */
static int get_midas_siop_level(int temp)
@@ -377,24 +784,24 @@ static int get_midas_siop_level(int temp)
#if defined(CONFIG_MACH_C1_KOR_SKT) || defined(CONFIG_MACH_C1_KOR_KT) || \
defined(CONFIG_MACH_C1_KOR_LGT)
if (temp > prev_temp) {
- if (temp >= 490)
+ if (temp >= 540)
level = 4;
- else if (temp >= 480)
+ else if (temp >= 530)
level = 3;
- else if (temp >= 450)
+ else if (temp >= 480)
level = 2;
- else if (temp >= 420)
+ else if (temp >= 440)
level = 1;
else
level = 0;
} else {
- if (temp < 400)
+ if (temp < 410)
level = 0;
- else if (temp < 420)
+ else if (temp < 440)
level = 1;
- else if (temp < 450)
- level = 2;
else if (temp < 480)
+ level = 2;
+ else if (temp < 530)
level = 3;
else
level = 4;
@@ -402,6 +809,10 @@ static int get_midas_siop_level(int temp)
if (level > prev_level)
level = prev_level;
}
+
+ if (siopLevellimit != 0 && level > siopLevellimit)
+ level = siopLevellimit;
+
#elif defined(CONFIG_MACH_P4NOTE)
if (temp > prev_temp) {
if (temp >= 620)
@@ -429,6 +840,60 @@ static int get_midas_siop_level(int temp)
if (level > prev_level)
level = prev_level;
}
+#elif defined(CONFIG_MACH_T0)
+ if (temp > prev_temp) {
+ if (temp >= 620)
+ level = 4;
+ else if (temp >= 610)
+ level = 3;
+ else if (temp >= 570)
+ level = 2;
+ else if (temp >= 540)
+ level = 1;
+ else
+ level = 0;
+ } else {
+ if (temp < 510)
+ level = 0;
+ else if (temp < 540)
+ level = 1;
+ else if (temp < 570)
+ level = 2;
+ else if (temp < 610)
+ level = 3;
+ else
+ level = 4;
+
+ if (level > prev_level)
+ level = prev_level;
+ }
+#elif defined(CONFIG_MACH_GC1)
+ if (temp > prev_temp) {
+ if (temp >= 590)
+ level = 4;
+ else if (temp >= 580)
+ level = 3;
+ else if (temp >= 550)
+ level = 2;
+ else if (temp >= 520)
+ level = 1;
+ else
+ level = 0;
+ } else {
+ if (temp < 480)
+ level = 0;
+ else if (temp < 520)
+ level = 1;
+ else if (temp < 550)
+ level = 2;
+ else if (temp < 580)
+ level = 3;
+ else
+ level = 4;
+
+ if (level > prev_level)
+ level = prev_level;
+ }
#else
if (temp > prev_temp) {
if (temp >= 540)