blob: b495ee77561bdc2af7581475b3b5a4d907a50cee [file] [log] [blame]
Duy Truonge833aca2013-02-12 13:35:08 -08001/* Copyright (c) 2011-2012, The Linux Foundation. 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
Taniya Das75596f92013-03-06 11:47:34 +053046static struct gpiomux_setting gsbi9_active_cfg = {
47 .func = GPIOMUX_FUNC_2,
48 .drv = GPIOMUX_DRV_8MA,
49 .pull = GPIOMUX_PULL_DOWN,
50};
51
52static struct gpiomux_setting gsbi9_suspended_cfg = {
53 .func = GPIOMUX_FUNC_2,
54 .drv = GPIOMUX_DRV_2MA,
55 .pull = GPIOMUX_PULL_DOWN,
56};
57
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080058static struct gpiomux_setting gsbi5 = {
59 .func = GPIOMUX_FUNC_1,
60 .drv = GPIOMUX_DRV_8MA,
61 .pull = GPIOMUX_PULL_NONE,
62};
63
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -060064static struct gpiomux_setting gsbi9 = {
65 .func = GPIOMUX_FUNC_2,
66 .drv = GPIOMUX_DRV_8MA,
67 .pull = GPIOMUX_PULL_NONE,
68};
69
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080070static struct gpiomux_setting gsbi10 = {
71 .func = GPIOMUX_FUNC_2,
72 .drv = GPIOMUX_DRV_8MA,
73 .pull = GPIOMUX_PULL_NONE,
74};
75
76static struct gpiomux_setting gsbi12 = {
77 .func = GPIOMUX_FUNC_1,
78 .drv = GPIOMUX_DRV_8MA,
79 .pull = GPIOMUX_PULL_NONE,
80};
81
Taniya Das75596f92013-03-06 11:47:34 +053082static struct gpiomux_setting external_vfr[] = {
83 /* Suspended state */
84 {
85 .func = GPIOMUX_FUNC_3,
86 .drv = GPIOMUX_DRV_2MA,
87 .pull = GPIOMUX_PULL_KEEPER,
88 },
89 /* Active state */
90 {
91 .func = GPIOMUX_FUNC_3,
92 .drv = GPIOMUX_DRV_2MA,
93 .pull = GPIOMUX_PULL_KEEPER,
94 },
95};
96
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -080097static struct gpiomux_setting cdc_mclk = {
98 .func = GPIOMUX_FUNC_1,
Rohit Vaswani47e6c142012-09-19 16:11:06 -070099 .drv = GPIOMUX_DRV_2MA,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800100 .pull = GPIOMUX_PULL_NONE,
101};
102
103static struct gpiomux_setting audio_auxpcm[] = {
104 /* Suspended state */
105 {
106 .func = GPIOMUX_FUNC_GPIO,
107 .drv = GPIOMUX_DRV_2MA,
108 .pull = GPIOMUX_PULL_NONE,
109 },
110 /* Active state */
111 {
112 .func = GPIOMUX_FUNC_1,
113 .drv = GPIOMUX_DRV_2MA,
114 .pull = GPIOMUX_PULL_NONE,
115 },
116};
117
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700118static struct gpiomux_setting audio_mbhc = {
119 .func = GPIOMUX_FUNC_GPIO,
120 .drv = GPIOMUX_DRV_8MA,
121 .pull = GPIOMUX_PULL_NONE,
122};
123
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700124static struct gpiomux_setting audio_spkr_boost = {
125 .func = GPIOMUX_FUNC_GPIO,
126 .drv = GPIOMUX_DRV_8MA,
127 .pull = GPIOMUX_PULL_NONE,
128};
129
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800130#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
131static struct gpiomux_setting gpio_eth_config = {
132 .pull = GPIOMUX_PULL_NONE,
133 .drv = GPIOMUX_DRV_8MA,
134 .func = GPIOMUX_FUNC_GPIO,
135};
136#endif
137
138static struct gpiomux_setting slimbus = {
139 .func = GPIOMUX_FUNC_1,
140 .drv = GPIOMUX_DRV_8MA,
141 .pull = GPIOMUX_PULL_KEEPER,
142};
143
144static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
145 .func = GPIOMUX_FUNC_GPIO,
146 .drv = GPIOMUX_DRV_2MA,
147 .pull = GPIOMUX_PULL_UP,
148};
149
150static struct gpiomux_setting wcnss_5wire_active_cfg = {
151 .func = GPIOMUX_FUNC_1,
152 .drv = GPIOMUX_DRV_6MA,
153 .pull = GPIOMUX_PULL_DOWN,
154};
155
Amy Malochef3c9db42011-12-08 15:17:35 -0800156static struct gpiomux_setting atmel_resout_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800157 .func = GPIOMUX_FUNC_GPIO,
158 .drv = GPIOMUX_DRV_6MA,
159 .pull = GPIOMUX_PULL_DOWN,
160};
161
Amy Malochef3c9db42011-12-08 15:17:35 -0800162static struct gpiomux_setting atmel_resout_act_cfg = {
163 .func = GPIOMUX_FUNC_GPIO,
164 .drv = GPIOMUX_DRV_6MA,
165 .pull = GPIOMUX_PULL_UP,
166};
167
168static struct gpiomux_setting atmel_ldo_en_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800169 .func = GPIOMUX_FUNC_GPIO,
170 .drv = GPIOMUX_DRV_6MA,
171 .pull = GPIOMUX_PULL_DOWN,
172};
173
Amy Malochef3c9db42011-12-08 15:17:35 -0800174static struct gpiomux_setting atmel_ldo_en_act_cfg = {
175 .func = GPIOMUX_FUNC_GPIO,
176 .drv = GPIOMUX_DRV_6MA,
177 .pull = GPIOMUX_PULL_DOWN,
178};
179
180static struct gpiomux_setting atmel_int_act_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800181 .func = GPIOMUX_FUNC_GPIO,
182 .drv = GPIOMUX_DRV_8MA,
183 .pull = GPIOMUX_PULL_UP,
184};
185
Amy Malochef3c9db42011-12-08 15:17:35 -0800186static struct gpiomux_setting atmel_int_sus_cfg = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800187 .func = GPIOMUX_FUNC_GPIO,
188 .drv = GPIOMUX_DRV_2MA,
189 .pull = GPIOMUX_PULL_DOWN,
190};
Mayank Ranabf5084a2011-12-12 17:06:54 +0530191#ifdef MSM8930_PHASE_2
Mayank Ranabf5084a2011-12-12 17:06:54 +0530192static struct gpiomux_setting hsusb_sus_cfg = {
193 .func = GPIOMUX_FUNC_GPIO,
194 .drv = GPIOMUX_DRV_2MA,
David Keitelc72d8192012-01-09 11:33:55 -0800195 .pull = GPIOMUX_PULL_NONE,
196 .dir = GPIOMUX_OUT_LOW,
Mayank Ranabf5084a2011-12-12 17:06:54 +0530197};
198static struct msm_gpiomux_config msm8930_hsusb_configs[] = {
199 {
200 .gpio = 63, /* HSUSB_EXTERNAL_5V_LDO_EN */
201 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530202 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
203 },
204 },
205 {
206 .gpio = 97, /* HSUSB_5V_EN */
207 .settings = {
Mayank Ranabf5084a2011-12-12 17:06:54 +0530208 [GPIOMUX_SUSPENDED] = &hsusb_sus_cfg,
209 },
210 },
211};
212#endif
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800213
214static struct gpiomux_setting hap_lvl_shft_suspended_config = {
215 .func = GPIOMUX_FUNC_GPIO,
216 .drv = GPIOMUX_DRV_2MA,
217 .pull = GPIOMUX_PULL_DOWN,
218};
219
220static struct gpiomux_setting hap_lvl_shft_active_config = {
221 .func = GPIOMUX_FUNC_GPIO,
222 .drv = GPIOMUX_DRV_8MA,
223 .pull = GPIOMUX_PULL_UP,
224};
225
226static struct gpiomux_setting ap2mdm_cfg = {
227 .func = GPIOMUX_FUNC_GPIO,
228 .drv = GPIOMUX_DRV_8MA,
229 .pull = GPIOMUX_PULL_DOWN,
230};
231
232static struct gpiomux_setting mdm2ap_status_cfg = {
233 .func = GPIOMUX_FUNC_GPIO,
234 .drv = GPIOMUX_DRV_8MA,
235 .pull = GPIOMUX_PULL_NONE,
236};
237
238static struct gpiomux_setting mdm2ap_errfatal_cfg = {
239 .func = GPIOMUX_FUNC_GPIO,
240 .drv = GPIOMUX_DRV_16MA,
241 .pull = GPIOMUX_PULL_DOWN,
242};
243
244static struct gpiomux_setting ap2mdm_kpdpwr_n_cfg = {
245 .func = GPIOMUX_FUNC_GPIO,
246 .drv = GPIOMUX_DRV_8MA,
247 .pull = GPIOMUX_PULL_NONE,
248};
249
250static struct gpiomux_setting mdp_vsync_suspend_cfg = {
251 .func = GPIOMUX_FUNC_GPIO,
252 .drv = GPIOMUX_DRV_2MA,
253 .pull = GPIOMUX_PULL_DOWN,
254};
255
256static struct gpiomux_setting mdp_vsync_active_cfg = {
257 .func = GPIOMUX_FUNC_1,
258 .drv = GPIOMUX_DRV_2MA,
259 .pull = GPIOMUX_PULL_DOWN,
260};
261
262#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
263static struct gpiomux_setting hdmi_suspend_cfg = {
264 .func = GPIOMUX_FUNC_GPIO,
265 .drv = GPIOMUX_DRV_2MA,
266 .pull = GPIOMUX_PULL_DOWN,
267};
268
269static struct gpiomux_setting hdmi_active_1_cfg = {
270 .func = GPIOMUX_FUNC_1,
271 .drv = GPIOMUX_DRV_2MA,
272 .pull = GPIOMUX_PULL_UP,
273};
274
275static struct gpiomux_setting hdmi_active_2_cfg = {
276 .func = GPIOMUX_FUNC_1,
277 .drv = GPIOMUX_DRV_2MA,
278 .pull = GPIOMUX_PULL_DOWN,
279};
Manoj Raoc6d904c2012-06-22 00:32:14 -0700280
281static struct gpiomux_setting hdmi_active_3_cfg = {
282 .func = GPIOMUX_FUNC_GPIO,
283 .drv = GPIOMUX_DRV_2MA,
284 .pull = GPIOMUX_PULL_UP,
285 .dir = GPIOMUX_IN,
286};
287
288static struct gpiomux_setting hdmi_active_4_cfg = {
289 .func = GPIOMUX_FUNC_GPIO,
290 .drv = GPIOMUX_DRV_2MA,
291 .pull = GPIOMUX_PULL_UP,
292 .dir = GPIOMUX_OUT_HIGH,
293};
294
295static struct gpiomux_setting hdmi_active_5_cfg = {
296 .func = GPIOMUX_FUNC_GPIO,
297 .drv = GPIOMUX_DRV_2MA,
298 .pull = GPIOMUX_PULL_UP,
299 .dir = GPIOMUX_OUT_HIGH,
300};
301
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800302#endif
303
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700304static struct gpiomux_setting sitar_reset = {
305 .func = GPIOMUX_FUNC_GPIO,
306 .drv = GPIOMUX_DRV_6MA,
307 .pull = GPIOMUX_PULL_NONE,
308 .dir = GPIOMUX_OUT_LOW,
309};
310
Taniya Das75596f92013-03-06 11:47:34 +0530311static struct gpiomux_setting usbsw_cfg = {
312 .func = GPIOMUX_FUNC_GPIO,
313 .drv = GPIOMUX_DRV_8MA,
314 .pull = GPIOMUX_PULL_DOWN,
315};
316
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800317#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
318static struct msm_gpiomux_config msm8960_ethernet_configs[] = {
319 {
320 .gpio = 90,
321 .settings = {
322 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
323 }
324 },
325 {
326 .gpio = 89,
327 .settings = {
328 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
329 }
330 },
331};
332#endif
333
334static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
335 {
336 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
337 .settings = {
338 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
339 [GPIOMUX_ACTIVE] = &spi_active,
340 },
341 },
342 {
343 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
344 .settings = {
345 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
346 [GPIOMUX_ACTIVE] = &spi_active,
347 },
348 },
349 {
350 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
351 .settings = {
352 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
353 [GPIOMUX_ACTIVE] = &spi_active,
354 },
355 },
356 {
357 .gpio = 9, /* GSBI1 QUP SPI_CLK */
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
360 [GPIOMUX_ACTIVE] = &spi_active,
361 },
362 },
363 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800364 .gpio = 16, /* GSBI3 I2C QUP SDA */
365 .settings = {
366 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
367 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
368 },
369 },
370 {
371 .gpio = 17, /* GSBI3 I2C QUP SCL */
372 .settings = {
373 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
374 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
375 },
376 },
377 {
378 .gpio = 22, /* GSBI5 UART2 */
379 .settings = {
380 [GPIOMUX_SUSPENDED] = &gsbi5,
381 },
382 },
383 {
384 .gpio = 23, /* GSBI5 UART2 */
385 .settings = {
386 [GPIOMUX_SUSPENDED] = &gsbi5,
387 },
388 },
389 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800390 .gpio = 44, /* GSBI12 I2C QUP SDA */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi12,
393 },
394 },
395 {
Harini Jayaramanfe6ff4162012-03-14 11:25:40 -0600396 .gpio = 95, /* GSBI9 I2C QUP SDA */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi9,
399 },
400 },
401 {
402 .gpio = 96, /* GSBI12 I2C QUP SCL */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi9,
405 },
406 },
407 {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800408 .gpio = 45, /* GSBI12 I2C QUP SCL */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &gsbi12,
411 },
412 },
413 {
414 .gpio = 73, /* GSBI10 I2C QUP SDA */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &gsbi10,
417 },
418 },
419 {
420 .gpio = 74, /* GSBI10 I2C QUP SCL */
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &gsbi10,
423 },
424 },
425};
426
427static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
428 {
429 .gpio = 60, /* slimbus data */
430 .settings = {
431 [GPIOMUX_SUSPENDED] = &slimbus,
432 },
433 },
434 {
435 .gpio = 61, /* slimbus clk */
436 .settings = {
437 [GPIOMUX_SUSPENDED] = &slimbus,
438 },
439 },
440};
441
442static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
443 {
444 .gpio = 59,
445 .settings = {
446 [GPIOMUX_SUSPENDED] = &cdc_mclk,
447 },
448 },
449};
450
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700451static struct msm_gpiomux_config msm8960_audio_mbhc_configs[] __initdata = {
452 {
453 .gpio = 37,
454 .settings = {
455 [GPIOMUX_SUSPENDED] = &audio_mbhc,
456 },
457 },
458};
459
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700460static struct msm_gpiomux_config msm8960_audio_spkr_configs[] __initdata = {
461 {
462 .gpio = 15,
463 .settings = {
464 [GPIOMUX_SUSPENDED] = &audio_spkr_boost,
465 },
466 },
467};
468
469
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800470static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
471 {
472 .gpio = 63,
473 .settings = {
474 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
475 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
476 },
477 },
478 {
479 .gpio = 64,
480 .settings = {
481 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
482 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
483 },
484 },
485 {
486 .gpio = 65,
487 .settings = {
488 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
489 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
490 },
491 },
492 {
493 .gpio = 66,
494 .settings = {
495 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
496 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
497 },
498 },
499};
500
501static struct msm_gpiomux_config wcnss_5wire_interface[] = {
502 {
503 .gpio = 84,
504 .settings = {
505 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
506 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
507 },
508 },
509 {
510 .gpio = 85,
511 .settings = {
512 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
513 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
514 },
515 },
516 {
517 .gpio = 86,
518 .settings = {
519 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
520 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
521 },
522 },
523 {
524 .gpio = 87,
525 .settings = {
526 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
527 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
528 },
529 },
530 {
531 .gpio = 88,
532 .settings = {
533 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
534 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
535 },
536 },
537};
538
Amy Malochef3c9db42011-12-08 15:17:35 -0800539static struct msm_gpiomux_config msm8960_atmel_configs[] __initdata = {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800540 { /* TS INTERRUPT */
541 .gpio = 11,
542 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800543 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
544 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800545 },
546 },
Amy Malochef3c9db42011-12-08 15:17:35 -0800547 { /* TS LDO ENABLE */
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800548 .gpio = 50,
549 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800550 [GPIOMUX_ACTIVE] = &atmel_ldo_en_act_cfg,
551 [GPIOMUX_SUSPENDED] = &atmel_ldo_en_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800552 },
553 },
554 { /* TS RESOUT */
555 .gpio = 52,
556 .settings = {
Amy Malochef3c9db42011-12-08 15:17:35 -0800557 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
558 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800559 },
560 },
561};
562
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800563static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
564 {
565 .gpio = 47,
566 .settings = {
567 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
568 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
569 },
570 },
571};
572
573static struct msm_gpiomux_config mdm_configs[] __initdata = {
574 /* AP2MDM_STATUS */
575 {
576 .gpio = 94,
577 .settings = {
578 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
579 }
580 },
581 /* MDM2AP_STATUS */
582 {
583 .gpio = 69,
584 .settings = {
585 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
586 }
587 },
588 /* MDM2AP_ERRFATAL */
589 {
590 .gpio = 70,
591 .settings = {
592 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
593 }
594 },
595 /* AP2MDM_ERRFATAL */
596 {
597 .gpio = 95,
598 .settings = {
599 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
600 }
601 },
602 /* AP2MDM_KPDPWR_N */
603 {
604 .gpio = 81,
605 .settings = {
606 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
607 }
608 },
609 /* AP2MDM_PMIC_RESET_N */
610 {
611 .gpio = 80,
612 .settings = {
613 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
614 }
615 }
616};
617
618static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
619 {
620 .gpio = 0,
621 .settings = {
622 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
623 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
624 },
625 }
626};
627
628#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
629static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
630 {
631 .gpio = 99,
632 .settings = {
633 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
634 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
635 },
636 },
637 {
638 .gpio = 100,
639 .settings = {
640 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
641 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
642 },
643 },
644 {
645 .gpio = 101,
646 .settings = {
647 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
648 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
649 },
650 },
651 {
652 .gpio = 102,
653 .settings = {
654 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
655 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
656 },
657 },
Manoj Raoc6d904c2012-06-22 00:32:14 -0700658
659};
660
661static struct msm_gpiomux_config msm8930_mhl_configs[] __initdata = {
662 {
663 .gpio = 72,
664 .settings = {
665 [GPIOMUX_ACTIVE] = &hdmi_active_3_cfg,
666 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
667 },
668 },
669 {
670 .gpio = 71,
671 .settings = {
672 [GPIOMUX_ACTIVE] = &hdmi_active_4_cfg,
673 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
674 },
675 },
676 {
677 .gpio = 73,
678 .settings = {
679 [GPIOMUX_ACTIVE] = &hdmi_active_5_cfg,
680 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
681 },
682 },
683
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800684};
685#endif
686
Amy Malochee8de95d2012-02-23 10:40:25 -0800687static struct gpiomux_setting haptics_active_cfg = {
688 .func = GPIOMUX_FUNC_GPIO,
689 .drv = GPIOMUX_DRV_8MA,
690 .pull = GPIOMUX_PULL_UP,
691};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530692static struct gpiomux_setting haptics_suspend_cfg = {
693 .func = GPIOMUX_FUNC_GPIO,
694 .drv = GPIOMUX_DRV_8MA,
695 .pull = GPIOMUX_PULL_DOWN,
696};
697
698static struct msm_gpiomux_config msm8930_haptics_configs[] __initdata = {
699 {
700 .gpio = 77,
701 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800702 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530703 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
704 },
705 },
706 {
707 .gpio = 78,
708 .settings = {
Amy Malochee8de95d2012-02-23 10:40:25 -0800709 [GPIOMUX_ACTIVE] = &haptics_active_cfg,
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530710 [GPIOMUX_SUSPENDED] = &haptics_suspend_cfg,
711 },
712 },
713};
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530714
Krishna Konda41b6ab02012-05-16 15:08:03 -0700715static struct gpiomux_setting sd_det_line = {
716 .func = GPIOMUX_FUNC_GPIO,
717 .drv = GPIOMUX_DRV_2MA,
718 .pull = GPIOMUX_PULL_NONE,
719};
720
721static struct msm_gpiomux_config msm8930_sd_det_config[] __initdata = {
722 {
723 .gpio = 94, /* SD Card Detect Line */
724 .settings = {
725 [GPIOMUX_SUSPENDED] = &sd_det_line,
726 [GPIOMUX_ACTIVE] = &sd_det_line,
727 },
728 },
729};
730
Wentao Xuc7769c02012-08-03 15:06:41 -0400731static struct gpiomux_setting gyro_int_line = {
732 .func = GPIOMUX_FUNC_GPIO,
733 .drv = GPIOMUX_DRV_2MA,
734 .pull = GPIOMUX_PULL_NONE,
735};
736
737static struct msm_gpiomux_config msm8930_gyro_int_config[] __initdata = {
738 {
739 .gpio = 69, /* Gyro Interrupt Line */
740 .settings = {
741 [GPIOMUX_SUSPENDED] = &gyro_int_line,
742 [GPIOMUX_ACTIVE] = &gyro_int_line,
743 },
744 },
745};
746
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700747static struct msm_gpiomux_config msm_sitar_config[] __initdata = {
748 {
749 .gpio = 42, /* SYS_RST_N */
750 .settings = {
751 [GPIOMUX_SUSPENDED] = &sitar_reset,
752 },
753 }
754};
755
Taniya Das75596f92013-03-06 11:47:34 +0530756static struct msm_gpiomux_config sglte_8930_configs[] __initdata = {
757 /* AP2MDM_STATUS */
758 {
759 .gpio = 77,
760 .settings = {
761 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
762 }
763 },
764 /* MDM2AP_STATUS */
765 {
766 .gpio = 24,
767 .settings = {
768 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
769 }
770 },
771 /* MDM2AP_ERRFATAL */
772 {
773 .gpio = 40,
774 .settings = {
775 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
776 }
777 },
778 /* AP2MDM_ERRFATAL */
779 {
780 .gpio = 80,
781 .settings = {
782 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
783 }
784 },
785 /* AP2MDM_KPDPWR_N */
786 {
787 .gpio = 79,
788 .settings = {
789 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
790 }
791 },
792 /* AP2MDM_PMIC_PWR_EN */
793 {
794 .gpio = 22,
795 .settings = {
796 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
797 }
798 },
799 /* AP2MDM_SOFT_RESET */
800 {
801 .gpio = 78,
802 .settings = {
803 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
804 }
805 },
806 /* USB_SW */
807 {
808 .gpio = 25,
809 .settings = {
810 [GPIOMUX_SUSPENDED] = &usbsw_cfg,
811 }
812 }
813};
814
815static struct msm_gpiomux_config msm8930_fusion_gsbi_configs[] = {
816 {
817 .gpio = 93,
818 .settings = {
819 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
820 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
821 }
822 },
823 {
824 .gpio = 94,
825 .settings = {
826 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
827 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
828 }
829 },
830 {
831 .gpio = 95,
832 .settings = {
833 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
834 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
835 }
836 },
837 {
838 .gpio = 96,
839 .settings = {
840 [GPIOMUX_SUSPENDED] = &gsbi9_suspended_cfg,
841 [GPIOMUX_ACTIVE] = &gsbi9_active_cfg,
842 }
843 },
844};
845
846static struct msm_gpiomux_config msm8930_external_vfr_configs[] __initdata = {
847 {
848 .gpio = 23, /* EXTERNAL VFR */
849 .settings = {
850 [GPIOMUX_SUSPENDED] = &external_vfr[0],
851 [GPIOMUX_ACTIVE] = &external_vfr[1],
852 },
853 },
854};
855
856int __init sglte8930_init_gpiomux(void)
857{
858 /* For 8960 Fusion 2.2 Primary IPC */
859 msm_gpiomux_install(msm8930_fusion_gsbi_configs,
860 ARRAY_SIZE(msm8930_fusion_gsbi_configs));
861 /* For SGLTE 8960 Fusion External VFR */
862 msm_gpiomux_install(msm8930_external_vfr_configs,
863 ARRAY_SIZE(msm8930_external_vfr_configs));
864 msm_gpiomux_install(sglte_8930_configs,
865 ARRAY_SIZE(sglte_8930_configs));
866
867 msm_gpiomux_install(msm8960_slimbus_config,
868 ARRAY_SIZE(msm8960_slimbus_config));
869
870 msm_gpiomux_install(msm8960_audio_codec_configs,
871 ARRAY_SIZE(msm8960_audio_codec_configs));
872
873 msm_gpiomux_install(wcnss_5wire_interface,
874 ARRAY_SIZE(wcnss_5wire_interface));
875
876 msm_gpiomux_install(msm8960_mdp_vsync_configs,
877 ARRAY_SIZE(msm8960_mdp_vsync_configs));
878
879 msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));
880
881 return 0;
882}
883
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800884int __init msm8930_init_gpiomux(void)
885{
886 int rc = msm_gpiomux_init(NR_GPIO_IRQS);
887 if (rc) {
888 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
889 return rc;
890 }
891
Taniya Das75596f92013-03-06 11:47:34 +0530892 if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE)
893 return sglte8930_init_gpiomux();
894
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800895#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
896 msm_gpiomux_install(msm8960_ethernet_configs,
897 ARRAY_SIZE(msm8960_ethernet_configs));
898#endif
899
900 msm_gpiomux_install(msm8960_gsbi_configs,
901 ARRAY_SIZE(msm8960_gsbi_configs));
902
Amy Malochef3c9db42011-12-08 15:17:35 -0800903 msm_gpiomux_install(msm8960_atmel_configs,
904 ARRAY_SIZE(msm8960_atmel_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800905
906 msm_gpiomux_install(msm8960_slimbus_config,
907 ARRAY_SIZE(msm8960_slimbus_config));
908
909 msm_gpiomux_install(msm8960_audio_codec_configs,
910 ARRAY_SIZE(msm8960_audio_codec_configs));
911
Bhalchandra Gajaredd00a9b2012-05-02 16:44:36 -0700912 msm_gpiomux_install(msm8960_audio_mbhc_configs,
913 ARRAY_SIZE(msm8960_audio_mbhc_configs));
914
Bhalchandra Gajarec0ac7d82012-05-16 11:28:59 -0700915 msm_gpiomux_install(msm8960_audio_spkr_configs,
916 ARRAY_SIZE(msm8960_audio_spkr_configs));
917
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800918 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
919 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
920
921 msm_gpiomux_install(wcnss_5wire_interface,
922 ARRAY_SIZE(wcnss_5wire_interface));
923
924 if (machine_is_msm8930_mtp() || machine_is_msm8930_fluid() ||
Mayank Ranabf5084a2011-12-12 17:06:54 +0530925 machine_is_msm8930_cdp()) {
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800926 msm_gpiomux_install(hap_lvl_shft_config,
927 ARRAY_SIZE(hap_lvl_shft_config));
Mayank Ranabf5084a2011-12-12 17:06:54 +0530928#ifdef MSM8930_PHASE_2
929 msm_gpiomux_install(msm8930_hsusb_configs,
930 ARRAY_SIZE(msm8930_hsusb_configs));
931#endif
932 }
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800933
934 if (PLATFORM_IS_CHARM25())
935 msm_gpiomux_install(mdm_configs,
936 ARRAY_SIZE(mdm_configs));
937
Amy Malochee8de95d2012-02-23 10:40:25 -0800938 if (machine_is_msm8930_cdp() || machine_is_msm8930_mtp()
939 || machine_is_msm8930_fluid())
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530940 msm_gpiomux_install(msm8930_haptics_configs,
941 ARRAY_SIZE(msm8930_haptics_configs));
Anirudh Ghayal8c15f7f2012-01-09 14:04:02 +0530942
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800943#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
944 msm_gpiomux_install(msm8960_hdmi_configs,
945 ARRAY_SIZE(msm8960_hdmi_configs));
Manoj Raoc6d904c2012-06-22 00:32:14 -0700946 if (machine_is_msm8930_fluid())
947 msm_gpiomux_install(msm8930_mhl_configs,
948 ARRAY_SIZE(msm8930_mhl_configs));
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800949#endif
950
951 msm_gpiomux_install(msm8960_mdp_vsync_configs,
952 ARRAY_SIZE(msm8960_mdp_vsync_configs));
Krishna Konda41b6ab02012-05-16 15:08:03 -0700953
954 msm_gpiomux_install(msm8930_sd_det_config,
955 ARRAY_SIZE(msm8930_sd_det_config));
956
Wentao Xuc7769c02012-08-03 15:06:41 -0400957 if (machine_is_msm8930_fluid() || machine_is_msm8930_mtp())
958 msm_gpiomux_install(msm8930_gyro_int_config,
959 ARRAY_SIZE(msm8930_gyro_int_config));
960
Joonwoo Parkb0795e12012-08-24 22:47:53 -0700961 msm_gpiomux_install(msm_sitar_config, ARRAY_SIZE(msm_sitar_config));
962
Stepan Moskovchenko3b09bf52011-12-06 20:40:53 -0800963 return 0;
964}