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