android_kernel_samsung_msm8976/arch/arm/mach-msm/msm8952-thermistor.c

393 lines
6.7 KiB
C

/*
* msm8916-thermistor.c - thermistor for MSM8916 projects
*
* Copyright (C) 2014 Samsung Electronics
* SangYoung Son <hello.son@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <mach/msm8952-thermistor.h>
#include <mach/sec_thermistor.h>
#ifdef CONFIG_SEC_THERMISTOR
#if defined(CONFIG_SEC_E7_PROJECT)
static struct sec_therm_adc_table temper_table_ap[] = {
{25817, 900},
{25999, 890},
{26036, 880},
{26078, 870},
{26121, 860},
{26163, 850},
{26205, 840},
{26248, 830},
{26290, 820},
{26333, 810},
{26375, 800},
{26440, 790},
{26505, 780},
{26570, 770},
{26635, 760},
{26700, 750},
{26764, 740},
{26829, 730},
{27113, 720},
{26959, 710},
{27024, 700},
{27076, 690},
{27129, 680},
{27181, 670},
{27233, 660},
{27286, 650},
{27338, 640},
{27390, 630},
{27242, 620},
{27495, 610},
{27547, 600},
{27626, 590},
{27705, 580},
{27784, 570},
{27863, 560},
{27943, 550},
{28058, 540},
{28173, 530},
{28288, 520},
{28403, 510},
{28519, 500},
{28674, 490},
{28830, 480},
{28985, 470},
{29141, 460},
{29296, 450},
{29521, 440},
{29746, 430},
{29971, 420},
{30196, 410},
{30421, 400},
{30603, 390},
{30786, 380},
{30968, 370},
{31150, 360},
{31333, 350},
{31491, 340},
{31650, 330},
{31808, 320},
{31967, 310},
{32126, 300},
{32418, 290},
{32711, 280},
{33003, 270},
{33296, 260},
{33588, 250},
{33795, 240},
{34002, 230},
{34210, 220},
{34417, 210},
{34624, 200},
{34803, 190},
{34983, 180},
{35162, 170},
{35341, 160},
{35521, 150},
{35661, 140},
{35802, 130},
{35943, 120},
{36084, 110},
{36225, 100},
{36436, 90},
{36648, 80},
{36860, 70},
{37072, 60},
{37284, 50},
{37493, 40},
{37702, 30},
{37911, 20},
{38120, 10},
{38329, 0},
{38501, -10},
{38672, -20},
{38844, -30},
{39015, -40},
{39187, -50},
{39393, -60},
{39598, -70},
{39804, -80},
{40010, -90},
{40216, -100},
{40360, -110},
{40505, -120},
{40650, -130},
{40794, -140},
{40939, -150},
{41034, -160},
{41129, -170},
{41223, -180},
{41318, -190},
{41413, -200},
};
#elif defined(CONFIG_SEC_E5_PROJECT)
static struct sec_therm_adc_table temper_table_ap[] = {
{25949, 900},
{26005, 890},
{26061, 880},
{26117, 870},
{26173, 860},
{26229, 850},
{26289, 840},
{26349, 830},
{26409, 820},
{26469, 810},
{26529, 800},
{26593, 790},
{26657, 780},
{26720, 770},
{26784, 760},
{26848, 750},
{26922, 740},
{26996, 730},
{27069, 720},
{27143, 710},
{27217, 700},
{27291, 690},
{27365, 680},
{27439, 670},
{27513, 660},
{27587, 650},
{27676, 640},
{27765, 630},
{27853, 620},
{27942, 610},
{28031, 600},
{28157, 590},
{28282, 580},
{28408, 570},
{28533, 560},
{28659, 550},
{28796, 540},
{28933, 530},
{29070, 520},
{29207, 510},
{29344, 500},
{29502, 490},
{29660, 480},
{29817, 470},
{29975, 460},
{30133, 450},
{30306, 440},
{30479, 430},
{30651, 420},
{30824, 410},
{30997, 400},
{31166, 390},
{31334, 380},
{31503, 370},
{31671, 360},
{31840, 350},
{32056, 340},
{32273, 330},
{32489, 320},
{32746, 310},
{32922, 300},
{33139, 290},
{33355, 280},
{33572, 270},
{33788, 260},
{34005, 250},
{34225, 240},
{34445, 230},
{34666, 220},
{34886, 210},
{35106, 200},
{35343, 190},
{35580, 180},
{35816, 170},
{36053, 160},
{36290, 150},
{36508, 140},
{36725, 130},
{36943, 120},
{37161, 110},
{37379, 100},
{37580, 90},
{37780, 80},
{37981, 70},
{38181, 60},
{38382, 50},
{38571, 40},
{38759, 30},
{38947, 20},
{39136, 10},
{39324, 0},
{39480, -10},
{39636, -20},
{39792, -30},
{39949, -40},
{40105, -50},
{40244, -60},
{40384, -70},
{40523, -80},
{40663, -90},
{40802, -100},
{40931, -110},
{41061, -120},
{41190, -130},
{41320, -140},
{41449, -150},
{41544, -160},
{41639, -170},
{41735, -180},
{41830, -190},
{41925, -200},
};
#else
/* default table from KLTE(MSM8974Pro) project */
static struct sec_therm_adc_table temper_table_ap[] = {
{25954, 900},
{26005, 890},
{26052, 880},
{26105, 870},
{26151, 860},
{26207, 850},
{26253, 840},
{26302, 830},
{26354, 820},
{26405, 810},
{26454, 800},
{26503, 790},
{26554, 780},
{26602, 770},
{26657, 760},
{26691, 750},
{26757, 740},
{26823, 730},
{26889, 720},
{26955, 710},
{27020, 700},
{27081, 690},
{27142, 680},
{27203, 670},
{27264, 660},
{27327, 650},
{27442, 640},
{27557, 630},
{27672, 620},
{27787, 610},
{27902, 600},
{28004, 590},
{28106, 580},
{28208, 570},
{28310, 560},
{28415, 550},
{28608, 540},
{28801, 530},
{28995, 520},
{28944, 510},
{28893, 500},
{29148, 490},
{29347, 480},
{29546, 470},
{29746, 460},
{29911, 450},
{30076, 440},
{30242, 430},
{30490, 420},
{30738, 410},
{30986, 400},
{31101, 390},
{31216, 380},
{31331, 370},
{31446, 360},
{31561, 350},
{31768, 340},
{31975, 330},
{32182, 320},
{32389, 310},
{32596, 300},
{32962, 290},
{32974, 280},
{32986, 270},
{33744, 260},
{33971, 250},
{34187, 240},
{34403, 230},
{34620, 220},
{34836, 210},
{35052, 200},
{35261, 190},
{35470, 180},
{35679, 170},
{35888, 160},
{36098, 150},
{36317, 140},
{36537, 130},
{36756, 120},
{36976, 110},
{37195, 100},
{37413, 90},
{37630, 80},
{37848, 70},
{38065, 60},
{38282, 50},
{38458, 40},
{38635, 30},
{38811, 20},
{38987, 10},
{39163, 0},
{39317, -10},
{39470, -20},
{39624, -30},
{39777, -40},
{39931, -50},
{40065, -60},
{40199, -70},
{40333, -80},
{40467, -90},
{40601, -100},
{40728, -110},
{40856, -120},
{40983, -130},
{41110, -140},
{41237, -150},
{41307, -160},
{41378, -170},
{41448, -180},
{41518, -190},
{41588, -200},
};
#endif
static struct sec_therm_platform_data sec_therm_pdata = {
.adc_arr_size = ARRAY_SIZE(temper_table_ap),
.adc_table = temper_table_ap,
.polling_interval = 30 * 1000, /* msecs */
.get_siop_level = NULL,
.no_polling = 1,
};
struct platform_device sec_device_thermistor = {
.name = "sec-thermistor",
.id = -1,
.dev.platform_data = &sec_therm_pdata,
};
struct sec_therm_platform_data * fill_therm_pdata(struct platform_device *pdev)
{
pdev->dev.platform_data = &sec_therm_pdata;
pdev->id = -1;
return &sec_therm_pdata;
}
#endif