board-millet-gpiomux.c 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919
  1. /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. /****************************** Revision History ******************************************
  14. *CH# Product author Description Date
  15. *-----------------------------------------------------------------------------------------
  16. *01 Millet-All nc.chaudhary Added the gpiomux settings for 30-Jan-2014
  17. * variants UART for LCIA Test failure
  18. ******************************************************************************************
  19. */
  20. #ifdef CONFIG_WCNSS_IRIS_REGISTER_DUMP
  21. #include <linux/gpio.h>
  22. #endif
  23. #include <linux/init.h>
  24. #include <linux/ioport.h>
  25. #include <mach/board.h>
  26. #include <mach/gpio.h>
  27. #include <mach/gpiomux.h>
  28. #include <mach/socinfo.h>
  29. #ifdef CONFIG_WCNSS_IRIS_REGISTER_DUMP
  30. #define WLAN_CLK 44
  31. #define WLAN_SET 43
  32. #define WLAN_DATA0 42
  33. #define WLAN_DATA1 41
  34. #define WLAN_DATA2 40
  35. #endif
  36. #if defined (CONFIG_SEC_MILLET_PROJECT)
  37. static struct gpiomux_setting nc_suspend_cfg = {
  38. .func = GPIOMUX_FUNC_GPIO,
  39. .drv = GPIOMUX_DRV_2MA,
  40. .pull = GPIOMUX_PULL_DOWN,
  41. .dir = GPIOMUX_IN,
  42. };
  43. #endif
  44. #ifdef CONFIG_USB_EHCI_MSM_HSIC
  45. static struct gpiomux_setting hsic_sus_cfg = {
  46. .func = GPIOMUX_FUNC_GPIO,
  47. .drv = GPIOMUX_DRV_2MA,
  48. .pull = GPIOMUX_PULL_DOWN,
  49. .dir = GPIOMUX_OUT_LOW,
  50. };
  51. static struct gpiomux_setting hsic_act_cfg = {
  52. .func = GPIOMUX_FUNC_1,
  53. .drv = GPIOMUX_DRV_16MA,
  54. .pull = GPIOMUX_PULL_NONE,
  55. };
  56. static struct msm_gpiomux_config msm_hsic_configs[] = {
  57. {
  58. #if !defined(CONFIG_SEC_MILLETLTE_COMMON)
  59. .gpio = 115, /* HSIC_STROBE */
  60. #else
  61. .gpio = 119, /* HSIC_STROBE */
  62. #endif
  63. .settings = {
  64. [GPIOMUX_ACTIVE] = &hsic_act_cfg,
  65. [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
  66. },
  67. },
  68. {
  69. #if !defined(CONFIG_SEC_MILLETLTE_COMMON)
  70. .gpio = 116, /* HSIC_DATA */
  71. #else
  72. .gpio = 120, /* HSIC_DATA */
  73. #endif
  74. .settings = {
  75. [GPIOMUX_ACTIVE] = &hsic_act_cfg,
  76. [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
  77. },
  78. },
  79. };
  80. #endif
  81. #define KS8851_IRQ_GPIO 115
  82. #if defined (CONFIG_SEC_MILLETLTE_COMMON) || \
  83. defined (CONFIG_SEC_MILLETWIFI_COMMON) || \
  84. defined (CONFIG_MACH_MILLET3G_EUR)
  85. #define NC_GPIO_CONFIG(gpio_num) { \
  86. .gpio = gpio_num, \
  87. .settings ={[GPIOMUX_SUSPENDED] = &nc_cfg,}\
  88. }
  89. static struct gpiomux_setting nc_cfg = {
  90. .func = GPIOMUX_FUNC_GPIO,
  91. .drv = GPIOMUX_DRV_2MA,
  92. .pull = GPIOMUX_PULL_DOWN,
  93. .dir = GPIOMUX_IN,
  94. };
  95. #endif
  96. #if defined(CONFIG_MACH_MILLETLTE_CAN)
  97. #define NC_GPIO_CONFIG_CAN(gpio_num) { \
  98. .gpio = gpio_num, \
  99. .settings ={[GPIOMUX_SUSPENDED] = &nc_cfg_can,}\
  100. }
  101. static struct gpiomux_setting nc_cfg_can = {
  102. .func = GPIOMUX_FUNC_1,
  103. .drv = GPIOMUX_DRV_2MA,
  104. .pull = GPIOMUX_PULL_DOWN,
  105. };
  106. #endif
  107. #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
  108. static struct gpiomux_setting gpio_eth_config = {
  109. .pull = GPIOMUX_PULL_UP,
  110. .drv = GPIOMUX_DRV_2MA,
  111. .func = GPIOMUX_FUNC_GPIO,
  112. };
  113. static struct msm_gpiomux_config msm_eth_configs[] = {
  114. {
  115. .gpio = KS8851_IRQ_GPIO,
  116. .settings = {
  117. [GPIOMUX_SUSPENDED] = &gpio_eth_config,
  118. }
  119. },
  120. };
  121. #endif
  122. #if defined (CONFIG_MACH_BERLUTI3G_EUR)
  123. static struct gpiomux_setting cypress_int_act_cfg = {
  124. .func = GPIOMUX_FUNC_GPIO,
  125. .drv = GPIOMUX_DRV_8MA,
  126. .pull = GPIOMUX_PULL_UP,
  127. };
  128. static struct gpiomux_setting cypress_int_sus_cfg = {
  129. .func = GPIOMUX_FUNC_GPIO,
  130. .drv = GPIOMUX_DRV_2MA,
  131. .pull = GPIOMUX_PULL_DOWN,
  132. };
  133. static struct gpiomux_setting gpio_i2c_tkey_active_config = {
  134. .func = GPIOMUX_FUNC_GPIO,
  135. .drv = GPIOMUX_DRV_2MA,
  136. .pull = GPIOMUX_PULL_NONE,
  137. };
  138. static struct gpiomux_setting gpio_i2c_tkey_suspend_config = {
  139. .func = GPIOMUX_FUNC_GPIO,
  140. .drv = GPIOMUX_DRV_2MA,
  141. .pull = GPIOMUX_PULL_DOWN,
  142. };
  143. #elif defined(CONFIG_SEC_MILLET_PROJECT)
  144. static struct gpiomux_setting melfas_int_act_cfg = {
  145. .func = GPIOMUX_FUNC_GPIO,
  146. .drv = GPIOMUX_DRV_8MA,
  147. .pull = GPIOMUX_PULL_NONE,
  148. };
  149. static struct gpiomux_setting melfas_int_sus_cfg = {
  150. .func = GPIOMUX_FUNC_GPIO,
  151. .drv = GPIOMUX_DRV_2MA,
  152. .pull = GPIOMUX_PULL_NONE,
  153. };
  154. #else
  155. static struct gpiomux_setting synaptics_int_act_cfg = {
  156. .func = GPIOMUX_FUNC_GPIO,
  157. .drv = GPIOMUX_DRV_8MA,
  158. .pull = GPIOMUX_PULL_UP,
  159. };
  160. static struct gpiomux_setting synaptics_int_sus_cfg = {
  161. .func = GPIOMUX_FUNC_GPIO,
  162. .drv = GPIOMUX_DRV_2MA,
  163. .pull = GPIOMUX_PULL_DOWN,
  164. };
  165. static struct gpiomux_setting synaptics_reset_act_cfg = {
  166. .func = GPIOMUX_FUNC_GPIO,
  167. .drv = GPIOMUX_DRV_6MA,
  168. .pull = GPIOMUX_PULL_DOWN,
  169. };
  170. static struct gpiomux_setting synaptics_reset_sus_cfg = {
  171. .func = GPIOMUX_FUNC_GPIO,
  172. .drv = GPIOMUX_DRV_2MA,
  173. .pull = GPIOMUX_PULL_DOWN,
  174. };
  175. #endif
  176. static struct gpiomux_setting gpio_keys_active = {
  177. .func = GPIOMUX_FUNC_GPIO,
  178. .drv = GPIOMUX_DRV_2MA,
  179. .pull = GPIOMUX_PULL_NONE,
  180. };
  181. static struct gpiomux_setting gpio_keys_suspend = {
  182. .func = GPIOMUX_FUNC_GPIO,
  183. .drv = GPIOMUX_DRV_2MA,
  184. .pull = GPIOMUX_PULL_NONE,
  185. };
  186. #if !defined (CONFIG_SEC_MILLET_PROJECT) && !defined(CONFIG_SEC_MATISSE_PROJECT)
  187. static struct gpiomux_setting gpio_spi_act_config = {
  188. .func = GPIOMUX_FUNC_1,
  189. .drv = GPIOMUX_DRV_8MA,
  190. .pull = GPIOMUX_PULL_NONE,
  191. };
  192. static struct gpiomux_setting gpio_spi_cs_act_config = {
  193. .func = GPIOMUX_FUNC_1,
  194. .drv = GPIOMUX_DRV_6MA,
  195. .pull = GPIOMUX_PULL_DOWN,
  196. };
  197. static struct gpiomux_setting gpio_spi_susp_config = {
  198. .func = GPIOMUX_FUNC_GPIO,
  199. .drv = GPIOMUX_DRV_2MA,
  200. .pull = GPIOMUX_PULL_DOWN,
  201. };
  202. #endif
  203. #ifndef CONFIG_SND_SOC_MAX98504
  204. #if !defined (CONFIG_MACH_BERLUTI3G_EUR)
  205. static struct gpiomux_setting gpio_spi_cs_eth_config = {
  206. .func = GPIOMUX_FUNC_4,
  207. .drv = GPIOMUX_DRV_6MA,
  208. .pull = GPIOMUX_PULL_DOWN,
  209. };
  210. #endif
  211. #endif
  212. static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
  213. .func = GPIOMUX_FUNC_GPIO,
  214. .drv = GPIOMUX_DRV_2MA,
  215. .pull = GPIOMUX_PULL_UP,
  216. };
  217. static struct gpiomux_setting wcnss_5wire_active_cfg = {
  218. .func = GPIOMUX_FUNC_1,
  219. .drv = GPIOMUX_DRV_6MA,
  220. .pull = GPIOMUX_PULL_DOWN,
  221. };
  222. #ifdef CONFIG_WCNSS_IRIS_REGISTER_DUMP
  223. static struct gpiomux_setting wcnss_5gpio_suspend_cfg = {
  224. .func = GPIOMUX_FUNC_GPIO,
  225. .drv = GPIOMUX_DRV_2MA,
  226. .pull = GPIOMUX_PULL_UP,
  227. };
  228. static struct gpiomux_setting wcnss_5gpio_active_cfg = {
  229. .func = GPIOMUX_FUNC_GPIO,
  230. .drv = GPIOMUX_DRV_6MA,
  231. .pull = GPIOMUX_PULL_DOWN,
  232. };
  233. #endif
  234. static struct gpiomux_setting gpio_i2c_config = {
  235. .func = GPIOMUX_FUNC_3,
  236. .drv = GPIOMUX_DRV_2MA,
  237. .pull = GPIOMUX_PULL_NONE,
  238. };
  239. #if defined (CONFIG_SEC_MILLET_PROJECT) || defined(CONFIG_SEC_MATISSE_PROJECT)
  240. static struct gpiomux_setting sensor_gpio_i2c_config = {
  241. .func = GPIOMUX_FUNC_3,
  242. .drv = GPIOMUX_DRV_2MA,
  243. .pull = GPIOMUX_PULL_NONE,
  244. .dir = GPIOMUX_IN,
  245. };
  246. static struct gpiomux_setting accel_irq_config = {
  247. .func = GPIOMUX_FUNC_GPIO,
  248. .drv = GPIOMUX_DRV_2MA,
  249. .pull = GPIOMUX_PULL_NONE,
  250. .dir = GPIOMUX_IN,
  251. };
  252. static struct gpiomux_setting irled_gpio_i2c_config = {
  253. .func = GPIOMUX_FUNC_GPIO,
  254. .drv = GPIOMUX_DRV_2MA,
  255. .pull = GPIOMUX_PULL_NONE,
  256. .dir = GPIOMUX_IN,
  257. };
  258. #if !defined(CONFIG_SEC_MILLET_PROJECT)
  259. static struct gpiomux_setting prox_irq_config = {
  260. .func = GPIOMUX_FUNC_GPIO,
  261. .drv = GPIOMUX_DRV_2MA,
  262. .pull = GPIOMUX_PULL_NONE,
  263. .dir = GPIOMUX_IN,
  264. };
  265. #endif
  266. static struct gpiomux_setting grip_irq_config = {
  267. .func = GPIOMUX_FUNC_GPIO,
  268. .drv = GPIOMUX_DRV_2MA,
  269. .pull = GPIOMUX_PULL_NONE,
  270. .dir = GPIOMUX_IN,
  271. };
  272. #endif
  273. #if defined (CONFIG_MACH_BERLUTI3G_EUR)
  274. static struct gpiomux_setting gpio_uart_active_config = {
  275. .func = GPIOMUX_FUNC_2,
  276. .drv = GPIOMUX_DRV_8MA,
  277. .pull = GPIOMUX_PULL_DOWN,
  278. };
  279. static struct gpiomux_setting gpio_uart_sleep_config = {
  280. .func = GPIOMUX_FUNC_2,
  281. .drv = GPIOMUX_DRV_8MA,
  282. .pull = GPIOMUX_PULL_NONE,
  283. };
  284. static struct gpiomux_setting gpio_uart_rx_sleep_config = {
  285. .func = GPIOMUX_FUNC_2,
  286. .drv = GPIOMUX_DRV_8MA,
  287. .pull = GPIOMUX_PULL_DOWN,
  288. };
  289. static struct gpiomux_setting gpio_i2c_tsp_active_config = {
  290. .func = GPIOMUX_FUNC_GPIO,
  291. .drv = GPIOMUX_DRV_2MA,
  292. .pull = GPIOMUX_PULL_NONE,
  293. };
  294. static struct gpiomux_setting gpio_i2c_tsp_suspend_config = {
  295. .func = GPIOMUX_FUNC_GPIO,
  296. .drv = GPIOMUX_DRV_2MA,
  297. .pull = GPIOMUX_PULL_NONE,
  298. };
  299. #endif
  300. static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
  301. {
  302. .gpio = 106,
  303. .settings = {
  304. [GPIOMUX_ACTIVE] = &gpio_keys_active,
  305. [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
  306. },
  307. },
  308. {
  309. .gpio = 107,
  310. .settings = {
  311. [GPIOMUX_ACTIVE] = &gpio_keys_active,
  312. [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
  313. },
  314. },
  315. {
  316. .gpio = 108,
  317. .settings = {
  318. [GPIOMUX_ACTIVE] = &gpio_keys_active,
  319. [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
  320. },
  321. },
  322. };
  323. static struct gpiomux_setting lcd_rst_act_cfg = {
  324. .func = GPIOMUX_FUNC_GPIO,
  325. .drv = GPIOMUX_DRV_2MA,
  326. .pull = GPIOMUX_PULL_NONE,
  327. .dir = GPIOMUX_OUT_HIGH,
  328. };
  329. static struct gpiomux_setting lcd_rst_sus_cfg = {
  330. .func = GPIOMUX_FUNC_GPIO,
  331. .drv = GPIOMUX_DRV_2MA,
  332. .pull = GPIOMUX_PULL_DOWN,
  333. .dir = GPIOMUX_OUT_LOW,
  334. };
  335. static struct gpiomux_setting lcd_in_gpio_cfg = {
  336. .func = GPIOMUX_FUNC_GPIO,
  337. .drv = GPIOMUX_DRV_2MA,
  338. .pull = GPIOMUX_PULL_NONE,
  339. .dir = GPIOMUX_IN,
  340. };
  341. static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
  342. {
  343. .gpio = 25, /* LCD Reset */
  344. .settings = {
  345. [GPIOMUX_ACTIVE] = &lcd_rst_act_cfg,
  346. [GPIOMUX_SUSPENDED] = &lcd_rst_sus_cfg,
  347. },
  348. },
  349. {
  350. .gpio = 53, /* LCD LDI INT */
  351. .settings = {
  352. [GPIOMUX_ACTIVE] = &lcd_in_gpio_cfg,
  353. [GPIOMUX_SUSPENDED] = &lcd_in_gpio_cfg,
  354. },
  355. },
  356. {
  357. .gpio = 20, /* Backlight SDA */
  358. .settings = {
  359. [GPIOMUX_ACTIVE] = &lcd_in_gpio_cfg,
  360. [GPIOMUX_SUSPENDED] = &lcd_in_gpio_cfg,
  361. },
  362. },
  363. {
  364. .gpio = 21, /* Backlight SCL */
  365. .settings = {
  366. [GPIOMUX_ACTIVE] = &lcd_in_gpio_cfg,
  367. [GPIOMUX_SUSPENDED] = &lcd_in_gpio_cfg,
  368. },
  369. },
  370. #if defined(CONFIG_SEC_MILLETLTE_COMMON)
  371. {
  372. .gpio =56, /* Backlight Reset */
  373. .settings = {
  374. [GPIOMUX_ACTIVE] = &lcd_rst_act_cfg,
  375. [GPIOMUX_SUSPENDED] = &lcd_rst_sus_cfg,
  376. },
  377. },
  378. #else
  379. {
  380. .gpio = 74, /* Backlight Reset */
  381. .settings = {
  382. [GPIOMUX_ACTIVE] = &lcd_rst_act_cfg,
  383. [GPIOMUX_SUSPENDED] = &lcd_rst_sus_cfg,
  384. },
  385. },
  386. #endif
  387. };
  388. static struct gpiomux_setting gpio_uart_config = {
  389. .func = GPIOMUX_FUNC_2,
  390. .drv = GPIOMUX_DRV_8MA,
  391. .pull = GPIOMUX_PULL_NONE, /*should be pulled None for UART */
  392. .dir = GPIOMUX_OUT_HIGH,
  393. };
  394. static struct gpiomux_setting rx_gpio_uart_config = {
  395. .func = GPIOMUX_FUNC_2,
  396. .drv = GPIOMUX_DRV_8MA,
  397. .pull = GPIOMUX_PULL_DOWN, /*LCIA Test failure*/
  398. .dir = GPIOMUX_OUT_HIGH,
  399. };
  400. static struct gpiomux_setting hw_chk_bit_gpio_cfg = {
  401. .func = GPIOMUX_FUNC_GPIO,
  402. .drv = GPIOMUX_DRV_2MA,
  403. .pull = GPIOMUX_PULL_NONE,
  404. .dir = GPIOMUX_IN,
  405. };
  406. static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
  407. {
  408. .gpio = 8, /* UART TX */
  409. .settings = {
  410. [GPIOMUX_SUSPENDED] = &gpio_uart_config,
  411. },
  412. },
  413. {
  414. .gpio = 9, /* UART RX */
  415. .settings = {
  416. [GPIOMUX_SUSPENDED] = &rx_gpio_uart_config,
  417. },
  418. },
  419. {
  420. .gpio = 32, /* HW_CHK_BIT 1 */
  421. .settings = {
  422. [GPIOMUX_ACTIVE] = &hw_chk_bit_gpio_cfg,
  423. [GPIOMUX_SUSPENDED] = &hw_chk_bit_gpio_cfg,
  424. },
  425. },
  426. {
  427. .gpio = 63, /* HW_CHK_BIT 0 */
  428. .settings = {
  429. [GPIOMUX_ACTIVE] = &hw_chk_bit_gpio_cfg,
  430. [GPIOMUX_SUSPENDED] = &hw_chk_bit_gpio_cfg,
  431. },
  432. },
  433. #if !defined (CONFIG_SEC_MILLET_PROJECT) && !defined(CONFIG_SEC_MATISSE_PROJECT)
  434. {
  435. .gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */
  436. .settings = {
  437. [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
  438. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  439. },
  440. },
  441. {
  442. .gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */
  443. .settings = {
  444. [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
  445. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  446. },
  447. },
  448. {
  449. .gpio = 2, /* BLSP1 QUP1 SPI_CS1 */
  450. .settings = {
  451. [GPIOMUX_ACTIVE] = &gpio_spi_cs_act_config,
  452. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  453. },
  454. },
  455. {
  456. .gpio = 3, /* BLSP1 QUP1 SPI_CLK */
  457. .settings = {
  458. [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
  459. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  460. },
  461. },
  462. #endif
  463. #if !defined(CONFIG_SEC_MILLET_PROJECT) || !defined(CONFIG_SEC_MATISSE_PROJECT)
  464. {
  465. .gpio = 14, /* BLSP1 QUP4 I2C_SDA */
  466. .settings = {
  467. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  468. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  469. },
  470. },
  471. {
  472. .gpio = 15, /* BLSP1 QUP4 I2C_SCL */
  473. .settings = {
  474. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  475. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  476. },
  477. },
  478. #endif
  479. #ifdef CONFIG_MACH_BERLUTI3G_EUR
  480. {
  481. .gpio = 8, /* BLSP1 UART2 TX */
  482. .settings = {
  483. [GPIOMUX_ACTIVE] = &gpio_uart_active_config,
  484. [GPIOMUX_SUSPENDED] = &gpio_uart_sleep_config,
  485. },
  486. },
  487. {
  488. .gpio = 9, /* BLSP1 UART2 RX */
  489. .settings = {
  490. [GPIOMUX_ACTIVE] = &gpio_uart_active_config,
  491. [GPIOMUX_SUSPENDED] = &gpio_uart_rx_sleep_config,
  492. },
  493. },
  494. {
  495. .gpio = 18, /* BLSP1 QUP5 I2C_SDA */
  496. .settings = {
  497. [GPIOMUX_ACTIVE] = &gpio_i2c_tsp_active_config,
  498. [GPIOMUX_SUSPENDED] = &gpio_i2c_tsp_suspend_config,
  499. },
  500. },
  501. {
  502. .gpio = 19, /* BLSP1 QUP5 I2C_SCL */
  503. .settings = {
  504. [GPIOMUX_ACTIVE] = &gpio_i2c_tsp_active_config,
  505. [GPIOMUX_SUSPENDED] = &gpio_i2c_tsp_suspend_config,
  506. },
  507. },
  508. #else
  509. {
  510. .gpio = 18, /* BLSP1 QUP5 I2C_SDA */
  511. .settings = {
  512. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  513. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  514. },
  515. },
  516. {
  517. .gpio = 19, /* BLSP1 QUP5 I2C_SCL */
  518. .settings = {
  519. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  520. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  521. },
  522. },
  523. #endif
  524. #ifndef CONFIG_SND_SOC_MAX98504
  525. #if !defined (CONFIG_MACH_BERLUTI3G_EUR)
  526. {
  527. .gpio = 22, /* BLSP1 QUP1 SPI_CS_ETH */
  528. .settings = {
  529. [GPIOMUX_SUSPENDED] = &gpio_spi_cs_eth_config,
  530. },
  531. },
  532. #endif
  533. #endif
  534. #if defined (CONFIG_SEC_MILLET_PROJECT) || defined(CONFIG_SEC_MATISSE_PROJECT)
  535. {
  536. .gpio = 6, /* BLSP1 QUP2 I2C_SDA */
  537. .settings = {
  538. [GPIOMUX_ACTIVE] = &sensor_gpio_i2c_config,
  539. [GPIOMUX_SUSPENDED] = &sensor_gpio_i2c_config,
  540. },
  541. },
  542. {
  543. .gpio = 7, /* BLSP1 QUP2 I2C_SCL */
  544. .settings = {
  545. [GPIOMUX_ACTIVE] = &sensor_gpio_i2c_config,
  546. [GPIOMUX_SUSPENDED] = &sensor_gpio_i2c_config,
  547. },
  548. },
  549. #endif
  550. };
  551. #if defined (CONFIG_SEC_MILLET_PROJECT)
  552. static struct gpiomux_setting prox_irq_config = {
  553. .func = GPIOMUX_FUNC_GPIO,
  554. .drv = GPIOMUX_DRV_2MA,
  555. .pull = GPIOMUX_PULL_NONE,
  556. .dir = GPIOMUX_IN,
  557. };
  558. static struct msm_gpiomux_config light_prox_config[] __initdata = {
  559. {
  560. .gpio = 65, /* PROXY IRQ */
  561. .settings = {
  562. [GPIOMUX_ACTIVE] = &prox_irq_config,
  563. [GPIOMUX_SUSPENDED] = &prox_irq_config,
  564. },
  565. },
  566. {
  567. .gpio = 2, /* BLSP1 QUP2 I2C_SDA */
  568. .settings = {
  569. [GPIOMUX_ACTIVE] = &sensor_gpio_i2c_config,
  570. [GPIOMUX_SUSPENDED] = &sensor_gpio_i2c_config,
  571. },
  572. },
  573. {
  574. .gpio = 3, /* BLSP1 QUP2 I2C_SDA */
  575. .settings = {
  576. [GPIOMUX_ACTIVE] = &sensor_gpio_i2c_config,
  577. [GPIOMUX_SUSPENDED] = &sensor_gpio_i2c_config,
  578. },
  579. },
  580. };
  581. static struct msm_gpiomux_config nc_light_prox_config[] __initdata = {
  582. {
  583. .gpio = 2, /* BLSP1 QUP2 I2C_SDA */
  584. .settings = {
  585. [GPIOMUX_ACTIVE] = &nc_suspend_cfg,
  586. [GPIOMUX_SUSPENDED] = &nc_suspend_cfg,
  587. },
  588. },
  589. {
  590. .gpio = 3, /* BLSP1 QUP2 I2C_SDA */
  591. .settings = {
  592. [GPIOMUX_ACTIVE] = &nc_suspend_cfg,
  593. [GPIOMUX_SUSPENDED] = &nc_suspend_cfg,
  594. },
  595. },
  596. };
  597. static struct msm_gpiomux_config irled_i2c_scl_config[] __initdata = {
  598. {
  599. .gpio = 4,
  600. .settings = {
  601. [GPIOMUX_ACTIVE] = &irled_gpio_i2c_config,
  602. [GPIOMUX_SUSPENDED] = &irled_gpio_i2c_config,
  603. },
  604. },
  605. {
  606. .gpio = 5,
  607. .settings = {
  608. [GPIOMUX_ACTIVE] = &irled_gpio_i2c_config,
  609. [GPIOMUX_SUSPENDED] = &irled_gpio_i2c_config,
  610. },
  611. },
  612. };
  613. #endif
  614. #if defined (CONFIG_MACH_BERLUTI3G_EUR)
  615. static struct msm_gpiomux_config msm_cypress_configs[] __initdata = {
  616. {
  617. .gpio = 17,
  618. .settings = {
  619. [GPIOMUX_ACTIVE] = &cypress_int_act_cfg,
  620. [GPIOMUX_SUSPENDED] = &cypress_int_sus_cfg,
  621. },
  622. },
  623. };
  624. static struct msm_gpiomux_config msm_keyboad_cypress_configs[] __initdata = {
  625. {
  626. .gpio = 49, /* 2_TOUCH_INT */
  627. .settings = {
  628. [GPIOMUX_ACTIVE] = &gpio_i2c_tkey_active_config,
  629. [GPIOMUX_SUSPENDED] = &gpio_i2c_tkey_suspend_config,
  630. },
  631. },
  632. {
  633. .gpio = 23, /* 2_TOUCH_I2C_SCL */
  634. .settings = {
  635. [GPIOMUX_ACTIVE] = &gpio_i2c_tkey_active_config,
  636. [GPIOMUX_SUSPENDED] = &gpio_i2c_tkey_suspend_config,
  637. },
  638. },
  639. {
  640. .gpio = 22, /* 2_TOUCH_I2C_SDA */
  641. .settings = {
  642. [GPIOMUX_ACTIVE] = &gpio_i2c_tkey_active_config,
  643. [GPIOMUX_SUSPENDED] = &gpio_i2c_tkey_suspend_config,
  644. },
  645. },
  646. };
  647. #elif defined(CONFIG_SEC_MILLET_PROJECT)
  648. static struct msm_gpiomux_config msm_melfas_configs[] __initdata = {
  649. {
  650. .gpio = 17,
  651. .settings = {
  652. [GPIOMUX_ACTIVE] = &melfas_int_act_cfg,
  653. [GPIOMUX_SUSPENDED] = &melfas_int_sus_cfg,
  654. },
  655. },
  656. };
  657. #else
  658. static struct msm_gpiomux_config msm_synaptics_configs[] __initdata = {
  659. {
  660. .gpio = 16,
  661. .settings = {
  662. [GPIOMUX_ACTIVE] = &synaptics_reset_act_cfg,
  663. [GPIOMUX_SUSPENDED] = &synaptics_reset_sus_cfg,
  664. },
  665. },
  666. {
  667. .gpio = 17,
  668. .settings = {
  669. [GPIOMUX_ACTIVE] = &synaptics_int_act_cfg,
  670. [GPIOMUX_SUSPENDED] = &synaptics_int_sus_cfg,
  671. },
  672. },
  673. };
  674. #endif
  675. static struct gpiomux_setting gpio_nc_cfg = {
  676. .func = GPIOMUX_FUNC_GPIO,
  677. .drv = GPIOMUX_DRV_2MA,
  678. .pull = GPIOMUX_PULL_NONE,
  679. };
  680. static struct gpiomux_setting goodix_ldo_en_act_cfg = {
  681. .func = GPIOMUX_FUNC_GPIO,
  682. .drv = GPIOMUX_DRV_6MA,
  683. .pull = GPIOMUX_PULL_UP,
  684. };
  685. static struct gpiomux_setting goodix_ldo_en_sus_cfg = {
  686. .func = GPIOMUX_FUNC_GPIO,
  687. .drv = GPIOMUX_DRV_2MA,
  688. .pull = GPIOMUX_PULL_DOWN,
  689. };
  690. static struct gpiomux_setting goodix_int_act_cfg = {
  691. .func = GPIOMUX_FUNC_GPIO,
  692. .drv = GPIOMUX_DRV_6MA,
  693. .pull = GPIOMUX_PULL_UP,
  694. };
  695. static struct gpiomux_setting goodix_int_sus_cfg = {
  696. .func = GPIOMUX_FUNC_GPIO,
  697. .drv = GPIOMUX_DRV_2MA,
  698. .pull = GPIOMUX_PULL_DOWN,
  699. };
  700. static struct gpiomux_setting goodix_reset_act_cfg = {
  701. .func = GPIOMUX_FUNC_GPIO,
  702. .drv = GPIOMUX_DRV_6MA,
  703. .pull = GPIOMUX_PULL_UP,
  704. };
  705. static struct gpiomux_setting goodix_reset_sus_cfg = {
  706. .func = GPIOMUX_FUNC_GPIO,
  707. .drv = GPIOMUX_DRV_2MA,
  708. .pull = GPIOMUX_PULL_DOWN,
  709. };
  710. static struct msm_gpiomux_config msm_skuf_blsp_configs[] __initdata = {
  711. {
  712. .gpio = 2, /* NC */
  713. .settings = {
  714. [GPIOMUX_SUSPENDED] = &gpio_nc_cfg,
  715. },
  716. },
  717. {
  718. .gpio = 3, /* NC */
  719. .settings = {
  720. [GPIOMUX_SUSPENDED] = &gpio_nc_cfg,
  721. },
  722. },
  723. {
  724. .gpio = 4, /* NC */
  725. .settings = {
  726. [GPIOMUX_SUSPENDED] = &gpio_nc_cfg,
  727. },
  728. },
  729. {
  730. .gpio = 14, /* NC */
  731. .settings = {
  732. [GPIOMUX_SUSPENDED] = &gpio_nc_cfg,
  733. },
  734. },
  735. };
  736. static struct msm_gpiomux_config msm_skuf_goodix_configs[] __initdata = {
  737. {
  738. .gpio = 15, /* LDO EN */
  739. .settings = {
  740. [GPIOMUX_ACTIVE] = &goodix_ldo_en_act_cfg,
  741. [GPIOMUX_SUSPENDED] = &goodix_ldo_en_sus_cfg,
  742. },
  743. },
  744. {
  745. .gpio = 16, /* RESET */
  746. .settings = {
  747. [GPIOMUX_ACTIVE] = &goodix_reset_act_cfg,
  748. [GPIOMUX_SUSPENDED] = &goodix_reset_sus_cfg,
  749. },
  750. },
  751. {
  752. .gpio = 17, /* INT */
  753. .settings = {
  754. [GPIOMUX_ACTIVE] = &goodix_int_act_cfg,
  755. [GPIOMUX_SUSPENDED] = &goodix_int_sus_cfg,
  756. },
  757. },
  758. {
  759. .gpio = 18, /* BLSP1 QUP5 I2C_SDA */
  760. .settings = {
  761. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  762. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  763. },
  764. },
  765. {
  766. .gpio = 19, /* BLSP1 QUP5 I2C_SCL */
  767. .settings = {
  768. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  769. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  770. },
  771. },
  772. };
  773. #if !defined (CONFIG_SEC_MILLET_PROJECT) && !defined(CONFIG_SEC_MATISSE_PROJECT)
  774. static struct gpiomux_setting nfc_ldo_act_cfg = {
  775. .func = GPIOMUX_FUNC_GPIO,
  776. .drv = GPIOMUX_DRV_6MA,
  777. .pull = GPIOMUX_PULL_UP,
  778. };
  779. static struct gpiomux_setting nfc_ldo_sus_cfg = {
  780. .func = GPIOMUX_FUNC_GPIO,
  781. .drv = GPIOMUX_DRV_6MA,
  782. .pull = GPIOMUX_PULL_UP,
  783. };
  784. static struct gpiomux_setting nfc_regc_act_cfg = {
  785. .func = GPIOMUX_FUNC_GPIO,
  786. .drv = GPIOMUX_DRV_6MA,
  787. .pull = GPIOMUX_PULL_UP,
  788. };
  789. static struct gpiomux_setting nfc_regc_sus_cfg = {
  790. .func = GPIOMUX_FUNC_GPIO,
  791. .drv = GPIOMUX_DRV_2MA,
  792. .pull = GPIOMUX_PULL_NONE,
  793. .dir = GPIOMUX_OUT_LOW,
  794. };
  795. #endif
  796. static struct gpiomux_setting nfc_wake_act_cfg = {
  797. .func = GPIOMUX_FUNC_GPIO,
  798. .drv = GPIOMUX_DRV_6MA,
  799. .pull = GPIOMUX_PULL_UP,
  800. };
  801. static struct gpiomux_setting nfc_wake_sus_cfg = {
  802. .func = GPIOMUX_FUNC_GPIO,
  803. .drv = GPIOMUX_DRV_2MA,
  804. .pull = GPIOMUX_PULL_NONE,
  805. .dir = GPIOMUX_OUT_LOW,
  806. };
  807. static struct msm_gpiomux_config msm_skuf_nfc_configs[] __initdata = {
  808. #if !defined (CONFIG_SEC_MILLET_PROJECT) && !defined(CONFIG_SEC_MATISSE_PROJECT)
  809. { /* NFC LDO EN */
  810. .gpio = 0,
  811. .settings = {
  812. [GPIOMUX_ACTIVE] = &nfc_ldo_act_cfg,
  813. [GPIOMUX_SUSPENDED] = &nfc_ldo_sus_cfg,
  814. },
  815. },
  816. { /* NFC REGC*/
  817. .gpio = 1,
  818. .settings = {
  819. [GPIOMUX_ACTIVE] = &nfc_regc_act_cfg,
  820. [GPIOMUX_SUSPENDED] = &nfc_regc_sus_cfg,
  821. },
  822. },
  823. #endif
  824. { /* NFC WAKE */
  825. .gpio = 5,
  826. .settings = {
  827. [GPIOMUX_ACTIVE] = &nfc_wake_act_cfg,
  828. [GPIOMUX_SUSPENDED] = &nfc_wake_sus_cfg,
  829. },
  830. },
  831. };
  832. static struct gpiomux_setting sd_card_det_active_config = {
  833. .func = GPIOMUX_FUNC_GPIO,
  834. .drv = GPIOMUX_DRV_2MA,
  835. .pull = GPIOMUX_PULL_NONE,
  836. .dir = GPIOMUX_IN,
  837. };
  838. static struct gpiomux_setting sd_card_det_sleep_config = {
  839. .func = GPIOMUX_FUNC_GPIO,
  840. .drv = GPIOMUX_DRV_2MA,
  841. .pull = GPIOMUX_PULL_NONE,
  842. .dir = GPIOMUX_IN,
  843. };
  844. static struct msm_gpiomux_config sd_card_det __initdata = {
  845. .gpio = 38,
  846. .settings = {
  847. [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
  848. [GPIOMUX_SUSPENDED] = &sd_card_det_sleep_config,
  849. },
  850. };
  851. #if defined (CONFIG_SEC_MILLET_PROJECT) || defined(CONFIG_SEC_MATISSE_PROJECT)
  852. static struct msm_gpiomux_config msm_nativesensors_configs[] __initdata = {
  853. {
  854. .gpio = 66, /* GRIP IRQ */
  855. .settings = {
  856. [GPIOMUX_ACTIVE] = &grip_irq_config,
  857. [GPIOMUX_SUSPENDED] = &grip_irq_config,
  858. },
  859. },
  860. {
  861. .gpio = 54, /* ACCEL IRQ */
  862. .settings = {
  863. [GPIOMUX_ACTIVE] = &accel_irq_config,
  864. [GPIOMUX_SUSPENDED] = &accel_irq_config,
  865. },
  866. },
  867. };
  868. #endif
  869. static struct msm_gpiomux_config wcnss_5wire_interface[] = {
  870. {
  871. .gpio = 40,
  872. .settings = {
  873. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  874. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  875. },
  876. },
  877. {
  878. .gpio = 41,
  879. .settings = {
  880. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  881. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  882. },
  883. },
  884. {
  885. .gpio = 42,
  886. .settings = {
  887. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  888. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  889. },
  890. },
  891. {
  892. .gpio = 43,
  893. .settings = {
  894. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  895. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  896. },
  897. },
  898. {
  899. .gpio = 44,
  900. .settings = {
  901. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  902. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  903. },
  904. },
  905. };
  906. #ifdef CONFIG_WCNSS_IRIS_REGISTER_DUMP
  907. static struct msm_gpiomux_config wcnss_5gpio_interface[] = {
  908. {
  909. .gpio = 40,
  910. .settings = {
  911. [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
  912. [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
  913. },
  914. },
  915. {
  916. .gpio = 41,
  917. .settings = {
  918. [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
  919. [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
  920. },
  921. },
  922. {
  923. .gpio = 42,
  924. .settings = {
  925. [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
  926. [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
  927. },
  928. },
  929. {
  930. .gpio = 43,
  931. .settings = {
  932. [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
  933. [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
  934. },
  935. },
  936. {
  937. .gpio = 44,
  938. .settings = {
  939. [GPIOMUX_ACTIVE] = &wcnss_5gpio_active_cfg,
  940. [GPIOMUX_SUSPENDED] = &wcnss_5gpio_suspend_cfg,
  941. },
  942. },
  943. };
  944. #endif
  945. static struct gpiomux_setting gpio_suspend_config[] = {
  946. {
  947. .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
  948. .drv = GPIOMUX_DRV_2MA,
  949. .pull = GPIOMUX_PULL_NONE,
  950. },
  951. {
  952. .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
  953. .drv = GPIOMUX_DRV_2MA,
  954. .pull = GPIOMUX_PULL_NONE,
  955. .dir = GPIOMUX_OUT_LOW,
  956. },
  957. };
  958. static struct gpiomux_setting cam_settings[] = {
  959. {
  960. .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
  961. .drv = GPIOMUX_DRV_2MA,
  962. .pull = GPIOMUX_PULL_NONE,
  963. },
  964. {
  965. .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
  966. .drv = GPIOMUX_DRV_2MA,
  967. .pull = GPIOMUX_PULL_DOWN,
  968. },
  969. {
  970. .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
  971. .drv = GPIOMUX_DRV_2MA,
  972. .pull = GPIOMUX_PULL_KEEPER,
  973. },
  974. {
  975. .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
  976. .drv = GPIOMUX_DRV_2MA,
  977. .pull = GPIOMUX_PULL_NONE,
  978. },
  979. {
  980. .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
  981. .drv = GPIOMUX_DRV_2MA,
  982. .pull = GPIOMUX_PULL_DOWN,
  983. },
  984. {
  985. .func = GPIOMUX_FUNC_GPIO, /*active 1*/ /* 5 */
  986. .drv = GPIOMUX_DRV_2MA,
  987. .pull = GPIOMUX_PULL_NONE,
  988. .dir = GPIOMUX_OUT_LOW,
  989. },
  990. };
  991. static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
  992. #if defined (CONFIG_SEC_MILLET_PROJECT)
  993. {
  994. .gpio = 16, /* VTCAM_1.8V */
  995. .settings = {
  996. [GPIOMUX_ACTIVE] = &cam_settings[5],
  997. [GPIOMUX_SUSPENDED] = &cam_settings[5],
  998. },
  999. },
  1000. {
  1001. .gpio = 26, /* CAM_MCLK0 */
  1002. .settings = {
  1003. [GPIOMUX_ACTIVE] = &cam_settings[0],
  1004. [GPIOMUX_SUSPENDED] = &cam_settings[1],
  1005. },
  1006. },
  1007. {
  1008. .gpio = 28, /* CAM2_RST_N */
  1009. .settings = {
  1010. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1011. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1012. },
  1013. },
  1014. {
  1015. .gpio = 29, /* CCI_I2C_SDA0 */
  1016. .settings = {
  1017. [GPIOMUX_ACTIVE] = &cam_settings[0],
  1018. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  1019. },
  1020. },
  1021. {
  1022. .gpio = 30, /* CCI_I2C_SCL0 */
  1023. .settings = {
  1024. [GPIOMUX_ACTIVE] = &cam_settings[0],
  1025. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  1026. },
  1027. },
  1028. {
  1029. .gpio = 35, /* CAM2_STANDBY_N */
  1030. .settings = {
  1031. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1032. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1033. },
  1034. },
  1035. {
  1036. .gpio = 36, /* CAM1_STANDBY_N */
  1037. .settings = {
  1038. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1039. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1040. },
  1041. },
  1042. {
  1043. .gpio = 110, /* CAM1_RST_N */
  1044. .settings = {
  1045. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1046. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1047. },
  1048. },
  1049. {
  1050. .gpio = 112, /* CAM1_ANALOG_EN */
  1051. .settings = {
  1052. [GPIOMUX_ACTIVE] = &cam_settings[5],
  1053. [GPIOMUX_SUSPENDED] = &cam_settings[5],
  1054. },
  1055. },
  1056. #else
  1057. {
  1058. .gpio = 26, /* CAM_MCLK0 */
  1059. .settings = {
  1060. [GPIOMUX_ACTIVE] = &cam_settings[0],
  1061. [GPIOMUX_SUSPENDED] = &cam_settings[1],
  1062. },
  1063. },
  1064. #if !defined(CONFIG_SEC_MILLET_PROJECT)
  1065. {
  1066. .gpio = 27, /* CAM_MCLK1 */
  1067. .settings = {
  1068. [GPIOMUX_ACTIVE] = &cam_settings[0],
  1069. [GPIOMUX_SUSPENDED] = &cam_settings[1],
  1070. },
  1071. },
  1072. #endif
  1073. {
  1074. .gpio = 29, /* CCI_I2C_SDA0 */
  1075. .settings = {
  1076. [GPIOMUX_ACTIVE] = &cam_settings[0],
  1077. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  1078. },
  1079. },
  1080. {
  1081. .gpio = 30, /* CCI_I2C_SCL0 */
  1082. .settings = {
  1083. [GPIOMUX_ACTIVE] = &cam_settings[0],
  1084. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  1085. },
  1086. },
  1087. {
  1088. .gpio = 36, /* CAM1_STANDBY_N */
  1089. .settings = {
  1090. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1091. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1092. },
  1093. },
  1094. {
  1095. .gpio = 37, /* CAM1_RST_N */
  1096. .settings = {
  1097. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1098. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1099. },
  1100. },
  1101. {
  1102. .gpio = 35, /* CAM2_STANDBY_N */
  1103. .settings = {
  1104. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1105. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1106. },
  1107. },
  1108. {
  1109. .gpio = 28, /* CAM2_RST_N */
  1110. .settings = {
  1111. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1112. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1113. },
  1114. },
  1115. #endif
  1116. };
  1117. static struct msm_gpiomux_config msm_sensor_configs_skuf_plus[] __initdata = {
  1118. {
  1119. .gpio = 22, /* CAM1_VDD */
  1120. .settings = {
  1121. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1122. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1123. },
  1124. },
  1125. {
  1126. .gpio = 34, /* CAM1 VCM_PWDN */
  1127. .settings = {
  1128. [GPIOMUX_ACTIVE] = &cam_settings[3],
  1129. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  1130. },
  1131. },
  1132. };
  1133. #if !defined (CONFIG_SEC_MILLET_PROJECT)
  1134. static struct gpiomux_setting auxpcm_act_cfg = {
  1135. .func = GPIOMUX_FUNC_1,
  1136. .drv = GPIOMUX_DRV_8MA,
  1137. .pull = GPIOMUX_PULL_NONE,
  1138. };
  1139. static struct gpiomux_setting auxpcm_sus_cfg = {
  1140. .func = GPIOMUX_FUNC_1,
  1141. .drv = GPIOMUX_DRV_2MA,
  1142. .pull = GPIOMUX_PULL_DOWN,
  1143. };
  1144. static struct msm_gpiomux_config msm_auxpcm_configs[] __initdata = {
  1145. {
  1146. .gpio = 63,
  1147. .settings = {
  1148. [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
  1149. [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
  1150. },
  1151. },
  1152. {
  1153. .gpio = 64,
  1154. .settings = {
  1155. [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
  1156. [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
  1157. },
  1158. },
  1159. {
  1160. .gpio = 65,
  1161. .settings = {
  1162. [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
  1163. [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
  1164. },
  1165. },
  1166. {
  1167. .gpio = 66,
  1168. .settings = {
  1169. [GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
  1170. [GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
  1171. },
  1172. },
  1173. };
  1174. #endif
  1175. #if defined (CONFIG_SAMSUNG_JACK)
  1176. static struct gpiomux_setting earjack_gpio_active_cfg = {
  1177. .func = GPIOMUX_FUNC_GPIO, /*active 1*/ /* 0 */
  1178. .drv = GPIOMUX_DRV_2MA,
  1179. #if defined(CONFIG_SEC_MILLET_PROJECT) || defined(CONFIG_MACH_CRATERQ) || defined(CONFIG_SEC_MATISSE_PROJECT)
  1180. .pull = GPIOMUX_PULL_NONE,
  1181. #else
  1182. .pull = GPIOMUX_PULL_DOWN,
  1183. #endif
  1184. .dir = GPIOMUX_IN,
  1185. };
  1186. static struct gpiomux_setting earjack_gpio_suspend_cfg = {
  1187. .func = GPIOMUX_FUNC_GPIO, /*suspend*/ /* 1 */
  1188. .drv = GPIOMUX_DRV_2MA,
  1189. #if defined(CONFIG_SEC_MILLET_PROJECT) || defined(CONFIG_MACH_CRATERQ) || defined(CONFIG_SEC_MATISSE_PROJECT)
  1190. .pull = GPIOMUX_PULL_NONE,
  1191. #else
  1192. .pull = GPIOMUX_PULL_DOWN,
  1193. #endif
  1194. .dir = GPIOMUX_IN,
  1195. };
  1196. static struct msm_gpiomux_config msm_earjack_gpio_configs[] __initdata = {
  1197. {
  1198. #if defined(CONFIG_SEC_MILLET_PROJECT) || defined(CONFIG_SEC_MATISSE_PROJECT)
  1199. .gpio = 111, /* EAR_SEND_END */
  1200. #else
  1201. .gpio = 35, /* EAR_SWITCH */
  1202. #endif
  1203. .settings = {
  1204. [GPIOMUX_ACTIVE] = &earjack_gpio_active_cfg,
  1205. [GPIOMUX_SUSPENDED] = &earjack_gpio_suspend_cfg,
  1206. },
  1207. },
  1208. {
  1209. .gpio = 69,
  1210. .settings = {
  1211. [GPIOMUX_ACTIVE] = &earjack_gpio_active_cfg,
  1212. [GPIOMUX_SUSPENDED] = &earjack_gpio_suspend_cfg,
  1213. },
  1214. },
  1215. };
  1216. #endif
  1217. #ifdef CONFIG_SND_SOC_MAX98504
  1218. static struct gpiomux_setting gpio_i2c_codec_active_config = {
  1219. .func = GPIOMUX_FUNC_3,
  1220. .drv = GPIOMUX_DRV_2MA,
  1221. .dir = GPIOMUX_IN,
  1222. .pull = GPIOMUX_PULL_NONE,
  1223. };
  1224. static struct gpiomux_setting gpio_i2c_codec_suspend_config = {
  1225. .func = GPIOMUX_FUNC_3,
  1226. .drv = GPIOMUX_DRV_2MA,
  1227. .dir = GPIOMUX_IN,
  1228. .pull = GPIOMUX_PULL_NONE,
  1229. };
  1230. static struct gpiomux_setting pri_mi2s_act_cfg = {
  1231. .func = GPIOMUX_FUNC_1,
  1232. .drv = GPIOMUX_DRV_8MA,
  1233. .pull = GPIOMUX_PULL_NONE,
  1234. };
  1235. static struct gpiomux_setting pri_mi2s_sus_cfg = {
  1236. .func = GPIOMUX_FUNC_GPIO,
  1237. .drv = GPIOMUX_DRV_2MA,
  1238. .pull = GPIOMUX_PULL_DOWN,
  1239. };
  1240. static struct msm_gpiomux_config msm8226_blsp_codec_configs[] __initdata = {
  1241. { /* MAX_SDA */
  1242. .gpio = 22, /* BLSP1 QUP3 I2C_DAT */
  1243. .settings = {
  1244. [GPIOMUX_ACTIVE] = &gpio_i2c_codec_active_config,
  1245. [GPIOMUX_SUSPENDED] = &gpio_i2c_codec_suspend_config,
  1246. },
  1247. },
  1248. { /* MAX_SCL */
  1249. .gpio = 23, /* BLSP1 QUP3 I2C_CLK */
  1250. .settings = {
  1251. [GPIOMUX_ACTIVE] = &gpio_i2c_codec_active_config,
  1252. [GPIOMUX_SUSPENDED] = &gpio_i2c_codec_suspend_config,
  1253. },
  1254. },
  1255. };
  1256. static struct gpiomux_setting gpio_amp_int_config = {
  1257. .func = GPIOMUX_FUNC_GPIO,
  1258. .drv = GPIOMUX_DRV_2MA,
  1259. .dir = GPIOMUX_IN,
  1260. .pull = GPIOMUX_PULL_NONE,
  1261. };
  1262. static struct msm_gpiomux_config msm8226_amp_int_configs[] __initdata = {
  1263. {
  1264. .gpio = 24, /* AMP_INT_N */
  1265. .settings = {
  1266. [GPIOMUX_ACTIVE] = &gpio_amp_int_config,
  1267. [GPIOMUX_SUSPENDED] = &gpio_amp_int_config,
  1268. },
  1269. },
  1270. };
  1271. static struct msm_gpiomux_config msm8226_tertiary_mi2s_configs[] __initdata = {
  1272. {
  1273. .gpio = 49, /* qua mi2s sck */
  1274. .settings = {
  1275. [GPIOMUX_SUSPENDED] = &pri_mi2s_sus_cfg,
  1276. [GPIOMUX_ACTIVE] = &pri_mi2s_act_cfg,
  1277. },
  1278. },
  1279. {
  1280. .gpio = 50,
  1281. .settings = {
  1282. [GPIOMUX_SUSPENDED] = &pri_mi2s_sus_cfg,
  1283. [GPIOMUX_ACTIVE] = &pri_mi2s_act_cfg,
  1284. },
  1285. },
  1286. {
  1287. .gpio = 51,
  1288. .settings = {
  1289. [GPIOMUX_SUSPENDED] = &pri_mi2s_sus_cfg,
  1290. [GPIOMUX_ACTIVE] = &pri_mi2s_act_cfg,
  1291. },
  1292. },
  1293. {
  1294. .gpio = 52,
  1295. .settings = {
  1296. [GPIOMUX_SUSPENDED] = &pri_mi2s_sus_cfg,
  1297. [GPIOMUX_ACTIVE] = &pri_mi2s_act_cfg,
  1298. },
  1299. },
  1300. };
  1301. #endif /* CONFIG_SND_SOC_MAX98504 */
  1302. static struct gpiomux_setting ta_nchg_cfg[] = {
  1303. {
  1304. .func = GPIOMUX_FUNC_GPIO,
  1305. .drv = GPIOMUX_DRV_2MA,
  1306. .pull = GPIOMUX_PULL_NONE,
  1307. .dir = GPIOMUX_IN,
  1308. },
  1309. };
  1310. static struct msm_gpiomux_config msm_ta_nchg_configs[] = {
  1311. {
  1312. .gpio = 27, /* TA_NCHG */
  1313. .settings = {
  1314. [GPIOMUX_ACTIVE] = &ta_nchg_cfg[0],
  1315. [GPIOMUX_SUSPENDED] = &ta_nchg_cfg[0],
  1316. },
  1317. },
  1318. };
  1319. static struct gpiomux_setting ta_int_n_cfg = {
  1320. .func = GPIOMUX_FUNC_GPIO,
  1321. .drv = GPIOMUX_DRV_2MA,
  1322. .pull = GPIOMUX_PULL_NONE,
  1323. .dir = GPIOMUX_IN,
  1324. };
  1325. static struct msm_gpiomux_config msm_ta_int_n_configs[] = {
  1326. {
  1327. #if defined (CONFIG_SEC_MILLETLTE_COMMON)
  1328. .gpio = 119, /* TA_INT_N */
  1329. #else
  1330. .gpio = 115, /* TA_INT_N */
  1331. #endif
  1332. .settings = {
  1333. [GPIOMUX_ACTIVE] = &ta_int_n_cfg,
  1334. [GPIOMUX_SUSPENDED] = &ta_int_n_cfg,
  1335. },
  1336. },
  1337. };
  1338. static struct gpiomux_setting ovp_enable_cfg = {
  1339. .func = GPIOMUX_FUNC_GPIO,
  1340. .drv = GPIOMUX_DRV_2MA,
  1341. .pull = GPIOMUX_PULL_NONE,
  1342. .dir = GPIOMUX_OUT_LOW,
  1343. };
  1344. static struct msm_gpiomux_config ovp_enable_configs[] = {
  1345. {
  1346. .gpio = 65, /* OVP enable */
  1347. .settings = {
  1348. [GPIOMUX_ACTIVE] = &ovp_enable_cfg,
  1349. [GPIOMUX_SUSPENDED] = &ovp_enable_cfg,
  1350. },
  1351. },
  1352. };
  1353. static struct gpiomux_setting usb_otg_sw_cfg = {
  1354. .func = GPIOMUX_FUNC_GPIO,
  1355. .drv = GPIOMUX_DRV_2MA,
  1356. .dir = GPIOMUX_OUT_LOW,
  1357. };
  1358. static struct msm_gpiomux_config usb_otg_sw_configs[] __initdata = {
  1359. {
  1360. .gpio = 67,
  1361. .settings = {
  1362. [GPIOMUX_SUSPENDED] = &usb_otg_sw_cfg,
  1363. },
  1364. },
  1365. };
  1366. static struct gpiomux_setting wcdcodec_reset_suspend_cfg = {
  1367. .func = GPIOMUX_FUNC_GPIO,
  1368. .drv = GPIOMUX_DRV_2MA,
  1369. .dir = GPIOMUX_OUT_HIGH,
  1370. .pull = GPIOMUX_PULL_NONE,
  1371. };
  1372. static struct msm_gpiomux_config wcdcodec_reset_cfg[] __initdata = {
  1373. {
  1374. .gpio = 72,
  1375. .settings = {
  1376. [GPIOMUX_SUSPENDED] = &wcdcodec_reset_suspend_cfg,
  1377. },
  1378. },
  1379. };
  1380. #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
  1381. static struct gpiomux_setting sdc3_clk_actv_cfg = {
  1382. .func = GPIOMUX_FUNC_2,
  1383. .drv = GPIOMUX_DRV_8MA,
  1384. .pull = GPIOMUX_PULL_NONE,
  1385. };
  1386. static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
  1387. .func = GPIOMUX_FUNC_2,
  1388. .drv = GPIOMUX_DRV_8MA,
  1389. .pull = GPIOMUX_PULL_UP,
  1390. };
  1391. static struct gpiomux_setting sdc3_suspend_cfg = {
  1392. .func = GPIOMUX_FUNC_GPIO,
  1393. .drv = GPIOMUX_DRV_2MA,
  1394. .pull = GPIOMUX_PULL_DOWN,
  1395. };
  1396. static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
  1397. .func = GPIOMUX_FUNC_GPIO,
  1398. .drv = GPIOMUX_DRV_2MA,
  1399. .pull = GPIOMUX_PULL_UP,
  1400. };
  1401. static struct msm_gpiomux_config msm8226_sdc3_configs[] __initdata = {
  1402. {
  1403. /* DAT3 */
  1404. .gpio = 39,
  1405. .settings = {
  1406. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  1407. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  1408. },
  1409. },
  1410. {
  1411. /* DAT2 */
  1412. .gpio = 40,
  1413. .settings = {
  1414. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  1415. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  1416. },
  1417. },
  1418. {
  1419. /* DAT1 */
  1420. .gpio = 41,
  1421. .settings = {
  1422. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  1423. [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
  1424. },
  1425. },
  1426. {
  1427. /* DAT0 */
  1428. .gpio = 42,
  1429. .settings = {
  1430. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  1431. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  1432. },
  1433. },
  1434. {
  1435. /* CMD */
  1436. .gpio = 43,
  1437. .settings = {
  1438. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  1439. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  1440. },
  1441. },
  1442. {
  1443. /* CLK */
  1444. .gpio = 44,
  1445. .settings = {
  1446. [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
  1447. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  1448. },
  1449. },
  1450. };
  1451. static void msm_gpiomux_sdc3_install(void)
  1452. {
  1453. msm_gpiomux_install(msm8226_sdc3_configs,
  1454. ARRAY_SIZE(msm8226_sdc3_configs));
  1455. }
  1456. #else
  1457. static void msm_gpiomux_sdc3_install(void) {}
  1458. #endif /* CONFIG_MMC_MSM_SDC3_SUPPORT */
  1459. extern int system_rev;
  1460. #if defined (CONFIG_MACH_MILLETLTE_OPEN) || defined (CONFIG_MACH_MILLETLTE_KOR)
  1461. static struct msm_gpiomux_config millet_nc_gpio_cfgs[] __initdata = {
  1462. NC_GPIO_CONFIG(115),
  1463. NC_GPIO_CONFIG(116),
  1464. };
  1465. static struct msm_gpiomux_config millet_nc3_gpio_cfgs[] __initdata = {
  1466. NC_GPIO_CONFIG(4),
  1467. NC_GPIO_CONFIG(52),
  1468. NC_GPIO_CONFIG(120),
  1469. };
  1470. #endif
  1471. #if defined (CONFIG_SEC_MILLETWIFI_COMMON)
  1472. static struct msm_gpiomux_config milletwifi_nc_gpio_cfgs[] __initdata = {
  1473. NC_GPIO_CONFIG(0),
  1474. NC_GPIO_CONFIG(1),
  1475. #if defined(CONFIG_MACH_MILLETWIFI_OPEN)
  1476. NC_GPIO_CONFIG(4),
  1477. NC_GPIO_CONFIG(5),
  1478. #endif
  1479. NC_GPIO_CONFIG(22),
  1480. NC_GPIO_CONFIG(52),
  1481. NC_GPIO_CONFIG(56),
  1482. NC_GPIO_CONFIG(57),
  1483. NC_GPIO_CONFIG(58),
  1484. NC_GPIO_CONFIG(59),
  1485. NC_GPIO_CONFIG(60),
  1486. NC_GPIO_CONFIG(66),
  1487. NC_GPIO_CONFIG(116),
  1488. };
  1489. #endif
  1490. #if defined (CONFIG_MACH_MILLETLTE_VZW) || defined(CONFIG_MACH_MILLETLTE_ATT) || defined(CONFIG_MACH_MILLETLTE_TMO) || defined(CONFIG_MACH_MILLETLTE_CAN)
  1491. static struct msm_gpiomux_config milletltevzw_att_nc_gpio_cfgs[] __initdata = {
  1492. NC_GPIO_CONFIG(2),
  1493. NC_GPIO_CONFIG(3),
  1494. #if defined(CONFIG_MACH_MILLETLTE_CAN)
  1495. NC_GPIO_CONFIG_CAN(22),
  1496. #else
  1497. NC_GPIO_CONFIG(22),
  1498. #endif
  1499. NC_GPIO_CONFIG(52),
  1500. };
  1501. #endif
  1502. extern int poweroff_charging;
  1503. #if defined (CONFIG_MACH_MILLET3G_EUR)
  1504. static struct msm_gpiomux_config millet3g_nc_gpio_cfgs[] __initdata = {
  1505. NC_GPIO_CONFIG(4),
  1506. NC_GPIO_CONFIG(52),
  1507. NC_GPIO_CONFIG(56),
  1508. NC_GPIO_CONFIG(62),
  1509. NC_GPIO_CONFIG(64),
  1510. NC_GPIO_CONFIG(116),
  1511. };
  1512. #endif
  1513. #if defined (CONFIG_SEC_MILLET_PROJECT)
  1514. static struct gpiomux_setting gpio_10_sda_config = {
  1515. .func = GPIOMUX_FUNC_GPIO,
  1516. .drv = GPIOMUX_DRV_2MA,
  1517. .pull = GPIOMUX_PULL_NONE,
  1518. .dir = GPIOMUX_IN,
  1519. };
  1520. static struct msm_gpiomux_config milletltevzw_gpio_10[] __initdata = {
  1521. {
  1522. .gpio = 10,
  1523. .settings = {
  1524. [GPIOMUX_ACTIVE] = &gpio_10_sda_config,
  1525. [GPIOMUX_SUSPENDED] = &gpio_10_sda_config,
  1526. },
  1527. },
  1528. };
  1529. #endif
  1530. #if defined (CONFIG_MACH_MILLETLTE_ATT) || defined(CONFIG_MACH_MILLETLTE_TMO) || defined(CONFIG_MACH_MILLETLTE_CAN)
  1531. static struct msm_gpiomux_config milletatt_tmo_nc_gpio_107[] __initdata = {
  1532. NC_GPIO_CONFIG(107), // NC, revision 1 onwards
  1533. };
  1534. #endif
  1535. #if defined (CONFIG_MACH_MILLETLTE_VZW)
  1536. static struct msm_gpiomux_config milletvzw_nc_gpio_22[] __initdata = {
  1537. NC_GPIO_CONFIG(22),
  1538. };
  1539. static struct msm_gpiomux_config milletvzw_nc_gpio_107[] __initdata = {
  1540. NC_GPIO_CONFIG(107), // NC only after revision 4
  1541. };
  1542. #endif
  1543. void __init msm8226_init_gpiomux(void)
  1544. {
  1545. int rc;
  1546. rc = msm_gpiomux_init_dt();
  1547. if (rc) {
  1548. pr_err("%s failed %d\n", __func__, rc);
  1549. return;
  1550. }
  1551. #if defined (CONFIG_SEC_MILLET_PROJECT)
  1552. msm_gpiomux_install(milletltevzw_gpio_10, ARRAY_SIZE(milletltevzw_gpio_10));
  1553. #endif
  1554. #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
  1555. msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
  1556. #endif
  1557. msm_gpiomux_install(msm_keypad_configs,
  1558. ARRAY_SIZE(msm_keypad_configs));
  1559. if (of_board_is_skuf())
  1560. msm_gpiomux_install(msm_skuf_blsp_configs,
  1561. ARRAY_SIZE(msm_skuf_blsp_configs));
  1562. else
  1563. msm_gpiomux_install(msm_blsp_configs,
  1564. ARRAY_SIZE(msm_blsp_configs));
  1565. msm_gpiomux_install(wcnss_5wire_interface,
  1566. ARRAY_SIZE(wcnss_5wire_interface));
  1567. msm_gpiomux_install(&sd_card_det, 1);
  1568. if (of_board_is_skuf())
  1569. msm_gpiomux_install(msm_skuf_goodix_configs,
  1570. ARRAY_SIZE(msm_skuf_goodix_configs));
  1571. else
  1572. #if defined (CONFIG_MACH_BERLUTI3G_EUR)
  1573. msm_gpiomux_install(msm_cypress_configs,
  1574. ARRAY_SIZE(msm_cypress_configs));
  1575. msm_gpiomux_install(msm_keyboad_cypress_configs,
  1576. ARRAY_SIZE(msm_keyboad_cypress_configs));
  1577. #elif defined(CONFIG_SEC_MILLET_PROJECT)
  1578. msm_gpiomux_install(msm_melfas_configs,
  1579. ARRAY_SIZE(msm_melfas_configs));
  1580. #else
  1581. msm_gpiomux_install(msm_synaptics_configs,
  1582. ARRAY_SIZE(msm_synaptics_configs));
  1583. #endif
  1584. if (of_board_is_skuf())
  1585. msm_gpiomux_install(msm_skuf_nfc_configs,
  1586. ARRAY_SIZE(msm_skuf_nfc_configs));
  1587. msm_gpiomux_install_nowrite(msm_lcd_configs,
  1588. ARRAY_SIZE(msm_lcd_configs));
  1589. msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
  1590. if (of_board_is_skuf())
  1591. msm_gpiomux_install(msm_sensor_configs_skuf_plus,
  1592. ARRAY_SIZE(msm_sensor_configs_skuf_plus));
  1593. #if !defined (CONFIG_SEC_MILLET_PROJECT)
  1594. msm_gpiomux_install(msm_auxpcm_configs,
  1595. ARRAY_SIZE(msm_auxpcm_configs));
  1596. #endif
  1597. if (of_board_is_cdp() || of_board_is_mtp() || of_board_is_xpm())
  1598. msm_gpiomux_install(usb_otg_sw_configs,
  1599. ARRAY_SIZE(usb_otg_sw_configs));
  1600. #if defined (CONFIG_SEC_MILLET_PROJECT)
  1601. msm_gpiomux_install(msm_nativesensors_configs,ARRAY_SIZE(msm_nativesensors_configs));
  1602. if ( system_rev >= 0 && system_rev < 3) {
  1603. msm_gpiomux_install(light_prox_config, ARRAY_SIZE(light_prox_config));
  1604. msm_gpiomux_install(irled_i2c_scl_config,
  1605. ARRAY_SIZE(irled_i2c_scl_config));
  1606. } else {
  1607. msm_gpiomux_install(nc_light_prox_config, ARRAY_SIZE(nc_light_prox_config));
  1608. #if defined (CONFIG_MACH_MILLETLTE_VZW) || defined(CONFIG_SEC_MILLETWIFI_COMMON)
  1609. msm_gpiomux_install(irled_i2c_scl_config,
  1610. ARRAY_SIZE(irled_i2c_scl_config));
  1611. #endif
  1612. }
  1613. #endif
  1614. msm_gpiomux_sdc3_install();
  1615. msm_gpiomux_install(msm_ta_nchg_configs, ARRAY_SIZE(msm_ta_nchg_configs));
  1616. msm_gpiomux_install(msm_ta_int_n_configs, ARRAY_SIZE(msm_ta_int_n_configs));
  1617. #if defined (CONFIG_SEC_MILLETLTE_COMMON)
  1618. if ( system_rev >= 3)
  1619. {
  1620. msm_gpiomux_install(ovp_enable_configs, ARRAY_SIZE(ovp_enable_configs));
  1621. }
  1622. #else
  1623. msm_gpiomux_install(ovp_enable_configs, ARRAY_SIZE(ovp_enable_configs));
  1624. #endif
  1625. #if defined (CONFIG_SEC_MILLETWIFI_COMMON)
  1626. msm_gpiomux_install(milletwifi_nc_gpio_cfgs, ARRAY_SIZE(milletwifi_nc_gpio_cfgs));
  1627. #endif
  1628. #if defined (CONFIG_MACH_MILLETLTE_OPEN) || defined (CONFIG_MACH_MILLETLTE_KOR)
  1629. msm_gpiomux_install(millet_nc_gpio_cfgs, ARRAY_SIZE(millet_nc_gpio_cfgs));
  1630. if ( system_rev >= 3){
  1631. msm_gpiomux_install(millet_nc3_gpio_cfgs, ARRAY_SIZE(millet_nc3_gpio_cfgs));
  1632. }
  1633. #endif
  1634. #if defined (CONFIG_MACH_MILLET3G_EUR)
  1635. if ( system_rev >= 2)
  1636. msm_gpiomux_install(millet3g_nc_gpio_cfgs, ARRAY_SIZE(millet3g_nc_gpio_cfgs));
  1637. #endif
  1638. #if defined (CONFIG_MACH_MILLETLTE_VZW)
  1639. msm_gpiomux_install(milletvzw_nc_gpio_22, ARRAY_SIZE(milletvzw_nc_gpio_22));
  1640. if ( system_rev >= 4)
  1641. msm_gpiomux_install(milletvzw_nc_gpio_107, ARRAY_SIZE(milletvzw_nc_gpio_107));
  1642. if ( system_rev >= 1)
  1643. msm_gpiomux_install(milletltevzw_att_nc_gpio_cfgs, ARRAY_SIZE(milletltevzw_att_nc_gpio_cfgs));
  1644. #endif
  1645. #if defined (CONFIG_MACH_MILLETLTE_ATT) || defined(CONFIG_MACH_MILLETLTE_TMO) || defined(CONFIG_MACH_MILLETLTE_CAN)
  1646. msm_gpiomux_install(milletltevzw_att_nc_gpio_cfgs, ARRAY_SIZE(milletltevzw_att_nc_gpio_cfgs));
  1647. msm_gpiomux_install(ovp_enable_configs, ARRAY_SIZE(ovp_enable_configs));
  1648. if (system_rev >= 1)
  1649. msm_gpiomux_install(milletatt_tmo_nc_gpio_107, ARRAY_SIZE(milletatt_tmo_nc_gpio_107));
  1650. #endif
  1651. #if defined(CONFIG_SAMSUNG_JACK)
  1652. msm_gpiomux_install(msm_earjack_gpio_configs, ARRAY_SIZE(msm_earjack_gpio_configs));
  1653. #endif
  1654. if(!poweroff_charging)
  1655. msm_gpiomux_install(wcdcodec_reset_cfg, ARRAY_SIZE(wcdcodec_reset_cfg));
  1656. #ifdef CONFIG_SND_SOC_MAX98504
  1657. #if defined(CONFIG_MACH_MILLETLTE_OPEN) || defined (CONFIG_MACH_MILLETLTE_KOR)
  1658. if ( system_rev >= 0 && system_rev < 3)
  1659. #elif defined (CONFIG_MACH_MILLET3G_EUR)
  1660. if ( system_rev >= 2 && system_rev < 4)
  1661. #elif defined(CONFIG_MACH_MILLETWIFI_OPEN)
  1662. if ( system_rev >= 0 && system_rev < 5)
  1663. #endif
  1664. {
  1665. msm_gpiomux_install(msm8226_tertiary_mi2s_configs,ARRAY_SIZE(msm8226_tertiary_mi2s_configs));
  1666. msm_gpiomux_install(msm8226_blsp_codec_configs,ARRAY_SIZE(msm8226_blsp_codec_configs));
  1667. msm_gpiomux_install(msm8226_amp_int_configs,ARRAY_SIZE(msm8226_amp_int_configs));
  1668. }
  1669. #endif
  1670. }
  1671. #ifdef CONFIG_WCNSS_IRIS_REGISTER_DUMP
  1672. static void wcnss_switch_to_gpio(void)
  1673. {
  1674. /* Switch MUX to GPIO */
  1675. msm_gpiomux_install(wcnss_5gpio_interface,
  1676. ARRAY_SIZE(wcnss_5gpio_interface));
  1677. /* Ensure GPIO config */
  1678. gpio_direction_input(WLAN_DATA2);
  1679. gpio_direction_input(WLAN_DATA1);
  1680. gpio_direction_input(WLAN_DATA0);
  1681. gpio_direction_output(WLAN_SET, 0);
  1682. gpio_direction_output(WLAN_CLK, 0);
  1683. }
  1684. static void wcnss_switch_to_5wire(void)
  1685. {
  1686. msm_gpiomux_install(wcnss_5wire_interface,
  1687. ARRAY_SIZE(wcnss_5wire_interface));
  1688. }
  1689. u32 wcnss_rf_read_reg(u32 rf_reg_addr)
  1690. {
  1691. int count = 0;
  1692. u32 rf_cmd_and_addr = 0;
  1693. u32 rf_data_received = 0;
  1694. u32 rf_bit = 0;
  1695. wcnss_switch_to_gpio();
  1696. /* Reset the signal if it is already being used. */
  1697. gpio_set_value(WLAN_SET, 0);
  1698. gpio_set_value(WLAN_CLK, 0);
  1699. /* We start with cmd_set high WLAN_SET = 1. */
  1700. gpio_set_value(WLAN_SET, 1);
  1701. gpio_direction_output(WLAN_DATA0, 1);
  1702. gpio_direction_output(WLAN_DATA1, 1);
  1703. gpio_direction_output(WLAN_DATA2, 1);
  1704. gpio_set_value(WLAN_DATA0, 0);
  1705. gpio_set_value(WLAN_DATA1, 0);
  1706. gpio_set_value(WLAN_DATA2, 0);
  1707. /* Prepare command and RF register address that need to sent out.
  1708. * Make sure that we send only 14 bits from LSB.
  1709. */
  1710. rf_cmd_and_addr = (((WLAN_RF_READ_REG_CMD) |
  1711. (rf_reg_addr << WLAN_RF_REG_ADDR_START_OFFSET)) &
  1712. WLAN_RF_READ_CMD_MASK);
  1713. for (count = 0; count < 5; count++) {
  1714. gpio_set_value(WLAN_CLK, 0);
  1715. rf_bit = (rf_cmd_and_addr & 0x1);
  1716. gpio_set_value(WLAN_DATA0, rf_bit ? 1 : 0);
  1717. rf_cmd_and_addr = (rf_cmd_and_addr >> 1);
  1718. rf_bit = (rf_cmd_and_addr & 0x1);
  1719. gpio_set_value(WLAN_DATA1, rf_bit ? 1 : 0);
  1720. rf_cmd_and_addr = (rf_cmd_and_addr >> 1);
  1721. rf_bit = (rf_cmd_and_addr & 0x1);
  1722. gpio_set_value(WLAN_DATA2, rf_bit ? 1 : 0);
  1723. rf_cmd_and_addr = (rf_cmd_and_addr >> 1);
  1724. /* Send the data out WLAN_CLK = 1 */
  1725. gpio_set_value(WLAN_CLK, 1);
  1726. }
  1727. /* Pull down the clock signal */
  1728. gpio_set_value(WLAN_CLK, 0);
  1729. /* Configure data pins to input IO pins */
  1730. gpio_direction_input(WLAN_DATA0);
  1731. gpio_direction_input(WLAN_DATA1);
  1732. gpio_direction_input(WLAN_DATA2);
  1733. for (count = 0; count < 2; count++) {
  1734. gpio_set_value(WLAN_CLK, 1);
  1735. gpio_set_value(WLAN_CLK, 0);
  1736. }
  1737. rf_bit = 0;
  1738. for (count = 0; count < 6; count++) {
  1739. gpio_set_value(WLAN_CLK, 1);
  1740. gpio_set_value(WLAN_CLK, 0);
  1741. rf_bit = gpio_get_value(WLAN_DATA0);
  1742. rf_data_received |= (rf_bit << (count * 3 + 0));
  1743. if (count != 5) {
  1744. rf_bit = gpio_get_value(WLAN_DATA1);
  1745. rf_data_received |= (rf_bit << (count * 3 + 1));
  1746. rf_bit = gpio_get_value(WLAN_DATA2);
  1747. rf_data_received |= (rf_bit << (count * 3 + 2));
  1748. }
  1749. }
  1750. gpio_set_value(WLAN_SET, 0);
  1751. wcnss_switch_to_5wire();
  1752. return rf_data_received;
  1753. }
  1754. #endif