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