blob: 20bb0e43aceab79c9456e253d7ce4b7c96cf2089 [file] [log] [blame]
Bingzhe Cai43bed2b2014-01-02 14:07:31 +08001/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
Hanumant Singh55a1bb02012-11-06 10:01:15 -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
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>
Figo Wangb1510f82013-06-13 19:40:20 +080019#include <mach/socinfo.h>
Hanumant Singh55a1bb02012-11-06 10:01:15 -080020
Gilad Avidova460c472013-04-12 16:23:32 -060021static struct gpiomux_setting gpio_spi_config = {
22 .func = GPIOMUX_FUNC_1,
23 .drv = GPIOMUX_DRV_6MA,
24 .pull = GPIOMUX_PULL_NONE,
25};
Sana Venkat Rajue53161a2013-09-17 16:33:26 +053026static struct gpiomux_setting gpio_spi_susp_config = {
27 .func = GPIOMUX_FUNC_GPIO,
28 .drv = GPIOMUX_DRV_2MA,
29 .pull = GPIOMUX_PULL_DOWN,
30};
Gilad Avidova460c472013-04-12 16:23:32 -060031
Gilad Avidovf84f2792013-01-31 13:26:39 -070032static struct gpiomux_setting gpio_i2c_config = {
33 .func = GPIOMUX_FUNC_3,
34 .drv = GPIOMUX_DRV_2MA,
35 .pull = GPIOMUX_PULL_NONE,
36};
37
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -060038static struct gpiomux_setting gpio_cam_i2c_config = {
39 .func = GPIOMUX_FUNC_1,
40 .drv = GPIOMUX_DRV_2MA,
41 .pull = GPIOMUX_PULL_NONE,
42};
43
Bansidhar Gopalacharie331f372013-09-25 19:50:43 +010044static struct gpiomux_setting gpio_nfc_config = {
45 .func = GPIOMUX_FUNC_2,
46 .drv = GPIOMUX_DRV_2MA,
47 .pull = GPIOMUX_PULL_NONE,
48};
49static struct gpiomux_setting gpio_nfc_sus_config = {
50 .func = GPIOMUX_FUNC_2,
51 .drv = GPIOMUX_DRV_2MA,
52 .pull = GPIOMUX_PULL_DOWN,
53};
54
Chun Zhangf39a0652013-05-01 15:57:54 -070055static struct gpiomux_setting atmel_int_act_cfg = {
56 .func = GPIOMUX_FUNC_GPIO,
57 .drv = GPIOMUX_DRV_8MA,
58 .pull = GPIOMUX_PULL_UP,
Gilad Avidovf58f1832013-01-09 17:31:28 -070059};
60
Chun Zhangf39a0652013-05-01 15:57:54 -070061static struct gpiomux_setting atmel_int_sus_cfg = {
62 .func = GPIOMUX_FUNC_GPIO,
63 .drv = GPIOMUX_DRV_2MA,
64 .pull = GPIOMUX_PULL_DOWN,
65};
66
67static struct gpiomux_setting atmel_reset_act_cfg = {
68 .func = GPIOMUX_FUNC_GPIO,
69 .drv = GPIOMUX_DRV_6MA,
70 .pull = GPIOMUX_PULL_UP,
71};
72
73static struct gpiomux_setting atmel_reset_sus_cfg = {
74 .func = GPIOMUX_FUNC_GPIO,
Gilad Avidovf58f1832013-01-09 17:31:28 -070075 .drv = GPIOMUX_DRV_6MA,
76 .pull = GPIOMUX_PULL_DOWN,
77};
78
Figo Wangb1510f82013-06-13 19:40:20 +080079static struct gpiomux_setting focaltech_int_act_cfg = {
80 .func = GPIOMUX_FUNC_GPIO,
81 .drv = GPIOMUX_DRV_8MA,
82 .pull = GPIOMUX_PULL_UP,
83};
84
85static struct gpiomux_setting focaltech_int_sus_cfg = {
86 .func = GPIOMUX_FUNC_GPIO,
87 .drv = GPIOMUX_DRV_2MA,
88 .pull = GPIOMUX_PULL_DOWN,
89};
90
91static struct gpiomux_setting focaltech_reset_act_cfg = {
92 .func = GPIOMUX_FUNC_GPIO,
93 .drv = GPIOMUX_DRV_6MA,
94 .pull = GPIOMUX_PULL_UP,
95};
96
97static struct gpiomux_setting focaltech_reset_sus_cfg = {
98 .func = GPIOMUX_FUNC_GPIO,
99 .drv = GPIOMUX_DRV_6MA,
100 .pull = GPIOMUX_PULL_UP,
101};
102
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700103static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
104 .func = GPIOMUX_FUNC_GPIO,
105 .drv = GPIOMUX_DRV_2MA,
106 .pull = GPIOMUX_PULL_UP,
107};
108
109static struct gpiomux_setting wcnss_5wire_active_cfg = {
110 .func = GPIOMUX_FUNC_1,
111 .drv = GPIOMUX_DRV_6MA,
112 .pull = GPIOMUX_PULL_DOWN,
113};
114
Xiaoming Zhou17972262013-04-10 17:50:35 -0400115static struct gpiomux_setting lcd_en_act_cfg = {
116 .func = GPIOMUX_FUNC_GPIO,
117 .drv = GPIOMUX_DRV_8MA,
118 .pull = GPIOMUX_PULL_NONE,
119 .dir = GPIOMUX_OUT_HIGH,
120};
121
122static struct gpiomux_setting lcd_en_sus_cfg = {
123 .func = GPIOMUX_FUNC_GPIO,
124 .drv = GPIOMUX_DRV_2MA,
125 .pull = GPIOMUX_PULL_DOWN,
126};
127
Xiaoming Zhou8dca7e42013-05-31 19:44:57 -0400128static struct gpiomux_setting lcd_te_act_config = {
129 .func = GPIOMUX_FUNC_1,
130 .drv = GPIOMUX_DRV_2MA,
131 .pull = GPIOMUX_PULL_DOWN,
132 .dir = GPIOMUX_IN,
133};
134
135static struct gpiomux_setting lcd_te_sus_config = {
136 .func = GPIOMUX_FUNC_1,
137 .drv = GPIOMUX_DRV_2MA,
138 .pull = GPIOMUX_PULL_DOWN,
139 .dir = GPIOMUX_IN,
140};
141
Amy Maloche19c386b2013-04-15 14:06:01 -0700142static struct gpiomux_setting gpio_keys_active = {
143 .func = GPIOMUX_FUNC_GPIO,
144 .drv = GPIOMUX_DRV_2MA,
145 .pull = GPIOMUX_PULL_UP,
146};
147
148static struct gpiomux_setting gpio_keys_suspend = {
149 .func = GPIOMUX_FUNC_GPIO,
150 .drv = GPIOMUX_DRV_2MA,
151 .pull = GPIOMUX_PULL_NONE,
152};
153
Richard Liua1d406a2013-04-14 13:46:48 -0700154/* define gpio used as interrupt input */
155static struct gpiomux_setting gpio_int_act_cfg = {
156 .func = GPIOMUX_FUNC_GPIO,
157 .drv = GPIOMUX_DRV_2MA,
158 .pull = GPIOMUX_PULL_UP,
159 .dir = GPIOMUX_IN,
160};
161
162static struct gpiomux_setting gpio_int_sus_cfg = {
163 .func = GPIOMUX_FUNC_GPIO,
164 .drv = GPIOMUX_DRV_2MA,
165 .pull = GPIOMUX_PULL_UP,
166 .dir = GPIOMUX_IN,
167};
168
169static struct msm_gpiomux_config msm_gpio_int_configs[] __initdata = {
170 {
171 .gpio = 84,
172 .settings = {
173 [GPIOMUX_ACTIVE] = &gpio_int_act_cfg,
174 [GPIOMUX_SUSPENDED] = &gpio_int_sus_cfg,
175 },
176 },
177};
178
Xiaoming Zhou17972262013-04-10 17:50:35 -0400179static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
180 {
181 .gpio = 41,
182 .settings = {
183 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
184 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
185 },
186 },
187 {
188 .gpio = 7,
189 .settings = {
190 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
191 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
192 },
193 },
Xiaoming Zhou8dca7e42013-05-31 19:44:57 -0400194 {
195 .gpio = 12,
196 .settings = {
197 [GPIOMUX_ACTIVE] = &lcd_te_act_config,
198 [GPIOMUX_SUSPENDED] = &lcd_te_sus_config,
199 },
200 },
Xiaoming Zhou17972262013-04-10 17:50:35 -0400201};
202
Gilad Avidovf84f2792013-01-31 13:26:39 -0700203static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
204 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700205 .gpio = 2, /* BLSP1 QUP1 I2C_SDA */
206 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800207 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Chun Zhangf39a0652013-05-01 15:57:54 -0700208 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
209 },
210 },
211 {
212 .gpio = 3, /* BLSP1 QUP1 I2C_SCL */
213 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800214 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Chun Zhangf39a0652013-05-01 15:57:54 -0700215 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
216 },
217 },
218 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700219 .gpio = 10, /* BLSP1 QUP3 I2C_SDA */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700220 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800221 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Gilad Avidovf84f2792013-01-31 13:26:39 -0700222 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
223 },
224 },
225 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700226 .gpio = 11, /* BLSP1 QUP3 I2C_SCL */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700227 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800228 [GPIOMUX_ACTIVE] = &gpio_i2c_config,
Gilad Avidovf84f2792013-01-31 13:26:39 -0700229 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
230 },
231 },
Gilad Avidovf58f1832013-01-09 17:31:28 -0700232 {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600233 .gpio = 16, /* BLSP1 QUP6 I2C_SDA */
234 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800235 [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config,
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600236 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
237 },
238 },
239 {
240 .gpio = 17, /* BLSP1 QUP6 I2C_SCL */
241 .settings = {
Bingzhe Cai12487222013-09-02 22:37:36 +0800242 [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config,
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600243 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
244 },
245 },
Bansidhar Gopalacharie331f372013-09-25 19:50:43 +0100246 {
247 .gpio = 78, /* NFC CLK */
248 .settings = {
249 [GPIOMUX_ACTIVE] = &gpio_nfc_config,
250 [GPIOMUX_SUSPENDED] = &gpio_nfc_sus_config,
251 },
252 },
Chun Zhangf39a0652013-05-01 15:57:54 -0700253};
254
Houston Hoffman53421b42013-11-26 16:12:16 -0800255static struct gpiomux_setting gpio_i2c_nfc_pvt_config = {
256 .func = GPIOMUX_FUNC_5, /*active 1*/ /* 0 */
257 .drv = GPIOMUX_DRV_2MA,
258 .pull = GPIOMUX_PULL_NONE,
259 };
260
261static struct msm_gpiomux_config msm_nfc_configs[] __initdata = {
262 {
263 .gpio = 8, /* BLSP1 QUP2 I2C_SDA */
264 .settings = {
265 [GPIOMUX_ACTIVE] = &gpio_i2c_nfc_pvt_config,
266 [GPIOMUX_SUSPENDED] = &gpio_i2c_nfc_pvt_config,
267 },
268 },
269 {
270 .gpio = 9, /* BLSP1 QUP2 I2C_SCL */
271 .settings = {
272 [GPIOMUX_ACTIVE] = &gpio_i2c_nfc_pvt_config,
273 [GPIOMUX_SUSPENDED] = &gpio_i2c_nfc_pvt_config,
274 },
275 },
276};
277
Houston Hoffman1cd68b22013-11-26 17:27:38 -0800278
Chun Zhangf39a0652013-05-01 15:57:54 -0700279static struct msm_gpiomux_config msm_atmel_configs[] __initdata = {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600280 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700281 .gpio = 0, /* TOUCH RESET */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700282 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700283 [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg,
284 [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700285 },
286 },
287 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700288 .gpio = 1, /* TOUCH INT */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700289 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700290 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
291 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700292 },
293 },
Gilad Avidova460c472013-04-12 16:23:32 -0600294 {
295 .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */
296 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530297 [GPIOMUX_ACTIVE] = &gpio_spi_config,
298 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600299 },
300 },
301 {
302 .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */
303 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530304 [GPIOMUX_ACTIVE] = &gpio_spi_config,
305 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600306 },
307 },
308 {
309 .gpio = 89, /* BLSP1 QUP4 SPI_CLK */
310 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530311 [GPIOMUX_ACTIVE] = &gpio_spi_config,
312 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600313 },
314 },
315 {
316 .gpio = 88, /* BLSP1 QUP4 SPI_CS */
317 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530318 [GPIOMUX_ACTIVE] = &gpio_spi_config,
319 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Gilad Avidova460c472013-04-12 16:23:32 -0600320 },
321 },
Gilad Avidovf84f2792013-01-31 13:26:39 -0700322};
323
Figo Wangb1510f82013-06-13 19:40:20 +0800324static struct msm_gpiomux_config msm_focaltech_configs[] __initdata = {
325 {
326 .gpio = 0, /* TOUCH RESET */
327 .settings = {
328 [GPIOMUX_ACTIVE] = &focaltech_reset_act_cfg,
329 [GPIOMUX_SUSPENDED] = &focaltech_reset_sus_cfg,
330 },
331 },
332 {
333 .gpio = 1, /* TOUCH INT */
334 .settings = {
335 [GPIOMUX_ACTIVE] = &focaltech_int_act_cfg,
336 [GPIOMUX_SUSPENDED] = &focaltech_int_sus_cfg,
337 },
338 },
339 {
340 .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */
341 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530342 [GPIOMUX_ACTIVE] = &gpio_spi_config,
343 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800344 },
345 },
346 {
347 .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */
348 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530349 [GPIOMUX_ACTIVE] = &gpio_spi_config,
350 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800351 },
352 },
353 {
354 .gpio = 89, /* BLSP1 QUP4 SPI_CLK */
355 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530356 [GPIOMUX_ACTIVE] = &gpio_spi_config,
357 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800358 },
359 },
360 {
361 .gpio = 88, /* BLSP1 QUP4 SPI_CS */
362 .settings = {
Sana Venkat Rajue53161a2013-09-17 16:33:26 +0530363 [GPIOMUX_ACTIVE] = &gpio_spi_config,
364 [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config,
Figo Wangb1510f82013-06-13 19:40:20 +0800365 },
366 },
367};
368
369
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700370static struct msm_gpiomux_config wcnss_5wire_interface[] = {
371 {
372 .gpio = 23,
373 .settings = {
374 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
375 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
376 },
377 },
378 {
379 .gpio = 24,
380 .settings = {
381 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
382 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
383 },
384 },
385 {
386 .gpio = 25,
387 .settings = {
388 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
389 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
390 },
391 },
392 {
393 .gpio = 26,
394 .settings = {
395 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
396 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
397 },
398 },
399 {
400 .gpio = 27,
401 .settings = {
402 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
403 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
404 },
405 },
406};
407
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700408static struct gpiomux_setting gpio_suspend_config[] = {
409 {
410 .func = GPIOMUX_FUNC_GPIO, /* IN-NP */
411 .drv = GPIOMUX_DRV_2MA,
412 .pull = GPIOMUX_PULL_NONE,
413 },
414 {
415 .func = GPIOMUX_FUNC_GPIO, /* O-LOW */
416 .drv = GPIOMUX_DRV_2MA,
417 .pull = GPIOMUX_PULL_NONE,
418 .dir = GPIOMUX_OUT_LOW,
419 },
420};
421
422static struct gpiomux_setting cam_settings[] = {
423 {
424 .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
425 .drv = GPIOMUX_DRV_2MA,
426 .pull = GPIOMUX_PULL_NONE,
427 },
428
429 {
430 .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
431 .drv = GPIOMUX_DRV_2MA,
432 .pull = GPIOMUX_PULL_DOWN,
433 },
434
435 {
436 .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
437 .drv = GPIOMUX_DRV_2MA,
438 .pull = GPIOMUX_PULL_KEEPER,
439 },
440
441 {
442 .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
443 .drv = GPIOMUX_DRV_2MA,
444 .pull = GPIOMUX_PULL_NONE,
445 },
446
447 {
448 .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
449 .drv = GPIOMUX_DRV_2MA,
450 .pull = GPIOMUX_PULL_DOWN,
451 },
452};
453
Bingzhe Cai43bed2b2014-01-02 14:07:31 +0800454static struct gpiomux_setting accel_interrupt_config = {
455 .func = GPIOMUX_FUNC_GPIO,
456 .drv = GPIOMUX_DRV_6MA,
457 .pull = GPIOMUX_PULL_DOWN,
458};
459
Houston Hoffman1cd68b22013-11-26 17:27:38 -0800460static struct msm_gpiomux_config msm_non_qrd_configs[] __initdata = {
461 {
462 .gpio = 8, /* CAM1_STANDBY_N */
463 .settings = {
464 [GPIOMUX_ACTIVE] = &cam_settings[3],
465 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
466 },
467 },
Bingzhe Cai43bed2b2014-01-02 14:07:31 +0800468 {
469 .gpio = 81, /*ACCEL_INT1 */
470 .settings = {
471 [GPIOMUX_ACTIVE] = &accel_interrupt_config,
472 [GPIOMUX_SUSPENDED] = &accel_interrupt_config,
473 },
474 },
Houston Hoffman1cd68b22013-11-26 17:27:38 -0800475};
476
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700477static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
478 {
479 .gpio = 13, /* CAM_MCLK0 */
480 .settings = {
481 [GPIOMUX_ACTIVE] = &cam_settings[0],
482 [GPIOMUX_SUSPENDED] = &cam_settings[1],
483 },
484 },
485 {
486 .gpio = 14, /* CAM_MCLK1 */
487 .settings = {
488 [GPIOMUX_ACTIVE] = &cam_settings[0],
489 [GPIOMUX_SUSPENDED] = &cam_settings[1],
490 },
491 },
492 {
493 .gpio = 16, /* CCI_I2C_SDA */
494 .settings = {
495 [GPIOMUX_ACTIVE] = &cam_settings[0],
496 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
497 },
498 },
499 {
500 .gpio = 17, /* CCI_I2C_SCL */
501 .settings = {
502 [GPIOMUX_ACTIVE] = &cam_settings[0],
503 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
504 },
505 },
506 {
507 .gpio = 18, /* FLASH_LED_EN */
508 .settings = {
Lokesh Kumar Aakulu034626d2013-05-10 20:30:07 -0700509 [GPIOMUX_ACTIVE] = &cam_settings[3],
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700510 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
511 },
512 },
513 {
514 .gpio = 19, /* FLASH_LED_NOW */
515 .settings = {
Lokesh Kumar Aakulu034626d2013-05-10 20:30:07 -0700516 [GPIOMUX_ACTIVE] = &cam_settings[3],
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700517 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
518 },
519 },
520 {
521 .gpio = 8, /* CAM1_STANDBY_N */
522 .settings = {
523 [GPIOMUX_ACTIVE] = &cam_settings[3],
524 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
525 },
526 },
527 {
528 .gpio = 15, /* CAM1_RST_N */
529 .settings = {
530 [GPIOMUX_ACTIVE] = &cam_settings[3],
531 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
532 },
533 },
534 {
535 .gpio = 20, /* WEBCAM1_STANDBY */
536 .settings = {
537 [GPIOMUX_ACTIVE] = &cam_settings[3],
538 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
539 },
540 },
541 {
542 .gpio = 21, /* WEBCAM2_RESET_N */
543 .settings = {
544 [GPIOMUX_ACTIVE] = &cam_settings[3],
545 [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
546 },
547 },
548};
549
Amy Maloche19c386b2013-04-15 14:06:01 -0700550static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
551 {
552 .gpio = 72,
553 .settings = {
554 [GPIOMUX_ACTIVE] = &gpio_keys_active,
555 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
556 },
557 },
558 {
559 .gpio = 73,
560 .settings = {
561 [GPIOMUX_ACTIVE] = &gpio_keys_active,
562 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
563 },
564 },
565 {
566 .gpio = 74,
567 .settings = {
568 [GPIOMUX_ACTIVE] = &gpio_keys_active,
569 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
570 },
571 },
572};
573
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700574static struct gpiomux_setting sd_card_det_active_config = {
575 .func = GPIOMUX_FUNC_GPIO,
576 .drv = GPIOMUX_DRV_2MA,
577 .pull = GPIOMUX_PULL_NONE,
578 .dir = GPIOMUX_IN,
579};
580
581static struct gpiomux_setting sd_card_det_suspend_config = {
582 .func = GPIOMUX_FUNC_GPIO,
583 .drv = GPIOMUX_DRV_2MA,
584 .pull = GPIOMUX_PULL_UP,
585 .dir = GPIOMUX_IN,
586};
587
588static struct msm_gpiomux_config sd_card_det[] __initdata = {
589 {
590 .gpio = 42,
591 .settings = {
592 [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
593 [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config,
594 },
595 },
596};
597
Bingzhe Caife20b712013-07-15 16:48:49 +0800598static struct gpiomux_setting interrupt_gpio_active = {
599 .func = GPIOMUX_FUNC_GPIO,
600 .drv = GPIOMUX_DRV_6MA,
601 .pull = GPIOMUX_PULL_UP,
602};
603
604static struct gpiomux_setting interrupt_gpio_suspend_pullup = {
605 .func = GPIOMUX_FUNC_GPIO,
606 .drv = GPIOMUX_DRV_6MA,
607 .pull = GPIOMUX_PULL_UP,
608};
609
610static struct gpiomux_setting interrupt_gpio_suspend_pulldown = {
611 .func = GPIOMUX_FUNC_GPIO,
612 .drv = GPIOMUX_DRV_6MA,
613 .pull = GPIOMUX_PULL_UP,
614};
615
616static struct msm_gpiomux_config msm_interrupt_configs[] __initdata = {
617 {
618 .gpio = 77, /* NFC_IRQ */
619 .settings = {
620 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
621 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup,
622 },
623 },
624 {
Bingzhe Caife20b712013-07-15 16:48:49 +0800625 .gpio = 80, /*ALSP_INT */
626 .settings = {
627 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
628 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup,
629 },
630 },
631 {
632 .gpio = 81, /*ACCEL_INT1 */
633 .settings = {
634 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
635 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown,
636 },
637 },
638 {
639 .gpio = 82, /*ACCEL_INT2 */
640 .settings = {
641 [GPIOMUX_ACTIVE] = &interrupt_gpio_active,
642 [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown,
643 },
644 },
645};
646
Kuirong Wang3ef74f02013-08-02 14:46:45 -0700647static struct gpiomux_setting gpio_cdc_dmic_cfg = {
648 .func = GPIOMUX_FUNC_1,
649 .drv = GPIOMUX_DRV_4MA,
650 .pull = GPIOMUX_PULL_NONE,
651};
652
653
654static struct msm_gpiomux_config msm_cdc_dmic_configs[] __initdata = {
655 {
656 .gpio = 100, /* DMIC CLK */
657 .settings = {
658 [GPIOMUX_SUSPENDED] = &gpio_cdc_dmic_cfg,
659 },
660 },
661 {
662 .gpio = 101, /* DMIC DATA */
663 .settings = {
664 [GPIOMUX_SUSPENDED] = &gpio_cdc_dmic_cfg,
665 },
666 },
667};
668
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800669void __init msm8610_init_gpiomux(void)
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800670{
671 int rc;
672
Rohit Vaswani341c2032012-11-08 18:49:29 -0800673 rc = msm_gpiomux_init_dt();
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800674 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800675 pr_err("%s failed %d\n", __func__, rc);
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800676 return;
677 }
Gilad Avidovf84f2792013-01-31 13:26:39 -0700678
679 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Figo Wangb1510f82013-06-13 19:40:20 +0800680 if (of_board_is_qrd()) {
681 msm_gpiomux_install(msm_focaltech_configs,
682 ARRAY_SIZE(msm_focaltech_configs));
683 } else {
684 msm_gpiomux_install(msm_atmel_configs,
Chun Zhangf39a0652013-05-01 15:57:54 -0700685 ARRAY_SIZE(msm_atmel_configs));
Figo Wangb1510f82013-06-13 19:40:20 +0800686 }
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700687 msm_gpiomux_install(wcnss_5wire_interface,
688 ARRAY_SIZE(wcnss_5wire_interface));
Xiaoming Zhoua329c942013-07-10 10:32:20 -0400689 msm_gpiomux_install_nowrite(msm_lcd_configs,
690 ARRAY_SIZE(msm_lcd_configs));
Amy Maloche19c386b2013-04-15 14:06:01 -0700691 msm_gpiomux_install(msm_keypad_configs,
692 ARRAY_SIZE(msm_keypad_configs));
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700693 msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det));
Lokesh Kumar Aakulu329a3472013-06-03 06:08:17 -0700694 msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
Richard Liua1d406a2013-04-14 13:46:48 -0700695 msm_gpiomux_install(msm_gpio_int_configs,
696 ARRAY_SIZE(msm_gpio_int_configs));
Houston Hoffman53421b42013-11-26 16:12:16 -0800697 if (of_board_is_qrd()) {
Bingzhe Caife20b712013-07-15 16:48:49 +0800698 msm_gpiomux_install(msm_interrupt_configs,
699 ARRAY_SIZE(msm_interrupt_configs));
Houston Hoffman53421b42013-11-26 16:12:16 -0800700 msm_gpiomux_install(msm_nfc_configs,
701 ARRAY_SIZE(msm_nfc_configs));
Houston Hoffman1cd68b22013-11-26 17:27:38 -0800702 } else {
703 msm_gpiomux_install(msm_non_qrd_configs,
704 ARRAY_SIZE(msm_non_qrd_configs));
Houston Hoffman53421b42013-11-26 16:12:16 -0800705 }
Kuirong Wang3ef74f02013-08-02 14:46:45 -0700706 if (of_board_is_cdp())
707 msm_gpiomux_install(msm_cdc_dmic_configs,
708 ARRAY_SIZE(msm_cdc_dmic_configs));
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800709}