Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 2 | * |
| 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 Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 19 | #include <mach/socinfo.h> |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 20 | |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 21 | static struct gpiomux_setting gpio_spi_config = { |
| 22 | .func = GPIOMUX_FUNC_1, |
| 23 | .drv = GPIOMUX_DRV_6MA, |
| 24 | .pull = GPIOMUX_PULL_NONE, |
| 25 | }; |
| 26 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 27 | static struct gpiomux_setting gpio_i2c_config = { |
| 28 | .func = GPIOMUX_FUNC_3, |
| 29 | .drv = GPIOMUX_DRV_2MA, |
| 30 | .pull = GPIOMUX_PULL_NONE, |
| 31 | }; |
| 32 | |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 33 | static struct gpiomux_setting gpio_cam_i2c_config = { |
| 34 | .func = GPIOMUX_FUNC_1, |
| 35 | .drv = GPIOMUX_DRV_2MA, |
| 36 | .pull = GPIOMUX_PULL_NONE, |
| 37 | }; |
| 38 | |
Bansidhar Gopalachari | e331f37 | 2013-09-25 19:50:43 +0100 | [diff] [blame^] | 39 | static struct gpiomux_setting gpio_nfc_config = { |
| 40 | .func = GPIOMUX_FUNC_2, |
| 41 | .drv = GPIOMUX_DRV_2MA, |
| 42 | .pull = GPIOMUX_PULL_NONE, |
| 43 | }; |
| 44 | static struct gpiomux_setting gpio_nfc_sus_config = { |
| 45 | .func = GPIOMUX_FUNC_2, |
| 46 | .drv = GPIOMUX_DRV_2MA, |
| 47 | .pull = GPIOMUX_PULL_DOWN, |
| 48 | }; |
| 49 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 50 | static struct gpiomux_setting atmel_int_act_cfg = { |
| 51 | .func = GPIOMUX_FUNC_GPIO, |
| 52 | .drv = GPIOMUX_DRV_8MA, |
| 53 | .pull = GPIOMUX_PULL_UP, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 54 | }; |
| 55 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 56 | static struct gpiomux_setting atmel_int_sus_cfg = { |
| 57 | .func = GPIOMUX_FUNC_GPIO, |
| 58 | .drv = GPIOMUX_DRV_2MA, |
| 59 | .pull = GPIOMUX_PULL_DOWN, |
| 60 | }; |
| 61 | |
| 62 | static struct gpiomux_setting atmel_reset_act_cfg = { |
| 63 | .func = GPIOMUX_FUNC_GPIO, |
| 64 | .drv = GPIOMUX_DRV_6MA, |
| 65 | .pull = GPIOMUX_PULL_UP, |
| 66 | }; |
| 67 | |
| 68 | static struct gpiomux_setting atmel_reset_sus_cfg = { |
| 69 | .func = GPIOMUX_FUNC_GPIO, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 70 | .drv = GPIOMUX_DRV_6MA, |
| 71 | .pull = GPIOMUX_PULL_DOWN, |
| 72 | }; |
| 73 | |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 74 | static struct gpiomux_setting focaltech_int_act_cfg = { |
| 75 | .func = GPIOMUX_FUNC_GPIO, |
| 76 | .drv = GPIOMUX_DRV_8MA, |
| 77 | .pull = GPIOMUX_PULL_UP, |
| 78 | }; |
| 79 | |
| 80 | static struct gpiomux_setting focaltech_int_sus_cfg = { |
| 81 | .func = GPIOMUX_FUNC_GPIO, |
| 82 | .drv = GPIOMUX_DRV_2MA, |
| 83 | .pull = GPIOMUX_PULL_DOWN, |
| 84 | }; |
| 85 | |
| 86 | static struct gpiomux_setting focaltech_reset_act_cfg = { |
| 87 | .func = GPIOMUX_FUNC_GPIO, |
| 88 | .drv = GPIOMUX_DRV_6MA, |
| 89 | .pull = GPIOMUX_PULL_UP, |
| 90 | }; |
| 91 | |
| 92 | static struct gpiomux_setting focaltech_reset_sus_cfg = { |
| 93 | .func = GPIOMUX_FUNC_GPIO, |
| 94 | .drv = GPIOMUX_DRV_6MA, |
| 95 | .pull = GPIOMUX_PULL_UP, |
| 96 | }; |
| 97 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 98 | static struct gpiomux_setting wcnss_5wire_suspend_cfg = { |
| 99 | .func = GPIOMUX_FUNC_GPIO, |
| 100 | .drv = GPIOMUX_DRV_2MA, |
| 101 | .pull = GPIOMUX_PULL_UP, |
| 102 | }; |
| 103 | |
| 104 | static struct gpiomux_setting wcnss_5wire_active_cfg = { |
| 105 | .func = GPIOMUX_FUNC_1, |
| 106 | .drv = GPIOMUX_DRV_6MA, |
| 107 | .pull = GPIOMUX_PULL_DOWN, |
| 108 | }; |
| 109 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 110 | static struct gpiomux_setting lcd_en_act_cfg = { |
| 111 | .func = GPIOMUX_FUNC_GPIO, |
| 112 | .drv = GPIOMUX_DRV_8MA, |
| 113 | .pull = GPIOMUX_PULL_NONE, |
| 114 | .dir = GPIOMUX_OUT_HIGH, |
| 115 | }; |
| 116 | |
| 117 | static struct gpiomux_setting lcd_en_sus_cfg = { |
| 118 | .func = GPIOMUX_FUNC_GPIO, |
| 119 | .drv = GPIOMUX_DRV_2MA, |
| 120 | .pull = GPIOMUX_PULL_DOWN, |
| 121 | }; |
| 122 | |
Xiaoming Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame] | 123 | static struct gpiomux_setting lcd_te_act_config = { |
| 124 | .func = GPIOMUX_FUNC_1, |
| 125 | .drv = GPIOMUX_DRV_2MA, |
| 126 | .pull = GPIOMUX_PULL_DOWN, |
| 127 | .dir = GPIOMUX_IN, |
| 128 | }; |
| 129 | |
| 130 | static struct gpiomux_setting lcd_te_sus_config = { |
| 131 | .func = GPIOMUX_FUNC_1, |
| 132 | .drv = GPIOMUX_DRV_2MA, |
| 133 | .pull = GPIOMUX_PULL_DOWN, |
| 134 | .dir = GPIOMUX_IN, |
| 135 | }; |
| 136 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 137 | static struct gpiomux_setting gpio_keys_active = { |
| 138 | .func = GPIOMUX_FUNC_GPIO, |
| 139 | .drv = GPIOMUX_DRV_2MA, |
| 140 | .pull = GPIOMUX_PULL_UP, |
| 141 | }; |
| 142 | |
| 143 | static struct gpiomux_setting gpio_keys_suspend = { |
| 144 | .func = GPIOMUX_FUNC_GPIO, |
| 145 | .drv = GPIOMUX_DRV_2MA, |
| 146 | .pull = GPIOMUX_PULL_NONE, |
| 147 | }; |
| 148 | |
Richard Liu | a1d406a | 2013-04-14 13:46:48 -0700 | [diff] [blame] | 149 | /* define gpio used as interrupt input */ |
| 150 | static struct gpiomux_setting gpio_int_act_cfg = { |
| 151 | .func = GPIOMUX_FUNC_GPIO, |
| 152 | .drv = GPIOMUX_DRV_2MA, |
| 153 | .pull = GPIOMUX_PULL_UP, |
| 154 | .dir = GPIOMUX_IN, |
| 155 | }; |
| 156 | |
| 157 | static struct gpiomux_setting gpio_int_sus_cfg = { |
| 158 | .func = GPIOMUX_FUNC_GPIO, |
| 159 | .drv = GPIOMUX_DRV_2MA, |
| 160 | .pull = GPIOMUX_PULL_UP, |
| 161 | .dir = GPIOMUX_IN, |
| 162 | }; |
| 163 | |
| 164 | static struct msm_gpiomux_config msm_gpio_int_configs[] __initdata = { |
| 165 | { |
| 166 | .gpio = 84, |
| 167 | .settings = { |
| 168 | [GPIOMUX_ACTIVE] = &gpio_int_act_cfg, |
| 169 | [GPIOMUX_SUSPENDED] = &gpio_int_sus_cfg, |
| 170 | }, |
| 171 | }, |
| 172 | }; |
| 173 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 174 | static struct msm_gpiomux_config msm_lcd_configs[] __initdata = { |
| 175 | { |
| 176 | .gpio = 41, |
| 177 | .settings = { |
| 178 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 179 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 180 | }, |
| 181 | }, |
| 182 | { |
| 183 | .gpio = 7, |
| 184 | .settings = { |
| 185 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 186 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 187 | }, |
| 188 | }, |
Xiaoming Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame] | 189 | { |
| 190 | .gpio = 12, |
| 191 | .settings = { |
| 192 | [GPIOMUX_ACTIVE] = &lcd_te_act_config, |
| 193 | [GPIOMUX_SUSPENDED] = &lcd_te_sus_config, |
| 194 | }, |
| 195 | }, |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 196 | }; |
| 197 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 198 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 199 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 200 | .gpio = 2, /* BLSP1 QUP1 I2C_SDA */ |
| 201 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 202 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 203 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 204 | }, |
| 205 | }, |
| 206 | { |
| 207 | .gpio = 3, /* BLSP1 QUP1 I2C_SCL */ |
| 208 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 209 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 210 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 211 | }, |
| 212 | }, |
| 213 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 214 | .gpio = 10, /* BLSP1 QUP3 I2C_SDA */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 215 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 216 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 217 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 218 | }, |
| 219 | }, |
| 220 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 221 | .gpio = 11, /* BLSP1 QUP3 I2C_SCL */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 222 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 223 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 224 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 225 | }, |
| 226 | }, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 227 | { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 228 | .gpio = 16, /* BLSP1 QUP6 I2C_SDA */ |
| 229 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 230 | [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config, |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 231 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 232 | }, |
| 233 | }, |
| 234 | { |
| 235 | .gpio = 17, /* BLSP1 QUP6 I2C_SCL */ |
| 236 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 237 | [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config, |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 238 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 239 | }, |
| 240 | }, |
Bansidhar Gopalachari | e331f37 | 2013-09-25 19:50:43 +0100 | [diff] [blame^] | 241 | { |
| 242 | .gpio = 78, /* NFC CLK */ |
| 243 | .settings = { |
| 244 | [GPIOMUX_ACTIVE] = &gpio_nfc_config, |
| 245 | [GPIOMUX_SUSPENDED] = &gpio_nfc_sus_config, |
| 246 | }, |
| 247 | }, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 248 | }; |
| 249 | |
| 250 | static struct msm_gpiomux_config msm_atmel_configs[] __initdata = { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 251 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 252 | .gpio = 0, /* TOUCH RESET */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 253 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 254 | [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg, |
| 255 | [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 256 | }, |
| 257 | }, |
| 258 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 259 | .gpio = 1, /* TOUCH INT */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 260 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 261 | [GPIOMUX_ACTIVE] = &atmel_int_act_cfg, |
| 262 | [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 263 | }, |
| 264 | }, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 265 | { |
| 266 | .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */ |
| 267 | .settings = { |
| 268 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 269 | }, |
| 270 | }, |
| 271 | { |
| 272 | .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */ |
| 273 | .settings = { |
| 274 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 275 | }, |
| 276 | }, |
| 277 | { |
| 278 | .gpio = 89, /* BLSP1 QUP4 SPI_CLK */ |
| 279 | .settings = { |
| 280 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 281 | }, |
| 282 | }, |
| 283 | { |
| 284 | .gpio = 88, /* BLSP1 QUP4 SPI_CS */ |
| 285 | .settings = { |
| 286 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 287 | }, |
| 288 | }, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 289 | }; |
| 290 | |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 291 | static struct msm_gpiomux_config msm_focaltech_configs[] __initdata = { |
| 292 | { |
| 293 | .gpio = 0, /* TOUCH RESET */ |
| 294 | .settings = { |
| 295 | [GPIOMUX_ACTIVE] = &focaltech_reset_act_cfg, |
| 296 | [GPIOMUX_SUSPENDED] = &focaltech_reset_sus_cfg, |
| 297 | }, |
| 298 | }, |
| 299 | { |
| 300 | .gpio = 1, /* TOUCH INT */ |
| 301 | .settings = { |
| 302 | [GPIOMUX_ACTIVE] = &focaltech_int_act_cfg, |
| 303 | [GPIOMUX_SUSPENDED] = &focaltech_int_sus_cfg, |
| 304 | }, |
| 305 | }, |
| 306 | { |
| 307 | .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */ |
| 308 | .settings = { |
| 309 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 310 | }, |
| 311 | }, |
| 312 | { |
| 313 | .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */ |
| 314 | .settings = { |
| 315 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 316 | }, |
| 317 | }, |
| 318 | { |
| 319 | .gpio = 89, /* BLSP1 QUP4 SPI_CLK */ |
| 320 | .settings = { |
| 321 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 322 | }, |
| 323 | }, |
| 324 | { |
| 325 | .gpio = 88, /* BLSP1 QUP4 SPI_CS */ |
| 326 | .settings = { |
| 327 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 328 | }, |
| 329 | }, |
| 330 | }; |
| 331 | |
| 332 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 333 | static struct msm_gpiomux_config wcnss_5wire_interface[] = { |
| 334 | { |
| 335 | .gpio = 23, |
| 336 | .settings = { |
| 337 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 338 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 339 | }, |
| 340 | }, |
| 341 | { |
| 342 | .gpio = 24, |
| 343 | .settings = { |
| 344 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 345 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 346 | }, |
| 347 | }, |
| 348 | { |
| 349 | .gpio = 25, |
| 350 | .settings = { |
| 351 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 352 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 353 | }, |
| 354 | }, |
| 355 | { |
| 356 | .gpio = 26, |
| 357 | .settings = { |
| 358 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 359 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 360 | }, |
| 361 | }, |
| 362 | { |
| 363 | .gpio = 27, |
| 364 | .settings = { |
| 365 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 366 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 367 | }, |
| 368 | }, |
| 369 | }; |
| 370 | |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 371 | static struct gpiomux_setting gpio_suspend_config[] = { |
| 372 | { |
| 373 | .func = GPIOMUX_FUNC_GPIO, /* IN-NP */ |
| 374 | .drv = GPIOMUX_DRV_2MA, |
| 375 | .pull = GPIOMUX_PULL_NONE, |
| 376 | }, |
| 377 | { |
| 378 | .func = GPIOMUX_FUNC_GPIO, /* O-LOW */ |
| 379 | .drv = GPIOMUX_DRV_2MA, |
| 380 | .pull = GPIOMUX_PULL_NONE, |
| 381 | .dir = GPIOMUX_OUT_LOW, |
| 382 | }, |
| 383 | }; |
| 384 | |
| 385 | static struct gpiomux_setting cam_settings[] = { |
| 386 | { |
| 387 | .func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */ |
| 388 | .drv = GPIOMUX_DRV_2MA, |
| 389 | .pull = GPIOMUX_PULL_NONE, |
| 390 | }, |
| 391 | |
| 392 | { |
| 393 | .func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */ |
| 394 | .drv = GPIOMUX_DRV_2MA, |
| 395 | .pull = GPIOMUX_PULL_DOWN, |
| 396 | }, |
| 397 | |
| 398 | { |
| 399 | .func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */ |
| 400 | .drv = GPIOMUX_DRV_2MA, |
| 401 | .pull = GPIOMUX_PULL_KEEPER, |
| 402 | }, |
| 403 | |
| 404 | { |
| 405 | .func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */ |
| 406 | .drv = GPIOMUX_DRV_2MA, |
| 407 | .pull = GPIOMUX_PULL_NONE, |
| 408 | }, |
| 409 | |
| 410 | { |
| 411 | .func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */ |
| 412 | .drv = GPIOMUX_DRV_2MA, |
| 413 | .pull = GPIOMUX_PULL_DOWN, |
| 414 | }, |
| 415 | }; |
| 416 | |
| 417 | static struct msm_gpiomux_config msm_sensor_configs[] __initdata = { |
| 418 | { |
| 419 | .gpio = 13, /* CAM_MCLK0 */ |
| 420 | .settings = { |
| 421 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 422 | [GPIOMUX_SUSPENDED] = &cam_settings[1], |
| 423 | }, |
| 424 | }, |
| 425 | { |
| 426 | .gpio = 14, /* CAM_MCLK1 */ |
| 427 | .settings = { |
| 428 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 429 | [GPIOMUX_SUSPENDED] = &cam_settings[1], |
| 430 | }, |
| 431 | }, |
| 432 | { |
| 433 | .gpio = 16, /* CCI_I2C_SDA */ |
| 434 | .settings = { |
| 435 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 436 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0], |
| 437 | }, |
| 438 | }, |
| 439 | { |
| 440 | .gpio = 17, /* CCI_I2C_SCL */ |
| 441 | .settings = { |
| 442 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 443 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0], |
| 444 | }, |
| 445 | }, |
| 446 | { |
| 447 | .gpio = 18, /* FLASH_LED_EN */ |
| 448 | .settings = { |
Lokesh Kumar Aakulu | 034626d | 2013-05-10 20:30:07 -0700 | [diff] [blame] | 449 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 450 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 451 | }, |
| 452 | }, |
| 453 | { |
| 454 | .gpio = 19, /* FLASH_LED_NOW */ |
| 455 | .settings = { |
Lokesh Kumar Aakulu | 034626d | 2013-05-10 20:30:07 -0700 | [diff] [blame] | 456 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 457 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 458 | }, |
| 459 | }, |
| 460 | { |
| 461 | .gpio = 8, /* CAM1_STANDBY_N */ |
| 462 | .settings = { |
| 463 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 464 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 465 | }, |
| 466 | }, |
| 467 | { |
| 468 | .gpio = 15, /* CAM1_RST_N */ |
| 469 | .settings = { |
| 470 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 471 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 472 | }, |
| 473 | }, |
| 474 | { |
| 475 | .gpio = 20, /* WEBCAM1_STANDBY */ |
| 476 | .settings = { |
| 477 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 478 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 479 | }, |
| 480 | }, |
| 481 | { |
| 482 | .gpio = 21, /* WEBCAM2_RESET_N */ |
| 483 | .settings = { |
| 484 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 485 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 486 | }, |
| 487 | }, |
| 488 | }; |
| 489 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 490 | static struct msm_gpiomux_config msm_keypad_configs[] __initdata = { |
| 491 | { |
| 492 | .gpio = 72, |
| 493 | .settings = { |
| 494 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 495 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 496 | }, |
| 497 | }, |
| 498 | { |
| 499 | .gpio = 73, |
| 500 | .settings = { |
| 501 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 502 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 503 | }, |
| 504 | }, |
| 505 | { |
| 506 | .gpio = 74, |
| 507 | .settings = { |
| 508 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 509 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 510 | }, |
| 511 | }, |
| 512 | }; |
| 513 | |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 514 | static struct gpiomux_setting sd_card_det_active_config = { |
| 515 | .func = GPIOMUX_FUNC_GPIO, |
| 516 | .drv = GPIOMUX_DRV_2MA, |
| 517 | .pull = GPIOMUX_PULL_NONE, |
| 518 | .dir = GPIOMUX_IN, |
| 519 | }; |
| 520 | |
| 521 | static struct gpiomux_setting sd_card_det_suspend_config = { |
| 522 | .func = GPIOMUX_FUNC_GPIO, |
| 523 | .drv = GPIOMUX_DRV_2MA, |
| 524 | .pull = GPIOMUX_PULL_UP, |
| 525 | .dir = GPIOMUX_IN, |
| 526 | }; |
| 527 | |
| 528 | static struct msm_gpiomux_config sd_card_det[] __initdata = { |
| 529 | { |
| 530 | .gpio = 42, |
| 531 | .settings = { |
| 532 | [GPIOMUX_ACTIVE] = &sd_card_det_active_config, |
| 533 | [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config, |
| 534 | }, |
| 535 | }, |
| 536 | }; |
| 537 | |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 538 | static struct gpiomux_setting interrupt_gpio_active = { |
| 539 | .func = GPIOMUX_FUNC_GPIO, |
| 540 | .drv = GPIOMUX_DRV_6MA, |
| 541 | .pull = GPIOMUX_PULL_UP, |
| 542 | }; |
| 543 | |
| 544 | static struct gpiomux_setting interrupt_gpio_suspend_pullup = { |
| 545 | .func = GPIOMUX_FUNC_GPIO, |
| 546 | .drv = GPIOMUX_DRV_6MA, |
| 547 | .pull = GPIOMUX_PULL_UP, |
| 548 | }; |
| 549 | |
| 550 | static struct gpiomux_setting interrupt_gpio_suspend_pulldown = { |
| 551 | .func = GPIOMUX_FUNC_GPIO, |
| 552 | .drv = GPIOMUX_DRV_6MA, |
| 553 | .pull = GPIOMUX_PULL_UP, |
| 554 | }; |
| 555 | |
| 556 | static struct msm_gpiomux_config msm_interrupt_configs[] __initdata = { |
| 557 | { |
| 558 | .gpio = 77, /* NFC_IRQ */ |
| 559 | .settings = { |
| 560 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 561 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup, |
| 562 | }, |
| 563 | }, |
| 564 | { |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 565 | .gpio = 80, /*ALSP_INT */ |
| 566 | .settings = { |
| 567 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 568 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup, |
| 569 | }, |
| 570 | }, |
| 571 | { |
| 572 | .gpio = 81, /*ACCEL_INT1 */ |
| 573 | .settings = { |
| 574 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 575 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown, |
| 576 | }, |
| 577 | }, |
| 578 | { |
| 579 | .gpio = 82, /*ACCEL_INT2 */ |
| 580 | .settings = { |
| 581 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 582 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown, |
| 583 | }, |
| 584 | }, |
| 585 | }; |
| 586 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 587 | void __init msm8610_init_gpiomux(void) |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 588 | { |
| 589 | int rc; |
| 590 | |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 591 | rc = msm_gpiomux_init_dt(); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 592 | if (rc) { |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 593 | pr_err("%s failed %d\n", __func__, rc); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 594 | return; |
| 595 | } |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 596 | |
| 597 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 598 | if (of_board_is_qrd()) { |
| 599 | msm_gpiomux_install(msm_focaltech_configs, |
| 600 | ARRAY_SIZE(msm_focaltech_configs)); |
| 601 | } else { |
| 602 | msm_gpiomux_install(msm_atmel_configs, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 603 | ARRAY_SIZE(msm_atmel_configs)); |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 604 | } |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 605 | msm_gpiomux_install(wcnss_5wire_interface, |
| 606 | ARRAY_SIZE(wcnss_5wire_interface)); |
Xiaoming Zhou | a329c94 | 2013-07-10 10:32:20 -0400 | [diff] [blame] | 607 | msm_gpiomux_install_nowrite(msm_lcd_configs, |
| 608 | ARRAY_SIZE(msm_lcd_configs)); |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 609 | msm_gpiomux_install(msm_keypad_configs, |
| 610 | ARRAY_SIZE(msm_keypad_configs)); |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 611 | msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det)); |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 612 | msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs)); |
Richard Liu | a1d406a | 2013-04-14 13:46:48 -0700 | [diff] [blame] | 613 | msm_gpiomux_install(msm_gpio_int_configs, |
| 614 | ARRAY_SIZE(msm_gpio_int_configs)); |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 615 | if (of_board_is_qrd()) |
| 616 | msm_gpiomux_install(msm_interrupt_configs, |
| 617 | ARRAY_SIZE(msm_interrupt_configs)); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 618 | } |