blob: 56a7225af8067116251e4d85cbc607a2fd7e0dc7 [file] [log] [blame]
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08001/* Copyright (c) 2012-2013, 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>
19
Gilad Avidova460c472013-04-12 16:23:32 -060020static struct gpiomux_setting gpio_spi_config = {
21 .func = GPIOMUX_FUNC_1,
22 .drv = GPIOMUX_DRV_6MA,
23 .pull = GPIOMUX_PULL_NONE,
24};
25
Gilad Avidovf84f2792013-01-31 13:26:39 -070026static struct gpiomux_setting gpio_i2c_config = {
27 .func = GPIOMUX_FUNC_3,
28 .drv = GPIOMUX_DRV_2MA,
29 .pull = GPIOMUX_PULL_NONE,
30};
31
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -060032static struct gpiomux_setting gpio_cam_i2c_config = {
33 .func = GPIOMUX_FUNC_1,
34 .drv = GPIOMUX_DRV_2MA,
35 .pull = GPIOMUX_PULL_NONE,
36};
37
Chun Zhangf39a0652013-05-01 15:57:54 -070038static struct gpiomux_setting atmel_int_act_cfg = {
39 .func = GPIOMUX_FUNC_GPIO,
40 .drv = GPIOMUX_DRV_8MA,
41 .pull = GPIOMUX_PULL_UP,
Gilad Avidovf58f1832013-01-09 17:31:28 -070042};
43
Chun Zhangf39a0652013-05-01 15:57:54 -070044static struct gpiomux_setting atmel_int_sus_cfg = {
45 .func = GPIOMUX_FUNC_GPIO,
46 .drv = GPIOMUX_DRV_2MA,
47 .pull = GPIOMUX_PULL_DOWN,
48};
49
50static struct gpiomux_setting atmel_reset_act_cfg = {
51 .func = GPIOMUX_FUNC_GPIO,
52 .drv = GPIOMUX_DRV_6MA,
53 .pull = GPIOMUX_PULL_UP,
54};
55
56static struct gpiomux_setting atmel_reset_sus_cfg = {
57 .func = GPIOMUX_FUNC_GPIO,
Gilad Avidovf58f1832013-01-09 17:31:28 -070058 .drv = GPIOMUX_DRV_6MA,
59 .pull = GPIOMUX_PULL_DOWN,
60};
61
Sameer Thalappil1fafd672013-04-03 12:31:04 -070062static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
63 .func = GPIOMUX_FUNC_GPIO,
64 .drv = GPIOMUX_DRV_2MA,
65 .pull = GPIOMUX_PULL_UP,
66};
67
68static struct gpiomux_setting wcnss_5wire_active_cfg = {
69 .func = GPIOMUX_FUNC_1,
70 .drv = GPIOMUX_DRV_6MA,
71 .pull = GPIOMUX_PULL_DOWN,
72};
73
Xiaoming Zhou17972262013-04-10 17:50:35 -040074static struct gpiomux_setting lcd_en_act_cfg = {
75 .func = GPIOMUX_FUNC_GPIO,
76 .drv = GPIOMUX_DRV_8MA,
77 .pull = GPIOMUX_PULL_NONE,
78 .dir = GPIOMUX_OUT_HIGH,
79};
80
81static struct gpiomux_setting lcd_en_sus_cfg = {
82 .func = GPIOMUX_FUNC_GPIO,
83 .drv = GPIOMUX_DRV_2MA,
84 .pull = GPIOMUX_PULL_DOWN,
85};
86
Xiaoming Zhou8dca7e42013-05-31 19:44:57 -040087static struct gpiomux_setting lcd_te_act_config = {
88 .func = GPIOMUX_FUNC_1,
89 .drv = GPIOMUX_DRV_2MA,
90 .pull = GPIOMUX_PULL_DOWN,
91 .dir = GPIOMUX_IN,
92};
93
94static struct gpiomux_setting lcd_te_sus_config = {
95 .func = GPIOMUX_FUNC_1,
96 .drv = GPIOMUX_DRV_2MA,
97 .pull = GPIOMUX_PULL_DOWN,
98 .dir = GPIOMUX_IN,
99};
100
Amy Maloche19c386b2013-04-15 14:06:01 -0700101static struct gpiomux_setting gpio_keys_active = {
102 .func = GPIOMUX_FUNC_GPIO,
103 .drv = GPIOMUX_DRV_2MA,
104 .pull = GPIOMUX_PULL_UP,
105};
106
107static struct gpiomux_setting gpio_keys_suspend = {
108 .func = GPIOMUX_FUNC_GPIO,
109 .drv = GPIOMUX_DRV_2MA,
110 .pull = GPIOMUX_PULL_NONE,
111};
112
Xiaoming Zhou17972262013-04-10 17:50:35 -0400113static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
114 {
115 .gpio = 41,
116 .settings = {
117 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
118 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
119 },
120 },
121 {
122 .gpio = 7,
123 .settings = {
124 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
125 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
126 },
127 },
Xiaoming Zhou8dca7e42013-05-31 19:44:57 -0400128 {
129 .gpio = 12,
130 .settings = {
131 [GPIOMUX_ACTIVE] = &lcd_te_act_config,
132 [GPIOMUX_SUSPENDED] = &lcd_te_sus_config,
133 },
134 },
Xiaoming Zhou17972262013-04-10 17:50:35 -0400135};
136
Gilad Avidovf84f2792013-01-31 13:26:39 -0700137static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
138 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700139 .gpio = 2, /* BLSP1 QUP1 I2C_SDA */
140 .settings = {
141 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
142 },
143 },
144 {
145 .gpio = 3, /* BLSP1 QUP1 I2C_SCL */
146 .settings = {
147 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
148 },
149 },
150 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700151 .gpio = 10, /* BLSP1 QUP3 I2C_SDA */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700152 .settings = {
153 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
154 },
155 },
156 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700157 .gpio = 11, /* BLSP1 QUP3 I2C_SCL */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700158 .settings = {
159 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
160 },
161 },
Gilad Avidovf58f1832013-01-09 17:31:28 -0700162 {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600163 .gpio = 16, /* BLSP1 QUP6 I2C_SDA */
164 .settings = {
165 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
166 },
167 },
168 {
169 .gpio = 17, /* BLSP1 QUP6 I2C_SCL */
170 .settings = {
171 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
172 },
173 },
Chun Zhangf39a0652013-05-01 15:57:54 -0700174};
175
176static struct msm_gpiomux_config msm_atmel_configs[] __initdata = {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600177 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700178 .gpio = 0, /* TOUCH RESET */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700179 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700180 [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg,
181 [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700182 },
183 },
184 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700185 .gpio = 1, /* TOUCH INT */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700186 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700187 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
188 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700189 },
190 },
Gilad Avidova460c472013-04-12 16:23:32 -0600191 {
192 .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */
193 .settings = {
194 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
195 },
196 },
197 {
198 .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */
199 .settings = {
200 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
201 },
202 },
203 {
204 .gpio = 89, /* BLSP1 QUP4 SPI_CLK */
205 .settings = {
206 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
207 },
208 },
209 {
210 .gpio = 88, /* BLSP1 QUP4 SPI_CS */
211 .settings = {
212 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
213 },
214 },
Gilad Avidovf84f2792013-01-31 13:26:39 -0700215};
216
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700217static struct msm_gpiomux_config wcnss_5wire_interface[] = {
218 {
219 .gpio = 23,
220 .settings = {
221 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
222 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
223 },
224 },
225 {
226 .gpio = 24,
227 .settings = {
228 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
229 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
230 },
231 },
232 {
233 .gpio = 25,
234 .settings = {
235 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
236 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
237 },
238 },
239 {
240 .gpio = 26,
241 .settings = {
242 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
243 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
244 },
245 },
246 {
247 .gpio = 27,
248 .settings = {
249 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
250 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
251 },
252 },
253};
254
Amy Maloche19c386b2013-04-15 14:06:01 -0700255static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
256 {
257 .gpio = 72,
258 .settings = {
259 [GPIOMUX_ACTIVE] = &gpio_keys_active,
260 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
261 },
262 },
263 {
264 .gpio = 73,
265 .settings = {
266 [GPIOMUX_ACTIVE] = &gpio_keys_active,
267 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
268 },
269 },
270 {
271 .gpio = 74,
272 .settings = {
273 [GPIOMUX_ACTIVE] = &gpio_keys_active,
274 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
275 },
276 },
277};
278
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700279static struct gpiomux_setting sd_card_det_active_config = {
280 .func = GPIOMUX_FUNC_GPIO,
281 .drv = GPIOMUX_DRV_2MA,
282 .pull = GPIOMUX_PULL_NONE,
283 .dir = GPIOMUX_IN,
284};
285
286static struct gpiomux_setting sd_card_det_suspend_config = {
287 .func = GPIOMUX_FUNC_GPIO,
288 .drv = GPIOMUX_DRV_2MA,
289 .pull = GPIOMUX_PULL_UP,
290 .dir = GPIOMUX_IN,
291};
292
293static struct msm_gpiomux_config sd_card_det[] __initdata = {
294 {
295 .gpio = 42,
296 .settings = {
297 [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
298 [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config,
299 },
300 },
301};
302
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800303void __init msm8610_init_gpiomux(void)
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800304{
305 int rc;
306
Rohit Vaswani341c2032012-11-08 18:49:29 -0800307 rc = msm_gpiomux_init_dt();
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800308 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800309 pr_err("%s failed %d\n", __func__, rc);
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800310 return;
311 }
Gilad Avidovf84f2792013-01-31 13:26:39 -0700312
313 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Chun Zhangf39a0652013-05-01 15:57:54 -0700314 msm_gpiomux_install(msm_atmel_configs,
315 ARRAY_SIZE(msm_atmel_configs));
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700316 msm_gpiomux_install(wcnss_5wire_interface,
317 ARRAY_SIZE(wcnss_5wire_interface));
Xiaoming Zhou17972262013-04-10 17:50:35 -0400318 msm_gpiomux_install(msm_lcd_configs, ARRAY_SIZE(msm_lcd_configs));
Amy Maloche19c386b2013-04-15 14:06:01 -0700319 msm_gpiomux_install(msm_keypad_configs,
320 ARRAY_SIZE(msm_keypad_configs));
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700321 msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det));
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800322}