Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 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 | * |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 12 | */ |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
| 16 | #include <linux/irq.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | #include <linux/i2c.h> |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 18 | #include <linux/i2c/sx150x.h> |
Amir Samuelov | 5137e39 | 2011-09-21 17:31:25 +0300 | [diff] [blame] | 19 | #include <linux/i2c/isl9519.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | #include <linux/gpio.h> |
| 21 | #include <linux/msm_ssbi.h> |
| 22 | #include <linux/regulator/gpio-regulator.h> |
| 23 | #include <linux/mfd/pm8xxx/pm8921.h> |
Siddartha Mohanadoss | 77d106e | 2011-09-20 16:25:59 -0700 | [diff] [blame] | 24 | #include <linux/mfd/pm8xxx/pm8921-adc.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 25 | #include <linux/regulator/consumer.h> |
| 26 | #include <linux/spi/spi.h> |
| 27 | #include <linux/slimbus/slimbus.h> |
| 28 | #include <linux/bootmem.h> |
Lucille Sylvester | 34ec369 | 2011-08-16 16:28:04 -0600 | [diff] [blame] | 29 | #include <linux/msm_kgsl.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 30 | #ifdef CONFIG_ANDROID_PMEM |
| 31 | #include <linux/android_pmem.h> |
| 32 | #endif |
| 33 | #include <linux/cyttsp.h> |
| 34 | #include <linux/dma-mapping.h> |
| 35 | #include <linux/platform_data/qcom_crypto_device.h> |
Ankur Nandwani | b0039b0 | 2011-08-09 14:00:45 -0700 | [diff] [blame] | 36 | #include <linux/platform_data/qcom_wcnss_device.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 37 | #include <linux/leds.h> |
| 38 | #include <linux/leds-pm8xxx.h> |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 39 | #include <linux/i2c/atmel_mxt_ts.h> |
Siddartha Mohanadoss | ba21fdd | 2011-08-18 10:05:27 -0700 | [diff] [blame] | 40 | #include <linux/msm_tsens.h> |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 41 | |
| 42 | #include <asm/mach-types.h> |
| 43 | #include <asm/mach/arch.h> |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 44 | #include <asm/setup.h> |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 45 | #include <asm/hardware/gic.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 46 | #include <asm/mach/mmc.h> |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 47 | |
| 48 | #include <mach/board.h> |
| 49 | #include <mach/msm_iomap.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 50 | #include <mach/msm_spi.h> |
| 51 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 52 | #include <mach/msm_hsusb.h> |
| 53 | #else |
| 54 | #include <linux/usb/msm_hsusb.h> |
| 55 | #endif |
| 56 | #include <linux/usb/android.h> |
| 57 | #include <mach/usbdiag.h> |
| 58 | #include <mach/socinfo.h> |
| 59 | #include <mach/rpm.h> |
| 60 | #include <mach/gpio.h> |
Rohit Vaswani | a513aa8d | 2011-07-18 15:14:28 -0700 | [diff] [blame] | 61 | #include <mach/gpiomux.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 62 | #include <mach/msm_bus_board.h> |
| 63 | #include <mach/msm_memtypes.h> |
| 64 | #include <mach/dma.h> |
| 65 | #include <mach/msm_dsps.h> |
| 66 | #include <mach/msm_xo.h> |
Abhijeet Dharmapurikar | 6d565fd | 2011-09-15 18:49:56 -0700 | [diff] [blame] | 67 | #include <mach/restart.h> |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 68 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 69 | #ifdef CONFIG_WCD9310_CODEC |
| 70 | #include <linux/slimbus/slimbus.h> |
| 71 | #include <linux/mfd/wcd9310/core.h> |
| 72 | #include <linux/mfd/wcd9310/pdata.h> |
| 73 | #endif |
| 74 | |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 75 | #include <linux/ion.h> |
| 76 | #include <mach/ion.h> |
| 77 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 78 | #include "timer.h" |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 79 | #include "devices.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 80 | #include "devices-msm8x60.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 81 | #include "spm.h" |
| 82 | #include "board-msm8960.h" |
| 83 | #include "pm.h" |
| 84 | #include "cpuidle.h" |
| 85 | #include "rpm_resources.h" |
| 86 | #include "mpm.h" |
Matt Wagantall | 6d9ebee | 2011-08-26 12:15:24 -0700 | [diff] [blame] | 87 | #include "acpuclock.h" |
David Collins | 4c31a87 | 2011-08-31 10:07:10 -0700 | [diff] [blame] | 88 | #include "rpm_log.h" |
Naveen Ramaraj | 76483ad | 2011-09-06 14:25:44 -0700 | [diff] [blame] | 89 | #include "smd_private.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 90 | |
| 91 | static struct platform_device msm_fm_platform_init = { |
| 92 | .name = "iris_fm", |
| 93 | .id = -1, |
| 94 | }; |
| 95 | |
| 96 | struct pm8xxx_gpio_init { |
| 97 | unsigned gpio; |
| 98 | struct pm_gpio config; |
| 99 | }; |
| 100 | |
| 101 | struct pm8xxx_mpp_init { |
| 102 | unsigned mpp; |
| 103 | struct pm8xxx_mpp_config_data config; |
| 104 | }; |
| 105 | |
| 106 | #define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \ |
| 107 | _func, _inv, _disable) \ |
| 108 | { \ |
| 109 | .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \ |
| 110 | .config = { \ |
| 111 | .direction = _dir, \ |
| 112 | .output_buffer = _buf, \ |
| 113 | .output_value = _val, \ |
| 114 | .pull = _pull, \ |
| 115 | .vin_sel = _vin, \ |
| 116 | .out_strength = _out_strength, \ |
| 117 | .function = _func, \ |
| 118 | .inv_int_pol = _inv, \ |
| 119 | .disable_pin = _disable, \ |
| 120 | } \ |
| 121 | } |
| 122 | |
| 123 | #define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \ |
| 124 | { \ |
| 125 | .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \ |
| 126 | .config = { \ |
| 127 | .type = PM8XXX_MPP_TYPE_##_type, \ |
| 128 | .level = _level, \ |
| 129 | .control = PM8XXX_MPP_##_control, \ |
| 130 | } \ |
| 131 | } |
| 132 | |
| 133 | #define PM8XXX_GPIO_DISABLE(_gpio) \ |
| 134 | PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \ |
| 135 | 0, 0, 0, 1) |
| 136 | |
| 137 | #define PM8XXX_GPIO_OUTPUT(_gpio, _val) \ |
| 138 | PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
| 139 | PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \ |
| 140 | PM_GPIO_STRENGTH_HIGH, \ |
| 141 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 142 | |
| 143 | #define PM8XXX_GPIO_INPUT(_gpio, _pull) \ |
| 144 | PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \ |
| 145 | _pull, PM_GPIO_VIN_S4, \ |
| 146 | PM_GPIO_STRENGTH_NO, \ |
| 147 | PM_GPIO_FUNC_NORMAL, 0, 0) |
| 148 | |
| 149 | #define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \ |
| 150 | PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \ |
| 151 | PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \ |
| 152 | PM_GPIO_STRENGTH_HIGH, \ |
| 153 | _func, 0, 0) |
| 154 | |
| 155 | /* Initial PM8921 GPIO configurations */ |
| 156 | static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = { |
| 157 | PM8XXX_GPIO_DISABLE(6), /* Disable unused */ |
| 158 | PM8XXX_GPIO_DISABLE(7), /* Disable NFC */ |
| 159 | PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */ |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame] | 160 | /* External regulator shared by display and touchscreen on LiQUID */ |
| 161 | PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */ |
| 162 | PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 163 | PM8XXX_GPIO_DISABLE(22), /* Disable NFC */ |
Nagamalleswararao Ganji | eac5dfa | 2011-07-23 17:31:16 -0700 | [diff] [blame] | 164 | PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 165 | PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */ |
Nagamalleswararao Ganji | ca0adc0 | 2011-09-22 20:35:53 -0700 | [diff] [blame] | 166 | PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 167 | }; |
| 168 | |
| 169 | /* Initial PM8921 MPP configurations */ |
| 170 | static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = { |
| 171 | /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */ |
| 172 | PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 173 | PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8, |
| 174 | DOUT_CTRL_LOW), |
| 175 | }; |
| 176 | |
| 177 | static void __init pm8921_gpio_mpp_init(void) |
| 178 | { |
| 179 | int i, rc; |
| 180 | |
| 181 | for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) { |
| 182 | rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio, |
| 183 | &pm8921_gpios[i].config); |
| 184 | if (rc) { |
| 185 | pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc); |
| 186 | break; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) { |
| 191 | rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp, |
| 192 | &pm8921_mpps[i].config); |
| 193 | if (rc) { |
| 194 | pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc); |
| 195 | break; |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | #define FPGA_CS_GPIO 14 |
| 201 | #define KS8851_RST_GPIO 89 |
| 202 | #define KS8851_IRQ_GPIO 90 |
| 203 | |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 204 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 205 | enum { |
Abhijeet Dharmapurikar | 0fda560 | 2011-08-17 18:00:55 -0700 | [diff] [blame] | 206 | GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS), |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 207 | GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS), |
| 208 | /* CAM Expander */ |
| 209 | GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE, |
| 210 | GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE, |
| 211 | GPIO_CAM_GP_AFBUSY, |
| 212 | GPIO_CAM_GP_STROBE_CE, |
| 213 | GPIO_CAM_GP_CAM1MP_XCLR, |
| 214 | GPIO_CAM_GP_CAMIF_RESET_N, |
| 215 | GPIO_CAM_GP_XMT_FLASH_INT, |
| 216 | GPIO_CAM_GP_LED_EN1, |
| 217 | GPIO_CAM_GP_LED_EN2, |
| 218 | |
| 219 | }; |
| 220 | #endif |
| 221 | |
Harini Jayaraman | 608d046 | 2011-08-09 19:10:03 -0600 | [diff] [blame] | 222 | /* The SPI configurations apply to GSBI 1*/ |
| 223 | static struct gpiomux_setting spi_active = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 224 | .func = GPIOMUX_FUNC_1, |
| 225 | .drv = GPIOMUX_DRV_8MA, |
| 226 | .pull = GPIOMUX_PULL_NONE, |
| 227 | }; |
| 228 | |
Harini Jayaraman | 608d046 | 2011-08-09 19:10:03 -0600 | [diff] [blame] | 229 | static struct gpiomux_setting spi_suspended_config = { |
| 230 | .func = GPIOMUX_FUNC_GPIO, |
| 231 | .drv = GPIOMUX_DRV_2MA, |
| 232 | .pull = GPIOMUX_PULL_DOWN, |
| 233 | }; |
| 234 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 235 | static struct gpiomux_setting gsbi3 = { |
| 236 | .func = GPIOMUX_FUNC_1, |
| 237 | .drv = GPIOMUX_DRV_8MA, |
| 238 | .pull = GPIOMUX_PULL_NONE, |
| 239 | }; |
| 240 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 241 | static struct gpiomux_setting gsbi5 = { |
| 242 | .func = GPIOMUX_FUNC_1, |
| 243 | .drv = GPIOMUX_DRV_8MA, |
| 244 | .pull = GPIOMUX_PULL_NONE, |
| 245 | }; |
| 246 | |
| 247 | static struct gpiomux_setting gsbi10 = { |
| 248 | .func = GPIOMUX_FUNC_2, |
| 249 | .drv = GPIOMUX_DRV_8MA, |
| 250 | .pull = GPIOMUX_PULL_NONE, |
| 251 | }; |
| 252 | |
| 253 | static struct gpiomux_setting gsbi12 = { |
| 254 | .func = GPIOMUX_FUNC_1, |
| 255 | .drv = GPIOMUX_DRV_8MA, |
| 256 | .pull = GPIOMUX_PULL_NONE, |
| 257 | }; |
| 258 | |
| 259 | static struct gpiomux_setting cdc_mclk = { |
| 260 | .func = GPIOMUX_FUNC_1, |
| 261 | .drv = GPIOMUX_DRV_8MA, |
| 262 | .pull = GPIOMUX_PULL_NONE, |
| 263 | }; |
| 264 | |
Bhalchandra Gajare | 0e795c4 | 2011-08-15 18:10:30 -0700 | [diff] [blame] | 265 | static struct gpiomux_setting audio_auxpcm[] = { |
| 266 | /* Suspended state */ |
| 267 | { |
| 268 | .func = GPIOMUX_FUNC_GPIO, |
| 269 | .drv = GPIOMUX_DRV_2MA, |
| 270 | .pull = GPIOMUX_PULL_NONE, |
| 271 | }, |
| 272 | /* Active state */ |
| 273 | { |
| 274 | .func = GPIOMUX_FUNC_1, |
| 275 | .drv = GPIOMUX_DRV_2MA, |
| 276 | .pull = GPIOMUX_PULL_NONE, |
| 277 | }, |
| 278 | }; |
| 279 | |
Stepan Moskovchenko | 41d16827 | 2011-08-09 17:09:42 -0700 | [diff] [blame] | 280 | #ifdef CONFIG_KS8851 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 281 | static struct gpiomux_setting gpio_eth_config = { |
| 282 | .pull = GPIOMUX_PULL_NONE, |
| 283 | .drv = GPIOMUX_DRV_8MA, |
| 284 | .func = GPIOMUX_FUNC_GPIO, |
| 285 | }; |
Stepan Moskovchenko | 41d16827 | 2011-08-09 17:09:42 -0700 | [diff] [blame] | 286 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 287 | |
| 288 | static struct gpiomux_setting slimbus = { |
| 289 | .func = GPIOMUX_FUNC_1, |
| 290 | .drv = GPIOMUX_DRV_8MA, |
| 291 | .pull = GPIOMUX_PULL_KEEPER, |
| 292 | }; |
| 293 | |
| 294 | struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = { |
Stepan Moskovchenko | 41d16827 | 2011-08-09 17:09:42 -0700 | [diff] [blame] | 295 | #ifdef CONFIG_KS8851 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 296 | { |
| 297 | .gpio = KS8851_IRQ_GPIO, |
| 298 | .settings = { |
| 299 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 300 | } |
| 301 | }, |
| 302 | { |
| 303 | .gpio = KS8851_RST_GPIO, |
| 304 | .settings = { |
| 305 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 306 | } |
| 307 | }, |
| 308 | { |
| 309 | .gpio = FPGA_CS_GPIO, |
| 310 | .settings = { |
| 311 | [GPIOMUX_SUSPENDED] = &gpio_eth_config, |
| 312 | } |
| 313 | }, |
Stepan Moskovchenko | 41d16827 | 2011-08-09 17:09:42 -0700 | [diff] [blame] | 314 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 315 | }; |
| 316 | |
| 317 | static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = { |
| 318 | { |
| 319 | .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */ |
| 320 | .settings = { |
Harini Jayaraman | 608d046 | 2011-08-09 19:10:03 -0600 | [diff] [blame] | 321 | [GPIOMUX_SUSPENDED] = &spi_suspended_config, |
| 322 | [GPIOMUX_ACTIVE] = &spi_active, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 323 | }, |
| 324 | }, |
| 325 | { |
| 326 | .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */ |
| 327 | .settings = { |
Harini Jayaraman | 608d046 | 2011-08-09 19:10:03 -0600 | [diff] [blame] | 328 | [GPIOMUX_SUSPENDED] = &spi_suspended_config, |
| 329 | [GPIOMUX_ACTIVE] = &spi_active, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 330 | }, |
| 331 | }, |
| 332 | { |
| 333 | .gpio = 8, /* GSBI1 QUP SPI_CS_N */ |
| 334 | .settings = { |
Harini Jayaraman | 608d046 | 2011-08-09 19:10:03 -0600 | [diff] [blame] | 335 | [GPIOMUX_SUSPENDED] = &spi_suspended_config, |
| 336 | [GPIOMUX_ACTIVE] = &spi_active, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 337 | }, |
| 338 | }, |
| 339 | { |
| 340 | .gpio = 9, /* GSBI1 QUP SPI_CLK */ |
| 341 | .settings = { |
Harini Jayaraman | 608d046 | 2011-08-09 19:10:03 -0600 | [diff] [blame] | 342 | [GPIOMUX_SUSPENDED] = &spi_suspended_config, |
| 343 | [GPIOMUX_ACTIVE] = &spi_active, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 344 | }, |
| 345 | }, |
| 346 | { |
| 347 | .gpio = 16, /* GSBI3 I2C QUP SDA */ |
| 348 | .settings = { |
| 349 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 350 | }, |
| 351 | }, |
| 352 | { |
| 353 | .gpio = 17, /* GSBI3 I2C QUP SCL */ |
| 354 | .settings = { |
| 355 | [GPIOMUX_SUSPENDED] = &gsbi3, |
| 356 | }, |
| 357 | }, |
| 358 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 359 | .gpio = 22, /* GSBI5 UART2 */ |
| 360 | .settings = { |
| 361 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 362 | }, |
| 363 | }, |
| 364 | { |
| 365 | .gpio = 23, /* GSBI5 UART2 */ |
| 366 | .settings = { |
| 367 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 368 | }, |
| 369 | }, |
| 370 | { |
| 371 | .gpio = 24, /* GSBI5 UART2 */ |
| 372 | .settings = { |
| 373 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 374 | }, |
| 375 | }, |
| 376 | { |
| 377 | .gpio = 25, /* GSBI5 UART2 */ |
| 378 | .settings = { |
| 379 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 380 | }, |
| 381 | }, |
| 382 | { |
| 383 | .gpio = 44, /* GSBI12 I2C QUP SDA */ |
| 384 | .settings = { |
| 385 | [GPIOMUX_SUSPENDED] = &gsbi12, |
| 386 | }, |
| 387 | }, |
| 388 | { |
| 389 | .gpio = 45, /* GSBI12 I2C QUP SCL */ |
| 390 | .settings = { |
| 391 | [GPIOMUX_SUSPENDED] = &gsbi12, |
| 392 | }, |
| 393 | }, |
| 394 | { |
| 395 | .gpio = 73, /* GSBI10 I2C QUP SDA */ |
| 396 | .settings = { |
| 397 | [GPIOMUX_SUSPENDED] = &gsbi10, |
| 398 | }, |
| 399 | }, |
| 400 | { |
| 401 | .gpio = 74, /* GSBI10 I2C QUP SCL */ |
| 402 | .settings = { |
| 403 | [GPIOMUX_SUSPENDED] = &gsbi10, |
| 404 | }, |
| 405 | }, |
| 406 | }; |
| 407 | |
| 408 | static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = { |
| 409 | { |
| 410 | .gpio = 60, /* slimbus data */ |
| 411 | .settings = { |
| 412 | [GPIOMUX_SUSPENDED] = &slimbus, |
| 413 | }, |
| 414 | }, |
| 415 | { |
| 416 | .gpio = 61, /* slimbus clk */ |
| 417 | .settings = { |
| 418 | [GPIOMUX_SUSPENDED] = &slimbus, |
| 419 | }, |
| 420 | }, |
| 421 | }; |
| 422 | |
| 423 | static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = { |
| 424 | { |
| 425 | .gpio = 59, |
| 426 | .settings = { |
| 427 | [GPIOMUX_SUSPENDED] = &cdc_mclk, |
| 428 | }, |
| 429 | }, |
| 430 | }; |
Bhalchandra Gajare | 0e795c4 | 2011-08-15 18:10:30 -0700 | [diff] [blame] | 431 | |
| 432 | static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = { |
| 433 | { |
| 434 | .gpio = 63, |
| 435 | .settings = { |
| 436 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 437 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 438 | }, |
| 439 | }, |
| 440 | { |
| 441 | .gpio = 64, |
| 442 | .settings = { |
| 443 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 444 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 445 | }, |
| 446 | }, |
| 447 | { |
| 448 | .gpio = 65, |
| 449 | .settings = { |
| 450 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 451 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 452 | }, |
| 453 | }, |
| 454 | { |
| 455 | .gpio = 66, |
| 456 | .settings = { |
| 457 | [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], |
| 458 | [GPIOMUX_ACTIVE] = &audio_auxpcm[1], |
| 459 | }, |
| 460 | }, |
| 461 | }; |
| 462 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 463 | static struct gpiomux_setting wcnss_5wire_suspend_cfg = { |
| 464 | .func = GPIOMUX_FUNC_GPIO, |
| 465 | .drv = GPIOMUX_DRV_2MA, |
| 466 | .pull = GPIOMUX_PULL_NONE, |
| 467 | }; |
| 468 | |
| 469 | static struct gpiomux_setting wcnss_5wire_active_cfg = { |
| 470 | .func = GPIOMUX_FUNC_1, |
| 471 | .drv = GPIOMUX_DRV_6MA, |
| 472 | .pull = GPIOMUX_PULL_DOWN, |
| 473 | }; |
| 474 | |
| 475 | static struct msm_gpiomux_config wcnss_5wire_interface[] = { |
| 476 | { |
| 477 | .gpio = 84, |
| 478 | .settings = { |
| 479 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 480 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 481 | }, |
| 482 | }, |
| 483 | { |
| 484 | .gpio = 85, |
| 485 | .settings = { |
| 486 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 487 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 488 | }, |
| 489 | }, |
| 490 | { |
| 491 | .gpio = 86, |
| 492 | .settings = { |
| 493 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 494 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 495 | }, |
| 496 | }, |
| 497 | { |
| 498 | .gpio = 87, |
| 499 | .settings = { |
| 500 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 501 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 502 | }, |
| 503 | }, |
| 504 | { |
| 505 | .gpio = 88, |
| 506 | .settings = { |
| 507 | [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg, |
| 508 | [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg, |
| 509 | }, |
| 510 | }, |
| 511 | }; |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 512 | static struct gpiomux_setting cam_settings[] = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 513 | { |
| 514 | .func = GPIOMUX_FUNC_GPIO, /*suspend*/ |
| 515 | .drv = GPIOMUX_DRV_2MA, |
| 516 | .pull = GPIOMUX_PULL_DOWN, |
| 517 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 518 | |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 519 | { |
| 520 | .func = GPIOMUX_FUNC_1, /*active 1*/ |
| 521 | .drv = GPIOMUX_DRV_2MA, |
| 522 | .pull = GPIOMUX_PULL_NONE, |
| 523 | }, |
| 524 | |
| 525 | { |
| 526 | .func = GPIOMUX_FUNC_GPIO, /*active 2*/ |
| 527 | .drv = GPIOMUX_DRV_2MA, |
| 528 | .pull = GPIOMUX_PULL_NONE, |
| 529 | }, |
| 530 | |
| 531 | { |
| 532 | .func = GPIOMUX_FUNC_1, /*active 3*/ |
| 533 | .drv = GPIOMUX_DRV_8MA, |
Kevin Chan | 4c58d29 | 2011-09-13 11:03:25 -0700 | [diff] [blame] | 534 | .pull = GPIOMUX_PULL_NONE, |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 535 | }, |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 536 | |
| 537 | { |
| 538 | .func = GPIOMUX_FUNC_5, /*active 4*/ |
| 539 | .drv = GPIOMUX_DRV_8MA, |
| 540 | .pull = GPIOMUX_PULL_UP, |
| 541 | }, |
| 542 | |
| 543 | { |
| 544 | .func = GPIOMUX_FUNC_6, /*active 5*/ |
| 545 | .drv = GPIOMUX_DRV_8MA, |
| 546 | .pull = GPIOMUX_PULL_UP, |
| 547 | }, |
| 548 | |
| 549 | { |
| 550 | .func = GPIOMUX_FUNC_2, /*active 6*/ |
| 551 | .drv = GPIOMUX_DRV_2MA, |
| 552 | .pull = GPIOMUX_PULL_UP, |
| 553 | }, |
| 554 | |
| 555 | { |
| 556 | .func = GPIOMUX_FUNC_3, /*active 7*/ |
| 557 | .drv = GPIOMUX_DRV_8MA, |
| 558 | .pull = GPIOMUX_PULL_UP, |
| 559 | }, |
| 560 | |
Kevin Chan | 4c58d29 | 2011-09-13 11:03:25 -0700 | [diff] [blame] | 561 | { |
| 562 | .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/ |
| 563 | .drv = GPIOMUX_DRV_2MA, |
| 564 | .pull = GPIOMUX_PULL_KEEPER, |
| 565 | }, |
| 566 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 567 | }; |
| 568 | |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 569 | static struct msm_gpiomux_config msm8960_cam_common_configs[] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 570 | { |
| 571 | .gpio = 2, |
| 572 | .settings = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 573 | [GPIOMUX_ACTIVE] = &cam_settings[2], |
| 574 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 575 | }, |
| 576 | }, |
| 577 | { |
| 578 | .gpio = 3, |
| 579 | .settings = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 580 | [GPIOMUX_ACTIVE] = &cam_settings[1], |
| 581 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 582 | }, |
| 583 | }, |
| 584 | { |
| 585 | .gpio = 4, |
| 586 | .settings = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 587 | [GPIOMUX_ACTIVE] = &cam_settings[1], |
| 588 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 589 | }, |
| 590 | }, |
| 591 | { |
| 592 | .gpio = 5, |
| 593 | .settings = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 594 | [GPIOMUX_ACTIVE] = &cam_settings[1], |
| 595 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 596 | }, |
| 597 | }, |
| 598 | { |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 599 | .gpio = 76, |
| 600 | .settings = { |
| 601 | [GPIOMUX_ACTIVE] = &cam_settings[2], |
| 602 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
| 603 | }, |
| 604 | }, |
| 605 | { |
| 606 | .gpio = 107, |
| 607 | .settings = { |
| 608 | [GPIOMUX_ACTIVE] = &cam_settings[2], |
| 609 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
| 610 | }, |
| 611 | }, |
| 612 | }; |
| 613 | |
| 614 | static struct msm_gpiomux_config msm8960_cam_2d_configs[] = { |
| 615 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 616 | .gpio = 18, |
| 617 | .settings = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 618 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Kevin Chan | 4c58d29 | 2011-09-13 11:03:25 -0700 | [diff] [blame] | 619 | [GPIOMUX_SUSPENDED] = &cam_settings[8], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 620 | }, |
| 621 | }, |
| 622 | { |
| 623 | .gpio = 19, |
| 624 | .settings = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 625 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Kevin Chan | 4c58d29 | 2011-09-13 11:03:25 -0700 | [diff] [blame] | 626 | [GPIOMUX_SUSPENDED] = &cam_settings[8], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 627 | }, |
| 628 | }, |
| 629 | { |
| 630 | .gpio = 20, |
| 631 | .settings = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 632 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Kevin Chan | 4c58d29 | 2011-09-13 11:03:25 -0700 | [diff] [blame] | 633 | [GPIOMUX_SUSPENDED] = &cam_settings[8], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 634 | }, |
| 635 | }, |
| 636 | { |
| 637 | .gpio = 21, |
| 638 | .settings = { |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 639 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Kevin Chan | 4c58d29 | 2011-09-13 11:03:25 -0700 | [diff] [blame] | 640 | [GPIOMUX_SUSPENDED] = &cam_settings[8], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 641 | }, |
| 642 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 643 | }; |
| 644 | |
| 645 | static struct gpiomux_setting cyts_resout_sus_cfg = { |
| 646 | .func = GPIOMUX_FUNC_GPIO, |
| 647 | .drv = GPIOMUX_DRV_6MA, |
| 648 | .pull = GPIOMUX_PULL_UP, |
| 649 | }; |
| 650 | |
| 651 | static struct gpiomux_setting cyts_resout_act_cfg = { |
| 652 | .func = GPIOMUX_FUNC_GPIO, |
| 653 | .drv = GPIOMUX_DRV_6MA, |
| 654 | .pull = GPIOMUX_PULL_UP, |
| 655 | }; |
| 656 | |
| 657 | static struct gpiomux_setting cyts_sleep_sus_cfg = { |
| 658 | .func = GPIOMUX_FUNC_GPIO, |
| 659 | .drv = GPIOMUX_DRV_6MA, |
| 660 | .pull = GPIOMUX_PULL_DOWN, |
| 661 | }; |
| 662 | |
| 663 | static struct gpiomux_setting cyts_sleep_act_cfg = { |
| 664 | .func = GPIOMUX_FUNC_GPIO, |
| 665 | .drv = GPIOMUX_DRV_6MA, |
| 666 | .pull = GPIOMUX_PULL_DOWN, |
| 667 | }; |
| 668 | |
| 669 | static struct gpiomux_setting cyts_int_act_cfg = { |
| 670 | .func = GPIOMUX_FUNC_GPIO, |
| 671 | .drv = GPIOMUX_DRV_8MA, |
| 672 | .pull = GPIOMUX_PULL_UP, |
| 673 | }; |
| 674 | |
| 675 | static struct gpiomux_setting cyts_int_sus_cfg = { |
| 676 | .func = GPIOMUX_FUNC_GPIO, |
| 677 | .drv = GPIOMUX_DRV_2MA, |
Mohan Pallaka | cbc5d16 | 2011-09-13 15:23:21 +0530 | [diff] [blame] | 678 | .pull = GPIOMUX_PULL_DOWN, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 679 | }; |
| 680 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 681 | static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = { |
| 682 | { /* TS INTERRUPT */ |
| 683 | .gpio = 11, |
| 684 | .settings = { |
| 685 | [GPIOMUX_ACTIVE] = &cyts_int_act_cfg, |
| 686 | [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg, |
| 687 | }, |
| 688 | }, |
| 689 | { /* TS SLEEP */ |
| 690 | .gpio = 50, |
| 691 | .settings = { |
| 692 | [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg, |
| 693 | [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg, |
| 694 | }, |
| 695 | }, |
| 696 | { /* TS RESOUT */ |
| 697 | .gpio = 52, |
| 698 | .settings = { |
| 699 | [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg, |
| 700 | [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg, |
| 701 | }, |
| 702 | }, |
| 703 | }; |
| 704 | |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 705 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 706 | enum { |
| 707 | SX150X_CAM, |
| 708 | }; |
| 709 | |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 710 | static struct sx150x_platform_data sx150x_data[] = { |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 711 | [SX150X_CAM] = { |
| 712 | .gpio_base = GPIO_CAM_EXPANDER_BASE, |
| 713 | .oscio_is_gpo = false, |
| 714 | .io_pullup_ena = 0x0, |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 715 | .io_pulldn_ena = 0xc0, |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 716 | .io_open_drain_ena = 0x0, |
| 717 | .irq_summary = -1, |
| 718 | }, |
| 719 | }; |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 720 | |
| 721 | #endif |
| 722 | |
| 723 | #ifdef CONFIG_I2C |
| 724 | |
| 725 | #define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4 |
| 726 | #define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3 |
Amir Samuelov | 5137e39 | 2011-09-21 17:31:25 +0300 | [diff] [blame] | 727 | #define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10 |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 728 | |
| 729 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 730 | |
| 731 | static struct i2c_board_info cam_expander_i2c_info[] = { |
| 732 | { |
| 733 | I2C_BOARD_INFO("sx1508q", 0x22), |
| 734 | .platform_data = &sx150x_data[SX150X_CAM] |
| 735 | }, |
| 736 | }; |
| 737 | |
| 738 | static struct msm_cam_expander_info cam_expander_info[] = { |
| 739 | { |
| 740 | cam_expander_i2c_info, |
| 741 | MSM_8960_GSBI4_QUP_I2C_BUS_ID, |
| 742 | }, |
| 743 | }; |
| 744 | #endif |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 745 | #endif |
| 746 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 747 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000 |
| 748 | #define MSM_PMEM_ADSP_SIZE 0x3800000 |
Ben Romberger | 09e462d | 2011-08-09 15:24:37 -0700 | [diff] [blame] | 749 | #define MSM_PMEM_AUDIO_SIZE 0x28B000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 750 | #define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */ |
| 751 | |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 752 | #define MSM_ION_EBI_SIZE SZ_8M |
| 753 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 754 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| 755 | static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE; |
| 756 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 757 | { |
| 758 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 759 | return 0; |
| 760 | } |
| 761 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 762 | #endif |
| 763 | |
| 764 | #ifdef CONFIG_ANDROID_PMEM |
| 765 | static unsigned pmem_size = MSM_PMEM_SIZE; |
| 766 | static int __init pmem_size_setup(char *p) |
| 767 | { |
| 768 | pmem_size = memparse(p, NULL); |
| 769 | return 0; |
| 770 | } |
| 771 | early_param("pmem_size", pmem_size_setup); |
| 772 | |
| 773 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 774 | |
| 775 | static int __init pmem_adsp_size_setup(char *p) |
| 776 | { |
| 777 | pmem_adsp_size = memparse(p, NULL); |
| 778 | return 0; |
| 779 | } |
| 780 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 781 | |
| 782 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 783 | |
| 784 | static int __init pmem_audio_size_setup(char *p) |
| 785 | { |
| 786 | pmem_audio_size = memparse(p, NULL); |
| 787 | return 0; |
| 788 | } |
| 789 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 790 | #endif |
| 791 | |
| 792 | #ifdef CONFIG_ANDROID_PMEM |
| 793 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 794 | .name = "pmem", |
| 795 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 796 | .cached = 1, |
| 797 | .memory_type = MEMTYPE_EBI1, |
| 798 | }; |
| 799 | |
| 800 | static struct platform_device android_pmem_device = { |
| 801 | .name = "android_pmem", |
| 802 | .id = 0, |
| 803 | .dev = {.platform_data = &android_pmem_pdata}, |
| 804 | }; |
| 805 | |
| 806 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 807 | .name = "pmem_adsp", |
| 808 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 809 | .cached = 0, |
| 810 | .memory_type = MEMTYPE_EBI1, |
| 811 | }; |
| 812 | static struct platform_device android_pmem_adsp_device = { |
| 813 | .name = "android_pmem", |
| 814 | .id = 2, |
| 815 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 816 | }; |
| 817 | |
| 818 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 819 | .name = "pmem_audio", |
| 820 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 821 | .cached = 0, |
| 822 | .memory_type = MEMTYPE_EBI1, |
| 823 | }; |
| 824 | |
| 825 | static struct platform_device android_pmem_audio_device = { |
| 826 | .name = "android_pmem", |
| 827 | .id = 4, |
| 828 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 829 | }; |
| 830 | #endif |
| 831 | |
| 832 | static struct memtype_reserve msm8960_reserve_table[] __initdata = { |
| 833 | [MEMTYPE_SMI] = { |
| 834 | }, |
| 835 | [MEMTYPE_EBI0] = { |
| 836 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 837 | }, |
| 838 | [MEMTYPE_EBI1] = { |
| 839 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 840 | }, |
| 841 | }; |
| 842 | |
| 843 | static void __init size_pmem_devices(void) |
| 844 | { |
| 845 | #ifdef CONFIG_ANDROID_PMEM |
| 846 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 847 | android_pmem_pdata.size = pmem_size; |
| 848 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
| 849 | #endif |
| 850 | } |
| 851 | |
| 852 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 853 | { |
| 854 | msm8960_reserve_table[p->memory_type].size += p->size; |
| 855 | } |
| 856 | |
| 857 | static void __init reserve_pmem_memory(void) |
| 858 | { |
| 859 | #ifdef CONFIG_ANDROID_PMEM |
| 860 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 861 | reserve_memory_for(&android_pmem_pdata); |
| 862 | reserve_memory_for(&android_pmem_audio_pdata); |
| 863 | msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 864 | #endif |
| 865 | } |
| 866 | |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 867 | static int msm8960_paddr_to_memtype(unsigned int paddr) |
| 868 | { |
| 869 | return MEMTYPE_EBI1; |
| 870 | } |
| 871 | |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 872 | #ifdef CONFIG_ION_MSM |
| 873 | struct ion_platform_data ion_pdata = { |
| 874 | .nr = 3, |
| 875 | .heaps = { |
| 876 | { |
| 877 | .id = ION_HEAP_SYSTEM_ID, |
| 878 | .type = ION_HEAP_TYPE_SYSTEM, |
| 879 | .name = ION_KMALLOC_HEAP_NAME, |
| 880 | }, |
| 881 | { |
| 882 | .id = ION_HEAP_SYSTEM_CONTIG_ID, |
| 883 | .type = ION_HEAP_TYPE_SYSTEM_CONTIG, |
| 884 | .name = ION_VMALLOC_HEAP_NAME, |
| 885 | }, |
| 886 | { |
| 887 | .id = ION_HEAP_EBI_ID, |
| 888 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 889 | .name = ION_EBI1_HEAP_NAME, |
| 890 | .size = MSM_ION_EBI_SIZE, |
| 891 | .memory_type = ION_EBI_TYPE, |
| 892 | }, |
| 893 | } |
| 894 | }; |
| 895 | |
| 896 | struct platform_device ion_dev = { |
| 897 | .name = "ion-msm", |
| 898 | .id = 1, |
| 899 | .dev = { .platform_data = &ion_pdata }, |
| 900 | }; |
| 901 | #endif |
| 902 | |
| 903 | static void reserve_ion_memory(void) |
| 904 | { |
| 905 | #ifdef CONFIG_ION_MSM |
| 906 | msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE; |
| 907 | #endif |
| 908 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 909 | static void __init msm8960_calculate_reserve_sizes(void) |
| 910 | { |
| 911 | size_pmem_devices(); |
| 912 | reserve_pmem_memory(); |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 913 | reserve_ion_memory(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 914 | } |
| 915 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 916 | static struct reserve_info msm8960_reserve_info __initdata = { |
| 917 | .memtype_reserve_table = msm8960_reserve_table, |
| 918 | .calculate_reserve_sizes = msm8960_calculate_reserve_sizes, |
| 919 | .paddr_to_memtype = msm8960_paddr_to_memtype, |
| 920 | }; |
| 921 | |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 922 | static int msm8960_memory_bank_size(void) |
| 923 | { |
| 924 | return 1<<29; |
| 925 | } |
| 926 | |
| 927 | static void __init locate_unstable_memory(void) |
| 928 | { |
| 929 | struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; |
| 930 | unsigned long bank_size; |
| 931 | unsigned long low, high; |
| 932 | |
| 933 | bank_size = msm8960_memory_bank_size(); |
| 934 | low = meminfo.bank[0].start; |
| 935 | high = mb->start + mb->size; |
| 936 | low &= ~(bank_size - 1); |
| 937 | |
| 938 | if (high - low <= bank_size) |
| 939 | return; |
| 940 | msm8960_reserve_info.low_unstable_address = low + bank_size; |
| 941 | msm8960_reserve_info.max_unstable_size = high - low - bank_size; |
| 942 | msm8960_reserve_info.bank_size = bank_size; |
| 943 | pr_info("low unstable address %lx max size %lx bank size %lx\n", |
| 944 | msm8960_reserve_info.low_unstable_address, |
| 945 | msm8960_reserve_info.max_unstable_size, |
| 946 | msm8960_reserve_info.bank_size); |
| 947 | } |
| 948 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 949 | static void __init msm8960_reserve(void) |
| 950 | { |
| 951 | reserve_info = &msm8960_reserve_info; |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 952 | locate_unstable_memory(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 953 | msm_reserve(); |
| 954 | } |
| 955 | |
Larry Bassel | a4414b1 | 2011-08-04 11:11:02 -0700 | [diff] [blame] | 956 | static int msm8960_change_memory_power(u64 start, u64 size, |
| 957 | int change_type) |
Larry Bassel | a7eadea | 2011-07-14 10:46:00 -0700 | [diff] [blame] | 958 | { |
Naveen Ramaraj | b03bb1b | 2011-09-12 14:34:31 -0700 | [diff] [blame] | 959 | return soc_change_memory_power(start, size, change_type); |
Larry Bassel | a7eadea | 2011-07-14 10:46:00 -0700 | [diff] [blame] | 960 | } |
| 961 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 962 | #ifdef CONFIG_MSM_CAMERA |
| 963 | |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 964 | static uint16_t msm_cam_gpio_2d_tbl[] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 965 | 5, /*CAMIF_MCLK*/ |
| 966 | 20, /*CAMIF_I2C_DATA*/ |
| 967 | 21, /*CAMIF_I2C_CLK*/ |
| 968 | }; |
| 969 | |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 970 | static struct msm_camera_gpio_conf gpio_conf = { |
| 971 | .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs, |
| 972 | .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs), |
| 973 | .cam_gpio_tbl = msm_cam_gpio_2d_tbl, |
| 974 | .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl), |
| 975 | }; |
| 976 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 977 | #define VFE_CAMIF_TIMER1_GPIO 2 |
| 978 | #define VFE_CAMIF_TIMER2_GPIO 3 |
| 979 | #define VFE_CAMIF_TIMER3_GPIO_INT 4 |
| 980 | struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = { |
| 981 | .flash_trigger = VFE_CAMIF_TIMER2_GPIO, |
| 982 | .flash_charge = VFE_CAMIF_TIMER1_GPIO, |
| 983 | .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT, |
| 984 | .flash_recharge_duration = 50000, |
| 985 | .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT), |
| 986 | }; |
| 987 | |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 988 | #ifdef CONFIG_MSM_CAMERA_FLASH |
| 989 | static struct msm_camera_sensor_flash_src msm_flash_src = { |
| 990 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT, |
| 991 | ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1, |
| 992 | ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2, |
| 993 | #if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \ |
| 994 | defined(CONFIG_GPIO_SX150X_MODULE)) |
| 995 | ._fsrc.ext_driver_src.expander_info = cam_expander_info, |
| 996 | #endif |
| 997 | }; |
| 998 | #endif |
| 999 | |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1000 | struct msm_camera_device_platform_data msm_camera_csi_device_data[] = { |
| 1001 | { |
| 1002 | .ioclk.mclk_clk_rate = 24000000, |
| 1003 | .ioclk.vfe_clk_rate = 228570000, |
| 1004 | .csid_core = 0, |
| 1005 | }, |
| 1006 | { |
| 1007 | .ioclk.mclk_clk_rate = 24000000, |
| 1008 | .ioclk.vfe_clk_rate = 228570000, |
| 1009 | .csid_core = 1, |
| 1010 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1011 | }; |
| 1012 | |
Sreesudhan Ramakrish Ramkumar | b54fd24 | 2011-09-12 17:11:19 -0700 | [diff] [blame] | 1013 | #ifdef CONFIG_IMX074_ACT |
| 1014 | static struct i2c_board_info imx074_actuator_i2c_info = { |
| 1015 | I2C_BOARD_INFO("imx074_act", 0x11), |
| 1016 | }; |
| 1017 | |
| 1018 | static struct msm_actuator_info imx074_actuator_info = { |
| 1019 | .board_info = &imx074_actuator_i2c_info, |
| 1020 | .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID, |
| 1021 | .vcm_pwd = 0, |
| 1022 | .vcm_enable = 1, |
| 1023 | }; |
| 1024 | #endif |
| 1025 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1026 | #ifdef CONFIG_IMX074 |
| 1027 | static struct msm_camera_sensor_flash_data flash_imx074 = { |
| 1028 | .flash_type = MSM_CAMERA_FLASH_LED, |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 1029 | #ifdef CONFIG_MSM_CAMERA_FLASH |
| 1030 | .flash_src = &msm_flash_src |
| 1031 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1032 | }; |
| 1033 | |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1034 | static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = { |
| 1035 | .mount_angle = 90, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1036 | .sensor_reset = 107, |
| 1037 | .sensor_pwd = 85, |
| 1038 | .vcm_pwd = 0, |
| 1039 | .vcm_enable = 1, |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1040 | }; |
| 1041 | |
| 1042 | static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = { |
| 1043 | .sensor_name = "imx074", |
| 1044 | .pdata = &msm_camera_csi_device_data[0], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1045 | .flash_data = &flash_imx074, |
| 1046 | .strobe_flash_data = &strobe_flash_xenon, |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1047 | .sensor_platform_info = &sensor_board_info_imx074, |
| 1048 | .gpio_conf = &gpio_conf, |
| 1049 | .csi_if = 1, |
| 1050 | .camera_type = BACK_CAMERA_2D, |
Sreesudhan Ramakrish Ramkumar | b54fd24 | 2011-09-12 17:11:19 -0700 | [diff] [blame] | 1051 | #ifdef CONFIG_IMX074_ACT |
| 1052 | .actuator_info = &imx074_actuator_info |
| 1053 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1054 | }; |
| 1055 | |
| 1056 | struct platform_device msm8960_camera_sensor_imx074 = { |
| 1057 | .name = "msm_camera_imx074", |
| 1058 | .dev = { |
| 1059 | .platform_data = &msm_camera_sensor_imx074_data, |
| 1060 | }, |
| 1061 | }; |
| 1062 | #endif |
| 1063 | #ifdef CONFIG_OV2720 |
| 1064 | static struct msm_camera_sensor_flash_data flash_ov2720 = { |
Kevin Chan | 1a99033 | 2011-07-26 20:31:23 -0700 | [diff] [blame] | 1065 | .flash_type = MSM_CAMERA_FLASH_NONE, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1066 | }; |
| 1067 | |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1068 | static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = { |
| 1069 | .mount_angle = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1070 | .sensor_reset = 76, |
| 1071 | .sensor_pwd = 85, |
| 1072 | .vcm_pwd = 0, |
| 1073 | .vcm_enable = 1, |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1074 | }; |
| 1075 | |
| 1076 | static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = { |
| 1077 | .sensor_name = "ov2720", |
| 1078 | .pdata = &msm_camera_csi_device_data[1], |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1079 | .flash_data = &flash_ov2720, |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1080 | .sensor_platform_info = &sensor_board_info_ov2720, |
| 1081 | .gpio_conf = &gpio_conf, |
| 1082 | .csi_if = 1, |
| 1083 | .camera_type = FRONT_CAMERA_2D, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1084 | }; |
| 1085 | |
| 1086 | struct platform_device msm8960_camera_sensor_ov2720 = { |
| 1087 | .name = "msm_camera_ov2720", |
| 1088 | .dev = { |
| 1089 | .platform_data = &msm_camera_sensor_ov2720_data, |
| 1090 | }, |
| 1091 | }; |
| 1092 | #endif |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 1093 | |
| 1094 | static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = { |
| 1095 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 1096 | }; |
| 1097 | |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1098 | static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = { |
| 1099 | .mount_angle = 270, |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 1100 | .sensor_reset = 107, |
| 1101 | .sensor_pwd = 85, |
| 1102 | .vcm_pwd = 0, |
| 1103 | .vcm_enable = 1, |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1104 | }; |
| 1105 | |
| 1106 | static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = { |
| 1107 | .sensor_name = "qs_mt9p017", |
| 1108 | .pdata = &msm_camera_csi_device_data[0], |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 1109 | .flash_data = &flash_qs_mt9p017, |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 1110 | .sensor_platform_info = &sensor_board_info_qs_mt9p017, |
| 1111 | .gpio_conf = &gpio_conf, |
| 1112 | .csi_if = 1, |
| 1113 | .camera_type = BACK_CAMERA_3D, |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 1114 | }; |
| 1115 | |
| 1116 | struct platform_device msm8960_camera_sensor_qs_mt9p017 = { |
| 1117 | .name = "msm_camera_qs_mt9p017", |
| 1118 | .dev = { |
| 1119 | .platform_data = &msm_camera_sensor_qs_mt9p017_data, |
| 1120 | }, |
| 1121 | }; |
| 1122 | |
Kevin Chan | 8b0d232 | 2011-09-10 21:06:31 -0700 | [diff] [blame] | 1123 | static struct msm8960_privacy_light_cfg privacy_light_info = { |
| 1124 | .mpp = PM8921_MPP_PM_TO_SYS(12), |
| 1125 | }; |
| 1126 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1127 | static void __init msm8960_init_cam(void) |
| 1128 | { |
| 1129 | int i; |
| 1130 | struct platform_device *cam_dev[] = { |
| 1131 | &msm8960_camera_sensor_imx074, |
| 1132 | &msm8960_camera_sensor_ov2720, |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 1133 | &msm8960_camera_sensor_qs_mt9p017, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1134 | }; |
| 1135 | |
Kevin Chan | 8b0d232 | 2011-09-10 21:06:31 -0700 | [diff] [blame] | 1136 | if (machine_is_msm8960_liquid()) { |
| 1137 | struct msm_camera_sensor_info *s_info; |
| 1138 | s_info = msm8960_camera_sensor_imx074.dev.platform_data; |
| 1139 | s_info->sensor_platform_info->mount_angle = 180; |
| 1140 | s_info = msm8960_camera_sensor_ov2720.dev.platform_data; |
| 1141 | s_info->sensor_platform_info->privacy_light = 1; |
| 1142 | s_info->sensor_platform_info->privacy_light_info = |
| 1143 | &privacy_light_info; |
| 1144 | } |
| 1145 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1146 | for (i = 0; i < ARRAY_SIZE(cam_dev); i++) { |
| 1147 | struct msm_camera_sensor_info *s_info; |
| 1148 | s_info = cam_dev[i]->dev.platform_data; |
| 1149 | msm_get_cam_resources(s_info); |
| 1150 | platform_device_register(cam_dev[i]); |
| 1151 | } |
| 1152 | } |
| 1153 | #endif |
| 1154 | |
| 1155 | #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER |
kuogee hsieh | 3830eb9 | 2011-09-12 15:25:57 -0700 | [diff] [blame] | 1156 | #define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1157 | #else |
kuogee hsieh | 3830eb9 | 2011-09-12 15:25:57 -0700 | [diff] [blame] | 1158 | #define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1159 | #endif |
| 1160 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1161 | |
| 1162 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
kuogee hsieh | 3830eb9 | 2011-09-12 15:25:57 -0700 | [diff] [blame] | 1163 | #define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1164 | #elif defined(CONFIG_FB_MSM_TVOUT) |
kuogee hsieh | 3830eb9 | 2011-09-12 15:25:57 -0700 | [diff] [blame] | 1165 | #define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */ |
| 1166 | #else |
| 1167 | #define MSM_FB_EXT_BUF_SIZE 0 |
| 1168 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1169 | |
kuogee hsieh | 3830eb9 | 2011-09-12 15:25:57 -0700 | [diff] [blame] | 1170 | #ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK |
| 1171 | /* width x height x 3 bpp x 2 frame buffer */ |
| 1172 | #define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2) |
| 1173 | #define MSM_FB_WRITEBACK_OFFSET \ |
| 1174 | (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE) |
| 1175 | #else |
| 1176 | #define MSM_FB_WRITEBACK_SIZE 0 |
| 1177 | #define MSM_FB_WRITEBACK_OFFSET 0 |
| 1178 | #endif |
| 1179 | |
| 1180 | |
| 1181 | /* Note: must be multiple of 4096 */ |
| 1182 | #define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \ |
| 1183 | MSM_FB_WRITEBACK_SIZE, 4096) |
| 1184 | |
| 1185 | static int writeback_offset(void) |
| 1186 | { |
| 1187 | return MSM_FB_WRITEBACK_OFFSET; |
| 1188 | } |
| 1189 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1190 | |
| 1191 | #define MDP_VSYNC_GPIO 0 |
| 1192 | |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame] | 1193 | #define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga" |
| 1194 | #define TOSHIBA_PANEL_NAME_LEN 24 |
| 1195 | #define CHIMEI_PANEL_NAME "mipi_chimei_wxga" |
| 1196 | #define CHIMEI_PANEL_NAME_LEN 16 |
| 1197 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1198 | static struct resource msm_fb_resources[] = { |
| 1199 | { |
| 1200 | .flags = IORESOURCE_DMA, |
| 1201 | } |
| 1202 | }; |
| 1203 | |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame] | 1204 | #ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT |
| 1205 | static int msm_fb_detect_panel(const char *name) |
| 1206 | { |
| 1207 | if (machine_is_msm8960_liquid()) { |
| 1208 | if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN)) |
| 1209 | return 0; |
| 1210 | } else { |
| 1211 | if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN)) |
| 1212 | return 0; |
| 1213 | } |
| 1214 | |
| 1215 | pr_warning("%s: not supported '%s'", __func__, name); |
| 1216 | |
| 1217 | return -ENODEV; |
| 1218 | } |
| 1219 | |
| 1220 | static struct msm_fb_platform_data msm_fb_pdata = { |
| 1221 | .detect_client = msm_fb_detect_panel, |
| 1222 | }; |
| 1223 | #endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */ |
| 1224 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1225 | static struct platform_device msm_fb_device = { |
| 1226 | .name = "msm_fb", |
| 1227 | .id = 0, |
| 1228 | .num_resources = ARRAY_SIZE(msm_fb_resources), |
| 1229 | .resource = msm_fb_resources, |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame] | 1230 | #ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT |
| 1231 | .dev.platform_data = &msm_fb_pdata, |
| 1232 | #endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1233 | }; |
| 1234 | |
| 1235 | static bool dsi_power_on; |
| 1236 | |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame] | 1237 | /** |
| 1238 | * LiQUID panel on/off |
| 1239 | * |
| 1240 | * @param on |
| 1241 | * |
| 1242 | * @return int |
| 1243 | */ |
| 1244 | static int mipi_dsi_liquid_panel_power(int on) |
| 1245 | { |
| 1246 | static struct regulator *reg_l2, *reg_ext_3p3v; |
| 1247 | static int gpio21, gpio24, gpio43; |
| 1248 | int rc; |
| 1249 | |
| 1250 | pr_info("%s: on=%d\n", __func__, on); |
| 1251 | |
| 1252 | gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */ |
| 1253 | gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/ |
| 1254 | gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */ |
| 1255 | |
| 1256 | if (!dsi_power_on) { |
| 1257 | |
| 1258 | reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 1259 | "dsi_vdda"); |
| 1260 | if (IS_ERR(reg_l2)) { |
| 1261 | pr_err("could not get 8921_l2, rc = %ld\n", |
| 1262 | PTR_ERR(reg_l2)); |
| 1263 | return -ENODEV; |
| 1264 | } |
| 1265 | |
| 1266 | rc = regulator_set_voltage(reg_l2, 1200000, 1200000); |
| 1267 | if (rc) { |
| 1268 | pr_err("set_voltage l2 failed, rc=%d\n", rc); |
| 1269 | return -EINVAL; |
| 1270 | } |
| 1271 | |
| 1272 | reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev, |
| 1273 | "vdd_lvds_3p3v"); |
| 1274 | if (IS_ERR(reg_ext_3p3v)) { |
| 1275 | pr_err("could not get reg_ext_3p3v, rc = %ld\n", |
| 1276 | PTR_ERR(reg_ext_3p3v)); |
| 1277 | return -ENODEV; |
| 1278 | } |
| 1279 | |
| 1280 | rc = gpio_request(gpio21, "disp_pwr_en_n"); |
| 1281 | if (rc) { |
| 1282 | pr_err("request gpio 21 failed, rc=%d\n", rc); |
| 1283 | return -ENODEV; |
| 1284 | } |
| 1285 | |
| 1286 | rc = gpio_request(gpio43, "disp_rst_n"); |
| 1287 | if (rc) { |
| 1288 | pr_err("request gpio 43 failed, rc=%d\n", rc); |
| 1289 | return -ENODEV; |
| 1290 | } |
| 1291 | |
| 1292 | rc = gpio_request(gpio24, "disp_backlight_pwm"); |
| 1293 | if (rc) { |
| 1294 | pr_err("request gpio 24 failed, rc=%d\n", rc); |
| 1295 | return -ENODEV; |
| 1296 | } |
| 1297 | |
| 1298 | dsi_power_on = true; |
| 1299 | } |
| 1300 | |
| 1301 | if (on) { |
| 1302 | rc = regulator_set_optimum_mode(reg_l2, 100000); |
| 1303 | if (rc < 0) { |
| 1304 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 1305 | return -EINVAL; |
| 1306 | } |
| 1307 | rc = regulator_enable(reg_l2); |
| 1308 | if (rc) { |
| 1309 | pr_err("enable l2 failed, rc=%d\n", rc); |
| 1310 | return -ENODEV; |
| 1311 | } |
| 1312 | |
| 1313 | rc = regulator_enable(reg_ext_3p3v); |
| 1314 | if (rc) { |
| 1315 | pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc); |
| 1316 | return -ENODEV; |
| 1317 | } |
| 1318 | |
| 1319 | /* set reset pin before power enable */ |
| 1320 | gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */ |
| 1321 | |
| 1322 | gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */ |
| 1323 | msleep(20); |
| 1324 | gpio_set_value_cansleep(gpio43, 1); /* disp enable */ |
| 1325 | msleep(20); |
| 1326 | gpio_set_value_cansleep(gpio43, 0); /* disp enable */ |
| 1327 | msleep(20); |
| 1328 | gpio_set_value_cansleep(gpio43, 1); /* disp enable */ |
| 1329 | msleep(20); |
| 1330 | } else { |
| 1331 | gpio_set_value_cansleep(gpio43, 0); |
| 1332 | gpio_set_value_cansleep(gpio21, 1); |
| 1333 | |
| 1334 | rc = regulator_disable(reg_l2); |
| 1335 | if (rc) { |
| 1336 | pr_err("disable reg_l2 failed, rc=%d\n", rc); |
| 1337 | return -ENODEV; |
| 1338 | } |
| 1339 | rc = regulator_disable(reg_ext_3p3v); |
| 1340 | if (rc) { |
| 1341 | pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc); |
| 1342 | return -ENODEV; |
| 1343 | } |
| 1344 | rc = regulator_set_optimum_mode(reg_l2, 100); |
| 1345 | if (rc < 0) { |
| 1346 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 1347 | return -EINVAL; |
| 1348 | } |
| 1349 | } |
| 1350 | |
| 1351 | return 0; |
| 1352 | } |
| 1353 | |
| 1354 | static int mipi_dsi_cdp_panel_power(int on) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1355 | { |
| 1356 | static struct regulator *reg_l8, *reg_l23, *reg_l2; |
Nagamalleswararao Ganji | eac5dfa | 2011-07-23 17:31:16 -0700 | [diff] [blame] | 1357 | static int gpio43; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1358 | int rc; |
| 1359 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1360 | pr_info("%s: state : %d\n", __func__, on); |
| 1361 | |
| 1362 | if (!dsi_power_on) { |
| 1363 | |
| 1364 | reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 1365 | "dsi_vdc"); |
| 1366 | if (IS_ERR(reg_l8)) { |
| 1367 | pr_err("could not get 8921_l8, rc = %ld\n", |
| 1368 | PTR_ERR(reg_l8)); |
| 1369 | return -ENODEV; |
| 1370 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1371 | reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 1372 | "dsi_vddio"); |
| 1373 | if (IS_ERR(reg_l23)) { |
| 1374 | pr_err("could not get 8921_l23, rc = %ld\n", |
| 1375 | PTR_ERR(reg_l23)); |
| 1376 | return -ENODEV; |
| 1377 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1378 | reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 1379 | "dsi_vdda"); |
| 1380 | if (IS_ERR(reg_l2)) { |
| 1381 | pr_err("could not get 8921_l2, rc = %ld\n", |
| 1382 | PTR_ERR(reg_l2)); |
| 1383 | return -ENODEV; |
| 1384 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1385 | rc = regulator_set_voltage(reg_l8, 2800000, 3000000); |
| 1386 | if (rc) { |
| 1387 | pr_err("set_voltage l8 failed, rc=%d\n", rc); |
| 1388 | return -EINVAL; |
| 1389 | } |
| 1390 | rc = regulator_set_voltage(reg_l23, 1800000, 1800000); |
| 1391 | if (rc) { |
| 1392 | pr_err("set_voltage l23 failed, rc=%d\n", rc); |
| 1393 | return -EINVAL; |
| 1394 | } |
| 1395 | rc = regulator_set_voltage(reg_l2, 1200000, 1200000); |
| 1396 | if (rc) { |
| 1397 | pr_err("set_voltage l2 failed, rc=%d\n", rc); |
| 1398 | return -EINVAL; |
| 1399 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1400 | gpio43 = PM8921_GPIO_PM_TO_SYS(43); |
| 1401 | rc = gpio_request(gpio43, "disp_rst_n"); |
| 1402 | if (rc) { |
| 1403 | pr_err("request gpio 43 failed, rc=%d\n", rc); |
| 1404 | return -ENODEV; |
| 1405 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1406 | dsi_power_on = true; |
| 1407 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1408 | if (on) { |
| 1409 | rc = regulator_set_optimum_mode(reg_l8, 100000); |
| 1410 | if (rc < 0) { |
| 1411 | pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); |
| 1412 | return -EINVAL; |
| 1413 | } |
| 1414 | rc = regulator_set_optimum_mode(reg_l23, 100000); |
| 1415 | if (rc < 0) { |
| 1416 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 1417 | return -EINVAL; |
| 1418 | } |
| 1419 | rc = regulator_set_optimum_mode(reg_l2, 100000); |
| 1420 | if (rc < 0) { |
| 1421 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 1422 | return -EINVAL; |
| 1423 | } |
| 1424 | rc = regulator_enable(reg_l8); |
| 1425 | if (rc) { |
| 1426 | pr_err("enable l8 failed, rc=%d\n", rc); |
| 1427 | return -ENODEV; |
| 1428 | } |
| 1429 | rc = regulator_enable(reg_l23); |
| 1430 | if (rc) { |
| 1431 | pr_err("enable l8 failed, rc=%d\n", rc); |
| 1432 | return -ENODEV; |
| 1433 | } |
| 1434 | rc = regulator_enable(reg_l2); |
| 1435 | if (rc) { |
| 1436 | pr_err("enable l2 failed, rc=%d\n", rc); |
| 1437 | return -ENODEV; |
| 1438 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1439 | gpio_set_value_cansleep(gpio43, 1); |
| 1440 | } else { |
Nagamalleswararao Ganji | ca0adc0 | 2011-09-22 20:35:53 -0700 | [diff] [blame] | 1441 | rc = regulator_disable(reg_l2); |
| 1442 | if (rc) { |
| 1443 | pr_err("disable reg_l2 failed, rc=%d\n", rc); |
| 1444 | return -ENODEV; |
| 1445 | } |
| 1446 | rc = regulator_disable(reg_l8); |
| 1447 | if (rc) { |
| 1448 | pr_err("disable reg_l8 failed, rc=%d\n", rc); |
| 1449 | return -ENODEV; |
| 1450 | } |
| 1451 | rc = regulator_disable(reg_l23); |
| 1452 | if (rc) { |
| 1453 | pr_err("disable reg_l23 failed, rc=%d\n", rc); |
| 1454 | return -ENODEV; |
| 1455 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1456 | rc = regulator_set_optimum_mode(reg_l8, 100); |
| 1457 | if (rc < 0) { |
| 1458 | pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); |
| 1459 | return -EINVAL; |
| 1460 | } |
| 1461 | rc = regulator_set_optimum_mode(reg_l23, 100); |
| 1462 | if (rc < 0) { |
| 1463 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 1464 | return -EINVAL; |
| 1465 | } |
| 1466 | rc = regulator_set_optimum_mode(reg_l2, 100); |
| 1467 | if (rc < 0) { |
| 1468 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 1469 | return -EINVAL; |
| 1470 | } |
| 1471 | gpio_set_value_cansleep(gpio43, 0); |
| 1472 | } |
| 1473 | return 0; |
| 1474 | } |
| 1475 | |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame] | 1476 | static int mipi_dsi_panel_power(int on) |
| 1477 | { |
| 1478 | int ret; |
| 1479 | |
| 1480 | pr_info("%s: on=%d\n", __func__, on); |
| 1481 | |
| 1482 | if (machine_is_msm8960_liquid()) |
| 1483 | ret = mipi_dsi_liquid_panel_power(on); |
| 1484 | else |
| 1485 | ret = mipi_dsi_cdp_panel_power(on); |
| 1486 | |
| 1487 | return ret; |
| 1488 | } |
| 1489 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1490 | static struct mipi_dsi_platform_data mipi_dsi_pdata = { |
| 1491 | .vsync_gpio = MDP_VSYNC_GPIO, |
| 1492 | .dsi_power_save = mipi_dsi_panel_power, |
| 1493 | }; |
| 1494 | |
| 1495 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1496 | |
| 1497 | static struct msm_bus_vectors mdp_init_vectors[] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1498 | { |
| 1499 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 1500 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1501 | .ab = 0, |
| 1502 | .ib = 0, |
| 1503 | }, |
Ravishangar Kalyanam | 882930f | 2011-07-08 17:51:52 -0700 | [diff] [blame] | 1504 | }; |
| 1505 | |
| 1506 | static struct msm_bus_vectors mdp_ui_vectors[] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1507 | { |
| 1508 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 1509 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
Ravishangar Kalyanam | 882930f | 2011-07-08 17:51:52 -0700 | [diff] [blame] | 1510 | .ab = 216000000 * 2, |
| 1511 | .ib = 270000000 * 2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1512 | }, |
| 1513 | }; |
| 1514 | |
| 1515 | static struct msm_bus_vectors mdp_vga_vectors[] = { |
| 1516 | /* VGA and less video */ |
| 1517 | { |
| 1518 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 1519 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
Ravishangar Kalyanam | 882930f | 2011-07-08 17:51:52 -0700 | [diff] [blame] | 1520 | .ab = 216000000 * 2, |
| 1521 | .ib = 270000000 * 2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1522 | }, |
| 1523 | }; |
| 1524 | |
| 1525 | static struct msm_bus_vectors mdp_720p_vectors[] = { |
| 1526 | /* 720p and less video */ |
| 1527 | { |
| 1528 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 1529 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
Ravishangar Kalyanam | 882930f | 2011-07-08 17:51:52 -0700 | [diff] [blame] | 1530 | .ab = 230400000 * 2, |
| 1531 | .ib = 288000000 * 2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1532 | }, |
| 1533 | }; |
| 1534 | |
| 1535 | static struct msm_bus_vectors mdp_1080p_vectors[] = { |
| 1536 | /* 1080p and less video */ |
| 1537 | { |
| 1538 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 1539 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
Ravishangar Kalyanam | 882930f | 2011-07-08 17:51:52 -0700 | [diff] [blame] | 1540 | .ab = 334080000 * 2, |
| 1541 | .ib = 417600000 * 2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1542 | }, |
| 1543 | }; |
| 1544 | |
| 1545 | static struct msm_bus_paths mdp_bus_scale_usecases[] = { |
| 1546 | { |
| 1547 | ARRAY_SIZE(mdp_init_vectors), |
| 1548 | mdp_init_vectors, |
| 1549 | }, |
| 1550 | { |
Ravishangar Kalyanam | 882930f | 2011-07-08 17:51:52 -0700 | [diff] [blame] | 1551 | ARRAY_SIZE(mdp_ui_vectors), |
| 1552 | mdp_ui_vectors, |
| 1553 | }, |
| 1554 | { |
| 1555 | ARRAY_SIZE(mdp_ui_vectors), |
| 1556 | mdp_ui_vectors, |
| 1557 | }, |
| 1558 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1559 | ARRAY_SIZE(mdp_vga_vectors), |
| 1560 | mdp_vga_vectors, |
| 1561 | }, |
| 1562 | { |
| 1563 | ARRAY_SIZE(mdp_720p_vectors), |
| 1564 | mdp_720p_vectors, |
| 1565 | }, |
| 1566 | { |
| 1567 | ARRAY_SIZE(mdp_1080p_vectors), |
| 1568 | mdp_1080p_vectors, |
| 1569 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1570 | }; |
| 1571 | |
| 1572 | static struct msm_bus_scale_pdata mdp_bus_scale_pdata = { |
| 1573 | mdp_bus_scale_usecases, |
| 1574 | ARRAY_SIZE(mdp_bus_scale_usecases), |
| 1575 | .name = "mdp", |
| 1576 | }; |
| 1577 | |
| 1578 | #endif |
| 1579 | |
| 1580 | int mdp_core_clk_rate_table[] = { |
| 1581 | 85330000, |
| 1582 | 85330000, |
Nagamalleswararao Ganji | ad31c98 | 2011-08-15 23:24:17 -0700 | [diff] [blame] | 1583 | 160000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1584 | 200000000, |
| 1585 | }; |
| 1586 | |
| 1587 | static struct msm_panel_common_pdata mdp_pdata = { |
| 1588 | .gpio = MDP_VSYNC_GPIO, |
| 1589 | .mdp_core_clk_rate = 85330000, |
| 1590 | .mdp_core_clk_table = mdp_core_clk_rate_table, |
| 1591 | .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table), |
| 1592 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1593 | .mdp_bus_scale_table = &mdp_bus_scale_pdata, |
| 1594 | #endif |
| 1595 | .mdp_rev = MDP_REV_42, |
kuogee hsieh | 3830eb9 | 2011-09-12 15:25:57 -0700 | [diff] [blame] | 1596 | .writeback_offset = writeback_offset, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1597 | }; |
| 1598 | |
| 1599 | static struct platform_device mipi_dsi_renesas_panel_device = { |
| 1600 | .name = "mipi_renesas", |
| 1601 | .id = 0, |
| 1602 | }; |
| 1603 | |
| 1604 | static struct platform_device mipi_dsi_simulator_panel_device = { |
| 1605 | .name = "mipi_simulator", |
| 1606 | .id = 0, |
| 1607 | }; |
| 1608 | |
Nagamalleswararao Ganji | eac5dfa | 2011-07-23 17:31:16 -0700 | [diff] [blame] | 1609 | #define LPM_CHANNEL0 0 |
| 1610 | static int toshiba_gpio[] = {LPM_CHANNEL0}; |
| 1611 | |
| 1612 | static struct mipi_dsi_panel_platform_data toshiba_pdata = { |
| 1613 | .gpio = toshiba_gpio, |
| 1614 | }; |
| 1615 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1616 | static struct platform_device mipi_dsi_toshiba_panel_device = { |
| 1617 | .name = "mipi_toshiba", |
| 1618 | .id = 0, |
Nagamalleswararao Ganji | eac5dfa | 2011-07-23 17:31:16 -0700 | [diff] [blame] | 1619 | .dev = { |
| 1620 | .platform_data = &toshiba_pdata, |
| 1621 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1622 | }; |
| 1623 | |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame] | 1624 | static int dsi2lvds_gpio[2] = { |
| 1625 | 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */ |
| 1626 | 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */ |
| 1627 | }; |
| 1628 | |
| 1629 | static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = { |
| 1630 | .gpio_num = dsi2lvds_gpio, |
| 1631 | }; |
| 1632 | |
Chandan Uddaraju | 83eac3c | 2011-09-11 18:32:23 -0700 | [diff] [blame] | 1633 | static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = { |
| 1634 | |
| 1635 | /* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */ |
| 1636 | {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */ |
| 1637 | /* timing */ |
| 1638 | {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c, |
| 1639 | 0x0c, 0x03, 0x04, 0xa0}, |
| 1640 | {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */ |
| 1641 | {0xff, 0x00, 0x06, 0x00}, /* strength */ |
| 1642 | /* pll control */ |
| 1643 | {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62, |
| 1644 | 0x40, 0x07, 0x03, |
| 1645 | 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01}, |
| 1646 | }; |
| 1647 | |
| 1648 | static struct mipi_dsi_panel_platform_data novatek_pdata = { |
| 1649 | .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db, |
| 1650 | }; |
| 1651 | |
| 1652 | static struct platform_device mipi_dsi_novatek_panel_device = { |
| 1653 | .name = "mipi_novatek", |
| 1654 | .id = 0, |
| 1655 | .dev = { |
| 1656 | .platform_data = &novatek_pdata, |
| 1657 | } |
| 1658 | }; |
| 1659 | |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame] | 1660 | static struct platform_device mipi_dsi2lvds_bridge_device = { |
| 1661 | .name = "mipi_tc358764", |
| 1662 | .id = 0, |
| 1663 | .dev.platform_data = &mipi_dsi2lvds_pdata, |
| 1664 | }; |
| 1665 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1666 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 1667 | static struct resource hdmi_msm_resources[] = { |
| 1668 | { |
| 1669 | .name = "hdmi_msm_qfprom_addr", |
| 1670 | .start = 0x00700000, |
| 1671 | .end = 0x007060FF, |
| 1672 | .flags = IORESOURCE_MEM, |
| 1673 | }, |
| 1674 | { |
| 1675 | .name = "hdmi_msm_hdmi_addr", |
| 1676 | .start = 0x04A00000, |
| 1677 | .end = 0x04A00FFF, |
| 1678 | .flags = IORESOURCE_MEM, |
| 1679 | }, |
| 1680 | { |
| 1681 | .name = "hdmi_msm_irq", |
| 1682 | .start = HDMI_IRQ, |
| 1683 | .end = HDMI_IRQ, |
| 1684 | .flags = IORESOURCE_IRQ, |
| 1685 | }, |
| 1686 | }; |
| 1687 | |
| 1688 | static int hdmi_enable_5v(int on); |
| 1689 | static int hdmi_core_power(int on, int show); |
| 1690 | static int hdmi_cec_power(int on); |
| 1691 | |
| 1692 | static struct msm_hdmi_platform_data hdmi_msm_data = { |
| 1693 | .irq = HDMI_IRQ, |
| 1694 | .enable_5v = hdmi_enable_5v, |
| 1695 | .core_power = hdmi_core_power, |
| 1696 | .cec_power = hdmi_cec_power, |
| 1697 | }; |
| 1698 | |
| 1699 | static struct platform_device hdmi_msm_device = { |
| 1700 | .name = "hdmi_msm", |
| 1701 | .id = 0, |
| 1702 | .num_resources = ARRAY_SIZE(hdmi_msm_resources), |
| 1703 | .resource = hdmi_msm_resources, |
| 1704 | .dev.platform_data = &hdmi_msm_data, |
| 1705 | }; |
| 1706 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ |
| 1707 | |
Ravishangar Kalyanam | 882930f | 2011-07-08 17:51:52 -0700 | [diff] [blame] | 1708 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1709 | static struct msm_bus_vectors dtv_bus_init_vectors[] = { |
| 1710 | { |
| 1711 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 1712 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1713 | .ab = 0, |
| 1714 | .ib = 0, |
| 1715 | }, |
| 1716 | }; |
| 1717 | static struct msm_bus_vectors dtv_bus_def_vectors[] = { |
| 1718 | { |
| 1719 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 1720 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1721 | .ab = 566092800 * 2, |
| 1722 | .ib = 707616000 * 2, |
| 1723 | }, |
| 1724 | }; |
| 1725 | static struct msm_bus_paths dtv_bus_scale_usecases[] = { |
| 1726 | { |
| 1727 | ARRAY_SIZE(dtv_bus_init_vectors), |
| 1728 | dtv_bus_init_vectors, |
| 1729 | }, |
| 1730 | { |
| 1731 | ARRAY_SIZE(dtv_bus_def_vectors), |
| 1732 | dtv_bus_def_vectors, |
| 1733 | }, |
| 1734 | }; |
| 1735 | static struct msm_bus_scale_pdata dtv_bus_scale_pdata = { |
| 1736 | dtv_bus_scale_usecases, |
| 1737 | ARRAY_SIZE(dtv_bus_scale_usecases), |
| 1738 | .name = "dtv", |
| 1739 | }; |
| 1740 | |
| 1741 | static struct lcdc_platform_data dtv_pdata = { |
| 1742 | .bus_scale_table = &dtv_bus_scale_pdata, |
| 1743 | }; |
| 1744 | #endif |
| 1745 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1746 | static void __init msm_fb_add_devices(void) |
| 1747 | { |
Amir Samuelov | 0c7270f | 2011-09-07 03:13:47 +0300 | [diff] [blame] | 1748 | struct platform_device *ptr = NULL; |
| 1749 | |
| 1750 | if (machine_is_msm8960_liquid()) |
| 1751 | ptr = &mipi_dsi2lvds_bridge_device; |
| 1752 | else |
| 1753 | ptr = &mipi_dsi_toshiba_panel_device; |
| 1754 | platform_add_devices(&ptr, 1); |
| 1755 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1756 | if (machine_is_msm8x60_rumi3()) { |
| 1757 | msm_fb_register_device("mdp", NULL); |
| 1758 | mipi_dsi_pdata.target_type = 1; |
| 1759 | } else |
| 1760 | msm_fb_register_device("mdp", &mdp_pdata); |
| 1761 | msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata); |
Ravishangar Kalyanam | 882930f | 2011-07-08 17:51:52 -0700 | [diff] [blame] | 1762 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1763 | msm_fb_register_device("dtv", &dtv_pdata); |
| 1764 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1765 | } |
| 1766 | |
Ravishangar Kalyanam | ba99e51 | 2011-07-20 12:57:19 -0700 | [diff] [blame] | 1767 | static struct gpiomux_setting mdp_vsync_suspend_cfg = { |
| 1768 | .func = GPIOMUX_FUNC_GPIO, |
| 1769 | .drv = GPIOMUX_DRV_2MA, |
| 1770 | .pull = GPIOMUX_PULL_DOWN, |
| 1771 | }; |
| 1772 | |
| 1773 | static struct gpiomux_setting mdp_vsync_active_cfg = { |
| 1774 | .func = GPIOMUX_FUNC_1, |
| 1775 | .drv = GPIOMUX_DRV_2MA, |
| 1776 | .pull = GPIOMUX_PULL_DOWN, |
| 1777 | }; |
| 1778 | |
| 1779 | static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = { |
| 1780 | { |
| 1781 | .gpio = MDP_VSYNC_GPIO, |
| 1782 | .settings = { |
| 1783 | [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg, |
| 1784 | [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg, |
| 1785 | }, |
| 1786 | } |
| 1787 | }; |
| 1788 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1789 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 1790 | static struct gpiomux_setting hdmi_suspend_cfg = { |
| 1791 | .func = GPIOMUX_FUNC_GPIO, |
| 1792 | .drv = GPIOMUX_DRV_2MA, |
| 1793 | .pull = GPIOMUX_PULL_DOWN, |
| 1794 | }; |
| 1795 | |
| 1796 | static struct gpiomux_setting hdmi_active_1_cfg = { |
| 1797 | .func = GPIOMUX_FUNC_1, |
| 1798 | .drv = GPIOMUX_DRV_2MA, |
| 1799 | .pull = GPIOMUX_PULL_UP, |
| 1800 | }; |
| 1801 | |
| 1802 | static struct gpiomux_setting hdmi_active_2_cfg = { |
| 1803 | .func = GPIOMUX_FUNC_1, |
| 1804 | .drv = GPIOMUX_DRV_2MA, |
| 1805 | .pull = GPIOMUX_PULL_DOWN, |
| 1806 | }; |
| 1807 | |
| 1808 | static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = { |
| 1809 | { |
| 1810 | .gpio = 99, |
| 1811 | .settings = { |
| 1812 | [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg, |
| 1813 | [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg, |
| 1814 | }, |
| 1815 | }, |
| 1816 | { |
| 1817 | .gpio = 100, |
| 1818 | .settings = { |
| 1819 | [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg, |
| 1820 | [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg, |
| 1821 | }, |
| 1822 | }, |
| 1823 | { |
| 1824 | .gpio = 101, |
| 1825 | .settings = { |
| 1826 | [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg, |
| 1827 | [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg, |
| 1828 | }, |
| 1829 | }, |
| 1830 | { |
| 1831 | .gpio = 102, |
| 1832 | .settings = { |
| 1833 | [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg, |
| 1834 | [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg, |
| 1835 | }, |
| 1836 | }, |
| 1837 | }; |
| 1838 | |
| 1839 | static int hdmi_enable_5v(int on) |
| 1840 | { |
| 1841 | /* TBD: PM8921 regulator instead of 8901 */ |
| 1842 | static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */ |
| 1843 | static int prev_on; |
| 1844 | int rc; |
| 1845 | |
| 1846 | if (on == prev_on) |
| 1847 | return 0; |
| 1848 | |
| 1849 | if (!reg_8921_hdmi_mvs) |
| 1850 | reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev, |
| 1851 | "hdmi_mvs"); |
| 1852 | |
| 1853 | if (on) { |
| 1854 | rc = regulator_enable(reg_8921_hdmi_mvs); |
| 1855 | if (rc) { |
| 1856 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 1857 | "8921_hdmi_mvs", rc); |
| 1858 | return rc; |
| 1859 | } |
| 1860 | pr_debug("%s(on): success\n", __func__); |
| 1861 | } else { |
| 1862 | rc = regulator_disable(reg_8921_hdmi_mvs); |
| 1863 | if (rc) |
| 1864 | pr_warning("'%s' regulator disable failed, rc=%d\n", |
| 1865 | "8921_hdmi_mvs", rc); |
| 1866 | pr_debug("%s(off): success\n", __func__); |
| 1867 | } |
| 1868 | |
| 1869 | prev_on = on; |
| 1870 | |
| 1871 | return 0; |
| 1872 | } |
| 1873 | |
| 1874 | static int hdmi_core_power(int on, int show) |
| 1875 | { |
| 1876 | static struct regulator *reg_8921_l23, *reg_8921_s4; |
| 1877 | static int prev_on; |
| 1878 | int rc; |
| 1879 | |
| 1880 | if (on == prev_on) |
| 1881 | return 0; |
| 1882 | |
| 1883 | /* TBD: PM8921 regulator instead of 8901 */ |
Nagamalleswararao Ganji | ca0adc0 | 2011-09-22 20:35:53 -0700 | [diff] [blame] | 1884 | if (!reg_8921_l23) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1885 | reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd"); |
Nagamalleswararao Ganji | ca0adc0 | 2011-09-22 20:35:53 -0700 | [diff] [blame] | 1886 | if (IS_ERR(reg_8921_l23)) { |
| 1887 | pr_err("could not get reg_8921_l23, rc = %ld\n", |
| 1888 | PTR_ERR(reg_8921_l23)); |
| 1889 | return -ENODEV; |
| 1890 | } |
| 1891 | rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000); |
| 1892 | if (rc) { |
| 1893 | pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc); |
| 1894 | return -EINVAL; |
| 1895 | } |
| 1896 | } |
| 1897 | if (!reg_8921_s4) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1898 | reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc"); |
Nagamalleswararao Ganji | ca0adc0 | 2011-09-22 20:35:53 -0700 | [diff] [blame] | 1899 | if (IS_ERR(reg_8921_s4)) { |
| 1900 | pr_err("could not get reg_8921_s4, rc = %ld\n", |
| 1901 | PTR_ERR(reg_8921_s4)); |
| 1902 | return -ENODEV; |
| 1903 | } |
| 1904 | rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000); |
| 1905 | if (rc) { |
| 1906 | pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc); |
| 1907 | return -EINVAL; |
| 1908 | } |
| 1909 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1910 | |
| 1911 | if (on) { |
| 1912 | rc = regulator_set_optimum_mode(reg_8921_l23, 100000); |
| 1913 | if (rc < 0) { |
| 1914 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 1915 | return -EINVAL; |
| 1916 | } |
Nagamalleswararao Ganji | ca0adc0 | 2011-09-22 20:35:53 -0700 | [diff] [blame] | 1917 | rc = regulator_enable(reg_8921_l23); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1918 | if (rc) { |
| 1919 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 1920 | "hdmi_avdd", rc); |
| 1921 | return rc; |
| 1922 | } |
Nagamalleswararao Ganji | ca0adc0 | 2011-09-22 20:35:53 -0700 | [diff] [blame] | 1923 | rc = regulator_enable(reg_8921_s4); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1924 | if (rc) { |
| 1925 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 1926 | "hdmi_vcc", rc); |
| 1927 | return rc; |
| 1928 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1929 | rc = gpio_request(100, "HDMI_DDC_CLK"); |
| 1930 | if (rc) { |
| 1931 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 1932 | "HDMI_DDC_CLK", 100, rc); |
| 1933 | goto error1; |
| 1934 | } |
| 1935 | rc = gpio_request(101, "HDMI_DDC_DATA"); |
| 1936 | if (rc) { |
| 1937 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 1938 | "HDMI_DDC_DATA", 101, rc); |
| 1939 | goto error2; |
| 1940 | } |
| 1941 | rc = gpio_request(102, "HDMI_HPD"); |
| 1942 | if (rc) { |
| 1943 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 1944 | "HDMI_HPD", 102, rc); |
| 1945 | goto error3; |
| 1946 | } |
| 1947 | pr_debug("%s(on): success\n", __func__); |
| 1948 | } else { |
| 1949 | gpio_free(100); |
| 1950 | gpio_free(101); |
| 1951 | gpio_free(102); |
| 1952 | |
Nagamalleswararao Ganji | ca0adc0 | 2011-09-22 20:35:53 -0700 | [diff] [blame] | 1953 | rc = regulator_disable(reg_8921_l23); |
| 1954 | if (rc) { |
| 1955 | pr_err("disable reg_8921_l23 failed, rc=%d\n", rc); |
| 1956 | return -ENODEV; |
| 1957 | } |
| 1958 | rc = regulator_disable(reg_8921_s4); |
| 1959 | if (rc) { |
| 1960 | pr_err("disable reg_8921_s4 failed, rc=%d\n", rc); |
| 1961 | return -ENODEV; |
| 1962 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1963 | rc = regulator_set_optimum_mode(reg_8921_l23, 100); |
| 1964 | if (rc < 0) { |
| 1965 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 1966 | return -EINVAL; |
| 1967 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1968 | pr_debug("%s(off): success\n", __func__); |
| 1969 | } |
| 1970 | |
| 1971 | prev_on = on; |
| 1972 | |
| 1973 | return 0; |
| 1974 | |
| 1975 | error3: |
| 1976 | gpio_free(101); |
| 1977 | error2: |
| 1978 | gpio_free(100); |
| 1979 | error1: |
| 1980 | regulator_disable(reg_8921_l23); |
Nagamalleswararao Ganji | ca0adc0 | 2011-09-22 20:35:53 -0700 | [diff] [blame] | 1981 | regulator_disable(reg_8921_s4); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1982 | return rc; |
| 1983 | } |
| 1984 | |
| 1985 | static int hdmi_cec_power(int on) |
| 1986 | { |
| 1987 | static int prev_on; |
| 1988 | int rc; |
| 1989 | |
| 1990 | if (on == prev_on) |
| 1991 | return 0; |
| 1992 | |
| 1993 | if (on) { |
| 1994 | rc = gpio_request(99, "HDMI_CEC_VAR"); |
| 1995 | if (rc) { |
| 1996 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 1997 | "HDMI_CEC_VAR", 99, rc); |
| 1998 | goto error; |
| 1999 | } |
| 2000 | pr_debug("%s(on): success\n", __func__); |
| 2001 | } else { |
| 2002 | gpio_free(99); |
| 2003 | pr_debug("%s(off): success\n", __func__); |
| 2004 | } |
| 2005 | |
| 2006 | prev_on = on; |
| 2007 | |
| 2008 | return 0; |
| 2009 | error: |
| 2010 | return rc; |
| 2011 | } |
| 2012 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ |
| 2013 | |
| 2014 | static void __init msm8960_allocate_memory_regions(void) |
| 2015 | { |
| 2016 | void *addr; |
| 2017 | unsigned long size; |
| 2018 | |
| 2019 | size = MSM_FB_SIZE; |
| 2020 | addr = alloc_bootmem_align(size, 0x1000); |
| 2021 | msm_fb_resources[0].start = __pa(addr); |
| 2022 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; |
| 2023 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", |
| 2024 | size, addr, __pa(addr)); |
| 2025 | |
| 2026 | } |
| 2027 | #ifdef CONFIG_WCD9310_CODEC |
| 2028 | |
| 2029 | #define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS) |
| 2030 | |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 2031 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 2032 | * 4 micbiases are used to power various analog and digital |
| 2033 | * microphones operating at 1800 mV. Technically, all micbiases |
| 2034 | * can source from single cfilter since all microphones operate |
| 2035 | * at the same voltage level. The arrangement below is to make |
| 2036 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 2037 | * does not need to be as high as 2.85V. It is choosen for |
| 2038 | * microphone sensitivity purpose. |
| 2039 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2040 | static struct tabla_pdata tabla_platform_data = { |
| 2041 | .slimbus_slave_device = { |
| 2042 | .name = "tabla-slave", |
| 2043 | .e_addr = {0, 0, 0x10, 0, 0x17, 2}, |
| 2044 | }, |
| 2045 | .irq = MSM_GPIO_TO_INT(62), |
| 2046 | .irq_base = TABLA_INTERRUPT_BASE, |
| 2047 | .num_irqs = NR_TABLA_IRQS, |
| 2048 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 2049 | .micbias = { |
| 2050 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 2051 | .cfilt1_mv = 1800, |
| 2052 | .cfilt2_mv = 1800, |
| 2053 | .cfilt3_mv = 1800, |
| 2054 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 2055 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 2056 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 2057 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 2058 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2059 | }; |
| 2060 | |
| 2061 | static struct slim_device msm_slim_tabla = { |
| 2062 | .name = "tabla-slim", |
| 2063 | .e_addr = {0, 1, 0x10, 0, 0x17, 2}, |
| 2064 | .dev = { |
| 2065 | .platform_data = &tabla_platform_data, |
| 2066 | }, |
| 2067 | }; |
| 2068 | #endif |
| 2069 | |
| 2070 | static struct slim_boardinfo msm_slim_devices[] = { |
| 2071 | #ifdef CONFIG_WCD9310_CODEC |
| 2072 | { |
| 2073 | .bus_num = 1, |
| 2074 | .slim_slave = &msm_slim_tabla, |
| 2075 | }, |
| 2076 | #endif |
| 2077 | /* add more slimbus slaves as needed */ |
| 2078 | }; |
| 2079 | |
Yunsen Wang | 5c1a739 | 2011-07-09 19:10:16 -0700 | [diff] [blame] | 2080 | #define MSM_WCNSS_PHYS 0x03000000 |
| 2081 | #define MSM_WCNSS_SIZE 0x280000 |
| 2082 | |
| 2083 | static struct resource resources_wcnss_wlan[] = { |
| 2084 | { |
| 2085 | .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 2086 | .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 2087 | .name = "wcnss_wlanrx_irq", |
| 2088 | .flags = IORESOURCE_IRQ, |
| 2089 | }, |
| 2090 | { |
| 2091 | .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 2092 | .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 2093 | .name = "wcnss_wlantx_irq", |
| 2094 | .flags = IORESOURCE_IRQ, |
| 2095 | }, |
| 2096 | { |
| 2097 | .start = MSM_WCNSS_PHYS, |
| 2098 | .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1, |
| 2099 | .name = "wcnss_mmio", |
| 2100 | .flags = IORESOURCE_MEM, |
| 2101 | }, |
| 2102 | }; |
| 2103 | |
Ankur Nandwani | b0039b0 | 2011-08-09 14:00:45 -0700 | [diff] [blame] | 2104 | static struct qcom_wcnss_opts qcom_wcnss_pdata = { |
| 2105 | .has_48mhz_xo = 1, |
| 2106 | }; |
| 2107 | |
Yunsen Wang | 5c1a739 | 2011-07-09 19:10:16 -0700 | [diff] [blame] | 2108 | static struct platform_device msm_device_wcnss_wlan = { |
| 2109 | .name = "wcnss_wlan", |
| 2110 | .id = 0, |
| 2111 | .num_resources = ARRAY_SIZE(resources_wcnss_wlan), |
| 2112 | .resource = resources_wcnss_wlan, |
Ankur Nandwani | b0039b0 | 2011-08-09 14:00:45 -0700 | [diff] [blame] | 2113 | .dev = {.platform_data = &qcom_wcnss_pdata}, |
Yunsen Wang | 5c1a739 | 2011-07-09 19:10:16 -0700 | [diff] [blame] | 2114 | }; |
| 2115 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2116 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 2117 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 2118 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 2119 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 2120 | |
| 2121 | #define QCE_SIZE 0x10000 |
| 2122 | #define QCE_0_BASE 0x18500000 |
| 2123 | |
| 2124 | #define QCE_HW_KEY_SUPPORT 0 |
| 2125 | #define QCE_SHA_HMAC_SUPPORT 1 |
| 2126 | #define QCE_SHARE_CE_RESOURCE 1 |
| 2127 | #define QCE_CE_SHARED 0 |
| 2128 | |
| 2129 | static struct resource qcrypto_resources[] = { |
| 2130 | [0] = { |
| 2131 | .start = QCE_0_BASE, |
| 2132 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 2133 | .flags = IORESOURCE_MEM, |
| 2134 | }, |
| 2135 | [1] = { |
| 2136 | .name = "crypto_channels", |
| 2137 | .start = DMOV_CE_IN_CHAN, |
| 2138 | .end = DMOV_CE_OUT_CHAN, |
| 2139 | .flags = IORESOURCE_DMA, |
| 2140 | }, |
| 2141 | [2] = { |
| 2142 | .name = "crypto_crci_in", |
| 2143 | .start = DMOV_CE_IN_CRCI, |
| 2144 | .end = DMOV_CE_IN_CRCI, |
| 2145 | .flags = IORESOURCE_DMA, |
| 2146 | }, |
| 2147 | [3] = { |
| 2148 | .name = "crypto_crci_out", |
| 2149 | .start = DMOV_CE_OUT_CRCI, |
| 2150 | .end = DMOV_CE_OUT_CRCI, |
| 2151 | .flags = IORESOURCE_DMA, |
| 2152 | }, |
| 2153 | }; |
| 2154 | |
| 2155 | static struct resource qcedev_resources[] = { |
| 2156 | [0] = { |
| 2157 | .start = QCE_0_BASE, |
| 2158 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 2159 | .flags = IORESOURCE_MEM, |
| 2160 | }, |
| 2161 | [1] = { |
| 2162 | .name = "crypto_channels", |
| 2163 | .start = DMOV_CE_IN_CHAN, |
| 2164 | .end = DMOV_CE_OUT_CHAN, |
| 2165 | .flags = IORESOURCE_DMA, |
| 2166 | }, |
| 2167 | [2] = { |
| 2168 | .name = "crypto_crci_in", |
| 2169 | .start = DMOV_CE_IN_CRCI, |
| 2170 | .end = DMOV_CE_IN_CRCI, |
| 2171 | .flags = IORESOURCE_DMA, |
| 2172 | }, |
| 2173 | [3] = { |
| 2174 | .name = "crypto_crci_out", |
| 2175 | .start = DMOV_CE_OUT_CRCI, |
| 2176 | .end = DMOV_CE_OUT_CRCI, |
| 2177 | .flags = IORESOURCE_DMA, |
| 2178 | }, |
| 2179 | }; |
| 2180 | |
| 2181 | #endif |
| 2182 | |
| 2183 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 2184 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 2185 | |
| 2186 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 2187 | .ce_shared = QCE_CE_SHARED, |
| 2188 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 2189 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 2190 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
| 2191 | }; |
| 2192 | |
| 2193 | static struct platform_device qcrypto_device = { |
| 2194 | .name = "qcrypto", |
| 2195 | .id = 0, |
| 2196 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 2197 | .resource = qcrypto_resources, |
| 2198 | .dev = { |
| 2199 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 2200 | .platform_data = &qcrypto_ce_hw_suppport, |
| 2201 | }, |
| 2202 | }; |
| 2203 | #endif |
| 2204 | |
| 2205 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 2206 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 2207 | |
| 2208 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 2209 | .ce_shared = QCE_CE_SHARED, |
| 2210 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 2211 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 2212 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
| 2213 | }; |
| 2214 | |
| 2215 | static struct platform_device qcedev_device = { |
| 2216 | .name = "qce", |
| 2217 | .id = 0, |
| 2218 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 2219 | .resource = qcedev_resources, |
| 2220 | .dev = { |
| 2221 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 2222 | .platform_data = &qcedev_ce_hw_suppport, |
| 2223 | }, |
| 2224 | }; |
| 2225 | #endif |
| 2226 | |
| 2227 | |
| 2228 | static int __init gpiomux_init(void) |
| 2229 | { |
| 2230 | int rc; |
| 2231 | |
| 2232 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 2233 | if (rc) { |
| 2234 | pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); |
| 2235 | return rc; |
| 2236 | } |
| 2237 | |
Nishant Pandit | 24153d8 | 2011-08-27 16:05:13 +0530 | [diff] [blame] | 2238 | msm_gpiomux_install(msm8960_cam_common_configs, |
| 2239 | ARRAY_SIZE(msm8960_cam_common_configs)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2240 | |
| 2241 | msm_gpiomux_install(msm8960_gpiomux_configs, |
Stepan Moskovchenko | d2a45a8 | 2011-08-09 17:02:57 -0700 | [diff] [blame] | 2242 | ARRAY_SIZE(msm8960_gpiomux_configs)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2243 | |
| 2244 | msm_gpiomux_install(msm8960_gsbi_configs, |
| 2245 | ARRAY_SIZE(msm8960_gsbi_configs)); |
| 2246 | |
| 2247 | msm_gpiomux_install(msm8960_cyts_configs, |
| 2248 | ARRAY_SIZE(msm8960_cyts_configs)); |
| 2249 | |
| 2250 | msm_gpiomux_install(msm8960_slimbus_config, |
| 2251 | ARRAY_SIZE(msm8960_slimbus_config)); |
| 2252 | |
| 2253 | msm_gpiomux_install(msm8960_audio_codec_configs, |
| 2254 | ARRAY_SIZE(msm8960_audio_codec_configs)); |
| 2255 | |
Bhalchandra Gajare | 0e795c4 | 2011-08-15 18:10:30 -0700 | [diff] [blame] | 2256 | msm_gpiomux_install(msm8960_audio_auxpcm_configs, |
| 2257 | ARRAY_SIZE(msm8960_audio_auxpcm_configs)); |
| 2258 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2259 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 2260 | msm_gpiomux_install(msm8960_hdmi_configs, |
| 2261 | ARRAY_SIZE(msm8960_hdmi_configs)); |
| 2262 | #endif |
| 2263 | |
Ravishangar Kalyanam | ba99e51 | 2011-07-20 12:57:19 -0700 | [diff] [blame] | 2264 | msm_gpiomux_install(msm8960_mdp_vsync_configs, |
| 2265 | ARRAY_SIZE(msm8960_mdp_vsync_configs)); |
| 2266 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2267 | msm_gpiomux_install(wcnss_5wire_interface, |
| 2268 | ARRAY_SIZE(wcnss_5wire_interface)); |
| 2269 | |
| 2270 | return 0; |
| 2271 | } |
| 2272 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2273 | #define MSM_SHARED_RAM_PHYS 0x80000000 |
| 2274 | |
| 2275 | static struct pm8921_adc_amux pm8921_adc_channels_data[] = { |
| 2276 | {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 2277 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 2278 | {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 2279 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 2280 | {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1, |
| 2281 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 2282 | {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 2283 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 2284 | {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1, |
| 2285 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 2286 | {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 2287 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2288 | {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2, |
| 2289 | ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM}, |
| 2290 | {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 2291 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 2292 | {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1, |
| 2293 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 2294 | {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 2295 | ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM}, |
| 2296 | {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 2297 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 2298 | {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 2299 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
| 2300 | {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 2301 | ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT}, |
Siddartha Mohanadoss | 77d106e | 2011-09-20 16:25:59 -0700 | [diff] [blame] | 2302 | {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1, |
Siddartha Mohanadoss | b9e4d28 | 2011-09-13 17:50:11 -0700 | [diff] [blame] | 2303 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
| 2304 | {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0, |
| 2305 | ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM}, |
Siddartha Mohanadoss | 77d106e | 2011-09-20 16:25:59 -0700 | [diff] [blame] | 2306 | {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1, |
| 2307 | ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM}, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2308 | }; |
| 2309 | |
| 2310 | static struct pm8921_adc_properties pm8921_adc_data = { |
| 2311 | .adc_vdd_reference = 1800, /* milli-voltage for this adc */ |
| 2312 | .bitresolution = 15, |
| 2313 | .bipolar = 0, |
| 2314 | }; |
| 2315 | |
| 2316 | static struct pm8921_adc_platform_data pm8921_adc_pdata = { |
| 2317 | .adc_channel = pm8921_adc_channels_data, |
Siddartha Mohanadoss | 77d106e | 2011-09-20 16:25:59 -0700 | [diff] [blame] | 2318 | .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2319 | .adc_prop = &pm8921_adc_data, |
Siddartha Mohanadoss | 77d106e | 2011-09-20 16:25:59 -0700 | [diff] [blame] | 2320 | .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2321 | }; |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 2322 | |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2323 | static void __init msm8960_map_io(void) |
| 2324 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2325 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2326 | msm_map_msm8960_io(); |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame^] | 2327 | |
| 2328 | if (socinfo_init() < 0) |
| 2329 | pr_err("socinfo_init() failed!\n"); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2330 | } |
| 2331 | |
| 2332 | static void __init msm8960_init_irq(void) |
| 2333 | { |
| 2334 | unsigned int i; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2335 | |
| 2336 | msm_mpm_irq_extn_init(); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2337 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2338 | (void *)MSM_QGIC_CPU_BASE); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2339 | |
| 2340 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2341 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2342 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2343 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 2344 | mb(); |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 2345 | |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2346 | /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet |
| 2347 | * as they are configured as level, which does not play nice with |
| 2348 | * handle_percpu_irq. |
| 2349 | */ |
| 2350 | for (i = GIC_PPI_START; i < GIC_SPI_START; i++) { |
| 2351 | if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE) |
Thomas Gleixner | 6845664a | 2011-03-24 13:25:22 +0100 | [diff] [blame] | 2352 | irq_set_handler(i, handle_percpu_irq); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2353 | } |
| 2354 | } |
| 2355 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2356 | /* MSM8960 have 5 SDCC controllers */ |
| 2357 | enum sdcc_controllers { |
| 2358 | SDCC1, |
| 2359 | SDCC2, |
| 2360 | SDCC3, |
| 2361 | SDCC4, |
| 2362 | SDCC5, |
| 2363 | MAX_SDCC_CONTROLLER |
| 2364 | }; |
| 2365 | |
| 2366 | /* All SDCC controllers requires VDD/VCC voltage */ |
| 2367 | static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = { |
| 2368 | /* SDCC1 : eMMC card connected */ |
| 2369 | [SDCC1] = { |
| 2370 | .name = "sdc_vdd", |
| 2371 | .set_voltage_sup = 1, |
Subhash Jadavani | 99ba53a | 2011-08-01 16:04:18 +0530 | [diff] [blame] | 2372 | .high_vol_level = 2950000, |
| 2373 | .low_vol_level = 2950000, |
Subhash Jadavani | dd7ef89 | 2011-08-18 16:49:57 +0530 | [diff] [blame] | 2374 | .always_on = 1, |
| 2375 | .lpm_sup = 1, |
| 2376 | .lpm_uA = 9000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2377 | .hpm_uA = 200000, /* 200mA */ |
| 2378 | }, |
| 2379 | /* SDCC3 : External card slot connected */ |
| 2380 | [SDCC3] = { |
| 2381 | .name = "sdc_vdd", |
| 2382 | .set_voltage_sup = 1, |
Subhash Jadavani | 99ba53a | 2011-08-01 16:04:18 +0530 | [diff] [blame] | 2383 | .high_vol_level = 2950000, |
| 2384 | .low_vol_level = 2950000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2385 | .hpm_uA = 600000, /* 600mA */ |
| 2386 | } |
| 2387 | }; |
| 2388 | |
| 2389 | /* Only slots having eMMC card will require VCCQ voltage */ |
| 2390 | static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = { |
| 2391 | /* SDCC1 : eMMC card connected */ |
| 2392 | [SDCC1] = { |
| 2393 | .name = "sdc_vccq", |
| 2394 | .set_voltage_sup = 1, |
| 2395 | .always_on = 1, |
Subhash Jadavani | 99ba53a | 2011-08-01 16:04:18 +0530 | [diff] [blame] | 2396 | .high_vol_level = 1800000, |
| 2397 | .low_vol_level = 1800000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2398 | .hpm_uA = 200000, /* 200mA */ |
| 2399 | } |
| 2400 | }; |
| 2401 | |
| 2402 | /* All SDCC controllers may require voting for VDD PAD voltage */ |
| 2403 | static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = { |
| 2404 | /* SDCC3 : External card slot connected */ |
| 2405 | [SDCC3] = { |
| 2406 | .name = "sdc_vddp", |
| 2407 | .set_voltage_sup = 1, |
Subhash Jadavani | 99ba53a | 2011-08-01 16:04:18 +0530 | [diff] [blame] | 2408 | .high_vol_level = 2950000, |
| 2409 | .low_vol_level = 1850000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2410 | .always_on = 1, |
| 2411 | .lpm_sup = 1, |
| 2412 | /* Max. Active current required is 16 mA */ |
| 2413 | .hpm_uA = 16000, |
| 2414 | /* |
| 2415 | * Sleep current required is ~300 uA. But min. vote can be |
| 2416 | * in terms of mA (min. 1 mA). So let's vote for 2 mA |
| 2417 | * during sleep. |
| 2418 | */ |
| 2419 | .lpm_uA = 2000, |
| 2420 | } |
| 2421 | }; |
| 2422 | |
| 2423 | static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = { |
| 2424 | /* SDCC1 : eMMC card connected */ |
| 2425 | [SDCC1] = { |
| 2426 | .vdd_data = &mmc_vdd_reg_data[SDCC1], |
| 2427 | .vccq_data = &mmc_vccq_reg_data[SDCC1], |
| 2428 | }, |
| 2429 | /* SDCC3 : External card slot connected */ |
| 2430 | [SDCC3] = { |
| 2431 | .vdd_data = &mmc_vdd_reg_data[SDCC3], |
| 2432 | .vddp_data = &mmc_vddp_reg_data[SDCC3], |
| 2433 | } |
| 2434 | }; |
| 2435 | |
| 2436 | /* SDC1 pad data */ |
| 2437 | static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = { |
| 2438 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA}, |
Subhash Jadavani | 87bda5a | 2011-08-30 17:40:44 +0530 | [diff] [blame] | 2439 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA}, |
| 2440 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA} |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2441 | }; |
| 2442 | |
| 2443 | static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = { |
| 2444 | {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA}, |
| 2445 | {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA}, |
| 2446 | {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA} |
| 2447 | }; |
| 2448 | |
| 2449 | static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = { |
Subhash Jadavani | b7b5b8a | 2011-09-13 13:00:40 +0530 | [diff] [blame] | 2450 | {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2451 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP}, |
| 2452 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP} |
| 2453 | }; |
| 2454 | |
| 2455 | static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = { |
Subhash Jadavani | b7b5b8a | 2011-09-13 13:00:40 +0530 | [diff] [blame] | 2456 | {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL}, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2457 | {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN}, |
| 2458 | {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN} |
| 2459 | }; |
| 2460 | |
| 2461 | /* SDC3 pad data */ |
| 2462 | static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = { |
| 2463 | {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA}, |
| 2464 | {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA}, |
| 2465 | {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA} |
| 2466 | }; |
| 2467 | |
| 2468 | static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = { |
| 2469 | {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA}, |
| 2470 | {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA}, |
| 2471 | {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA} |
| 2472 | }; |
| 2473 | |
| 2474 | static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = { |
Subhash Jadavani | b7b5b8a | 2011-09-13 13:00:40 +0530 | [diff] [blame] | 2475 | {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL}, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2476 | {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP}, |
| 2477 | {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP} |
| 2478 | }; |
| 2479 | |
| 2480 | static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = { |
Subhash Jadavani | b7b5b8a | 2011-09-13 13:00:40 +0530 | [diff] [blame] | 2481 | {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL}, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2482 | {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN}, |
| 2483 | {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN} |
| 2484 | }; |
| 2485 | |
| 2486 | struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = { |
| 2487 | [SDCC1] = { |
| 2488 | .on = sdc1_pad_pull_on_cfg, |
| 2489 | .off = sdc1_pad_pull_off_cfg, |
| 2490 | .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg) |
| 2491 | }, |
| 2492 | [SDCC3] = { |
| 2493 | .on = sdc3_pad_pull_on_cfg, |
| 2494 | .off = sdc3_pad_pull_off_cfg, |
| 2495 | .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg) |
| 2496 | }, |
| 2497 | }; |
| 2498 | |
| 2499 | struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = { |
| 2500 | [SDCC1] = { |
| 2501 | .on = sdc1_pad_drv_on_cfg, |
| 2502 | .off = sdc1_pad_drv_off_cfg, |
| 2503 | .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg) |
| 2504 | }, |
| 2505 | [SDCC3] = { |
| 2506 | .on = sdc3_pad_drv_on_cfg, |
| 2507 | .off = sdc3_pad_drv_off_cfg, |
| 2508 | .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg) |
| 2509 | }, |
| 2510 | }; |
| 2511 | |
| 2512 | struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = { |
| 2513 | [SDCC1] = { |
| 2514 | .pull = &mmc_pad_pull_data[SDCC1], |
| 2515 | .drv = &mmc_pad_drv_data[SDCC1] |
| 2516 | }, |
| 2517 | [SDCC3] = { |
| 2518 | .pull = &mmc_pad_pull_data[SDCC3], |
| 2519 | .drv = &mmc_pad_drv_data[SDCC3] |
| 2520 | }, |
| 2521 | }; |
| 2522 | |
| 2523 | struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = { |
| 2524 | [SDCC1] = { |
| 2525 | .pad_data = &mmc_pad_data[SDCC1], |
| 2526 | }, |
| 2527 | [SDCC3] = { |
| 2528 | .pad_data = &mmc_pad_data[SDCC3], |
| 2529 | }, |
| 2530 | }; |
| 2531 | |
| 2532 | static unsigned int sdc1_sup_clk_rates[] = { |
Subhash Jadavani | 0e027b7 | 2011-08-30 17:40:55 +0530 | [diff] [blame] | 2533 | 400000, 24000000, 48000000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2534 | }; |
| 2535 | |
| 2536 | static unsigned int sdc3_sup_clk_rates[] = { |
| 2537 | 400000, 24000000, 48000000, 96000000 |
| 2538 | }; |
| 2539 | |
| 2540 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 2541 | static struct mmc_platform_data msm8960_sdc1_data = { |
| 2542 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 2543 | #ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT |
| 2544 | .mmc_bus_width = MMC_CAP_8_BIT_DATA, |
| 2545 | #else |
| 2546 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 2547 | #endif |
| 2548 | .sup_clk_table = sdc1_sup_clk_rates, |
| 2549 | .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates), |
Subhash Jadavani | b7655b6 | 2011-09-27 19:12:36 +0530 | [diff] [blame] | 2550 | .pclk_src_dfab = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2551 | .nonremovable = 1, |
| 2552 | .sdcc_v4_sup = true, |
| 2553 | .vreg_data = &mmc_slot_vreg_data[SDCC1], |
Subhash Jadavani | 0e027b7 | 2011-08-30 17:40:55 +0530 | [diff] [blame] | 2554 | .pin_data = &mmc_slot_pin_data[SDCC1] |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2555 | }; |
| 2556 | #endif |
| 2557 | |
| 2558 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 2559 | static struct mmc_platform_data msm8960_sdc3_data = { |
| 2560 | .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 2561 | .mmc_bus_width = MMC_CAP_4_BIT_DATA, |
| 2562 | .sup_clk_table = sdc3_sup_clk_rates, |
| 2563 | .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates), |
Subhash Jadavani | b7655b6 | 2011-09-27 19:12:36 +0530 | [diff] [blame] | 2564 | .pclk_src_dfab = 1, |
Subhash Jadavani | b9ef747 | 2011-09-21 18:37:28 +0530 | [diff] [blame] | 2565 | #ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2566 | .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16), |
Subhash Jadavani | b9ef747 | 2011-09-21 18:37:28 +0530 | [diff] [blame] | 2567 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2568 | .sdcc_v4_sup = true, |
| 2569 | .vreg_data = &mmc_slot_vreg_data[SDCC3], |
| 2570 | .pin_data = &mmc_slot_pin_data[SDCC3], |
| 2571 | #ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION |
| 2572 | .status_gpio = PM8921_GPIO_PM_TO_SYS(26), |
| 2573 | .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26), |
| 2574 | .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
| 2575 | #endif |
| 2576 | .xpc_cap = 1, |
| 2577 | .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | |
| 2578 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 | |
Subhash Jadavani | 0e027b7 | 2011-08-30 17:40:55 +0530 | [diff] [blame] | 2579 | MMC_CAP_MAX_CURRENT_600) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2580 | }; |
| 2581 | #endif |
| 2582 | |
| 2583 | static void __init msm8960_init_mmc(void) |
| 2584 | { |
| 2585 | #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT |
| 2586 | /* SDC1 : eMMC card connected */ |
| 2587 | msm_add_sdcc(1, &msm8960_sdc1_data); |
| 2588 | #endif |
| 2589 | #ifdef CONFIG_MMC_MSM_SDC3_SUPPORT |
| 2590 | /* SDC3: External card slot */ |
| 2591 | msm_add_sdcc(3, &msm8960_sdc3_data); |
| 2592 | #endif |
| 2593 | } |
| 2594 | |
| 2595 | static void __init msm8960_init_buses(void) |
| 2596 | { |
| 2597 | #ifdef CONFIG_MSM_BUS_SCALING |
| 2598 | msm_bus_apps_fabric_pdata.rpm_enabled = 1; |
| 2599 | msm_bus_sys_fabric_pdata.rpm_enabled = 1; |
| 2600 | msm_bus_mm_fabric_pdata.rpm_enabled = 1; |
| 2601 | msm_bus_sys_fpb_pdata.rpm_enabled = 1; |
| 2602 | msm_bus_cpss_fpb_pdata.rpm_enabled = 1; |
| 2603 | msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata; |
| 2604 | msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata; |
| 2605 | msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata; |
| 2606 | msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata; |
| 2607 | msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata; |
Gagan Mac | dc1dc14 | 2011-09-16 15:13:35 -0600 | [diff] [blame] | 2608 | msm_bus_rpm_set_mt_mask(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2609 | #endif |
| 2610 | } |
| 2611 | |
| 2612 | static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = { |
| 2613 | .max_clock_speed = 15060000, |
| 2614 | }; |
| 2615 | |
| 2616 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 2617 | static struct msm_otg_platform_data msm_otg_pdata; |
| 2618 | #else |
| 2619 | #define USB_5V_EN 42 |
| 2620 | static void msm_hsusb_vbus_power(bool on) |
| 2621 | { |
| 2622 | int rc; |
| 2623 | static bool vbus_is_on; |
| 2624 | static struct regulator *mvs_otg_switch; |
| 2625 | struct pm_gpio param = { |
| 2626 | .direction = PM_GPIO_DIR_OUT, |
| 2627 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 2628 | .output_value = 1, |
| 2629 | .pull = PM_GPIO_PULL_NO, |
| 2630 | .vin_sel = PM_GPIO_VIN_S4, |
| 2631 | .out_strength = PM_GPIO_STRENGTH_MED, |
| 2632 | .function = PM_GPIO_FUNC_NORMAL, |
| 2633 | }; |
| 2634 | |
| 2635 | if (vbus_is_on == on) |
| 2636 | return; |
| 2637 | |
| 2638 | if (on) { |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 2639 | mvs_otg_switch = regulator_get(&msm8960_device_otg.dev, |
| 2640 | "vbus_otg"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2641 | if (IS_ERR(mvs_otg_switch)) { |
| 2642 | pr_err("Unable to get mvs_otg_switch\n"); |
| 2643 | return; |
| 2644 | } |
| 2645 | |
| 2646 | rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), |
| 2647 | "usb_5v_en"); |
| 2648 | if (rc < 0) { |
| 2649 | pr_err("failed to request usb_5v_en gpio\n"); |
| 2650 | goto put_mvs_otg; |
| 2651 | } |
| 2652 | |
| 2653 | if (regulator_enable(mvs_otg_switch)) { |
| 2654 | pr_err("unable to enable mvs_otg_switch\n"); |
| 2655 | goto free_usb_5v_en; |
| 2656 | } |
| 2657 | |
| 2658 | rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), |
| 2659 | ¶m); |
| 2660 | if (rc < 0) { |
| 2661 | pr_err("failed to configure usb_5v_en gpio\n"); |
| 2662 | goto disable_mvs_otg; |
| 2663 | } |
| 2664 | vbus_is_on = true; |
| 2665 | return; |
| 2666 | } |
| 2667 | disable_mvs_otg: |
| 2668 | regulator_disable(mvs_otg_switch); |
| 2669 | free_usb_5v_en: |
| 2670 | gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN)); |
| 2671 | put_mvs_otg: |
| 2672 | regulator_put(mvs_otg_switch); |
| 2673 | vbus_is_on = false; |
| 2674 | } |
| 2675 | |
| 2676 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 2677 | .mode = USB_OTG, |
| 2678 | .otg_control = OTG_PMIC_CONTROL, |
| 2679 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
| 2680 | .pclk_src_name = "dfab_usb_hs_clk", |
| 2681 | .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE), |
| 2682 | .vbus_power = msm_hsusb_vbus_power, |
Anji jonnala | 4e3e677 | 2011-09-15 18:53:42 +0530 | [diff] [blame] | 2683 | .power_budget = 750, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2684 | }; |
| 2685 | #endif |
| 2686 | |
| 2687 | #define PID_MAGIC_ID 0x71432909 |
| 2688 | #define SERIAL_NUM_MAGIC_ID 0x61945374 |
| 2689 | #define SERIAL_NUMBER_LENGTH 127 |
| 2690 | #define DLOAD_USB_BASE_ADD 0x2A03F0C8 |
| 2691 | |
| 2692 | struct magic_num_struct { |
| 2693 | uint32_t pid; |
| 2694 | uint32_t serial_num; |
| 2695 | }; |
| 2696 | |
| 2697 | struct dload_struct { |
| 2698 | uint32_t reserved1; |
| 2699 | uint32_t reserved2; |
| 2700 | uint32_t reserved3; |
| 2701 | uint16_t reserved4; |
| 2702 | uint16_t pid; |
| 2703 | char serial_number[SERIAL_NUMBER_LENGTH]; |
| 2704 | uint16_t reserved5; |
| 2705 | struct magic_num_struct magic_struct; |
| 2706 | }; |
| 2707 | |
| 2708 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 2709 | { |
| 2710 | struct dload_struct __iomem *dload = 0; |
| 2711 | |
| 2712 | dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); |
| 2713 | if (!dload) { |
| 2714 | pr_err("%s: cannot remap I/O memory region: %08x\n", |
| 2715 | __func__, DLOAD_USB_BASE_ADD); |
| 2716 | return -ENXIO; |
| 2717 | } |
| 2718 | |
| 2719 | pr_debug("%s: dload:%p pid:%x serial_num:%s\n", |
| 2720 | __func__, dload, pid, snum); |
| 2721 | /* update pid */ |
| 2722 | dload->magic_struct.pid = PID_MAGIC_ID; |
| 2723 | dload->pid = pid; |
| 2724 | |
| 2725 | /* update serial number */ |
| 2726 | dload->magic_struct.serial_num = 0; |
| 2727 | if (!snum) { |
| 2728 | memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH); |
| 2729 | goto out; |
| 2730 | } |
| 2731 | |
| 2732 | dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; |
| 2733 | strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); |
| 2734 | dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0'; |
| 2735 | out: |
| 2736 | iounmap(dload); |
| 2737 | return 0; |
| 2738 | } |
| 2739 | |
| 2740 | static struct android_usb_platform_data android_usb_pdata = { |
| 2741 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 2742 | }; |
| 2743 | |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 2744 | static struct platform_device android_usb_device = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2745 | .name = "android_usb", |
| 2746 | .id = -1, |
| 2747 | .dev = { |
| 2748 | .platform_data = &android_usb_pdata, |
| 2749 | }, |
| 2750 | }; |
| 2751 | |
| 2752 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { |
| 2753 | 0x03, 0x0f, |
| 2754 | }; |
| 2755 | |
| 2756 | static uint8_t spm_power_collapse_without_rpm[] __initdata = { |
| 2757 | 0x00, 0x24, 0x54, 0x10, |
| 2758 | 0x09, 0x03, 0x01, |
| 2759 | 0x10, 0x54, 0x30, 0x0C, |
| 2760 | 0x24, 0x30, 0x0f, |
| 2761 | }; |
| 2762 | |
| 2763 | static uint8_t spm_power_collapse_with_rpm[] __initdata = { |
| 2764 | 0x00, 0x24, 0x54, 0x10, |
| 2765 | 0x09, 0x07, 0x01, 0x0B, |
| 2766 | 0x10, 0x54, 0x30, 0x0C, |
| 2767 | 0x24, 0x30, 0x0f, |
| 2768 | }; |
| 2769 | |
| 2770 | static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { |
| 2771 | [0] = { |
| 2772 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 2773 | .notify_rpm = false, |
| 2774 | .cmd = spm_wfi_cmd_sequence, |
| 2775 | }, |
| 2776 | [1] = { |
| 2777 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 2778 | .notify_rpm = false, |
| 2779 | .cmd = spm_power_collapse_without_rpm, |
| 2780 | }, |
| 2781 | [2] = { |
| 2782 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 2783 | .notify_rpm = true, |
| 2784 | .cmd = spm_power_collapse_with_rpm, |
| 2785 | }, |
| 2786 | }; |
| 2787 | |
| 2788 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 2789 | [0] = { |
| 2790 | .reg_base_addr = MSM_SAW0_BASE, |
| 2791 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 2792 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
| 2793 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C, |
| 2794 | #if defined(CONFIG_MSM_AVS_HW) |
| 2795 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 2796 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 2797 | #endif |
| 2798 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 2799 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 2800 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 2801 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 2802 | .vctl_timeout_us = 50, |
| 2803 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 2804 | .modes = msm_spm_seq_list, |
| 2805 | }, |
| 2806 | [1] = { |
| 2807 | .reg_base_addr = MSM_SAW1_BASE, |
| 2808 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 2809 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
| 2810 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C, |
| 2811 | #if defined(CONFIG_MSM_AVS_HW) |
| 2812 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 2813 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 2814 | #endif |
| 2815 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 2816 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 2817 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 2818 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 2819 | .vctl_timeout_us = 50, |
| 2820 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 2821 | .modes = msm_spm_seq_list, |
| 2822 | }, |
| 2823 | }; |
| 2824 | |
| 2825 | static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = { |
| 2826 | 0x00, 0x20, 0x03, 0x20, |
| 2827 | 0x00, 0x0f, |
| 2828 | }; |
| 2829 | |
| 2830 | static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = { |
| 2831 | 0x00, 0x20, 0x34, 0x64, |
| 2832 | 0x48, 0x07, 0x48, 0x20, |
| 2833 | 0x50, 0x64, 0x04, 0x34, |
| 2834 | 0x50, 0x0f, |
| 2835 | }; |
| 2836 | static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = { |
| 2837 | 0x00, 0x10, 0x34, 0x64, |
| 2838 | 0x48, 0x07, 0x48, 0x10, |
| 2839 | 0x50, 0x64, 0x04, 0x34, |
| 2840 | 0x50, 0x0F, |
| 2841 | }; |
| 2842 | |
| 2843 | static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = { |
| 2844 | [0] = { |
| 2845 | .mode = MSM_SPM_L2_MODE_RETENTION, |
| 2846 | .notify_rpm = false, |
| 2847 | .cmd = l2_spm_wfi_cmd_sequence, |
| 2848 | }, |
| 2849 | [1] = { |
| 2850 | .mode = MSM_SPM_L2_MODE_GDHS, |
| 2851 | .notify_rpm = true, |
| 2852 | .cmd = l2_spm_gdhs_cmd_sequence, |
| 2853 | }, |
| 2854 | [2] = { |
| 2855 | .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE, |
| 2856 | .notify_rpm = true, |
| 2857 | .cmd = l2_spm_power_off_cmd_sequence, |
| 2858 | }, |
| 2859 | }; |
| 2860 | |
| 2861 | |
| 2862 | static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = { |
| 2863 | [0] = { |
| 2864 | .reg_base_addr = MSM_SAW_L2_BASE, |
| 2865 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 2866 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00, |
| 2867 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 2868 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE, |
| 2869 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020, |
| 2870 | .modes = msm_spm_l2_seq_list, |
| 2871 | .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list), |
| 2872 | }, |
| 2873 | }; |
| 2874 | |
| 2875 | #define CYTTSP_TS_GPIO_IRQ 11 |
| 2876 | #define CYTTSP_TS_SLEEP_GPIO 50 |
| 2877 | #define CYTTSP_TS_RESOUT_N_GPIO 52 |
| 2878 | |
| 2879 | /*virtual key support */ |
| 2880 | static ssize_t tma340_vkeys_show(struct kobject *kobj, |
| 2881 | struct kobj_attribute *attr, char *buf) |
| 2882 | { |
| 2883 | return snprintf(buf, 200, |
| 2884 | __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97" |
| 2885 | ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97" |
| 2886 | ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97" |
| 2887 | ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97" |
| 2888 | "\n"); |
| 2889 | } |
| 2890 | |
| 2891 | static struct kobj_attribute tma340_vkeys_attr = { |
| 2892 | .attr = { |
| 2893 | .mode = S_IRUGO, |
| 2894 | }, |
| 2895 | .show = &tma340_vkeys_show, |
| 2896 | }; |
| 2897 | |
| 2898 | static struct attribute *tma340_properties_attrs[] = { |
| 2899 | &tma340_vkeys_attr.attr, |
| 2900 | NULL |
| 2901 | }; |
| 2902 | |
| 2903 | static struct attribute_group tma340_properties_attr_group = { |
| 2904 | .attrs = tma340_properties_attrs, |
| 2905 | }; |
| 2906 | |
| 2907 | |
| 2908 | static int cyttsp_platform_init(struct i2c_client *client) |
| 2909 | { |
| 2910 | int rc = 0; |
| 2911 | static struct kobject *tma340_properties_kobj; |
| 2912 | |
| 2913 | tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c"; |
| 2914 | tma340_properties_kobj = kobject_create_and_add("board_properties", |
| 2915 | NULL); |
| 2916 | if (tma340_properties_kobj) |
| 2917 | rc = sysfs_create_group(tma340_properties_kobj, |
| 2918 | &tma340_properties_attr_group); |
| 2919 | if (!tma340_properties_kobj || rc) |
| 2920 | pr_err("%s: failed to create board_properties\n", |
| 2921 | __func__); |
| 2922 | |
| 2923 | return 0; |
| 2924 | } |
| 2925 | |
| 2926 | static struct cyttsp_regulator regulator_data[] = { |
| 2927 | { |
| 2928 | .name = "vdd", |
| 2929 | .min_uV = CY_TMA300_VTG_MIN_UV, |
| 2930 | .max_uV = CY_TMA300_VTG_MAX_UV, |
| 2931 | .load_uA = CY_TMA300_CURR_24HZ_UA, |
| 2932 | }, |
| 2933 | /* TODO: Remove after runtime PM is enabled in I2C driver */ |
| 2934 | { |
| 2935 | .name = "vcc_i2c", |
| 2936 | .min_uV = CY_I2C_VTG_MIN_UV, |
| 2937 | .max_uV = CY_I2C_VTG_MAX_UV, |
| 2938 | .load_uA = CY_I2C_CURR_UA, |
| 2939 | }, |
| 2940 | }; |
| 2941 | |
| 2942 | static struct cyttsp_platform_data cyttsp_pdata = { |
| 2943 | .panel_maxx = 634, |
| 2944 | .panel_maxy = 1166, |
| 2945 | .disp_maxx = 616, |
| 2946 | .disp_maxy = 1023, |
| 2947 | .disp_minx = 0, |
| 2948 | .disp_miny = 16, |
| 2949 | .flags = 0x01, |
| 2950 | .gen = CY_GEN3, /* or */ |
| 2951 | .use_st = CY_USE_ST, |
| 2952 | .use_mt = CY_USE_MT, |
| 2953 | .use_hndshk = CY_SEND_HNDSHK, |
| 2954 | .use_trk_id = CY_USE_TRACKING_ID, |
Anirudh Ghayal | e96f66d | 2011-08-11 14:06:38 +0530 | [diff] [blame] | 2955 | .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2956 | .use_gestures = CY_USE_GESTURES, |
| 2957 | .fw_fname = "cyttsp_8960_cdp.hex", |
| 2958 | /* activate up to 4 groups |
| 2959 | * and set active distance |
| 2960 | */ |
| 2961 | .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 | |
| 2962 | CY_GEST_GRP3 | CY_GEST_GRP4 | |
| 2963 | CY_ACT_DIST, |
| 2964 | /* change act_intrvl to customize the Active power state |
| 2965 | * scanning/processing refresh interval for Operating mode |
| 2966 | */ |
| 2967 | .act_intrvl = CY_ACT_INTRVL_DFLT, |
| 2968 | /* change tch_tmout to customize the touch timeout for the |
| 2969 | * Active power state for Operating mode |
| 2970 | */ |
| 2971 | .tch_tmout = CY_TCH_TMOUT_DFLT, |
| 2972 | /* change lp_intrvl to customize the Low Power power state |
| 2973 | * scanning/processing refresh interval for Operating mode |
| 2974 | */ |
| 2975 | .lp_intrvl = CY_LP_INTRVL_DFLT, |
| 2976 | .sleep_gpio = CYTTSP_TS_SLEEP_GPIO, |
| 2977 | .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO, |
| 2978 | .irq_gpio = CYTTSP_TS_GPIO_IRQ, |
| 2979 | .regulator_info = regulator_data, |
| 2980 | .num_regulators = ARRAY_SIZE(regulator_data), |
| 2981 | .init = cyttsp_platform_init, |
Mohan Pallaka | 49c37d6 | 2011-08-01 11:52:00 +0530 | [diff] [blame] | 2982 | .correct_fw_ver = 9, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2983 | }; |
| 2984 | |
| 2985 | static struct i2c_board_info cyttsp_info[] __initdata = { |
| 2986 | { |
| 2987 | I2C_BOARD_INFO(CY_I2C_NAME, 0x24), |
| 2988 | .platform_data = &cyttsp_pdata, |
| 2989 | #ifndef CY_USE_TIMER |
| 2990 | .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ), |
| 2991 | #endif /* CY_USE_TIMER */ |
| 2992 | }, |
| 2993 | }; |
| 2994 | |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 2995 | /* configuration data */ |
| 2996 | static const u8 mxt_config_data[] = { |
| 2997 | /* T6 Object */ |
| 2998 | 0, 0, 0, 0, 0, 0, |
| 2999 | /* T38 Object */ |
| 3000 | 11, 0, 0, 6, 9, 11, 0, 0, 0, 0, |
| 3001 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 3002 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 3003 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 3004 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 3005 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 3006 | 0, 0, 0, 0, |
| 3007 | /* T7 Object */ |
| 3008 | 10, 10, 50, |
| 3009 | /* T8 Object */ |
| 3010 | 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 3011 | /* T9 Object */ |
| 3012 | 131, 0, 0, 26, 42, 0, 32, 60, 2, 5, |
| 3013 | 0, 5, 5, 34, 10, 10, 10, 10, 85, 5, |
| 3014 | 255, 2, 8, 9, 9, 9, 0, 0, 5, 20, |
| 3015 | 0, 5, 45, 46, |
| 3016 | /* T15 Object */ |
| 3017 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 3018 | 0, |
| 3019 | /* T22 Object */ |
| 3020 | 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, |
| 3021 | 0, 0, 255, 255, 255, 255, 0, |
| 3022 | /* T24 Object */ |
| 3023 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 3024 | 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 3025 | /* T25 Object */ |
| 3026 | 3, 0, 188, 52, 52, 33, 0, 0, 0, 0, |
| 3027 | 0, 0, 0, 0, |
| 3028 | /* T27 Object */ |
| 3029 | 0, 0, 0, 0, 0, 0, 0, |
| 3030 | /* T28 Object */ |
| 3031 | 0, 0, 0, 8, 8, 8, |
| 3032 | /* T40 Object */ |
| 3033 | 0, 0, 0, 0, 0, |
| 3034 | /* T41 Object */ |
| 3035 | 0, 0, 0, 0, 0, 0, |
| 3036 | /* T43 Object */ |
| 3037 | 0, 0, 0, 0, 0, 0, |
| 3038 | }; |
| 3039 | |
| 3040 | #define MXT_TS_GPIO_IRQ 11 |
| 3041 | #define MXT_TS_LDO_EN_GPIO 50 |
| 3042 | #define MXT_TS_RESET_GPIO 52 |
| 3043 | |
| 3044 | static void mxt_init_hw_liquid(void) |
| 3045 | { |
| 3046 | int rc; |
| 3047 | |
| 3048 | rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio"); |
| 3049 | if (rc) { |
| 3050 | pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n", |
| 3051 | __func__, MXT_TS_GPIO_IRQ); |
| 3052 | return; |
| 3053 | } |
| 3054 | |
| 3055 | rc = gpio_direction_input(MXT_TS_GPIO_IRQ); |
| 3056 | if (rc) { |
| 3057 | pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n", |
| 3058 | __func__, MXT_TS_GPIO_IRQ); |
| 3059 | goto err_irq_gpio_req; |
| 3060 | } |
| 3061 | |
| 3062 | rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio"); |
| 3063 | if (rc) { |
| 3064 | pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n", |
| 3065 | __func__, MXT_TS_LDO_EN_GPIO); |
| 3066 | goto err_irq_gpio_req; |
| 3067 | } |
| 3068 | |
| 3069 | rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1); |
| 3070 | if (rc) { |
| 3071 | pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n", |
| 3072 | __func__, MXT_TS_LDO_EN_GPIO); |
| 3073 | goto err_ldo_gpio_req; |
| 3074 | } |
| 3075 | |
| 3076 | rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio"); |
| 3077 | if (rc) { |
| 3078 | pr_err("%s: unable to request mxt_reset gpio [%d]\n", |
| 3079 | __func__, MXT_TS_RESET_GPIO); |
| 3080 | goto err_ldo_gpio_set_dir; |
| 3081 | } |
| 3082 | |
| 3083 | rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1); |
| 3084 | if (rc) { |
| 3085 | pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n", |
| 3086 | __func__, MXT_TS_RESET_GPIO); |
| 3087 | goto err_reset_gpio_req; |
| 3088 | } |
| 3089 | |
| 3090 | return; |
| 3091 | |
| 3092 | err_reset_gpio_req: |
| 3093 | gpio_free(MXT_TS_RESET_GPIO); |
| 3094 | err_ldo_gpio_set_dir: |
| 3095 | gpio_set_value(MXT_TS_LDO_EN_GPIO, 0); |
| 3096 | err_ldo_gpio_req: |
| 3097 | gpio_free(MXT_TS_LDO_EN_GPIO); |
| 3098 | err_irq_gpio_req: |
| 3099 | gpio_free(MXT_TS_GPIO_IRQ); |
| 3100 | } |
| 3101 | |
| 3102 | static struct mxt_platform_data mxt_platform_data = { |
| 3103 | .config = mxt_config_data, |
| 3104 | .config_length = ARRAY_SIZE(mxt_config_data), |
| 3105 | .x_line = 26, |
| 3106 | .y_line = 42, |
| 3107 | .x_size = 767, |
| 3108 | .y_size = 1365, |
| 3109 | .blen = 32, |
| 3110 | .threshold = 40, |
| 3111 | .voltage = 3300000, /* 3.3V */ |
| 3112 | .orient = MXT_ROTATED_90, |
| 3113 | .irqflags = IRQF_TRIGGER_FALLING, |
| 3114 | }; |
| 3115 | |
| 3116 | static struct i2c_board_info mxt_device_info[] __initdata = { |
| 3117 | { |
| 3118 | I2C_BOARD_INFO("atmel_mxt_ts", 0x5b), |
| 3119 | .platform_data = &mxt_platform_data, |
| 3120 | .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ), |
| 3121 | }, |
| 3122 | }; |
| 3123 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3124 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 3125 | { |
| 3126 | } |
| 3127 | |
| 3128 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = { |
| 3129 | .clk_freq = 100000, |
| 3130 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3131 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 3132 | }; |
| 3133 | |
| 3134 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = { |
| 3135 | .clk_freq = 100000, |
| 3136 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3137 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 3138 | }; |
| 3139 | |
| 3140 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = { |
| 3141 | .clk_freq = 100000, |
| 3142 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3143 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 3144 | }; |
| 3145 | |
| 3146 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = { |
| 3147 | .clk_freq = 100000, |
| 3148 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3149 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 3150 | }; |
| 3151 | |
| 3152 | static struct msm_rpm_platform_data msm_rpm_data = { |
| 3153 | .reg_base_addrs = { |
| 3154 | [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE, |
| 3155 | [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400, |
| 3156 | [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600, |
| 3157 | [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00, |
| 3158 | }, |
| 3159 | |
| 3160 | .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ, |
| 3161 | .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ, |
| 3162 | .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
| 3163 | .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008, |
| 3164 | .msm_apps_ipc_rpm_val = 4, |
| 3165 | }; |
| 3166 | |
Praveen Chidambaram | 043f4ce | 2011-08-02 09:37:59 -0600 | [diff] [blame] | 3167 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3168 | static struct spi_board_info spi_board_info[] __initdata = { |
| 3169 | { |
| 3170 | .modalias = "ks8851", |
| 3171 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 3172 | .max_speed_hz = 19200000, |
| 3173 | .bus_num = 0, |
| 3174 | .chip_select = 0, |
| 3175 | .mode = SPI_MODE_0, |
| 3176 | }, |
| 3177 | }; |
| 3178 | |
| 3179 | static struct platform_device msm_device_saw_core0 = { |
| 3180 | .name = "saw-regulator", |
| 3181 | .id = 0, |
| 3182 | .dev = { |
| 3183 | .platform_data = &msm_saw_regulator_pdata_s5, |
| 3184 | }, |
| 3185 | }; |
| 3186 | |
| 3187 | static struct platform_device msm_device_saw_core1 = { |
| 3188 | .name = "saw-regulator", |
| 3189 | .id = 1, |
| 3190 | .dev = { |
| 3191 | .platform_data = &msm_saw_regulator_pdata_s6, |
| 3192 | }, |
| 3193 | }; |
| 3194 | |
Siddartha Mohanadoss | ba21fdd | 2011-08-18 10:05:27 -0700 | [diff] [blame] | 3195 | static struct tsens_platform_data msm_tsens_pdata = { |
| 3196 | .slope = 910, |
| 3197 | .tsens_factor = 1000, |
| 3198 | .hw_type = MSM_8960, |
| 3199 | .tsens_num_sensor = 5, |
| 3200 | }; |
| 3201 | |
| 3202 | static struct platform_device msm_tsens_device = { |
| 3203 | .name = "tsens8960-tm", |
| 3204 | .id = -1, |
| 3205 | .dev = { |
| 3206 | .platform_data = &msm_tsens_pdata, |
| 3207 | }, |
| 3208 | }; |
| 3209 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3210 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 3211 | static struct platform_device fish_battery_device = { |
| 3212 | .name = "fish_battery", |
| 3213 | }; |
| 3214 | #endif |
| 3215 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 3216 | static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3217 | .name = GPIO_REGULATOR_DEV_NAME, |
| 3218 | .id = PM8921_MPP_PM_TO_SYS(7), |
| 3219 | .dev = { |
| 3220 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V], |
| 3221 | }, |
| 3222 | }; |
| 3223 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 3224 | static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3225 | .name = GPIO_REGULATOR_DEV_NAME, |
| 3226 | .id = 91, |
| 3227 | .dev = { |
| 3228 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2], |
| 3229 | }, |
| 3230 | }; |
| 3231 | |
David Collins | b10be1d | 2011-09-02 10:29:31 -0700 | [diff] [blame] | 3232 | static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = { |
| 3233 | .name = GPIO_REGULATOR_DEV_NAME, |
| 3234 | .id = PM8921_GPIO_PM_TO_SYS(17), |
| 3235 | .dev = { |
| 3236 | .platform_data = |
| 3237 | &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V], |
| 3238 | }, |
| 3239 | }; |
| 3240 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 3241 | static struct platform_device msm8960_device_rpm_regulator __devinitdata = { |
| 3242 | .name = "rpm-regulator", |
| 3243 | .id = -1, |
| 3244 | .dev = { |
| 3245 | .platform_data = &msm_rpm_regulator_pdata, |
| 3246 | }, |
| 3247 | }; |
| 3248 | |
David Collins | 4c31a87 | 2011-08-31 10:07:10 -0700 | [diff] [blame] | 3249 | static struct msm_rpm_log_platform_data msm_rpm_log_pdata = { |
| 3250 | .phys_addr_base = 0x0010C000, |
| 3251 | .reg_offsets = { |
| 3252 | [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080, |
| 3253 | [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0, |
| 3254 | }, |
| 3255 | .phys_size = SZ_8K, |
| 3256 | .log_len = 4096, /* log's buffer length in bytes */ |
| 3257 | .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */ |
| 3258 | }; |
| 3259 | |
| 3260 | static struct platform_device msm_rpm_log_device = { |
| 3261 | .name = "msm_rpm_log", |
| 3262 | .id = -1, |
| 3263 | .dev = { |
| 3264 | .platform_data = &msm_rpm_log_pdata, |
| 3265 | }, |
| 3266 | }; |
| 3267 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3268 | static struct platform_device *common_devices[] __initdata = { |
Stepan Moskovchenko | df13d34 | 2011-08-03 19:01:25 -0700 | [diff] [blame] | 3269 | &msm8960_device_dmov, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3270 | &msm_device_smd, |
| 3271 | &msm8960_device_uart_gsbi5, |
Mayank Rana | 9f51f58 | 2011-08-04 18:35:59 +0530 | [diff] [blame] | 3272 | &msm_device_uart_dm6, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3273 | &msm_device_saw_core0, |
| 3274 | &msm_device_saw_core1, |
| 3275 | &msm8960_device_ext_5v_vreg, |
| 3276 | &msm8960_device_ext_l2_vreg, |
| 3277 | &msm8960_device_ssbi_pm8921, |
| 3278 | &msm8960_device_qup_spi_gsbi1, |
| 3279 | &msm8960_device_qup_i2c_gsbi3, |
| 3280 | &msm8960_device_qup_i2c_gsbi4, |
| 3281 | &msm8960_device_qup_i2c_gsbi10, |
| 3282 | #ifndef CONFIG_MSM_DSPS |
| 3283 | &msm8960_device_qup_i2c_gsbi12, |
| 3284 | #endif |
| 3285 | &msm_slim_ctrl, |
| 3286 | &msm_device_wcnss_wlan, |
| 3287 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 3288 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 3289 | &qcrypto_device, |
| 3290 | #endif |
| 3291 | |
| 3292 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 3293 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 3294 | &qcedev_device, |
| 3295 | #endif |
| 3296 | #ifdef CONFIG_MSM_ROTATOR |
| 3297 | &msm_rotator_device, |
| 3298 | #endif |
| 3299 | &msm_device_sps, |
| 3300 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 3301 | &fish_battery_device, |
| 3302 | #endif |
| 3303 | #ifdef CONFIG_ANDROID_PMEM |
| 3304 | &android_pmem_device, |
| 3305 | &android_pmem_adsp_device, |
| 3306 | &android_pmem_audio_device, |
| 3307 | #endif |
| 3308 | &msm_fb_device, |
| 3309 | &msm_device_vidc, |
| 3310 | &msm_device_bam_dmux, |
| 3311 | &msm_fm_platform_init, |
Mona Hossain | 9c430e3 | 2011-07-27 11:04:47 -0700 | [diff] [blame] | 3312 | |
| 3313 | #ifdef CONFIG_HW_RANDOM_MSM |
| 3314 | &msm_device_rng, |
| 3315 | #endif |
Praveen Chidambaram | 043f4ce | 2011-08-02 09:37:59 -0600 | [diff] [blame] | 3316 | &msm_rpm_device, |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 3317 | #ifdef CONFIG_ION_MSM |
| 3318 | &ion_dev, |
| 3319 | #endif |
David Collins | 4c31a87 | 2011-08-31 10:07:10 -0700 | [diff] [blame] | 3320 | &msm_rpm_log_device, |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 3321 | #ifdef CONFIG_MSM_QDSS |
| 3322 | &msm_etb_device, |
| 3323 | &msm_tpiu_device, |
| 3324 | &msm_funnel_device, |
| 3325 | &msm_ptm_device, |
| 3326 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3327 | }; |
| 3328 | |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 3329 | static struct platform_device *sim_devices[] __initdata = { |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 3330 | &msm8960_device_otg, |
| 3331 | &msm8960_device_gadget_peripheral, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3332 | &msm_device_hsusb_host, |
Vijayavardhan Vennapusa | eb56648 | 2011-09-18 07:48:37 +0530 | [diff] [blame] | 3333 | &msm_device_hsic_host, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3334 | &android_usb_device, |
| 3335 | &msm_device_vidc, |
| 3336 | &mipi_dsi_simulator_panel_device, |
| 3337 | &msm_bus_apps_fabric, |
| 3338 | &msm_bus_sys_fabric, |
| 3339 | &msm_bus_mm_fabric, |
| 3340 | &msm_bus_sys_fpb, |
| 3341 | &msm_bus_cpss_fpb, |
| 3342 | &msm_pcm, |
| 3343 | &msm_pcm_routing, |
| 3344 | &msm_cpudai0, |
| 3345 | &msm_cpudai1, |
| 3346 | &msm_cpudai_hdmi_rx, |
| 3347 | &msm_cpudai_bt_rx, |
| 3348 | &msm_cpudai_bt_tx, |
| 3349 | &msm_cpudai_fm_rx, |
| 3350 | &msm_cpudai_fm_tx, |
Bhalchandra Gajare | 0e795c4 | 2011-08-15 18:10:30 -0700 | [diff] [blame] | 3351 | &msm_cpudai_auxpcm_rx, |
| 3352 | &msm_cpudai_auxpcm_tx, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3353 | &msm_cpu_fe, |
| 3354 | &msm_stub_codec, |
| 3355 | &msm_voice, |
| 3356 | &msm_voip, |
| 3357 | &msm_lpa_pcm, |
| 3358 | |
| 3359 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 3360 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 3361 | &qcrypto_device, |
| 3362 | #endif |
| 3363 | |
| 3364 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 3365 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 3366 | &qcedev_device, |
| 3367 | #endif |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 3368 | }; |
| 3369 | |
| 3370 | static struct platform_device *rumi3_devices[] __initdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3371 | &msm_kgsl_3d0, |
| 3372 | &msm_kgsl_2d0, |
| 3373 | &msm_kgsl_2d1, |
| 3374 | &mipi_dsi_renesas_panel_device, |
| 3375 | #ifdef CONFIG_MSM_GEMINI |
| 3376 | &msm8960_gemini_device, |
| 3377 | #endif |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 3378 | }; |
| 3379 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3380 | static struct platform_device *cdp_devices[] __initdata = { |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 3381 | &msm8960_device_otg, |
| 3382 | &msm8960_device_gadget_peripheral, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3383 | &msm_device_hsusb_host, |
Vijayavardhan Vennapusa | eb56648 | 2011-09-18 07:48:37 +0530 | [diff] [blame] | 3384 | &msm_device_hsic_host, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3385 | &android_usb_device, |
| 3386 | &msm_pcm, |
| 3387 | &msm_pcm_routing, |
| 3388 | &msm_cpudai0, |
| 3389 | &msm_cpudai1, |
| 3390 | &msm_cpudai_hdmi_rx, |
| 3391 | &msm_cpudai_bt_rx, |
| 3392 | &msm_cpudai_bt_tx, |
| 3393 | &msm_cpudai_fm_rx, |
| 3394 | &msm_cpudai_fm_tx, |
Bhalchandra Gajare | 0e795c4 | 2011-08-15 18:10:30 -0700 | [diff] [blame] | 3395 | &msm_cpudai_auxpcm_rx, |
| 3396 | &msm_cpudai_auxpcm_tx, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3397 | &msm_cpu_fe, |
| 3398 | &msm_stub_codec, |
| 3399 | &msm_kgsl_3d0, |
| 3400 | #ifdef CONFIG_MSM_KGSL_2D |
| 3401 | &msm_kgsl_2d0, |
| 3402 | &msm_kgsl_2d1, |
| 3403 | #endif |
Chandan Uddaraju | 83eac3c | 2011-09-11 18:32:23 -0700 | [diff] [blame] | 3404 | &mipi_dsi_novatek_panel_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3405 | #ifdef CONFIG_MSM_GEMINI |
| 3406 | &msm8960_gemini_device, |
| 3407 | #endif |
| 3408 | &msm_voice, |
| 3409 | &msm_voip, |
| 3410 | &msm_lpa_pcm, |
Laxminath Kasam | cee1d60 | 2011-08-01 19:26:57 +0530 | [diff] [blame] | 3411 | &msm_cpudai_afe_01_rx, |
| 3412 | &msm_cpudai_afe_01_tx, |
| 3413 | &msm_cpudai_afe_02_rx, |
| 3414 | &msm_cpudai_afe_02_tx, |
| 3415 | &msm_pcm_afe, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3416 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 3417 | &hdmi_msm_device, |
| 3418 | #endif |
| 3419 | &msm_pcm_hostless, |
| 3420 | &msm_bus_apps_fabric, |
| 3421 | &msm_bus_sys_fabric, |
| 3422 | &msm_bus_mm_fabric, |
| 3423 | &msm_bus_sys_fpb, |
| 3424 | &msm_bus_cpss_fpb, |
Siddartha Mohanadoss | ba21fdd | 2011-08-18 10:05:27 -0700 | [diff] [blame] | 3425 | &msm_tsens_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3426 | }; |
| 3427 | |
| 3428 | static void __init msm8960_i2c_init(void) |
| 3429 | { |
| 3430 | msm8960_device_qup_i2c_gsbi4.dev.platform_data = |
| 3431 | &msm8960_i2c_qup_gsbi4_pdata; |
| 3432 | |
| 3433 | msm8960_device_qup_i2c_gsbi3.dev.platform_data = |
| 3434 | &msm8960_i2c_qup_gsbi3_pdata; |
| 3435 | |
| 3436 | msm8960_device_qup_i2c_gsbi10.dev.platform_data = |
| 3437 | &msm8960_i2c_qup_gsbi10_pdata; |
| 3438 | |
| 3439 | msm8960_device_qup_i2c_gsbi12.dev.platform_data = |
| 3440 | &msm8960_i2c_qup_gsbi12_pdata; |
| 3441 | } |
| 3442 | |
Lucille Sylvester | 34ec369 | 2011-08-16 16:28:04 -0600 | [diff] [blame] | 3443 | static void __init msm8960_gfx_init(void) |
| 3444 | { |
| 3445 | uint32_t soc_platform_version = socinfo_get_platform_version(); |
| 3446 | if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) { |
| 3447 | struct kgsl_device_platform_data *kgsl_3d0_pdata = |
| 3448 | msm_kgsl_3d0.dev.platform_data; |
| 3449 | kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq = |
| 3450 | 320000000; |
| 3451 | kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq = |
| 3452 | 266667000; |
| 3453 | } |
| 3454 | } |
| 3455 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3456 | static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = { |
| 3457 | .irq_base = PM8921_IRQ_BASE, |
| 3458 | .devirq = MSM_GPIO_TO_INT(104), |
| 3459 | .irq_trigger_flag = IRQF_TRIGGER_LOW, |
| 3460 | }; |
| 3461 | |
| 3462 | static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = { |
| 3463 | .gpio_base = PM8921_GPIO_PM_TO_SYS(1), |
| 3464 | }; |
| 3465 | |
| 3466 | static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = { |
| 3467 | .mpp_base = PM8921_MPP_PM_TO_SYS(1), |
| 3468 | }; |
| 3469 | |
| 3470 | static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = { |
| 3471 | .rtc_write_enable = false, |
| 3472 | }; |
| 3473 | |
| 3474 | static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = { |
| 3475 | .pull_up = 1, |
| 3476 | .kpd_trigger_delay_us = 970, |
| 3477 | .wakeup = 1, |
| 3478 | }; |
| 3479 | |
Mohan Pallaka | 002e9e0 | 2011-08-05 11:23:22 +0530 | [diff] [blame] | 3480 | /* Rotate lock key is not available so use F1 */ |
| 3481 | #define KEY_ROTATE_LOCK KEY_F1 |
| 3482 | |
| 3483 | static const unsigned int keymap_liquid[] = { |
| 3484 | KEY(0, 0, KEY_VOLUMEUP), |
| 3485 | KEY(0, 1, KEY_VOLUMEDOWN), |
| 3486 | KEY(1, 3, KEY_ROTATE_LOCK), |
| 3487 | KEY(1, 4, KEY_HOME), |
| 3488 | }; |
| 3489 | |
| 3490 | static struct matrix_keymap_data keymap_data_liquid = { |
| 3491 | .keymap_size = ARRAY_SIZE(keymap_liquid), |
| 3492 | .keymap = keymap_liquid, |
| 3493 | }; |
| 3494 | |
| 3495 | static struct pm8xxx_keypad_platform_data keypad_data_liquid = { |
| 3496 | .input_name = "keypad_8960_liquid", |
| 3497 | .input_phys_device = "keypad_8960/input0", |
| 3498 | .num_rows = 2, |
| 3499 | .num_cols = 5, |
| 3500 | .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9), |
| 3501 | .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1), |
| 3502 | .debounce_ms = 15, |
| 3503 | .scan_delay_ms = 32, |
| 3504 | .row_hold_ns = 91500, |
| 3505 | .wakeup = 1, |
| 3506 | .keymap_data = &keymap_data_liquid, |
| 3507 | }; |
| 3508 | |
| 3509 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3510 | static const unsigned int keymap[] = { |
| 3511 | KEY(0, 0, KEY_VOLUMEUP), |
| 3512 | KEY(0, 1, KEY_VOLUMEDOWN), |
| 3513 | KEY(0, 2, KEY_CAMERA_SNAPSHOT), |
| 3514 | KEY(0, 3, KEY_CAMERA_FOCUS), |
| 3515 | }; |
| 3516 | |
| 3517 | static struct matrix_keymap_data keymap_data = { |
| 3518 | .keymap_size = ARRAY_SIZE(keymap), |
| 3519 | .keymap = keymap, |
| 3520 | }; |
| 3521 | |
| 3522 | static struct pm8xxx_keypad_platform_data keypad_data = { |
| 3523 | .input_name = "keypad_8960", |
| 3524 | .input_phys_device = "keypad_8960/input0", |
| 3525 | .num_rows = 1, |
| 3526 | .num_cols = 5, |
| 3527 | .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9), |
| 3528 | .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1), |
| 3529 | .debounce_ms = 15, |
| 3530 | .scan_delay_ms = 32, |
| 3531 | .row_hold_ns = 91500, |
| 3532 | .wakeup = 1, |
| 3533 | .keymap_data = &keymap_data, |
| 3534 | }; |
| 3535 | |
| 3536 | static const unsigned int keymap_sim[] = { |
| 3537 | KEY(0, 0, KEY_7), |
| 3538 | KEY(0, 1, KEY_DOWN), |
| 3539 | KEY(0, 2, KEY_UP), |
| 3540 | KEY(0, 3, KEY_RIGHT), |
| 3541 | KEY(0, 4, KEY_ENTER), |
| 3542 | KEY(0, 5, KEY_L), |
| 3543 | KEY(0, 6, KEY_BACK), |
| 3544 | KEY(0, 7, KEY_M), |
| 3545 | |
| 3546 | KEY(1, 0, KEY_LEFT), |
| 3547 | KEY(1, 1, KEY_SEND), |
| 3548 | KEY(1, 2, KEY_1), |
| 3549 | KEY(1, 3, KEY_4), |
| 3550 | KEY(1, 4, KEY_CLEAR), |
| 3551 | KEY(1, 5, KEY_MSDOS), |
| 3552 | KEY(1, 6, KEY_SPACE), |
| 3553 | KEY(1, 7, KEY_COMMA), |
| 3554 | |
| 3555 | KEY(2, 0, KEY_6), |
| 3556 | KEY(2, 1, KEY_5), |
| 3557 | KEY(2, 2, KEY_8), |
| 3558 | KEY(2, 3, KEY_3), |
| 3559 | KEY(2, 4, KEY_NUMERIC_STAR), |
| 3560 | KEY(2, 5, KEY_UP), |
| 3561 | KEY(2, 6, KEY_DOWN), |
| 3562 | KEY(2, 7, KEY_LEFTSHIFT), |
| 3563 | |
| 3564 | KEY(3, 0, KEY_9), |
| 3565 | KEY(3, 1, KEY_NUMERIC_POUND), |
| 3566 | KEY(3, 2, KEY_0), |
| 3567 | KEY(3, 3, KEY_2), |
| 3568 | KEY(3, 4, KEY_SLEEP), |
| 3569 | KEY(3, 5, KEY_F1), |
| 3570 | KEY(3, 6, KEY_F2), |
| 3571 | KEY(3, 7, KEY_F3), |
| 3572 | |
| 3573 | KEY(4, 0, KEY_BACK), |
| 3574 | KEY(4, 1, KEY_HOME), |
| 3575 | KEY(4, 2, KEY_MENU), |
| 3576 | KEY(4, 3, KEY_VOLUMEUP), |
| 3577 | KEY(4, 4, KEY_VOLUMEDOWN), |
| 3578 | KEY(4, 5, KEY_F4), |
| 3579 | KEY(4, 6, KEY_F5), |
| 3580 | KEY(4, 7, KEY_F6), |
| 3581 | |
| 3582 | KEY(5, 0, KEY_R), |
| 3583 | KEY(5, 1, KEY_T), |
| 3584 | KEY(5, 2, KEY_Y), |
| 3585 | KEY(5, 3, KEY_LEFTALT), |
| 3586 | KEY(5, 4, KEY_KPENTER), |
| 3587 | KEY(5, 5, KEY_Q), |
| 3588 | KEY(5, 6, KEY_W), |
| 3589 | KEY(5, 7, KEY_E), |
| 3590 | |
| 3591 | KEY(6, 0, KEY_F), |
| 3592 | KEY(6, 1, KEY_G), |
| 3593 | KEY(6, 2, KEY_H), |
| 3594 | KEY(6, 3, KEY_CAPSLOCK), |
| 3595 | KEY(6, 4, KEY_PAGEUP), |
| 3596 | KEY(6, 5, KEY_A), |
| 3597 | KEY(6, 6, KEY_S), |
| 3598 | KEY(6, 7, KEY_D), |
| 3599 | |
| 3600 | KEY(7, 0, KEY_V), |
| 3601 | KEY(7, 1, KEY_B), |
| 3602 | KEY(7, 2, KEY_N), |
| 3603 | KEY(7, 3, KEY_MENU), |
| 3604 | KEY(7, 4, KEY_PAGEDOWN), |
| 3605 | KEY(7, 5, KEY_Z), |
| 3606 | KEY(7, 6, KEY_X), |
| 3607 | KEY(7, 7, KEY_C), |
| 3608 | |
| 3609 | KEY(8, 0, KEY_P), |
| 3610 | KEY(8, 1, KEY_J), |
| 3611 | KEY(8, 2, KEY_K), |
| 3612 | KEY(8, 3, KEY_INSERT), |
| 3613 | KEY(8, 4, KEY_LINEFEED), |
| 3614 | KEY(8, 5, KEY_U), |
| 3615 | KEY(8, 6, KEY_I), |
| 3616 | KEY(8, 7, KEY_O), |
| 3617 | |
| 3618 | KEY(9, 0, KEY_4), |
| 3619 | KEY(9, 1, KEY_5), |
| 3620 | KEY(9, 2, KEY_6), |
| 3621 | KEY(9, 3, KEY_7), |
| 3622 | KEY(9, 4, KEY_8), |
| 3623 | KEY(9, 5, KEY_1), |
| 3624 | KEY(9, 6, KEY_2), |
| 3625 | KEY(9, 7, KEY_3), |
| 3626 | |
| 3627 | KEY(10, 0, KEY_F7), |
| 3628 | KEY(10, 1, KEY_F8), |
| 3629 | KEY(10, 2, KEY_F9), |
| 3630 | KEY(10, 3, KEY_F10), |
| 3631 | KEY(10, 4, KEY_FN), |
| 3632 | KEY(10, 5, KEY_9), |
| 3633 | KEY(10, 6, KEY_0), |
| 3634 | KEY(10, 7, KEY_DOT), |
| 3635 | |
| 3636 | KEY(11, 0, KEY_LEFTCTRL), |
| 3637 | KEY(11, 1, KEY_F11), |
| 3638 | KEY(11, 2, KEY_ENTER), |
| 3639 | KEY(11, 3, KEY_SEARCH), |
| 3640 | KEY(11, 4, KEY_DELETE), |
| 3641 | KEY(11, 5, KEY_RIGHT), |
| 3642 | KEY(11, 6, KEY_LEFT), |
| 3643 | KEY(11, 7, KEY_RIGHTSHIFT), |
| 3644 | KEY(0, 0, KEY_VOLUMEUP), |
| 3645 | KEY(0, 1, KEY_VOLUMEDOWN), |
| 3646 | KEY(0, 2, KEY_CAMERA_SNAPSHOT), |
| 3647 | KEY(0, 3, KEY_CAMERA_FOCUS), |
| 3648 | }; |
| 3649 | |
| 3650 | static struct matrix_keymap_data keymap_data_sim = { |
| 3651 | .keymap_size = ARRAY_SIZE(keymap_sim), |
| 3652 | .keymap = keymap_sim, |
| 3653 | }; |
| 3654 | |
| 3655 | static struct pm8xxx_keypad_platform_data keypad_data_sim = { |
| 3656 | .input_name = "keypad_8960", |
| 3657 | .input_phys_device = "keypad_8960/input0", |
| 3658 | .num_rows = 12, |
| 3659 | .num_cols = 8, |
| 3660 | .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9), |
| 3661 | .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1), |
| 3662 | .debounce_ms = 15, |
| 3663 | .scan_delay_ms = 32, |
| 3664 | .row_hold_ns = 91500, |
| 3665 | .wakeup = 1, |
| 3666 | .keymap_data = &keymap_data_sim, |
| 3667 | }; |
| 3668 | |
Abhijeet Dharmapurikar | ad74236 | 2011-08-29 19:50:02 -0700 | [diff] [blame] | 3669 | static int pm8921_therm_mitigation[] = { |
| 3670 | 1100, |
| 3671 | 700, |
| 3672 | 600, |
| 3673 | 325, |
| 3674 | }; |
| 3675 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3676 | static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = { |
Abhijeet Dharmapurikar | 3405933 | 2011-08-16 19:19:39 -0700 | [diff] [blame] | 3677 | .safety_time = 180, |
Abhijeet Dharmapurikar | 33fe6fb | 2011-09-14 16:03:11 -0700 | [diff] [blame] | 3678 | .update_time = 60000, |
Abhijeet Dharmapurikar | 3405933 | 2011-08-16 19:19:39 -0700 | [diff] [blame] | 3679 | .max_voltage = 4200, |
| 3680 | .min_voltage = 3200, |
| 3681 | .resume_voltage = 4100, |
| 3682 | .term_current = 100, |
| 3683 | .cool_temp = 10, |
| 3684 | .warm_temp = 40, |
| 3685 | .temp_check_period = 1, |
Abhijeet Dharmapurikar | ad74236 | 2011-08-29 19:50:02 -0700 | [diff] [blame] | 3686 | .max_bat_chg_current = 1100, |
Abhijeet Dharmapurikar | 3405933 | 2011-08-16 19:19:39 -0700 | [diff] [blame] | 3687 | .cool_bat_chg_current = 350, |
| 3688 | .warm_bat_chg_current = 350, |
| 3689 | .cool_bat_voltage = 4100, |
| 3690 | .warm_bat_voltage = 4100, |
Abhijeet Dharmapurikar | ad74236 | 2011-08-29 19:50:02 -0700 | [diff] [blame] | 3691 | .thermal_mitigation = pm8921_therm_mitigation, |
| 3692 | .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3693 | }; |
| 3694 | |
| 3695 | static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = { |
| 3696 | .priority = 0, |
| 3697 | }; |
| 3698 | |
| 3699 | static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = { |
| 3700 | .r_sense = 10, |
| 3701 | .i_test = 2500, |
| 3702 | .v_failure = 3000, |
| 3703 | .calib_delay_ms = 600000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3704 | }; |
| 3705 | |
Jay Chokshi | de4cefb | 2011-08-04 18:10:44 -0700 | [diff] [blame] | 3706 | #define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */ |
| 3707 | |
| 3708 | /** |
| 3709 | * 'flag' stores three values; led id, led mode, and max current of led. |
| 3710 | * The bit packing format is as follow, |
| 3711 | * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) | |
| 3712 | * led_id (1 nibble) |
| 3713 | */ |
| 3714 | #define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \ |
| 3715 | (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\ |
| 3716 | ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\ |
| 3717 | ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \ |
| 3718 | PM8XXX_LED_MAX_CURRENT_MASK)) |
| 3719 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3720 | static struct led_info pm8921_led_info[] = { |
| 3721 | [0] = { |
Jay Chokshi | de4cefb | 2011-08-04 18:10:44 -0700 | [diff] [blame] | 3722 | .name = "led:usb", |
| 3723 | .default_trigger = "usb-online", |
| 3724 | .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0, |
| 3725 | PM8XXX_LED_MODE_MANUAL, |
| 3726 | PM8921_LC_LED_MAX_CURRENT), |
| 3727 | }, |
| 3728 | [1] = { |
| 3729 | .name = "led:ac", |
| 3730 | .default_trigger = "ac-online", |
| 3731 | .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1, |
| 3732 | PM8XXX_LED_MODE_MANUAL, |
| 3733 | PM8921_LC_LED_MAX_CURRENT), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3734 | }, |
| 3735 | }; |
| 3736 | |
| 3737 | static struct led_platform_data pm8xxx_leds_pdata = { |
| 3738 | .num_leds = ARRAY_SIZE(pm8921_led_info), |
| 3739 | .leds = pm8921_led_info, |
| 3740 | }; |
| 3741 | |
| 3742 | static struct pm8921_platform_data pm8921_platform_data __devinitdata = { |
| 3743 | .irq_pdata = &pm8xxx_irq_pdata, |
| 3744 | .gpio_pdata = &pm8xxx_gpio_pdata, |
| 3745 | .mpp_pdata = &pm8xxx_mpp_pdata, |
| 3746 | .rtc_pdata = &pm8xxx_rtc_pdata, |
| 3747 | .pwrkey_pdata = &pm8xxx_pwrkey_pdata, |
| 3748 | .keypad_pdata = &keypad_data, |
| 3749 | .misc_pdata = &pm8xxx_misc_pdata, |
| 3750 | .regulator_pdatas = msm_pm8921_regulator_pdata, |
| 3751 | .charger_pdata = &pm8921_chg_pdata, |
| 3752 | .bms_pdata = &pm8921_bms_pdata, |
| 3753 | .adc_pdata = &pm8921_adc_pdata, |
| 3754 | .leds_pdata = &pm8xxx_leds_pdata, |
| 3755 | }; |
| 3756 | |
| 3757 | static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = { |
| 3758 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 3759 | .slave = { |
| 3760 | .name = "pm8921-core", |
| 3761 | .platform_data = &pm8921_platform_data, |
| 3762 | }, |
| 3763 | }; |
| 3764 | |
| 3765 | static void msm8960_wcnss_init(void) |
| 3766 | { |
| 3767 | int i, ret, j; |
| 3768 | |
| 3769 | for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) { |
| 3770 | ret = gpio_request(wcnss_5wire_interface[i].gpio, |
| 3771 | "wcnss_5_wire"); |
| 3772 | if (ret) { |
| 3773 | pr_err("wcnss_5_wire gpio %d failed: %d\n", |
| 3774 | wcnss_5wire_interface[i].gpio, ret); |
| 3775 | goto fail; |
| 3776 | } |
| 3777 | } |
| 3778 | |
| 3779 | pr_info("%s: Iris 5-wire gpios configured\n", __func__); |
| 3780 | |
| 3781 | return; |
| 3782 | |
| 3783 | fail: |
| 3784 | for (j = 0; j < i; j++) |
| 3785 | gpio_free(wcnss_5wire_interface[j].gpio); |
| 3786 | } |
| 3787 | |
Stepan Moskovchenko | 41d16827 | 2011-08-09 17:09:42 -0700 | [diff] [blame] | 3788 | #ifdef CONFIG_KS8851 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3789 | static int ethernet_init(void) |
| 3790 | { |
| 3791 | int ret; |
| 3792 | ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq"); |
| 3793 | if (ret) { |
| 3794 | pr_err("ks8851 gpio_request failed: %d\n", ret); |
| 3795 | goto fail; |
| 3796 | } |
| 3797 | |
| 3798 | ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst"); |
| 3799 | if (ret) { |
| 3800 | pr_err("ks8851 gpio_request failed: %d\n", ret); |
| 3801 | goto fail_rst; |
| 3802 | } |
| 3803 | |
| 3804 | ret = gpio_request(FPGA_CS_GPIO, "fpga_cs"); |
| 3805 | if (ret) { |
| 3806 | pr_err("ks8851 gpio_request failed: %d\n", ret); |
| 3807 | goto fail_cs; |
| 3808 | } |
| 3809 | |
| 3810 | gpio_direction_output(FPGA_CS_GPIO, 1); |
| 3811 | gpio_direction_output(KS8851_RST_GPIO, 1); |
| 3812 | return 0; |
| 3813 | fail_cs: |
| 3814 | gpio_free(KS8851_RST_GPIO); |
| 3815 | fail_rst: |
| 3816 | gpio_free(KS8851_IRQ_GPIO); |
| 3817 | fail: |
| 3818 | return ret; |
| 3819 | } |
Stepan Moskovchenko | 41d16827 | 2011-08-09 17:09:42 -0700 | [diff] [blame] | 3820 | #else |
| 3821 | static int ethernet_init(void) |
| 3822 | { |
| 3823 | return 0; |
| 3824 | } |
| 3825 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3826 | |
| 3827 | static struct msm_cpuidle_state msm_cstates[] __initdata = { |
| 3828 | {0, 0, "C0", "WFI", |
| 3829 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 3830 | |
| 3831 | {0, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 3832 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 3833 | |
| 3834 | {0, 2, "C2", "POWER_COLLAPSE", |
| 3835 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, |
| 3836 | |
| 3837 | {1, 0, "C0", "WFI", |
| 3838 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 3839 | |
| 3840 | {1, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 3841 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 3842 | }; |
| 3843 | |
| 3844 | static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { |
| 3845 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 3846 | .idle_supported = 1, |
| 3847 | .suspend_supported = 1, |
| 3848 | .idle_enabled = 0, |
| 3849 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3850 | }, |
| 3851 | |
| 3852 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 3853 | .idle_supported = 1, |
| 3854 | .suspend_supported = 1, |
| 3855 | .idle_enabled = 0, |
| 3856 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3857 | }, |
| 3858 | |
| 3859 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 3860 | .idle_supported = 1, |
| 3861 | .suspend_supported = 1, |
| 3862 | .idle_enabled = 1, |
| 3863 | .suspend_enabled = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3864 | }, |
| 3865 | |
| 3866 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 3867 | .idle_supported = 0, |
| 3868 | .suspend_supported = 1, |
| 3869 | .idle_enabled = 0, |
| 3870 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3871 | }, |
| 3872 | |
| 3873 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 3874 | .idle_supported = 1, |
| 3875 | .suspend_supported = 1, |
| 3876 | .idle_enabled = 0, |
| 3877 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3878 | }, |
| 3879 | |
| 3880 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 3881 | .idle_supported = 1, |
| 3882 | .suspend_supported = 0, |
| 3883 | .idle_enabled = 1, |
| 3884 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3885 | }, |
| 3886 | }; |
| 3887 | |
| 3888 | static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = { |
| 3889 | { |
| 3890 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 3891 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 3892 | true, |
| 3893 | 1, 8000, 100000, 1, |
| 3894 | }, |
| 3895 | |
| 3896 | { |
| 3897 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 3898 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 3899 | true, |
| 3900 | 1500, 5000, 60100000, 3000, |
| 3901 | }, |
| 3902 | |
| 3903 | { |
| 3904 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 3905 | MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), |
| 3906 | false, |
| 3907 | 1800, 5000, 60350000, 3500, |
| 3908 | }, |
| 3909 | |
| 3910 | { |
| 3911 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 3912 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), |
| 3913 | false, |
| 3914 | 2800, 2500, 65350000, 4800, |
| 3915 | }, |
| 3916 | |
| 3917 | { |
| 3918 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 3919 | MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), |
| 3920 | false, |
| 3921 | 3800, 4500, 67850000, 5500, |
| 3922 | }, |
| 3923 | |
| 3924 | { |
| 3925 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 3926 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), |
| 3927 | false, |
| 3928 | 4800, 2000, 71850000, 6800, |
| 3929 | }, |
| 3930 | |
| 3931 | { |
| 3932 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 3933 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 3934 | false, |
| 3935 | 6800, 500, 75850000, 8800, |
| 3936 | }, |
| 3937 | |
| 3938 | { |
| 3939 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 3940 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), |
| 3941 | false, |
| 3942 | 7800, 0, 76350000, 9800, |
| 3943 | }, |
| 3944 | }; |
| 3945 | |
| 3946 | #ifdef CONFIG_I2C |
| 3947 | #define I2C_SURF 1 |
| 3948 | #define I2C_FFA (1 << 1) |
| 3949 | #define I2C_RUMI (1 << 2) |
| 3950 | #define I2C_SIM (1 << 3) |
| 3951 | #define I2C_FLUID (1 << 4) |
Amir Samuelov | 05f8780 | 2011-08-27 18:30:12 +0300 | [diff] [blame] | 3952 | #define I2C_LIQUID (1 << 5) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3953 | |
| 3954 | struct i2c_registry { |
| 3955 | u8 machs; |
| 3956 | int bus; |
| 3957 | struct i2c_board_info *info; |
| 3958 | int len; |
| 3959 | }; |
| 3960 | |
| 3961 | #ifdef CONFIG_MSM_CAMERA |
| 3962 | static struct i2c_board_info msm_camera_boardinfo[] __initdata = { |
| 3963 | #ifdef CONFIG_IMX074 |
| 3964 | { |
| 3965 | I2C_BOARD_INFO("imx074", 0x1A), |
| 3966 | }, |
| 3967 | #endif |
| 3968 | #ifdef CONFIG_OV2720 |
| 3969 | { |
| 3970 | I2C_BOARD_INFO("ov2720", 0x6C), |
| 3971 | }, |
| 3972 | #endif |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 3973 | { |
| 3974 | I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1), |
| 3975 | }, |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 3976 | #ifdef CONFIG_MSM_CAMERA_FLASH_SC628A |
| 3977 | { |
| 3978 | I2C_BOARD_INFO("sc628a", 0x6E), |
| 3979 | }, |
| 3980 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3981 | }; |
| 3982 | #endif |
| 3983 | |
| 3984 | /* Sensors DSPS platform data */ |
| 3985 | #ifdef CONFIG_MSM_DSPS |
| 3986 | #define DSPS_PIL_GENERIC_NAME "dsps" |
| 3987 | #endif /* CONFIG_MSM_DSPS */ |
| 3988 | |
| 3989 | static void __init msm8960_init_dsps(void) |
| 3990 | { |
| 3991 | #ifdef CONFIG_MSM_DSPS |
| 3992 | struct msm_dsps_platform_data *pdata = |
| 3993 | msm_dsps_device.dev.platform_data; |
| 3994 | pdata->pil_name = DSPS_PIL_GENERIC_NAME; |
| 3995 | pdata->gpios = NULL; |
| 3996 | pdata->gpios_num = 0; |
| 3997 | |
| 3998 | platform_device_register(&msm_dsps_device); |
| 3999 | #endif /* CONFIG_MSM_DSPS */ |
| 4000 | } |
| 4001 | |
Amir Samuelov | 5137e39 | 2011-09-21 17:31:25 +0300 | [diff] [blame] | 4002 | #ifdef CONFIG_ISL9519_CHARGER |
| 4003 | static struct isl_platform_data isl_data __initdata = { |
| 4004 | .valid_n_gpio = 0, /* Not required when notify-by-pmic */ |
| 4005 | .chg_detection_config = NULL, /* Not required when notify-by-pmic */ |
| 4006 | .max_system_voltage = 4200, |
| 4007 | .min_system_voltage = 3200, |
| 4008 | .chgcurrent = 1000, /* 1900, */ |
| 4009 | .term_current = 400, /* Need fine tuning */ |
| 4010 | .input_current = 2048, |
| 4011 | }; |
| 4012 | |
| 4013 | static struct i2c_board_info isl_charger_i2c_info[] __initdata = { |
| 4014 | { |
| 4015 | I2C_BOARD_INFO("isl9519q", 0x9), |
| 4016 | .irq = 0, /* Not required when notify-by-pmic */ |
| 4017 | .platform_data = &isl_data, |
| 4018 | }, |
| 4019 | }; |
| 4020 | #endif /* CONFIG_ISL9519_CHARGER */ |
| 4021 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4022 | static struct i2c_registry msm8960_i2c_devices[] __initdata = { |
| 4023 | #ifdef CONFIG_MSM_CAMERA |
| 4024 | { |
Amir Samuelov | 05f8780 | 2011-08-27 18:30:12 +0300 | [diff] [blame] | 4025 | I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4026 | MSM_8960_GSBI4_QUP_I2C_BUS_ID, |
| 4027 | msm_camera_boardinfo, |
| 4028 | ARRAY_SIZE(msm_camera_boardinfo), |
| 4029 | }, |
| 4030 | #endif |
Amir Samuelov | 5137e39 | 2011-09-21 17:31:25 +0300 | [diff] [blame] | 4031 | #ifdef CONFIG_ISL9519_CHARGER |
| 4032 | { |
| 4033 | I2C_LIQUID, |
| 4034 | MSM_8960_GSBI10_QUP_I2C_BUS_ID, |
| 4035 | isl_charger_i2c_info, |
| 4036 | ARRAY_SIZE(isl_charger_i2c_info), |
| 4037 | }, |
| 4038 | #endif /* CONFIG_ISL9519_CHARGER */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4039 | { |
| 4040 | I2C_SURF | I2C_FFA | I2C_FLUID, |
| 4041 | MSM_8960_GSBI3_QUP_I2C_BUS_ID, |
| 4042 | cyttsp_info, |
| 4043 | ARRAY_SIZE(cyttsp_info), |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 4044 | }, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 4045 | { |
| 4046 | I2C_LIQUID, |
| 4047 | MSM_8960_GSBI3_QUP_I2C_BUS_ID, |
| 4048 | mxt_device_info, |
| 4049 | ARRAY_SIZE(mxt_device_info), |
| 4050 | }, |
| 4051 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4052 | }; |
| 4053 | #endif /* CONFIG_I2C */ |
| 4054 | |
| 4055 | static void __init register_i2c_devices(void) |
| 4056 | { |
| 4057 | #ifdef CONFIG_I2C |
| 4058 | u8 mach_mask = 0; |
| 4059 | int i; |
| 4060 | |
| 4061 | /* Build the matching 'supported_machs' bitmask */ |
| 4062 | if (machine_is_msm8960_cdp()) |
| 4063 | mach_mask = I2C_SURF; |
| 4064 | else if (machine_is_msm8960_rumi3()) |
| 4065 | mach_mask = I2C_RUMI; |
| 4066 | else if (machine_is_msm8960_sim()) |
| 4067 | mach_mask = I2C_SIM; |
Amy Maloche | 2d02803 | 2011-07-20 14:08:06 -0700 | [diff] [blame] | 4068 | else if (machine_is_msm8960_fluid()) |
| 4069 | mach_mask = I2C_FLUID; |
Amir Samuelov | 05f8780 | 2011-08-27 18:30:12 +0300 | [diff] [blame] | 4070 | else if (machine_is_msm8960_liquid()) |
| 4071 | mach_mask = I2C_LIQUID; |
Amy Maloche | 1b0663f | 2011-08-02 16:46:22 -0700 | [diff] [blame] | 4072 | else if (machine_is_msm8960_mtp()) |
| 4073 | mach_mask = I2C_FFA; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4074 | else |
| 4075 | pr_err("unmatched machine ID in register_i2c_devices\n"); |
| 4076 | |
| 4077 | /* Run the array and install devices as appropriate */ |
| 4078 | for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) { |
| 4079 | if (msm8960_i2c_devices[i].machs & mach_mask) |
| 4080 | i2c_register_board_info(msm8960_i2c_devices[i].bus, |
| 4081 | msm8960_i2c_devices[i].info, |
| 4082 | msm8960_i2c_devices[i].len); |
| 4083 | } |
| 4084 | #endif |
| 4085 | } |
| 4086 | |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 4087 | static void __init msm8960_sim_init(void) |
| 4088 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4089 | BUG_ON(msm_rpm_init(&msm_rpm_data)); |
| 4090 | BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels, |
| 4091 | ARRAY_SIZE(msm_rpmrs_levels))); |
| 4092 | regulator_suppress_info_printing(); |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 4093 | platform_device_register(&msm8960_device_rpm_regulator); |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 4094 | msm_clock_init(&msm8960_clock_init_data); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4095 | msm8960_device_ssbi_pm8921.dev.platform_data = |
| 4096 | &msm8960_ssbi_pm8921_pdata; |
| 4097 | pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4098 | |
| 4099 | /* Simulator supports a QWERTY keypad */ |
| 4100 | pm8921_platform_data.keypad_pdata = &keypad_data_sim; |
| 4101 | |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 4102 | msm8960_device_otg.dev.platform_data = &msm_otg_pdata; |
| 4103 | msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev; |
| 4104 | msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4105 | gpiomux_init(); |
| 4106 | ethernet_init(); |
| 4107 | msm8960_i2c_init(); |
| 4108 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 4109 | msm_spm_l2_init(msm_spm_l2_data); |
| 4110 | msm8960_init_buses(); |
| 4111 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
| 4112 | pm8921_gpio_mpp_init(); |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 4113 | platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices)); |
Matt Wagantall | ec57f06 | 2011-08-16 23:54:46 -0700 | [diff] [blame] | 4114 | acpuclk_init(&acpuclk_8960_soc_data); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4115 | |
| 4116 | msm8960_device_qup_spi_gsbi1.dev.platform_data = |
| 4117 | &msm8960_qup_spi_gsbi1_pdata; |
| 4118 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 4119 | |
| 4120 | msm8960_init_mmc(); |
| 4121 | msm_fb_add_devices(); |
| 4122 | slim_register_board_info(msm_slim_devices, |
| 4123 | ARRAY_SIZE(msm_slim_devices)); |
| 4124 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 4125 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 4126 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 4127 | msm_pm_data); |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 4128 | } |
| 4129 | |
| 4130 | static void __init msm8960_rumi3_init(void) |
| 4131 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4132 | BUG_ON(msm_rpm_init(&msm_rpm_data)); |
| 4133 | BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels, |
| 4134 | ARRAY_SIZE(msm_rpmrs_levels))); |
| 4135 | regulator_suppress_info_printing(); |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 4136 | platform_device_register(&msm8960_device_rpm_regulator); |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 4137 | msm_clock_init(&msm8960_dummy_clock_init_data); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4138 | gpiomux_init(); |
| 4139 | ethernet_init(); |
| 4140 | msm8960_device_ssbi_pm8921.dev.platform_data = |
| 4141 | &msm8960_ssbi_pm8921_pdata; |
| 4142 | pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len; |
| 4143 | msm8960_device_qup_spi_gsbi1.dev.platform_data = |
| 4144 | &msm8960_qup_spi_gsbi1_pdata; |
| 4145 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 4146 | msm8960_i2c_init(); |
| 4147 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 4148 | msm_spm_l2_init(msm_spm_l2_data); |
| 4149 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
| 4150 | pm8921_gpio_mpp_init(); |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 4151 | platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4152 | msm8960_init_mmc(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4153 | register_i2c_devices(); |
| 4154 | msm_fb_add_devices(); |
| 4155 | slim_register_board_info(msm_slim_devices, |
| 4156 | ARRAY_SIZE(msm_slim_devices)); |
| 4157 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 4158 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 4159 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 4160 | msm_pm_data); |
| 4161 | } |
| 4162 | |
| 4163 | static void __init msm8960_cdp_init(void) |
| 4164 | { |
Naveen Ramaraj | 76483ad | 2011-09-06 14:25:44 -0700 | [diff] [blame] | 4165 | if (meminfo_init(SYS_MEMORY, SZ_256M) < 0) |
| 4166 | pr_err("meminfo_init() failed!\n"); |
| 4167 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4168 | BUG_ON(msm_rpm_init(&msm_rpm_data)); |
| 4169 | BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels, |
| 4170 | ARRAY_SIZE(msm_rpmrs_levels))); |
Abhijeet Dharmapurikar | 6d565fd | 2011-09-15 18:49:56 -0700 | [diff] [blame] | 4171 | |
| 4172 | pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4173 | regulator_suppress_info_printing(); |
| 4174 | if (msm_xo_init()) |
| 4175 | pr_err("Failed to initialize XO votes\n"); |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 4176 | platform_device_register(&msm8960_device_rpm_regulator); |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 4177 | msm_clock_init(&msm8960_clock_init_data); |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 4178 | msm8960_device_otg.dev.platform_data = &msm_otg_pdata; |
| 4179 | msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev; |
| 4180 | msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4181 | gpiomux_init(); |
| 4182 | ethernet_init(); |
Mohan Pallaka | 002e9e0 | 2011-08-05 11:23:22 +0530 | [diff] [blame] | 4183 | if (machine_is_msm8960_liquid()) |
| 4184 | pm8921_platform_data.keypad_pdata = &keypad_data_liquid; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4185 | msm8960_device_qup_spi_gsbi1.dev.platform_data = |
| 4186 | &msm8960_qup_spi_gsbi1_pdata; |
| 4187 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 4188 | msm8960_device_ssbi_pm8921.dev.platform_data = |
| 4189 | &msm8960_ssbi_pm8921_pdata; |
| 4190 | pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len; |
| 4191 | msm8960_i2c_init(); |
Lucille Sylvester | 34ec369 | 2011-08-16 16:28:04 -0600 | [diff] [blame] | 4192 | msm8960_gfx_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4193 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 4194 | msm_spm_l2_init(msm_spm_l2_data); |
| 4195 | msm8960_init_buses(); |
| 4196 | platform_add_devices(msm_footswitch_devices, |
| 4197 | msm_num_footswitch_devices); |
David Collins | b10be1d | 2011-09-02 10:29:31 -0700 | [diff] [blame] | 4198 | if (machine_is_msm8960_liquid()) |
| 4199 | platform_device_register(&msm8960_device_ext_3p3v_vreg); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4200 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
| 4201 | pm8921_gpio_mpp_init(); |
| 4202 | platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices)); |
| 4203 | msm8960_init_cam(); |
| 4204 | msm8960_init_mmc(); |
Matt Wagantall | ec57f06 | 2011-08-16 23:54:46 -0700 | [diff] [blame] | 4205 | acpuclk_init(&acpuclk_8960_soc_data); |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 4206 | if (machine_is_msm8960_liquid()) |
| 4207 | mxt_init_hw_liquid(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4208 | register_i2c_devices(); |
| 4209 | msm8960_wcnss_init(); |
| 4210 | msm_fb_add_devices(); |
| 4211 | slim_register_board_info(msm_slim_devices, |
| 4212 | ARRAY_SIZE(msm_slim_devices)); |
| 4213 | msm8960_init_dsps(); |
| 4214 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 4215 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 4216 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 4217 | msm_pm_data); |
Larry Bassel | a7eadea | 2011-07-14 10:46:00 -0700 | [diff] [blame] | 4218 | change_memory_power = &msm8960_change_memory_power; |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 4219 | } |
| 4220 | |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 4221 | MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR") |
| 4222 | .map_io = msm8960_map_io, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4223 | .reserve = msm8960_reserve, |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 4224 | .init_irq = msm8960_init_irq, |
| 4225 | .timer = &msm_timer, |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 4226 | .init_machine = msm8960_sim_init, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4227 | .init_early = msm8960_allocate_memory_regions, |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 4228 | MACHINE_END |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 4229 | |
| 4230 | MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3") |
| 4231 | .map_io = msm8960_map_io, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4232 | .reserve = msm8960_reserve, |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 4233 | .init_irq = msm8960_init_irq, |
| 4234 | .timer = &msm_timer, |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 4235 | .init_machine = msm8960_rumi3_init, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4236 | .init_early = msm8960_allocate_memory_regions, |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 4237 | MACHINE_END |
| 4238 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4239 | MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP") |
| 4240 | .map_io = msm8960_map_io, |
| 4241 | .reserve = msm8960_reserve, |
| 4242 | .init_irq = msm8960_init_irq, |
| 4243 | .timer = &msm_timer, |
| 4244 | .init_machine = msm8960_cdp_init, |
| 4245 | .init_early = msm8960_allocate_memory_regions, |
| 4246 | MACHINE_END |
| 4247 | |
| 4248 | MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP") |
| 4249 | .map_io = msm8960_map_io, |
| 4250 | .reserve = msm8960_reserve, |
| 4251 | .init_irq = msm8960_init_irq, |
| 4252 | .timer = &msm_timer, |
| 4253 | .init_machine = msm8960_cdp_init, |
| 4254 | .init_early = msm8960_allocate_memory_regions, |
| 4255 | MACHINE_END |
| 4256 | |
| 4257 | MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID") |
| 4258 | .map_io = msm8960_map_io, |
| 4259 | .reserve = msm8960_reserve, |
| 4260 | .init_irq = msm8960_init_irq, |
| 4261 | .timer = &msm_timer, |
| 4262 | .init_machine = msm8960_cdp_init, |
| 4263 | .init_early = msm8960_allocate_memory_regions, |
| 4264 | MACHINE_END |
Amir Samuelov | 0d1f8ae | 2011-07-28 11:13:58 +0300 | [diff] [blame] | 4265 | |
| 4266 | MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID") |
| 4267 | .map_io = msm8960_map_io, |
| 4268 | .reserve = msm8960_reserve, |
| 4269 | .init_irq = msm8960_init_irq, |
| 4270 | .timer = &msm_timer, |
| 4271 | .init_machine = msm8960_cdp_init, |
| 4272 | .init_early = msm8960_allocate_memory_regions, |
| 4273 | MACHINE_END |