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> |
| 19 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 20 | static struct gpiomux_setting gpio_i2c_config = { |
| 21 | .func = GPIOMUX_FUNC_3, |
| 22 | .drv = GPIOMUX_DRV_2MA, |
| 23 | .pull = GPIOMUX_PULL_NONE, |
| 24 | }; |
| 25 | |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame^] | 26 | static struct gpiomux_setting gpio_cam_i2c_config = { |
| 27 | .func = GPIOMUX_FUNC_1, |
| 28 | .drv = GPIOMUX_DRV_2MA, |
| 29 | .pull = GPIOMUX_PULL_NONE, |
| 30 | }; |
| 31 | |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 32 | static struct gpiomux_setting gpio_spi_config = { |
| 33 | .func = GPIOMUX_FUNC_1, |
| 34 | .drv = GPIOMUX_DRV_6MA, |
| 35 | .pull = GPIOMUX_PULL_NONE, |
| 36 | }; |
| 37 | |
| 38 | static struct gpiomux_setting gpio_spi_cs_config = { |
| 39 | .func = GPIOMUX_FUNC_1, |
| 40 | .drv = GPIOMUX_DRV_6MA, |
| 41 | .pull = GPIOMUX_PULL_DOWN, |
| 42 | }; |
| 43 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 44 | static struct gpiomux_setting wcnss_5wire_suspend_cfg = { |
| 45 | .func = GPIOMUX_FUNC_GPIO, |
| 46 | .drv = GPIOMUX_DRV_2MA, |
| 47 | .pull = GPIOMUX_PULL_UP, |
| 48 | }; |
| 49 | |
| 50 | static struct gpiomux_setting wcnss_5wire_active_cfg = { |
| 51 | .func = GPIOMUX_FUNC_1, |
| 52 | .drv = GPIOMUX_DRV_6MA, |
| 53 | .pull = GPIOMUX_PULL_DOWN, |
| 54 | }; |
| 55 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 56 | static struct gpiomux_setting lcd_en_act_cfg = { |
| 57 | .func = GPIOMUX_FUNC_GPIO, |
| 58 | .drv = GPIOMUX_DRV_8MA, |
| 59 | .pull = GPIOMUX_PULL_NONE, |
| 60 | .dir = GPIOMUX_OUT_HIGH, |
| 61 | }; |
| 62 | |
| 63 | static struct gpiomux_setting lcd_en_sus_cfg = { |
| 64 | .func = GPIOMUX_FUNC_GPIO, |
| 65 | .drv = GPIOMUX_DRV_2MA, |
| 66 | .pull = GPIOMUX_PULL_DOWN, |
| 67 | }; |
| 68 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 69 | static struct gpiomux_setting gpio_keys_active = { |
| 70 | .func = GPIOMUX_FUNC_GPIO, |
| 71 | .drv = GPIOMUX_DRV_2MA, |
| 72 | .pull = GPIOMUX_PULL_UP, |
| 73 | }; |
| 74 | |
| 75 | static struct gpiomux_setting gpio_keys_suspend = { |
| 76 | .func = GPIOMUX_FUNC_GPIO, |
| 77 | .drv = GPIOMUX_DRV_2MA, |
| 78 | .pull = GPIOMUX_PULL_NONE, |
| 79 | }; |
| 80 | |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 81 | static struct msm_gpiomux_config msm_lcd_configs[] __initdata = { |
| 82 | { |
| 83 | .gpio = 41, |
| 84 | .settings = { |
| 85 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 86 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 87 | }, |
| 88 | }, |
| 89 | { |
| 90 | .gpio = 7, |
| 91 | .settings = { |
| 92 | [GPIOMUX_ACTIVE] = &lcd_en_act_cfg, |
| 93 | [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg, |
| 94 | }, |
| 95 | }, |
| 96 | }; |
| 97 | |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 98 | static struct msm_gpiomux_config msm_blsp_configs[] __initdata = { |
| 99 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 100 | .gpio = 10, /* BLSP1 QUP3 I2C_SDA */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 101 | .settings = { |
| 102 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 103 | }, |
| 104 | }, |
| 105 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 106 | .gpio = 11, /* BLSP1 QUP3 I2C_SCL */ |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 107 | .settings = { |
| 108 | [GPIOMUX_SUSPENDED] = &gpio_i2c_config, |
| 109 | }, |
| 110 | }, |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 111 | { |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame^] | 112 | .gpio = 16, /* BLSP1 QUP6 I2C_SDA */ |
| 113 | .settings = { |
| 114 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 115 | }, |
| 116 | }, |
| 117 | { |
| 118 | .gpio = 17, /* BLSP1 QUP6 I2C_SCL */ |
| 119 | .settings = { |
| 120 | [GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config, |
| 121 | }, |
| 122 | }, |
| 123 | { |
Gilad Avidov | f58f183 | 2013-01-09 17:31:28 -0700 | [diff] [blame] | 124 | .gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */ |
| 125 | .settings = { |
| 126 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 127 | }, |
| 128 | }, |
| 129 | { |
| 130 | .gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */ |
| 131 | .settings = { |
| 132 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 133 | }, |
| 134 | }, |
| 135 | { |
| 136 | .gpio = 3, /* BLSP1 QUP1 SPI_CLK */ |
| 137 | .settings = { |
| 138 | [GPIOMUX_SUSPENDED] = &gpio_spi_config, |
| 139 | }, |
| 140 | }, |
| 141 | { |
| 142 | .gpio = 2, /* BLSP1 QUP1 SPI_CS1 */ |
| 143 | .settings = { |
| 144 | [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config, |
| 145 | }, |
| 146 | }, |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 147 | }; |
| 148 | |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 149 | static struct msm_gpiomux_config wcnss_5wire_interface[] = { |
| 150 | { |
| 151 | .gpio = 23, |
| 152 | .settings = { |
| 153 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 154 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 155 | }, |
| 156 | }, |
| 157 | { |
| 158 | .gpio = 24, |
| 159 | .settings = { |
| 160 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 161 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 162 | }, |
| 163 | }, |
| 164 | { |
| 165 | .gpio = 25, |
| 166 | .settings = { |
| 167 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 168 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 169 | }, |
| 170 | }, |
| 171 | { |
| 172 | .gpio = 26, |
| 173 | .settings = { |
| 174 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 175 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 176 | }, |
| 177 | }, |
| 178 | { |
| 179 | .gpio = 27, |
| 180 | .settings = { |
| 181 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 182 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 183 | }, |
| 184 | }, |
| 185 | }; |
| 186 | |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 187 | static struct msm_gpiomux_config msm_keypad_configs[] __initdata = { |
| 188 | { |
| 189 | .gpio = 72, |
| 190 | .settings = { |
| 191 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 192 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 193 | }, |
| 194 | }, |
| 195 | { |
| 196 | .gpio = 73, |
| 197 | .settings = { |
| 198 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 199 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 200 | }, |
| 201 | }, |
| 202 | { |
| 203 | .gpio = 74, |
| 204 | .settings = { |
| 205 | [GPIOMUX_ACTIVE] = &gpio_keys_active, |
| 206 | [GPIOMUX_SUSPENDED] = &gpio_keys_suspend, |
| 207 | }, |
| 208 | }, |
| 209 | }; |
| 210 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 211 | void __init msm8610_init_gpiomux(void) |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 212 | { |
| 213 | int rc; |
| 214 | |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 215 | rc = msm_gpiomux_init_dt(); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 216 | if (rc) { |
Rohit Vaswani | 341c203 | 2012-11-08 18:49:29 -0800 | [diff] [blame] | 217 | pr_err("%s failed %d\n", __func__, rc); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 218 | return; |
| 219 | } |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 220 | |
| 221 | msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs)); |
Sameer Thalappil | 1fafd67 | 2013-04-03 12:31:04 -0700 | [diff] [blame] | 222 | msm_gpiomux_install(wcnss_5wire_interface, |
| 223 | ARRAY_SIZE(wcnss_5wire_interface)); |
Xiaoming Zhou | 1797226 | 2013-04-10 17:50:35 -0400 | [diff] [blame] | 224 | msm_gpiomux_install(msm_lcd_configs, ARRAY_SIZE(msm_lcd_configs)); |
Amy Maloche | 19c386b | 2013-04-15 14:06:01 -0700 | [diff] [blame] | 225 | msm_gpiomux_install(msm_keypad_configs, |
| 226 | ARRAY_SIZE(msm_keypad_configs)); |
Hanumant Singh | 55a1bb0 | 2012-11-06 10:01:15 -0800 | [diff] [blame] | 227 | } |