blob: 593e2b1737af2e72a6c232f502e7c56008145095 [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 Avidovf84f2792013-01-31 13:26:39 -070020static struct gpiomux_setting gpio_i2c_config = {
21 .func = GPIOMUX_FUNC_3,
22 .drv = GPIOMUX_DRV_2MA,
23 .pull = GPIOMUX_PULL_NONE,
24};
25
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -060026static struct gpiomux_setting gpio_cam_i2c_config = {
27 .func = GPIOMUX_FUNC_1,
28 .drv = GPIOMUX_DRV_2MA,
29 .pull = GPIOMUX_PULL_NONE,
30};
31
Chun Zhangf39a0652013-05-01 15:57:54 -070032static struct gpiomux_setting atmel_int_act_cfg = {
33 .func = GPIOMUX_FUNC_GPIO,
34 .drv = GPIOMUX_DRV_8MA,
35 .pull = GPIOMUX_PULL_UP,
Gilad Avidovf58f1832013-01-09 17:31:28 -070036};
37
Chun Zhangf39a0652013-05-01 15:57:54 -070038static struct gpiomux_setting atmel_int_sus_cfg = {
39 .func = GPIOMUX_FUNC_GPIO,
40 .drv = GPIOMUX_DRV_2MA,
41 .pull = GPIOMUX_PULL_DOWN,
42};
43
44static struct gpiomux_setting atmel_reset_act_cfg = {
45 .func = GPIOMUX_FUNC_GPIO,
46 .drv = GPIOMUX_DRV_6MA,
47 .pull = GPIOMUX_PULL_UP,
48};
49
50static struct gpiomux_setting atmel_reset_sus_cfg = {
51 .func = GPIOMUX_FUNC_GPIO,
Gilad Avidovf58f1832013-01-09 17:31:28 -070052 .drv = GPIOMUX_DRV_6MA,
53 .pull = GPIOMUX_PULL_DOWN,
54};
55
Sameer Thalappil1fafd672013-04-03 12:31:04 -070056static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
57 .func = GPIOMUX_FUNC_GPIO,
58 .drv = GPIOMUX_DRV_2MA,
59 .pull = GPIOMUX_PULL_UP,
60};
61
62static struct gpiomux_setting wcnss_5wire_active_cfg = {
63 .func = GPIOMUX_FUNC_1,
64 .drv = GPIOMUX_DRV_6MA,
65 .pull = GPIOMUX_PULL_DOWN,
66};
67
Xiaoming Zhou17972262013-04-10 17:50:35 -040068static struct gpiomux_setting lcd_en_act_cfg = {
69 .func = GPIOMUX_FUNC_GPIO,
70 .drv = GPIOMUX_DRV_8MA,
71 .pull = GPIOMUX_PULL_NONE,
72 .dir = GPIOMUX_OUT_HIGH,
73};
74
75static struct gpiomux_setting lcd_en_sus_cfg = {
76 .func = GPIOMUX_FUNC_GPIO,
77 .drv = GPIOMUX_DRV_2MA,
78 .pull = GPIOMUX_PULL_DOWN,
79};
80
Amy Maloche19c386b2013-04-15 14:06:01 -070081static struct gpiomux_setting gpio_keys_active = {
82 .func = GPIOMUX_FUNC_GPIO,
83 .drv = GPIOMUX_DRV_2MA,
84 .pull = GPIOMUX_PULL_UP,
85};
86
87static struct gpiomux_setting gpio_keys_suspend = {
88 .func = GPIOMUX_FUNC_GPIO,
89 .drv = GPIOMUX_DRV_2MA,
90 .pull = GPIOMUX_PULL_NONE,
91};
92
Xiaoming Zhou17972262013-04-10 17:50:35 -040093static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
94 {
95 .gpio = 41,
96 .settings = {
97 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
98 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
99 },
100 },
101 {
102 .gpio = 7,
103 .settings = {
104 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
105 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
106 },
107 },
108};
109
Gilad Avidovf84f2792013-01-31 13:26:39 -0700110static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
111 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700112 .gpio = 2, /* BLSP1 QUP1 I2C_SDA */
113 .settings = {
114 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
115 },
116 },
117 {
118 .gpio = 3, /* BLSP1 QUP1 I2C_SCL */
119 .settings = {
120 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
121 },
122 },
123 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700124 .gpio = 10, /* BLSP1 QUP3 I2C_SDA */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700125 .settings = {
126 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
127 },
128 },
129 {
Gilad Avidovf58f1832013-01-09 17:31:28 -0700130 .gpio = 11, /* BLSP1 QUP3 I2C_SCL */
Gilad Avidovf84f2792013-01-31 13:26:39 -0700131 .settings = {
132 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
133 },
134 },
Gilad Avidovf58f1832013-01-09 17:31:28 -0700135 {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600136 .gpio = 16, /* BLSP1 QUP6 I2C_SDA */
137 .settings = {
138 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
139 },
140 },
141 {
142 .gpio = 17, /* BLSP1 QUP6 I2C_SCL */
143 .settings = {
144 [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
145 },
146 },
Chun Zhangf39a0652013-05-01 15:57:54 -0700147};
148
149static struct msm_gpiomux_config msm_atmel_configs[] __initdata = {
Kenneth Heitke0d4fbb12013-04-10 12:51:14 -0600150 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700151 .gpio = 0, /* TOUCH RESET */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700152 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700153 [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg,
154 [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700155 },
156 },
157 {
Chun Zhangf39a0652013-05-01 15:57:54 -0700158 .gpio = 1, /* TOUCH INT */
Gilad Avidovf58f1832013-01-09 17:31:28 -0700159 .settings = {
Chun Zhangf39a0652013-05-01 15:57:54 -0700160 [GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
161 [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
Gilad Avidovf58f1832013-01-09 17:31:28 -0700162 },
163 },
Gilad Avidovf84f2792013-01-31 13:26:39 -0700164};
165
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700166static struct msm_gpiomux_config wcnss_5wire_interface[] = {
167 {
168 .gpio = 23,
169 .settings = {
170 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
171 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
172 },
173 },
174 {
175 .gpio = 24,
176 .settings = {
177 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
178 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
179 },
180 },
181 {
182 .gpio = 25,
183 .settings = {
184 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
185 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
186 },
187 },
188 {
189 .gpio = 26,
190 .settings = {
191 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
192 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
193 },
194 },
195 {
196 .gpio = 27,
197 .settings = {
198 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
199 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
200 },
201 },
202};
203
Amy Maloche19c386b2013-04-15 14:06:01 -0700204static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
205 {
206 .gpio = 72,
207 .settings = {
208 [GPIOMUX_ACTIVE] = &gpio_keys_active,
209 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
210 },
211 },
212 {
213 .gpio = 73,
214 .settings = {
215 [GPIOMUX_ACTIVE] = &gpio_keys_active,
216 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
217 },
218 },
219 {
220 .gpio = 74,
221 .settings = {
222 [GPIOMUX_ACTIVE] = &gpio_keys_active,
223 [GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
224 },
225 },
226};
227
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700228static struct gpiomux_setting sd_card_det_active_config = {
229 .func = GPIOMUX_FUNC_GPIO,
230 .drv = GPIOMUX_DRV_2MA,
231 .pull = GPIOMUX_PULL_NONE,
232 .dir = GPIOMUX_IN,
233};
234
235static struct gpiomux_setting sd_card_det_suspend_config = {
236 .func = GPIOMUX_FUNC_GPIO,
237 .drv = GPIOMUX_DRV_2MA,
238 .pull = GPIOMUX_PULL_UP,
239 .dir = GPIOMUX_IN,
240};
241
242static struct msm_gpiomux_config sd_card_det[] __initdata = {
243 {
244 .gpio = 42,
245 .settings = {
246 [GPIOMUX_ACTIVE] = &sd_card_det_active_config,
247 [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config,
248 },
249 },
250};
251
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800252void __init msm8610_init_gpiomux(void)
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800253{
254 int rc;
255
Rohit Vaswani341c2032012-11-08 18:49:29 -0800256 rc = msm_gpiomux_init_dt();
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800257 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800258 pr_err("%s failed %d\n", __func__, rc);
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800259 return;
260 }
Gilad Avidovf84f2792013-01-31 13:26:39 -0700261
262 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Chun Zhangf39a0652013-05-01 15:57:54 -0700263 msm_gpiomux_install(msm_atmel_configs,
264 ARRAY_SIZE(msm_atmel_configs));
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700265 msm_gpiomux_install(wcnss_5wire_interface,
266 ARRAY_SIZE(wcnss_5wire_interface));
Xiaoming Zhou17972262013-04-10 17:50:35 -0400267 msm_gpiomux_install(msm_lcd_configs, ARRAY_SIZE(msm_lcd_configs));
Amy Maloche19c386b2013-04-15 14:06:01 -0700268 msm_gpiomux_install(msm_keypad_configs,
269 ARRAY_SIZE(msm_keypad_configs));
Venkat Gopalakrishnan8aaf15a2013-04-30 16:27:03 -0700270 msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det));
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800271}