sec_board-msm8974.c 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168
  1. /*
  2. * sec_board-msm8974.c
  3. * Samsung Mobile Battery Driver
  4. *
  5. * Copyright (C) 2012 Samsung Electronics
  6. *
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/battery/sec_battery.h>
  13. #include <linux/battery/sec_fuelgauge.h>
  14. #include <linux/battery/sec_charging_common.h>
  15. #include <linux/qpnp/pin.h>
  16. #include <linux/qpnp/qpnp-adc.h>
  17. #include <linux/regulator/machine.h>
  18. #include <linux/regulator/krait-regulator.h>
  19. #define SHORT_BATTERY_STANDARD 100
  20. #if defined(CONFIG_USB_SWITCH_FSA9485)
  21. extern int mhl_connection_state(void);
  22. extern void fsa9485_mmdock_vbus_check(bool vbus_status);
  23. #endif
  24. #if defined(CONFIG_EXTCON)
  25. extern int get_jig_state(void);
  26. int current_cable_type = POWER_SUPPLY_TYPE_BATTERY;
  27. #else
  28. extern int current_cable_type;
  29. #endif
  30. extern unsigned int system_rev;
  31. static enum qpnp_vadc_channels temp_channel;
  32. static enum qpnp_vadc_channels chg_temp_channel;
  33. static struct sec_fuelgauge_info *sec_fuelgauge = NULL;
  34. #if defined(CONFIG_BATTERY_SAMSUNG_DATA)
  35. #include CONFIG_BATTERY_SAMSUNG_DATA_FILE
  36. #else //CONFIG_BATTERY_SAMSUNG_DATA
  37. #if defined(CONFIG_FUELGAUGE_MAX17048)
  38. static struct battery_data_t samsung_battery_data[] = {
  39. /* SDI battery data (High voltage 4.35V) */
  40. {
  41. #if defined(CONFIG_MACH_HLTESKT) || defined(CONFIG_MACH_HLTEKTT) || defined(CONFIG_MACH_HLTELGT)
  42. .RCOMP0 = 0x73,
  43. .RCOMP_charging = 0x84,
  44. .temp_cohot = -1025,
  45. .temp_cocold = -3675,
  46. #elif defined(CONFIG_MACH_FRESCOLTESKT)||defined(CONFIG_MACH_FRESCOLTEKTT)||defined(CONFIG_MACH_FRESCOLTELGT)
  47. .RCOMP0 = 0x7E,
  48. .RCOMP_charging = 0x80,
  49. .temp_cohot = -675,
  50. .temp_cocold = -6400,
  51. #elif defined(CONFIG_MACH_HLTEVZW) || defined(CONFIG_MACH_HLTESPR)
  52. .RCOMP0 = 0x70,
  53. .RCOMP_charging = 0x8D,
  54. .temp_cohot = -1000,
  55. .temp_cocold = -4350,
  56. #elif defined(CONFIG_MACH_HLTEATT)
  57. .RCOMP0 = 0x75,
  58. .RCOMP_charging = 0x8D,
  59. .temp_cohot = -1000,
  60. .temp_cocold = -4350,
  61. #elif defined(CONFIG_MACH_HLTEUSC)
  62. .RCOMP0 = 0x75,
  63. .RCOMP_charging = 0x8D,
  64. .temp_cohot = -1000,
  65. .temp_cocold = -4350,
  66. #elif defined(CONFIG_MACH_HLTEDCM)
  67. .RCOMP0 = 0x7A,
  68. .RCOMP_charging = 0x8A,
  69. .temp_cohot = -1025,
  70. .temp_cocold = -3675,
  71. #elif defined(CONFIG_MACH_HLTEKDI)
  72. .RCOMP0 = 0x73,
  73. .RCOMP_charging = 0x84,
  74. .temp_cohot = -1025,
  75. .temp_cocold = -3675,
  76. #elif defined(CONFIG_SEC_JS_PROJECT)
  77. .RCOMP0 = 0x75,
  78. .RCOMP_charging = 0x80,
  79. .temp_cohot = -700,
  80. .temp_cocold = -4875,
  81. #elif defined(CONFIG_MACH_HLTECHNTWU)
  82. .RCOMP0 = 0x6D,
  83. .RCOMP_charging = 0x6D,
  84. .temp_cohot = -900,
  85. .temp_cocold = -3700,
  86. #elif defined(CONFIG_MACH_HLTE_CHN_CMCC) || defined(CONFIG_MACH_H3G_CHN_CMCC) || defined(CONFIG_MACH_H3G_CHN_OPEN)
  87. .RCOMP0 = 0x73,
  88. .RCOMP_charging = 0x8D,
  89. .temp_cohot = -1000,
  90. .temp_cocold = -4350,
  91. #elif defined(CONFIG_MACH_HLTEEUR)
  92. .RCOMP0 = 0x62,
  93. .RCOMP_charging = 0x7C,
  94. .temp_cohot = -1000,
  95. .temp_cocold = -4350,
  96. #elif defined(CONFIG_MACH_FLTEEUR) || defined(CONFIG_MACH_FLTESKT)
  97. .RCOMP0 = 0x75,
  98. .RCOMP_charging = 0x70,
  99. .temp_cohot = -375,
  100. .temp_cocold = -3975,
  101. #elif defined(CONFIG_MACH_KS01EUR)
  102. .RCOMP0 = 0x73,
  103. .RCOMP_charging = 0x79,
  104. .temp_cohot = -850,
  105. .temp_cocold = -4200,
  106. #elif defined(CONFIG_MACH_KS01SKT) || defined(CONFIG_MACH_KS01KTT) || \
  107. defined(CONFIG_MACH_KS01LGT)
  108. .RCOMP0 = 0x70,
  109. .RCOMP_charging = 0x79,
  110. .temp_cohot = -850,
  111. .temp_cocold = -4200,
  112. #elif defined(CONFIG_MACH_JACTIVESKT)
  113. .RCOMP0 = 0x7B,
  114. .RCOMP_charging = 0x85,
  115. .temp_cohot = -700,
  116. .temp_cocold = -4875,
  117. #elif defined(CONFIG_MACH_K3GDUOS_CTC)
  118. .RCOMP0 = 0x5D,
  119. .RCOMP_charging = 0x62,
  120. .temp_cohot = -175,
  121. .temp_cocold = -5825,
  122. #elif defined(CONFIG_MACH_KLTE_CTC)
  123. .RCOMP0 = 0x68,
  124. .RCOMP_charging = 0x75,
  125. .temp_cohot = -175,
  126. .temp_cocold = -5825,
  127. #elif defined(CONFIG_MACH_KLTE_CHN)
  128. .RCOMP0 = 0x62,
  129. .RCOMP_charging = 0x65,
  130. .temp_cohot = -175,
  131. .temp_cocold = -5825,
  132. #elif defined(CONFIG_MACH_KLTE_SKT) || defined(CONFIG_MACH_KLTE_KTT) || \
  133. defined(CONFIG_MACH_KLTE_LGT)
  134. .RCOMP0 = 0x5D,
  135. .RCOMP_charging = 0x68,
  136. .temp_cohot = -175,
  137. .temp_cocold = -5825,
  138. #elif defined(CONFIG_SEC_KSPORTS_PROJECT)
  139. .RCOMP0 = 0x67,
  140. .RCOMP_charging = 0x67,
  141. .temp_cohot = -175,
  142. .temp_cocold = -5825,
  143. #elif defined(CONFIG_SEC_K_PROJECT)
  144. .RCOMP0 = 0x5D,
  145. .RCOMP_charging = 0x5D,
  146. .temp_cohot = -175,
  147. .temp_cocold = -5825,
  148. #elif defined(CONFIG_MACH_KACTIVELTE_KOR)
  149. .RCOMP0 = 0x7E,
  150. .RCOMP_charging = 0x7E,
  151. .temp_cohot = -762,
  152. .temp_cocold = -4787,
  153. #elif defined(CONFIG_SEC_KACTIVE_PROJECT)
  154. .RCOMP0 = 0x5D,
  155. .RCOMP_charging = 0x5D,
  156. .temp_cohot = -175,
  157. .temp_cocold = -5825,
  158. #else
  159. .RCOMP0 = 0x73,
  160. .RCOMP_charging = 0x8D,
  161. .temp_cohot = -1000,
  162. .temp_cocold = -4350,
  163. #endif
  164. .is_using_model_data = true,
  165. .type_str = "SDI",
  166. }
  167. };
  168. #else
  169. static struct battery_data_t samsung_battery_data[] = {
  170. /* SDI battery data (High voltage 4.35V) */
  171. {
  172. #if defined(CONFIG_MACH_PICASSO) || defined(CONFIG_MACH_LT03)
  173. .Capacity = 0x3F76, /* N1/N2: 8123mAh */
  174. #elif defined(CONFIG_MACH_MONDRIAN)
  175. .Capacity = 0x257E,
  176. #else
  177. .Capacity = 0x4A38, /* V1/V2: 9500mAh */
  178. #endif
  179. .low_battery_comp_voltage = 3500,
  180. .low_battery_table = {
  181. /* range, slope, offset */
  182. {-5000, 0, 0}, /* dummy for top limit */
  183. {-1250, 0, 3320},
  184. {-750, 97, 3451},
  185. {-100, 96, 3461},
  186. {0, 0, 3456},
  187. },
  188. .temp_adjust_table = {
  189. /* range, slope, offset */
  190. {47000, 122, 8950},
  191. {60000, 200, 51000},
  192. {100000, 0, 0}, /* dummy for top limit */
  193. },
  194. .type_str = "SDI",
  195. }
  196. };
  197. #endif
  198. #if defined(CONFIG_MACH_KLTE_CTC)
  199. #define CAPACITY_MAX 980
  200. #define CAPACITY_MAX_MARGIN 50
  201. #define CAPACITY_MIN -7
  202. #elif defined(CONFIG_MACH_KACTIVELTE_KOR)
  203. #define CAPACITY_MAX 990
  204. #define CAPACITY_MAX_MARGIN 70
  205. #define CAPACITY_MIN 0
  206. #elif defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
  207. defined(CONFIG_SEC_KSPORTS_PROJECT)
  208. #define CAPACITY_MAX 990
  209. #define CAPACITY_MAX_MARGIN 50
  210. #define CAPACITY_MIN -7
  211. #elif defined(CONFIG_MACH_HLTESKT) || defined(CONFIG_MACH_HLTEKTT) || \
  212. defined(CONFIG_MACH_HLTELGT) || defined(CONFIG_MACH_HLTEDCM) || \
  213. defined(CONFIG_MACH_HLTEKDI)
  214. #define CAPACITY_MAX 980
  215. #define CAPACITY_MAX_MARGIN 50
  216. #define CAPACITY_MIN -7
  217. #elif defined(CONFIG_MACH_FRESCOLTESKT)||defined(CONFIG_MACH_FRESCOLTEKTT)||defined(CONFIG_MACH_FRESCOLTELGT)
  218. #define CAPACITY_MAX 980
  219. #define CAPACITY_MAX_MARGIN 50
  220. #define CAPACITY_MIN 3
  221. #elif defined(CONFIG_MACH_FLTEEUR) || defined(CONFIG_MACH_FLTESKT)
  222. #define CAPACITY_MAX 990
  223. #define CAPACITY_MAX_MARGIN 50
  224. #define CAPACITY_MIN 0
  225. #elif defined(CONFIG_MACH_MONDRIAN)
  226. #define CAPACITY_MAX 1000
  227. #define CAPACITY_MAX_MARGIN 50
  228. #define CAPACITY_MIN 0
  229. #elif defined(CONFIG_SEC_H_PROJECT) /* from H USA/EUR */
  230. #define CAPACITY_MAX 990
  231. #define CAPACITY_MAX_MARGIN 50
  232. #define CAPACITY_MIN -7
  233. #elif defined(CONFIG_SEC_JS_PROJECT)
  234. #define CAPACITY_MAX 970
  235. #define CAPACITY_MAX_MARGIN 50
  236. #define CAPACITY_MIN -7
  237. #else /* CONFIG_SEC_KS01_PROJECT */
  238. #define CAPACITY_MAX 1000
  239. #define CAPACITY_MAX_MARGIN 50
  240. #define CAPACITY_MIN 0
  241. #endif
  242. #if defined(CONFIG_MACH_KLTE_EUR) || defined(CONFIG_MACH_KLTE_ATT) || defined(CONFIG_MACH_KLTE_TMO) || \
  243. defined (CONFIG_MACH_KLTE_SKT) || defined(CONFIG_MACH_KLTE_KTT) || defined(CONFIG_MACH_KLTE_LGT) || \
  244. defined(CONFIG_MACH_KLTE_SPR) || defined(CONFIG_MACH_KLTE_CAN) || defined(CONFIG_MACH_KLTE_MTR) || \
  245. defined(CONFIG_MACH_KLTE_VZW) || defined(CONFIG_SEC_LOCALE_CHN) || defined(CONFIG_MACH_KLTE_AUS_TEL) || \
  246. defined(CONFIG_MACH_KLTE_LRA)
  247. static sec_bat_adc_table_data_t temp_table[] = {
  248. {26009, 900},
  249. {26280, 850},
  250. {26600, 800},
  251. {26950, 750},
  252. {27325, 700},
  253. {27737, 650},
  254. {28180, 600},
  255. {28699, 550},
  256. {29360, 500},
  257. {29970, 450},
  258. {30995, 400},
  259. {32046, 350},
  260. {32985, 300},
  261. {34050, 250},
  262. {35139, 200},
  263. {36179, 150},
  264. {37208, 100},
  265. {38237, 50},
  266. {38414, 40},
  267. {38598, 30},
  268. {38776, 20},
  269. {38866, 10},
  270. {38956, 0},
  271. {39102, -10},
  272. {39247, -20},
  273. {39393, -30},
  274. {39538, -40},
  275. {39684, -50},
  276. {40490, -100},
  277. {41187, -150},
  278. {41652, -200},
  279. {42030, -250},
  280. {42327, -300},
  281. };
  282. #elif defined(CONFIG_MACH_KACTIVELTE_EUR) || defined(CONFIG_MACH_KACTIVELTE_ATT) || defined(CONFIG_MACH_KACTIVELTE_CAN) || defined(CONFIG_MACH_KACTIVELTE_SKT) \
  283. || defined(CONFIG_MACH_KACTIVELTE_DCM)
  284. static sec_bat_adc_table_data_t temp_table[] = {
  285. {26009, 900},
  286. {26280, 850},
  287. {26600, 800},
  288. {26950, 750},
  289. {27168, 700},
  290. {27519, 650},
  291. {27984, 600},
  292. {28596, 550},
  293. {29256, 500},
  294. {30029, 450},
  295. {30881, 400},
  296. {32682, 300},
  297. {35159, 200},
  298. {37244, 100},
  299. {38264, 50},
  300. {38890, 20},
  301. {39075, 10},
  302. {39228, 0},
  303. {39383, -10},
  304. {39557, -20},
  305. {40002, -50},
  306. {41724, -200},
  307. {42373, -300},
  308. };
  309. #elif defined(CONFIG_SEC_KSPORTS_PROJECT)
  310. static sec_bat_adc_table_data_t temp_table[] = {
  311. {25744, 900},
  312. {26015, 850},
  313. {26335, 800},
  314. {26685, 750},
  315. {27082, 700},
  316. {27512, 650},
  317. {27900, 600},
  318. {28223, 550},
  319. {28438, 530},
  320. {28790, 500},
  321. {29080, 490},
  322. {29370, 480},
  323. {29660, 470},
  324. {29950, 460},
  325. {30250, 450},
  326. {31223, 400},
  327. {32138, 350},
  328. {33153, 300},
  329. {34177, 250},
  330. {35432, 200},
  331. {36520, 150},
  332. {37636, 100},
  333. {38598, 50},
  334. {38700, 40},
  335. {38930, 30},
  336. {38950, 20},
  337. {39050, 10},
  338. {39168, 0},
  339. {39281, -10},
  340. {39438, -20},
  341. {39596, -30},
  342. {39728, -40},
  343. {39898, -50},
  344. {40594, -100},
  345. {41193, -150},
  346. {41651, -200},
  347. {42033, -250},
  348. {42325, -300},
  349. };
  350. #elif defined (CONFIG_MACH_KLTE_DCM)
  351. static sec_bat_adc_table_data_t temp_table[] = {
  352. {25844, 900},
  353. {26113, 850},
  354. {26595, 800},
  355. {26896, 750},
  356. {27238, 700},
  357. {27679, 650},
  358. {28193, 600},
  359. {28768, 550},
  360. {29412, 500},
  361. {30169, 450},
  362. {31008, 400},
  363. {31917, 350},
  364. {32901, 300},
  365. {33955, 250},
  366. {35039, 200},
  367. {36132, 150},
  368. {37183, 100},
  369. {38158, 50},
  370. {39041, 0},
  371. {39856, -50},
  372. {40561, -100},
  373. {41146, -150},
  374. {41622, -200},
  375. };
  376. #elif defined (CONFIG_MACH_KLTE_SBM)
  377. static sec_bat_adc_table_data_t temp_table[] = {
  378. {25844, 900},
  379. {26113, 850},
  380. {26595, 800},
  381. {26896, 750},
  382. {27238, 700},
  383. {27679, 650},
  384. {28193, 600},
  385. {28768, 550},
  386. {29412, 500},
  387. {30169, 450},
  388. {31008, 400},
  389. {31917, 350},
  390. {32901, 300},
  391. {33955, 250},
  392. {35039, 200},
  393. {36132, 150},
  394. {37183, 100},
  395. {38158, 50},
  396. {39041, 0},
  397. {39856, -50},
  398. {40561, -100},
  399. {41146, -150},
  400. {41622, -200},
  401. };
  402. #elif defined (CONFIG_MACH_KLTE_KDI)
  403. static sec_bat_adc_table_data_t temp_table[] = {
  404. {25844, 900},
  405. {26113, 850},
  406. {26595, 800},
  407. {26896, 750},
  408. {27238, 700},
  409. {27679, 650},
  410. {28193, 600},
  411. {28768, 550},
  412. {29412, 500},
  413. {30169, 450},
  414. {31008, 400},
  415. {31917, 350},
  416. {32901, 300},
  417. {33955, 250},
  418. {35039, 200},
  419. {36132, 150},
  420. {37183, 100},
  421. {38158, 50},
  422. {39041, 0},
  423. {39856, -50},
  424. {40561, -100},
  425. {41146, -150},
  426. {41622, -200},
  427. };
  428. #elif defined (CONFIG_MACH_KLTE_USC) || defined(CONFIG_MACH_KLTE_ACG)
  429. static sec_bat_adc_table_data_t temp_table[] = {
  430. {26013, 900},
  431. {26227, 850},
  432. {26482, 800},
  433. {26784, 750},
  434. {27122, 700},
  435. {27559, 650},
  436. {28096, 600},
  437. {28667, 550},
  438. {29275, 500},
  439. {30069, 450},
  440. {30896, 400},
  441. {31800, 350},
  442. {32788, 300},
  443. {33844, 250},
  444. {34932, 200},
  445. {36041, 150},
  446. {37107, 100},
  447. {38098, 50},
  448. {38955, 0},
  449. {39804, -50},
  450. {40505, -100},
  451. {41101, -150},
  452. {41597, -200},
  453. };
  454. #elif defined(CONFIG_MACH_H3GDUOS_CTC)
  455. static sec_bat_adc_table_data_t temp_table[] = {
  456. {25844, 900},
  457. {26113, 850},
  458. {26398, 800},
  459. {26764, 750},
  460. {27240, 700},
  461. {27662, 650},
  462. {28202, 600},
  463. {28777, 550},
  464. {29444, 500},
  465. {30193, 450},
  466. {31040, 400},
  467. {31953, 350},
  468. {32942, 300},
  469. {33991, 250},
  470. {35070, 200},
  471. {36168, 150},
  472. {37238, 100},
  473. {38234, 50},
  474. {38414, 40},
  475. {38640, 30},
  476. {38866, 20},
  477. {39092, 10},
  478. {39139, 0},
  479. {39342, -10},
  480. {39545, -30},
  481. {39748, -40},
  482. {39954, -50},
  483. {40641, -100},
  484. {41204, -150},
  485. {41689, -200},
  486. };
  487. #elif defined(CONFIG_MACH_HLTEUSC)
  488. static sec_bat_adc_table_data_t temp_table[] = {
  489. {25908, 900},
  490. {26111, 850},
  491. {26357, 800},
  492. {26651, 750},
  493. {26962, 700},
  494. {27363, 650},
  495. {27850, 600},
  496. {28407, 550},
  497. {29084, 500},
  498. {29857, 450},
  499. {30684, 400},
  500. {31576, 350},
  501. {32674, 300},
  502. {33694, 250},
  503. {34848, 200},
  504. {35963, 150},
  505. {37118, 100},
  506. {38166, 50},
  507. {39104, 0},
  508. {39932, -50},
  509. {40629, -100},
  510. {41224, -150},
  511. {41704, -200},
  512. };
  513. #elif defined(CONFIG_MACH_HLTEKDI)
  514. static sec_bat_adc_table_data_t temp_table[] = {
  515. {25844, 900},
  516. {26113, 850},
  517. {26398, 800},
  518. {26764, 750},
  519. {27293, 700},
  520. {27703, 650},
  521. {28203, 600},
  522. {28773, 550},
  523. {29414, 500},
  524. {30181, 450},
  525. {31023, 400},
  526. {31932, 350},
  527. {32924, 300},
  528. {33962, 250},
  529. {35007, 200},
  530. {36069, 150},
  531. {37080, 100},
  532. {38102, 50},
  533. {39049, 0},
  534. {39542, -50},
  535. {40564, -100},
  536. {41130, -150},
  537. {41651, -200},
  538. };
  539. #elif defined(CONFIG_SEC_H_PROJECT)
  540. static sec_bat_adc_table_data_t temp_table[] = {
  541. {25950, 900},
  542. {26173, 850},
  543. {26424, 800},
  544. {26727, 750},
  545. {27281, 700},
  546. {27669, 650},
  547. {28178, 600},
  548. {28724, 550},
  549. {29342, 500},
  550. {30101, 450},
  551. {30912, 400},
  552. {31807, 350},
  553. {32823, 300},
  554. {33858, 250},
  555. {34950, 200},
  556. {36049, 150},
  557. {37054, 100},
  558. {38025, 50},
  559. {38219, 40},
  560. {38448, 30},
  561. {38626, 20},
  562. {38795, 10},
  563. {38989, 0},
  564. {39229, -10},
  565. {39540, -30},
  566. {39687, -40},
  567. {39822, -50},
  568. {40523, -100},
  569. {41123, -150},
  570. {41619, -200},
  571. };
  572. #elif defined(CONFIG_SEC_JS_PROJECT)
  573. static sec_bat_adc_table_data_t temp_table[] = {
  574. {25950, 900},
  575. {26173, 850},
  576. {26424, 800},
  577. {26727, 750},
  578. {27281, 700},
  579. {27669, 650},
  580. {28178, 600},
  581. {28724, 550},
  582. {29342, 500},
  583. {30101, 450},
  584. {30912, 400},
  585. {31807, 350},
  586. {32823, 300},
  587. {33858, 250},
  588. {34950, 200},
  589. {36049, 150},
  590. {37054, 100},
  591. {38025, 50},
  592. {38219, 40},
  593. {38448, 30},
  594. {38626, 20},
  595. {38795, 10},
  596. {38989, 0},
  597. {39229, -10},
  598. {39540, -30},
  599. {39687, -40},
  600. {39822, -50},
  601. {40523, -100},
  602. {41123, -150},
  603. {41619, -200},
  604. };
  605. #elif defined(CONFIG_MACH_FRESCOLTESKT)||defined(CONFIG_MACH_FRESCOLTEKTT)||defined(CONFIG_MACH_FRESCOLTELGT)
  606. static sec_bat_adc_table_data_t temp_table[] = {
  607. {25827, 900},
  608. {26033, 850},
  609. {26253, 800},
  610. {26415, 750},
  611. {27069, 700},
  612. {27497, 650},
  613. {27911, 600},
  614. {28464, 550},
  615. {28927, 500},
  616. {29785, 450},
  617. {30575, 400},
  618. {31398, 350},
  619. {32513, 300},
  620. {33557, 250},
  621. {34594, 200},
  622. {35889, 150},
  623. {36651, 100},
  624. {37637, 50},
  625. {37831, 40},
  626. {38025, 30},
  627. {38219, 20},
  628. {38448, 10},
  629. {38626, 0},
  630. {38789, -10},
  631. {39229, -30},
  632. {39417, -40},
  633. {39617, -50},
  634. {40202, -100},
  635. {40962, -150},
  636. {41521, -200},
  637. };
  638. #elif defined(CONFIG_MACH_FLTEEUR) || defined(CONFIG_MACH_FLTESKT)
  639. static sec_bat_adc_table_data_t temp_table[] = {
  640. {25844, 900},
  641. {26113, 850},
  642. {26398, 800},
  643. {26764, 750},
  644. {26960, 700},
  645. {27435, 650},
  646. {27885, 600},
  647. {28463, 550},
  648. {29087, 500},
  649. {29988, 450},
  650. {30883, 400},
  651. {31831, 350},
  652. {32868, 300},
  653. {33667, 250},
  654. {34657, 200},
  655. {35871, 150},
  656. {36980, 100},
  657. {38018, 50},
  658. {38965, 0},
  659. {39722, -50},
  660. {40720, -100},
  661. {41309, -150},
  662. {41772, -200},
  663. };
  664. #elif defined(CONFIG_MACH_KS01SKT) || defined(CONFIG_MACH_KS01KTT) || \
  665. defined(CONFIG_MACH_KS01LGT) || defined(CONFIG_MACH_JACTIVESKT)
  666. static sec_bat_adc_table_data_t temp_table[] = {
  667. {25844, 900},
  668. {26113, 850},
  669. {26398, 800},
  670. {26764, 750},
  671. {27281, 700},
  672. {27669, 650},
  673. {28178, 600},
  674. {28724, 550},
  675. {29342, 500},
  676. {30101, 450},
  677. {30912, 400},
  678. {31807, 350},
  679. {32823, 300},
  680. {33858, 250},
  681. {34950, 200},
  682. {36049, 150},
  683. {37054, 100},
  684. {38025, 50},
  685. {38219, 40},
  686. {38448, 30},
  687. {38626, 20},
  688. {38795, 10},
  689. {38989, 0},
  690. {39229, -10},
  691. {39540, -30},
  692. {39687, -40},
  693. {39822, -50},
  694. {40523, -100},
  695. {41123, -150},
  696. {41619, -200},
  697. };
  698. #elif defined(CONFIG_MACH_PICASSO_SPR)
  699. static sec_bat_adc_table_data_t temp_table[] = {
  700. {1100, 1140},
  701. {1000, 1040},
  702. {700, 940},
  703. {645, 840},
  704. {615, 740},
  705. {600, 640},
  706. {561, 601},
  707. {560, 590},
  708. {536, 566},
  709. {535, 555},
  710. {521, 541},
  711. {520, 520},
  712. {400, 400},
  713. {300, 300},
  714. {200, 200},
  715. {100, 100},
  716. {0, 0},
  717. {-100, -100},
  718. {-200, -200},
  719. {-300, -300},
  720. };
  721. #elif defined(CONFIG_SEC_VIENNA_PROJECT) || defined(CONFIG_SEC_V2_PROJECT) ||\
  722. defined(CONFIG_MACH_PICASSO_EUR) || defined(CONFIG_MACH_LT03)
  723. static sec_bat_adc_table_data_t temp_table[] = {
  724. {1100, 1140},
  725. {1000, 1040},
  726. {900, 940},
  727. {800, 840},
  728. {700, 740},
  729. {600, 640},
  730. {561, 601},
  731. {560, 590},
  732. {536, 566},
  733. {535, 555},
  734. {521, 541},
  735. {520, 520},
  736. {400, 400},
  737. {300, 300},
  738. {200, 200},
  739. {100, 100},
  740. {0, 0},
  741. {-100, -100},
  742. {-200, -200},
  743. {-300, -300},
  744. };
  745. #elif defined(CONFIG_MACH_MONDRIANWIFI_USA)
  746. static sec_bat_adc_table_data_t temp_table[] = {
  747. {1100, 1165},
  748. {1000, 1065},
  749. {900, 965},
  750. {800, 865},
  751. {700, 795},
  752. {616, 700},
  753. {607, 670},
  754. {590, 655},
  755. {580, 640},
  756. {574, 635},
  757. {570, 630},
  758. {565, 605},
  759. {555, 600},
  760. {550, 595},
  761. {545, 585},
  762. {520, 550},
  763. {490, 510},
  764. {470, 500},
  765. {460, 460},
  766. {450, 450},
  767. {400, 400},
  768. {300, 300},
  769. {200, 200},
  770. {100, 100},
  771. {0, 0},
  772. {-10, -10},
  773. {-20, -25},
  774. {-30, -38},
  775. {-40, -52},
  776. {-50, -65},
  777. {-60, -78},
  778. {-70, -90},
  779. {-100, -150},
  780. {-200, -250},
  781. {-300, -350},
  782. {-400, -450},
  783. };
  784. #elif defined(CONFIG_MACH_MONDRIAN)
  785. static sec_bat_adc_table_data_t temp_table[] = {
  786. {1100, 1165},
  787. {1000, 1065},
  788. {900, 965},
  789. {800, 865},
  790. {700, 795},
  791. {616, 700},
  792. {607, 670},
  793. {590, 655},
  794. {580, 640},
  795. {574, 635},
  796. {570, 630},
  797. {565, 605},
  798. {555, 600},
  799. {550, 595},
  800. {545, 585},
  801. {540, 575},
  802. {480, 480},
  803. {470, 470},
  804. {460, 460},
  805. {450, 450},
  806. {400, 400},
  807. {300, 300},
  808. {200, 200},
  809. {100, 100},
  810. {0, 0},
  811. {-10, -10},
  812. {-20, -25},
  813. {-30, -38},
  814. {-40, -52},
  815. {-50, -65},
  816. {-60, -78},
  817. {-70, -90},
  818. {-100, -150},
  819. {-200, -250},
  820. {-300, -350},
  821. {-400, -450},
  822. };
  823. /* only for G870F0 */
  824. #elif defined(CONFIG_MACH_KACTIVELTE_KOR)
  825. static sec_bat_adc_table_data_t temp_table[] = {
  826. {25935, 900},
  827. {26149, 850},
  828. {26399, 800},
  829. {26741, 750},
  830. {27052, 700},
  831. {27441, 650},
  832. {27971, 600},
  833. {28551, 550},
  834. {29229, 500},
  835. {30011, 450},
  836. {30895, 400},
  837. {31867, 350},
  838. {32921, 300},
  839. {34036, 250},
  840. {35168, 200},
  841. {36303, 150},
  842. {37374, 100},
  843. {38371, 50},
  844. {39252, 0},
  845. {40077, -50},
  846. {40826, -100},
  847. {41381, -150},
  848. {41824, -200},
  849. };
  850. #else
  851. static sec_bat_adc_table_data_t temp_table[] = {
  852. {25950, 900},
  853. {26173, 850},
  854. {26424, 800},
  855. {26727, 750},
  856. {26884, 700},
  857. {27346, 650},
  858. {27750, 600},
  859. {28213, 550},
  860. {28760, 500},
  861. {29384, 450},
  862. {30180, 400},
  863. {31095, 350},
  864. {32085, 300},
  865. {33132, 250},
  866. {34242, 200},
  867. {35340, 150},
  868. {36430, 100},
  869. {37471, 50},
  870. {38406, 0},
  871. {39388, -50},
  872. {40184, -100},
  873. {40852, -150},
  874. {41420, -200},
  875. {41685, -210},
  876. {41786, -220},
  877. {41887, -230},
  878. {41987, -240},
  879. {42088, -250},
  880. {42178, -260},
  881. {42268, -270},
  882. {42358, -280},
  883. {42448, -290},
  884. {42538, -300},
  885. };
  886. #endif
  887. static sec_bat_adc_table_data_t chg_temp_table[] = {
  888. {0, 0},
  889. };
  890. #if defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
  891. defined(CONFIG_SEC_KSPORTS_PROJECT)
  892. #define TEMP_HIGHLIMIT_THRESHOLD_EVENT 800
  893. #define TEMP_HIGHLIMIT_RECOVERY_EVENT 750
  894. #define TEMP_HIGHLIMIT_THRESHOLD_NORMAL 800
  895. #define TEMP_HIGHLIMIT_RECOVERY_NORMAL 750
  896. #define TEMP_HIGHLIMIT_THRESHOLD_LPM 800
  897. #define TEMP_HIGHLIMIT_RECOVERY_LPM 750
  898. #endif
  899. #if defined(CONFIG_MACH_KLTE_EUR)
  900. #define TEMP_HIGH_THRESHOLD_EVENT 550
  901. #define TEMP_HIGH_RECOVERY_EVENT 500
  902. #define TEMP_LOW_THRESHOLD_EVENT -50
  903. #define TEMP_LOW_RECOVERY_EVENT 0
  904. #define TEMP_HIGH_THRESHOLD_NORMAL 550
  905. #define TEMP_HIGH_RECOVERY_NORMAL 500
  906. #define TEMP_LOW_THRESHOLD_NORMAL -50
  907. #define TEMP_LOW_RECOVERY_NORMAL 0
  908. #define TEMP_HIGH_THRESHOLD_LPM 550
  909. #define TEMP_HIGH_RECOVERY_LPM 500
  910. #define TEMP_LOW_THRESHOLD_LPM -50
  911. #define TEMP_LOW_RECOVERY_LPM 0
  912. #elif defined(CONFIG_MACH_KLTE_ATT) || defined(CONFIG_MACH_KLTE_TMO) || defined(CONFIG_MACH_KLTE_MTR) || \
  913. defined(CONFIG_MACH_KLTE_VZW) || defined(CONFIG_MACH_KLTE_CAN) || defined(CONFIG_MACH_KLTE_SPR) || defined(CONFIG_MACH_KLTE_LRA)
  914. #define TEMP_HIGH_THRESHOLD_EVENT 550
  915. #define TEMP_HIGH_RECOVERY_EVENT 500
  916. #define TEMP_LOW_THRESHOLD_EVENT -50
  917. #define TEMP_LOW_RECOVERY_EVENT 0
  918. #define TEMP_HIGH_THRESHOLD_NORMAL 550
  919. #define TEMP_HIGH_RECOVERY_NORMAL 500
  920. #define TEMP_LOW_THRESHOLD_NORMAL -50
  921. #define TEMP_LOW_RECOVERY_NORMAL 0
  922. #define TEMP_HIGH_THRESHOLD_LPM 550
  923. #define TEMP_HIGH_RECOVERY_LPM 500
  924. #define TEMP_LOW_THRESHOLD_LPM -50
  925. #define TEMP_LOW_RECOVERY_LPM -20
  926. #elif defined(CONFIG_MACH_KACTIVELTE_SKT)
  927. #define TEMP_HIGH_THRESHOLD_EVENT 600
  928. #define TEMP_HIGH_RECOVERY_EVENT 460
  929. #define TEMP_LOW_THRESHOLD_EVENT -50
  930. #define TEMP_LOW_RECOVERY_EVENT 0
  931. #define TEMP_HIGH_THRESHOLD_NORMAL 560
  932. #define TEMP_HIGH_RECOVERY_NORMAL 460
  933. #define TEMP_LOW_THRESHOLD_NORMAL -50
  934. #define TEMP_LOW_RECOVERY_NORMAL 0
  935. #define TEMP_HIGH_THRESHOLD_LPM 540
  936. #define TEMP_HIGH_RECOVERY_LPM 500
  937. #define TEMP_LOW_THRESHOLD_LPM -50
  938. #define TEMP_LOW_RECOVERY_LPM -20
  939. #elif defined(CONFIG_MACH_KSPORTSLTE_SPR)
  940. #define TEMP_HIGH_THRESHOLD_EVENT 600
  941. #define TEMP_HIGH_RECOVERY_EVENT 460
  942. #define TEMP_LOW_THRESHOLD_EVENT -50
  943. #define TEMP_LOW_RECOVERY_EVENT 0
  944. #define TEMP_HIGH_THRESHOLD_NORMAL 550
  945. #define TEMP_HIGH_RECOVERY_NORMAL 470
  946. #define TEMP_LOW_THRESHOLD_NORMAL -50
  947. #define TEMP_LOW_RECOVERY_NORMAL 0
  948. #define TEMP_HIGH_THRESHOLD_LPM 500
  949. #define TEMP_HIGH_RECOVERY_LPM 480
  950. #define TEMP_LOW_THRESHOLD_LPM -30
  951. #define TEMP_LOW_RECOVERY_LPM 23
  952. #elif defined(CONFIG_MACH_KACTIVELTE_ATT)
  953. #define TEMP_HIGH_THRESHOLD_EVENT 600
  954. #define TEMP_HIGH_RECOVERY_EVENT 460
  955. #define TEMP_LOW_THRESHOLD_EVENT -50
  956. #define TEMP_LOW_RECOVERY_EVENT 0
  957. #define TEMP_HIGH_THRESHOLD_NORMAL 550
  958. #define TEMP_HIGH_RECOVERY_NORMAL 470
  959. #define TEMP_LOW_THRESHOLD_NORMAL -30
  960. #define TEMP_LOW_RECOVERY_NORMAL 20
  961. #define TEMP_HIGH_THRESHOLD_LPM 525
  962. #define TEMP_HIGH_RECOVERY_LPM 470
  963. #define TEMP_LOW_THRESHOLD_LPM -10
  964. #define TEMP_LOW_RECOVERY_LPM 20
  965. #elif defined (CONFIG_MACH_KLTE_ACG)
  966. #define TEMP_HIGH_THRESHOLD_EVENT 540
  967. #define TEMP_HIGH_RECOVERY_EVENT 460
  968. #define TEMP_LOW_THRESHOLD_EVENT -50
  969. #define TEMP_LOW_RECOVERY_EVENT 0
  970. #define TEMP_HIGH_THRESHOLD_NORMAL 540
  971. #define TEMP_HIGH_RECOVERY_NORMAL 460
  972. #define TEMP_LOW_THRESHOLD_NORMAL -50
  973. #define TEMP_LOW_RECOVERY_NORMAL 0
  974. #define TEMP_HIGH_THRESHOLD_LPM 540
  975. #define TEMP_HIGH_RECOVERY_LPM 460
  976. #define TEMP_LOW_THRESHOLD_LPM -50
  977. #define TEMP_LOW_RECOVERY_LPM 0
  978. #elif defined (CONFIG_MACH_KLTE_USC)
  979. #define TEMP_HIGH_THRESHOLD_EVENT 600
  980. #define TEMP_HIGH_RECOVERY_EVENT 460
  981. #define TEMP_LOW_THRESHOLD_EVENT -50
  982. #define TEMP_LOW_RECOVERY_EVENT 0
  983. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  984. #define TEMP_HIGH_RECOVERY_NORMAL 460
  985. #define TEMP_LOW_THRESHOLD_NORMAL -50
  986. #define TEMP_LOW_RECOVERY_NORMAL 0
  987. #define TEMP_HIGH_THRESHOLD_LPM 600
  988. #define TEMP_HIGH_RECOVERY_LPM 460
  989. #define TEMP_LOW_THRESHOLD_LPM -50
  990. #define TEMP_LOW_RECOVERY_LPM 0
  991. #elif defined (CONFIG_MACH_KLTE_JPN)
  992. #define TEMP_HIGH_THRESHOLD_EVENT 580
  993. #define TEMP_HIGH_RECOVERY_EVENT 530
  994. #define TEMP_LOW_THRESHOLD_EVENT -50
  995. #define TEMP_LOW_RECOVERY_EVENT 0
  996. #define TEMP_HIGH_THRESHOLD_NORMAL 580
  997. #define TEMP_HIGH_RECOVERY_NORMAL 530
  998. #define TEMP_LOW_THRESHOLD_NORMAL -50
  999. #define TEMP_LOW_RECOVERY_NORMAL 0
  1000. #define TEMP_HIGH_THRESHOLD_LPM 580
  1001. #define TEMP_HIGH_RECOVERY_LPM 530
  1002. #define TEMP_LOW_THRESHOLD_LPM -50
  1003. #define TEMP_LOW_RECOVERY_LPM 0
  1004. #elif defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
  1005. defined(CONFIG_SEC_LOCALE_CHN)
  1006. #define TEMP_HIGH_THRESHOLD_EVENT 580
  1007. #define TEMP_HIGH_RECOVERY_EVENT 530
  1008. #define TEMP_LOW_THRESHOLD_EVENT -50
  1009. #define TEMP_LOW_RECOVERY_EVENT 0
  1010. #define TEMP_HIGH_THRESHOLD_NORMAL 580
  1011. #define TEMP_HIGH_RECOVERY_NORMAL 530
  1012. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1013. #define TEMP_LOW_RECOVERY_NORMAL 0
  1014. #define TEMP_HIGH_THRESHOLD_LPM 580
  1015. #define TEMP_HIGH_RECOVERY_LPM 530
  1016. #define TEMP_LOW_THRESHOLD_LPM -50
  1017. #define TEMP_LOW_RECOVERY_LPM 0
  1018. #elif defined(CONFIG_MACH_HLTESKT) || defined(CONFIG_MACH_HLTEKTT) || defined(CONFIG_MACH_HLTELGT)
  1019. #define TEMP_HIGH_THRESHOLD_EVENT 680
  1020. #define TEMP_HIGH_RECOVERY_EVENT 440
  1021. #define TEMP_LOW_THRESHOLD_EVENT -45
  1022. #define TEMP_LOW_RECOVERY_EVENT 0
  1023. #define TEMP_HIGH_THRESHOLD_NORMAL 680
  1024. #define TEMP_HIGH_RECOVERY_NORMAL 440
  1025. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1026. #define TEMP_LOW_RECOVERY_NORMAL 0
  1027. #define TEMP_HIGH_THRESHOLD_LPM 680
  1028. #define TEMP_HIGH_RECOVERY_LPM 440
  1029. #define TEMP_LOW_THRESHOLD_LPM -45
  1030. #define TEMP_LOW_RECOVERY_LPM 0
  1031. #elif defined(CONFIG_MACH_FRESCOLTESKT)||defined(CONFIG_MACH_FRESCOLTEKTT)||defined(CONFIG_MACH_FRESCOLTELGT)
  1032. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1033. #define TEMP_HIGH_RECOVERY_EVENT 460
  1034. #define TEMP_LOW_THRESHOLD_EVENT -50
  1035. #define TEMP_LOW_RECOVERY_EVENT 0
  1036. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1037. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1038. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1039. #define TEMP_LOW_RECOVERY_NORMAL 0
  1040. #define TEMP_HIGH_THRESHOLD_LPM 600
  1041. #define TEMP_HIGH_RECOVERY_LPM 460
  1042. #define TEMP_LOW_THRESHOLD_LPM -50
  1043. #define TEMP_LOW_RECOVERY_LPM 0
  1044. #elif defined(CONFIG_MACH_HLTEATT) || defined(CONFIG_MACH_HLTETMO)
  1045. #define TEMP_HIGH_THRESHOLD_EVENT 610
  1046. #define TEMP_HIGH_RECOVERY_EVENT 400
  1047. #define TEMP_LOW_THRESHOLD_EVENT -45
  1048. #define TEMP_LOW_RECOVERY_EVENT 0
  1049. #define TEMP_HIGH_THRESHOLD_NORMAL 490
  1050. #define TEMP_HIGH_RECOVERY_NORMAL 440
  1051. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1052. #define TEMP_LOW_RECOVERY_NORMAL 0
  1053. #define TEMP_HIGH_THRESHOLD_LPM 490
  1054. #define TEMP_HIGH_RECOVERY_LPM 440
  1055. #define TEMP_LOW_THRESHOLD_LPM -45
  1056. #define TEMP_LOW_RECOVERY_LPM 0
  1057. #elif defined(CONFIG_MACH_HLTESPR)
  1058. #define TEMP_HIGH_THRESHOLD_EVENT 640
  1059. #define TEMP_HIGH_RECOVERY_EVENT 438
  1060. #define TEMP_LOW_THRESHOLD_EVENT -37
  1061. #define TEMP_LOW_RECOVERY_EVENT 11
  1062. #define TEMP_HIGH_THRESHOLD_NORMAL 529
  1063. #define TEMP_HIGH_RECOVERY_NORMAL 438
  1064. #define TEMP_LOW_THRESHOLD_NORMAL -37
  1065. #define TEMP_LOW_RECOVERY_NORMAL 11
  1066. #define TEMP_HIGH_THRESHOLD_LPM 529
  1067. #define TEMP_HIGH_RECOVERY_LPM 459
  1068. #define TEMP_LOW_THRESHOLD_LPM -23
  1069. #define TEMP_LOW_RECOVERY_LPM -10
  1070. #elif defined(CONFIG_MACH_HLTEVZW)
  1071. #define TEMP_HIGH_THRESHOLD_EVENT 650
  1072. #define TEMP_HIGH_RECOVERY_EVENT 450
  1073. #define TEMP_LOW_THRESHOLD_EVENT -45
  1074. #define TEMP_LOW_RECOVERY_EVENT -10
  1075. #define TEMP_HIGH_THRESHOLD_NORMAL 550
  1076. #define TEMP_HIGH_RECOVERY_NORMAL 450
  1077. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1078. #define TEMP_LOW_RECOVERY_NORMAL -10
  1079. #define TEMP_HIGH_THRESHOLD_LPM 520
  1080. #define TEMP_HIGH_RECOVERY_LPM 470
  1081. #define TEMP_LOW_THRESHOLD_LPM -45
  1082. #define TEMP_LOW_RECOVERY_LPM -15
  1083. #elif defined(CONFIG_MACH_HLTEDCM)
  1084. #define TEMP_HIGH_THRESHOLD_EVENT 625
  1085. #define TEMP_HIGH_RECOVERY_EVENT 420
  1086. #define TEMP_LOW_THRESHOLD_EVENT -45
  1087. #define TEMP_LOW_RECOVERY_EVENT -5
  1088. #define TEMP_HIGH_THRESHOLD_NORMAL 625
  1089. #define TEMP_HIGH_RECOVERY_NORMAL 420
  1090. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1091. #define TEMP_LOW_RECOVERY_NORMAL -5
  1092. #define TEMP_HIGH_THRESHOLD_LPM 625
  1093. #define TEMP_HIGH_RECOVERY_LPM 420
  1094. #define TEMP_LOW_THRESHOLD_LPM -45
  1095. #define TEMP_LOW_RECOVERY_LPM -5
  1096. #elif defined(CONFIG_MACH_HLTEKDI)
  1097. #define TEMP_HIGH_THRESHOLD_EVENT 660
  1098. #define TEMP_HIGH_RECOVERY_EVENT 420
  1099. #define TEMP_LOW_THRESHOLD_EVENT -50
  1100. #define TEMP_LOW_RECOVERY_EVENT 0
  1101. #define TEMP_HIGH_THRESHOLD_NORMAL 660
  1102. #define TEMP_HIGH_RECOVERY_NORMAL 420
  1103. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1104. #define TEMP_LOW_RECOVERY_NORMAL 0
  1105. #define TEMP_HIGH_THRESHOLD_LPM 660
  1106. #define TEMP_HIGH_RECOVERY_LPM 420
  1107. #define TEMP_LOW_THRESHOLD_LPM -50
  1108. #define TEMP_LOW_RECOVERY_LPM 0
  1109. #elif defined(CONFIG_MACH_HLTEUSC)
  1110. #define TEMP_HIGH_THRESHOLD_EVENT 650
  1111. #define TEMP_HIGH_RECOVERY_EVENT 440
  1112. #define TEMP_LOW_THRESHOLD_EVENT -45
  1113. #define TEMP_LOW_RECOVERY_EVENT 0
  1114. #define TEMP_HIGH_THRESHOLD_NORMAL 640
  1115. #define TEMP_HIGH_RECOVERY_NORMAL 450
  1116. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1117. #define TEMP_LOW_RECOVERY_NORMAL 0
  1118. #define TEMP_HIGH_THRESHOLD_LPM 650
  1119. #define TEMP_HIGH_RECOVERY_LPM 440
  1120. #define TEMP_LOW_THRESHOLD_LPM -45
  1121. #define TEMP_LOW_RECOVERY_LPM 0
  1122. #elif defined(CONFIG_MACH_H3GDUOS_CTC)
  1123. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1124. #define TEMP_HIGH_RECOVERY_EVENT 460
  1125. #define TEMP_LOW_THRESHOLD_EVENT -50
  1126. #define TEMP_LOW_RECOVERY_EVENT 0
  1127. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1128. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1129. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1130. #define TEMP_LOW_RECOVERY_NORMAL 0
  1131. #define TEMP_HIGH_THRESHOLD_LPM 600
  1132. #define TEMP_HIGH_RECOVERY_LPM 460
  1133. #define TEMP_LOW_THRESHOLD_LPM -50
  1134. #define TEMP_LOW_RECOVERY_LPM 0
  1135. #elif defined(CONFIG_MACH_HLTEAUS)
  1136. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1137. #define TEMP_HIGH_RECOVERY_EVENT 460
  1138. #define TEMP_LOW_THRESHOLD_EVENT -50
  1139. #define TEMP_LOW_RECOVERY_EVENT 0
  1140. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1141. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1142. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1143. #define TEMP_LOW_RECOVERY_NORMAL 0
  1144. #define TEMP_HIGH_THRESHOLD_LPM 600
  1145. #define TEMP_HIGH_RECOVERY_LPM 460
  1146. #define TEMP_LOW_THRESHOLD_LPM -50
  1147. #define TEMP_LOW_RECOVERY_LPM 0
  1148. #elif defined(CONFIG_MACH_H3G_CHN_CMCC)
  1149. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1150. #define TEMP_HIGH_RECOVERY_EVENT 460
  1151. #define TEMP_LOW_THRESHOLD_EVENT -45
  1152. #define TEMP_LOW_RECOVERY_EVENT 0
  1153. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1154. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1155. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1156. #define TEMP_LOW_RECOVERY_NORMAL 0
  1157. #define TEMP_HIGH_THRESHOLD_LPM 600
  1158. #define TEMP_HIGH_RECOVERY_LPM 460
  1159. #define TEMP_LOW_THRESHOLD_LPM -45
  1160. #define TEMP_LOW_RECOVERY_LPM 0
  1161. #elif defined(CONFIG_MACH_HLTEEUR)
  1162. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1163. #define TEMP_HIGH_RECOVERY_EVENT 400
  1164. #define TEMP_LOW_THRESHOLD_EVENT -45
  1165. #define TEMP_LOW_RECOVERY_EVENT 0
  1166. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1167. #define TEMP_HIGH_RECOVERY_NORMAL 400
  1168. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1169. #define TEMP_LOW_RECOVERY_NORMAL 0
  1170. #define TEMP_HIGH_THRESHOLD_LPM 600
  1171. #define TEMP_HIGH_RECOVERY_LPM 400
  1172. #define TEMP_LOW_THRESHOLD_LPM -45
  1173. #define TEMP_LOW_RECOVERY_LPM 0
  1174. /* H Project*/
  1175. #elif defined(CONFIG_SEC_H_PROJECT)
  1176. #define TEMP_HIGH_THRESHOLD_EVENT 650
  1177. #define TEMP_HIGH_RECOVERY_EVENT 440
  1178. #define TEMP_LOW_THRESHOLD_EVENT -45
  1179. #define TEMP_LOW_RECOVERY_EVENT 0
  1180. #define TEMP_HIGH_THRESHOLD_NORMAL 650
  1181. #define TEMP_HIGH_RECOVERY_NORMAL 440
  1182. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1183. #define TEMP_LOW_RECOVERY_NORMAL 0
  1184. #define TEMP_HIGH_THRESHOLD_LPM 650
  1185. #define TEMP_HIGH_RECOVERY_LPM 440
  1186. #define TEMP_LOW_THRESHOLD_LPM -45
  1187. #define TEMP_LOW_RECOVERY_LPM 0
  1188. /* JS Project*/
  1189. #elif defined(CONFIG_SEC_JS_PROJECT)
  1190. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1191. #define TEMP_HIGH_RECOVERY_EVENT 400
  1192. #define TEMP_LOW_THRESHOLD_EVENT -50
  1193. #define TEMP_LOW_RECOVERY_EVENT 0
  1194. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1195. #define TEMP_HIGH_RECOVERY_NORMAL 400
  1196. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1197. #define TEMP_LOW_RECOVERY_NORMAL 0
  1198. #define TEMP_HIGH_THRESHOLD_LPM 600
  1199. #define TEMP_HIGH_RECOVERY_LPM 400
  1200. #define TEMP_LOW_THRESHOLD_LPM -50
  1201. #define TEMP_LOW_RECOVERY_LPM 0
  1202. #elif defined(CONFIG_MACH_FLTEEUR) || defined(CONFIG_MACH_FLTESKT)
  1203. #define TEMP_HIGH_THRESHOLD_EVENT 700
  1204. #define TEMP_HIGH_RECOVERY_EVENT 460
  1205. #define TEMP_LOW_THRESHOLD_EVENT -50
  1206. #define TEMP_LOW_RECOVERY_EVENT 0
  1207. #define TEMP_HIGH_THRESHOLD_NORMAL 700
  1208. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1209. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1210. #define TEMP_LOW_RECOVERY_NORMAL 0
  1211. #define TEMP_HIGH_THRESHOLD_LPM 700
  1212. #define TEMP_HIGH_RECOVERY_LPM 460
  1213. #define TEMP_LOW_THRESHOLD_LPM -50
  1214. #define TEMP_LOW_RECOVERY_LPM 0
  1215. #elif defined(CONFIG_SEC_KS01_PROJECT)
  1216. #if defined(CONFIG_MACH_KS01EUR)
  1217. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1218. #define TEMP_HIGH_RECOVERY_EVENT 460
  1219. #define TEMP_LOW_THRESHOLD_EVENT -50
  1220. #define TEMP_LOW_RECOVERY_EVENT 0
  1221. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1222. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1223. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1224. #define TEMP_LOW_RECOVERY_NORMAL 0
  1225. #define TEMP_HIGH_THRESHOLD_LPM 600
  1226. #define TEMP_HIGH_RECOVERY_LPM 460
  1227. #define TEMP_LOW_THRESHOLD_LPM -50
  1228. #define TEMP_LOW_RECOVERY_LPM 0
  1229. #elif defined(CONFIG_MACH_KS01SKT) || defined(CONFIG_MACH_KS01LGT)
  1230. #define TEMP_HIGH_THRESHOLD_EVENT 670
  1231. #define TEMP_HIGH_RECOVERY_EVENT 420
  1232. #define TEMP_LOW_THRESHOLD_EVENT -45
  1233. #define TEMP_LOW_RECOVERY_EVENT 0
  1234. #define TEMP_HIGH_THRESHOLD_NORMAL 670
  1235. #define TEMP_HIGH_RECOVERY_NORMAL 420
  1236. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1237. #define TEMP_LOW_RECOVERY_NORMAL 0
  1238. #define TEMP_HIGH_THRESHOLD_LPM 670
  1239. #define TEMP_HIGH_RECOVERY_LPM 420
  1240. #define TEMP_LOW_THRESHOLD_LPM -45
  1241. #define TEMP_LOW_RECOVERY_LPM 0
  1242. #else /* CONFIG_MACH_KS01KTT */
  1243. #define TEMP_HIGH_THRESHOLD_EVENT 670
  1244. #define TEMP_HIGH_RECOVERY_EVENT 440
  1245. #define TEMP_LOW_THRESHOLD_EVENT -45
  1246. #define TEMP_LOW_RECOVERY_EVENT 0
  1247. #define TEMP_HIGH_THRESHOLD_NORMAL 670
  1248. #define TEMP_HIGH_RECOVERY_NORMAL 440
  1249. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1250. #define TEMP_LOW_RECOVERY_NORMAL 0
  1251. #define TEMP_HIGH_THRESHOLD_LPM 670
  1252. #define TEMP_HIGH_RECOVERY_LPM 440
  1253. #define TEMP_LOW_THRESHOLD_LPM -45
  1254. #define TEMP_LOW_RECOVERY_LPM 0
  1255. #endif
  1256. #elif defined(CONFIG_SEC_JACTIVE_PROJECT)
  1257. #define TEMP_HIGH_THRESHOLD_EVENT 670
  1258. #define TEMP_HIGH_RECOVERY_EVENT 420
  1259. #define TEMP_LOW_THRESHOLD_EVENT -45
  1260. #define TEMP_LOW_RECOVERY_EVENT 0
  1261. #define TEMP_HIGH_THRESHOLD_NORMAL 670
  1262. #define TEMP_HIGH_RECOVERY_NORMAL 420
  1263. #define TEMP_LOW_THRESHOLD_NORMAL -45
  1264. #define TEMP_LOW_RECOVERY_NORMAL 0
  1265. #define TEMP_HIGH_THRESHOLD_LPM 670
  1266. #define TEMP_HIGH_RECOVERY_LPM 420
  1267. #define TEMP_LOW_THRESHOLD_LPM -45
  1268. #define TEMP_LOW_RECOVERY_LPM 0
  1269. #elif defined(CONFIG_MACH_MONDRIANWIFI_USA)
  1270. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1271. #define TEMP_HIGH_RECOVERY_EVENT 450
  1272. #define TEMP_LOW_THRESHOLD_EVENT -50
  1273. #define TEMP_LOW_RECOVERY_EVENT 0
  1274. #define TEMP_HIGH_THRESHOLD_NORMAL 510
  1275. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1276. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1277. #define TEMP_LOW_RECOVERY_NORMAL 0
  1278. #define TEMP_HIGH_THRESHOLD_LPM 600
  1279. #define TEMP_HIGH_RECOVERY_LPM 450
  1280. #define TEMP_LOW_THRESHOLD_LPM -50
  1281. #define TEMP_LOW_RECOVERY_LPM 0
  1282. #elif defined(CONFIG_MACH_MONDRIAN)
  1283. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1284. #define TEMP_HIGH_RECOVERY_EVENT 460
  1285. #define TEMP_LOW_THRESHOLD_EVENT -50
  1286. #define TEMP_LOW_RECOVERY_EVENT 0
  1287. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1288. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1289. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1290. #define TEMP_LOW_RECOVERY_NORMAL 0
  1291. #define TEMP_HIGH_THRESHOLD_LPM 600
  1292. #define TEMP_HIGH_RECOVERY_LPM 460
  1293. #define TEMP_LOW_THRESHOLD_LPM -50
  1294. #define TEMP_LOW_RECOVERY_LPM 0
  1295. #elif defined(CONFIG_MACH_VIENNAVZW)
  1296. #define TEMP_HIGH_THRESHOLD_EVENT 590
  1297. #define TEMP_HIGH_RECOVERY_EVENT 470
  1298. #define TEMP_LOW_THRESHOLD_EVENT -25
  1299. #define TEMP_LOW_RECOVERY_EVENT 15
  1300. #define TEMP_HIGH_THRESHOLD_NORMAL 530
  1301. #define TEMP_HIGH_RECOVERY_NORMAL 480
  1302. #define TEMP_LOW_THRESHOLD_NORMAL -25
  1303. #define TEMP_LOW_RECOVERY_NORMAL 15
  1304. #define TEMP_HIGH_THRESHOLD_LPM 500
  1305. #define TEMP_HIGH_RECOVERY_LPM 460
  1306. #define TEMP_LOW_THRESHOLD_LPM -40
  1307. #define TEMP_LOW_RECOVERY_LPM 5
  1308. #elif defined(CONFIG_MACH_VIENNAATT)
  1309. #define TEMP_HIGH_THRESHOLD_EVENT 590
  1310. #define TEMP_HIGH_RECOVERY_EVENT 470
  1311. #define TEMP_LOW_THRESHOLD_EVENT -25
  1312. #define TEMP_LOW_RECOVERY_EVENT 5
  1313. #define TEMP_HIGH_THRESHOLD_NORMAL 545
  1314. #define TEMP_HIGH_RECOVERY_NORMAL 470
  1315. #define TEMP_LOW_THRESHOLD_NORMAL -25
  1316. #define TEMP_LOW_RECOVERY_NORMAL 5
  1317. #define TEMP_HIGH_THRESHOLD_LPM 500
  1318. #define TEMP_HIGH_RECOVERY_LPM 480
  1319. #define TEMP_LOW_THRESHOLD_LPM -35
  1320. #define TEMP_LOW_RECOVERY_LPM 5
  1321. #elif defined(CONFIG_MACH_V2)
  1322. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1323. #define TEMP_HIGH_RECOVERY_EVENT 460
  1324. #define TEMP_LOW_THRESHOLD_EVENT -40
  1325. #define TEMP_LOW_RECOVERY_EVENT 10
  1326. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1327. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1328. #define TEMP_LOW_THRESHOLD_NORMAL -40
  1329. #define TEMP_LOW_RECOVERY_NORMAL 10
  1330. #define TEMP_HIGH_THRESHOLD_LPM 600
  1331. #define TEMP_HIGH_RECOVERY_LPM 460
  1332. #define TEMP_LOW_THRESHOLD_LPM -40
  1333. #define TEMP_LOW_RECOVERY_LPM 10
  1334. #elif defined(CONFIG_MACH_VIENNAEUR) || defined(CONFIG_MACH_VIENNAKOR)
  1335. #define TEMP_HIGH_THRESHOLD_EVENT 590
  1336. #define TEMP_HIGH_RECOVERY_EVENT 460
  1337. #define TEMP_LOW_THRESHOLD_EVENT -40
  1338. #define TEMP_LOW_RECOVERY_EVENT 10
  1339. #define TEMP_HIGH_THRESHOLD_NORMAL 590
  1340. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1341. #define TEMP_LOW_THRESHOLD_NORMAL -40
  1342. #define TEMP_LOW_RECOVERY_NORMAL 10
  1343. #define TEMP_HIGH_THRESHOLD_LPM 590
  1344. #define TEMP_HIGH_RECOVERY_LPM 460
  1345. #define TEMP_LOW_THRESHOLD_LPM -40
  1346. #define TEMP_LOW_RECOVERY_LPM 10
  1347. #elif defined(CONFIG_MACH_PICASSO_SPR)
  1348. #define TEMP_HIGH_THRESHOLD_EVENT 507
  1349. #define TEMP_HIGH_RECOVERY_EVENT 460
  1350. #define TEMP_LOW_THRESHOLD_EVENT -50
  1351. #define TEMP_LOW_RECOVERY_EVENT 0
  1352. #define TEMP_HIGH_THRESHOLD_NORMAL 507
  1353. #define TEMP_HIGH_RECOVERY_NORMAL 470
  1354. #define TEMP_LOW_THRESHOLD_NORMAL -33
  1355. #define TEMP_LOW_RECOVERY_NORMAL 4
  1356. #define TEMP_HIGH_THRESHOLD_LPM 490
  1357. #define TEMP_HIGH_RECOVERY_LPM 480
  1358. #define TEMP_LOW_THRESHOLD_LPM 10
  1359. #define TEMP_LOW_RECOVERY_LPM 15
  1360. #elif defined(CONFIG_MACH_PICASSO_EUR)
  1361. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1362. #define TEMP_HIGH_RECOVERY_EVENT 460
  1363. #define TEMP_LOW_THRESHOLD_EVENT -50
  1364. #define TEMP_LOW_RECOVERY_EVENT 0
  1365. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1366. #define TEMP_HIGH_RECOVERY_NORMAL 460
  1367. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1368. #define TEMP_LOW_RECOVERY_NORMAL 0
  1369. #define TEMP_HIGH_THRESHOLD_LPM 600
  1370. #define TEMP_HIGH_RECOVERY_LPM 460
  1371. #define TEMP_LOW_THRESHOLD_LPM -50
  1372. #define TEMP_LOW_RECOVERY_LPM 0
  1373. #elif defined(CONFIG_MACH_LT03)
  1374. #if defined(CONFIG_MACH_LT03_VZW)
  1375. #define TEMP_HIGH_THRESHOLD_EVENT 567
  1376. #define TEMP_HIGH_RECOVERY_EVENT 480
  1377. #define TEMP_LOW_THRESHOLD_EVENT -50
  1378. #define TEMP_LOW_RECOVERY_EVENT 0
  1379. #define TEMP_HIGH_THRESHOLD_NORMAL 530
  1380. #define TEMP_HIGH_RECOVERY_NORMAL 480
  1381. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1382. #define TEMP_LOW_RECOVERY_NORMAL 0
  1383. #define TEMP_HIGH_THRESHOLD_LPM 507
  1384. #define TEMP_HIGH_RECOVERY_LPM 480
  1385. #define TEMP_LOW_THRESHOLD_LPM -20
  1386. #define TEMP_LOW_RECOVERY_LPM 0
  1387. #elif defined(CONFIG_MACH_LT03_TMO)
  1388. #define TEMP_HIGH_THRESHOLD_EVENT 530
  1389. #define TEMP_HIGH_RECOVERY_EVENT 480
  1390. #define TEMP_LOW_THRESHOLD_EVENT -50
  1391. #define TEMP_LOW_RECOVERY_EVENT 0
  1392. #define TEMP_HIGH_THRESHOLD_NORMAL 530
  1393. #define TEMP_HIGH_RECOVERY_NORMAL 480
  1394. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1395. #define TEMP_LOW_RECOVERY_NORMAL 0
  1396. #define TEMP_HIGH_THRESHOLD_LPM 510
  1397. #define TEMP_HIGH_RECOVERY_LPM 460
  1398. #define TEMP_LOW_THRESHOLD_LPM -50
  1399. #define TEMP_LOW_RECOVERY_LPM 0
  1400. #else
  1401. #define TEMP_HIGH_THRESHOLD_EVENT 600
  1402. #define TEMP_HIGH_RECOVERY_EVENT 400
  1403. #define TEMP_LOW_THRESHOLD_EVENT -50
  1404. #define TEMP_LOW_RECOVERY_EVENT 0
  1405. #define TEMP_HIGH_THRESHOLD_NORMAL 600
  1406. #define TEMP_HIGH_RECOVERY_NORMAL 400
  1407. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1408. #define TEMP_LOW_RECOVERY_NORMAL 0
  1409. #define TEMP_HIGH_THRESHOLD_LPM 600
  1410. #define TEMP_HIGH_RECOVERY_LPM 400
  1411. #define TEMP_LOW_THRESHOLD_LPM -50
  1412. #define TEMP_LOW_RECOVERY_LPM 0
  1413. #endif
  1414. #else
  1415. #define TEMP_HIGH_THRESHOLD_EVENT 700
  1416. #define TEMP_HIGH_RECOVERY_EVENT 420
  1417. #define TEMP_LOW_THRESHOLD_EVENT -50
  1418. #define TEMP_LOW_RECOVERY_EVENT 0
  1419. #define TEMP_HIGH_THRESHOLD_NORMAL 700
  1420. #define TEMP_HIGH_RECOVERY_NORMAL 420
  1421. #define TEMP_LOW_THRESHOLD_NORMAL -50
  1422. #define TEMP_LOW_RECOVERY_NORMAL 0
  1423. #define TEMP_HIGH_THRESHOLD_LPM 700
  1424. #define TEMP_HIGH_RECOVERY_LPM 420
  1425. #define TEMP_LOW_THRESHOLD_LPM -50
  1426. #define TEMP_LOW_RECOVERY_LPM 0
  1427. #endif
  1428. #if defined(CONFIG_BATTERY_SWELLING)
  1429. #if defined(CONFIG_MACH_KACTIVELTE_KOR)
  1430. #define BATT_SWELLING_HIGH_TEMP_BLOCK 450
  1431. #define BATT_SWELLING_HIGH_TEMP_RECOV 400
  1432. #define BATT_SWELLING_LOW_TEMP_BLOCK 100
  1433. #define BATT_SWELLING_LOW_TEMP_RECOV 150
  1434. #define BATT_SWELLING_HIGH_CHG_CURRENT 1400
  1435. #define BATT_SWELLING_LOW_CHG_CURRENT 1000
  1436. #define BATT_SWELLING_DROP_FLOAT_VOLTAGE 4200
  1437. #define BATT_SWELLING_HIGH_RECHG_VOLTAGE 4150
  1438. #define BATT_SWELLING_LOW_RECHG_VOLTAGE 4050
  1439. #elif defined(CONFIG_SEC_K_PROJECT)
  1440. #define BATT_SWELLING_HIGH_TEMP_BLOCK 500
  1441. #define BATT_SWELLING_HIGH_TEMP_RECOV 450
  1442. #define BATT_SWELLING_LOW_TEMP_BLOCK 50
  1443. #define BATT_SWELLING_LOW_TEMP_RECOV 100
  1444. #define BATT_SWELLING_HIGH_CHG_CURRENT 0
  1445. #define BATT_SWELLING_LOW_CHG_CURRENT 1400
  1446. #define BATT_SWELLING_DROP_FLOAT_VOLTAGE 4200
  1447. #define BATT_SWELLING_HIGH_RECHG_VOLTAGE 4150
  1448. #define BATT_SWELLING_LOW_RECHG_VOLTAGE 4050
  1449. #else
  1450. #define BATT_SWELLING_HIGH_TEMP_BLOCK 450
  1451. #define BATT_SWELLING_HIGH_TEMP_RECOV 400
  1452. #define BATT_SWELLING_LOW_TEMP_BLOCK 100
  1453. #define BATT_SWELLING_LOW_TEMP_RECOV 150
  1454. #define BATT_SWELLING_HIGH_CHG_CURRENT 0
  1455. #define BATT_SWELLING_LOW_CHG_CURRENT 0
  1456. #define BATT_SWELLING_DROP_FLOAT_VOLTAGE 4200
  1457. #define BATT_SWELLING_HIGH_RECHG_VOLTAGE 4150
  1458. #define BATT_SWELLING_LOW_RECHG_VOLTAGE 4050
  1459. #endif
  1460. #endif //CONFIG_BATTERY_SWELLING
  1461. #endif //CONFIG_BATTERY_SAMSUNG_DATA
  1462. #if defined(CONFIG_MACH_MONDRIAN)
  1463. int sec_bat_check_battery_company(void)
  1464. {
  1465. int result = BATT_TYPE_ATL;
  1466. int rc, data = -1;
  1467. struct qpnp_vadc_result results;
  1468. rc = qpnp_vadc_read(NULL, LR_MUX5_PU2_AMUX_THM2, &results);
  1469. if (rc) {
  1470. pr_err("%s: Unable to read batt id rc=%d\n",
  1471. __func__, rc);
  1472. return BATT_TYPE_ATL;
  1473. }
  1474. data = results.adc_code;
  1475. pr_info("%s: batt_id_adc = (%d)\n", __func__, data);
  1476. /* SDI: 28500, ATL: 31000 */
  1477. if (data > 31000) {
  1478. result = BATT_TYPE_ATL;
  1479. } else {
  1480. result = BATT_TYPE_SDI;
  1481. }
  1482. return result;
  1483. }
  1484. #endif
  1485. void sec_bat_check_batt_id(struct sec_battery_info *battery)
  1486. {
  1487. #if defined(CONFIG_SENSORS_QPNP_ADC_VOLTAGE)
  1488. #if defined(CONFIG_FUELGAUGE_MAX17050)
  1489. int rc, data = -1;
  1490. struct qpnp_vadc_result results;
  1491. #if defined(CONFIG_MACH_PICASSO) || defined(CONFIG_MACH_LT03) || defined(CONFIG_MACH_VIENNA)
  1492. rc = qpnp_vadc_read(NULL, LR_MUX9_PU2_AMUX_THM5, &results);
  1493. #else
  1494. rc = qpnp_vadc_read(NULL, LR_MUX5_PU2_AMUX_THM2, &results);
  1495. #endif
  1496. if (rc) {
  1497. pr_err("%s: Unable to read batt id rc=%d\n",
  1498. __func__, rc);
  1499. return;
  1500. }
  1501. data = results.adc_code;
  1502. pr_info("%s: batt_id_adc = (%d)\n", __func__, data);
  1503. #if defined(CONFIG_MACH_PICASSO) || defined(CONFIG_MACH_LT03)
  1504. /* SDI: 28000, BYD: 29000, ATL: 31000 */
  1505. if (data > 31000) { /* ATL */
  1506. battery->pdata->vendor = "ATL ATL";
  1507. samsung_battery_data[0].Capacity = 0x4074;
  1508. samsung_battery_data[0].type_str = "ATL";
  1509. } else if (data > 29000) { /* BYD */
  1510. battery->pdata->vendor = "BYD BYD";
  1511. samsung_battery_data[0].Capacity = 0x4010;
  1512. samsung_battery_data[0].type_str = "BYD";
  1513. }
  1514. #endif
  1515. #if defined(CONFIG_MACH_VIENNA) || defined(CONFIG_MACH_MONDRIAN)
  1516. /* SDI: 28500, ATL: 31000 */
  1517. if (data > 31000) {
  1518. battery->pdata->vendor = "ATL ATL";
  1519. #if defined(CONFIG_MACH_MONDRIAN)
  1520. samsung_battery_data[0].Capacity = 0x2614; /* Mondrian : 4874mAh */
  1521. #else
  1522. samsung_battery_data[0].Capacity = 0x4958; /* Vienna */
  1523. #endif
  1524. samsung_battery_data[0].type_str = "ATL";
  1525. }
  1526. #endif
  1527. pr_err("%s: batt_type(%s), batt_id(%d), cap(0x%x), type(%s)\n",
  1528. __func__, battery->pdata->vendor, data,
  1529. samsung_battery_data[0].Capacity, samsung_battery_data[0].type_str);
  1530. #endif
  1531. #endif
  1532. }
  1533. static void sec_bat_adc_ap_init(struct platform_device *pdev,
  1534. struct sec_battery_info *battery)
  1535. {
  1536. #if 0
  1537. struct power_supply *psy_fuelgauge;
  1538. struct sec_fuelgauge_info *fuelgauge;
  1539. psy_fuelgauge = get_power_supply_by_name(battery->pdata->fuelgauge_name);
  1540. if (!psy_fuelgauge) {
  1541. pr_err("%s : can't get sec-fuelgauge\n", __func__);
  1542. } else {
  1543. fuelgauge = container_of(psy_fuelgauge, struct sec_fuelgauge_info, psy_fg);
  1544. adc_client = qpnp_get_vadc(&fuelgauge->client->dev, "sec-fuelgauge");
  1545. if (IS_ERR(adc_client)) {
  1546. int rc;
  1547. rc = PTR_ERR(adc_client);
  1548. if (rc != -EPROBE_DEFER)
  1549. pr_err("%s: Fail to get vadc %d\n", __func__, rc);
  1550. }
  1551. }
  1552. #endif
  1553. #if defined(CONFIG_ARCH_MSM8974PRO)
  1554. temp_channel = LR_MUX5_PU1_AMUX_THM2;
  1555. #elif defined(CONFIG_SEC_H_PROJECT) || defined(CONFIG_SEC_JS_PROJECT) || defined(CONFIG_SEC_KS01_PROJECT) || defined(CONFIG_SEC_FRESCO_PROJECT) || defined(CONFIG_SEC_JACTIVE_PROJECT)
  1556. temp_channel = LR_MUX5_PU2_AMUX_THM2;
  1557. #else
  1558. temp_channel = LR_MUX4_PU2_AMUX_THM1;
  1559. #endif
  1560. if (battery->pdata->chg_temp_check)
  1561. chg_temp_channel = LR_MUX9_PU1_AMUX_THM5;
  1562. #if defined(CONFIG_FUELGAUGE_MAX17050)
  1563. /* battery id checking*/
  1564. sec_bat_check_batt_id(battery);
  1565. #endif
  1566. }
  1567. static int sec_bat_adc_ap_read(struct sec_battery_info *battery, int channel)
  1568. {
  1569. struct qpnp_vadc_result results;
  1570. int rc = -1;
  1571. int data = -1;
  1572. switch (channel)
  1573. {
  1574. case SEC_BAT_ADC_CHANNEL_TEMP :
  1575. rc = qpnp_vadc_read(NULL, temp_channel, &results);
  1576. if (rc) {
  1577. pr_err("%s: Unable to read batt temperature rc=%d\n",
  1578. __func__, rc);
  1579. return 0;
  1580. }
  1581. data = results.adc_code;
  1582. break;
  1583. case SEC_BAT_ADC_CHANNEL_TEMP_AMBIENT:
  1584. data = 33000;
  1585. break;
  1586. case SEC_BAT_ADC_CHANNEL_BAT_CHECK :
  1587. qpnp_vadc_read(NULL, P_MUX8_1_3, &results);
  1588. data = ((int)results.physical) / 1000;
  1589. break;
  1590. #if defined(CONFIG_FUELGAUGE_MAX17050)
  1591. case SEC_BAT_ADC_CHANNEL_INBAT_VOLTAGE:
  1592. qpnp_vadc_read(NULL, P_MUX5_1_1, &results);
  1593. /* pullup resistance: 1M, pulldown: 470k */
  1594. data = ((int)results.physical) * 1470 / 470 / 1000;
  1595. break;
  1596. #endif
  1597. case SEC_BAT_ADC_CHANNEL_CHG_TEMP:
  1598. rc = qpnp_vadc_read(NULL, chg_temp_channel, &results);
  1599. if (rc) {
  1600. pr_err("%s: Unable to read chg temperature rc=%d\n",
  1601. __func__, rc);
  1602. return 33000;
  1603. }
  1604. data = results.adc_code;
  1605. break;
  1606. default :
  1607. break;
  1608. }
  1609. pr_debug("%s: data(%d)\n", __func__, data);
  1610. return data;
  1611. }
  1612. static void sec_bat_adc_ap_exit(void)
  1613. {
  1614. }
  1615. static void sec_bat_adc_none_init(struct platform_device *pdev,
  1616. struct sec_battery_info *battery)
  1617. {
  1618. }
  1619. static int sec_bat_adc_none_read(struct sec_battery_info *battery, int channel)
  1620. {
  1621. return 0;
  1622. }
  1623. static void sec_bat_adc_none_exit(void)
  1624. {
  1625. }
  1626. static void sec_bat_adc_ic_init(struct platform_device *pdev,
  1627. struct sec_battery_info *battery)
  1628. {
  1629. }
  1630. static int sec_bat_adc_ic_read(struct sec_battery_info *battery, int channel)
  1631. {
  1632. return 0;
  1633. }
  1634. static void sec_bat_adc_ic_exit(void)
  1635. {
  1636. }
  1637. static int adc_read_type(struct sec_battery_info *battery, int channel)
  1638. {
  1639. int adc = 0;
  1640. switch (battery->pdata->temp_adc_type)
  1641. {
  1642. case SEC_BATTERY_ADC_TYPE_NONE :
  1643. adc = sec_bat_adc_none_read(battery, channel);
  1644. break;
  1645. case SEC_BATTERY_ADC_TYPE_AP :
  1646. adc = sec_bat_adc_ap_read(battery, channel);
  1647. break;
  1648. case SEC_BATTERY_ADC_TYPE_IC :
  1649. adc = sec_bat_adc_ic_read(battery, channel);
  1650. break;
  1651. case SEC_BATTERY_ADC_TYPE_NUM :
  1652. break;
  1653. default :
  1654. break;
  1655. }
  1656. pr_debug("[%s] ADC = %d\n", __func__, adc);
  1657. return adc;
  1658. }
  1659. static void adc_init_type(struct platform_device *pdev,
  1660. struct sec_battery_info *battery)
  1661. {
  1662. switch (battery->pdata->temp_adc_type)
  1663. {
  1664. case SEC_BATTERY_ADC_TYPE_NONE :
  1665. sec_bat_adc_none_init(pdev, battery);
  1666. break;
  1667. case SEC_BATTERY_ADC_TYPE_AP :
  1668. sec_bat_adc_ap_init(pdev, battery);
  1669. break;
  1670. case SEC_BATTERY_ADC_TYPE_IC :
  1671. sec_bat_adc_ic_init(pdev, battery);
  1672. break;
  1673. case SEC_BATTERY_ADC_TYPE_NUM :
  1674. break;
  1675. default :
  1676. break;
  1677. }
  1678. }
  1679. static void adc_exit_type(struct sec_battery_info *battery)
  1680. {
  1681. switch (battery->pdata->temp_adc_type)
  1682. {
  1683. case SEC_BATTERY_ADC_TYPE_NONE :
  1684. sec_bat_adc_none_exit();
  1685. break;
  1686. case SEC_BATTERY_ADC_TYPE_AP :
  1687. sec_bat_adc_ap_exit();
  1688. break;
  1689. case SEC_BATTERY_ADC_TYPE_IC :
  1690. sec_bat_adc_ic_exit();
  1691. break;
  1692. case SEC_BATTERY_ADC_TYPE_NUM :
  1693. break;
  1694. default :
  1695. break;
  1696. }
  1697. }
  1698. int adc_read(struct sec_battery_info *battery, int channel)
  1699. {
  1700. int adc = 0;
  1701. adc = adc_read_type(battery, channel);
  1702. pr_debug("[%s]adc = %d\n", __func__, adc);
  1703. return adc;
  1704. }
  1705. void adc_exit(struct sec_battery_info *battery)
  1706. {
  1707. adc_exit_type(battery);
  1708. }
  1709. bool sec_bat_check_jig_status(void)
  1710. {
  1711. #if defined(CONFIG_SEC_H_PROJECT) || defined(CONFIG_SEC_JS_PROJECT) || defined(CONFIG_SEC_F_PROJECT) || \
  1712. defined(CONFIG_SEC_KS01_PROJECT) || defined(CONFIG_MACH_MONDRIAN) || \
  1713. defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_FRESCO_PROJECT) || \
  1714. defined(CONFIG_SEC_KACTIVE_PROJECT) || defined(CONFIG_SEC_KSPORTS_PROJECT) || \
  1715. defined(CONFIG_SEC_JACTIVE_PROJECT) || defined(CONFIG_SEC_S_PROJECT) || \
  1716. defined(CONFIG_SEC_PATEK_PROJECT)
  1717. #if defined(CONFIG_EXTCON)
  1718. return get_jig_state();
  1719. #else
  1720. extern bool is_jig_attached; // from sec-switch
  1721. return is_jig_attached;
  1722. #endif
  1723. #else
  1724. if (!sec_fuelgauge) {
  1725. pr_err("%s: sec_fuelgauge is empty\n", __func__);
  1726. return false;
  1727. }
  1728. if (sec_fuelgauge->pdata->jig_irq >= 0) {
  1729. if (gpio_get_value_cansleep(sec_fuelgauge->pdata->jig_irq))
  1730. return true;
  1731. else
  1732. return false;
  1733. } else {
  1734. pr_err("%s: jig_irq is invalid\n", __func__);
  1735. return false;
  1736. }
  1737. #endif
  1738. }
  1739. /* callback for battery check
  1740. * return : bool
  1741. * true - battery detected, false battery NOT detected
  1742. */
  1743. bool sec_bat_check_callback(struct sec_battery_info *battery)
  1744. {
  1745. struct power_supply *psy;
  1746. union power_supply_propval value;
  1747. pr_info("%s: battery->pdata->bat_irq_gpio(%d)\n",
  1748. __func__, battery->pdata->bat_irq_gpio);
  1749. psy = get_power_supply_by_name(("sec-charger"));
  1750. if (!psy) {
  1751. pr_err("%s: Fail to get psy (%s)\n",
  1752. __func__, "sec-charger");
  1753. value.intval = 1;
  1754. } else {
  1755. if (battery->pdata->bat_irq_gpio > 0) {
  1756. value.intval = !gpio_get_value(battery->pdata->bat_irq_gpio);
  1757. pr_info("%s: Battery status(%d)\n",
  1758. __func__, value.intval);
  1759. if (value.intval == 0) {
  1760. return value.intval;
  1761. }
  1762. #if defined(CONFIG_MACH_HLTEATT) || defined(CONFIG_MACH_HLTESPR) || \
  1763. defined(CONFIG_MACH_HLTEVZW) || defined(CONFIG_MACH_HLTETMO) || \
  1764. defined(CONFIG_MACH_HLTEUSC)
  1765. {
  1766. int data, ret;
  1767. struct qpnp_vadc_result result;
  1768. struct qpnp_pin_cfg adc_param = {
  1769. .mode = 4,
  1770. .ain_route = 3,
  1771. .src_sel = 0,
  1772. .master_en =1,
  1773. };
  1774. struct qpnp_pin_cfg int_param = {
  1775. .mode = 0,
  1776. .vin_sel = 2,
  1777. .src_sel = 0,
  1778. .master_en =1,
  1779. };
  1780. ret = qpnp_pin_config(battery->pdata->bat_irq_gpio, &adc_param);
  1781. if (ret < 0)
  1782. pr_info("%s: qpnp config error: %d\n",
  1783. __func__, ret);
  1784. /* check the adc from vf pin */
  1785. qpnp_vadc_read(NULL, P_MUX8_1_3, &result);
  1786. data = ((int)result.physical) / 1000;
  1787. pr_info("%s: (%dmV) is connected.\n",
  1788. __func__, data);
  1789. if(data < SHORT_BATTERY_STANDARD) {
  1790. pr_info("%s: Short Battery(%dmV) is connected.\n",
  1791. __func__, data);
  1792. value.intval = 0;
  1793. }
  1794. ret = qpnp_pin_config(battery->pdata->bat_irq_gpio, &int_param);
  1795. if (ret < 0)
  1796. pr_info("%s: qpnp config error int: %d\n",
  1797. __func__, ret);
  1798. }
  1799. #endif
  1800. } else {
  1801. int ret;
  1802. ret = psy->get_property(psy, POWER_SUPPLY_PROP_PRESENT, &(value));
  1803. if (ret < 0) {
  1804. pr_err("%s: Fail to sec-charger get_property (%d=>%d)\n",
  1805. __func__, POWER_SUPPLY_PROP_PRESENT, ret);
  1806. value.intval = 1;
  1807. }
  1808. }
  1809. }
  1810. return value.intval;
  1811. }
  1812. void sec_bat_check_cable_result_callback(struct device *dev,
  1813. int cable_type)
  1814. {
  1815. #if defined(CONFIG_SEC_H_PROJECT) || defined(CONFIG_SEC_JS_PROJECT) || defined(CONFIG_SEC_FRESCO_PROJECT)
  1816. struct regulator *ldo11;
  1817. current_cable_type = cable_type;
  1818. if (current_cable_type == POWER_SUPPLY_TYPE_BATTERY)
  1819. {
  1820. pr_info("%s set ldo off\n", __func__);
  1821. ldo11 = regulator_get(NULL, "8941_l11");
  1822. if(ldo11 > 0)
  1823. {
  1824. regulator_disable(ldo11);
  1825. }
  1826. }
  1827. else
  1828. {
  1829. pr_info("%s set ldo on\n", __func__);
  1830. ldo11 = regulator_get(NULL, "8941_l11");
  1831. if(ldo11 > 0)
  1832. {
  1833. regulator_enable(ldo11);
  1834. }
  1835. }
  1836. #elif defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
  1837. defined(CONFIG_SEC_KSPORTS_PROJECT) || defined(CONFIG_SEC_S_PROJECT)
  1838. struct regulator *max77826_ldo6;
  1839. current_cable_type = cable_type;
  1840. if (current_cable_type == POWER_SUPPLY_TYPE_BATTERY)
  1841. {
  1842. pr_info("%s set ldo off\n", __func__);
  1843. max77826_ldo6 = regulator_get(NULL, "max77826_ldo6");
  1844. if(max77826_ldo6) {
  1845. regulator_disable(max77826_ldo6);
  1846. regulator_put(max77826_ldo6);
  1847. }
  1848. }
  1849. else
  1850. {
  1851. pr_info("%s set ldo on\n", __func__);
  1852. max77826_ldo6 = regulator_get(NULL, "max77826_ldo6");
  1853. if(max77826_ldo6) {
  1854. regulator_enable(max77826_ldo6);
  1855. regulator_put(max77826_ldo6);
  1856. }
  1857. }
  1858. #elif defined(CONFIG_SEC_PATEK_PROJECT)
  1859. struct regulator *vreg_lvs3;
  1860. current_cable_type = cable_type;
  1861. if (current_cable_type == POWER_SUPPLY_TYPE_BATTERY)
  1862. {
  1863. pr_info("%s set lvs3 off\n", __func__);
  1864. vreg_lvs3 = regulator_get(NULL, "8084_lvs3");
  1865. if (!IS_ERR(vreg_lvs3))
  1866. {
  1867. if (regulator_disable(vreg_lvs3))
  1868. pr_err("%s: error for disabling regulator VF_1P8\n", __func__);
  1869. regulator_put(vreg_lvs3);
  1870. }
  1871. }
  1872. else
  1873. {
  1874. pr_info("%s set lvs3 on\n", __func__);
  1875. vreg_lvs3 = regulator_get(NULL, "8084_lvs3");
  1876. if (!IS_ERR(vreg_lvs3))
  1877. {
  1878. if (regulator_enable(vreg_lvs3))
  1879. pr_err("%s: error for enabling regulator VF_1P8\n", __func__);
  1880. regulator_put(vreg_lvs3);
  1881. }
  1882. }
  1883. #endif
  1884. }
  1885. int sec_bat_check_cable_callback(struct sec_battery_info *battery)
  1886. {
  1887. union power_supply_propval value;
  1888. #ifdef CONFIG_USB_SWITCH_FSA9485
  1889. bool ta_status;
  1890. ta_status = gpio_get_value_cansleep(battery->pdata->ta_irq_gpio) ? false : true;
  1891. fsa9485_mmdock_vbus_check(ta_status);
  1892. #endif
  1893. if (battery->pdata->ta_irq_gpio == 0) {
  1894. pr_err("%s: ta_int_gpio is 0 or not assigned yet(cable_type(%d))\n",
  1895. __func__, current_cable_type);
  1896. } else {
  1897. if (battery->wire_status == POWER_SUPPLY_TYPE_BATTERY &&
  1898. #if defined(CONFIG_SEC_LT03_PROJECT)
  1899. !battery->ps_enable &&
  1900. #endif
  1901. !gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) {
  1902. pr_info("%s : VBUS IN\n", __func__);
  1903. value.intval = POWER_SUPPLY_TYPE_UARTOFF;
  1904. psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value);
  1905. current_cable_type = POWER_SUPPLY_TYPE_UARTOFF;
  1906. return POWER_SUPPLY_TYPE_UARTOFF;
  1907. }
  1908. if ((battery->wire_status == POWER_SUPPLY_TYPE_UARTOFF ||
  1909. battery->wire_status == POWER_SUPPLY_TYPE_CARDOCK) &&
  1910. gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) {
  1911. pr_info("%s : VBUS OUT\n", __func__);
  1912. value.intval = POWER_SUPPLY_TYPE_BATTERY;
  1913. psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value);
  1914. current_cable_type = POWER_SUPPLY_TYPE_BATTERY;
  1915. return POWER_SUPPLY_TYPE_BATTERY;
  1916. }
  1917. }
  1918. return current_cable_type;
  1919. }
  1920. void board_battery_init(struct platform_device *pdev, struct sec_battery_info *battery)
  1921. {
  1922. if ((!battery->pdata->temp_adc_table) &&
  1923. (battery->pdata->thermal_source == SEC_BATTERY_THERMAL_SOURCE_ADC)) {
  1924. pr_info("%s : assign temp adc table\n", __func__);
  1925. battery->pdata->temp_adc_table = temp_table;
  1926. battery->pdata->temp_amb_adc_table = temp_table;
  1927. battery->pdata->temp_adc_table_size = sizeof(temp_table)/sizeof(sec_bat_adc_table_data_t);
  1928. battery->pdata->temp_amb_adc_table_size = sizeof(temp_table)/sizeof(sec_bat_adc_table_data_t);
  1929. }
  1930. if ((!battery->pdata->chg_temp_adc_table) &&
  1931. (battery->pdata->chg_temp_check)) {
  1932. pr_info("%s : assign chg temp adc table\n", __func__);
  1933. battery->pdata->chg_temp_adc_table = chg_temp_table;
  1934. battery->pdata->chg_temp_adc_table_size = sizeof(chg_temp_table)/sizeof(sec_bat_adc_table_data_t);
  1935. }
  1936. battery->pdata->event_check = true;
  1937. #if defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
  1938. defined(CONFIG_SEC_KSPORTS_PROJECT) || defined(CONFIG_SEC_S_PROJECT) || \
  1939. defined(CONFIG_SEC_PATEK_PROJECT)
  1940. battery->pdata->temp_highlimit_threshold_event = TEMP_HIGHLIMIT_THRESHOLD_EVENT;
  1941. battery->pdata->temp_highlimit_recovery_event = TEMP_HIGHLIMIT_RECOVERY_EVENT;
  1942. battery->pdata->temp_highlimit_threshold_normal = TEMP_HIGHLIMIT_THRESHOLD_NORMAL;
  1943. battery->pdata->temp_highlimit_recovery_normal = TEMP_HIGHLIMIT_RECOVERY_NORMAL;
  1944. battery->pdata->temp_highlimit_threshold_lpm = TEMP_HIGHLIMIT_THRESHOLD_LPM;
  1945. battery->pdata->temp_highlimit_recovery_lpm = TEMP_HIGHLIMIT_RECOVERY_LPM;
  1946. #endif
  1947. battery->pdata->temp_high_threshold_event = TEMP_HIGH_THRESHOLD_EVENT;
  1948. battery->pdata->temp_high_recovery_event = TEMP_HIGH_RECOVERY_EVENT;
  1949. battery->pdata->temp_low_threshold_event = TEMP_LOW_THRESHOLD_EVENT;
  1950. battery->pdata->temp_low_recovery_event = TEMP_LOW_RECOVERY_EVENT;
  1951. battery->pdata->temp_high_threshold_normal = TEMP_HIGH_THRESHOLD_NORMAL;
  1952. battery->pdata->temp_high_recovery_normal = TEMP_HIGH_RECOVERY_NORMAL;
  1953. battery->pdata->temp_low_threshold_normal = TEMP_LOW_THRESHOLD_NORMAL;
  1954. battery->pdata->temp_low_recovery_normal = TEMP_LOW_RECOVERY_NORMAL;
  1955. battery->pdata->temp_high_threshold_lpm = TEMP_HIGH_THRESHOLD_LPM;
  1956. battery->pdata->temp_high_recovery_lpm = TEMP_HIGH_RECOVERY_LPM;
  1957. battery->pdata->temp_low_threshold_lpm = TEMP_LOW_THRESHOLD_LPM;
  1958. battery->pdata->temp_low_recovery_lpm = TEMP_LOW_RECOVERY_LPM;
  1959. #if defined(CONFIG_MACH_KLTE_ATT) || defined(CONFIG_MACH_KLTE_TMO) || \
  1960. defined(CONFIG_MACH_KLTE_SPR) || defined(CONFIG_MACH_KLTE_VZW) || \
  1961. defined(CONFIG_MACH_KLTE_MTR) || defined(CONFIG_MACH_KSPORTSLTE_SPR) || \
  1962. defined(CONFIG_MACH_KLTE_USC) || defined(CONFIG_MACH_KACTIVELTE_ATT) || \
  1963. defined(CONFIG_MACH_KLTE_ACG) || defined(CONFIG_MACH_KLTE_LRA) || \
  1964. defined(CONFIG_MACH_KACTIVELTE_SKT) || defined(CONFIG_SEC_S_PROJECT)
  1965. battery->pdata->check_adc_max = 1110;
  1966. battery->pdata->check_adc_min = 150;
  1967. #endif
  1968. #if defined(CONFIG_BATTERY_SWELLING)
  1969. battery->pdata->swelling_high_temp_block = BATT_SWELLING_HIGH_TEMP_BLOCK;
  1970. battery->pdata->swelling_high_temp_recov = BATT_SWELLING_HIGH_TEMP_RECOV;
  1971. battery->pdata->swelling_low_temp_block = BATT_SWELLING_LOW_TEMP_BLOCK;
  1972. battery->pdata->swelling_low_temp_recov = BATT_SWELLING_LOW_TEMP_RECOV;
  1973. battery->pdata->swelling_high_chg_current = BATT_SWELLING_HIGH_CHG_CURRENT;
  1974. battery->pdata->swelling_low_chg_current = BATT_SWELLING_LOW_CHG_CURRENT;
  1975. battery->pdata->swelling_drop_float_voltage = BATT_SWELLING_DROP_FLOAT_VOLTAGE;
  1976. battery->pdata->swelling_high_rechg_voltage = BATT_SWELLING_HIGH_RECHG_VOLTAGE;
  1977. battery->pdata->swelling_low_rechg_voltage = BATT_SWELLING_LOW_RECHG_VOLTAGE;
  1978. #endif
  1979. adc_init_type(pdev, battery);
  1980. }
  1981. #if defined(CONFIG_FUELGAUGE_MAX77823)
  1982. void board_fuelgauge_init(struct max77823_fuelgauge_data *fuelgauge)
  1983. {
  1984. sec_fuelgauge = 0;
  1985. if (!fuelgauge->pdata->battery_data) {
  1986. pr_info("%s : assign battery data\n", __func__);
  1987. fuelgauge->pdata->battery_data = (void *)samsung_battery_data;
  1988. }
  1989. }
  1990. #else
  1991. void board_fuelgauge_init(struct sec_fuelgauge_info *fuelgauge)
  1992. {
  1993. sec_fuelgauge = fuelgauge;
  1994. if (!fuelgauge->pdata->battery_data) {
  1995. pr_info("%s : assign battery data\n", __func__);
  1996. fuelgauge->pdata->battery_data = (void *)samsung_battery_data;
  1997. }
  1998. fuelgauge->pdata->capacity_max = CAPACITY_MAX;
  1999. fuelgauge->pdata->capacity_max_margin = CAPACITY_MAX_MARGIN;
  2000. fuelgauge->pdata->capacity_min = CAPACITY_MIN;
  2001. #if defined(CONFIG_SEC_VIENNA_PROJECT) || defined(CONFIG_SEC_V2_PROJECT) ||\
  2002. defined(CONFIG_MACH_PICASSO_LTE) || defined(CONFIG_MACH_MONDRIAN) || defined(CONFIG_MACH_LT03) ||\
  2003. defined(CONFIG_MACH_KLIMT) || defined(CONFIG_MACH_CHAGALL)
  2004. fuelgauge->pdata->temp_adc_table = temp_table;
  2005. fuelgauge->pdata->temp_adc_table_size = sizeof(temp_table)/sizeof(sec_bat_adc_table_data_t);
  2006. #endif
  2007. #if defined(CONFIG_FUELGAUGE_MAX17048)
  2008. pr_info("%s: RCOMP0: 0x%x, RCOMP_charging: 0x%x, "
  2009. "temp_cohot: %d, temp_cocold: %d, "
  2010. "is_using_model_data: %d, type_str: %s, "
  2011. "capacity_max: %d, capacity_max_margin: %d, "
  2012. "capacity_min: %d, \n", __func__ ,
  2013. get_battery_data(fuelgauge).RCOMP0,
  2014. get_battery_data(fuelgauge).RCOMP_charging,
  2015. get_battery_data(fuelgauge).temp_cohot,
  2016. get_battery_data(fuelgauge).temp_cocold,
  2017. get_battery_data(fuelgauge).is_using_model_data,
  2018. get_battery_data(fuelgauge).type_str,
  2019. fuelgauge->pdata->capacity_max,
  2020. fuelgauge->pdata->capacity_max_margin,
  2021. fuelgauge->pdata->capacity_min
  2022. );
  2023. #endif
  2024. }
  2025. #endif
  2026. void cable_initial_check(struct sec_battery_info *battery)
  2027. {
  2028. union power_supply_propval value;
  2029. pr_info("%s : current_cable_type : (%d)\n", __func__, current_cable_type);
  2030. if (POWER_SUPPLY_TYPE_BATTERY != current_cable_type) {
  2031. if (current_cable_type == POWER_SUPPLY_TYPE_POWER_SHARING) {
  2032. value.intval = current_cable_type;
  2033. psy_do_property("ps", set,
  2034. POWER_SUPPLY_PROP_ONLINE, value);
  2035. } else {
  2036. value.intval = current_cable_type;
  2037. psy_do_property("battery", set,
  2038. POWER_SUPPLY_PROP_ONLINE, value);
  2039. }
  2040. } else {
  2041. psy_do_property(battery->pdata->charger_name, get,
  2042. POWER_SUPPLY_PROP_ONLINE, value);
  2043. if (value.intval == POWER_SUPPLY_TYPE_WIRELESS) {
  2044. value.intval = 1;
  2045. psy_do_property("wireless", set,
  2046. POWER_SUPPLY_PROP_ONLINE, value);
  2047. }
  2048. if (battery->pdata->ta_irq_gpio == 0) {
  2049. pr_err("%s: ta_int_gpio is 0 or not assigned yet(cable_type(%d))\n",
  2050. __func__, current_cable_type);
  2051. } else {
  2052. if (battery->wire_status == POWER_SUPPLY_TYPE_BATTERY &&
  2053. !gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) {
  2054. #if defined(CONFIG_USB_SWITCH_FSA9485)
  2055. if (!mhl_connection_state()) {
  2056. #endif
  2057. pr_info("%s : VBUS IN\n", __func__);
  2058. value.intval = POWER_SUPPLY_TYPE_UARTOFF;
  2059. psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value);
  2060. current_cable_type = POWER_SUPPLY_TYPE_UARTOFF;
  2061. #if defined(CONFIG_USB_SWITCH_FSA9485)
  2062. }
  2063. #endif
  2064. }
  2065. if ((battery->wire_status == POWER_SUPPLY_TYPE_UARTOFF ||
  2066. battery->wire_status == POWER_SUPPLY_TYPE_CARDOCK) &&
  2067. gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) {
  2068. pr_info("%s : VBUS OUT\n", __func__);
  2069. value.intval = POWER_SUPPLY_TYPE_BATTERY;
  2070. psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value);
  2071. current_cable_type = POWER_SUPPLY_TYPE_BATTERY;
  2072. }
  2073. }
  2074. }
  2075. }