blob: e0f012a9f3d916cf7789d78e0adcc1751ec70efe [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
277#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
278static struct msm_gpiomux_config msm8960_ethernet_configs[] = {
279 {
280 .gpio = 90,
281 .settings = {
282 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
283 }
284 },
285 {
286 .gpio = 89,
287 .settings = {
288 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
289 }
290 },
291};
292#endif
293
294static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
295 {
296 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
297 .settings = {
298 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
299 [GPIOMUX_ACTIVE] = &spi_active,
300 },
301 },
302 {
303 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
304 .settings = {
305 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
306 [GPIOMUX_ACTIVE] = &spi_active,
307 },
308 },
309 {
310 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
313 [GPIOMUX_ACTIVE] = &spi_active,
314 },
315 },
316 {
317 .gpio = 9, /* GSBI1 QUP SPI_CLK */
318 .settings = {
319 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
320 [GPIOMUX_ACTIVE] = &spi_active,
321 },
322 },
323 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800324 .gpio = 16, /* GSBI3 I2C QUP SDA */
325 .settings = {
326 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
327 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
328 },
329 },
330 {
331 .gpio = 17, /* GSBI3 I2C QUP SCL */
332 .settings = {
333 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
334 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
335 },
336 },
337 {
338 .gpio = 22, /* GSBI5 UART2 */
339 .settings = {
340 [GPIOMUX_SUSPENDED] = &gsbi5,
341 },
342 },
343 {
344 .gpio = 23, /* GSBI5 UART2 */
345 .settings = {
346 [GPIOMUX_SUSPENDED] = &gsbi5,
347 },
348 },
349 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800350 .gpio = 44, /* GSBI12 I2C QUP SDA */
351 .settings = {
352 [GPIOMUX_SUSPENDED] = &gsbi12,
353 },
354 },
355 {
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -0600356 .gpio = 95, /* GSBI9 I2C QUP SDA */
357 .settings = {
358 [GPIOMUX_SUSPENDED] = &gsbi9,
359 },
360 },
361 {
362 .gpio = 96, /* GSBI12 I2C QUP SCL */
363 .settings = {
364 [GPIOMUX_SUSPENDED] = &gsbi9,
365 },
366 },
367 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800368 .gpio = 45, /* GSBI12 I2C QUP SCL */
369 .settings = {
370 [GPIOMUX_SUSPENDED] = &gsbi12,
371 },
372 },
373 {
374 .gpio = 73, /* GSBI10 I2C QUP SDA */
375 .settings = {
376 [GPIOMUX_SUSPENDED] = &gsbi10,
377 },
378 },
379 {
380 .gpio = 74, /* GSBI10 I2C QUP SCL */
381 .settings = {
382 [GPIOMUX_SUSPENDED] = &gsbi10,
383 },
384 },
385};
386
387static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
388 {
389 .gpio = 60, /* slimbus data */
390 .settings = {
391 [GPIOMUX_SUSPENDED] = &slimbus,
392 },
393 },
394 {
395 .gpio = 61, /* slimbus clk */
396 .settings = {
397 [GPIOMUX_SUSPENDED] = &slimbus,
398 },
399 },
400};
401
402static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
403 {
404 .gpio = 59,
405 .settings = {
406 [GPIOMUX_SUSPENDED] = &cdc_mclk,
407 },
408 },
409};
410
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700411static struct msm_gpiomux_config msm8960_audio_mbhc_configs[] __initdata = {
412 {
413 .gpio = 37,
414 .settings = {
415 [GPIOMUX_SUSPENDED] = &audio_mbhc,
416 },
417 },
418};
419
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700420static struct msm_gpiomux_config msm8960_audio_spkr_configs[] __initdata = {
421 {
422 .gpio = 15,
423 .settings = {
424 [GPIOMUX_SUSPENDED] = &audio_spkr_boost,
425 },
426 },
427};
428
429
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800430static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
431 {
432 .gpio = 63,
433 .settings = {
434 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
435 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
436 },
437 },
438 {
439 .gpio = 64,
440 .settings = {
441 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
442 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
443 },
444 },
445 {
446 .gpio = 65,
447 .settings = {
448 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
449 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
450 },
451 },
452 {
453 .gpio = 66,
454 .settings = {
455 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
456 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
457 },
458 },
459};
460
461static struct msm_gpiomux_config wcnss_5wire_interface[] = {
462 {
463 .gpio = 84,
464 .settings = {
465 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
466 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
467 },
468 },
469 {
470 .gpio = 85,
471 .settings = {
472 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
473 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
474 },
475 },
476 {
477 .gpio = 86,
478 .settings = {
479 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
480 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
481 },
482 },
483 {
484 .gpio = 87,
485 .settings = {
486 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
487 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
488 },
489 },
490 {
491 .gpio = 88,
492 .settings = {
493 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
494 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
495 },
496 },
497};
498
Amy Malochef3c9db42011-12-08 15:17:35 -0800499static struct msm_gpiomux_config msm8960_atmel_configs[] __initdata = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800500 { /* TS INTERRUPT */
501 .gpio = 11,
502 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800503 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
504 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800505 },
506 },
Amy Malochef3c9db42011-12-08 15:17:35 -0800507 { /* TS LDO ENABLE */
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800508 .gpio = 50,
509 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800510 [GPIOMUX_ACTIVE] = &atmel_ldo_en_act_cfg,
511 [GPIOMUX_SUSPENDED] = &atmel_ldo_en_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800512 },
513 },
514 { /* TS RESOUT */
515 .gpio = 52,
516 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800517 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
518 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800519 },
520 },
521};
522
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800523static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
524 {
525 .gpio = 47,
526 .settings = {
527 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
528 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
529 },
530 },
531};
532
533static struct msm_gpiomux_config mdm_configs[] __initdata = {
534 /* AP2MDM_STATUS */
535 {
536 .gpio = 94,
537 .settings = {
538 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
539 }
540 },
541 /* MDM2AP_STATUS */
542 {
543 .gpio = 69,
544 .settings = {
545 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
546 }
547 },
548 /* MDM2AP_ERRFATAL */
549 {
550 .gpio = 70,
551 .settings = {
552 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
553 }
554 },
555 /* AP2MDM_ERRFATAL */
556 {
557 .gpio = 95,
558 .settings = {
559 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
560 }
561 },
562 /* AP2MDM_KPDPWR_N */
563 {
564 .gpio = 81,
565 .settings = {
566 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
567 }
568 },
569 /* AP2MDM_PMIC_RESET_N */
570 {
571 .gpio = 80,
572 .settings = {
573 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
574 }
575 }
576};
577
578static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
579 {
580 .gpio = 0,
581 .settings = {
582 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
583 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
584 },
585 }
586};
587
588#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
589static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
590 {
591 .gpio = 99,
592 .settings = {
593 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
594 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
595 },
596 },
597 {
598 .gpio = 100,
599 .settings = {
600 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
601 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
602 },
603 },
604 {
605 .gpio = 101,
606 .settings = {
607 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
608 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
609 },
610 },
611 {
612 .gpio = 102,
613 .settings = {
614 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
615 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
616 },
617 },
Manoj Raoc6d904c2012-06-22 00:32:14 -0700618
619};
620
621static struct msm_gpiomux_config msm8930_mhl_configs[] __initdata = {
622 {
623 .gpio = 72,
624 .settings = {
625 [GPIOMUX_ACTIVE] = &hdmi_active_3_cfg,
626 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
627 },
628 },
629 {
630 .gpio = 71,
631 .settings = {
632 [GPIOMUX_ACTIVE] = &hdmi_active_4_cfg,
633 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
634 },
635 },
636 {
637 .gpio = 73,
638 .settings = {
639 [GPIOMUX_ACTIVE] = &hdmi_active_5_cfg,
640 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
641 },
642 },
643
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800644};
645#endif
646
Amy Malochee8de95d2012-02-23 10:40:25 -0800647static struct gpiomux_setting haptics_active_cfg = {
648 .func = GPIOMUX_FUNC_GPIO,
649 .drv = GPIOMUX_DRV_8MA,
650 .pull = GPIOMUX_PULL_UP,
651};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530652static struct gpiomux_setting haptics_suspend_cfg = {
653 .func = GPIOMUX_FUNC_GPIO,
654 .drv = GPIOMUX_DRV_8MA,
655 .pull = GPIOMUX_PULL_DOWN,
656};
657
658static struct msm_gpiomux_config msm8930_haptics_configs[] __initdata = {
659 {
660 .gpio = 77,
661 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800662 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530663 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
664 },
665 },
666 {
667 .gpio = 78,
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};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530674
Krishna Konda41b6ab02012-05-16 15:08:03 -0700675static struct gpiomux_setting sd_det_line = {
676 .func = GPIOMUX_FUNC_GPIO,
677 .drv = GPIOMUX_DRV_2MA,
678 .pull = GPIOMUX_PULL_NONE,
679};
680
681static struct msm_gpiomux_config msm8930_sd_det_config[] __initdata = {
682 {
683 .gpio = 94, /* SD Card Detect Line */
684 .settings = {
685 [GPIOMUX_SUSPENDED] = &sd_det_line,
686 [GPIOMUX_ACTIVE] = &sd_det_line,
687 },
688 },
689};
690
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800691int __init msm8930_init_gpiomux(void)
692{
693 int rc = msm_gpiomux_init(NR_GPIO_IRQS);
694 if (rc) {
695 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
696 return rc;
697 }
698
699#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
700 msm_gpiomux_install(msm8960_ethernet_configs,
701 ARRAY_SIZE(msm8960_ethernet_configs));
702#endif
703
704 msm_gpiomux_install(msm8960_gsbi_configs,
705 ARRAY_SIZE(msm8960_gsbi_configs));
706
Amy Malochef3c9db42011-12-08 15:17:35 -0800707 msm_gpiomux_install(msm8960_atmel_configs,
708 ARRAY_SIZE(msm8960_atmel_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800709
710 msm_gpiomux_install(msm8960_slimbus_config,
711 ARRAY_SIZE(msm8960_slimbus_config));
712
713 msm_gpiomux_install(msm8960_audio_codec_configs,
714 ARRAY_SIZE(msm8960_audio_codec_configs));
715
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700716 msm_gpiomux_install(msm8960_audio_mbhc_configs,
717 ARRAY_SIZE(msm8960_audio_mbhc_configs));
718
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700719 msm_gpiomux_install(msm8960_audio_spkr_configs,
720 ARRAY_SIZE(msm8960_audio_spkr_configs));
721
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800722 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
723 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
724
725 msm_gpiomux_install(wcnss_5wire_interface,
726 ARRAY_SIZE(wcnss_5wire_interface));
727
728 if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
Mayank Ranabf5084a2011-12-12 17:06:54 +0530729 machine_is_msm8930_cdp()) {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800730 msm_gpiomux_install(hap_lvl_shft_config,
731 ARRAY_SIZE(hap_lvl_shft_config));
Mayank Ranabf5084a2011-12-12 17:06:54 +0530732#ifdef MSM8930_PHASE_2
733 msm_gpiomux_install(msm8930_hsusb_configs,
734 ARRAY_SIZE(msm8930_hsusb_configs));
735#endif
736 }
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800737
738 if (PLATFORM_IS_CHARM25())
739 msm_gpiomux_install(mdm_configs,
740 ARRAY_SIZE(mdm_configs));
741
Amy Malochee8de95d2012-02-23 10:40:25 -0800742 if (machine_is_msm8930_cdp() || machine_is_msm8930_mtp()
743 || machine_is_msm8930_fluid())
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530744 msm_gpiomux_install(msm8930_haptics_configs,
745 ARRAY_SIZE(msm8930_haptics_configs));
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530746
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800747#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
748 msm_gpiomux_install(msm8960_hdmi_configs,
749 ARRAY_SIZE(msm8960_hdmi_configs));
Manoj Raoc6d904c2012-06-22 00:32:14 -0700750 if (machine_is_msm8930_fluid())
751 msm_gpiomux_install(msm8930_mhl_configs,
752 ARRAY_SIZE(msm8930_mhl_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800753#endif
754
755 msm_gpiomux_install(msm8960_mdp_vsync_configs,
756 ARRAY_SIZE(msm8960_mdp_vsync_configs));
Krishna Konda41b6ab02012-05-16 15:08:03 -0700757
758 msm_gpiomux_install(msm8930_sd_det_config,
759 ARRAY_SIZE(msm8930_sd_det_config));
760
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800761 return 0;
762}