blob: 4bd100d09d3bf41af1662cddb70554e82d6be413 [file] [log] [blame]
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07001/* Copyright (c) 2012, Code Aurora Forum. 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
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <mach/board.h>
17#include <mach/gpio.h>
18#include <mach/gpiomux.h>
Stepan Moskovchenko95108b82012-11-27 14:28:11 -080019#include <mach/socinfo.h>
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -070020
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070021#define KS8851_IRQ_GPIO 94
Sathish Ambleye3154b42012-04-09 10:59:09 -070022
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -070023static struct gpiomux_setting gpio_uart_config = {
24 .func = GPIOMUX_FUNC_2,
25 .drv = GPIOMUX_DRV_16MA,
26 .pull = GPIOMUX_PULL_NONE,
27 .dir = GPIOMUX_OUT_HIGH,
28};
29
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -060030static struct gpiomux_setting slimbus = {
31 .func = GPIOMUX_FUNC_1,
32 .drv = GPIOMUX_DRV_8MA,
33 .pull = GPIOMUX_PULL_KEEPER,
34};
35
Sathish Ambleye3154b42012-04-09 10:59:09 -070036#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
37static struct gpiomux_setting gpio_eth_config = {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070038 .pull = GPIOMUX_PULL_UP,
39 .drv = GPIOMUX_DRV_2MA,
Sathish Ambleye3154b42012-04-09 10:59:09 -070040 .func = GPIOMUX_FUNC_GPIO,
41};
42
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070043static struct gpiomux_setting gpio_spi_cs2_config = {
Sathish Ambleye3154b42012-04-09 10:59:09 -070044 .func = GPIOMUX_FUNC_4,
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070045 .drv = GPIOMUX_DRV_6MA,
46 .pull = GPIOMUX_PULL_DOWN,
Sathish Ambleye3154b42012-04-09 10:59:09 -070047};
48
49static struct gpiomux_setting gpio_spi_config = {
50 .func = GPIOMUX_FUNC_1,
51 .drv = GPIOMUX_DRV_12MA,
52 .pull = GPIOMUX_PULL_NONE,
53};
54
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -070055static struct gpiomux_setting gpio_spi_cs1_config = {
56 .func = GPIOMUX_FUNC_GPIO,
57 .drv = GPIOMUX_DRV_6MA,
58 .pull = GPIOMUX_PULL_UP,
59};
60
Sathish Ambleye3154b42012-04-09 10:59:09 -070061static struct msm_gpiomux_config msm_eth_configs[] = {
62 {
63 .gpio = KS8851_IRQ_GPIO,
64 .settings = {
65 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
66 }
67 },
68};
69#endif
Sameer Thalappil8d686d42012-08-24 10:07:31 -070070
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -080071static struct gpiomux_setting gpio_epm_config = {
72 .func = GPIOMUX_FUNC_GPIO,
73 .drv = GPIOMUX_DRV_2MA,
74 .pull = GPIOMUX_PULL_DOWN,
75};
76
Sameer Thalappil8d686d42012-08-24 10:07:31 -070077static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
78 .func = GPIOMUX_FUNC_GPIO,
79 .drv = GPIOMUX_DRV_2MA,
80 .pull = GPIOMUX_PULL_UP,
81};
82
83static struct gpiomux_setting wcnss_5wire_active_cfg = {
84 .func = GPIOMUX_FUNC_1,
85 .drv = GPIOMUX_DRV_6MA,
86 .pull = GPIOMUX_PULL_DOWN,
87};
88
Jin Honga04caaa2012-05-23 10:28:27 -070089static struct gpiomux_setting gpio_i2c_config = {
90 .func = GPIOMUX_FUNC_3,
91 .drv = GPIOMUX_DRV_8MA,
92 .pull = GPIOMUX_PULL_NONE,
93};
94
Chandan Uddaraju88b26d72012-08-13 22:28:44 -070095static struct gpiomux_setting lcd_en_act_cfg = {
96 .func = GPIOMUX_FUNC_GPIO,
97 .drv = GPIOMUX_DRV_8MA,
98 .pull = GPIOMUX_PULL_NONE,
99};
100
101static struct gpiomux_setting lcd_en_sus_cfg = {
102 .func = GPIOMUX_FUNC_GPIO,
103 .drv = GPIOMUX_DRV_2MA,
104 .pull = GPIOMUX_PULL_DOWN,
105};
Sathish Ambleye3154b42012-04-09 10:59:09 -0700106
Amy Maloche9e99a792012-08-15 23:27:51 -0700107static struct gpiomux_setting atmel_resout_sus_cfg = {
108 .func = GPIOMUX_FUNC_GPIO,
109 .drv = GPIOMUX_DRV_6MA,
110 .pull = GPIOMUX_PULL_DOWN,
111};
112
113static struct gpiomux_setting atmel_resout_act_cfg = {
114 .func = GPIOMUX_FUNC_GPIO,
115 .drv = GPIOMUX_DRV_6MA,
116 .pull = GPIOMUX_PULL_UP,
117};
118
119static struct gpiomux_setting atmel_int_act_cfg = {
120 .func = GPIOMUX_FUNC_GPIO,
121 .drv = GPIOMUX_DRV_8MA,
122 .pull = GPIOMUX_PULL_UP,
123};
124
125static struct gpiomux_setting atmel_int_sus_cfg = {
126 .func = GPIOMUX_FUNC_GPIO,
127 .drv = GPIOMUX_DRV_2MA,
128 .pull = GPIOMUX_PULL_DOWN,
129};
130
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700131static struct gpiomux_setting taiko_reset = {
132 .func = GPIOMUX_FUNC_GPIO,
133 .drv = GPIOMUX_DRV_6MA,
134 .pull = GPIOMUX_PULL_NONE,
135 .dir = GPIOMUX_OUT_LOW,
136};
137
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700138static struct gpiomux_setting taiko_int = {
139 .func = GPIOMUX_FUNC_GPIO,
140 .drv = GPIOMUX_DRV_2MA,
141 .pull = GPIOMUX_PULL_NONE,
142};
Amy Maloche527acc42012-12-07 18:40:54 -0800143static struct gpiomux_setting hap_lvl_shft_suspended_config = {
144 .func = GPIOMUX_FUNC_GPIO,
145 .drv = GPIOMUX_DRV_2MA,
146 .pull = GPIOMUX_PULL_DOWN,
147};
148
149static struct gpiomux_setting hap_lvl_shft_active_config = {
150 .func = GPIOMUX_FUNC_GPIO,
151 .drv = GPIOMUX_DRV_8MA,
152 .pull = GPIOMUX_PULL_UP,
153};
154static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
155 {
156 .gpio = 86,
157 .settings = {
158 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
159 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
160 },
161 },
162};
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700163
Amy Maloche9e99a792012-08-15 23:27:51 -0700164static struct msm_gpiomux_config msm_touch_configs[] __initdata = {
165 {
166 .gpio = 60, /* TOUCH RESET */
167 .settings = {
168 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
169 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
170 },
171 },
172 {
173 .gpio = 61, /* TOUCH IRQ */
174 .settings = {
175 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
176 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
177 },
178 },
179
180};
Ujwal Patel74b5df42012-08-13 22:50:13 -0700181
Manu Gautamac7265b2012-11-21 11:49:15 +0530182static struct gpiomux_setting hsic_sus_cfg = {
183 .func = GPIOMUX_FUNC_GPIO,
184 .drv = GPIOMUX_DRV_2MA,
185 .pull = GPIOMUX_PULL_DOWN,
186 .dir = GPIOMUX_OUT_LOW,
187};
188
189static struct gpiomux_setting hsic_act_cfg = {
190 .func = GPIOMUX_FUNC_1,
191 .drv = GPIOMUX_DRV_12MA,
192 .pull = GPIOMUX_PULL_NONE,
193};
194
195static struct gpiomux_setting hsic_hub_act_cfg = {
196 .func = GPIOMUX_FUNC_GPIO,
197 .drv = GPIOMUX_DRV_2MA,
198 .pull = GPIOMUX_PULL_UP,
199 .dir = GPIOMUX_IN,
200};
201
202static struct msm_gpiomux_config msm_hsic_configs[] = {
203 {
204 .gpio = 144, /*HSIC_STROBE */
205 .settings = {
206 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
207 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
208 },
209 },
210 {
211 .gpio = 145, /* HSIC_DATA */
212 .settings = {
213 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
214 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
215 },
216 },
217};
218
219static struct msm_gpiomux_config msm_hsic_hub_configs[] = {
220 {
221 .gpio = 50, /* HSIC_HUB_INT_N */
222 .settings = {
223 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
224 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
225 },
226 },
227};
228
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700229static struct gpiomux_setting mhl_suspend_config = {
230 .func = GPIOMUX_FUNC_GPIO,
231 .drv = GPIOMUX_DRV_2MA,
232 .pull = GPIOMUX_PULL_DOWN,
233};
234
235static struct gpiomux_setting mhl_active_1_cfg = {
236 .func = GPIOMUX_FUNC_1,
237 .drv = GPIOMUX_DRV_2MA,
238 .pull = GPIOMUX_PULL_UP,
239 .dir = GPIOMUX_OUT_HIGH,
240};
241
242static struct gpiomux_setting mhl_active_2_cfg = {
243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_2MA,
245 .pull = GPIOMUX_PULL_UP,
246};
247
Ujwal Patel74b5df42012-08-13 22:50:13 -0700248static struct gpiomux_setting hdmi_suspend_cfg = {
249 .func = GPIOMUX_FUNC_GPIO,
250 .drv = GPIOMUX_DRV_2MA,
251 .pull = GPIOMUX_PULL_DOWN,
252};
253
254static struct gpiomux_setting hdmi_active_1_cfg = {
255 .func = GPIOMUX_FUNC_1,
256 .drv = GPIOMUX_DRV_2MA,
257 .pull = GPIOMUX_PULL_UP,
258};
259
260static struct gpiomux_setting hdmi_active_2_cfg = {
261 .func = GPIOMUX_FUNC_1,
262 .drv = GPIOMUX_DRV_16MA,
263 .pull = GPIOMUX_PULL_DOWN,
264};
265
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700266static struct msm_gpiomux_config msm_mhl_configs[] __initdata = {
267 {
268 /* mhl-sii8334 pwr */
269 .gpio = 12,
270 .settings = {
271 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
272 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
273 },
274 },
275 {
276 /* mhl-sii8334 intr */
277 .gpio = 82,
278 .settings = {
279 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
280 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
281 },
282 },
283 {
284 /* mhl-sii8334 reset */
285 .gpio = 8,
286 .settings = {
287 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
288 [GPIOMUX_ACTIVE] = &mhl_active_2_cfg,
289 },
290 },
291};
292
293
Ujwal Patel74b5df42012-08-13 22:50:13 -0700294static struct msm_gpiomux_config msm_hdmi_configs[] __initdata = {
295 {
296 .gpio = 31,
297 .settings = {
298 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
299 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
300 },
301 },
302 {
303 .gpio = 32,
304 .settings = {
305 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
306 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
307 },
308 },
309 {
310 .gpio = 33,
311 .settings = {
312 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
313 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
314 },
315 },
316 {
317 .gpio = 34,
318 .settings = {
319 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
320 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
321 },
322 },
323};
324
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800325static struct msm_gpiomux_config msm_rumi_blsp_configs[] __initdata = {
326 {
327 .gpio = 45, /* BLSP2 UART8 TX */
328 .settings = {
329 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
330 },
331 },
332 {
333 .gpio = 46, /* BLSP2 UART8 RX */
334 .settings = {
335 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
336 },
337 },
338};
339
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700340static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
Sathish Ambleye3154b42012-04-09 10:59:09 -0700341#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
342 {
343 .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */
344 .settings = {
345 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
346 },
347 },
348 {
349 .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */
350 .settings = {
351 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
352 },
353 },
354 {
355 .gpio = 3, /* BLSP1 QUP SPI_CLK */
356 .settings = {
357 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
358 },
359 },
360 {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700361 .gpio = 9, /* BLSP1 QUP SPI_CS2A_N */
Sathish Ambleye3154b42012-04-09 10:59:09 -0700362 .settings = {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700363 [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config,
364 },
365 },
366 {
367 .gpio = 8, /* BLSP1 QUP SPI_CS1_N */
368 .settings = {
369 [GPIOMUX_SUSPENDED] = &gpio_spi_cs1_config,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700370 },
371 },
372#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700373 {
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700374 .gpio = 58,
375 .settings = {
376 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
377 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
378 },
379 },
380 {
Amy Malochebc7e9672012-08-15 10:30:40 -0700381 .gpio = 6, /* BLSP1 QUP2 I2C_DAT */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
384 },
385 },
386 {
387 .gpio = 7, /* BLSP1 QUP2 I2C_CLK */
388 .settings = {
389 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
390 },
391 },
392 {
Jin Honga04caaa2012-05-23 10:28:27 -0700393 .gpio = 83, /* BLSP11 QUP I2C_DAT */
394 .settings = {
395 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
396 },
397 },
398 {
399 .gpio = 84, /* BLSP11 QUP I2C_CLK */
400 .settings = {
401 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
402 },
403 },
404 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700405 .gpio = 4, /* BLSP2 UART TX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700406 .settings = {
407 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
408 },
409 },
410 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700411 .gpio = 5, /* BLSP2 UART RX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700412 .settings = {
413 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
414 },
415 },
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600416 {
417 .gpio = 53, /* BLSP2 QUP4 SPI_DATA_MOSI */
418 .settings = {
419 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
420 },
421 },
422 {
423 .gpio = 54, /* BLSP2 QUP4 SPI_DATA_MISO */
424 .settings = {
425 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
426 },
427 },
428 {
429 .gpio = 56, /* BLSP2 QUP4 SPI_CLK */
430 .settings = {
431 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
432 },
433 },
434 {
435 .gpio = 55, /* BLSP2 QUP4 SPI_CS0_N */
436 .settings = {
437 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
438 },
439 },
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -0800440 {
441 .gpio = 81, /* EPM enable */
442 .settings = {
443 [GPIOMUX_SUSPENDED] = &gpio_epm_config,
444 },
445 },
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700446};
447
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600448static struct msm_gpiomux_config msm8974_slimbus_config[] __initdata = {
449 {
450 .gpio = 70, /* slimbus clk */
451 .settings = {
452 [GPIOMUX_SUSPENDED] = &slimbus,
453 },
454 },
455 {
456 .gpio = 71, /* slimbus data */
457 .settings = {
458 [GPIOMUX_SUSPENDED] = &slimbus,
459 },
460 },
461};
462
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700463static struct gpiomux_setting cam_settings[] = {
464 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700465 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700466 .drv = GPIOMUX_DRV_2MA,
467 .pull = GPIOMUX_PULL_NONE,
468 },
469
470 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700471 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700472 .drv = GPIOMUX_DRV_2MA,
473 .pull = GPIOMUX_PULL_DOWN,
474 },
475
476 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700477 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700478 .drv = GPIOMUX_DRV_2MA,
479 .pull = GPIOMUX_PULL_KEEPER,
480 },
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700481
482 {
483 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
484 .drv = GPIOMUX_DRV_2MA,
485 .pull = GPIOMUX_PULL_NONE,
486 },
487
488 {
489 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
490 .drv = GPIOMUX_DRV_2MA,
491 .pull = GPIOMUX_PULL_DOWN,
492 },
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700493};
494
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530495static struct gpiomux_setting sd_card_det_config = {
496 .func = GPIOMUX_FUNC_GPIO,
497 .drv = GPIOMUX_DRV_2MA,
498 .pull = GPIOMUX_PULL_NONE,
499 .dir = GPIOMUX_IN,
500};
501
502static struct msm_gpiomux_config sd_card_det __initdata = {
503 .gpio = 62,
504 .settings = {
505 [GPIOMUX_ACTIVE] = &sd_card_det_config,
506 [GPIOMUX_SUSPENDED] = &sd_card_det_config,
507 },
508};
509
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700510static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
511 {
512 .gpio = 15, /* CAM_MCLK0 */
513 .settings = {
514 [GPIOMUX_ACTIVE] = &cam_settings[0],
515 [GPIOMUX_SUSPENDED] = &cam_settings[1],
516 },
517 },
518 {
519 .gpio = 16, /* CAM_MCLK1 */
520 .settings = {
521 [GPIOMUX_ACTIVE] = &cam_settings[0],
522 [GPIOMUX_SUSPENDED] = &cam_settings[1],
523 },
524 },
525 {
526 .gpio = 17, /* CAM_MCLK2 */
527 .settings = {
528 [GPIOMUX_ACTIVE] = &cam_settings[0],
529 [GPIOMUX_SUSPENDED] = &cam_settings[1],
530 },
531 },
532 {
533 .gpio = 18, /* WEBCAM1_RESET_N / CAM_MCLK3 */
534 .settings = {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700535 [GPIOMUX_ACTIVE] = &cam_settings[3],
536 [GPIOMUX_SUSPENDED] = &cam_settings[4],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700537 },
538 },
539 {
540 .gpio = 19, /* CCI_I2C_SDA0 */
541 .settings = {
542 [GPIOMUX_ACTIVE] = &cam_settings[0],
543 [GPIOMUX_SUSPENDED] = &cam_settings[2],
544 },
545 },
546 {
547 .gpio = 20, /* CCI_I2C_SCL0 */
548 .settings = {
549 [GPIOMUX_ACTIVE] = &cam_settings[0],
550 [GPIOMUX_SUSPENDED] = &cam_settings[2],
551 },
552 },
553 {
554 .gpio = 21, /* CCI_I2C_SDA1 */
555 .settings = {
556 [GPIOMUX_ACTIVE] = &cam_settings[0],
557 [GPIOMUX_SUSPENDED] = &cam_settings[2],
558 },
559 },
560 {
561 .gpio = 22, /* CCI_I2C_SCL1 */
562 .settings = {
563 [GPIOMUX_ACTIVE] = &cam_settings[0],
564 [GPIOMUX_SUSPENDED] = &cam_settings[2],
565 },
566 },
567 {
568 .gpio = 23, /* FLASH_LED_EN */
569 .settings = {
570 [GPIOMUX_ACTIVE] = &cam_settings[0],
571 [GPIOMUX_SUSPENDED] = &cam_settings[1],
572 },
573 },
574 {
575 .gpio = 24, /* FLASH_LED_NOW */
576 .settings = {
577 [GPIOMUX_ACTIVE] = &cam_settings[0],
578 [GPIOMUX_SUSPENDED] = &cam_settings[1],
579 },
580 },
581 {
582 .gpio = 25, /* WEBCAM2_RESET_N */
583 .settings = {
584 [GPIOMUX_ACTIVE] = &cam_settings[0],
585 [GPIOMUX_SUSPENDED] = &cam_settings[1],
586 },
587 },
588 {
589 .gpio = 26, /* CAM_IRQ */
590 .settings = {
591 [GPIOMUX_ACTIVE] = &cam_settings[0],
592 [GPIOMUX_SUSPENDED] = &cam_settings[1],
593 },
594 },
595 {
596 .gpio = 27, /* OIS_SYNC */
597 .settings = {
598 [GPIOMUX_ACTIVE] = &cam_settings[0],
599 [GPIOMUX_SUSPENDED] = &cam_settings[1],
600 },
601 },
602 {
603 .gpio = 28, /* WEBCAM1_STANDBY */
604 .settings = {
605 [GPIOMUX_ACTIVE] = &cam_settings[0],
606 [GPIOMUX_SUSPENDED] = &cam_settings[1],
607 },
608 },
609 {
610 .gpio = 89, /* CAM1_STANDBY_N */
611 .settings = {
612 [GPIOMUX_ACTIVE] = &cam_settings[0],
613 [GPIOMUX_SUSPENDED] = &cam_settings[1],
614 },
615 },
616 {
617 .gpio = 90, /* CAM1_RST_N */
618 .settings = {
619 [GPIOMUX_ACTIVE] = &cam_settings[0],
620 [GPIOMUX_SUSPENDED] = &cam_settings[1],
621 },
622 },
623 {
624 .gpio = 91, /* CAM2_STANDBY_N */
625 .settings = {
626 [GPIOMUX_ACTIVE] = &cam_settings[0],
627 [GPIOMUX_SUSPENDED] = &cam_settings[1],
628 },
629 },
630 {
631 .gpio = 92, /* CAM2_RST_N */
632 .settings = {
633 [GPIOMUX_ACTIVE] = &cam_settings[0],
634 [GPIOMUX_SUSPENDED] = &cam_settings[1],
635 },
636 },
637};
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700638static struct msm_gpiomux_config wcnss_5wire_interface[] = {
639 {
640 .gpio = 36,
641 .settings = {
642 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
643 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
644 },
645 },
646 {
647 .gpio = 37,
648 .settings = {
649 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
650 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
651 },
652 },
653 {
654 .gpio = 38,
655 .settings = {
656 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
657 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
658 },
659 },
660 {
661 .gpio = 39,
662 .settings = {
663 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
664 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
665 },
666 },
667 {
668 .gpio = 40,
669 .settings = {
670 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
671 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
672 },
673 },
674};
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700675
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700676static struct msm_gpiomux_config msm_taiko_config[] __initdata = {
677 {
678 .gpio = 63, /* SYS_RST_N */
679 .settings = {
680 [GPIOMUX_SUSPENDED] = &taiko_reset,
681 },
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700682 },
683 {
684 .gpio = 72, /* CDC_INT */
685 .settings = {
686 [GPIOMUX_SUSPENDED] = &taiko_int,
687 },
688 },
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700689};
690
Subhash Jadavani102f0ce2012-12-14 21:25:59 +0530691#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
692static struct gpiomux_setting sdc3_clk_actv_cfg = {
693 .func = GPIOMUX_FUNC_2,
694 .drv = GPIOMUX_DRV_8MA,
695 .pull = GPIOMUX_PULL_NONE,
696};
697
698static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
699 .func = GPIOMUX_FUNC_2,
700 .drv = GPIOMUX_DRV_8MA,
701 .pull = GPIOMUX_PULL_UP,
702};
703
704static struct gpiomux_setting sdc3_suspend_cfg = {
705 .func = GPIOMUX_FUNC_GPIO,
706 .drv = GPIOMUX_DRV_2MA,
707 .pull = GPIOMUX_PULL_DOWN,
708};
709
710static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
711 .func = GPIOMUX_FUNC_GPIO,
712 .drv = GPIOMUX_DRV_8MA,
713 .pull = GPIOMUX_PULL_UP,
714};
715
716static struct msm_gpiomux_config msm8974_sdc3_configs[] __initdata = {
717 {
718 /* DAT3 */
719 .gpio = 35,
720 .settings = {
721 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
722 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
723 },
724 },
725 {
726 /* DAT2 */
727 .gpio = 36,
728 .settings = {
729 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
730 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
731 },
732 },
733 {
734 /* DAT1 */
735 .gpio = 37,
736 .settings = {
737 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
738 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
739 },
740 },
741 {
742 /* DAT0 */
743 .gpio = 38,
744 .settings = {
745 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
746 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
747 },
748 },
749 {
750 /* CMD */
751 .gpio = 39,
752 .settings = {
753 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
754 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
755 },
756 },
757 {
758 /* CLK */
759 .gpio = 40,
760 .settings = {
761 [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
762 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
763 },
764 },
765};
766
767static void msm_gpiomux_sdc3_install(void)
768{
769 msm_gpiomux_install(msm8974_sdc3_configs,
770 ARRAY_SIZE(msm8974_sdc3_configs));
771}
772#else
773static void msm_gpiomux_sdc3_install(void) {}
774#endif /* CONFIG_MMC_MSM_SDC3_SUPPORT */
775
776#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
777static struct gpiomux_setting sdc4_clk_actv_cfg = {
778 .func = GPIOMUX_FUNC_2,
779 .drv = GPIOMUX_DRV_8MA,
780 .pull = GPIOMUX_PULL_NONE,
781};
782
783static struct gpiomux_setting sdc4_cmd_data_0_3_actv_cfg = {
784 .func = GPIOMUX_FUNC_2,
785 .drv = GPIOMUX_DRV_8MA,
786 .pull = GPIOMUX_PULL_UP,
787};
788
789static struct gpiomux_setting sdc4_suspend_cfg = {
790 .func = GPIOMUX_FUNC_GPIO,
791 .drv = GPIOMUX_DRV_2MA,
792 .pull = GPIOMUX_PULL_DOWN,
793};
794
795static struct gpiomux_setting sdc4_data_1_suspend_cfg = {
796 .func = GPIOMUX_FUNC_GPIO,
797 .drv = GPIOMUX_DRV_8MA,
798 .pull = GPIOMUX_PULL_UP,
799};
800
801static struct msm_gpiomux_config msm8974_sdc4_configs[] __initdata = {
802 {
803 /* DAT3 */
804 .gpio = 92,
805 .settings = {
806 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
807 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
808 },
809 },
810 {
811 /* DAT2 */
812 .gpio = 94,
813 .settings = {
814 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
815 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
816 },
817 },
818 {
819 /* DAT1 */
820 .gpio = 95,
821 .settings = {
822 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
823 [GPIOMUX_SUSPENDED] = &sdc4_data_1_suspend_cfg,
824 },
825 },
826 {
827 /* DAT0 */
828 .gpio = 96,
829 .settings = {
830 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
831 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
832 },
833 },
834 {
835 /* CMD */
836 .gpio = 91,
837 .settings = {
838 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
839 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
840 },
841 },
842 {
843 /* CLK */
844 .gpio = 93,
845 .settings = {
846 [GPIOMUX_ACTIVE] = &sdc4_clk_actv_cfg,
847 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
848 },
849 },
850};
851
852static void msm_gpiomux_sdc4_install(void)
853{
854 msm_gpiomux_install(msm8974_sdc4_configs,
855 ARRAY_SIZE(msm8974_sdc4_configs));
856}
857#else
858static void msm_gpiomux_sdc4_install(void) {}
859#endif /* CONFIG_MMC_MSM_SDC4_SUPPORT */
860
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700861void __init msm_8974_init_gpiomux(void)
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700862{
863 int rc;
864
865 rc = msm_gpiomux_init(NR_GPIO_IRQS);
866 if (rc) {
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700867 pr_err(KERN_ERR "msm_8974_init_gpiomux failed %d\n", rc);
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700868 return;
869 }
870
Sathish Ambleye3154b42012-04-09 10:59:09 -0700871#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
872 msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
873#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700874 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700875 msm_gpiomux_install(wcnss_5wire_interface,
876 ARRAY_SIZE(wcnss_5wire_interface));
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600877
878 msm_gpiomux_install(msm8974_slimbus_config,
879 ARRAY_SIZE(msm8974_slimbus_config));
880
Amy Maloche9e99a792012-08-15 23:27:51 -0700881 msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));
Amy Maloche527acc42012-12-07 18:40:54 -0800882 msm_gpiomux_install(hap_lvl_shft_config,
883 ARRAY_SIZE(hap_lvl_shft_config));
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700884
885 msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700886
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530887 msm_gpiomux_install(&sd_card_det, 1);
Subhash Jadavani102f0ce2012-12-14 21:25:59 +0530888 msm_gpiomux_sdc3_install();
889 msm_gpiomux_sdc4_install();
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530890
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700891 msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));
Ujwal Patel74b5df42012-08-13 22:50:13 -0700892
Manu Gautamac7265b2012-11-21 11:49:15 +0530893 msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));
894 msm_gpiomux_install(msm_hsic_hub_configs,
895 ARRAY_SIZE(msm_hsic_hub_configs));
896
Ujwal Patel74b5df42012-08-13 22:50:13 -0700897 msm_gpiomux_install(msm_hdmi_configs, ARRAY_SIZE(msm_hdmi_configs));
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700898 msm_gpiomux_install(msm_mhl_configs, ARRAY_SIZE(msm_mhl_configs));
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800899
900 if (machine_is_msm8974_rumi())
901 msm_gpiomux_install(msm_rumi_blsp_configs,
902 ARRAY_SIZE(msm_rumi_blsp_configs));
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700903}