12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168 |
- /*
- * sec_board-msm8974.c
- * Samsung Mobile Battery Driver
- *
- * Copyright (C) 2012 Samsung Electronics
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
- #include <linux/battery/sec_battery.h>
- #include <linux/battery/sec_fuelgauge.h>
- #include <linux/battery/sec_charging_common.h>
- #include <linux/qpnp/pin.h>
- #include <linux/qpnp/qpnp-adc.h>
- #include <linux/regulator/machine.h>
- #include <linux/regulator/krait-regulator.h>
- #define SHORT_BATTERY_STANDARD 100
- #if defined(CONFIG_USB_SWITCH_FSA9485)
- extern int mhl_connection_state(void);
- extern void fsa9485_mmdock_vbus_check(bool vbus_status);
- #endif
- #if defined(CONFIG_EXTCON)
- extern int get_jig_state(void);
- int current_cable_type = POWER_SUPPLY_TYPE_BATTERY;
- #else
- extern int current_cable_type;
- #endif
- extern unsigned int system_rev;
- static enum qpnp_vadc_channels temp_channel;
- static enum qpnp_vadc_channels chg_temp_channel;
- static struct sec_fuelgauge_info *sec_fuelgauge = NULL;
- #if defined(CONFIG_BATTERY_SAMSUNG_DATA)
- #include CONFIG_BATTERY_SAMSUNG_DATA_FILE
- #else //CONFIG_BATTERY_SAMSUNG_DATA
- #if defined(CONFIG_FUELGAUGE_MAX17048)
- static struct battery_data_t samsung_battery_data[] = {
- /* SDI battery data (High voltage 4.35V) */
- {
- #if defined(CONFIG_MACH_HLTESKT) || defined(CONFIG_MACH_HLTEKTT) || defined(CONFIG_MACH_HLTELGT)
- .RCOMP0 = 0x73,
- .RCOMP_charging = 0x84,
- .temp_cohot = -1025,
- .temp_cocold = -3675,
- #elif defined(CONFIG_MACH_FRESCOLTESKT)||defined(CONFIG_MACH_FRESCOLTEKTT)||defined(CONFIG_MACH_FRESCOLTELGT)
- .RCOMP0 = 0x7E,
- .RCOMP_charging = 0x80,
- .temp_cohot = -675,
- .temp_cocold = -6400,
- #elif defined(CONFIG_MACH_HLTEVZW) || defined(CONFIG_MACH_HLTESPR)
- .RCOMP0 = 0x70,
- .RCOMP_charging = 0x8D,
- .temp_cohot = -1000,
- .temp_cocold = -4350,
- #elif defined(CONFIG_MACH_HLTEATT)
- .RCOMP0 = 0x75,
- .RCOMP_charging = 0x8D,
- .temp_cohot = -1000,
- .temp_cocold = -4350,
- #elif defined(CONFIG_MACH_HLTEUSC)
- .RCOMP0 = 0x75,
- .RCOMP_charging = 0x8D,
- .temp_cohot = -1000,
- .temp_cocold = -4350,
- #elif defined(CONFIG_MACH_HLTEDCM)
- .RCOMP0 = 0x7A,
- .RCOMP_charging = 0x8A,
- .temp_cohot = -1025,
- .temp_cocold = -3675,
- #elif defined(CONFIG_MACH_HLTEKDI)
- .RCOMP0 = 0x73,
- .RCOMP_charging = 0x84,
- .temp_cohot = -1025,
- .temp_cocold = -3675,
- #elif defined(CONFIG_SEC_JS_PROJECT)
- .RCOMP0 = 0x75,
- .RCOMP_charging = 0x80,
- .temp_cohot = -700,
- .temp_cocold = -4875,
- #elif defined(CONFIG_MACH_HLTECHNTWU)
- .RCOMP0 = 0x6D,
- .RCOMP_charging = 0x6D,
- .temp_cohot = -900,
- .temp_cocold = -3700,
- #elif defined(CONFIG_MACH_HLTE_CHN_CMCC) || defined(CONFIG_MACH_H3G_CHN_CMCC) || defined(CONFIG_MACH_H3G_CHN_OPEN)
- .RCOMP0 = 0x73,
- .RCOMP_charging = 0x8D,
- .temp_cohot = -1000,
- .temp_cocold = -4350,
- #elif defined(CONFIG_MACH_HLTEEUR)
- .RCOMP0 = 0x62,
- .RCOMP_charging = 0x7C,
- .temp_cohot = -1000,
- .temp_cocold = -4350,
- #elif defined(CONFIG_MACH_FLTEEUR) || defined(CONFIG_MACH_FLTESKT)
- .RCOMP0 = 0x75,
- .RCOMP_charging = 0x70,
- .temp_cohot = -375,
- .temp_cocold = -3975,
- #elif defined(CONFIG_MACH_KS01EUR)
- .RCOMP0 = 0x73,
- .RCOMP_charging = 0x79,
- .temp_cohot = -850,
- .temp_cocold = -4200,
- #elif defined(CONFIG_MACH_KS01SKT) || defined(CONFIG_MACH_KS01KTT) || \
- defined(CONFIG_MACH_KS01LGT)
- .RCOMP0 = 0x70,
- .RCOMP_charging = 0x79,
- .temp_cohot = -850,
- .temp_cocold = -4200,
- #elif defined(CONFIG_MACH_JACTIVESKT)
- .RCOMP0 = 0x7B,
- .RCOMP_charging = 0x85,
- .temp_cohot = -700,
- .temp_cocold = -4875,
- #elif defined(CONFIG_MACH_K3GDUOS_CTC)
- .RCOMP0 = 0x5D,
- .RCOMP_charging = 0x62,
- .temp_cohot = -175,
- .temp_cocold = -5825,
- #elif defined(CONFIG_MACH_KLTE_CTC)
- .RCOMP0 = 0x68,
- .RCOMP_charging = 0x75,
- .temp_cohot = -175,
- .temp_cocold = -5825,
- #elif defined(CONFIG_MACH_KLTE_CHN)
- .RCOMP0 = 0x62,
- .RCOMP_charging = 0x65,
- .temp_cohot = -175,
- .temp_cocold = -5825,
- #elif defined(CONFIG_MACH_KLTE_SKT) || defined(CONFIG_MACH_KLTE_KTT) || \
- defined(CONFIG_MACH_KLTE_LGT)
- .RCOMP0 = 0x5D,
- .RCOMP_charging = 0x68,
- .temp_cohot = -175,
- .temp_cocold = -5825,
- #elif defined(CONFIG_SEC_KSPORTS_PROJECT)
- .RCOMP0 = 0x67,
- .RCOMP_charging = 0x67,
- .temp_cohot = -175,
- .temp_cocold = -5825,
- #elif defined(CONFIG_SEC_K_PROJECT)
- .RCOMP0 = 0x5D,
- .RCOMP_charging = 0x5D,
- .temp_cohot = -175,
- .temp_cocold = -5825,
- #elif defined(CONFIG_MACH_KACTIVELTE_KOR)
- .RCOMP0 = 0x7E,
- .RCOMP_charging = 0x7E,
- .temp_cohot = -762,
- .temp_cocold = -4787,
- #elif defined(CONFIG_SEC_KACTIVE_PROJECT)
- .RCOMP0 = 0x5D,
- .RCOMP_charging = 0x5D,
- .temp_cohot = -175,
- .temp_cocold = -5825,
- #else
- .RCOMP0 = 0x73,
- .RCOMP_charging = 0x8D,
- .temp_cohot = -1000,
- .temp_cocold = -4350,
- #endif
- .is_using_model_data = true,
- .type_str = "SDI",
- }
- };
- #else
- static struct battery_data_t samsung_battery_data[] = {
- /* SDI battery data (High voltage 4.35V) */
- {
- #if defined(CONFIG_MACH_PICASSO) || defined(CONFIG_MACH_LT03)
- .Capacity = 0x3F76, /* N1/N2: 8123mAh */
- #elif defined(CONFIG_MACH_MONDRIAN)
- .Capacity = 0x257E,
- #else
- .Capacity = 0x4A38, /* V1/V2: 9500mAh */
- #endif
- .low_battery_comp_voltage = 3500,
- .low_battery_table = {
- /* range, slope, offset */
- {-5000, 0, 0}, /* dummy for top limit */
- {-1250, 0, 3320},
- {-750, 97, 3451},
- {-100, 96, 3461},
- {0, 0, 3456},
- },
- .temp_adjust_table = {
- /* range, slope, offset */
- {47000, 122, 8950},
- {60000, 200, 51000},
- {100000, 0, 0}, /* dummy for top limit */
- },
- .type_str = "SDI",
- }
- };
- #endif
- #if defined(CONFIG_MACH_KLTE_CTC)
- #define CAPACITY_MAX 980
- #define CAPACITY_MAX_MARGIN 50
- #define CAPACITY_MIN -7
- #elif defined(CONFIG_MACH_KACTIVELTE_KOR)
- #define CAPACITY_MAX 990
- #define CAPACITY_MAX_MARGIN 70
- #define CAPACITY_MIN 0
- #elif defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
- defined(CONFIG_SEC_KSPORTS_PROJECT)
- #define CAPACITY_MAX 990
- #define CAPACITY_MAX_MARGIN 50
- #define CAPACITY_MIN -7
- #elif defined(CONFIG_MACH_HLTESKT) || defined(CONFIG_MACH_HLTEKTT) || \
- defined(CONFIG_MACH_HLTELGT) || defined(CONFIG_MACH_HLTEDCM) || \
- defined(CONFIG_MACH_HLTEKDI)
- #define CAPACITY_MAX 980
- #define CAPACITY_MAX_MARGIN 50
- #define CAPACITY_MIN -7
- #elif defined(CONFIG_MACH_FRESCOLTESKT)||defined(CONFIG_MACH_FRESCOLTEKTT)||defined(CONFIG_MACH_FRESCOLTELGT)
- #define CAPACITY_MAX 980
- #define CAPACITY_MAX_MARGIN 50
- #define CAPACITY_MIN 3
- #elif defined(CONFIG_MACH_FLTEEUR) || defined(CONFIG_MACH_FLTESKT)
- #define CAPACITY_MAX 990
- #define CAPACITY_MAX_MARGIN 50
- #define CAPACITY_MIN 0
- #elif defined(CONFIG_MACH_MONDRIAN)
- #define CAPACITY_MAX 1000
- #define CAPACITY_MAX_MARGIN 50
- #define CAPACITY_MIN 0
- #elif defined(CONFIG_SEC_H_PROJECT) /* from H USA/EUR */
- #define CAPACITY_MAX 990
- #define CAPACITY_MAX_MARGIN 50
- #define CAPACITY_MIN -7
- #elif defined(CONFIG_SEC_JS_PROJECT)
- #define CAPACITY_MAX 970
- #define CAPACITY_MAX_MARGIN 50
- #define CAPACITY_MIN -7
- #else /* CONFIG_SEC_KS01_PROJECT */
- #define CAPACITY_MAX 1000
- #define CAPACITY_MAX_MARGIN 50
- #define CAPACITY_MIN 0
- #endif
- #if defined(CONFIG_MACH_KLTE_EUR) || defined(CONFIG_MACH_KLTE_ATT) || defined(CONFIG_MACH_KLTE_TMO) || \
- defined (CONFIG_MACH_KLTE_SKT) || defined(CONFIG_MACH_KLTE_KTT) || defined(CONFIG_MACH_KLTE_LGT) || \
- defined(CONFIG_MACH_KLTE_SPR) || defined(CONFIG_MACH_KLTE_CAN) || defined(CONFIG_MACH_KLTE_MTR) || \
- defined(CONFIG_MACH_KLTE_VZW) || defined(CONFIG_SEC_LOCALE_CHN) || defined(CONFIG_MACH_KLTE_AUS_TEL) || \
- defined(CONFIG_MACH_KLTE_LRA)
- static sec_bat_adc_table_data_t temp_table[] = {
- {26009, 900},
- {26280, 850},
- {26600, 800},
- {26950, 750},
- {27325, 700},
- {27737, 650},
- {28180, 600},
- {28699, 550},
- {29360, 500},
- {29970, 450},
- {30995, 400},
- {32046, 350},
- {32985, 300},
- {34050, 250},
- {35139, 200},
- {36179, 150},
- {37208, 100},
- {38237, 50},
- {38414, 40},
- {38598, 30},
- {38776, 20},
- {38866, 10},
- {38956, 0},
- {39102, -10},
- {39247, -20},
- {39393, -30},
- {39538, -40},
- {39684, -50},
- {40490, -100},
- {41187, -150},
- {41652, -200},
- {42030, -250},
- {42327, -300},
- };
- #elif defined(CONFIG_MACH_KACTIVELTE_EUR) || defined(CONFIG_MACH_KACTIVELTE_ATT) || defined(CONFIG_MACH_KACTIVELTE_CAN) || defined(CONFIG_MACH_KACTIVELTE_SKT) \
- || defined(CONFIG_MACH_KACTIVELTE_DCM)
- static sec_bat_adc_table_data_t temp_table[] = {
- {26009, 900},
- {26280, 850},
- {26600, 800},
- {26950, 750},
- {27168, 700},
- {27519, 650},
- {27984, 600},
- {28596, 550},
- {29256, 500},
- {30029, 450},
- {30881, 400},
- {32682, 300},
- {35159, 200},
- {37244, 100},
- {38264, 50},
- {38890, 20},
- {39075, 10},
- {39228, 0},
- {39383, -10},
- {39557, -20},
- {40002, -50},
- {41724, -200},
- {42373, -300},
- };
- #elif defined(CONFIG_SEC_KSPORTS_PROJECT)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25744, 900},
- {26015, 850},
- {26335, 800},
- {26685, 750},
- {27082, 700},
- {27512, 650},
- {27900, 600},
- {28223, 550},
- {28438, 530},
- {28790, 500},
- {29080, 490},
- {29370, 480},
- {29660, 470},
- {29950, 460},
- {30250, 450},
- {31223, 400},
- {32138, 350},
- {33153, 300},
- {34177, 250},
- {35432, 200},
- {36520, 150},
- {37636, 100},
- {38598, 50},
- {38700, 40},
- {38930, 30},
- {38950, 20},
- {39050, 10},
- {39168, 0},
- {39281, -10},
- {39438, -20},
- {39596, -30},
- {39728, -40},
- {39898, -50},
- {40594, -100},
- {41193, -150},
- {41651, -200},
- {42033, -250},
- {42325, -300},
- };
- #elif defined (CONFIG_MACH_KLTE_DCM)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25844, 900},
- {26113, 850},
- {26595, 800},
- {26896, 750},
- {27238, 700},
- {27679, 650},
- {28193, 600},
- {28768, 550},
- {29412, 500},
- {30169, 450},
- {31008, 400},
- {31917, 350},
- {32901, 300},
- {33955, 250},
- {35039, 200},
- {36132, 150},
- {37183, 100},
- {38158, 50},
- {39041, 0},
- {39856, -50},
- {40561, -100},
- {41146, -150},
- {41622, -200},
- };
- #elif defined (CONFIG_MACH_KLTE_SBM)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25844, 900},
- {26113, 850},
- {26595, 800},
- {26896, 750},
- {27238, 700},
- {27679, 650},
- {28193, 600},
- {28768, 550},
- {29412, 500},
- {30169, 450},
- {31008, 400},
- {31917, 350},
- {32901, 300},
- {33955, 250},
- {35039, 200},
- {36132, 150},
- {37183, 100},
- {38158, 50},
- {39041, 0},
- {39856, -50},
- {40561, -100},
- {41146, -150},
- {41622, -200},
- };
- #elif defined (CONFIG_MACH_KLTE_KDI)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25844, 900},
- {26113, 850},
- {26595, 800},
- {26896, 750},
- {27238, 700},
- {27679, 650},
- {28193, 600},
- {28768, 550},
- {29412, 500},
- {30169, 450},
- {31008, 400},
- {31917, 350},
- {32901, 300},
- {33955, 250},
- {35039, 200},
- {36132, 150},
- {37183, 100},
- {38158, 50},
- {39041, 0},
- {39856, -50},
- {40561, -100},
- {41146, -150},
- {41622, -200},
- };
- #elif defined (CONFIG_MACH_KLTE_USC) || defined(CONFIG_MACH_KLTE_ACG)
- static sec_bat_adc_table_data_t temp_table[] = {
- {26013, 900},
- {26227, 850},
- {26482, 800},
- {26784, 750},
- {27122, 700},
- {27559, 650},
- {28096, 600},
- {28667, 550},
- {29275, 500},
- {30069, 450},
- {30896, 400},
- {31800, 350},
- {32788, 300},
- {33844, 250},
- {34932, 200},
- {36041, 150},
- {37107, 100},
- {38098, 50},
- {38955, 0},
- {39804, -50},
- {40505, -100},
- {41101, -150},
- {41597, -200},
- };
- #elif defined(CONFIG_MACH_H3GDUOS_CTC)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25844, 900},
- {26113, 850},
- {26398, 800},
- {26764, 750},
- {27240, 700},
- {27662, 650},
- {28202, 600},
- {28777, 550},
- {29444, 500},
- {30193, 450},
- {31040, 400},
- {31953, 350},
- {32942, 300},
- {33991, 250},
- {35070, 200},
- {36168, 150},
- {37238, 100},
- {38234, 50},
- {38414, 40},
- {38640, 30},
- {38866, 20},
- {39092, 10},
- {39139, 0},
- {39342, -10},
- {39545, -30},
- {39748, -40},
- {39954, -50},
- {40641, -100},
- {41204, -150},
- {41689, -200},
- };
- #elif defined(CONFIG_MACH_HLTEUSC)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25908, 900},
- {26111, 850},
- {26357, 800},
- {26651, 750},
- {26962, 700},
- {27363, 650},
- {27850, 600},
- {28407, 550},
- {29084, 500},
- {29857, 450},
- {30684, 400},
- {31576, 350},
- {32674, 300},
- {33694, 250},
- {34848, 200},
- {35963, 150},
- {37118, 100},
- {38166, 50},
- {39104, 0},
- {39932, -50},
- {40629, -100},
- {41224, -150},
- {41704, -200},
- };
- #elif defined(CONFIG_MACH_HLTEKDI)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25844, 900},
- {26113, 850},
- {26398, 800},
- {26764, 750},
- {27293, 700},
- {27703, 650},
- {28203, 600},
- {28773, 550},
- {29414, 500},
- {30181, 450},
- {31023, 400},
- {31932, 350},
- {32924, 300},
- {33962, 250},
- {35007, 200},
- {36069, 150},
- {37080, 100},
- {38102, 50},
- {39049, 0},
- {39542, -50},
- {40564, -100},
- {41130, -150},
- {41651, -200},
- };
- #elif defined(CONFIG_SEC_H_PROJECT)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25950, 900},
- {26173, 850},
- {26424, 800},
- {26727, 750},
- {27281, 700},
- {27669, 650},
- {28178, 600},
- {28724, 550},
- {29342, 500},
- {30101, 450},
- {30912, 400},
- {31807, 350},
- {32823, 300},
- {33858, 250},
- {34950, 200},
- {36049, 150},
- {37054, 100},
- {38025, 50},
- {38219, 40},
- {38448, 30},
- {38626, 20},
- {38795, 10},
- {38989, 0},
- {39229, -10},
- {39540, -30},
- {39687, -40},
- {39822, -50},
- {40523, -100},
- {41123, -150},
- {41619, -200},
- };
- #elif defined(CONFIG_SEC_JS_PROJECT)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25950, 900},
- {26173, 850},
- {26424, 800},
- {26727, 750},
- {27281, 700},
- {27669, 650},
- {28178, 600},
- {28724, 550},
- {29342, 500},
- {30101, 450},
- {30912, 400},
- {31807, 350},
- {32823, 300},
- {33858, 250},
- {34950, 200},
- {36049, 150},
- {37054, 100},
- {38025, 50},
- {38219, 40},
- {38448, 30},
- {38626, 20},
- {38795, 10},
- {38989, 0},
- {39229, -10},
- {39540, -30},
- {39687, -40},
- {39822, -50},
- {40523, -100},
- {41123, -150},
- {41619, -200},
- };
- #elif defined(CONFIG_MACH_FRESCOLTESKT)||defined(CONFIG_MACH_FRESCOLTEKTT)||defined(CONFIG_MACH_FRESCOLTELGT)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25827, 900},
- {26033, 850},
- {26253, 800},
- {26415, 750},
- {27069, 700},
- {27497, 650},
- {27911, 600},
- {28464, 550},
- {28927, 500},
- {29785, 450},
- {30575, 400},
- {31398, 350},
- {32513, 300},
- {33557, 250},
- {34594, 200},
- {35889, 150},
- {36651, 100},
- {37637, 50},
- {37831, 40},
- {38025, 30},
- {38219, 20},
- {38448, 10},
- {38626, 0},
- {38789, -10},
- {39229, -30},
- {39417, -40},
- {39617, -50},
- {40202, -100},
- {40962, -150},
- {41521, -200},
- };
- #elif defined(CONFIG_MACH_FLTEEUR) || defined(CONFIG_MACH_FLTESKT)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25844, 900},
- {26113, 850},
- {26398, 800},
- {26764, 750},
- {26960, 700},
- {27435, 650},
- {27885, 600},
- {28463, 550},
- {29087, 500},
- {29988, 450},
- {30883, 400},
- {31831, 350},
- {32868, 300},
- {33667, 250},
- {34657, 200},
- {35871, 150},
- {36980, 100},
- {38018, 50},
- {38965, 0},
- {39722, -50},
- {40720, -100},
- {41309, -150},
- {41772, -200},
- };
- #elif defined(CONFIG_MACH_KS01SKT) || defined(CONFIG_MACH_KS01KTT) || \
- defined(CONFIG_MACH_KS01LGT) || defined(CONFIG_MACH_JACTIVESKT)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25844, 900},
- {26113, 850},
- {26398, 800},
- {26764, 750},
- {27281, 700},
- {27669, 650},
- {28178, 600},
- {28724, 550},
- {29342, 500},
- {30101, 450},
- {30912, 400},
- {31807, 350},
- {32823, 300},
- {33858, 250},
- {34950, 200},
- {36049, 150},
- {37054, 100},
- {38025, 50},
- {38219, 40},
- {38448, 30},
- {38626, 20},
- {38795, 10},
- {38989, 0},
- {39229, -10},
- {39540, -30},
- {39687, -40},
- {39822, -50},
- {40523, -100},
- {41123, -150},
- {41619, -200},
- };
- #elif defined(CONFIG_MACH_PICASSO_SPR)
- static sec_bat_adc_table_data_t temp_table[] = {
- {1100, 1140},
- {1000, 1040},
- {700, 940},
- {645, 840},
- {615, 740},
- {600, 640},
- {561, 601},
- {560, 590},
- {536, 566},
- {535, 555},
- {521, 541},
- {520, 520},
- {400, 400},
- {300, 300},
- {200, 200},
- {100, 100},
- {0, 0},
- {-100, -100},
- {-200, -200},
- {-300, -300},
- };
- #elif defined(CONFIG_SEC_VIENNA_PROJECT) || defined(CONFIG_SEC_V2_PROJECT) ||\
- defined(CONFIG_MACH_PICASSO_EUR) || defined(CONFIG_MACH_LT03)
- static sec_bat_adc_table_data_t temp_table[] = {
- {1100, 1140},
- {1000, 1040},
- {900, 940},
- {800, 840},
- {700, 740},
- {600, 640},
- {561, 601},
- {560, 590},
- {536, 566},
- {535, 555},
- {521, 541},
- {520, 520},
- {400, 400},
- {300, 300},
- {200, 200},
- {100, 100},
- {0, 0},
- {-100, -100},
- {-200, -200},
- {-300, -300},
- };
- #elif defined(CONFIG_MACH_MONDRIANWIFI_USA)
- static sec_bat_adc_table_data_t temp_table[] = {
- {1100, 1165},
- {1000, 1065},
- {900, 965},
- {800, 865},
- {700, 795},
- {616, 700},
- {607, 670},
- {590, 655},
- {580, 640},
- {574, 635},
- {570, 630},
- {565, 605},
- {555, 600},
- {550, 595},
- {545, 585},
- {520, 550},
- {490, 510},
- {470, 500},
- {460, 460},
- {450, 450},
- {400, 400},
- {300, 300},
- {200, 200},
- {100, 100},
- {0, 0},
- {-10, -10},
- {-20, -25},
- {-30, -38},
- {-40, -52},
- {-50, -65},
- {-60, -78},
- {-70, -90},
- {-100, -150},
- {-200, -250},
- {-300, -350},
- {-400, -450},
- };
- #elif defined(CONFIG_MACH_MONDRIAN)
- static sec_bat_adc_table_data_t temp_table[] = {
- {1100, 1165},
- {1000, 1065},
- {900, 965},
- {800, 865},
- {700, 795},
- {616, 700},
- {607, 670},
- {590, 655},
- {580, 640},
- {574, 635},
- {570, 630},
- {565, 605},
- {555, 600},
- {550, 595},
- {545, 585},
- {540, 575},
- {480, 480},
- {470, 470},
- {460, 460},
- {450, 450},
- {400, 400},
- {300, 300},
- {200, 200},
- {100, 100},
- {0, 0},
- {-10, -10},
- {-20, -25},
- {-30, -38},
- {-40, -52},
- {-50, -65},
- {-60, -78},
- {-70, -90},
- {-100, -150},
- {-200, -250},
- {-300, -350},
- {-400, -450},
- };
- /* only for G870F0 */
- #elif defined(CONFIG_MACH_KACTIVELTE_KOR)
- static sec_bat_adc_table_data_t temp_table[] = {
- {25935, 900},
- {26149, 850},
- {26399, 800},
- {26741, 750},
- {27052, 700},
- {27441, 650},
- {27971, 600},
- {28551, 550},
- {29229, 500},
- {30011, 450},
- {30895, 400},
- {31867, 350},
- {32921, 300},
- {34036, 250},
- {35168, 200},
- {36303, 150},
- {37374, 100},
- {38371, 50},
- {39252, 0},
- {40077, -50},
- {40826, -100},
- {41381, -150},
- {41824, -200},
- };
- #else
- static sec_bat_adc_table_data_t temp_table[] = {
- {25950, 900},
- {26173, 850},
- {26424, 800},
- {26727, 750},
- {26884, 700},
- {27346, 650},
- {27750, 600},
- {28213, 550},
- {28760, 500},
- {29384, 450},
- {30180, 400},
- {31095, 350},
- {32085, 300},
- {33132, 250},
- {34242, 200},
- {35340, 150},
- {36430, 100},
- {37471, 50},
- {38406, 0},
- {39388, -50},
- {40184, -100},
- {40852, -150},
- {41420, -200},
- {41685, -210},
- {41786, -220},
- {41887, -230},
- {41987, -240},
- {42088, -250},
- {42178, -260},
- {42268, -270},
- {42358, -280},
- {42448, -290},
- {42538, -300},
- };
- #endif
- static sec_bat_adc_table_data_t chg_temp_table[] = {
- {0, 0},
- };
- #if defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
- defined(CONFIG_SEC_KSPORTS_PROJECT)
- #define TEMP_HIGHLIMIT_THRESHOLD_EVENT 800
- #define TEMP_HIGHLIMIT_RECOVERY_EVENT 750
- #define TEMP_HIGHLIMIT_THRESHOLD_NORMAL 800
- #define TEMP_HIGHLIMIT_RECOVERY_NORMAL 750
- #define TEMP_HIGHLIMIT_THRESHOLD_LPM 800
- #define TEMP_HIGHLIMIT_RECOVERY_LPM 750
- #endif
- #if defined(CONFIG_MACH_KLTE_EUR)
- #define TEMP_HIGH_THRESHOLD_EVENT 550
- #define TEMP_HIGH_RECOVERY_EVENT 500
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 550
- #define TEMP_HIGH_RECOVERY_NORMAL 500
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 550
- #define TEMP_HIGH_RECOVERY_LPM 500
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_KLTE_ATT) || defined(CONFIG_MACH_KLTE_TMO) || defined(CONFIG_MACH_KLTE_MTR) || \
- defined(CONFIG_MACH_KLTE_VZW) || defined(CONFIG_MACH_KLTE_CAN) || defined(CONFIG_MACH_KLTE_SPR) || defined(CONFIG_MACH_KLTE_LRA)
- #define TEMP_HIGH_THRESHOLD_EVENT 550
- #define TEMP_HIGH_RECOVERY_EVENT 500
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 550
- #define TEMP_HIGH_RECOVERY_NORMAL 500
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 550
- #define TEMP_HIGH_RECOVERY_LPM 500
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM -20
- #elif defined(CONFIG_MACH_KACTIVELTE_SKT)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 560
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 540
- #define TEMP_HIGH_RECOVERY_LPM 500
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM -20
- #elif defined(CONFIG_MACH_KSPORTSLTE_SPR)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 550
- #define TEMP_HIGH_RECOVERY_NORMAL 470
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 500
- #define TEMP_HIGH_RECOVERY_LPM 480
- #define TEMP_LOW_THRESHOLD_LPM -30
- #define TEMP_LOW_RECOVERY_LPM 23
- #elif defined(CONFIG_MACH_KACTIVELTE_ATT)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 550
- #define TEMP_HIGH_RECOVERY_NORMAL 470
- #define TEMP_LOW_THRESHOLD_NORMAL -30
- #define TEMP_LOW_RECOVERY_NORMAL 20
- #define TEMP_HIGH_THRESHOLD_LPM 525
- #define TEMP_HIGH_RECOVERY_LPM 470
- #define TEMP_LOW_THRESHOLD_LPM -10
- #define TEMP_LOW_RECOVERY_LPM 20
- #elif defined (CONFIG_MACH_KLTE_ACG)
- #define TEMP_HIGH_THRESHOLD_EVENT 540
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 540
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 540
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined (CONFIG_MACH_KLTE_USC)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined (CONFIG_MACH_KLTE_JPN)
- #define TEMP_HIGH_THRESHOLD_EVENT 580
- #define TEMP_HIGH_RECOVERY_EVENT 530
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 580
- #define TEMP_HIGH_RECOVERY_NORMAL 530
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 580
- #define TEMP_HIGH_RECOVERY_LPM 530
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
- defined(CONFIG_SEC_LOCALE_CHN)
- #define TEMP_HIGH_THRESHOLD_EVENT 580
- #define TEMP_HIGH_RECOVERY_EVENT 530
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 580
- #define TEMP_HIGH_RECOVERY_NORMAL 530
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 580
- #define TEMP_HIGH_RECOVERY_LPM 530
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_HLTESKT) || defined(CONFIG_MACH_HLTEKTT) || defined(CONFIG_MACH_HLTELGT)
- #define TEMP_HIGH_THRESHOLD_EVENT 680
- #define TEMP_HIGH_RECOVERY_EVENT 440
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 680
- #define TEMP_HIGH_RECOVERY_NORMAL 440
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 680
- #define TEMP_HIGH_RECOVERY_LPM 440
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_FRESCOLTESKT)||defined(CONFIG_MACH_FRESCOLTEKTT)||defined(CONFIG_MACH_FRESCOLTELGT)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_HLTEATT) || defined(CONFIG_MACH_HLTETMO)
- #define TEMP_HIGH_THRESHOLD_EVENT 610
- #define TEMP_HIGH_RECOVERY_EVENT 400
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 490
- #define TEMP_HIGH_RECOVERY_NORMAL 440
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 490
- #define TEMP_HIGH_RECOVERY_LPM 440
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_HLTESPR)
- #define TEMP_HIGH_THRESHOLD_EVENT 640
- #define TEMP_HIGH_RECOVERY_EVENT 438
- #define TEMP_LOW_THRESHOLD_EVENT -37
- #define TEMP_LOW_RECOVERY_EVENT 11
- #define TEMP_HIGH_THRESHOLD_NORMAL 529
- #define TEMP_HIGH_RECOVERY_NORMAL 438
- #define TEMP_LOW_THRESHOLD_NORMAL -37
- #define TEMP_LOW_RECOVERY_NORMAL 11
- #define TEMP_HIGH_THRESHOLD_LPM 529
- #define TEMP_HIGH_RECOVERY_LPM 459
- #define TEMP_LOW_THRESHOLD_LPM -23
- #define TEMP_LOW_RECOVERY_LPM -10
- #elif defined(CONFIG_MACH_HLTEVZW)
- #define TEMP_HIGH_THRESHOLD_EVENT 650
- #define TEMP_HIGH_RECOVERY_EVENT 450
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT -10
- #define TEMP_HIGH_THRESHOLD_NORMAL 550
- #define TEMP_HIGH_RECOVERY_NORMAL 450
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL -10
- #define TEMP_HIGH_THRESHOLD_LPM 520
- #define TEMP_HIGH_RECOVERY_LPM 470
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM -15
- #elif defined(CONFIG_MACH_HLTEDCM)
- #define TEMP_HIGH_THRESHOLD_EVENT 625
- #define TEMP_HIGH_RECOVERY_EVENT 420
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT -5
- #define TEMP_HIGH_THRESHOLD_NORMAL 625
- #define TEMP_HIGH_RECOVERY_NORMAL 420
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL -5
- #define TEMP_HIGH_THRESHOLD_LPM 625
- #define TEMP_HIGH_RECOVERY_LPM 420
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM -5
- #elif defined(CONFIG_MACH_HLTEKDI)
- #define TEMP_HIGH_THRESHOLD_EVENT 660
- #define TEMP_HIGH_RECOVERY_EVENT 420
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 660
- #define TEMP_HIGH_RECOVERY_NORMAL 420
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 660
- #define TEMP_HIGH_RECOVERY_LPM 420
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_HLTEUSC)
- #define TEMP_HIGH_THRESHOLD_EVENT 650
- #define TEMP_HIGH_RECOVERY_EVENT 440
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 640
- #define TEMP_HIGH_RECOVERY_NORMAL 450
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 650
- #define TEMP_HIGH_RECOVERY_LPM 440
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_H3GDUOS_CTC)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_HLTEAUS)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_H3G_CHN_CMCC)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_HLTEEUR)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 400
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 400
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 400
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM 0
- /* H Project*/
- #elif defined(CONFIG_SEC_H_PROJECT)
- #define TEMP_HIGH_THRESHOLD_EVENT 650
- #define TEMP_HIGH_RECOVERY_EVENT 440
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 650
- #define TEMP_HIGH_RECOVERY_NORMAL 440
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 650
- #define TEMP_HIGH_RECOVERY_LPM 440
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM 0
- /* JS Project*/
- #elif defined(CONFIG_SEC_JS_PROJECT)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 400
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 400
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 400
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_FLTEEUR) || defined(CONFIG_MACH_FLTESKT)
- #define TEMP_HIGH_THRESHOLD_EVENT 700
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 700
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 700
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_SEC_KS01_PROJECT)
- #if defined(CONFIG_MACH_KS01EUR)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_KS01SKT) || defined(CONFIG_MACH_KS01LGT)
- #define TEMP_HIGH_THRESHOLD_EVENT 670
- #define TEMP_HIGH_RECOVERY_EVENT 420
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 670
- #define TEMP_HIGH_RECOVERY_NORMAL 420
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 670
- #define TEMP_HIGH_RECOVERY_LPM 420
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM 0
- #else /* CONFIG_MACH_KS01KTT */
- #define TEMP_HIGH_THRESHOLD_EVENT 670
- #define TEMP_HIGH_RECOVERY_EVENT 440
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 670
- #define TEMP_HIGH_RECOVERY_NORMAL 440
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 670
- #define TEMP_HIGH_RECOVERY_LPM 440
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM 0
- #endif
- #elif defined(CONFIG_SEC_JACTIVE_PROJECT)
- #define TEMP_HIGH_THRESHOLD_EVENT 670
- #define TEMP_HIGH_RECOVERY_EVENT 420
- #define TEMP_LOW_THRESHOLD_EVENT -45
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 670
- #define TEMP_HIGH_RECOVERY_NORMAL 420
- #define TEMP_LOW_THRESHOLD_NORMAL -45
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 670
- #define TEMP_HIGH_RECOVERY_LPM 420
- #define TEMP_LOW_THRESHOLD_LPM -45
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_MONDRIANWIFI_USA)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 450
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 510
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 450
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_MONDRIAN)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_VIENNAVZW)
- #define TEMP_HIGH_THRESHOLD_EVENT 590
- #define TEMP_HIGH_RECOVERY_EVENT 470
- #define TEMP_LOW_THRESHOLD_EVENT -25
- #define TEMP_LOW_RECOVERY_EVENT 15
- #define TEMP_HIGH_THRESHOLD_NORMAL 530
- #define TEMP_HIGH_RECOVERY_NORMAL 480
- #define TEMP_LOW_THRESHOLD_NORMAL -25
- #define TEMP_LOW_RECOVERY_NORMAL 15
- #define TEMP_HIGH_THRESHOLD_LPM 500
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -40
- #define TEMP_LOW_RECOVERY_LPM 5
- #elif defined(CONFIG_MACH_VIENNAATT)
- #define TEMP_HIGH_THRESHOLD_EVENT 590
- #define TEMP_HIGH_RECOVERY_EVENT 470
- #define TEMP_LOW_THRESHOLD_EVENT -25
- #define TEMP_LOW_RECOVERY_EVENT 5
- #define TEMP_HIGH_THRESHOLD_NORMAL 545
- #define TEMP_HIGH_RECOVERY_NORMAL 470
- #define TEMP_LOW_THRESHOLD_NORMAL -25
- #define TEMP_LOW_RECOVERY_NORMAL 5
- #define TEMP_HIGH_THRESHOLD_LPM 500
- #define TEMP_HIGH_RECOVERY_LPM 480
- #define TEMP_LOW_THRESHOLD_LPM -35
- #define TEMP_LOW_RECOVERY_LPM 5
- #elif defined(CONFIG_MACH_V2)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -40
- #define TEMP_LOW_RECOVERY_EVENT 10
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -40
- #define TEMP_LOW_RECOVERY_NORMAL 10
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -40
- #define TEMP_LOW_RECOVERY_LPM 10
- #elif defined(CONFIG_MACH_VIENNAEUR) || defined(CONFIG_MACH_VIENNAKOR)
- #define TEMP_HIGH_THRESHOLD_EVENT 590
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -40
- #define TEMP_LOW_RECOVERY_EVENT 10
- #define TEMP_HIGH_THRESHOLD_NORMAL 590
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -40
- #define TEMP_LOW_RECOVERY_NORMAL 10
- #define TEMP_HIGH_THRESHOLD_LPM 590
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -40
- #define TEMP_LOW_RECOVERY_LPM 10
- #elif defined(CONFIG_MACH_PICASSO_SPR)
- #define TEMP_HIGH_THRESHOLD_EVENT 507
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 507
- #define TEMP_HIGH_RECOVERY_NORMAL 470
- #define TEMP_LOW_THRESHOLD_NORMAL -33
- #define TEMP_LOW_RECOVERY_NORMAL 4
- #define TEMP_HIGH_THRESHOLD_LPM 490
- #define TEMP_HIGH_RECOVERY_LPM 480
- #define TEMP_LOW_THRESHOLD_LPM 10
- #define TEMP_LOW_RECOVERY_LPM 15
- #elif defined(CONFIG_MACH_PICASSO_EUR)
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 460
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 460
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_LT03)
- #if defined(CONFIG_MACH_LT03_VZW)
- #define TEMP_HIGH_THRESHOLD_EVENT 567
- #define TEMP_HIGH_RECOVERY_EVENT 480
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 530
- #define TEMP_HIGH_RECOVERY_NORMAL 480
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 507
- #define TEMP_HIGH_RECOVERY_LPM 480
- #define TEMP_LOW_THRESHOLD_LPM -20
- #define TEMP_LOW_RECOVERY_LPM 0
- #elif defined(CONFIG_MACH_LT03_TMO)
- #define TEMP_HIGH_THRESHOLD_EVENT 530
- #define TEMP_HIGH_RECOVERY_EVENT 480
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 530
- #define TEMP_HIGH_RECOVERY_NORMAL 480
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 510
- #define TEMP_HIGH_RECOVERY_LPM 460
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #else
- #define TEMP_HIGH_THRESHOLD_EVENT 600
- #define TEMP_HIGH_RECOVERY_EVENT 400
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 600
- #define TEMP_HIGH_RECOVERY_NORMAL 400
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 600
- #define TEMP_HIGH_RECOVERY_LPM 400
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #endif
- #else
- #define TEMP_HIGH_THRESHOLD_EVENT 700
- #define TEMP_HIGH_RECOVERY_EVENT 420
- #define TEMP_LOW_THRESHOLD_EVENT -50
- #define TEMP_LOW_RECOVERY_EVENT 0
- #define TEMP_HIGH_THRESHOLD_NORMAL 700
- #define TEMP_HIGH_RECOVERY_NORMAL 420
- #define TEMP_LOW_THRESHOLD_NORMAL -50
- #define TEMP_LOW_RECOVERY_NORMAL 0
- #define TEMP_HIGH_THRESHOLD_LPM 700
- #define TEMP_HIGH_RECOVERY_LPM 420
- #define TEMP_LOW_THRESHOLD_LPM -50
- #define TEMP_LOW_RECOVERY_LPM 0
- #endif
- #if defined(CONFIG_BATTERY_SWELLING)
- #if defined(CONFIG_MACH_KACTIVELTE_KOR)
- #define BATT_SWELLING_HIGH_TEMP_BLOCK 450
- #define BATT_SWELLING_HIGH_TEMP_RECOV 400
- #define BATT_SWELLING_LOW_TEMP_BLOCK 100
- #define BATT_SWELLING_LOW_TEMP_RECOV 150
- #define BATT_SWELLING_HIGH_CHG_CURRENT 1400
- #define BATT_SWELLING_LOW_CHG_CURRENT 1000
- #define BATT_SWELLING_DROP_FLOAT_VOLTAGE 4200
- #define BATT_SWELLING_HIGH_RECHG_VOLTAGE 4150
- #define BATT_SWELLING_LOW_RECHG_VOLTAGE 4050
- #elif defined(CONFIG_SEC_K_PROJECT)
- #define BATT_SWELLING_HIGH_TEMP_BLOCK 500
- #define BATT_SWELLING_HIGH_TEMP_RECOV 450
- #define BATT_SWELLING_LOW_TEMP_BLOCK 50
- #define BATT_SWELLING_LOW_TEMP_RECOV 100
- #define BATT_SWELLING_HIGH_CHG_CURRENT 0
- #define BATT_SWELLING_LOW_CHG_CURRENT 1400
- #define BATT_SWELLING_DROP_FLOAT_VOLTAGE 4200
- #define BATT_SWELLING_HIGH_RECHG_VOLTAGE 4150
- #define BATT_SWELLING_LOW_RECHG_VOLTAGE 4050
- #else
- #define BATT_SWELLING_HIGH_TEMP_BLOCK 450
- #define BATT_SWELLING_HIGH_TEMP_RECOV 400
- #define BATT_SWELLING_LOW_TEMP_BLOCK 100
- #define BATT_SWELLING_LOW_TEMP_RECOV 150
- #define BATT_SWELLING_HIGH_CHG_CURRENT 0
- #define BATT_SWELLING_LOW_CHG_CURRENT 0
- #define BATT_SWELLING_DROP_FLOAT_VOLTAGE 4200
- #define BATT_SWELLING_HIGH_RECHG_VOLTAGE 4150
- #define BATT_SWELLING_LOW_RECHG_VOLTAGE 4050
- #endif
- #endif //CONFIG_BATTERY_SWELLING
- #endif //CONFIG_BATTERY_SAMSUNG_DATA
- #if defined(CONFIG_MACH_MONDRIAN)
- int sec_bat_check_battery_company(void)
- {
- int result = BATT_TYPE_ATL;
- int rc, data = -1;
- struct qpnp_vadc_result results;
- rc = qpnp_vadc_read(NULL, LR_MUX5_PU2_AMUX_THM2, &results);
- if (rc) {
- pr_err("%s: Unable to read batt id rc=%d\n",
- __func__, rc);
- return BATT_TYPE_ATL;
- }
- data = results.adc_code;
- pr_info("%s: batt_id_adc = (%d)\n", __func__, data);
- /* SDI: 28500, ATL: 31000 */
- if (data > 31000) {
- result = BATT_TYPE_ATL;
- } else {
- result = BATT_TYPE_SDI;
- }
- return result;
- }
- #endif
- void sec_bat_check_batt_id(struct sec_battery_info *battery)
- {
- #if defined(CONFIG_SENSORS_QPNP_ADC_VOLTAGE)
- #if defined(CONFIG_FUELGAUGE_MAX17050)
- int rc, data = -1;
- struct qpnp_vadc_result results;
- #if defined(CONFIG_MACH_PICASSO) || defined(CONFIG_MACH_LT03) || defined(CONFIG_MACH_VIENNA)
- rc = qpnp_vadc_read(NULL, LR_MUX9_PU2_AMUX_THM5, &results);
- #else
- rc = qpnp_vadc_read(NULL, LR_MUX5_PU2_AMUX_THM2, &results);
- #endif
- if (rc) {
- pr_err("%s: Unable to read batt id rc=%d\n",
- __func__, rc);
- return;
- }
- data = results.adc_code;
- pr_info("%s: batt_id_adc = (%d)\n", __func__, data);
- #if defined(CONFIG_MACH_PICASSO) || defined(CONFIG_MACH_LT03)
- /* SDI: 28000, BYD: 29000, ATL: 31000 */
- if (data > 31000) { /* ATL */
- battery->pdata->vendor = "ATL ATL";
- samsung_battery_data[0].Capacity = 0x4074;
- samsung_battery_data[0].type_str = "ATL";
- } else if (data > 29000) { /* BYD */
- battery->pdata->vendor = "BYD BYD";
- samsung_battery_data[0].Capacity = 0x4010;
- samsung_battery_data[0].type_str = "BYD";
- }
- #endif
- #if defined(CONFIG_MACH_VIENNA) || defined(CONFIG_MACH_MONDRIAN)
- /* SDI: 28500, ATL: 31000 */
- if (data > 31000) {
- battery->pdata->vendor = "ATL ATL";
- #if defined(CONFIG_MACH_MONDRIAN)
- samsung_battery_data[0].Capacity = 0x2614; /* Mondrian : 4874mAh */
- #else
- samsung_battery_data[0].Capacity = 0x4958; /* Vienna */
- #endif
- samsung_battery_data[0].type_str = "ATL";
- }
- #endif
- pr_err("%s: batt_type(%s), batt_id(%d), cap(0x%x), type(%s)\n",
- __func__, battery->pdata->vendor, data,
- samsung_battery_data[0].Capacity, samsung_battery_data[0].type_str);
- #endif
- #endif
- }
- static void sec_bat_adc_ap_init(struct platform_device *pdev,
- struct sec_battery_info *battery)
- {
- #if 0
- struct power_supply *psy_fuelgauge;
- struct sec_fuelgauge_info *fuelgauge;
- psy_fuelgauge = get_power_supply_by_name(battery->pdata->fuelgauge_name);
- if (!psy_fuelgauge) {
- pr_err("%s : can't get sec-fuelgauge\n", __func__);
- } else {
- fuelgauge = container_of(psy_fuelgauge, struct sec_fuelgauge_info, psy_fg);
- adc_client = qpnp_get_vadc(&fuelgauge->client->dev, "sec-fuelgauge");
- if (IS_ERR(adc_client)) {
- int rc;
- rc = PTR_ERR(adc_client);
- if (rc != -EPROBE_DEFER)
- pr_err("%s: Fail to get vadc %d\n", __func__, rc);
- }
- }
- #endif
- #if defined(CONFIG_ARCH_MSM8974PRO)
- temp_channel = LR_MUX5_PU1_AMUX_THM2;
- #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)
- temp_channel = LR_MUX5_PU2_AMUX_THM2;
- #else
- temp_channel = LR_MUX4_PU2_AMUX_THM1;
- #endif
- if (battery->pdata->chg_temp_check)
- chg_temp_channel = LR_MUX9_PU1_AMUX_THM5;
- #if defined(CONFIG_FUELGAUGE_MAX17050)
- /* battery id checking*/
- sec_bat_check_batt_id(battery);
- #endif
- }
- static int sec_bat_adc_ap_read(struct sec_battery_info *battery, int channel)
- {
- struct qpnp_vadc_result results;
- int rc = -1;
- int data = -1;
- switch (channel)
- {
- case SEC_BAT_ADC_CHANNEL_TEMP :
- rc = qpnp_vadc_read(NULL, temp_channel, &results);
- if (rc) {
- pr_err("%s: Unable to read batt temperature rc=%d\n",
- __func__, rc);
- return 0;
- }
- data = results.adc_code;
- break;
- case SEC_BAT_ADC_CHANNEL_TEMP_AMBIENT:
- data = 33000;
- break;
- case SEC_BAT_ADC_CHANNEL_BAT_CHECK :
- qpnp_vadc_read(NULL, P_MUX8_1_3, &results);
- data = ((int)results.physical) / 1000;
- break;
- #if defined(CONFIG_FUELGAUGE_MAX17050)
- case SEC_BAT_ADC_CHANNEL_INBAT_VOLTAGE:
- qpnp_vadc_read(NULL, P_MUX5_1_1, &results);
- /* pullup resistance: 1M, pulldown: 470k */
- data = ((int)results.physical) * 1470 / 470 / 1000;
- break;
- #endif
- case SEC_BAT_ADC_CHANNEL_CHG_TEMP:
- rc = qpnp_vadc_read(NULL, chg_temp_channel, &results);
- if (rc) {
- pr_err("%s: Unable to read chg temperature rc=%d\n",
- __func__, rc);
- return 33000;
- }
- data = results.adc_code;
- break;
- default :
- break;
- }
- pr_debug("%s: data(%d)\n", __func__, data);
- return data;
- }
- static void sec_bat_adc_ap_exit(void)
- {
- }
- static void sec_bat_adc_none_init(struct platform_device *pdev,
- struct sec_battery_info *battery)
- {
- }
- static int sec_bat_adc_none_read(struct sec_battery_info *battery, int channel)
- {
- return 0;
- }
- static void sec_bat_adc_none_exit(void)
- {
- }
- static void sec_bat_adc_ic_init(struct platform_device *pdev,
- struct sec_battery_info *battery)
- {
- }
- static int sec_bat_adc_ic_read(struct sec_battery_info *battery, int channel)
- {
- return 0;
- }
- static void sec_bat_adc_ic_exit(void)
- {
- }
- static int adc_read_type(struct sec_battery_info *battery, int channel)
- {
- int adc = 0;
- switch (battery->pdata->temp_adc_type)
- {
- case SEC_BATTERY_ADC_TYPE_NONE :
- adc = sec_bat_adc_none_read(battery, channel);
- break;
- case SEC_BATTERY_ADC_TYPE_AP :
- adc = sec_bat_adc_ap_read(battery, channel);
- break;
- case SEC_BATTERY_ADC_TYPE_IC :
- adc = sec_bat_adc_ic_read(battery, channel);
- break;
- case SEC_BATTERY_ADC_TYPE_NUM :
- break;
- default :
- break;
- }
- pr_debug("[%s] ADC = %d\n", __func__, adc);
- return adc;
- }
- static void adc_init_type(struct platform_device *pdev,
- struct sec_battery_info *battery)
- {
- switch (battery->pdata->temp_adc_type)
- {
- case SEC_BATTERY_ADC_TYPE_NONE :
- sec_bat_adc_none_init(pdev, battery);
- break;
- case SEC_BATTERY_ADC_TYPE_AP :
- sec_bat_adc_ap_init(pdev, battery);
- break;
- case SEC_BATTERY_ADC_TYPE_IC :
- sec_bat_adc_ic_init(pdev, battery);
- break;
- case SEC_BATTERY_ADC_TYPE_NUM :
- break;
- default :
- break;
- }
- }
- static void adc_exit_type(struct sec_battery_info *battery)
- {
- switch (battery->pdata->temp_adc_type)
- {
- case SEC_BATTERY_ADC_TYPE_NONE :
- sec_bat_adc_none_exit();
- break;
- case SEC_BATTERY_ADC_TYPE_AP :
- sec_bat_adc_ap_exit();
- break;
- case SEC_BATTERY_ADC_TYPE_IC :
- sec_bat_adc_ic_exit();
- break;
- case SEC_BATTERY_ADC_TYPE_NUM :
- break;
- default :
- break;
- }
- }
- int adc_read(struct sec_battery_info *battery, int channel)
- {
- int adc = 0;
- adc = adc_read_type(battery, channel);
- pr_debug("[%s]adc = %d\n", __func__, adc);
- return adc;
- }
- void adc_exit(struct sec_battery_info *battery)
- {
- adc_exit_type(battery);
- }
- bool sec_bat_check_jig_status(void)
- {
- #if defined(CONFIG_SEC_H_PROJECT) || defined(CONFIG_SEC_JS_PROJECT) || defined(CONFIG_SEC_F_PROJECT) || \
- defined(CONFIG_SEC_KS01_PROJECT) || defined(CONFIG_MACH_MONDRIAN) || \
- defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_FRESCO_PROJECT) || \
- defined(CONFIG_SEC_KACTIVE_PROJECT) || defined(CONFIG_SEC_KSPORTS_PROJECT) || \
- defined(CONFIG_SEC_JACTIVE_PROJECT) || defined(CONFIG_SEC_S_PROJECT) || \
- defined(CONFIG_SEC_PATEK_PROJECT)
- #if defined(CONFIG_EXTCON)
- return get_jig_state();
- #else
- extern bool is_jig_attached; // from sec-switch
- return is_jig_attached;
- #endif
- #else
- if (!sec_fuelgauge) {
- pr_err("%s: sec_fuelgauge is empty\n", __func__);
- return false;
- }
- if (sec_fuelgauge->pdata->jig_irq >= 0) {
- if (gpio_get_value_cansleep(sec_fuelgauge->pdata->jig_irq))
- return true;
- else
- return false;
- } else {
- pr_err("%s: jig_irq is invalid\n", __func__);
- return false;
- }
- #endif
- }
- /* callback for battery check
- * return : bool
- * true - battery detected, false battery NOT detected
- */
- bool sec_bat_check_callback(struct sec_battery_info *battery)
- {
- struct power_supply *psy;
- union power_supply_propval value;
- pr_info("%s: battery->pdata->bat_irq_gpio(%d)\n",
- __func__, battery->pdata->bat_irq_gpio);
- psy = get_power_supply_by_name(("sec-charger"));
- if (!psy) {
- pr_err("%s: Fail to get psy (%s)\n",
- __func__, "sec-charger");
- value.intval = 1;
- } else {
- if (battery->pdata->bat_irq_gpio > 0) {
- value.intval = !gpio_get_value(battery->pdata->bat_irq_gpio);
- pr_info("%s: Battery status(%d)\n",
- __func__, value.intval);
- if (value.intval == 0) {
- return value.intval;
- }
- #if defined(CONFIG_MACH_HLTEATT) || defined(CONFIG_MACH_HLTESPR) || \
- defined(CONFIG_MACH_HLTEVZW) || defined(CONFIG_MACH_HLTETMO) || \
- defined(CONFIG_MACH_HLTEUSC)
- {
- int data, ret;
- struct qpnp_vadc_result result;
- struct qpnp_pin_cfg adc_param = {
- .mode = 4,
- .ain_route = 3,
- .src_sel = 0,
- .master_en =1,
- };
- struct qpnp_pin_cfg int_param = {
- .mode = 0,
- .vin_sel = 2,
- .src_sel = 0,
- .master_en =1,
- };
- ret = qpnp_pin_config(battery->pdata->bat_irq_gpio, &adc_param);
- if (ret < 0)
- pr_info("%s: qpnp config error: %d\n",
- __func__, ret);
- /* check the adc from vf pin */
- qpnp_vadc_read(NULL, P_MUX8_1_3, &result);
- data = ((int)result.physical) / 1000;
- pr_info("%s: (%dmV) is connected.\n",
- __func__, data);
- if(data < SHORT_BATTERY_STANDARD) {
- pr_info("%s: Short Battery(%dmV) is connected.\n",
- __func__, data);
- value.intval = 0;
- }
- ret = qpnp_pin_config(battery->pdata->bat_irq_gpio, &int_param);
- if (ret < 0)
- pr_info("%s: qpnp config error int: %d\n",
- __func__, ret);
- }
- #endif
- } else {
- int ret;
- ret = psy->get_property(psy, POWER_SUPPLY_PROP_PRESENT, &(value));
- if (ret < 0) {
- pr_err("%s: Fail to sec-charger get_property (%d=>%d)\n",
- __func__, POWER_SUPPLY_PROP_PRESENT, ret);
- value.intval = 1;
- }
- }
- }
- return value.intval;
- }
- void sec_bat_check_cable_result_callback(struct device *dev,
- int cable_type)
- {
- #if defined(CONFIG_SEC_H_PROJECT) || defined(CONFIG_SEC_JS_PROJECT) || defined(CONFIG_SEC_FRESCO_PROJECT)
- struct regulator *ldo11;
- current_cable_type = cable_type;
- if (current_cable_type == POWER_SUPPLY_TYPE_BATTERY)
- {
- pr_info("%s set ldo off\n", __func__);
- ldo11 = regulator_get(NULL, "8941_l11");
- if(ldo11 > 0)
- {
- regulator_disable(ldo11);
- }
- }
- else
- {
- pr_info("%s set ldo on\n", __func__);
- ldo11 = regulator_get(NULL, "8941_l11");
- if(ldo11 > 0)
- {
- regulator_enable(ldo11);
- }
- }
- #elif defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
- defined(CONFIG_SEC_KSPORTS_PROJECT) || defined(CONFIG_SEC_S_PROJECT)
- struct regulator *max77826_ldo6;
- current_cable_type = cable_type;
- if (current_cable_type == POWER_SUPPLY_TYPE_BATTERY)
- {
- pr_info("%s set ldo off\n", __func__);
- max77826_ldo6 = regulator_get(NULL, "max77826_ldo6");
- if(max77826_ldo6) {
- regulator_disable(max77826_ldo6);
- regulator_put(max77826_ldo6);
- }
- }
- else
- {
- pr_info("%s set ldo on\n", __func__);
- max77826_ldo6 = regulator_get(NULL, "max77826_ldo6");
- if(max77826_ldo6) {
- regulator_enable(max77826_ldo6);
- regulator_put(max77826_ldo6);
- }
- }
- #elif defined(CONFIG_SEC_PATEK_PROJECT)
- struct regulator *vreg_lvs3;
- current_cable_type = cable_type;
- if (current_cable_type == POWER_SUPPLY_TYPE_BATTERY)
- {
- pr_info("%s set lvs3 off\n", __func__);
- vreg_lvs3 = regulator_get(NULL, "8084_lvs3");
- if (!IS_ERR(vreg_lvs3))
- {
- if (regulator_disable(vreg_lvs3))
- pr_err("%s: error for disabling regulator VF_1P8\n", __func__);
- regulator_put(vreg_lvs3);
- }
- }
- else
- {
- pr_info("%s set lvs3 on\n", __func__);
- vreg_lvs3 = regulator_get(NULL, "8084_lvs3");
- if (!IS_ERR(vreg_lvs3))
- {
- if (regulator_enable(vreg_lvs3))
- pr_err("%s: error for enabling regulator VF_1P8\n", __func__);
- regulator_put(vreg_lvs3);
- }
- }
- #endif
- }
- int sec_bat_check_cable_callback(struct sec_battery_info *battery)
- {
- union power_supply_propval value;
- #ifdef CONFIG_USB_SWITCH_FSA9485
- bool ta_status;
- ta_status = gpio_get_value_cansleep(battery->pdata->ta_irq_gpio) ? false : true;
- fsa9485_mmdock_vbus_check(ta_status);
- #endif
- if (battery->pdata->ta_irq_gpio == 0) {
- pr_err("%s: ta_int_gpio is 0 or not assigned yet(cable_type(%d))\n",
- __func__, current_cable_type);
- } else {
- if (battery->wire_status == POWER_SUPPLY_TYPE_BATTERY &&
- #if defined(CONFIG_SEC_LT03_PROJECT)
- !battery->ps_enable &&
- #endif
- !gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) {
- pr_info("%s : VBUS IN\n", __func__);
- value.intval = POWER_SUPPLY_TYPE_UARTOFF;
- psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value);
- current_cable_type = POWER_SUPPLY_TYPE_UARTOFF;
- return POWER_SUPPLY_TYPE_UARTOFF;
- }
- if ((battery->wire_status == POWER_SUPPLY_TYPE_UARTOFF ||
- battery->wire_status == POWER_SUPPLY_TYPE_CARDOCK) &&
- gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) {
- pr_info("%s : VBUS OUT\n", __func__);
- value.intval = POWER_SUPPLY_TYPE_BATTERY;
- psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value);
- current_cable_type = POWER_SUPPLY_TYPE_BATTERY;
- return POWER_SUPPLY_TYPE_BATTERY;
- }
- }
- return current_cable_type;
- }
- void board_battery_init(struct platform_device *pdev, struct sec_battery_info *battery)
- {
- if ((!battery->pdata->temp_adc_table) &&
- (battery->pdata->thermal_source == SEC_BATTERY_THERMAL_SOURCE_ADC)) {
- pr_info("%s : assign temp adc table\n", __func__);
- battery->pdata->temp_adc_table = temp_table;
- battery->pdata->temp_amb_adc_table = temp_table;
- battery->pdata->temp_adc_table_size = sizeof(temp_table)/sizeof(sec_bat_adc_table_data_t);
- battery->pdata->temp_amb_adc_table_size = sizeof(temp_table)/sizeof(sec_bat_adc_table_data_t);
- }
- if ((!battery->pdata->chg_temp_adc_table) &&
- (battery->pdata->chg_temp_check)) {
- pr_info("%s : assign chg temp adc table\n", __func__);
- battery->pdata->chg_temp_adc_table = chg_temp_table;
- battery->pdata->chg_temp_adc_table_size = sizeof(chg_temp_table)/sizeof(sec_bat_adc_table_data_t);
- }
- battery->pdata->event_check = true;
- #if defined(CONFIG_SEC_K_PROJECT) || defined(CONFIG_SEC_KACTIVE_PROJECT) || \
- defined(CONFIG_SEC_KSPORTS_PROJECT) || defined(CONFIG_SEC_S_PROJECT) || \
- defined(CONFIG_SEC_PATEK_PROJECT)
- battery->pdata->temp_highlimit_threshold_event = TEMP_HIGHLIMIT_THRESHOLD_EVENT;
- battery->pdata->temp_highlimit_recovery_event = TEMP_HIGHLIMIT_RECOVERY_EVENT;
- battery->pdata->temp_highlimit_threshold_normal = TEMP_HIGHLIMIT_THRESHOLD_NORMAL;
- battery->pdata->temp_highlimit_recovery_normal = TEMP_HIGHLIMIT_RECOVERY_NORMAL;
- battery->pdata->temp_highlimit_threshold_lpm = TEMP_HIGHLIMIT_THRESHOLD_LPM;
- battery->pdata->temp_highlimit_recovery_lpm = TEMP_HIGHLIMIT_RECOVERY_LPM;
- #endif
- battery->pdata->temp_high_threshold_event = TEMP_HIGH_THRESHOLD_EVENT;
- battery->pdata->temp_high_recovery_event = TEMP_HIGH_RECOVERY_EVENT;
- battery->pdata->temp_low_threshold_event = TEMP_LOW_THRESHOLD_EVENT;
- battery->pdata->temp_low_recovery_event = TEMP_LOW_RECOVERY_EVENT;
- battery->pdata->temp_high_threshold_normal = TEMP_HIGH_THRESHOLD_NORMAL;
- battery->pdata->temp_high_recovery_normal = TEMP_HIGH_RECOVERY_NORMAL;
- battery->pdata->temp_low_threshold_normal = TEMP_LOW_THRESHOLD_NORMAL;
- battery->pdata->temp_low_recovery_normal = TEMP_LOW_RECOVERY_NORMAL;
- battery->pdata->temp_high_threshold_lpm = TEMP_HIGH_THRESHOLD_LPM;
- battery->pdata->temp_high_recovery_lpm = TEMP_HIGH_RECOVERY_LPM;
- battery->pdata->temp_low_threshold_lpm = TEMP_LOW_THRESHOLD_LPM;
- battery->pdata->temp_low_recovery_lpm = TEMP_LOW_RECOVERY_LPM;
- #if defined(CONFIG_MACH_KLTE_ATT) || defined(CONFIG_MACH_KLTE_TMO) || \
- defined(CONFIG_MACH_KLTE_SPR) || defined(CONFIG_MACH_KLTE_VZW) || \
- defined(CONFIG_MACH_KLTE_MTR) || defined(CONFIG_MACH_KSPORTSLTE_SPR) || \
- defined(CONFIG_MACH_KLTE_USC) || defined(CONFIG_MACH_KACTIVELTE_ATT) || \
- defined(CONFIG_MACH_KLTE_ACG) || defined(CONFIG_MACH_KLTE_LRA) || \
- defined(CONFIG_MACH_KACTIVELTE_SKT) || defined(CONFIG_SEC_S_PROJECT)
- battery->pdata->check_adc_max = 1110;
- battery->pdata->check_adc_min = 150;
- #endif
- #if defined(CONFIG_BATTERY_SWELLING)
- battery->pdata->swelling_high_temp_block = BATT_SWELLING_HIGH_TEMP_BLOCK;
- battery->pdata->swelling_high_temp_recov = BATT_SWELLING_HIGH_TEMP_RECOV;
- battery->pdata->swelling_low_temp_block = BATT_SWELLING_LOW_TEMP_BLOCK;
- battery->pdata->swelling_low_temp_recov = BATT_SWELLING_LOW_TEMP_RECOV;
- battery->pdata->swelling_high_chg_current = BATT_SWELLING_HIGH_CHG_CURRENT;
- battery->pdata->swelling_low_chg_current = BATT_SWELLING_LOW_CHG_CURRENT;
- battery->pdata->swelling_drop_float_voltage = BATT_SWELLING_DROP_FLOAT_VOLTAGE;
- battery->pdata->swelling_high_rechg_voltage = BATT_SWELLING_HIGH_RECHG_VOLTAGE;
- battery->pdata->swelling_low_rechg_voltage = BATT_SWELLING_LOW_RECHG_VOLTAGE;
- #endif
- adc_init_type(pdev, battery);
- }
- #if defined(CONFIG_FUELGAUGE_MAX77823)
- void board_fuelgauge_init(struct max77823_fuelgauge_data *fuelgauge)
- {
- sec_fuelgauge = 0;
- if (!fuelgauge->pdata->battery_data) {
- pr_info("%s : assign battery data\n", __func__);
- fuelgauge->pdata->battery_data = (void *)samsung_battery_data;
- }
- }
- #else
- void board_fuelgauge_init(struct sec_fuelgauge_info *fuelgauge)
- {
- sec_fuelgauge = fuelgauge;
- if (!fuelgauge->pdata->battery_data) {
- pr_info("%s : assign battery data\n", __func__);
- fuelgauge->pdata->battery_data = (void *)samsung_battery_data;
- }
- fuelgauge->pdata->capacity_max = CAPACITY_MAX;
- fuelgauge->pdata->capacity_max_margin = CAPACITY_MAX_MARGIN;
- fuelgauge->pdata->capacity_min = CAPACITY_MIN;
- #if defined(CONFIG_SEC_VIENNA_PROJECT) || defined(CONFIG_SEC_V2_PROJECT) ||\
- defined(CONFIG_MACH_PICASSO_LTE) || defined(CONFIG_MACH_MONDRIAN) || defined(CONFIG_MACH_LT03) ||\
- defined(CONFIG_MACH_KLIMT) || defined(CONFIG_MACH_CHAGALL)
- fuelgauge->pdata->temp_adc_table = temp_table;
- fuelgauge->pdata->temp_adc_table_size = sizeof(temp_table)/sizeof(sec_bat_adc_table_data_t);
- #endif
- #if defined(CONFIG_FUELGAUGE_MAX17048)
- pr_info("%s: RCOMP0: 0x%x, RCOMP_charging: 0x%x, "
- "temp_cohot: %d, temp_cocold: %d, "
- "is_using_model_data: %d, type_str: %s, "
- "capacity_max: %d, capacity_max_margin: %d, "
- "capacity_min: %d, \n", __func__ ,
- get_battery_data(fuelgauge).RCOMP0,
- get_battery_data(fuelgauge).RCOMP_charging,
- get_battery_data(fuelgauge).temp_cohot,
- get_battery_data(fuelgauge).temp_cocold,
- get_battery_data(fuelgauge).is_using_model_data,
- get_battery_data(fuelgauge).type_str,
- fuelgauge->pdata->capacity_max,
- fuelgauge->pdata->capacity_max_margin,
- fuelgauge->pdata->capacity_min
- );
- #endif
- }
- #endif
- void cable_initial_check(struct sec_battery_info *battery)
- {
- union power_supply_propval value;
- pr_info("%s : current_cable_type : (%d)\n", __func__, current_cable_type);
- if (POWER_SUPPLY_TYPE_BATTERY != current_cable_type) {
- if (current_cable_type == POWER_SUPPLY_TYPE_POWER_SHARING) {
- value.intval = current_cable_type;
- psy_do_property("ps", set,
- POWER_SUPPLY_PROP_ONLINE, value);
- } else {
- value.intval = current_cable_type;
- psy_do_property("battery", set,
- POWER_SUPPLY_PROP_ONLINE, value);
- }
- } else {
- psy_do_property(battery->pdata->charger_name, get,
- POWER_SUPPLY_PROP_ONLINE, value);
- if (value.intval == POWER_SUPPLY_TYPE_WIRELESS) {
- value.intval = 1;
- psy_do_property("wireless", set,
- POWER_SUPPLY_PROP_ONLINE, value);
- }
- if (battery->pdata->ta_irq_gpio == 0) {
- pr_err("%s: ta_int_gpio is 0 or not assigned yet(cable_type(%d))\n",
- __func__, current_cable_type);
- } else {
- if (battery->wire_status == POWER_SUPPLY_TYPE_BATTERY &&
- !gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) {
- #if defined(CONFIG_USB_SWITCH_FSA9485)
- if (!mhl_connection_state()) {
- #endif
- pr_info("%s : VBUS IN\n", __func__);
- value.intval = POWER_SUPPLY_TYPE_UARTOFF;
- psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value);
- current_cable_type = POWER_SUPPLY_TYPE_UARTOFF;
- #if defined(CONFIG_USB_SWITCH_FSA9485)
- }
- #endif
- }
- if ((battery->wire_status == POWER_SUPPLY_TYPE_UARTOFF ||
- battery->wire_status == POWER_SUPPLY_TYPE_CARDOCK) &&
- gpio_get_value_cansleep(battery->pdata->ta_irq_gpio)) {
- pr_info("%s : VBUS OUT\n", __func__);
- value.intval = POWER_SUPPLY_TYPE_BATTERY;
- psy_do_property("battery", set, POWER_SUPPLY_PROP_ONLINE, value);
- current_cable_type = POWER_SUPPLY_TYPE_BATTERY;
- }
- }
- }
- }
|