board-gnote-gpiomux.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  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 = 108,
  50. .settings = {
  51. [GPIOMUX_ACTIVE] = &gpio_home_keys_active,
  52. [GPIOMUX_SUSPENDED] = &gpio_home_keys_suspend,
  53. },
  54. },
  55. };
  56. /* SPI configurations */
  57. static struct gpiomux_setting gpio_spi_act_config = {
  58. .func = GPIOMUX_FUNC_1,
  59. .drv = GPIOMUX_DRV_8MA,
  60. .pull = GPIOMUX_PULL_DOWN,
  61. };
  62. static struct gpiomux_setting gpio_spi_cs_act_config = {
  63. .func = GPIOMUX_FUNC_1,
  64. .drv = GPIOMUX_DRV_8MA,
  65. .pull = GPIOMUX_PULL_DOWN,
  66. };
  67. static struct gpiomux_setting gpio_spi_susp_config = {
  68. .func = GPIOMUX_FUNC_1,
  69. .drv = GPIOMUX_DRV_6MA,
  70. .pull = GPIOMUX_PULL_DOWN,
  71. };
  72. /* WCNSS configurations */
  73. static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
  74. .func = GPIOMUX_FUNC_GPIO,
  75. .drv = GPIOMUX_DRV_2MA,
  76. .pull = GPIOMUX_PULL_UP,
  77. };
  78. static struct gpiomux_setting wcnss_5wire_active_cfg = {
  79. .func = GPIOMUX_FUNC_1,
  80. .drv = GPIOMUX_DRV_6MA,
  81. .pull = GPIOMUX_PULL_DOWN,
  82. };
  83. static struct msm_gpiomux_config wcnss_5wire_interface[] = {
  84. {
  85. .gpio = 40,
  86. .settings = {
  87. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  88. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  89. },
  90. },
  91. {
  92. .gpio = 41,
  93. .settings = {
  94. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  95. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  96. },
  97. },
  98. {
  99. .gpio = 42,
  100. .settings = {
  101. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  102. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  103. },
  104. },
  105. {
  106. .gpio = 43,
  107. .settings = {
  108. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  109. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  110. },
  111. },
  112. {
  113. .gpio = 44,
  114. .settings = {
  115. [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
  116. [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
  117. },
  118. },
  119. };
  120. /* GPIO i2c configurations */
  121. static struct gpiomux_setting gpio_i2c_config = {
  122. .func = GPIOMUX_FUNC_3,
  123. .drv = GPIOMUX_DRV_2MA,
  124. .pull = GPIOMUX_PULL_NONE,
  125. };
  126. /* Sensor configurations */
  127. static struct gpiomux_setting sensor_gpio_i2c_config = {
  128. .func = GPIOMUX_FUNC_3,
  129. .drv = GPIOMUX_DRV_2MA,
  130. .pull = GPIOMUX_PULL_DOWN,
  131. .dir = GPIOMUX_IN,
  132. };
  133. static struct gpiomux_setting accel_irq_config = {
  134. .func = GPIOMUX_FUNC_GPIO,
  135. .drv = GPIOMUX_DRV_2MA,
  136. .pull = GPIOMUX_PULL_UP,
  137. .dir = GPIOMUX_IN,
  138. };
  139. static struct gpiomux_setting prox_irq_config = {
  140. .func = GPIOMUX_FUNC_GPIO,
  141. .drv = GPIOMUX_DRV_2MA,
  142. .pull = GPIOMUX_PULL_NONE,
  143. .dir = GPIOMUX_IN,
  144. };
  145. static struct gpiomux_setting mag_rstn_config = {
  146. .func = GPIOMUX_FUNC_GPIO,
  147. .drv = GPIOMUX_DRV_2MA,
  148. .pull = GPIOMUX_PULL_NONE,
  149. };
  150. static struct msm_gpiomux_config msm_sensors_configs[] __initdata = {
  151. {
  152. .gpio = 65, /* PROXY IRQ */
  153. .settings = {
  154. [GPIOMUX_ACTIVE] = &prox_irq_config,
  155. [GPIOMUX_SUSPENDED] = &prox_irq_config,
  156. },
  157. },
  158. {
  159. .gpio = 64, /* G_SENSOR IRQ */
  160. .settings = {
  161. [GPIOMUX_ACTIVE] = &accel_irq_config,
  162. [GPIOMUX_SUSPENDED] = &accel_irq_config,
  163. },
  164. },
  165. {
  166. .gpio = 66, /* MAG RSTN */
  167. .settings = {
  168. [GPIOMUX_ACTIVE] = &mag_rstn_config,
  169. [GPIOMUX_SUSPENDED] = &mag_rstn_config,
  170. },
  171. },
  172. };
  173. /* NFC configurations */
  174. static struct gpiomux_setting nfc_gpio_i2c_config = {
  175. .func = GPIOMUX_FUNC_3,
  176. .drv = GPIOMUX_DRV_2MA,
  177. .pull = GPIOMUX_PULL_NONE,
  178. .dir = GPIOMUX_IN,
  179. };
  180. static struct gpiomux_setting nfc_ven_cfg = {
  181. .func = GPIOMUX_FUNC_GPIO,
  182. .drv = GPIOMUX_DRV_2MA,
  183. .pull = GPIOMUX_PULL_DOWN,
  184. .dir = GPIOMUX_OUT_LOW,
  185. };
  186. static struct gpiomux_setting nfc_irq_cfg = {
  187. .func = GPIOMUX_FUNC_GPIO,
  188. .drv = GPIOMUX_DRV_2MA,
  189. .pull = GPIOMUX_PULL_NONE,
  190. .dir = GPIOMUX_IN,
  191. };
  192. static struct gpiomux_setting nfc_firmware_cfg = {
  193. .func = GPIOMUX_FUNC_GPIO,
  194. .drv = GPIOMUX_DRV_2MA,
  195. .pull = GPIOMUX_PULL_NONE,
  196. .dir = GPIOMUX_OUT_LOW,
  197. };
  198. static struct msm_gpiomux_config msm_nfc_configs[] __initdata = {
  199. {
  200. .gpio = 20, /* NFC EN */
  201. .settings = {
  202. [GPIOMUX_ACTIVE] = &nfc_ven_cfg,
  203. [GPIOMUX_SUSPENDED] = &nfc_ven_cfg,
  204. },
  205. },
  206. {
  207. .gpio = 21, /* NFC IRQ */
  208. .settings = {
  209. [GPIOMUX_ACTIVE] = &nfc_irq_cfg,
  210. [GPIOMUX_SUSPENDED] = &nfc_irq_cfg,
  211. },
  212. },
  213. {
  214. .gpio = 62, /* NFC FIRMWARE */
  215. .settings = {
  216. [GPIOMUX_ACTIVE] = &nfc_firmware_cfg,
  217. [GPIOMUX_SUSPENDED] = &nfc_firmware_cfg,
  218. },
  219. },
  220. };
  221. /* Hall interrupt configuration */
  222. static struct gpiomux_setting hall_active_cfg = {
  223. .func = GPIOMUX_FUNC_GPIO,
  224. .drv = GPIOMUX_DRV_2MA,
  225. .pull = GPIOMUX_PULL_NONE,
  226. .dir = GPIOMUX_IN,
  227. };
  228. static struct gpiomux_setting hall_suspend_cfg = {
  229. .func = GPIOMUX_FUNC_GPIO,
  230. .drv = GPIOMUX_DRV_2MA,
  231. .pull = GPIOMUX_PULL_NONE,
  232. .dir = GPIOMUX_IN,
  233. };
  234. static struct msm_gpiomux_config msm_hall_configs[] __initdata = {
  235. {
  236. .gpio = 50,
  237. .settings = {
  238. [GPIOMUX_ACTIVE] = &hall_active_cfg,
  239. [GPIOMUX_SUSPENDED] = &hall_suspend_cfg,
  240. },
  241. },
  242. };
  243. /* LCD configurations */
  244. static struct gpiomux_setting lcd_rst_act_cfg = {
  245. .func = GPIOMUX_FUNC_GPIO,
  246. .drv = GPIOMUX_DRV_2MA,
  247. .pull = GPIOMUX_PULL_NONE,
  248. .dir = GPIOMUX_OUT_HIGH,
  249. };
  250. static struct gpiomux_setting lcd_rst_sus_cfg = {
  251. .func = GPIOMUX_FUNC_GPIO,
  252. .drv = GPIOMUX_DRV_2MA,
  253. .pull = GPIOMUX_PULL_DOWN,
  254. .dir = GPIOMUX_OUT_LOW,
  255. };
  256. static struct gpiomux_setting lcd_enable_act_cfg = {
  257. .func = GPIOMUX_FUNC_GPIO,
  258. .drv = GPIOMUX_DRV_8MA,
  259. .pull = GPIOMUX_PULL_NONE,
  260. .dir = GPIOMUX_OUT_HIGH,
  261. };
  262. static struct gpiomux_setting lcd_enable_sus_cfg = {
  263. .func = GPIOMUX_FUNC_GPIO,
  264. .drv = GPIOMUX_DRV_2MA,
  265. .pull = GPIOMUX_PULL_DOWN,
  266. };
  267. static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
  268. {
  269. .gpio = 25, /* LCD Reset */
  270. .settings = {
  271. [GPIOMUX_ACTIVE] = &lcd_rst_act_cfg,
  272. [GPIOMUX_SUSPENDED] = &lcd_rst_sus_cfg,
  273. },
  274. },
  275. {
  276. .gpio =63, /* LCD Enable */
  277. .settings = {
  278. [GPIOMUX_ACTIVE] = &lcd_enable_act_cfg,
  279. [GPIOMUX_SUSPENDED] = &lcd_enable_sus_cfg,
  280. },
  281. },
  282. };
  283. /* UART configurations */
  284. static struct gpiomux_setting gpio_uart_sleep_config = {
  285. .func = GPIOMUX_FUNC_2,
  286. .drv = GPIOMUX_DRV_8MA,
  287. .pull = GPIOMUX_PULL_NONE,
  288. };
  289. static struct gpiomux_setting gpio_uart_active_config = {
  290. .func = GPIOMUX_FUNC_2,
  291. .drv = GPIOMUX_DRV_8MA,
  292. .pull = GPIOMUX_PULL_DOWN,
  293. };
  294. static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
  295. {
  296. .gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */
  297. .settings = {
  298. [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
  299. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  300. },
  301. },
  302. {
  303. .gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */
  304. .settings = {
  305. [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
  306. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  307. },
  308. },
  309. {
  310. .gpio = 2, /* BLSP1 QUP1 SPI_CS1 */
  311. .settings = {
  312. [GPIOMUX_ACTIVE] = &gpio_spi_cs_act_config,
  313. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  314. },
  315. },
  316. {
  317. .gpio = 3, /* BLSP1 QUP1 SPI_CLK */
  318. .settings = {
  319. [GPIOMUX_ACTIVE] = &gpio_spi_act_config,
  320. [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
  321. },
  322. },
  323. {
  324. .gpio = 8, /* BLSP1 UART2 TX */
  325. .settings = {
  326. [GPIOMUX_ACTIVE] = &gpio_uart_active_config,
  327. [GPIOMUX_SUSPENDED] = &gpio_uart_sleep_config,
  328. },
  329. },
  330. {
  331. .gpio = 9, /* BLSP1 UART2 RX */
  332. .settings = {
  333. [GPIOMUX_ACTIVE] = &gpio_uart_active_config,
  334. [GPIOMUX_SUSPENDED] = &gpio_uart_sleep_config,
  335. },
  336. },
  337. { /* NFC */
  338. .gpio = 10, /* BLSP1 QUP3 I2C_DAT */
  339. .settings = {
  340. [GPIOMUX_SUSPENDED] = &nfc_gpio_i2c_config,
  341. },
  342. },
  343. {
  344. .gpio = 11, /* BLSP1 QUP3 I2C_CLK */
  345. .settings = {
  346. [GPIOMUX_SUSPENDED] = &nfc_gpio_i2c_config,
  347. },
  348. },
  349. {
  350. .gpio = 6, /* BLSP1 QUP2 I2C_SDA */
  351. .settings = {
  352. [GPIOMUX_SUSPENDED] = &sensor_gpio_i2c_config,
  353. },
  354. },
  355. {
  356. .gpio = 7, /* BLSP1 QUP2 I2C_SCL */
  357. .settings = {
  358. [GPIOMUX_SUSPENDED] = &sensor_gpio_i2c_config,
  359. },
  360. },
  361. {
  362. .gpio = 18, /* BLSP1 QUP5 I2C_SDA */
  363. .settings = {
  364. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  365. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  366. },
  367. },
  368. {
  369. .gpio = 19, /* BLSP1 QUP5 I2C_SCL */
  370. .settings = {
  371. [GPIOMUX_ACTIVE] = &gpio_i2c_config,
  372. [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
  373. },
  374. },
  375. };
  376. /* Camera configurations */
  377. static struct gpiomux_setting gpio_suspend_config[] = {
  378. {
  379. .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
  380. .drv = GPIOMUX_DRV_2MA,
  381. .pull = GPIOMUX_PULL_NONE,
  382. },
  383. {
  384. .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
  385. .drv = GPIOMUX_DRV_2MA,
  386. .pull = GPIOMUX_PULL_NONE,
  387. .dir = GPIOMUX_OUT_LOW,
  388. },
  389. };
  390. static struct gpiomux_setting cam_settings[] = {
  391. {
  392. .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
  393. .drv = GPIOMUX_DRV_2MA,
  394. .pull = GPIOMUX_PULL_NONE,
  395. },
  396. {
  397. .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
  398. .drv = GPIOMUX_DRV_2MA,
  399. .pull = GPIOMUX_PULL_DOWN,
  400. },
  401. {
  402. .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
  403. .drv = GPIOMUX_DRV_2MA,
  404. .pull = GPIOMUX_PULL_KEEPER,
  405. },
  406. {
  407. .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
  408. .drv = GPIOMUX_DRV_2MA,
  409. .pull = GPIOMUX_PULL_NONE,
  410. .dir = GPIOMUX_OUT_LOW,
  411. },
  412. {
  413. .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
  414. .drv = GPIOMUX_DRV_2MA,
  415. .pull = GPIOMUX_PULL_DOWN,
  416. .dir = GPIOMUX_OUT_LOW,
  417. },
  418. {
  419. .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
  420. .drv = GPIOMUX_DRV_4MA,
  421. .pull = GPIOMUX_PULL_NONE,
  422. },
  423. {
  424. .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
  425. .drv = GPIOMUX_DRV_4MA,
  426. .pull = GPIOMUX_PULL_DOWN,
  427. },
  428. {
  429. .func = GPIOMUX_FUNC_GPIO, /*active 1*/ /* 0 */ //7 Haarika
  430. .drv = GPIOMUX_DRV_2MA,
  431. .pull = GPIOMUX_PULL_DOWN,
  432. .dir = GPIOMUX_IN,
  433. },
  434. {
  435. .func = GPIOMUX_FUNC_GPIO, /*suspend*/ /* 1 */ //8
  436. .drv = GPIOMUX_DRV_2MA,
  437. .pull = GPIOMUX_PULL_DOWN,
  438. .dir = GPIOMUX_IN,
  439. },
  440. {
  441. .func = GPIOMUX_FUNC_1, /*active 1*/ /* 9 */
  442. .drv = GPIOMUX_DRV_6MA,
  443. .pull = GPIOMUX_PULL_NONE,
  444. },
  445. {
  446. .func = GPIOMUX_FUNC_1, /*suspend*/ /* 10 */
  447. .drv = GPIOMUX_DRV_6MA,
  448. .pull = GPIOMUX_PULL_DOWN,
  449. },
  450. };
  451. static struct msm_gpiomux_config msm_csensor_configs[] __initdata = {
  452. {
  453. .gpio = 26, /* CAM_MCLK0 */
  454. .settings = {
  455. [GPIOMUX_ACTIVE] = &cam_settings[9],
  456. [GPIOMUX_SUSPENDED] = &cam_settings[10],
  457. },
  458. },
  459. {
  460. .gpio = 29, /* CCI_I2C_SDA0 */
  461. .settings = {
  462. [GPIOMUX_ACTIVE] = &cam_settings[0],
  463. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  464. },
  465. },
  466. {
  467. .gpio = 30, /* CCI_I2C_SCL0 */
  468. .settings = {
  469. [GPIOMUX_ACTIVE] = &cam_settings[0],
  470. [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
  471. },
  472. },
  473. {
  474. .gpio = 37, /* CAM1_RST_N */
  475. .settings = {
  476. [GPIOMUX_ACTIVE] = &cam_settings[3],
  477. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  478. },
  479. },
  480. {
  481. .gpio = 28, /* CAM2_RST_N */
  482. .settings = {
  483. [GPIOMUX_ACTIVE] = &cam_settings[3],
  484. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  485. },
  486. },
  487. {
  488. .gpio = 112, /* CAM_ANALOG_EN */
  489. .settings = {
  490. [GPIOMUX_ACTIVE] = &cam_settings[3],
  491. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  492. },
  493. },
  494. {
  495. .gpio = 114, /* CAM_IO_EN */
  496. .settings = {
  497. [GPIOMUX_ACTIVE] = &cam_settings[3],
  498. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  499. },
  500. },
  501. {
  502. .gpio = 34, /* AF_SDA */
  503. .settings = {
  504. [GPIOMUX_ACTIVE] = &cam_settings[3],
  505. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  506. },
  507. },
  508. {
  509. .gpio = 33, /* AF_SCL */
  510. .settings = {
  511. [GPIOMUX_ACTIVE] = &cam_settings[3],
  512. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  513. },
  514. },
  515. {
  516. .gpio = 32, /* FLASH_STROBE_TRIG */
  517. .settings = {
  518. [GPIOMUX_ACTIVE] = &cam_settings[3],
  519. [GPIOMUX_SUSPENDED] = &cam_settings[4],
  520. },
  521. },
  522. };
  523. /* Touch */
  524. static struct gpiomux_setting cypress_int_act_cfg = {
  525. .func = GPIOMUX_FUNC_GPIO,
  526. .drv = GPIOMUX_DRV_8MA,
  527. .pull = GPIOMUX_PULL_UP,
  528. };
  529. static struct gpiomux_setting cypress_int_sus_cfg = {
  530. .func = GPIOMUX_FUNC_GPIO,
  531. .drv = GPIOMUX_DRV_2MA,
  532. .pull = GPIOMUX_PULL_DOWN,
  533. };
  534. static struct msm_gpiomux_config msm_cypress_configs[] __initdata = {
  535. {
  536. .gpio = 17,
  537. .settings = {
  538. [GPIOMUX_ACTIVE] = &cypress_int_act_cfg,
  539. [GPIOMUX_SUSPENDED] = &cypress_int_sus_cfg,
  540. },
  541. },
  542. };
  543. static struct gpiomux_setting gpio_i2c_tkey_active_config = {
  544. .func = GPIOMUX_FUNC_GPIO,
  545. .drv = GPIOMUX_DRV_2MA,
  546. .pull = GPIOMUX_PULL_UP,
  547. };
  548. static struct gpiomux_setting gpio_i2c_tkey_suspend_config = {
  549. .func = GPIOMUX_FUNC_GPIO,
  550. .drv = GPIOMUX_DRV_2MA,
  551. .pull = GPIOMUX_PULL_UP,
  552. };
  553. static struct msm_gpiomux_config msm_keyboad_abov_configs[] __initdata = {
  554. {
  555. .gpio = 22, /* BLSP1 QUP1 SPI_DATA_MOSI */
  556. .settings = {
  557. [GPIOMUX_ACTIVE] = &gpio_i2c_tkey_active_config,
  558. [GPIOMUX_SUSPENDED] = &gpio_i2c_tkey_suspend_config,
  559. },
  560. },
  561. {
  562. .gpio = 23, /* BLSP1 QUP1 SPI_DATA_MISO */
  563. .settings = {
  564. [GPIOMUX_ACTIVE] = &gpio_i2c_tkey_active_config,
  565. [GPIOMUX_SUSPENDED] = &gpio_i2c_tkey_suspend_config,
  566. },
  567. },
  568. };
  569. /* EarJack configurations */
  570. static struct gpiomux_setting earjack_gpio_active_cfg = {
  571. .func = GPIOMUX_FUNC_GPIO, /*active 1*/ /* 0 */
  572. .drv = GPIOMUX_DRV_2MA,
  573. .pull = GPIOMUX_PULL_DOWN,
  574. .dir = GPIOMUX_IN,
  575. };
  576. static struct gpiomux_setting earjack_gpio_suspend_cfg = {
  577. .func = GPIOMUX_FUNC_GPIO, /*suspend*/ /* 1 */
  578. .drv = GPIOMUX_DRV_2MA,
  579. .pull = GPIOMUX_PULL_DOWN,
  580. .dir = GPIOMUX_IN,
  581. };
  582. static struct msm_gpiomux_config msm_earjack_gpio_configs[] __initdata = {
  583. {
  584. .gpio = 35, /* EAR_SWITCH */
  585. .settings = {
  586. [GPIOMUX_ACTIVE] = &earjack_gpio_active_cfg,
  587. [GPIOMUX_SUSPENDED] = &earjack_gpio_suspend_cfg,
  588. },
  589. }
  590. };
  591. #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
  592. static struct gpiomux_setting sdc3_clk_actv_cfg = {
  593. .func = GPIOMUX_FUNC_2,
  594. .drv = GPIOMUX_DRV_8MA,
  595. .pull = GPIOMUX_PULL_NONE,
  596. };
  597. static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
  598. .func = GPIOMUX_FUNC_2,
  599. .drv = GPIOMUX_DRV_8MA,
  600. .pull = GPIOMUX_PULL_UP,
  601. };
  602. static struct gpiomux_setting sdc3_suspend_cfg = {
  603. .func = GPIOMUX_FUNC_GPIO,
  604. .drv = GPIOMUX_DRV_2MA,
  605. .pull = GPIOMUX_PULL_DOWN,
  606. };
  607. static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
  608. .func = GPIOMUX_FUNC_GPIO,
  609. .drv = GPIOMUX_DRV_2MA,
  610. .pull = GPIOMUX_PULL_UP,
  611. };
  612. static struct msm_gpiomux_config msm8226_sdc3_configs[] __initdata = {
  613. {
  614. /* DAT3 */
  615. .gpio = 39,
  616. .settings = {
  617. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  618. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  619. },
  620. },
  621. {
  622. /* DAT2 */
  623. .gpio = 40,
  624. .settings = {
  625. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  626. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  627. },
  628. },
  629. {
  630. /* DAT1 */
  631. .gpio = 41,
  632. .settings = {
  633. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  634. [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
  635. },
  636. },
  637. {
  638. /* DAT0 */
  639. .gpio = 42,
  640. .settings = {
  641. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  642. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  643. },
  644. },
  645. {
  646. /* CMD */
  647. .gpio = 43,
  648. .settings = {
  649. [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
  650. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  651. },
  652. },
  653. {
  654. /* CLK */
  655. .gpio = 44,
  656. .settings = {
  657. [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
  658. [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
  659. },
  660. },
  661. };
  662. static void msm_gpiomux_sdc3_install(void)
  663. {
  664. msm_gpiomux_install(msm8226_sdc3_configs,
  665. ARRAY_SIZE(msm8226_sdc3_configs));
  666. }
  667. #else
  668. static void msm_gpiomux_sdc3_install(void) {}
  669. #endif /* CONFIG_MMC_MSM_SDC3_SUPPORT */
  670. /* TX_GTR_THRESH configurations */
  671. static struct gpiomux_setting tx_gtr_cfg = {
  672. .func = GPIOMUX_FUNC_GPIO,
  673. .drv = GPIOMUX_DRV_2MA,
  674. .pull = GPIOMUX_PULL_DOWN,
  675. .dir = GPIOMUX_OUT_LOW,
  676. };
  677. static struct msm_gpiomux_config msm8226_tx_gtr_configs[] __initdata = {
  678. {
  679. /* TX_GTR_THRESH */
  680. .gpio = 87,
  681. .settings = {
  682. [GPIOMUX_ACTIVE] = &tx_gtr_cfg,
  683. [GPIOMUX_SUSPENDED] = &tx_gtr_cfg,
  684. },
  685. },
  686. };
  687. /* MUIC configurations */
  688. static struct gpiomux_setting gpio_muic_config = {
  689. .func = GPIOMUX_FUNC_GPIO,
  690. .drv = GPIOMUX_DRV_2MA,
  691. .pull = GPIOMUX_PULL_NONE,
  692. .dir = GPIOMUX_IN,
  693. };
  694. static struct msm_gpiomux_config muic_configs[] __initdata = {
  695. {
  696. .gpio = 4,
  697. .settings = {
  698. [GPIOMUX_ACTIVE] = &gpio_muic_config,
  699. [GPIOMUX_SUSPENDED] = &gpio_muic_config,
  700. },
  701. },
  702. {
  703. .gpio = 5,
  704. .settings = {
  705. [GPIOMUX_ACTIVE] = &gpio_muic_config,
  706. [GPIOMUX_SUSPENDED] = &gpio_muic_config,
  707. },
  708. },
  709. };
  710. /* NC pin configurations */
  711. #define NC_GPIO_CONFIG(gpio_num) { \
  712. .gpio = gpio_num, \
  713. .settings = { \
  714. [GPIOMUX_ACTIVE] = &nc_active_cfg, \
  715. [GPIOMUX_SUSPENDED] = &nc_suspend_cfg, } \
  716. }
  717. static struct gpiomux_setting nc_active_cfg = {
  718. .func = GPIOMUX_FUNC_GPIO,
  719. .drv = GPIOMUX_DRV_2MA,
  720. .pull = GPIOMUX_PULL_DOWN,
  721. .dir = GPIOMUX_IN,
  722. };
  723. static struct gpiomux_setting nc_suspend_cfg = {
  724. .func = GPIOMUX_FUNC_GPIO,
  725. .drv = GPIOMUX_DRV_2MA,
  726. .pull = GPIOMUX_PULL_DOWN,
  727. .dir = GPIOMUX_IN,
  728. };
  729. static struct msm_gpiomux_config nc_gpio_cfgs[] __initdata = {
  730. NC_GPIO_CONFIG(60),
  731. NC_GPIO_CONFIG(75),
  732. NC_GPIO_CONFIG(76),
  733. NC_GPIO_CONFIG(77),
  734. NC_GPIO_CONFIG(78),
  735. NC_GPIO_CONFIG(79),
  736. NC_GPIO_CONFIG(80),
  737. NC_GPIO_CONFIG(81),
  738. NC_GPIO_CONFIG(82),
  739. NC_GPIO_CONFIG(83),
  740. NC_GPIO_CONFIG(84),
  741. NC_GPIO_CONFIG(85),
  742. NC_GPIO_CONFIG(86),
  743. NC_GPIO_CONFIG(88),
  744. NC_GPIO_CONFIG(89),
  745. NC_GPIO_CONFIG(90),
  746. NC_GPIO_CONFIG(91),
  747. NC_GPIO_CONFIG(92),
  748. NC_GPIO_CONFIG(93),
  749. NC_GPIO_CONFIG(94),
  750. NC_GPIO_CONFIG(97),
  751. NC_GPIO_CONFIG(98),
  752. NC_GPIO_CONFIG(103),
  753. NC_GPIO_CONFIG(104),
  754. NC_GPIO_CONFIG(110),
  755. NC_GPIO_CONFIG(115),
  756. NC_GPIO_CONFIG(116),
  757. NC_GPIO_CONFIG(117),
  758. NC_GPIO_CONFIG(119),
  759. NC_GPIO_CONFIG(120),
  760. };
  761. void __init msm8226_init_gpiomux(void)
  762. {
  763. int rc;
  764. rc = msm_gpiomux_init_dt();
  765. if (rc) {
  766. pr_err("%s failed %d\n", __func__, rc);
  767. return;
  768. }
  769. /* Keypad */
  770. msm_gpiomux_install(msm_keypad_configs,
  771. ARRAY_SIZE(msm_keypad_configs));
  772. /* HallSensors */
  773. msm_gpiomux_install(msm_hall_configs,
  774. ARRAY_SIZE(msm_hall_configs));
  775. /* BLSP */
  776. msm_gpiomux_install(msm_blsp_configs,
  777. ARRAY_SIZE(msm_blsp_configs));
  778. /* WCNSS */
  779. msm_gpiomux_install(wcnss_5wire_interface,
  780. ARRAY_SIZE(wcnss_5wire_interface));
  781. /* TX_GTR */
  782. msm_gpiomux_install(msm8226_tx_gtr_configs,
  783. ARRAY_SIZE(msm8226_tx_gtr_configs));
  784. /* LCD */
  785. msm_gpiomux_install_nowrite(msm_lcd_configs,
  786. ARRAY_SIZE(msm_lcd_configs));
  787. /* Camera */
  788. msm_gpiomux_install(msm_csensor_configs,
  789. ARRAY_SIZE(msm_csensor_configs));
  790. /* Touch */
  791. msm_gpiomux_install(msm_cypress_configs,
  792. ARRAY_SIZE(msm_cypress_configs));
  793. /* Touch Key */
  794. msm_gpiomux_install(msm_keyboad_abov_configs,
  795. ARRAY_SIZE(msm_keyboad_abov_configs));
  796. /* NFC */
  797. msm_gpiomux_install(msm_nfc_configs,
  798. ARRAY_SIZE(msm_nfc_configs));
  799. /* Sensors */
  800. msm_gpiomux_install(msm_sensors_configs,
  801. ARRAY_SIZE(msm_sensors_configs));
  802. /* SDCC3 */
  803. msm_gpiomux_sdc3_install();
  804. /* Earjack */
  805. msm_gpiomux_install(msm_earjack_gpio_configs,
  806. ARRAY_SIZE(msm_earjack_gpio_configs));
  807. /* MUIC */
  808. msm_gpiomux_install(muic_configs,
  809. ARRAY_SIZE(muic_configs));
  810. /* NC */
  811. msm_gpiomux_install(nc_gpio_cfgs, ARRAY_SIZE(nc_gpio_cfgs));
  812. }