blob: 71f2b2e17bc96beba60a94f446bdc1800fe42f8a [file] [log] [blame]
Damir Didjusto93768d12013-01-17 11:30:47 -08001/* Copyright (c) 2012-2013, The Linux Foundation. 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
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -080071static struct gpiomux_setting gpio_suspend_config[] = {
72 {
73 .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
74 .drv = GPIOMUX_DRV_2MA,
75 .pull = GPIOMUX_PULL_NONE,
76 },
77 {
78 .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
79 .drv = GPIOMUX_DRV_2MA,
80 .pull = GPIOMUX_PULL_NONE,
81 .dir = GPIOMUX_OUT_LOW,
82 },
83};
84
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -080085static struct gpiomux_setting gpio_epm_config = {
86 .func = GPIOMUX_FUNC_GPIO,
87 .drv = GPIOMUX_DRV_2MA,
88 .pull = GPIOMUX_PULL_DOWN,
89};
90
Sameer Thalappil8d686d42012-08-24 10:07:31 -070091static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
92 .func = GPIOMUX_FUNC_GPIO,
93 .drv = GPIOMUX_DRV_2MA,
94 .pull = GPIOMUX_PULL_UP,
95};
96
97static struct gpiomux_setting wcnss_5wire_active_cfg = {
98 .func = GPIOMUX_FUNC_1,
99 .drv = GPIOMUX_DRV_6MA,
100 .pull = GPIOMUX_PULL_DOWN,
101};
102
Jin Honga04caaa2012-05-23 10:28:27 -0700103static struct gpiomux_setting gpio_i2c_config = {
104 .func = GPIOMUX_FUNC_3,
Gilad Avidovb7d8bb12012-11-09 16:30:37 -0700105 /*
106 * Please keep I2C GPIOs drive-strength at minimum (2ma). It is a
107 * workaround for HW issue of glitches caused by rapid GPIO current-
108 * change.
109 */
110 .drv = GPIOMUX_DRV_2MA,
Jin Honga04caaa2012-05-23 10:28:27 -0700111 .pull = GPIOMUX_PULL_NONE,
112};
113
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700114static struct gpiomux_setting lcd_en_act_cfg = {
115 .func = GPIOMUX_FUNC_GPIO,
116 .drv = GPIOMUX_DRV_8MA,
117 .pull = GPIOMUX_PULL_NONE,
118};
119
120static struct gpiomux_setting lcd_en_sus_cfg = {
121 .func = GPIOMUX_FUNC_GPIO,
122 .drv = GPIOMUX_DRV_2MA,
123 .pull = GPIOMUX_PULL_DOWN,
124};
Sathish Ambleye3154b42012-04-09 10:59:09 -0700125
Amy Maloche9e99a792012-08-15 23:27:51 -0700126static struct gpiomux_setting atmel_resout_sus_cfg = {
127 .func = GPIOMUX_FUNC_GPIO,
128 .drv = GPIOMUX_DRV_6MA,
129 .pull = GPIOMUX_PULL_DOWN,
130};
131
132static struct gpiomux_setting atmel_resout_act_cfg = {
133 .func = GPIOMUX_FUNC_GPIO,
134 .drv = GPIOMUX_DRV_6MA,
135 .pull = GPIOMUX_PULL_UP,
136};
137
138static struct gpiomux_setting atmel_int_act_cfg = {
139 .func = GPIOMUX_FUNC_GPIO,
140 .drv = GPIOMUX_DRV_8MA,
141 .pull = GPIOMUX_PULL_UP,
142};
143
144static struct gpiomux_setting atmel_int_sus_cfg = {
145 .func = GPIOMUX_FUNC_GPIO,
146 .drv = GPIOMUX_DRV_2MA,
147 .pull = GPIOMUX_PULL_DOWN,
148};
149
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700150static struct gpiomux_setting taiko_reset = {
151 .func = GPIOMUX_FUNC_GPIO,
152 .drv = GPIOMUX_DRV_6MA,
153 .pull = GPIOMUX_PULL_NONE,
154 .dir = GPIOMUX_OUT_LOW,
155};
156
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700157static struct gpiomux_setting taiko_int = {
158 .func = GPIOMUX_FUNC_GPIO,
159 .drv = GPIOMUX_DRV_2MA,
160 .pull = GPIOMUX_PULL_NONE,
161};
Amy Maloche527acc42012-12-07 18:40:54 -0800162static struct gpiomux_setting hap_lvl_shft_suspended_config = {
163 .func = GPIOMUX_FUNC_GPIO,
164 .drv = GPIOMUX_DRV_2MA,
165 .pull = GPIOMUX_PULL_DOWN,
166};
167
168static struct gpiomux_setting hap_lvl_shft_active_config = {
169 .func = GPIOMUX_FUNC_GPIO,
170 .drv = GPIOMUX_DRV_8MA,
171 .pull = GPIOMUX_PULL_UP,
172};
173static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
174 {
175 .gpio = 86,
176 .settings = {
177 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
178 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
179 },
180 },
181};
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700182
Amy Maloche9e99a792012-08-15 23:27:51 -0700183static struct msm_gpiomux_config msm_touch_configs[] __initdata = {
184 {
185 .gpio = 60, /* TOUCH RESET */
186 .settings = {
187 [GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
188 [GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
189 },
190 },
191 {
192 .gpio = 61, /* TOUCH IRQ */
193 .settings = {
194 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
195 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
196 },
197 },
198
199};
Ujwal Patel74b5df42012-08-13 22:50:13 -0700200
Manu Gautamac7265b2012-11-21 11:49:15 +0530201static struct gpiomux_setting hsic_sus_cfg = {
202 .func = GPIOMUX_FUNC_GPIO,
203 .drv = GPIOMUX_DRV_2MA,
204 .pull = GPIOMUX_PULL_DOWN,
205 .dir = GPIOMUX_OUT_LOW,
206};
207
208static struct gpiomux_setting hsic_act_cfg = {
209 .func = GPIOMUX_FUNC_1,
210 .drv = GPIOMUX_DRV_12MA,
211 .pull = GPIOMUX_PULL_NONE,
212};
213
214static struct gpiomux_setting hsic_hub_act_cfg = {
215 .func = GPIOMUX_FUNC_GPIO,
216 .drv = GPIOMUX_DRV_2MA,
217 .pull = GPIOMUX_PULL_UP,
218 .dir = GPIOMUX_IN,
219};
220
221static struct msm_gpiomux_config msm_hsic_configs[] = {
222 {
223 .gpio = 144, /*HSIC_STROBE */
224 .settings = {
225 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
226 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
227 },
228 },
229 {
230 .gpio = 145, /* HSIC_DATA */
231 .settings = {
232 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
233 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
234 },
235 },
236};
237
238static struct msm_gpiomux_config msm_hsic_hub_configs[] = {
239 {
240 .gpio = 50, /* HSIC_HUB_INT_N */
241 .settings = {
242 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
243 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
244 },
245 },
246};
247
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700248static struct gpiomux_setting mhl_suspend_config = {
249 .func = GPIOMUX_FUNC_GPIO,
250 .drv = GPIOMUX_DRV_2MA,
251 .pull = GPIOMUX_PULL_DOWN,
252};
253
254static struct gpiomux_setting mhl_active_1_cfg = {
255 .func = GPIOMUX_FUNC_1,
256 .drv = GPIOMUX_DRV_2MA,
257 .pull = GPIOMUX_PULL_UP,
258 .dir = GPIOMUX_OUT_HIGH,
259};
260
261static struct gpiomux_setting mhl_active_2_cfg = {
262 .func = GPIOMUX_FUNC_1,
263 .drv = GPIOMUX_DRV_2MA,
264 .pull = GPIOMUX_PULL_UP,
265};
266
Ujwal Patel74b5df42012-08-13 22:50:13 -0700267static struct gpiomux_setting hdmi_suspend_cfg = {
268 .func = GPIOMUX_FUNC_GPIO,
269 .drv = GPIOMUX_DRV_2MA,
270 .pull = GPIOMUX_PULL_DOWN,
271};
272
273static struct gpiomux_setting hdmi_active_1_cfg = {
274 .func = GPIOMUX_FUNC_1,
275 .drv = GPIOMUX_DRV_2MA,
276 .pull = GPIOMUX_PULL_UP,
277};
278
279static struct gpiomux_setting hdmi_active_2_cfg = {
280 .func = GPIOMUX_FUNC_1,
281 .drv = GPIOMUX_DRV_16MA,
282 .pull = GPIOMUX_PULL_DOWN,
283};
284
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700285static struct msm_gpiomux_config msm_mhl_configs[] __initdata = {
286 {
287 /* mhl-sii8334 pwr */
288 .gpio = 12,
289 .settings = {
290 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
291 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
292 },
293 },
294 {
295 /* mhl-sii8334 intr */
296 .gpio = 82,
297 .settings = {
298 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
299 [GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
300 },
301 },
302 {
303 /* mhl-sii8334 reset */
304 .gpio = 8,
305 .settings = {
306 [GPIOMUX_SUSPENDED] = &mhl_suspend_config,
307 [GPIOMUX_ACTIVE] = &mhl_active_2_cfg,
308 },
309 },
310};
311
312
Ujwal Patel74b5df42012-08-13 22:50:13 -0700313static struct msm_gpiomux_config msm_hdmi_configs[] __initdata = {
314 {
315 .gpio = 31,
316 .settings = {
317 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
318 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
319 },
320 },
321 {
322 .gpio = 32,
323 .settings = {
324 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
325 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
326 },
327 },
328 {
329 .gpio = 33,
330 .settings = {
331 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
332 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
333 },
334 },
335 {
336 .gpio = 34,
337 .settings = {
338 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
339 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
340 },
341 },
342};
343
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800344static struct msm_gpiomux_config msm_rumi_blsp_configs[] __initdata = {
345 {
346 .gpio = 45, /* BLSP2 UART8 TX */
347 .settings = {
348 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
349 },
350 },
351 {
352 .gpio = 46, /* BLSP2 UART8 RX */
353 .settings = {
354 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
355 },
356 },
357};
358
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700359static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
Sathish Ambleye3154b42012-04-09 10:59:09 -0700360#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
361 {
362 .gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */
363 .settings = {
364 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
365 },
366 },
367 {
368 .gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */
369 .settings = {
370 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
371 },
372 },
373 {
374 .gpio = 3, /* BLSP1 QUP SPI_CLK */
375 .settings = {
376 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
377 },
378 },
379 {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700380 .gpio = 9, /* BLSP1 QUP SPI_CS2A_N */
Sathish Ambleye3154b42012-04-09 10:59:09 -0700381 .settings = {
Subbaraman Narayanamurthy3f93ab12012-08-17 19:39:47 -0700382 [GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config,
383 },
384 },
385 {
386 .gpio = 8, /* BLSP1 QUP SPI_CS1_N */
387 .settings = {
388 [GPIOMUX_SUSPENDED] = &gpio_spi_cs1_config,
Sathish Ambleye3154b42012-04-09 10:59:09 -0700389 },
390 },
391#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700392 {
Chandan Uddaraju88b26d72012-08-13 22:28:44 -0700393 .gpio = 58,
394 .settings = {
395 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
396 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
397 },
398 },
399 {
Amy Malochebc7e9672012-08-15 10:30:40 -0700400 .gpio = 6, /* BLSP1 QUP2 I2C_DAT */
401 .settings = {
402 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
403 },
404 },
405 {
406 .gpio = 7, /* BLSP1 QUP2 I2C_CLK */
407 .settings = {
408 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
409 },
410 },
411 {
Jin Honga04caaa2012-05-23 10:28:27 -0700412 .gpio = 83, /* BLSP11 QUP I2C_DAT */
413 .settings = {
414 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
415 },
416 },
417 {
418 .gpio = 84, /* BLSP11 QUP I2C_CLK */
419 .settings = {
420 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
421 },
422 },
423 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700424 .gpio = 4, /* BLSP2 UART TX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700425 .settings = {
426 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
427 },
428 },
429 {
Stepan Moskovchenko5269b602012-08-08 17:57:09 -0700430 .gpio = 5, /* BLSP2 UART RX */
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700431 .settings = {
432 [GPIOMUX_SUSPENDED] = &gpio_uart_config,
433 },
434 },
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600435 {
436 .gpio = 53, /* BLSP2 QUP4 SPI_DATA_MOSI */
437 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800438 [GPIOMUX_ACTIVE] = &gpio_spi_config,
439 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600440 },
441 },
442 {
443 .gpio = 54, /* BLSP2 QUP4 SPI_DATA_MISO */
444 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800445 [GPIOMUX_ACTIVE] = &gpio_spi_config,
446 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600447 },
448 },
449 {
450 .gpio = 56, /* BLSP2 QUP4 SPI_CLK */
451 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800452 [GPIOMUX_ACTIVE] = &gpio_spi_config,
453 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600454 },
455 },
456 {
457 .gpio = 55, /* BLSP2 QUP4 SPI_CS0_N */
458 .settings = {
Pawan Kumar Nimmagaddabefacac2013-01-23 15:36:28 -0800459 [GPIOMUX_ACTIVE] = &gpio_spi_config,
460 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Sagar Dhariae0bb6502012-08-10 20:25:51 -0600461 },
462 },
Siddartha Mohanadossc4bc6ae2012-12-06 14:22:22 -0800463 {
464 .gpio = 81, /* EPM enable */
465 .settings = {
466 [GPIOMUX_SUSPENDED] = &gpio_epm_config,
467 },
468 },
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700469};
470
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600471static struct msm_gpiomux_config msm8974_slimbus_config[] __initdata = {
472 {
473 .gpio = 70, /* slimbus clk */
474 .settings = {
475 [GPIOMUX_SUSPENDED] = &slimbus,
476 },
477 },
478 {
479 .gpio = 71, /* slimbus data */
480 .settings = {
481 [GPIOMUX_SUSPENDED] = &slimbus,
482 },
483 },
484};
485
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700486static struct gpiomux_setting cam_settings[] = {
487 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700488 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700489 .drv = GPIOMUX_DRV_2MA,
490 .pull = GPIOMUX_PULL_NONE,
491 },
492
493 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700494 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700495 .drv = GPIOMUX_DRV_2MA,
496 .pull = GPIOMUX_PULL_DOWN,
497 },
498
499 {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700500 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700501 .drv = GPIOMUX_DRV_2MA,
502 .pull = GPIOMUX_PULL_KEEPER,
503 },
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700504
505 {
506 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
507 .drv = GPIOMUX_DRV_2MA,
508 .pull = GPIOMUX_PULL_NONE,
509 },
510
511 {
512 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
513 .drv = GPIOMUX_DRV_2MA,
514 .pull = GPIOMUX_PULL_DOWN,
515 },
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700516};
517
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530518static struct gpiomux_setting sd_card_det_config = {
519 .func = GPIOMUX_FUNC_GPIO,
520 .drv = GPIOMUX_DRV_2MA,
521 .pull = GPIOMUX_PULL_NONE,
522 .dir = GPIOMUX_IN,
523};
524
525static struct msm_gpiomux_config sd_card_det __initdata = {
526 .gpio = 62,
527 .settings = {
528 [GPIOMUX_ACTIVE] = &sd_card_det_config,
529 [GPIOMUX_SUSPENDED] = &sd_card_det_config,
530 },
531};
532
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700533static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
534 {
535 .gpio = 15, /* CAM_MCLK0 */
536 .settings = {
537 [GPIOMUX_ACTIVE] = &cam_settings[0],
538 [GPIOMUX_SUSPENDED] = &cam_settings[1],
539 },
540 },
541 {
542 .gpio = 16, /* CAM_MCLK1 */
543 .settings = {
544 [GPIOMUX_ACTIVE] = &cam_settings[0],
545 [GPIOMUX_SUSPENDED] = &cam_settings[1],
546 },
547 },
548 {
549 .gpio = 17, /* CAM_MCLK2 */
550 .settings = {
551 [GPIOMUX_ACTIVE] = &cam_settings[0],
552 [GPIOMUX_SUSPENDED] = &cam_settings[1],
553 },
554 },
555 {
556 .gpio = 18, /* WEBCAM1_RESET_N / CAM_MCLK3 */
557 .settings = {
Sreesudhan Ramakrish Ramkumar88c4a092012-09-07 23:43:46 -0700558 [GPIOMUX_ACTIVE] = &cam_settings[3],
559 [GPIOMUX_SUSPENDED] = &cam_settings[4],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700560 },
561 },
562 {
563 .gpio = 19, /* CCI_I2C_SDA0 */
564 .settings = {
565 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800566 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700567 },
568 },
569 {
570 .gpio = 20, /* CCI_I2C_SCL0 */
571 .settings = {
572 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800573 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700574 },
575 },
576 {
577 .gpio = 21, /* CCI_I2C_SDA1 */
578 .settings = {
579 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800580 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700581 },
582 },
583 {
584 .gpio = 22, /* CCI_I2C_SCL1 */
585 .settings = {
586 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800587 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700588 },
589 },
590 {
591 .gpio = 23, /* FLASH_LED_EN */
592 .settings = {
593 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800594 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700595 },
596 },
597 {
598 .gpio = 24, /* FLASH_LED_NOW */
599 .settings = {
600 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800601 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700602 },
603 },
604 {
605 .gpio = 25, /* WEBCAM2_RESET_N */
606 .settings = {
607 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800608 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700609 },
610 },
611 {
612 .gpio = 26, /* CAM_IRQ */
613 .settings = {
614 [GPIOMUX_ACTIVE] = &cam_settings[0],
615 [GPIOMUX_SUSPENDED] = &cam_settings[1],
616 },
617 },
618 {
619 .gpio = 27, /* OIS_SYNC */
620 .settings = {
621 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800622 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700623 },
624 },
625 {
626 .gpio = 28, /* WEBCAM1_STANDBY */
627 .settings = {
628 [GPIOMUX_ACTIVE] = &cam_settings[0],
Pawan Kumar Nimmagadda53621562013-01-28 13:11:44 -0800629 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700630 },
631 },
632 {
633 .gpio = 89, /* CAM1_STANDBY_N */
634 .settings = {
635 [GPIOMUX_ACTIVE] = &cam_settings[0],
636 [GPIOMUX_SUSPENDED] = &cam_settings[1],
637 },
638 },
639 {
640 .gpio = 90, /* CAM1_RST_N */
641 .settings = {
642 [GPIOMUX_ACTIVE] = &cam_settings[0],
643 [GPIOMUX_SUSPENDED] = &cam_settings[1],
644 },
645 },
646 {
647 .gpio = 91, /* CAM2_STANDBY_N */
648 .settings = {
649 [GPIOMUX_ACTIVE] = &cam_settings[0],
650 [GPIOMUX_SUSPENDED] = &cam_settings[1],
651 },
652 },
653 {
654 .gpio = 92, /* CAM2_RST_N */
655 .settings = {
656 [GPIOMUX_ACTIVE] = &cam_settings[0],
657 [GPIOMUX_SUSPENDED] = &cam_settings[1],
658 },
659 },
660};
Damir Didjusto04d3c362013-01-07 14:30:53 -0800661
662static struct gpiomux_setting pri_auxpcm_act_cfg = {
663 .func = GPIOMUX_FUNC_1,
664 .drv = GPIOMUX_DRV_8MA,
665 .pull = GPIOMUX_PULL_NONE,
666};
667
668
669static struct gpiomux_setting pri_auxpcm_sus_cfg = {
670 .func = GPIOMUX_FUNC_1,
671 .drv = GPIOMUX_DRV_2MA,
672 .pull = GPIOMUX_PULL_DOWN,
673};
674
675static struct msm_gpiomux_config msm8974_pri_auxpcm_configs[] __initdata = {
676 {
677 .gpio = 65,
678 .settings = {
679 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
680 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
681 },
682 },
683 {
684 .gpio = 66,
685 .settings = {
686 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
687 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
688 },
689 },
690 {
691 .gpio = 67,
692 .settings = {
693 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
694 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
695 },
696 },
697 {
698 .gpio = 68,
699 .settings = {
700 [GPIOMUX_SUSPENDED] = &pri_auxpcm_sus_cfg,
701 [GPIOMUX_ACTIVE] = &pri_auxpcm_act_cfg,
702 },
703 },
704};
705
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700706static struct msm_gpiomux_config wcnss_5wire_interface[] = {
707 {
708 .gpio = 36,
709 .settings = {
710 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
711 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
712 },
713 },
714 {
715 .gpio = 37,
716 .settings = {
717 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
718 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
719 },
720 },
721 {
722 .gpio = 38,
723 .settings = {
724 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
725 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
726 },
727 },
728 {
729 .gpio = 39,
730 .settings = {
731 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
732 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
733 },
734 },
735 {
736 .gpio = 40,
737 .settings = {
738 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
739 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
740 },
741 },
742};
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700743
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700744static struct msm_gpiomux_config msm_taiko_config[] __initdata = {
745 {
746 .gpio = 63, /* SYS_RST_N */
747 .settings = {
748 [GPIOMUX_SUSPENDED] = &taiko_reset,
749 },
Joonwoo Parkeb84dc72012-09-12 10:22:49 -0700750 },
751 {
752 .gpio = 72, /* CDC_INT */
753 .settings = {
754 [GPIOMUX_SUSPENDED] = &taiko_int,
755 },
756 },
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700757};
758
Subhash Jadavani102f0ce2012-12-14 21:25:59 +0530759#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
760static struct gpiomux_setting sdc3_clk_actv_cfg = {
761 .func = GPIOMUX_FUNC_2,
762 .drv = GPIOMUX_DRV_8MA,
763 .pull = GPIOMUX_PULL_NONE,
764};
765
766static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
767 .func = GPIOMUX_FUNC_2,
768 .drv = GPIOMUX_DRV_8MA,
769 .pull = GPIOMUX_PULL_UP,
770};
771
772static struct gpiomux_setting sdc3_suspend_cfg = {
773 .func = GPIOMUX_FUNC_GPIO,
774 .drv = GPIOMUX_DRV_2MA,
775 .pull = GPIOMUX_PULL_DOWN,
776};
777
778static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
779 .func = GPIOMUX_FUNC_GPIO,
780 .drv = GPIOMUX_DRV_8MA,
781 .pull = GPIOMUX_PULL_UP,
782};
783
784static struct msm_gpiomux_config msm8974_sdc3_configs[] __initdata = {
785 {
786 /* DAT3 */
787 .gpio = 35,
788 .settings = {
789 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
790 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
791 },
792 },
793 {
794 /* DAT2 */
795 .gpio = 36,
796 .settings = {
797 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
798 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
799 },
800 },
801 {
802 /* DAT1 */
803 .gpio = 37,
804 .settings = {
805 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
806 [GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
807 },
808 },
809 {
810 /* DAT0 */
811 .gpio = 38,
812 .settings = {
813 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
814 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
815 },
816 },
817 {
818 /* CMD */
819 .gpio = 39,
820 .settings = {
821 [GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
822 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
823 },
824 },
825 {
826 /* CLK */
827 .gpio = 40,
828 .settings = {
829 [GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
830 [GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
831 },
832 },
833};
834
835static void msm_gpiomux_sdc3_install(void)
836{
837 msm_gpiomux_install(msm8974_sdc3_configs,
838 ARRAY_SIZE(msm8974_sdc3_configs));
839}
840#else
841static void msm_gpiomux_sdc3_install(void) {}
842#endif /* CONFIG_MMC_MSM_SDC3_SUPPORT */
843
844#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
845static struct gpiomux_setting sdc4_clk_actv_cfg = {
846 .func = GPIOMUX_FUNC_2,
847 .drv = GPIOMUX_DRV_8MA,
848 .pull = GPIOMUX_PULL_NONE,
849};
850
851static struct gpiomux_setting sdc4_cmd_data_0_3_actv_cfg = {
852 .func = GPIOMUX_FUNC_2,
853 .drv = GPIOMUX_DRV_8MA,
854 .pull = GPIOMUX_PULL_UP,
855};
856
857static struct gpiomux_setting sdc4_suspend_cfg = {
858 .func = GPIOMUX_FUNC_GPIO,
859 .drv = GPIOMUX_DRV_2MA,
860 .pull = GPIOMUX_PULL_DOWN,
861};
862
863static struct gpiomux_setting sdc4_data_1_suspend_cfg = {
864 .func = GPIOMUX_FUNC_GPIO,
865 .drv = GPIOMUX_DRV_8MA,
866 .pull = GPIOMUX_PULL_UP,
867};
868
869static struct msm_gpiomux_config msm8974_sdc4_configs[] __initdata = {
870 {
871 /* DAT3 */
872 .gpio = 92,
873 .settings = {
874 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
875 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
876 },
877 },
878 {
879 /* DAT2 */
880 .gpio = 94,
881 .settings = {
882 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
883 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
884 },
885 },
886 {
887 /* DAT1 */
888 .gpio = 95,
889 .settings = {
890 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
891 [GPIOMUX_SUSPENDED] = &sdc4_data_1_suspend_cfg,
892 },
893 },
894 {
895 /* DAT0 */
896 .gpio = 96,
897 .settings = {
898 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
899 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
900 },
901 },
902 {
903 /* CMD */
904 .gpio = 91,
905 .settings = {
906 [GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
907 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
908 },
909 },
910 {
911 /* CLK */
912 .gpio = 93,
913 .settings = {
914 [GPIOMUX_ACTIVE] = &sdc4_clk_actv_cfg,
915 [GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
916 },
917 },
918};
919
920static void msm_gpiomux_sdc4_install(void)
921{
922 msm_gpiomux_install(msm8974_sdc4_configs,
923 ARRAY_SIZE(msm8974_sdc4_configs));
924}
925#else
926static void msm_gpiomux_sdc4_install(void) {}
927#endif /* CONFIG_MMC_MSM_SDC4_SUPPORT */
928
Abhimanyu Kapur90ced6e2012-06-26 17:41:25 -0700929void __init msm_8974_init_gpiomux(void)
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700930{
931 int rc;
932
Rohit Vaswani341c2032012-11-08 18:49:29 -0800933 rc = msm_gpiomux_init_dt();
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700934 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800935 pr_err("%s failed %d\n", __func__, rc);
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700936 return;
937 }
938
Sathish Ambleye3154b42012-04-09 10:59:09 -0700939#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
940 msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
941#endif
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700942 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Sameer Thalappil8d686d42012-08-24 10:07:31 -0700943 msm_gpiomux_install(wcnss_5wire_interface,
944 ARRAY_SIZE(wcnss_5wire_interface));
Sagar Dhariaa8e6b0a2012-08-10 20:52:30 -0600945
946 msm_gpiomux_install(msm8974_slimbus_config,
947 ARRAY_SIZE(msm8974_slimbus_config));
948
Amy Maloche9e99a792012-08-15 23:27:51 -0700949 msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));
Amy Maloche527acc42012-12-07 18:40:54 -0800950 msm_gpiomux_install(hap_lvl_shft_config,
951 ARRAY_SIZE(hap_lvl_shft_config));
Kevin Chanbdcf7ef2012-08-24 08:33:33 -0700952
953 msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700954
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530955 msm_gpiomux_install(&sd_card_det, 1);
Subhash Jadavani102f0ce2012-12-14 21:25:59 +0530956 msm_gpiomux_sdc3_install();
957 msm_gpiomux_sdc4_install();
Subhash Jadavani76aa7de2012-10-10 09:58:17 +0530958
Joonwoo Park187e9cb2012-08-24 22:47:53 -0700959 msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));
Ujwal Patel74b5df42012-08-13 22:50:13 -0700960
Manu Gautamac7265b2012-11-21 11:49:15 +0530961 msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));
962 msm_gpiomux_install(msm_hsic_hub_configs,
963 ARRAY_SIZE(msm_hsic_hub_configs));
964
Ujwal Patel74b5df42012-08-13 22:50:13 -0700965 msm_gpiomux_install(msm_hdmi_configs, ARRAY_SIZE(msm_hdmi_configs));
Manoj Rao5bf2a7e2012-10-29 12:53:27 -0700966 msm_gpiomux_install(msm_mhl_configs, ARRAY_SIZE(msm_mhl_configs));
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800967
Damir Didjusto04d3c362013-01-07 14:30:53 -0800968 msm_gpiomux_install(msm8974_pri_auxpcm_configs,
969 ARRAY_SIZE(msm8974_pri_auxpcm_configs));
970
Stepan Moskovchenko95108b82012-11-27 14:28:11 -0800971 if (machine_is_msm8974_rumi())
972 msm_gpiomux_install(msm_rumi_blsp_configs,
973 ARRAY_SIZE(msm_rumi_blsp_configs));
Sathish Ambleyb17ec7e2012-04-03 15:20:03 -0700974}