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