board-ms01-gpiomux.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  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. #include <linux/init.h>
  14. #include <linux/ioport.h>
  15. #include <mach/board.h>
  16. #include <mach/gpio.h>
  17. #include <mach/gpiomux.h>
  18. #include <mach/socinfo.h>
  19. /* Key gpio configurations */
  20. static struct gpiomux_setting gpio_keys_active = {
  21. .func = GPIOMUX_FUNC_GPIO,
  22. .drv = GPIOMUX_DRV_2MA,
  23. .pull = GPIOMUX_PULL_UP,
  24. };
  25. static struct gpiomux_setting gpio_keys_suspend = {
  26. .func = GPIOMUX_FUNC_GPIO,
  27. .drv = GPIOMUX_DRV_2MA,
  28. .pull = GPIOMUX_PULL_UP,
  29. };
  30. static struct gpiomux_setting gpio_home_keys_active = {
  31. .func = GPIOMUX_FUNC_GPIO,
  32. .drv = GPIOMUX_DRV_2MA,
  33. .pull = GPIOMUX_PULL_NONE,
  34. };
  35. static struct gpiomux_setting gpio_home_keys_suspend = {
  36. .func = GPIOMUX_FUNC_GPIO,
  37. .drv = GPIOMUX_DRV_2MA,
  38. .pull = GPIOMUX_PULL_NONE,
  39. };
  40. static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
  41. {
  42. .gpio = 106,
  43. .settings = {
  44. [GPIOMUX_ACTIVE] = &gpio_keys_active,
  45. [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
  46. },
  47. },
  48. {
  49. .gpio = 107,
  50. .settings = {
  51. [GPIOMUX_ACTIVE] = &gpio_keys_active,
  52. [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
  53. },
  54. },
  55. {
  56. .gpio = 108,
  57. .settings = {
  58. [GPIOMUX_ACTIVE] = &gpio_home_keys_active,
  59. [GPIOMUX_SUSPENDED] = &gpio_home_keys_suspend,
  60. },
  61. },
  62. };
  63. /* SPI configurations */
  64. static struct gpiomux_setting gpio_spi_act_config = {
  65. .func = GPIOMUX_FUNC_1,
  66. .drv = GPIOMUX_DRV_8MA,
  67. .pull = GPIOMUX_PULL_DOWN,
  68. };
  69. static struct gpiomux_setting gpio_spi_cs_act_config = {
  70. .func = GPIOMUX_FUNC_1,
  71. .drv = GPIOMUX_DRV_8MA,
  72. .pull = GPIOMUX_PULL_DOWN,
  73. };
  74. static struct gpiomux_setting gpio_spi_susp_config = {
  75. .func = GPIOMUX_FUNC_1,
  76. .drv = GPIOMUX_DRV_6MA,
  77. .pull = GPIOMUX_PULL_DOWN,
  78. };
  79. /* WCNSS configurations */
  80. static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
  81. .func = GPIOMUX_FUNC_GPIO,
  82. .drv = GPIOMUX_DRV_2MA,
  83. .pull = GPIOMUX_PULL_UP,
  84. };
  85. static struct gpiomux_setting wcnss_5wire_active_cfg = {
  86. .func = GPIOMUX_FUNC_1,
  87. .drv = GPIOMUX_DRV_6MA,
  88. .pull = GPIOMUX_PULL_DOWN,
  89. };
  90. static struct gpiomux_setting sd_card_det_active_config = {
  91. .func = GPIOMUX_FUNC_GPIO,
  92. .drv = GPIOMUX_DRV_2MA,
  93. .pull = GPIOMUX_PULL_NONE,
  94. .dir = GPIOMUX_IN,
  95. };
  96. static struct gpiomux_setting sd_card_det_sleep_config = {
  97. .func = GPIOMUX_FUNC_GPIO,
  98. .drv = GPIOMUX_DRV_2MA,
  99. .pull = GPIOMUX_PULL_NONE,
  100. .dir = GPIOMUX_IN,
  101. };
  102. static struct msm_gpiomux_config sd_card_det __initdata = {
  103. .gpio = 38,
  104. .settings = {
  105. [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
  106. [GPIOMUX_SUSPENDED] = &sd_card_det_sleep_config,
  107. },
  108. };
  109. static struct msm_gpiomux_config wcnss_5wire_interface[] = {
  110. {
  111. .gpio = 40,
  112. .settings = {
  113. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  114. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  115. },
  116. },
  117. {
  118. .gpio = 41,
  119. .settings = {
  120. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  121. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  122. },
  123. },
  124. {
  125. .gpio = 42,
  126. .settings = {
  127. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  128. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  129. },
  130. },
  131. {
  132. .gpio = 43,
  133. .settings = {
  134. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  135. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  136. },
  137. },
  138. {
  139. .gpio = 44,
  140. .settings = {
  141. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  142. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  143. },
  144. },
  145. };
  146. /* GPIO i2c configurations */
  147. static struct gpiomux_setting gpio_i2c_config = {
  148. .func = GPIOMUX_FUNC_3,
  149. .drv = GPIOMUX_DRV_2MA,
  150. .pull = GPIOMUX_PULL_NONE,
  151. };
  152. /* Sensor configurations */
  153. static struct gpiomux_setting sensor_gpio_i2c_config = {
  154. .func = GPIOMUX_FUNC_3,
  155. .drv = GPIOMUX_DRV_2MA,
  156. .pull = GPIOMUX_PULL_DOWN,
  157. .dir = GPIOMUX_IN,
  158. };
  159. static struct gpiomux_setting accel_irq_config = {
  160. .func = GPIOMUX_FUNC_GPIO,
  161. .drv = GPIOMUX_DRV_2MA,
  162. .pull = GPIOMUX_PULL_DOWN,
  163. .dir = GPIOMUX_IN,
  164. };
  165. static struct gpiomux_setting prox_irq_config = {
  166. .func = GPIOMUX_FUNC_GPIO,
  167. .drv = GPIOMUX_DRV_2MA,
  168. .pull = GPIOMUX_PULL_NONE,
  169. .dir = GPIOMUX_IN,
  170. };
  171. static struct gpiomux_setting mag_irq_config = {
  172. .func = GPIOMUX_FUNC_GPIO,
  173. .drv = GPIOMUX_DRV_2MA,
  174. .pull = GPIOMUX_PULL_DOWN,
  175. .dir = GPIOMUX_IN,
  176. };
  177. static struct gpiomux_setting rgb_sda_config = {
  178. .func = GPIOMUX_FUNC_GPIO,
  179. .drv = GPIOMUX_DRV_2MA,
  180. .pull = GPIOMUX_PULL_NONE,
  181. .dir = GPIOMUX_IN,
  182. };
  183. static struct msm_gpiomux_config msm_sensors_configs[] __initdata = {
  184. {
  185. .gpio = 65, /* PROXY IRQ */
  186. .settings = {
  187. [GPIOMUX_ACTIVE] = &prox_irq_config,
  188. [GPIOMUX_SUSPENDED] = &prox_irq_config,
  189. },
  190. },
  191. {
  192. .gpio = 64, /* G_SENSOR IRQ */
  193. .settings = {
  194. [GPIOMUX_ACTIVE] = &accel_irq_config,
  195. [GPIOMUX_SUSPENDED] = &accel_irq_config,
  196. },
  197. },
  198. {
  199. .gpio = 66, /* MAG IRQ */
  200. .settings = {
  201. [GPIOMUX_ACTIVE] = &mag_irq_config,
  202. [GPIOMUX_SUSPENDED] = &mag_irq_config,
  203. },
  204. },
  205. {
  206. .gpio = 23, /* SVC LED */
  207. .settings = {
  208. [GPIOMUX_ACTIVE] = &rgb_sda_config,
  209. [GPIOMUX_SUSPENDED] = &rgb_sda_config,
  210. },
  211. },
  212. };
  213. /* NFC configurations */
  214. #ifdef CONFIG_SEC_NFC_I2C
  215. static struct gpiomux_setting nfc_gpio_i2c_config = {
  216. .func = GPIOMUX_FUNC_3,
  217. .drv = GPIOMUX_DRV_2MA,
  218. .pull = GPIOMUX_PULL_NONE,
  219. .dir = GPIOMUX_IN,
  220. };
  221. static struct gpiomux_setting nfc_ven_cfg = {
  222. .func = GPIOMUX_FUNC_GPIO,
  223. .drv = GPIOMUX_DRV_2MA,
  224. .pull = GPIOMUX_PULL_DOWN,
  225. .dir = GPIOMUX_OUT_LOW,
  226. };
  227. static struct gpiomux_setting nfc_irq_cfg = {
  228. .func = GPIOMUX_FUNC_GPIO,
  229. .drv = GPIOMUX_DRV_2MA,
  230. .pull = GPIOMUX_PULL_DOWN,
  231. .dir = GPIOMUX_IN,
  232. };
  233. static struct gpiomux_setting nfc_firmware_cfg = {
  234. .func = GPIOMUX_FUNC_GPIO,
  235. .drv = GPIOMUX_DRV_2MA,
  236. .pull = GPIOMUX_PULL_DOWN,
  237. .dir = GPIOMUX_OUT_LOW,
  238. };
  239. static struct msm_gpiomux_config msm_nfc_configs[] __initdata = {
  240. {
  241. .gpio = 20, /* NFC EN */
  242. .settings = {
  243. [GPIOMUX_ACTIVE] = &nfc_ven_cfg,
  244. [GPIOMUX_SUSPENDED] = &nfc_ven_cfg,
  245. },
  246. },
  247. {
  248. .gpio = 21, /* NFC IRQ */
  249. .settings = {
  250. [GPIOMUX_ACTIVE] = &nfc_irq_cfg,
  251. [GPIOMUX_SUSPENDED] = &nfc_irq_cfg,
  252. },
  253. },
  254. {
  255. .gpio = 62, /* NFC FIRMWARE */
  256. .settings = {
  257. [GPIOMUX_ACTIVE] = &nfc_firmware_cfg,
  258. [GPIOMUX_SUSPENDED] = &nfc_firmware_cfg,
  259. },
  260. },
  261. };
  262. #endif
  263. /* Hall interrupt configuration */
  264. static struct gpiomux_setting hall_active_cfg = {
  265. .func = GPIOMUX_FUNC_GPIO,
  266. .drv = GPIOMUX_DRV_2MA,
  267. .pull = GPIOMUX_PULL_UP,
  268. .dir = GPIOMUX_IN,
  269. };
  270. static struct gpiomux_setting hall_suspend_cfg = {
  271. .func = GPIOMUX_FUNC_GPIO,
  272. .drv = GPIOMUX_DRV_2MA,
  273. .pull = GPIOMUX_PULL_UP,
  274. .dir = GPIOMUX_IN,
  275. };
  276. static struct msm_gpiomux_config msm_hall_configs[] __initdata = {
  277. {
  278. .gpio = 50,
  279. .settings = {
  280. [GPIOMUX_ACTIVE] = &hall_active_cfg,
  281. [GPIOMUX_SUSPENDED] = &hall_suspend_cfg,
  282. },
  283. },
  284. };
  285. /* LCD configurations */
  286. static struct gpiomux_setting lcd_rst_act_cfg = {
  287. .func = GPIOMUX_FUNC_GPIO,
  288. .drv = GPIOMUX_DRV_8MA,
  289. .pull = GPIOMUX_PULL_UP,
  290. .dir = GPIOMUX_OUT_HIGH,
  291. };
  292. static struct gpiomux_setting lcd_rst_sus_cfg = {
  293. .func = GPIOMUX_FUNC_GPIO,
  294. .drv = GPIOMUX_DRV_2MA,
  295. .pull = GPIOMUX_PULL_DOWN,
  296. .dir = GPIOMUX_OUT_LOW,
  297. };
  298. static struct gpiomux_setting lcd_power_act_cfg = {
  299. .func = GPIOMUX_FUNC_GPIO,
  300. .drv = GPIOMUX_DRV_8MA,
  301. .pull = GPIOMUX_PULL_NONE,
  302. .dir = GPIOMUX_OUT_HIGH,
  303. };
  304. static struct gpiomux_setting lcd_power_sus_cfg = {
  305. .func = GPIOMUX_FUNC_GPIO,
  306. .drv = GPIOMUX_DRV_2MA,
  307. .pull = GPIOMUX_PULL_DOWN,
  308. .dir = GPIOMUX_OUT_LOW,
  309. };
  310. static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
  311. {
  312. .gpio = 25,
  313. .settings = {
  314. [GPIOMUX_ACTIVE] = &lcd_rst_act_cfg,
  315. [GPIOMUX_SUSPENDED] = &lcd_rst_sus_cfg,
  316. },
  317. },
  318. {
  319. .gpio = 56,
  320. .settings = {
  321. [GPIOMUX_ACTIVE] = &lcd_power_act_cfg,
  322. [GPIOMUX_SUSPENDED] = &lcd_power_sus_cfg,
  323. },
  324. },
  325. {
  326. .gpio = 60,
  327. .settings = {
  328. [GPIOMUX_ACTIVE] = &lcd_power_act_cfg,
  329. [GPIOMUX_SUSPENDED] = &lcd_power_sus_cfg,
  330. },
  331. },
  332. {
  333. .gpio = 63,
  334. .settings = {
  335. [GPIOMUX_ACTIVE] = &lcd_power_act_cfg,
  336. [GPIOMUX_SUSPENDED] = &lcd_power_sus_cfg,
  337. },
  338. }
  339. };
  340. /* UART configurations */
  341. static struct gpiomux_setting gpio_uart_sleep_config = {
  342. .func = GPIOMUX_FUNC_2,
  343. .drv = GPIOMUX_DRV_8MA,
  344. .pull = GPIOMUX_PULL_NONE,
  345. };
  346. static struct gpiomux_setting gpio_uart_active_config = {
  347. .func = GPIOMUX_FUNC_2,
  348. .drv = GPIOMUX_DRV_8MA,
  349. .pull = GPIOMUX_PULL_DOWN,
  350. };
  351. static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
  352. {
  353. .gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */
  354. .settings = {
  355. [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
  356. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  357. },
  358. },
  359. {
  360. .gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */
  361. .settings = {
  362. [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
  363. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  364. },
  365. },
  366. {
  367. .gpio = 2, /* BLSP1 QUP1 SPI_CS1 */
  368. .settings = {
  369. [GPIOMUX_ACTIVE] = &gpio_spi_cs_act_config,
  370. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  371. },
  372. },
  373. {
  374. .gpio = 3, /* BLSP1 QUP1 SPI_CLK */
  375. .settings = {
  376. [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
  377. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  378. },
  379. },
  380. {
  381. .gpio = 8, /* BLSP1 UART2 TX */
  382. .settings = {
  383. [GPIOMUX_ACTIVE] = &gpio_uart_active_config,
  384. [GPIOMUX_SUSPENDED] = &gpio_uart_sleep_config,
  385. },
  386. },
  387. {
  388. .gpio = 9, /* BLSP1 UART2 RX */
  389. .settings = {
  390. [GPIOMUX_ACTIVE] = &gpio_uart_active_config,
  391. [GPIOMUX_SUSPENDED] = &gpio_uart_sleep_config,
  392. },
  393. },
  394. #ifdef CONFIG_SEC_NFC_I2C
  395. { /* NFC */
  396. .gpio = 10, /* BLSP1 QUP3 I2C_DAT */
  397. .settings = {
  398. [GPIOMUX_SUSPENDED] = &nfc_gpio_i2c_config,
  399. },
  400. },
  401. {
  402. .gpio = 11, /* BLSP1 QUP3 I2C_CLK */
  403. .settings = {
  404. [GPIOMUX_SUSPENDED] = &nfc_gpio_i2c_config,
  405. },
  406. },
  407. #endif
  408. {
  409. .gpio = 6, /* BLSP1 QUP2 I2C_SDA */
  410. .settings = {
  411. [GPIOMUX_SUSPENDED] = &sensor_gpio_i2c_config,
  412. },
  413. },
  414. {
  415. .gpio = 7, /* BLSP1 QUP2 I2C_SCL */
  416. .settings = {
  417. [GPIOMUX_SUSPENDED] = &sensor_gpio_i2c_config,
  418. },
  419. },
  420. {
  421. .gpio = 18, /* BLSP1 QUP5 I2C_SDA */
  422. .settings = {
  423. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  424. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  425. },
  426. },
  427. {
  428. .gpio = 19, /* BLSP1 QUP5 I2C_SCL */
  429. .settings = {
  430. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  431. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  432. },
  433. },
  434. };
  435. /* Camera configurations */
  436. static struct gpiomux_setting gpio_suspend_config[] = {
  437. {
  438. .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
  439. .drv = GPIOMUX_DRV_2MA,
  440. .pull = GPIOMUX_PULL_NONE,
  441. },
  442. {
  443. .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
  444. .drv = GPIOMUX_DRV_2MA,
  445. .pull = GPIOMUX_PULL_NONE,
  446. .dir = GPIOMUX_OUT_LOW,
  447. },
  448. };
  449. static struct gpiomux_setting cam_settings[] = {
  450. {
  451. .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
  452. .drv = GPIOMUX_DRV_2MA,
  453. .pull = GPIOMUX_PULL_NONE,
  454. },
  455. {
  456. .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
  457. .drv = GPIOMUX_DRV_2MA,
  458. .pull = GPIOMUX_PULL_DOWN,
  459. },
  460. {
  461. .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
  462. .drv = GPIOMUX_DRV_2MA,
  463. .pull = GPIOMUX_PULL_KEEPER,
  464. },
  465. {
  466. .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
  467. .drv = GPIOMUX_DRV_2MA,
  468. .pull = GPIOMUX_PULL_NONE,
  469. .dir = GPIOMUX_OUT_LOW,
  470. },
  471. {
  472. .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
  473. .drv = GPIOMUX_DRV_2MA,
  474. .pull = GPIOMUX_PULL_DOWN,
  475. .dir = GPIOMUX_OUT_LOW,
  476. },
  477. {
  478. .func = GPIOMUX_FUNC_1, /*active 1*/ /* 5 */
  479. .drv = GPIOMUX_DRV_4MA,
  480. .pull = GPIOMUX_PULL_NONE,
  481. },
  482. {
  483. .func = GPIOMUX_FUNC_1, /*suspend*/ /* 6 */
  484. .drv = GPIOMUX_DRV_4MA,
  485. .pull = GPIOMUX_PULL_DOWN,
  486. },
  487. {
  488. .func = GPIOMUX_FUNC_GPIO, /*active 1*/ /* 0 */ //7 Haarika
  489. .drv = GPIOMUX_DRV_2MA,
  490. .pull = GPIOMUX_PULL_DOWN,
  491. .dir = GPIOMUX_IN,
  492. },
  493. {
  494. .func = GPIOMUX_FUNC_GPIO, /*suspend*/ /* 1 */ //8
  495. .drv = GPIOMUX_DRV_2MA,
  496. .pull = GPIOMUX_PULL_DOWN,
  497. .dir = GPIOMUX_IN,
  498. },
  499. {
  500. .func = GPIOMUX_FUNC_1, /*active 1*/ /* 9 */
  501. .drv = GPIOMUX_DRV_6MA,
  502. .pull = GPIOMUX_PULL_NONE,
  503. },
  504. {
  505. .func = GPIOMUX_FUNC_1, /*suspend*/ /* 10 */
  506. .drv = GPIOMUX_DRV_6MA,
  507. .pull = GPIOMUX_PULL_DOWN,
  508. },
  509. };
  510. static struct msm_gpiomux_config msm_csensor_configs[] __initdata = {
  511. {
  512. .gpio = 0, /* CIS_SPI_MOSI */
  513. .settings = {
  514. [GPIOMUX_ACTIVE] = &cam_settings[5],
  515. #if defined(CONFIG_MACH_MS01_EUR_3G)
  516. [GPIOMUX_SUSPENDED] = &cam_settings[5],
  517. #else
  518. [GPIOMUX_SUSPENDED] = &cam_settings[8],
  519. #endif
  520. },
  521. },
  522. {
  523. .gpio = 1, /* CIS_SPI_MISO */
  524. .settings = {
  525. [GPIOMUX_ACTIVE] = &cam_settings[5],
  526. #if defined(CONFIG_MACH_MS01_EUR_3G)
  527. [GPIOMUX_SUSPENDED] = &cam_settings[5],
  528. #else
  529. [GPIOMUX_SUSPENDED] = &cam_settings[8],
  530. #endif
  531. },
  532. },
  533. {
  534. .gpio = 3, /* CIS_SPI_SCLK */
  535. .settings = {
  536. [GPIOMUX_ACTIVE] = &cam_settings[5],
  537. #if defined(CONFIG_MACH_MS01_EUR_3G)
  538. [GPIOMUX_SUSPENDED] = &cam_settings[5],
  539. #else
  540. [GPIOMUX_SUSPENDED] = &cam_settings[8],
  541. #endif
  542. },
  543. },
  544. {
  545. .gpio = 26, /* CAM_MCLK0 */
  546. .settings = {
  547. [GPIOMUX_ACTIVE] = &cam_settings[9],
  548. [GPIOMUX_SUSPENDED] = &cam_settings[10],
  549. },
  550. },
  551. #if defined(CONFIG_MACH_S3VE3G_EUR)
  552. {
  553. .gpio = 27, /* CAM_MCLK1 */
  554. .settings = {
  555. [GPIOMUX_ACTIVE] = &cam_settings[6],
  556. [GPIOMUX_SUSPENDED] = &cam_settings[6],
  557. },
  558. },
  559. #else
  560. {
  561. .gpio = 27, /* CAM_MCLK1 */
  562. .settings = {
  563. [GPIOMUX_ACTIVE] = &cam_settings[7],
  564. [GPIOMUX_SUSPENDED] = &cam_settings[8],
  565. },
  566. },
  567. #endif
  568. {
  569. .gpio = 29, /* CCI_I2C_SDA0 */
  570. .settings = {
  571. [GPIOMUX_ACTIVE] = &cam_settings[0],
  572. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  573. },
  574. },
  575. {
  576. .gpio = 30, /* CCI_I2C_SCL0 */
  577. .settings = {
  578. [GPIOMUX_ACTIVE] = &cam_settings[0],
  579. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  580. },
  581. },
  582. {
  583. .gpio = 37, /* CAM1_RST_N */
  584. .settings = {
  585. [GPIOMUX_ACTIVE] = &cam_settings[3],
  586. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  587. },
  588. },
  589. {
  590. .gpio = 28, /* CAM2_RST_N */
  591. .settings = {
  592. [GPIOMUX_ACTIVE] = &cam_settings[3],
  593. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  594. },
  595. },
  596. {
  597. .gpio = 112, /* CAM_ANALOG_EN */
  598. .settings = {
  599. [GPIOMUX_ACTIVE] = &cam_settings[3],
  600. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  601. },
  602. },
  603. {
  604. .gpio = 114, /* CAM_IO_EN */
  605. .settings = {
  606. [GPIOMUX_ACTIVE] = &cam_settings[3],
  607. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  608. },
  609. },
  610. {
  611. .gpio = 34, /* AF_SDA */
  612. .settings = {
  613. /*[GPIOMUX_ACTIVE] = &gpio_i2c_config,*/
  614. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  615. },
  616. },
  617. {
  618. #if defined(CONFIG_MACH_MS01_EUR_3G)
  619. .gpio = 33, /* AF_SCL */
  620. #else
  621. .gpio = 36, /* AF_SCL */
  622. #endif
  623. .settings = {
  624. /*[GPIOMUX_ACTIVE] = &gpio_i2c_config,*/
  625. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  626. },
  627. },
  628. };
  629. /* Touch */
  630. static struct gpiomux_setting melfas_int_act_cfg = {
  631. .func = GPIOMUX_FUNC_3,
  632. .drv = GPIOMUX_DRV_2MA,
  633. .pull = GPIOMUX_PULL_NONE,
  634. };
  635. static struct gpiomux_setting melfas_int_sus_cfg = {
  636. .func = GPIOMUX_FUNC_GPIO,
  637. .drv = GPIOMUX_DRV_2MA,
  638. .pull = GPIOMUX_PULL_NONE,
  639. };
  640. static struct gpiomux_setting gpio_i2c_tkey_act_config = {
  641. .func = GPIOMUX_FUNC_GPIO,
  642. .drv = GPIOMUX_DRV_2MA,
  643. .pull = GPIOMUX_PULL_NONE,
  644. };
  645. static struct gpiomux_setting gpio_i2c_tkey_sus_config = {
  646. .func = GPIOMUX_FUNC_GPIO,
  647. .drv = GPIOMUX_DRV_2MA,
  648. .pull = GPIOMUX_PULL_DOWN,
  649. };
  650. static struct msm_gpiomux_config msm_melfas_configs[] __initdata = {
  651. {
  652. .gpio = 17,
  653. .settings = {
  654. [GPIOMUX_ACTIVE] = &melfas_int_act_cfg,
  655. [GPIOMUX_SUSPENDED] = &melfas_int_sus_cfg,
  656. },
  657. },
  658. };
  659. static struct msm_gpiomux_config msm_keyboad_cypress_configs[] __initdata = {
  660. {
  661. .gpio = 49, /* 2_TOUCH_INT */
  662. .settings = {
  663. [GPIOMUX_ACTIVE] = &gpio_i2c_tkey_act_config,
  664. [GPIOMUX_SUSPENDED] = &gpio_i2c_tkey_sus_config,
  665. },
  666. },
  667. {
  668. .gpio = 66, /* 2_TOUCH_I2C_SCL */
  669. .settings = {
  670. [GPIOMUX_ACTIVE] = &gpio_i2c_tkey_act_config,
  671. [GPIOMUX_SUSPENDED] = &gpio_i2c_tkey_sus_config,
  672. },
  673. },
  674. {
  675. .gpio = 114, /* 2_TOUCH_I2C_SDA */
  676. .settings = {
  677. [GPIOMUX_ACTIVE] = &gpio_i2c_tkey_act_config,
  678. [GPIOMUX_SUSPENDED] = &gpio_i2c_tkey_sus_config,
  679. },
  680. },
  681. };
  682. /* EarJack configurations */
  683. static struct gpiomux_setting earjack_gpio_active_cfg = {
  684. .func = GPIOMUX_FUNC_GPIO, /*active 1*/ /* 0 */
  685. .drv = GPIOMUX_DRV_2MA,
  686. .pull = GPIOMUX_PULL_DOWN,
  687. .dir = GPIOMUX_IN,
  688. };
  689. static struct gpiomux_setting earjack_gpio_suspend_cfg = {
  690. .func = GPIOMUX_FUNC_GPIO, /*suspend*/ /* 1 */
  691. .drv = GPIOMUX_DRV_2MA,
  692. .pull = GPIOMUX_PULL_DOWN,
  693. .dir = GPIOMUX_IN,
  694. };
  695. static struct msm_gpiomux_config msm_earjack_gpio_configs[] __initdata = {
  696. {
  697. .gpio = 35, /* EAR_SWITCH */
  698. .settings = {
  699. [GPIOMUX_ACTIVE] = &earjack_gpio_active_cfg,
  700. [GPIOMUX_SUSPENDED] = &earjack_gpio_suspend_cfg,
  701. },
  702. }
  703. };
  704. static struct gpiomux_setting codec_active_cfg = {
  705. .func = GPIOMUX_FUNC_GPIO,
  706. .drv = GPIOMUX_DRV_6MA,
  707. .pull = GPIOMUX_PULL_NONE,
  708. };
  709. static struct gpiomux_setting codec_suspend_cfg = {
  710. .func = GPIOMUX_FUNC_GPIO,
  711. .drv = GPIOMUX_DRV_6MA,
  712. .pull = GPIOMUX_PULL_DOWN,
  713. };
  714. static struct msm_gpiomux_config msm_cdc_reset_config[] __initdata = {
  715. {
  716. .gpio = 72,
  717. .settings = {
  718. [GPIOMUX_ACTIVE] = &codec_active_cfg,
  719. [GPIOMUX_SUSPENDED] = &codec_suspend_cfg,
  720. },
  721. }
  722. };
  723. #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
  724. static struct gpiomux_setting sdc3_clk_actv_cfg = {
  725. .func = GPIOMUX_FUNC_2,
  726. .drv = GPIOMUX_DRV_8MA,
  727. .pull = GPIOMUX_PULL_NONE,
  728. };
  729. static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
  730. .func = GPIOMUX_FUNC_2,
  731. .drv = GPIOMUX_DRV_8MA,
  732. .pull = GPIOMUX_PULL_UP,
  733. };
  734. static struct gpiomux_setting sdc3_suspend_cfg = {
  735. .func = GPIOMUX_FUNC_GPIO,
  736. .drv = GPIOMUX_DRV_2MA,
  737. .pull = GPIOMUX_PULL_DOWN,
  738. };
  739. static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
  740. .func = GPIOMUX_FUNC_GPIO,
  741. .drv = GPIOMUX_DRV_2MA,
  742. .pull = GPIOMUX_PULL_UP,
  743. };
  744. static struct msm_gpiomux_config msm8226_sdc3_configs[] __initdata = {
  745. {
  746. /* DAT3 */
  747. .gpio = 39,
  748. .settings = {
  749. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  750. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  751. },
  752. },
  753. {
  754. /* DAT2 */
  755. .gpio = 40,
  756. .settings = {
  757. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  758. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  759. },
  760. },
  761. {
  762. /* DAT1 */
  763. .gpio = 41,
  764. .settings = {
  765. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  766. [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
  767. },
  768. },
  769. {
  770. /* DAT0 */
  771. .gpio = 42,
  772. .settings = {
  773. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  774. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  775. },
  776. },
  777. {
  778. /* CMD */
  779. .gpio = 43,
  780. .settings = {
  781. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  782. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  783. },
  784. },
  785. {
  786. /* CLK */
  787. .gpio = 44,
  788. .settings = {
  789. [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
  790. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  791. },
  792. },
  793. };
  794. static void msm_gpiomux_sdc3_install(void)
  795. {
  796. msm_gpiomux_install(msm8226_sdc3_configs,
  797. ARRAY_SIZE(msm8226_sdc3_configs));
  798. }
  799. #else
  800. static void msm_gpiomux_sdc3_install(void) {}
  801. #endif /* CONFIG_MMC_MSM_SDC3_SUPPORT */
  802. /* TX_GTR_THRESH configurations */
  803. static struct gpiomux_setting tx_gtr_cfg = {
  804. .func = GPIOMUX_FUNC_GPIO,
  805. .drv = GPIOMUX_DRV_2MA,
  806. .pull = GPIOMUX_PULL_DOWN,
  807. .dir = GPIOMUX_OUT_LOW,
  808. };
  809. static struct msm_gpiomux_config msm8226_tx_gtr_configs[] __initdata = {
  810. {
  811. /* TX_GTR_THRESH */
  812. .gpio = 87,
  813. .settings = {
  814. [GPIOMUX_ACTIVE] = &tx_gtr_cfg,
  815. [GPIOMUX_SUSPENDED] = &tx_gtr_cfg,
  816. },
  817. },
  818. };
  819. /* MUIC configurations */
  820. static struct gpiomux_setting gpio_muic_config = {
  821. .func = GPIOMUX_FUNC_GPIO,
  822. .drv = GPIOMUX_DRV_2MA,
  823. .pull = GPIOMUX_PULL_NONE,
  824. .dir = GPIOMUX_IN,
  825. };
  826. static struct msm_gpiomux_config muic_configs[] __initdata = {
  827. {
  828. .gpio = 4,
  829. .settings = {
  830. [GPIOMUX_ACTIVE] = &gpio_muic_config,
  831. [GPIOMUX_SUSPENDED] = &gpio_muic_config,
  832. },
  833. },
  834. {
  835. .gpio = 5,
  836. .settings = {
  837. [GPIOMUX_ACTIVE] = &gpio_muic_config,
  838. [GPIOMUX_SUSPENDED] = &gpio_muic_config,
  839. },
  840. },
  841. };
  842. /* NC pin configurations */
  843. #define NC_GPIO_CONFIG(gpio_num) { \
  844. .gpio = gpio_num, \
  845. .settings = { \
  846. [GPIOMUX_ACTIVE] = &nc_active_cfg, \
  847. [GPIOMUX_SUSPENDED] = &nc_suspend_cfg, } \
  848. }
  849. static struct gpiomux_setting nc_active_cfg = {
  850. .func = GPIOMUX_FUNC_GPIO,
  851. .drv = GPIOMUX_DRV_2MA,
  852. .pull = GPIOMUX_PULL_DOWN,
  853. .dir = GPIOMUX_IN,
  854. };
  855. static struct gpiomux_setting nc_suspend_cfg = {
  856. .func = GPIOMUX_FUNC_GPIO,
  857. .drv = GPIOMUX_DRV_2MA,
  858. .pull = GPIOMUX_PULL_DOWN,
  859. .dir = GPIOMUX_IN,
  860. };
  861. static struct gpiomux_setting hw_chk_bit_gpio_cfg = {
  862. .func = GPIOMUX_FUNC_GPIO,
  863. .drv = GPIOMUX_DRV_2MA,
  864. .pull = GPIOMUX_PULL_NONE,
  865. .dir = GPIOMUX_IN,
  866. };
  867. static struct msm_gpiomux_config hw_rev_configs[] __initdata = {
  868. {
  869. .gpio = 15, /* HW_REV(0) */
  870. .settings = {
  871. [GPIOMUX_ACTIVE] = &hw_chk_bit_gpio_cfg,
  872. [GPIOMUX_SUSPENDED] = &hw_chk_bit_gpio_cfg,
  873. },
  874. },
  875. {
  876. .gpio = 14, /* HW_REV(1) */
  877. .settings = {
  878. [GPIOMUX_ACTIVE] = &hw_chk_bit_gpio_cfg,
  879. [GPIOMUX_SUSPENDED] = &hw_chk_bit_gpio_cfg,
  880. },
  881. },
  882. {
  883. .gpio = 13, /* HW_REV(2) */
  884. .settings = {
  885. [GPIOMUX_ACTIVE] = &hw_chk_bit_gpio_cfg,
  886. [GPIOMUX_SUSPENDED] = &hw_chk_bit_gpio_cfg,
  887. },
  888. },
  889. {
  890. .gpio = 12, /* HW_REV(3) */
  891. .settings = {
  892. [GPIOMUX_ACTIVE] = &hw_chk_bit_gpio_cfg,
  893. [GPIOMUX_SUSPENDED] = &hw_chk_bit_gpio_cfg,
  894. },
  895. },
  896. {
  897. .gpio = 22, /* CHECK_DS_SS */
  898. .settings = {
  899. [GPIOMUX_ACTIVE] = &hw_chk_bit_gpio_cfg,
  900. [GPIOMUX_SUSPENDED] = &hw_chk_bit_gpio_cfg,
  901. },
  902. },
  903. };
  904. /* BERLUTI 3G NC configs */
  905. static struct msm_gpiomux_config berluti3g_nc_gpio_cfgs[] __initdata = {
  906. #if defined(CONFIG_FB_MSM_MDSS_SHARP_HD_PANEL)
  907. NC_GPIO_CONFIG(16), /* As we will not ESD so ESD pin should be NC */
  908. #endif
  909. NC_GPIO_CONFIG(24),
  910. NC_GPIO_CONFIG(53),
  911. NC_GPIO_CONFIG(54),
  912. NC_GPIO_CONFIG(55),
  913. #ifndef CONFIG_FB_MSM_MDSS_SHARP_HD_PANEL
  914. NC_GPIO_CONFIG(60),
  915. #endif
  916. NC_GPIO_CONFIG(80),
  917. NC_GPIO_CONFIG(88),
  918. NC_GPIO_CONFIG(89),
  919. NC_GPIO_CONFIG(90),
  920. NC_GPIO_CONFIG(91),
  921. NC_GPIO_CONFIG(92),
  922. NC_GPIO_CONFIG(93),
  923. NC_GPIO_CONFIG(94),
  924. NC_GPIO_CONFIG(97),
  925. NC_GPIO_CONFIG(98),
  926. NC_GPIO_CONFIG(99),
  927. NC_GPIO_CONFIG(100),
  928. NC_GPIO_CONFIG(103),
  929. NC_GPIO_CONFIG(104),
  930. NC_GPIO_CONFIG(110),
  931. NC_GPIO_CONFIG(113),
  932. NC_GPIO_CONFIG(115),
  933. NC_GPIO_CONFIG(116),
  934. };
  935. void __init msm8226_init_gpiomux(void)
  936. {
  937. int rc;
  938. rc = msm_gpiomux_init_dt();
  939. if (rc) {
  940. pr_err("%s failed %d\n", __func__, rc);
  941. return;
  942. }
  943. /* Keypad */
  944. msm_gpiomux_install(msm_keypad_configs,
  945. ARRAY_SIZE(msm_keypad_configs));
  946. /* HallSensors */
  947. msm_gpiomux_install(msm_hall_configs,
  948. ARRAY_SIZE(msm_hall_configs));
  949. /* BLSP */
  950. msm_gpiomux_install(msm_blsp_configs,
  951. ARRAY_SIZE(msm_blsp_configs));
  952. /*HW */
  953. msm_gpiomux_install(hw_rev_configs,
  954. ARRAY_SIZE(hw_rev_configs));
  955. /* WCNSS */
  956. msm_gpiomux_install(wcnss_5wire_interface,
  957. ARRAY_SIZE(wcnss_5wire_interface));
  958. /*T_FLASH_DETECT */
  959. msm_gpiomux_install(&sd_card_det, 1);
  960. /* TX_GTR */
  961. msm_gpiomux_install(msm8226_tx_gtr_configs,
  962. ARRAY_SIZE(msm8226_tx_gtr_configs));
  963. /* LCD */
  964. msm_gpiomux_install_nowrite(msm_lcd_configs,
  965. ARRAY_SIZE(msm_lcd_configs));
  966. /* Camera */
  967. msm_gpiomux_install(msm_csensor_configs,
  968. ARRAY_SIZE(msm_csensor_configs));
  969. /* Touch */
  970. msm_gpiomux_install(msm_melfas_configs,
  971. ARRAY_SIZE(msm_melfas_configs));
  972. /* Touch Key */
  973. msm_gpiomux_install(msm_keyboad_cypress_configs,
  974. ARRAY_SIZE(msm_keyboad_cypress_configs));
  975. #ifdef CONFIG_SEC_NFC_I2C
  976. /* NFC */
  977. msm_gpiomux_install(msm_nfc_configs,
  978. ARRAY_SIZE(msm_nfc_configs));
  979. #endif
  980. /* Sensors */
  981. msm_gpiomux_install(msm_sensors_configs,
  982. ARRAY_SIZE(msm_sensors_configs));
  983. /* SDCC3 */
  984. msm_gpiomux_sdc3_install();
  985. /* Codec */
  986. msm_gpiomux_install(msm_cdc_reset_config,
  987. ARRAY_SIZE(msm_cdc_reset_config));
  988. /* Earjack */
  989. msm_gpiomux_install(msm_earjack_gpio_configs,
  990. ARRAY_SIZE(msm_earjack_gpio_configs));
  991. /* MUIC */
  992. msm_gpiomux_install(muic_configs,
  993. ARRAY_SIZE(muic_configs));
  994. /* NC */
  995. msm_gpiomux_install(berluti3g_nc_gpio_cfgs, ARRAY_SIZE(berluti3g_nc_gpio_cfgs));
  996. }