blob: b1e107d10d3a7f354fe63cb50203f90f18772d38 [file] [log] [blame]
Damir Didjusto04d3c362013-01-07 14:30:53 -08001/* Copyright (c) 2012-2013, Code Aurora Forum. All rights reserved.
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -07002 *
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,
Gilad Avidovb7d8bb12012-11-09 16:30:37 -070091 /*
92 * Please keep I2C GPIOs drive-strength at minimum (2ma). It is a
93 * workaround for HW issue of glitches caused by rapid GPIO current-
94 * change.
95 */
96 .drv = GPIOMUX_DRV_2MA,
Jin Honga04caaa2012-05-23 10:28:27 -070097 .pull = GPIOMUX_PULL_NONE,
98};
99
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700100static struct gpiomux_setting lcd_en_act_cfg = {
101 .func = GPIOMUX_FUNC_GPIO,
102 .drv = GPIOMUX_DRV_8MA,
103 .pull = GPIOMUX_PULL_NONE,
104};
105
106static struct gpiomux_setting lcd_en_sus_cfg = {
107 .func = GPIOMUX_FUNC_GPIO,
108 .drv = GPIOMUX_DRV_2MA,
109 .pull = GPIOMUX_PULL_DOWN,
110};
Sathish Ambleye3154b42012-04-09 10:59:09 -0700111
Amy Maloche9e99a792012-08-15 23:27:51 -0700112static struct gpiomux_setting atmel_resout_sus_cfg = {
113 .func = GPIOMUX_FUNC_GPIO,
114 .drv = GPIOMUX_DRV_6MA,
115 .pull = GPIOMUX_PULL_DOWN,
116};
117
118static struct gpiomux_setting atmel_resout_act_cfg = {
119 .func = GPIOMUX_FUNC_GPIO,
120 .drv = GPIOMUX_DRV_6MA,
121 .pull = GPIOMUX_PULL_UP,
122};
123
124static struct gpiomux_setting atmel_int_act_cfg = {
125 .func = GPIOMUX_FUNC_GPIO,
126 .drv = GPIOMUX_DRV_8MA,
127 .pull = GPIOMUX_PULL_UP,
128};
129
130static struct gpiomux_setting atmel_int_sus_cfg = {
131 .func = GPIOMUX_FUNC_GPIO,
132 .drv = GPIOMUX_DRV_2MA,
133 .pull = GPIOMUX_PULL_DOWN,
134};
135
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700136static struct gpiomux_setting taiko_reset = {
137 .func = GPIOMUX_FUNC_GPIO,
138 .drv = GPIOMUX_DRV_6MA,
139 .pull = GPIOMUX_PULL_NONE,
140 .dir = GPIOMUX_OUT_LOW,
141};
142
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700143static struct gpiomux_setting taiko_int = {
144 .func = GPIOMUX_FUNC_GPIO,
145 .drv = GPIOMUX_DRV_2MA,
146 .pull = GPIOMUX_PULL_NONE,
147};
Amy Maloche527acc42012-12-07 18:40:54 -0800148static struct gpiomux_setting hap_lvl_shft_suspended_config = {
149 .func = GPIOMUX_FUNC_GPIO,
150 .drv = GPIOMUX_DRV_2MA,
151 .pull = GPIOMUX_PULL_DOWN,
152};
153
154static struct gpiomux_setting hap_lvl_shft_active_config = {
155 .func = GPIOMUX_FUNC_GPIO,
156 .drv = GPIOMUX_DRV_8MA,
157 .pull = GPIOMUX_PULL_UP,
158};
159static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
160 {
161 .gpio = 86,
162 .settings = {
163 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
164 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
165 },
166 },
167};
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700168
Amy Maloche9e99a792012-08-15 23:27:51 -0700169static struct msm_gpiomux_config msm_touch_configs[] __initdata = {
170 {
171 .gpio = 60, /* TOUCH RESET */
172 .settings = {
173 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
174 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
175 },
176 },
177 {
178 .gpio = 61, /* TOUCH IRQ */
179 .settings = {
180 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
181 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
182 },
183 },
184
185};
Ujwal Patel74b5df42012-08-13 22:50:13 -0700186
Manu Gautamac7265b2012-11-21 11:49:15 +0530187static struct gpiomux_setting hsic_sus_cfg = {
188 .func = GPIOMUX_FUNC_GPIO,
189 .drv = GPIOMUX_DRV_2MA,
190 .pull = GPIOMUX_PULL_DOWN,
191 .dir = GPIOMUX_OUT_LOW,
192};
193
194static struct gpiomux_setting hsic_act_cfg = {
195 .func = GPIOMUX_FUNC_1,
196 .drv = GPIOMUX_DRV_12MA,
197 .pull = GPIOMUX_PULL_NONE,
198};
199
200static struct gpiomux_setting hsic_hub_act_cfg = {
201 .func = GPIOMUX_FUNC_GPIO,
202 .drv = GPIOMUX_DRV_2MA,
203 .pull = GPIOMUX_PULL_UP,
204 .dir = GPIOMUX_IN,
205};
206
207static struct msm_gpiomux_config msm_hsic_configs[] = {
208 {
209 .gpio = 144, /*HSIC_STROBE */
210 .settings = {
211 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
212 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
213 },
214 },
215 {
216 .gpio = 145, /* HSIC_DATA */
217 .settings = {
218 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
219 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
220 },
221 },
222};
223
224static struct msm_gpiomux_config msm_hsic_hub_configs[] = {
225 {
226 .gpio = 50, /* HSIC_HUB_INT_N */
227 .settings = {
228 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
229 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
230 },
231 },
232};
233
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700234static struct gpiomux_setting mhl_suspend_config = {
235 .func = GPIOMUX_FUNC_GPIO,
236 .drv = GPIOMUX_DRV_2MA,
237 .pull = GPIOMUX_PULL_DOWN,
238};
239
240static struct gpiomux_setting mhl_active_1_cfg = {
241 .func = GPIOMUX_FUNC_1,
242 .drv = GPIOMUX_DRV_2MA,
243 .pull = GPIOMUX_PULL_UP,
244 .dir = GPIOMUX_OUT_HIGH,
245};
246
247static struct gpiomux_setting mhl_active_2_cfg = {
248 .func = GPIOMUX_FUNC_1,
249 .drv = GPIOMUX_DRV_2MA,
250 .pull = GPIOMUX_PULL_UP,
251};
252
Ujwal Patel74b5df42012-08-13 22:50:13 -0700253static struct gpiomux_setting hdmi_suspend_cfg = {
254 .func = GPIOMUX_FUNC_GPIO,
255 .drv = GPIOMUX_DRV_2MA,
256 .pull = GPIOMUX_PULL_DOWN,
257};
258
259static struct gpiomux_setting hdmi_active_1_cfg = {
260 .func = GPIOMUX_FUNC_1,
261 .drv = GPIOMUX_DRV_2MA,
262 .pull = GPIOMUX_PULL_UP,
263};
264
265static struct gpiomux_setting hdmi_active_2_cfg = {
266 .func = GPIOMUX_FUNC_1,
267 .drv = GPIOMUX_DRV_16MA,
268 .pull = GPIOMUX_PULL_DOWN,
269};
270
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700271static struct msm_gpiomux_config msm_mhl_configs[] __initdata = {
272 {
273 /* mhl-sii8334 pwr */
274 .gpio = 12,
275 .settings = {
276 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
277 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
278 },
279 },
280 {
281 /* mhl-sii8334 intr */
282 .gpio = 82,
283 .settings = {
284 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
285 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
286 },
287 },
288 {
289 /* mhl-sii8334 reset */
290 .gpio = 8,
291 .settings = {
292 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
293 [GPIOMUX_ACTIVE] = &mhl_active_2_cfg,
294 },
295 },
296};
297
298
Ujwal Patel74b5df42012-08-13 22:50:13 -0700299static struct msm_gpiomux_config msm_hdmi_configs[] __initdata = {
300 {
301 .gpio = 31,
302 .settings = {
303 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
304 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
305 },
306 },
307 {
308 .gpio = 32,
309 .settings = {
310 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
311 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
312 },
313 },
314 {
315 .gpio = 33,
316 .settings = {
317 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
318 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
319 },
320 },
321 {
322 .gpio = 34,
323 .settings = {
324 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
325 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
326 },
327 },
328};
329
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800330static struct msm_gpiomux_config msm_rumi_blsp_configs[] __initdata = {
331 {
332 .gpio = 45, /* BLSP2 UART8 TX */
333 .settings = {
334 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
335 },
336 },
337 {
338 .gpio = 46, /* BLSP2 UART8 RX */
339 .settings = {
340 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
341 },
342 },
343};
344
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700345static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
Sathish Ambleye3154b42012-04-09 10:59:09 -0700346#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
347 {
348 .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */
349 .settings = {
350 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
351 },
352 },
353 {
354 .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */
355 .settings = {
356 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
357 },
358 },
359 {
360 .gpio = 3, /* BLSP1 QUP SPI_CLK */
361 .settings = {
362 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
363 },
364 },
365 {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700366 .gpio = 9, /* BLSP1 QUP SPI_CS2A_N */
Sathish Ambleye3154b42012-04-09 10:59:09 -0700367 .settings = {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700368 [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config,
369 },
370 },
371 {
372 .gpio = 8, /* BLSP1 QUP SPI_CS1_N */
373 .settings = {
374 [GPIOMUX_SUSPENDED] = &gpio_spi_cs1_config,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700375 },
376 },
377#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700378 {
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700379 .gpio = 58,
380 .settings = {
381 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
382 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
383 },
384 },
385 {
Amy Malochebc7e9672012-08-15 10:30:40 -0700386 .gpio = 6, /* BLSP1 QUP2 I2C_DAT */
387 .settings = {
388 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
389 },
390 },
391 {
392 .gpio = 7, /* BLSP1 QUP2 I2C_CLK */
393 .settings = {
394 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
395 },
396 },
397 {
Jin Honga04caaa2012-05-23 10:28:27 -0700398 .gpio = 83, /* BLSP11 QUP I2C_DAT */
399 .settings = {
400 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
401 },
402 },
403 {
404 .gpio = 84, /* BLSP11 QUP I2C_CLK */
405 .settings = {
406 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
407 },
408 },
409 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700410 .gpio = 4, /* BLSP2 UART TX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700411 .settings = {
412 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
413 },
414 },
415 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700416 .gpio = 5, /* BLSP2 UART RX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700417 .settings = {
418 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
419 },
420 },
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600421 {
422 .gpio = 53, /* BLSP2 QUP4 SPI_DATA_MOSI */
423 .settings = {
424 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
425 },
426 },
427 {
428 .gpio = 54, /* BLSP2 QUP4 SPI_DATA_MISO */
429 .settings = {
430 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
431 },
432 },
433 {
434 .gpio = 56, /* BLSP2 QUP4 SPI_CLK */
435 .settings = {
436 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
437 },
438 },
439 {
440 .gpio = 55, /* BLSP2 QUP4 SPI_CS0_N */
441 .settings = {
442 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
443 },
444 },
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -0800445 {
446 .gpio = 81, /* EPM enable */
447 .settings = {
448 [GPIOMUX_SUSPENDED] = &gpio_epm_config,
449 },
450 },
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700451};
452
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600453static struct msm_gpiomux_config msm8974_slimbus_config[] __initdata = {
454 {
455 .gpio = 70, /* slimbus clk */
456 .settings = {
457 [GPIOMUX_SUSPENDED] = &slimbus,
458 },
459 },
460 {
461 .gpio = 71, /* slimbus data */
462 .settings = {
463 [GPIOMUX_SUSPENDED] = &slimbus,
464 },
465 },
466};
467
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700468static struct gpiomux_setting cam_settings[] = {
469 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700470 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700471 .drv = GPIOMUX_DRV_2MA,
472 .pull = GPIOMUX_PULL_NONE,
473 },
474
475 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700476 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700477 .drv = GPIOMUX_DRV_2MA,
478 .pull = GPIOMUX_PULL_DOWN,
479 },
480
481 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700482 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700483 .drv = GPIOMUX_DRV_2MA,
484 .pull = GPIOMUX_PULL_KEEPER,
485 },
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700486
487 {
488 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
489 .drv = GPIOMUX_DRV_2MA,
490 .pull = GPIOMUX_PULL_NONE,
491 },
492
493 {
494 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
495 .drv = GPIOMUX_DRV_2MA,
496 .pull = GPIOMUX_PULL_DOWN,
497 },
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700498};
499
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530500static struct gpiomux_setting sd_card_det_config = {
501 .func = GPIOMUX_FUNC_GPIO,
502 .drv = GPIOMUX_DRV_2MA,
503 .pull = GPIOMUX_PULL_NONE,
504 .dir = GPIOMUX_IN,
505};
506
507static struct msm_gpiomux_config sd_card_det __initdata = {
508 .gpio = 62,
509 .settings = {
510 [GPIOMUX_ACTIVE] = &sd_card_det_config,
511 [GPIOMUX_SUSPENDED] = &sd_card_det_config,
512 },
513};
514
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700515static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
516 {
517 .gpio = 15, /* CAM_MCLK0 */
518 .settings = {
519 [GPIOMUX_ACTIVE] = &cam_settings[0],
520 [GPIOMUX_SUSPENDED] = &cam_settings[1],
521 },
522 },
523 {
524 .gpio = 16, /* CAM_MCLK1 */
525 .settings = {
526 [GPIOMUX_ACTIVE] = &cam_settings[0],
527 [GPIOMUX_SUSPENDED] = &cam_settings[1],
528 },
529 },
530 {
531 .gpio = 17, /* CAM_MCLK2 */
532 .settings = {
533 [GPIOMUX_ACTIVE] = &cam_settings[0],
534 [GPIOMUX_SUSPENDED] = &cam_settings[1],
535 },
536 },
537 {
538 .gpio = 18, /* WEBCAM1_RESET_N / CAM_MCLK3 */
539 .settings = {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700540 [GPIOMUX_ACTIVE] = &cam_settings[3],
541 [GPIOMUX_SUSPENDED] = &cam_settings[4],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700542 },
543 },
544 {
545 .gpio = 19, /* CCI_I2C_SDA0 */
546 .settings = {
547 [GPIOMUX_ACTIVE] = &cam_settings[0],
548 [GPIOMUX_SUSPENDED] = &cam_settings[2],
549 },
550 },
551 {
552 .gpio = 20, /* CCI_I2C_SCL0 */
553 .settings = {
554 [GPIOMUX_ACTIVE] = &cam_settings[0],
555 [GPIOMUX_SUSPENDED] = &cam_settings[2],
556 },
557 },
558 {
559 .gpio = 21, /* CCI_I2C_SDA1 */
560 .settings = {
561 [GPIOMUX_ACTIVE] = &cam_settings[0],
562 [GPIOMUX_SUSPENDED] = &cam_settings[2],
563 },
564 },
565 {
566 .gpio = 22, /* CCI_I2C_SCL1 */
567 .settings = {
568 [GPIOMUX_ACTIVE] = &cam_settings[0],
569 [GPIOMUX_SUSPENDED] = &cam_settings[2],
570 },
571 },
572 {
573 .gpio = 23, /* FLASH_LED_EN */
574 .settings = {
575 [GPIOMUX_ACTIVE] = &cam_settings[0],
576 [GPIOMUX_SUSPENDED] = &cam_settings[1],
577 },
578 },
579 {
580 .gpio = 24, /* FLASH_LED_NOW */
581 .settings = {
582 [GPIOMUX_ACTIVE] = &cam_settings[0],
583 [GPIOMUX_SUSPENDED] = &cam_settings[1],
584 },
585 },
586 {
587 .gpio = 25, /* WEBCAM2_RESET_N */
588 .settings = {
589 [GPIOMUX_ACTIVE] = &cam_settings[0],
590 [GPIOMUX_SUSPENDED] = &cam_settings[1],
591 },
592 },
593 {
594 .gpio = 26, /* CAM_IRQ */
595 .settings = {
596 [GPIOMUX_ACTIVE] = &cam_settings[0],
597 [GPIOMUX_SUSPENDED] = &cam_settings[1],
598 },
599 },
600 {
601 .gpio = 27, /* OIS_SYNC */
602 .settings = {
603 [GPIOMUX_ACTIVE] = &cam_settings[0],
604 [GPIOMUX_SUSPENDED] = &cam_settings[1],
605 },
606 },
607 {
608 .gpio = 28, /* WEBCAM1_STANDBY */
609 .settings = {
610 [GPIOMUX_ACTIVE] = &cam_settings[0],
611 [GPIOMUX_SUSPENDED] = &cam_settings[1],
612 },
613 },
614 {
615 .gpio = 89, /* CAM1_STANDBY_N */
616 .settings = {
617 [GPIOMUX_ACTIVE] = &cam_settings[0],
618 [GPIOMUX_SUSPENDED] = &cam_settings[1],
619 },
620 },
621 {
622 .gpio = 90, /* CAM1_RST_N */
623 .settings = {
624 [GPIOMUX_ACTIVE] = &cam_settings[0],
625 [GPIOMUX_SUSPENDED] = &cam_settings[1],
626 },
627 },
628 {
629 .gpio = 91, /* CAM2_STANDBY_N */
630 .settings = {
631 [GPIOMUX_ACTIVE] = &cam_settings[0],
632 [GPIOMUX_SUSPENDED] = &cam_settings[1],
633 },
634 },
635 {
636 .gpio = 92, /* CAM2_RST_N */
637 .settings = {
638 [GPIOMUX_ACTIVE] = &cam_settings[0],
639 [GPIOMUX_SUSPENDED] = &cam_settings[1],
640 },
641 },
642};
Damir Didjusto04d3c362013-01-07 14:30:53 -0800643
644static struct gpiomux_setting pri_auxpcm_act_cfg = {
645 .func = GPIOMUX_FUNC_1,
646 .drv = GPIOMUX_DRV_8MA,
647 .pull = GPIOMUX_PULL_NONE,
648};
649
650
651static struct gpiomux_setting pri_auxpcm_sus_cfg = {
652 .func = GPIOMUX_FUNC_1,
653 .drv = GPIOMUX_DRV_2MA,
654 .pull = GPIOMUX_PULL_DOWN,
655};
656
657static struct msm_gpiomux_config msm8974_pri_auxpcm_configs[] __initdata = {
658 {
659 .gpio = 65,
660 .settings = {
661 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
662 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
663 },
664 },
665 {
666 .gpio = 66,
667 .settings = {
668 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
669 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
670 },
671 },
672 {
673 .gpio = 67,
674 .settings = {
675 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
676 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
677 },
678 },
679 {
680 .gpio = 68,
681 .settings = {
682 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
683 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
684 },
685 },
686};
687
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700688static struct msm_gpiomux_config wcnss_5wire_interface[] = {
689 {
690 .gpio = 36,
691 .settings = {
692 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
693 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
694 },
695 },
696 {
697 .gpio = 37,
698 .settings = {
699 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
700 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
701 },
702 },
703 {
704 .gpio = 38,
705 .settings = {
706 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
707 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
708 },
709 },
710 {
711 .gpio = 39,
712 .settings = {
713 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
714 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
715 },
716 },
717 {
718 .gpio = 40,
719 .settings = {
720 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
721 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
722 },
723 },
724};
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700725
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700726static struct msm_gpiomux_config msm_taiko_config[] __initdata = {
727 {
728 .gpio = 63, /* SYS_RST_N */
729 .settings = {
730 [GPIOMUX_SUSPENDED] = &taiko_reset,
731 },
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700732 },
733 {
734 .gpio = 72, /* CDC_INT */
735 .settings = {
736 [GPIOMUX_SUSPENDED] = &taiko_int,
737 },
738 },
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700739};
740
Subhash Jadavani102f0ce2012-12-14 21:25:59 +0530741#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
742static struct gpiomux_setting sdc3_clk_actv_cfg = {
743 .func = GPIOMUX_FUNC_2,
744 .drv = GPIOMUX_DRV_8MA,
745 .pull = GPIOMUX_PULL_NONE,
746};
747
748static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
749 .func = GPIOMUX_FUNC_2,
750 .drv = GPIOMUX_DRV_8MA,
751 .pull = GPIOMUX_PULL_UP,
752};
753
754static struct gpiomux_setting sdc3_suspend_cfg = {
755 .func = GPIOMUX_FUNC_GPIO,
756 .drv = GPIOMUX_DRV_2MA,
757 .pull = GPIOMUX_PULL_DOWN,
758};
759
760static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
761 .func = GPIOMUX_FUNC_GPIO,
762 .drv = GPIOMUX_DRV_8MA,
763 .pull = GPIOMUX_PULL_UP,
764};
765
766static struct msm_gpiomux_config msm8974_sdc3_configs[] __initdata = {
767 {
768 /* DAT3 */
769 .gpio = 35,
770 .settings = {
771 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
772 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
773 },
774 },
775 {
776 /* DAT2 */
777 .gpio = 36,
778 .settings = {
779 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
780 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
781 },
782 },
783 {
784 /* DAT1 */
785 .gpio = 37,
786 .settings = {
787 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
788 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
789 },
790 },
791 {
792 /* DAT0 */
793 .gpio = 38,
794 .settings = {
795 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
796 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
797 },
798 },
799 {
800 /* CMD */
801 .gpio = 39,
802 .settings = {
803 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
804 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
805 },
806 },
807 {
808 /* CLK */
809 .gpio = 40,
810 .settings = {
811 [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
812 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
813 },
814 },
815};
816
817static void msm_gpiomux_sdc3_install(void)
818{
819 msm_gpiomux_install(msm8974_sdc3_configs,
820 ARRAY_SIZE(msm8974_sdc3_configs));
821}
822#else
823static void msm_gpiomux_sdc3_install(void) {}
824#endif /* CONFIG_MMC_MSM_SDC3_SUPPORT */
825
826#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
827static struct gpiomux_setting sdc4_clk_actv_cfg = {
828 .func = GPIOMUX_FUNC_2,
829 .drv = GPIOMUX_DRV_8MA,
830 .pull = GPIOMUX_PULL_NONE,
831};
832
833static struct gpiomux_setting sdc4_cmd_data_0_3_actv_cfg = {
834 .func = GPIOMUX_FUNC_2,
835 .drv = GPIOMUX_DRV_8MA,
836 .pull = GPIOMUX_PULL_UP,
837};
838
839static struct gpiomux_setting sdc4_suspend_cfg = {
840 .func = GPIOMUX_FUNC_GPIO,
841 .drv = GPIOMUX_DRV_2MA,
842 .pull = GPIOMUX_PULL_DOWN,
843};
844
845static struct gpiomux_setting sdc4_data_1_suspend_cfg = {
846 .func = GPIOMUX_FUNC_GPIO,
847 .drv = GPIOMUX_DRV_8MA,
848 .pull = GPIOMUX_PULL_UP,
849};
850
851static struct msm_gpiomux_config msm8974_sdc4_configs[] __initdata = {
852 {
853 /* DAT3 */
854 .gpio = 92,
855 .settings = {
856 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
857 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
858 },
859 },
860 {
861 /* DAT2 */
862 .gpio = 94,
863 .settings = {
864 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
865 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
866 },
867 },
868 {
869 /* DAT1 */
870 .gpio = 95,
871 .settings = {
872 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
873 [GPIOMUX_SUSPENDED] = &sdc4_data_1_suspend_cfg,
874 },
875 },
876 {
877 /* DAT0 */
878 .gpio = 96,
879 .settings = {
880 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
881 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
882 },
883 },
884 {
885 /* CMD */
886 .gpio = 91,
887 .settings = {
888 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
889 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
890 },
891 },
892 {
893 /* CLK */
894 .gpio = 93,
895 .settings = {
896 [GPIOMUX_ACTIVE] = &sdc4_clk_actv_cfg,
897 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
898 },
899 },
900};
901
902static void msm_gpiomux_sdc4_install(void)
903{
904 msm_gpiomux_install(msm8974_sdc4_configs,
905 ARRAY_SIZE(msm8974_sdc4_configs));
906}
907#else
908static void msm_gpiomux_sdc4_install(void) {}
909#endif /* CONFIG_MMC_MSM_SDC4_SUPPORT */
910
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700911void __init msm_8974_init_gpiomux(void)
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700912{
913 int rc;
914
Rohit Vaswani341c2032012-11-08 18:49:29 -0800915 rc = msm_gpiomux_init_dt();
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700916 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800917 pr_err("%s failed %d\n", __func__, rc);
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700918 return;
919 }
920
Sathish Ambleye3154b42012-04-09 10:59:09 -0700921#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
922 msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
923#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700924 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700925 msm_gpiomux_install(wcnss_5wire_interface,
926 ARRAY_SIZE(wcnss_5wire_interface));
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600927
928 msm_gpiomux_install(msm8974_slimbus_config,
929 ARRAY_SIZE(msm8974_slimbus_config));
930
Amy Maloche9e99a792012-08-15 23:27:51 -0700931 msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));
Amy Maloche527acc42012-12-07 18:40:54 -0800932 msm_gpiomux_install(hap_lvl_shft_config,
933 ARRAY_SIZE(hap_lvl_shft_config));
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700934
935 msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700936
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530937 msm_gpiomux_install(&sd_card_det, 1);
Subhash Jadavani102f0ce2012-12-14 21:25:59 +0530938 msm_gpiomux_sdc3_install();
939 msm_gpiomux_sdc4_install();
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530940
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700941 msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));
Ujwal Patel74b5df42012-08-13 22:50:13 -0700942
Manu Gautamac7265b2012-11-21 11:49:15 +0530943 msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));
944 msm_gpiomux_install(msm_hsic_hub_configs,
945 ARRAY_SIZE(msm_hsic_hub_configs));
946
Ujwal Patel74b5df42012-08-13 22:50:13 -0700947 msm_gpiomux_install(msm_hdmi_configs, ARRAY_SIZE(msm_hdmi_configs));
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700948 msm_gpiomux_install(msm_mhl_configs, ARRAY_SIZE(msm_mhl_configs));
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800949
Damir Didjusto04d3c362013-01-07 14:30:53 -0800950 msm_gpiomux_install(msm8974_pri_auxpcm_configs,
951 ARRAY_SIZE(msm8974_pri_auxpcm_configs));
952
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800953 if (machine_is_msm8974_rumi())
954 msm_gpiomux_install(msm_rumi_blsp_configs,
955 ARRAY_SIZE(msm_rumi_blsp_configs));
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700956}