blob: 7702d008cd7a1d3e719133d9580dd1bd39a1b5fe [file] [log] [blame]
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -08002 *
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
Steve Mucklef132c6c2012-06-06 18:30:57 -070014#include <linux/gpio.h>
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080015#include <asm/mach-types.h>
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080016#include <mach/gpiomux.h>
17#include <mach/socinfo.h>
18#include "devices.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080019#include "board-8930.h"
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080020
21/* The SPI configurations apply to GSBI 1*/
22static struct gpiomux_setting spi_active = {
23 .func = GPIOMUX_FUNC_1,
24 .drv = GPIOMUX_DRV_12MA,
25 .pull = GPIOMUX_PULL_NONE,
26};
27
28static struct gpiomux_setting spi_suspended_config = {
29 .func = GPIOMUX_FUNC_GPIO,
30 .drv = GPIOMUX_DRV_2MA,
31 .pull = GPIOMUX_PULL_DOWN,
32};
33
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080034static struct gpiomux_setting gsbi3_suspended_cfg = {
35 .func = GPIOMUX_FUNC_1,
36 .drv = GPIOMUX_DRV_2MA,
37 .pull = GPIOMUX_PULL_KEEPER,
38};
39
40static struct gpiomux_setting gsbi3_active_cfg = {
41 .func = GPIOMUX_FUNC_1,
42 .drv = GPIOMUX_DRV_8MA,
43 .pull = GPIOMUX_PULL_NONE,
44};
45
46static struct gpiomux_setting gsbi5 = {
47 .func = GPIOMUX_FUNC_1,
48 .drv = GPIOMUX_DRV_8MA,
49 .pull = GPIOMUX_PULL_NONE,
50};
51
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -060052static struct gpiomux_setting gsbi9 = {
53 .func = GPIOMUX_FUNC_2,
54 .drv = GPIOMUX_DRV_8MA,
55 .pull = GPIOMUX_PULL_NONE,
56};
57
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080058static struct gpiomux_setting gsbi10 = {
59 .func = GPIOMUX_FUNC_2,
60 .drv = GPIOMUX_DRV_8MA,
61 .pull = GPIOMUX_PULL_NONE,
62};
63
64static struct gpiomux_setting gsbi12 = {
65 .func = GPIOMUX_FUNC_1,
66 .drv = GPIOMUX_DRV_8MA,
67 .pull = GPIOMUX_PULL_NONE,
68};
69
70static struct gpiomux_setting cdc_mclk = {
71 .func = GPIOMUX_FUNC_1,
72 .drv = GPIOMUX_DRV_8MA,
73 .pull = GPIOMUX_PULL_NONE,
74};
75
76static struct gpiomux_setting audio_auxpcm[] = {
77 /* Suspended state */
78 {
79 .func = GPIOMUX_FUNC_GPIO,
80 .drv = GPIOMUX_DRV_2MA,
81 .pull = GPIOMUX_PULL_NONE,
82 },
83 /* Active state */
84 {
85 .func = GPIOMUX_FUNC_1,
86 .drv = GPIOMUX_DRV_2MA,
87 .pull = GPIOMUX_PULL_NONE,
88 },
89};
90
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -070091static struct gpiomux_setting audio_mbhc = {
92 .func = GPIOMUX_FUNC_GPIO,
93 .drv = GPIOMUX_DRV_8MA,
94 .pull = GPIOMUX_PULL_NONE,
95};
96
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -070097static struct gpiomux_setting audio_spkr_boost = {
98 .func = GPIOMUX_FUNC_GPIO,
99 .drv = GPIOMUX_DRV_8MA,
100 .pull = GPIOMUX_PULL_NONE,
101};
102
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800103#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
104static struct gpiomux_setting gpio_eth_config = {
105 .pull = GPIOMUX_PULL_NONE,
106 .drv = GPIOMUX_DRV_8MA,
107 .func = GPIOMUX_FUNC_GPIO,
108};
109#endif
110
111static struct gpiomux_setting slimbus = {
112 .func = GPIOMUX_FUNC_1,
113 .drv = GPIOMUX_DRV_8MA,
114 .pull = GPIOMUX_PULL_KEEPER,
115};
116
117static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
118 .func = GPIOMUX_FUNC_GPIO,
119 .drv = GPIOMUX_DRV_2MA,
120 .pull = GPIOMUX_PULL_UP,
121};
122
123static struct gpiomux_setting wcnss_5wire_active_cfg = {
124 .func = GPIOMUX_FUNC_1,
125 .drv = GPIOMUX_DRV_6MA,
126 .pull = GPIOMUX_PULL_DOWN,
127};
128
Amy Malochef3c9db42011-12-08 15:17:35 -0800129static struct gpiomux_setting atmel_resout_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800130 .func = GPIOMUX_FUNC_GPIO,
131 .drv = GPIOMUX_DRV_6MA,
132 .pull = GPIOMUX_PULL_DOWN,
133};
134
Amy Malochef3c9db42011-12-08 15:17:35 -0800135static struct gpiomux_setting atmel_resout_act_cfg = {
136 .func = GPIOMUX_FUNC_GPIO,
137 .drv = GPIOMUX_DRV_6MA,
138 .pull = GPIOMUX_PULL_UP,
139};
140
141static struct gpiomux_setting atmel_ldo_en_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800142 .func = GPIOMUX_FUNC_GPIO,
143 .drv = GPIOMUX_DRV_6MA,
144 .pull = GPIOMUX_PULL_DOWN,
145};
146
Amy Malochef3c9db42011-12-08 15:17:35 -0800147static struct gpiomux_setting atmel_ldo_en_act_cfg = {
148 .func = GPIOMUX_FUNC_GPIO,
149 .drv = GPIOMUX_DRV_6MA,
150 .pull = GPIOMUX_PULL_DOWN,
151};
152
153static struct gpiomux_setting atmel_int_act_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800154 .func = GPIOMUX_FUNC_GPIO,
155 .drv = GPIOMUX_DRV_8MA,
156 .pull = GPIOMUX_PULL_UP,
157};
158
Amy Malochef3c9db42011-12-08 15:17:35 -0800159static struct gpiomux_setting atmel_int_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800160 .func = GPIOMUX_FUNC_GPIO,
161 .drv = GPIOMUX_DRV_2MA,
162 .pull = GPIOMUX_PULL_DOWN,
163};
Mayank Ranabf5084a2011-12-12 17:06:54 +0530164#ifdef MSM8930_PHASE_2
Mayank Ranabf5084a2011-12-12 17:06:54 +0530165static struct gpiomux_setting hsusb_sus_cfg = {
166 .func = GPIOMUX_FUNC_GPIO,
167 .drv = GPIOMUX_DRV_2MA,
David Keitelc72d8192012-01-09 11:33:55 -0800168 .pull = GPIOMUX_PULL_NONE,
169 .dir = GPIOMUX_OUT_LOW,
Mayank Ranabf5084a2011-12-12 17:06:54 +0530170};
171static struct msm_gpiomux_config msm8930_hsusb_configs[] = {
172 {
173 .gpio = 63, /* HSUSB_EXTERNAL_5V_LDO_EN */
174 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530175 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
176 },
177 },
178 {
179 .gpio = 97, /* HSUSB_5V_EN */
180 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530181 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
182 },
183 },
184};
185#endif
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800186
187static struct gpiomux_setting hap_lvl_shft_suspended_config = {
188 .func = GPIOMUX_FUNC_GPIO,
189 .drv = GPIOMUX_DRV_2MA,
190 .pull = GPIOMUX_PULL_DOWN,
191};
192
193static struct gpiomux_setting hap_lvl_shft_active_config = {
194 .func = GPIOMUX_FUNC_GPIO,
195 .drv = GPIOMUX_DRV_8MA,
196 .pull = GPIOMUX_PULL_UP,
197};
198
199static struct gpiomux_setting ap2mdm_cfg = {
200 .func = GPIOMUX_FUNC_GPIO,
201 .drv = GPIOMUX_DRV_8MA,
202 .pull = GPIOMUX_PULL_DOWN,
203};
204
205static struct gpiomux_setting mdm2ap_status_cfg = {
206 .func = GPIOMUX_FUNC_GPIO,
207 .drv = GPIOMUX_DRV_8MA,
208 .pull = GPIOMUX_PULL_NONE,
209};
210
211static struct gpiomux_setting mdm2ap_errfatal_cfg = {
212 .func = GPIOMUX_FUNC_GPIO,
213 .drv = GPIOMUX_DRV_16MA,
214 .pull = GPIOMUX_PULL_DOWN,
215};
216
217static struct gpiomux_setting ap2mdm_kpdpwr_n_cfg = {
218 .func = GPIOMUX_FUNC_GPIO,
219 .drv = GPIOMUX_DRV_8MA,
220 .pull = GPIOMUX_PULL_NONE,
221};
222
223static struct gpiomux_setting mdp_vsync_suspend_cfg = {
224 .func = GPIOMUX_FUNC_GPIO,
225 .drv = GPIOMUX_DRV_2MA,
226 .pull = GPIOMUX_PULL_DOWN,
227};
228
229static struct gpiomux_setting mdp_vsync_active_cfg = {
230 .func = GPIOMUX_FUNC_1,
231 .drv = GPIOMUX_DRV_2MA,
232 .pull = GPIOMUX_PULL_DOWN,
233};
234
235#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
236static struct gpiomux_setting hdmi_suspend_cfg = {
237 .func = GPIOMUX_FUNC_GPIO,
238 .drv = GPIOMUX_DRV_2MA,
239 .pull = GPIOMUX_PULL_DOWN,
240};
241
242static struct gpiomux_setting hdmi_active_1_cfg = {
243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_2MA,
245 .pull = GPIOMUX_PULL_UP,
246};
247
248static struct gpiomux_setting hdmi_active_2_cfg = {
249 .func = GPIOMUX_FUNC_1,
250 .drv = GPIOMUX_DRV_2MA,
251 .pull = GPIOMUX_PULL_DOWN,
252};
Manoj Raoc6d904c2012-06-22 00:32:14 -0700253
254static struct gpiomux_setting hdmi_active_3_cfg = {
255 .func = GPIOMUX_FUNC_GPIO,
256 .drv = GPIOMUX_DRV_2MA,
257 .pull = GPIOMUX_PULL_UP,
258 .dir = GPIOMUX_IN,
259};
260
261static struct gpiomux_setting hdmi_active_4_cfg = {
262 .func = GPIOMUX_FUNC_GPIO,
263 .drv = GPIOMUX_DRV_2MA,
264 .pull = GPIOMUX_PULL_UP,
265 .dir = GPIOMUX_OUT_HIGH,
266};
267
268static struct gpiomux_setting hdmi_active_5_cfg = {
269 .func = GPIOMUX_FUNC_GPIO,
270 .drv = GPIOMUX_DRV_2MA,
271 .pull = GPIOMUX_PULL_UP,
272 .dir = GPIOMUX_OUT_HIGH,
273};
274
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800275#endif
276
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700277static struct gpiomux_setting sitar_reset = {
278 .func = GPIOMUX_FUNC_GPIO,
279 .drv = GPIOMUX_DRV_6MA,
280 .pull = GPIOMUX_PULL_NONE,
281 .dir = GPIOMUX_OUT_LOW,
282};
283
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800284#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
285static struct msm_gpiomux_config msm8960_ethernet_configs[] = {
286 {
287 .gpio = 90,
288 .settings = {
289 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
290 }
291 },
292 {
293 .gpio = 89,
294 .settings = {
295 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
296 }
297 },
298};
299#endif
300
301static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
302 {
303 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
304 .settings = {
305 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
306 [GPIOMUX_ACTIVE] = &spi_active,
307 },
308 },
309 {
310 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
313 [GPIOMUX_ACTIVE] = &spi_active,
314 },
315 },
316 {
317 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
318 .settings = {
319 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
320 [GPIOMUX_ACTIVE] = &spi_active,
321 },
322 },
323 {
324 .gpio = 9, /* GSBI1 QUP SPI_CLK */
325 .settings = {
326 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
327 [GPIOMUX_ACTIVE] = &spi_active,
328 },
329 },
330 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800331 .gpio = 16, /* GSBI3 I2C QUP SDA */
332 .settings = {
333 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
334 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
335 },
336 },
337 {
338 .gpio = 17, /* GSBI3 I2C QUP SCL */
339 .settings = {
340 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
341 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
342 },
343 },
344 {
345 .gpio = 22, /* GSBI5 UART2 */
346 .settings = {
347 [GPIOMUX_SUSPENDED] = &gsbi5,
348 },
349 },
350 {
351 .gpio = 23, /* GSBI5 UART2 */
352 .settings = {
353 [GPIOMUX_SUSPENDED] = &gsbi5,
354 },
355 },
356 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800357 .gpio = 44, /* GSBI12 I2C QUP SDA */
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &gsbi12,
360 },
361 },
362 {
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -0600363 .gpio = 95, /* GSBI9 I2C QUP SDA */
364 .settings = {
365 [GPIOMUX_SUSPENDED] = &gsbi9,
366 },
367 },
368 {
369 .gpio = 96, /* GSBI12 I2C QUP SCL */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &gsbi9,
372 },
373 },
374 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800375 .gpio = 45, /* GSBI12 I2C QUP SCL */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &gsbi12,
378 },
379 },
380 {
381 .gpio = 73, /* GSBI10 I2C QUP SDA */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &gsbi10,
384 },
385 },
386 {
387 .gpio = 74, /* GSBI10 I2C QUP SCL */
388 .settings = {
389 [GPIOMUX_SUSPENDED] = &gsbi10,
390 },
391 },
392};
393
394static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
395 {
396 .gpio = 60, /* slimbus data */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &slimbus,
399 },
400 },
401 {
402 .gpio = 61, /* slimbus clk */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &slimbus,
405 },
406 },
407};
408
409static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
410 {
411 .gpio = 59,
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &cdc_mclk,
414 },
415 },
416};
417
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700418static struct msm_gpiomux_config msm8960_audio_mbhc_configs[] __initdata = {
419 {
420 .gpio = 37,
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &audio_mbhc,
423 },
424 },
425};
426
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700427static struct msm_gpiomux_config msm8960_audio_spkr_configs[] __initdata = {
428 {
429 .gpio = 15,
430 .settings = {
431 [GPIOMUX_SUSPENDED] = &audio_spkr_boost,
432 },
433 },
434};
435
436
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800437static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
438 {
439 .gpio = 63,
440 .settings = {
441 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
442 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
443 },
444 },
445 {
446 .gpio = 64,
447 .settings = {
448 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
449 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
450 },
451 },
452 {
453 .gpio = 65,
454 .settings = {
455 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
456 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
457 },
458 },
459 {
460 .gpio = 66,
461 .settings = {
462 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
463 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
464 },
465 },
466};
467
468static struct msm_gpiomux_config wcnss_5wire_interface[] = {
469 {
470 .gpio = 84,
471 .settings = {
472 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
473 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
474 },
475 },
476 {
477 .gpio = 85,
478 .settings = {
479 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
480 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
481 },
482 },
483 {
484 .gpio = 86,
485 .settings = {
486 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
487 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
488 },
489 },
490 {
491 .gpio = 87,
492 .settings = {
493 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
494 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
495 },
496 },
497 {
498 .gpio = 88,
499 .settings = {
500 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
501 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
502 },
503 },
504};
505
Amy Malochef3c9db42011-12-08 15:17:35 -0800506static struct msm_gpiomux_config msm8960_atmel_configs[] __initdata = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800507 { /* TS INTERRUPT */
508 .gpio = 11,
509 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800510 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
511 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800512 },
513 },
Amy Malochef3c9db42011-12-08 15:17:35 -0800514 { /* TS LDO ENABLE */
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800515 .gpio = 50,
516 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800517 [GPIOMUX_ACTIVE] = &atmel_ldo_en_act_cfg,
518 [GPIOMUX_SUSPENDED] = &atmel_ldo_en_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800519 },
520 },
521 { /* TS RESOUT */
522 .gpio = 52,
523 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800524 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
525 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800526 },
527 },
528};
529
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800530static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
531 {
532 .gpio = 47,
533 .settings = {
534 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
535 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
536 },
537 },
538};
539
540static struct msm_gpiomux_config mdm_configs[] __initdata = {
541 /* AP2MDM_STATUS */
542 {
543 .gpio = 94,
544 .settings = {
545 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
546 }
547 },
548 /* MDM2AP_STATUS */
549 {
550 .gpio = 69,
551 .settings = {
552 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
553 }
554 },
555 /* MDM2AP_ERRFATAL */
556 {
557 .gpio = 70,
558 .settings = {
559 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
560 }
561 },
562 /* AP2MDM_ERRFATAL */
563 {
564 .gpio = 95,
565 .settings = {
566 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
567 }
568 },
569 /* AP2MDM_KPDPWR_N */
570 {
571 .gpio = 81,
572 .settings = {
573 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
574 }
575 },
576 /* AP2MDM_PMIC_RESET_N */
577 {
578 .gpio = 80,
579 .settings = {
580 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
581 }
582 }
583};
584
585static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
586 {
587 .gpio = 0,
588 .settings = {
589 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
590 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
591 },
592 }
593};
594
595#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
596static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
597 {
598 .gpio = 99,
599 .settings = {
600 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
601 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
602 },
603 },
604 {
605 .gpio = 100,
606 .settings = {
607 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
608 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
609 },
610 },
611 {
612 .gpio = 101,
613 .settings = {
614 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
615 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
616 },
617 },
618 {
619 .gpio = 102,
620 .settings = {
621 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
622 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
623 },
624 },
Manoj Raoc6d904c2012-06-22 00:32:14 -0700625
626};
627
628static struct msm_gpiomux_config msm8930_mhl_configs[] __initdata = {
629 {
630 .gpio = 72,
631 .settings = {
632 [GPIOMUX_ACTIVE] = &hdmi_active_3_cfg,
633 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
634 },
635 },
636 {
637 .gpio = 71,
638 .settings = {
639 [GPIOMUX_ACTIVE] = &hdmi_active_4_cfg,
640 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
641 },
642 },
643 {
644 .gpio = 73,
645 .settings = {
646 [GPIOMUX_ACTIVE] = &hdmi_active_5_cfg,
647 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
648 },
649 },
650
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800651};
652#endif
653
Amy Malochee8de95d2012-02-23 10:40:25 -0800654static struct gpiomux_setting haptics_active_cfg = {
655 .func = GPIOMUX_FUNC_GPIO,
656 .drv = GPIOMUX_DRV_8MA,
657 .pull = GPIOMUX_PULL_UP,
658};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530659static struct gpiomux_setting haptics_suspend_cfg = {
660 .func = GPIOMUX_FUNC_GPIO,
661 .drv = GPIOMUX_DRV_8MA,
662 .pull = GPIOMUX_PULL_DOWN,
663};
664
665static struct msm_gpiomux_config msm8930_haptics_configs[] __initdata = {
666 {
667 .gpio = 77,
668 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800669 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530670 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
671 },
672 },
673 {
674 .gpio = 78,
675 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800676 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530677 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
678 },
679 },
680};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530681
Krishna Konda41b6ab02012-05-16 15:08:03 -0700682static struct gpiomux_setting sd_det_line = {
683 .func = GPIOMUX_FUNC_GPIO,
684 .drv = GPIOMUX_DRV_2MA,
685 .pull = GPIOMUX_PULL_NONE,
686};
687
688static struct msm_gpiomux_config msm8930_sd_det_config[] __initdata = {
689 {
690 .gpio = 94, /* SD Card Detect Line */
691 .settings = {
692 [GPIOMUX_SUSPENDED] = &sd_det_line,
693 [GPIOMUX_ACTIVE] = &sd_det_line,
694 },
695 },
696};
697
Wentao Xuc7769c02012-08-03 15:06:41 -0400698static struct gpiomux_setting gyro_int_line = {
699 .func = GPIOMUX_FUNC_GPIO,
700 .drv = GPIOMUX_DRV_2MA,
701 .pull = GPIOMUX_PULL_NONE,
702};
703
704static struct msm_gpiomux_config msm8930_gyro_int_config[] __initdata = {
705 {
706 .gpio = 69, /* Gyro Interrupt Line */
707 .settings = {
708 [GPIOMUX_SUSPENDED] = &gyro_int_line,
709 [GPIOMUX_ACTIVE] = &gyro_int_line,
710 },
711 },
712};
713
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700714static struct msm_gpiomux_config msm_sitar_config[] __initdata = {
715 {
716 .gpio = 42, /* SYS_RST_N */
717 .settings = {
718 [GPIOMUX_SUSPENDED] = &sitar_reset,
719 },
720 }
721};
722
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800723int __init msm8930_init_gpiomux(void)
724{
725 int rc = msm_gpiomux_init(NR_GPIO_IRQS);
726 if (rc) {
727 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
728 return rc;
729 }
730
731#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
732 msm_gpiomux_install(msm8960_ethernet_configs,
733 ARRAY_SIZE(msm8960_ethernet_configs));
734#endif
735
736 msm_gpiomux_install(msm8960_gsbi_configs,
737 ARRAY_SIZE(msm8960_gsbi_configs));
738
Amy Malochef3c9db42011-12-08 15:17:35 -0800739 msm_gpiomux_install(msm8960_atmel_configs,
740 ARRAY_SIZE(msm8960_atmel_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800741
742 msm_gpiomux_install(msm8960_slimbus_config,
743 ARRAY_SIZE(msm8960_slimbus_config));
744
745 msm_gpiomux_install(msm8960_audio_codec_configs,
746 ARRAY_SIZE(msm8960_audio_codec_configs));
747
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700748 msm_gpiomux_install(msm8960_audio_mbhc_configs,
749 ARRAY_SIZE(msm8960_audio_mbhc_configs));
750
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700751 msm_gpiomux_install(msm8960_audio_spkr_configs,
752 ARRAY_SIZE(msm8960_audio_spkr_configs));
753
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800754 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
755 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
756
757 msm_gpiomux_install(wcnss_5wire_interface,
758 ARRAY_SIZE(wcnss_5wire_interface));
759
760 if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
Mayank Ranabf5084a2011-12-12 17:06:54 +0530761 machine_is_msm8930_cdp()) {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800762 msm_gpiomux_install(hap_lvl_shft_config,
763 ARRAY_SIZE(hap_lvl_shft_config));
Mayank Ranabf5084a2011-12-12 17:06:54 +0530764#ifdef MSM8930_PHASE_2
765 msm_gpiomux_install(msm8930_hsusb_configs,
766 ARRAY_SIZE(msm8930_hsusb_configs));
767#endif
768 }
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800769
770 if (PLATFORM_IS_CHARM25())
771 msm_gpiomux_install(mdm_configs,
772 ARRAY_SIZE(mdm_configs));
773
Amy Malochee8de95d2012-02-23 10:40:25 -0800774 if (machine_is_msm8930_cdp() || machine_is_msm8930_mtp()
775 || machine_is_msm8930_fluid())
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530776 msm_gpiomux_install(msm8930_haptics_configs,
777 ARRAY_SIZE(msm8930_haptics_configs));
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530778
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800779#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
780 msm_gpiomux_install(msm8960_hdmi_configs,
781 ARRAY_SIZE(msm8960_hdmi_configs));
Manoj Raoc6d904c2012-06-22 00:32:14 -0700782 if (machine_is_msm8930_fluid())
783 msm_gpiomux_install(msm8930_mhl_configs,
784 ARRAY_SIZE(msm8930_mhl_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800785#endif
786
787 msm_gpiomux_install(msm8960_mdp_vsync_configs,
788 ARRAY_SIZE(msm8960_mdp_vsync_configs));
Krishna Konda41b6ab02012-05-16 15:08:03 -0700789
790 msm_gpiomux_install(msm8930_sd_det_config,
791 ARRAY_SIZE(msm8930_sd_det_config));
792
Wentao Xuc7769c02012-08-03 15:06:41 -0400793 if (machine_is_msm8930_fluid() || machine_is_msm8930_mtp())
794 msm_gpiomux_install(msm8930_gyro_int_config,
795 ARRAY_SIZE(msm8930_gyro_int_config));
796
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700797 msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));
798
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800799 return 0;
800}