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 | |
Bansidhar Gopalachari | e331f37 | 2013-09-25 19:50:43 +0100 | [diff] [blame] | 44 | static struct gpiomux_setting gpio_nfc_config = { |
| 45 | .func = GPIOMUX_FUNC_2, |
| 46 | .drv = GPIOMUX_DRV_2MA, |
| 47 | .pull = GPIOMUX_PULL_NONE, |
| 48 | }; |
| 49 | static 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 Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 55 | static struct gpiomux_setting atmel_int_act_cfg = { |
| 56 | .func = GPIOMUX_FUNC_GPIO, |
| 57 | .drv = GPIOMUX_DRV_8MA, |
| 58 | .pull = GPIOMUX_PULL_UP, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 61 | static struct gpiomux_setting atmel_int_sus_cfg = { |
| 62 | .func = GPIOMUX_FUNC_GPIO, |
| 63 | .drv = GPIOMUX_DRV_2MA, |
| 64 | .pull = GPIOMUX_PULL_DOWN, |
| 65 | }; |
| 66 | |
| 67 | static struct gpiomux_setting atmel_reset_act_cfg = { |
| 68 | .func = GPIOMUX_FUNC_GPIO, |
| 69 | .drv = GPIOMUX_DRV_6MA, |
| 70 | .pull = GPIOMUX_PULL_UP, |
| 71 | }; |
| 72 | |
| 73 | static struct gpiomux_setting atmel_reset_sus_cfg = { |
| 74 | .func = GPIOMUX_FUNC_GPIO, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 75 | .drv = GPIOMUX_DRV_6MA, |
| 76 | .pull = GPIOMUX_PULL_DOWN, |
| 77 | }; |
| 78 | |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 79 | static struct gpiomux_setting focaltech_int_act_cfg = { |
| 80 | .func = GPIOMUX_FUNC_GPIO, |
| 81 | .drv = GPIOMUX_DRV_8MA, |
| 82 | .pull = GPIOMUX_PULL_UP, |
| 83 | }; |
| 84 | |
| 85 | static struct gpiomux_setting focaltech_int_sus_cfg = { |
| 86 | .func = GPIOMUX_FUNC_GPIO, |
| 87 | .drv = GPIOMUX_DRV_2MA, |
| 88 | .pull = GPIOMUX_PULL_DOWN, |
| 89 | }; |
| 90 | |
| 91 | static struct gpiomux_setting focaltech_reset_act_cfg = { |
| 92 | .func = GPIOMUX_FUNC_GPIO, |
| 93 | .drv = GPIOMUX_DRV_6MA, |
| 94 | .pull = GPIOMUX_PULL_UP, |
| 95 | }; |
| 96 | |
| 97 | static 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 Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 103 | static struct gpiomux_setting wcnss_5wire_suspend_cfg = { |
| 104 | .func = GPIOMUX_FUNC_GPIO, |
| 105 | .drv = GPIOMUX_DRV_2MA, |
| 106 | .pull = GPIOMUX_PULL_UP, |
| 107 | }; |
| 108 | |
| 109 | static 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 Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 115 | static 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 | |
| 122 | static 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 Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame] | 128 | static 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 | |
| 135 | static 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 Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 142 | static struct gpiomux_setting gpio_keys_active = { |
| 143 | .func = GPIOMUX_FUNC_GPIO, |
| 144 | .drv = GPIOMUX_DRV_2MA, |
| 145 | .pull = GPIOMUX_PULL_UP, |
| 146 | }; |
| 147 | |
| 148 | static struct gpiomux_setting gpio_keys_suspend = { |
| 149 | .func = GPIOMUX_FUNC_GPIO, |
| 150 | .drv = GPIOMUX_DRV_2MA, |
| 151 | .pull = GPIOMUX_PULL_NONE, |
| 152 | }; |
| 153 | |
Richard Liu | a1d406a | 2013-04-14 13:46:48 -0700 | [diff] [blame] | 154 | /* define gpio used as interrupt input */ |
| 155 | static 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 | |
| 162 | static 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 | |
| 169 | static 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 Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 179 | static 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 Zhou | 8dca7e4 | 2013-05-31 19:44:57 -0400 | [diff] [blame] | 194 | { |
| 195 | .gpio = 12, |
| 196 | .settings = { |
| 197 | [GPIOMUX_ACTIVE] = &lcd_te_act_config, |
| 198 | [GPIOMUX_SUSPENDED] = &lcd_te_sus_config, |
| 199 | }, |
| 200 | }, |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 201 | }; |
| 202 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 203 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 204 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 205 | .gpio = 2, /* BLSP1 QUP1 I2C_SDA */ |
| 206 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 207 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 208 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 209 | }, |
| 210 | }, |
| 211 | { |
| 212 | .gpio = 3, /* BLSP1 QUP1 I2C_SCL */ |
| 213 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 214 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 215 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 216 | }, |
| 217 | }, |
| 218 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 219 | .gpio = 10, /* BLSP1 QUP3 I2C_SDA */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 220 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 221 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 222 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 223 | }, |
| 224 | }, |
| 225 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 226 | .gpio = 11, /* BLSP1 QUP3 I2C_SCL */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 227 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 228 | [GPIOMUX_ACTIVE] = &gpio_i2c_config, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 229 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 230 | }, |
| 231 | }, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 232 | { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 233 | .gpio = 16, /* BLSP1 QUP6 I2C_SDA */ |
| 234 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 235 | [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config, |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 236 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 237 | }, |
| 238 | }, |
| 239 | { |
| 240 | .gpio = 17, /* BLSP1 QUP6 I2C_SCL */ |
| 241 | .settings = { |
Bingzhe Cai | 1248722 | 2013-09-02 22:37:36 +0800 | [diff] [blame] | 242 | [GPIOMUX_ACTIVE] = &gpio_cam_i2c_config, |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 243 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 244 | }, |
| 245 | }, |
Bansidhar Gopalachari | e331f37 | 2013-09-25 19:50:43 +0100 | [diff] [blame] | 246 | { |
| 247 | .gpio = 78, /* NFC CLK */ |
| 248 | .settings = { |
| 249 | [GPIOMUX_ACTIVE] = &gpio_nfc_config, |
| 250 | [GPIOMUX_SUSPENDED] = &gpio_nfc_sus_config, |
| 251 | }, |
| 252 | }, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 253 | }; |
| 254 | |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame] | 255 | static 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 | |
| 261 | static 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 Hoffman | 1cd68b2 | 2013-11-26 17:27:38 -0800 | [diff] [blame] | 278 | |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 279 | static struct msm_gpiomux_config msm_atmel_configs[] __initdata = { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 280 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 281 | .gpio = 0, /* TOUCH RESET */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 282 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 283 | [GPIOMUX_ACTIVE] = &atmel_reset_act_cfg, |
| 284 | [GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 285 | }, |
| 286 | }, |
| 287 | { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 288 | .gpio = 1, /* TOUCH INT */ |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 289 | .settings = { |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 290 | [GPIOMUX_ACTIVE] = &atmel_int_act_cfg, |
| 291 | [GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 292 | }, |
| 293 | }, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 294 | { |
| 295 | .gpio = 86, /* BLSP1 QUP4 SPI_DATA_MOSI */ |
| 296 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 297 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 298 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 299 | }, |
| 300 | }, |
| 301 | { |
| 302 | .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */ |
| 303 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 304 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 305 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 306 | }, |
| 307 | }, |
| 308 | { |
| 309 | .gpio = 89, /* BLSP1 QUP4 SPI_CLK */ |
| 310 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 311 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 312 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 313 | }, |
| 314 | }, |
| 315 | { |
| 316 | .gpio = 88, /* BLSP1 QUP4 SPI_CS */ |
| 317 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 318 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 319 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Gilad Avidov | a460c47 | 2013-04-12 16:23:32 -0600 | [diff] [blame] | 320 | }, |
| 321 | }, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 322 | }; |
| 323 | |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 324 | static 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 Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 342 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 343 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 344 | }, |
| 345 | }, |
| 346 | { |
| 347 | .gpio = 87, /* BLSP1 QUP4 SPI_DATA_MISO */ |
| 348 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 349 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 350 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 351 | }, |
| 352 | }, |
| 353 | { |
| 354 | .gpio = 89, /* BLSP1 QUP4 SPI_CLK */ |
| 355 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 356 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 357 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 358 | }, |
| 359 | }, |
| 360 | { |
| 361 | .gpio = 88, /* BLSP1 QUP4 SPI_CS */ |
| 362 | .settings = { |
Sana Venkat Raju | e53161a | 2013-09-17 16:33:26 +0530 | [diff] [blame] | 363 | [GPIOMUX_ACTIVE] = &gpio_spi_config, |
| 364 | [GPIOMUX_SUSPENDED] = &gpio_spi_susp_config, |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 365 | }, |
| 366 | }, |
| 367 | }; |
| 368 | |
| 369 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 370 | static 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 Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 408 | static 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 | |
| 422 | static 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 | |
Houston Hoffman | 1cd68b2 | 2013-11-26 17:27:38 -0800 | [diff] [blame] | 454 | static struct msm_gpiomux_config msm_non_qrd_configs[] __initdata = { |
| 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 | |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 464 | static struct msm_gpiomux_config msm_sensor_configs[] __initdata = { |
| 465 | { |
| 466 | .gpio = 13, /* CAM_MCLK0 */ |
| 467 | .settings = { |
| 468 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 469 | [GPIOMUX_SUSPENDED] = &cam_settings[1], |
| 470 | }, |
| 471 | }, |
| 472 | { |
| 473 | .gpio = 14, /* CAM_MCLK1 */ |
| 474 | .settings = { |
| 475 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 476 | [GPIOMUX_SUSPENDED] = &cam_settings[1], |
| 477 | }, |
| 478 | }, |
| 479 | { |
| 480 | .gpio = 16, /* CCI_I2C_SDA */ |
| 481 | .settings = { |
| 482 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 483 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0], |
| 484 | }, |
| 485 | }, |
| 486 | { |
| 487 | .gpio = 17, /* CCI_I2C_SCL */ |
| 488 | .settings = { |
| 489 | [GPIOMUX_ACTIVE] = &cam_settings[0], |
| 490 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[0], |
| 491 | }, |
| 492 | }, |
| 493 | { |
| 494 | .gpio = 18, /* FLASH_LED_EN */ |
| 495 | .settings = { |
Lokesh Kumar Aakulu | 034626d | 2013-05-10 20:30:07 -0700 | [diff] [blame] | 496 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 497 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 498 | }, |
| 499 | }, |
| 500 | { |
| 501 | .gpio = 19, /* FLASH_LED_NOW */ |
| 502 | .settings = { |
Lokesh Kumar Aakulu | 034626d | 2013-05-10 20:30:07 -0700 | [diff] [blame] | 503 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 504 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 505 | }, |
| 506 | }, |
| 507 | { |
| 508 | .gpio = 8, /* CAM1_STANDBY_N */ |
| 509 | .settings = { |
| 510 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 511 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 512 | }, |
| 513 | }, |
| 514 | { |
| 515 | .gpio = 15, /* CAM1_RST_N */ |
| 516 | .settings = { |
| 517 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 518 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 519 | }, |
| 520 | }, |
| 521 | { |
| 522 | .gpio = 20, /* WEBCAM1_STANDBY */ |
| 523 | .settings = { |
| 524 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 525 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 526 | }, |
| 527 | }, |
| 528 | { |
| 529 | .gpio = 21, /* WEBCAM2_RESET_N */ |
| 530 | .settings = { |
| 531 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
| 532 | [GPIOMUX_SUSPENDED] = &gpio_suspend_config[1], |
| 533 | }, |
| 534 | }, |
| 535 | }; |
| 536 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 537 | static struct msm_gpiomux_config msm_keypad_configs[] __initdata = { |
| 538 | { |
| 539 | .gpio = 72, |
| 540 | .settings = { |
| 541 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 542 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 543 | }, |
| 544 | }, |
| 545 | { |
| 546 | .gpio = 73, |
| 547 | .settings = { |
| 548 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 549 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 550 | }, |
| 551 | }, |
| 552 | { |
| 553 | .gpio = 74, |
| 554 | .settings = { |
| 555 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 556 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 557 | }, |
| 558 | }, |
| 559 | }; |
| 560 | |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 561 | static struct gpiomux_setting sd_card_det_active_config = { |
| 562 | .func = GPIOMUX_FUNC_GPIO, |
| 563 | .drv = GPIOMUX_DRV_2MA, |
| 564 | .pull = GPIOMUX_PULL_NONE, |
| 565 | .dir = GPIOMUX_IN, |
| 566 | }; |
| 567 | |
| 568 | static struct gpiomux_setting sd_card_det_suspend_config = { |
| 569 | .func = GPIOMUX_FUNC_GPIO, |
| 570 | .drv = GPIOMUX_DRV_2MA, |
| 571 | .pull = GPIOMUX_PULL_UP, |
| 572 | .dir = GPIOMUX_IN, |
| 573 | }; |
| 574 | |
| 575 | static struct msm_gpiomux_config sd_card_det[] __initdata = { |
| 576 | { |
| 577 | .gpio = 42, |
| 578 | .settings = { |
| 579 | [GPIOMUX_ACTIVE] = &sd_card_det_active_config, |
| 580 | [GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config, |
| 581 | }, |
| 582 | }, |
| 583 | }; |
| 584 | |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 585 | static struct gpiomux_setting interrupt_gpio_active = { |
| 586 | .func = GPIOMUX_FUNC_GPIO, |
| 587 | .drv = GPIOMUX_DRV_6MA, |
| 588 | .pull = GPIOMUX_PULL_UP, |
| 589 | }; |
| 590 | |
| 591 | static struct gpiomux_setting interrupt_gpio_suspend_pullup = { |
| 592 | .func = GPIOMUX_FUNC_GPIO, |
| 593 | .drv = GPIOMUX_DRV_6MA, |
| 594 | .pull = GPIOMUX_PULL_UP, |
| 595 | }; |
| 596 | |
| 597 | static struct gpiomux_setting interrupt_gpio_suspend_pulldown = { |
| 598 | .func = GPIOMUX_FUNC_GPIO, |
| 599 | .drv = GPIOMUX_DRV_6MA, |
| 600 | .pull = GPIOMUX_PULL_UP, |
| 601 | }; |
| 602 | |
| 603 | static struct msm_gpiomux_config msm_interrupt_configs[] __initdata = { |
| 604 | { |
| 605 | .gpio = 77, /* NFC_IRQ */ |
| 606 | .settings = { |
| 607 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 608 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup, |
| 609 | }, |
| 610 | }, |
| 611 | { |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 612 | .gpio = 80, /*ALSP_INT */ |
| 613 | .settings = { |
| 614 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 615 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pullup, |
| 616 | }, |
| 617 | }, |
| 618 | { |
| 619 | .gpio = 81, /*ACCEL_INT1 */ |
| 620 | .settings = { |
| 621 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 622 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown, |
| 623 | }, |
| 624 | }, |
| 625 | { |
| 626 | .gpio = 82, /*ACCEL_INT2 */ |
| 627 | .settings = { |
| 628 | [GPIOMUX_ACTIVE] = &interrupt_gpio_active, |
| 629 | [GPIOMUX_SUSPENDED] = &interrupt_gpio_suspend_pulldown, |
| 630 | }, |
| 631 | }, |
| 632 | }; |
| 633 | |
Kuirong Wang | 3ef74f0 | 2013-08-02 14:46:45 -0700 | [diff] [blame^] | 634 | static struct gpiomux_setting gpio_cdc_dmic_cfg = { |
| 635 | .func = GPIOMUX_FUNC_1, |
| 636 | .drv = GPIOMUX_DRV_4MA, |
| 637 | .pull = GPIOMUX_PULL_NONE, |
| 638 | }; |
| 639 | |
| 640 | |
| 641 | static struct msm_gpiomux_config msm_cdc_dmic_configs[] __initdata = { |
| 642 | { |
| 643 | .gpio = 100, /* DMIC CLK */ |
| 644 | .settings = { |
| 645 | [GPIOMUX_SUSPENDED] = &gpio_cdc_dmic_cfg, |
| 646 | }, |
| 647 | }, |
| 648 | { |
| 649 | .gpio = 101, /* DMIC DATA */ |
| 650 | .settings = { |
| 651 | [GPIOMUX_SUSPENDED] = &gpio_cdc_dmic_cfg, |
| 652 | }, |
| 653 | }, |
| 654 | }; |
| 655 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 656 | void __init msm8610_init_gpiomux(void) |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 657 | { |
| 658 | int rc; |
| 659 | |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 660 | rc = msm_gpiomux_init_dt(); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 661 | if (rc) { |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 662 | pr_err("%s failed %d\n", __func__, rc); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 663 | return; |
| 664 | } |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 665 | |
| 666 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 667 | if (of_board_is_qrd()) { |
| 668 | msm_gpiomux_install(msm_focaltech_configs, |
| 669 | ARRAY_SIZE(msm_focaltech_configs)); |
| 670 | } else { |
| 671 | msm_gpiomux_install(msm_atmel_configs, |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 672 | ARRAY_SIZE(msm_atmel_configs)); |
Figo Wang | b1510f8 | 2013-06-13 19:40:20 +0800 | [diff] [blame] | 673 | } |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 674 | msm_gpiomux_install(wcnss_5wire_interface, |
| 675 | ARRAY_SIZE(wcnss_5wire_interface)); |
Xiaoming Zhou | a329c94 | 2013-07-10 10:32:20 -0400 | [diff] [blame] | 676 | msm_gpiomux_install_nowrite(msm_lcd_configs, |
| 677 | ARRAY_SIZE(msm_lcd_configs)); |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 678 | msm_gpiomux_install(msm_keypad_configs, |
| 679 | ARRAY_SIZE(msm_keypad_configs)); |
Venkat Gopalakrishnan | 8aaf15a | 2013-04-30 16:27:03 -0700 | [diff] [blame] | 680 | msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det)); |
Lokesh Kumar Aakulu | 329a347 | 2013-06-03 06:08:17 -0700 | [diff] [blame] | 681 | msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs)); |
Richard Liu | a1d406a | 2013-04-14 13:46:48 -0700 | [diff] [blame] | 682 | msm_gpiomux_install(msm_gpio_int_configs, |
| 683 | ARRAY_SIZE(msm_gpio_int_configs)); |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame] | 684 | if (of_board_is_qrd()) { |
Bingzhe Cai | fe20b71 | 2013-07-15 16:48:49 +0800 | [diff] [blame] | 685 | msm_gpiomux_install(msm_interrupt_configs, |
| 686 | ARRAY_SIZE(msm_interrupt_configs)); |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame] | 687 | msm_gpiomux_install(msm_nfc_configs, |
| 688 | ARRAY_SIZE(msm_nfc_configs)); |
Houston Hoffman | 1cd68b2 | 2013-11-26 17:27:38 -0800 | [diff] [blame] | 689 | } else { |
| 690 | msm_gpiomux_install(msm_non_qrd_configs, |
| 691 | ARRAY_SIZE(msm_non_qrd_configs)); |
Houston Hoffman | 53421b4 | 2013-11-26 16:12:16 -0800 | [diff] [blame] | 692 | } |
Kuirong Wang | 3ef74f0 | 2013-08-02 14:46:45 -0700 | [diff] [blame^] | 693 | if (of_board_is_cdp()) |
| 694 | msm_gpiomux_install(msm_cdc_dmic_configs, |
| 695 | ARRAY_SIZE(msm_cdc_dmic_configs)); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 696 | } |