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