Sravan Kumar Ambapuram | b22cf4d | 2012-01-02 21:45:04 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | #include <linux/kernel.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/gpio_event.h> |
Taniya Das | 2b16d1d | 2011-12-02 14:44:19 +0530 | [diff] [blame] | 15 | #include <linux/memblock.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 16 | #include <asm/mach-types.h> |
| 17 | #include <asm/mach/arch.h> |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 18 | #include <asm/hardware/gic.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 19 | #include <mach/board.h> |
| 20 | #include <mach/msm_iomap.h> |
| 21 | #include <mach/msm_hsusb.h> |
| 22 | #include <mach/rpc_hsusb.h> |
| 23 | #include <mach/rpc_pmapp.h> |
| 24 | #include <mach/usbdiag.h> |
| 25 | #include <mach/msm_memtypes.h> |
| 26 | #include <mach/msm_serial_hs.h> |
| 27 | #include <linux/usb/android.h> |
| 28 | #include <linux/platform_device.h> |
| 29 | #include <linux/io.h> |
| 30 | #include <linux/gpio.h> |
| 31 | #include <mach/vreg.h> |
| 32 | #include <mach/pmic.h> |
| 33 | #include <mach/socinfo.h> |
| 34 | #include <linux/mtd/nand.h> |
| 35 | #include <linux/mtd/partitions.h> |
| 36 | #include <asm/mach/mmc.h> |
| 37 | #include <linux/i2c.h> |
| 38 | #include <linux/i2c/sx150x.h> |
| 39 | #include <linux/gpio.h> |
| 40 | #include <linux/android_pmem.h> |
| 41 | #include <linux/bootmem.h> |
| 42 | #include <linux/mfd/marimba.h> |
| 43 | #include <mach/vreg.h> |
| 44 | #include <linux/power_supply.h> |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 45 | #include <linux/regulator/consumer.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 46 | #include <mach/rpc_pmapp.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 47 | #include <mach/msm_battery.h> |
| 48 | #include <linux/smsc911x.h> |
| 49 | #include <linux/atmel_maxtouch.h> |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 50 | #include <linux/fmem.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 51 | #include "devices.h" |
| 52 | #include "timer.h" |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 53 | #include "board-msm7x27a-regulator.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 54 | #include "devices-msm7x2xa.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 55 | #include "pm.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 56 | #include <mach/rpc_server_handset.h> |
| 57 | #include <mach/socinfo.h> |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 58 | #include "pm-boot.h" |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 59 | #include "board-msm7627a.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 60 | |
| 61 | #define PMEM_KERNEL_EBI1_SIZE 0x3A000 |
| 62 | #define MSM_PMEM_AUDIO_SIZE 0x5B000 |
Laxminath Kasam | 5faa1ca | 2012-02-15 12:06:45 +0530 | [diff] [blame] | 63 | #define ADSP_RPC_PROG 0x3000000a |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 64 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 65 | #if defined(CONFIG_GPIO_SX150X) |
| 66 | enum { |
| 67 | SX150X_CORE, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | static struct sx150x_platform_data sx150x_data[] __initdata = { |
| 71 | [SX150X_CORE] = { |
| 72 | .gpio_base = GPIO_CORE_EXPANDER_BASE, |
| 73 | .oscio_is_gpo = false, |
| 74 | .io_pullup_ena = 0, |
pankaj kumar | c5c0139 | 2011-08-12 13:44:05 +0530 | [diff] [blame] | 75 | .io_pulldn_ena = 0x02, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 76 | .io_open_drain_ena = 0xfef8, |
| 77 | .irq_summary = -1, |
| 78 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 79 | }; |
| 80 | #endif |
| 81 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 82 | |
Santosh Sajjan | 6822c68 | 2011-07-26 10:49:36 +0530 | [diff] [blame] | 83 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 84 | .name = "wlan_ar6000_pm_dev", |
| 85 | .id = -1, |
| 86 | }; |
| 87 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 88 | #if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X) |
| 89 | static struct i2c_board_info core_exp_i2c_info[] __initdata = { |
| 90 | { |
| 91 | I2C_BOARD_INFO("sx1509q", 0x3e), |
| 92 | }, |
| 93 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 94 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 95 | static void __init register_i2c_devices(void) |
| 96 | { |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 97 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf() || |
| 98 | machine_is_msm8625_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 99 | sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0; |
| 100 | |
| 101 | core_exp_i2c_info[0].platform_data = |
| 102 | &sx150x_data[SX150X_CORE]; |
| 103 | |
| 104 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 105 | core_exp_i2c_info, |
| 106 | ARRAY_SIZE(core_exp_i2c_info)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 107 | } |
| 108 | #endif |
| 109 | |
| 110 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 111 | { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 112 | "qup_scl" }, |
| 113 | { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 114 | "qup_sda" }, |
| 115 | { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 116 | "qup_scl" }, |
| 117 | { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 118 | "qup_sda" }, |
| 119 | }; |
| 120 | |
| 121 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 122 | { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 123 | "qup_scl" }, |
| 124 | { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 125 | "qup_sda" }, |
| 126 | { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 127 | "qup_scl" }, |
| 128 | { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 129 | "qup_sda" }, |
| 130 | }; |
| 131 | |
| 132 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 133 | { |
| 134 | int rc; |
| 135 | |
| 136 | if (adap_id < 0 || adap_id > 1) |
| 137 | return; |
| 138 | |
| 139 | /* Each adapter gets 2 lines from the table */ |
| 140 | if (config_type) |
| 141 | rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2); |
| 142 | else |
| 143 | rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2); |
| 144 | if (rc < 0) |
| 145 | pr_err("QUP GPIO request/enable failed: %d\n", rc); |
| 146 | } |
| 147 | |
| 148 | static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = { |
| 149 | .clk_freq = 100000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 150 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 151 | }; |
| 152 | |
| 153 | static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = { |
| 154 | .clk_freq = 100000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 155 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 156 | }; |
| 157 | |
| 158 | #ifdef CONFIG_ARCH_MSM7X27A |
Neti Ravi Kumar | 061726e | 2011-12-08 15:14:57 +0530 | [diff] [blame] | 159 | #define MSM_PMEM_MDP_SIZE 0x2300000 |
| 160 | #define MSM7x25A_MSM_PMEM_MDP_SIZE 0x1500000 |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 161 | |
Mahesh Lanka | a2f6df1 | 2012-01-05 16:54:40 +0530 | [diff] [blame] | 162 | #define MSM_PMEM_ADSP_SIZE 0x1100000 |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 163 | #define MSM7x25A_MSM_PMEM_ADSP_SIZE 0xB91000 |
| 164 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 165 | #endif |
| 166 | |
| 167 | static struct android_usb_platform_data android_usb_pdata = { |
| 168 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 169 | }; |
| 170 | |
| 171 | static struct platform_device android_usb_device = { |
| 172 | .name = "android_usb", |
| 173 | .id = -1, |
| 174 | .dev = { |
| 175 | .platform_data = &android_usb_pdata, |
| 176 | }, |
| 177 | }; |
| 178 | |
| 179 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 180 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 181 | { |
| 182 | int rc = 0; |
| 183 | unsigned gpio; |
| 184 | |
| 185 | gpio = GPIO_HOST_VBUS_EN; |
| 186 | |
| 187 | rc = gpio_request(gpio, "i2c_host_vbus_en"); |
| 188 | if (rc < 0) { |
| 189 | pr_err("failed to request %d GPIO\n", gpio); |
| 190 | return; |
| 191 | } |
| 192 | gpio_direction_output(gpio, !!on); |
| 193 | gpio_set_value_cansleep(gpio, !!on); |
| 194 | gpio_free(gpio); |
| 195 | } |
| 196 | |
| 197 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 198 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 199 | }; |
| 200 | |
| 201 | static void __init msm7x2x_init_host(void) |
| 202 | { |
| 203 | msm_add_host(0, &msm_usb_host_pdata); |
| 204 | } |
| 205 | #endif |
| 206 | |
| 207 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 208 | static int hsusb_rpc_connect(int connect) |
| 209 | { |
| 210 | if (connect) |
| 211 | return msm_hsusb_rpc_connect(); |
| 212 | else |
| 213 | return msm_hsusb_rpc_close(); |
| 214 | } |
| 215 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 216 | static struct regulator *reg_hsusb; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 217 | static int msm_hsusb_ldo_init(int init) |
| 218 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 219 | int rc = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 220 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 221 | if (init) { |
| 222 | reg_hsusb = regulator_get(NULL, "usb"); |
| 223 | if (IS_ERR(reg_hsusb)) { |
| 224 | rc = PTR_ERR(reg_hsusb); |
| 225 | pr_err("%s: could not get regulator: %d\n", |
| 226 | __func__, rc); |
| 227 | goto out; |
| 228 | } |
| 229 | |
| 230 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); |
| 231 | if (rc) { |
| 232 | pr_err("%s: could not set voltage: %d\n", |
| 233 | __func__, rc); |
| 234 | goto reg_free; |
| 235 | } |
| 236 | |
| 237 | return 0; |
| 238 | } |
| 239 | /* else fall through */ |
| 240 | reg_free: |
| 241 | regulator_put(reg_hsusb); |
| 242 | out: |
| 243 | reg_hsusb = NULL; |
| 244 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | static int msm_hsusb_ldo_enable(int enable) |
| 248 | { |
| 249 | static int ldo_status; |
| 250 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 251 | if (IS_ERR_OR_NULL(reg_hsusb)) |
| 252 | return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 253 | |
| 254 | if (ldo_status == enable) |
| 255 | return 0; |
| 256 | |
| 257 | ldo_status = enable; |
| 258 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 259 | return enable ? |
| 260 | regulator_enable(reg_hsusb) : |
| 261 | regulator_disable(reg_hsusb); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 265 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 266 | { |
| 267 | int ret = 0; |
| 268 | |
| 269 | if (init) |
| 270 | ret = msm_pm_app_rpc_init(callback); |
| 271 | else |
| 272 | msm_pm_app_rpc_deinit(callback); |
| 273 | |
| 274 | return ret; |
| 275 | } |
| 276 | #endif |
| 277 | |
| 278 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 279 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 280 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 281 | #else |
| 282 | .vbus_power = msm_hsusb_vbus_power, |
| 283 | #endif |
| 284 | .rpc_connect = hsusb_rpc_connect, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 285 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 286 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 287 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 288 | .se1_gating = SE1_GATING_DISABLE, |
| 289 | .ldo_init = msm_hsusb_ldo_init, |
| 290 | .ldo_enable = msm_hsusb_ldo_enable, |
| 291 | .chg_init = hsusb_chg_init, |
| 292 | .chg_connected = hsusb_chg_connected, |
| 293 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 294 | }; |
| 295 | #endif |
| 296 | |
| 297 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 298 | .is_phy_status_timer_on = 1, |
| 299 | }; |
| 300 | |
| 301 | static struct resource smc91x_resources[] = { |
| 302 | [0] = { |
| 303 | .start = 0x90000300, |
| 304 | .end = 0x900003ff, |
| 305 | .flags = IORESOURCE_MEM, |
| 306 | }, |
| 307 | [1] = { |
| 308 | .start = MSM_GPIO_TO_INT(4), |
| 309 | .end = MSM_GPIO_TO_INT(4), |
| 310 | .flags = IORESOURCE_IRQ, |
| 311 | }, |
| 312 | }; |
| 313 | |
| 314 | static struct platform_device smc91x_device = { |
| 315 | .name = "smc91x", |
| 316 | .id = 0, |
| 317 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 318 | .resource = smc91x_resources, |
| 319 | }; |
| 320 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 321 | #ifdef CONFIG_SERIAL_MSM_HS |
| 322 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 323 | .inject_rx_on_wakeup = 1, |
| 324 | .rx_to_inject = 0xFD, |
| 325 | }; |
| 326 | #endif |
| 327 | static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 328 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 329 | .idle_supported = 1, |
| 330 | .suspend_supported = 1, |
| 331 | .idle_enabled = 1, |
| 332 | .suspend_enabled = 1, |
| 333 | .latency = 16000, |
| 334 | .residency = 20000, |
| 335 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 336 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 337 | .idle_supported = 1, |
| 338 | .suspend_supported = 1, |
| 339 | .idle_enabled = 1, |
| 340 | .suspend_enabled = 1, |
| 341 | .latency = 12000, |
| 342 | .residency = 20000, |
| 343 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 344 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 345 | .idle_supported = 1, |
| 346 | .suspend_supported = 1, |
| 347 | .idle_enabled = 0, |
| 348 | .suspend_enabled = 1, |
| 349 | .latency = 2000, |
| 350 | .residency = 0, |
| 351 | }, |
Murali Nalajala | b10363d | 2012-01-12 16:29:01 +0530 | [diff] [blame] | 352 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 353 | .idle_supported = 1, |
| 354 | .suspend_supported = 1, |
| 355 | .idle_enabled = 1, |
| 356 | .suspend_enabled = 1, |
| 357 | .latency = 2, |
| 358 | .residency = 0, |
| 359 | }, |
| 360 | }; |
| 361 | |
Sujit Reddy Thumma | ca0c106 | 2012-02-24 14:47:05 +0530 | [diff] [blame] | 362 | u32 msm7627a_power_collapse_latency(enum msm_pm_sleep_mode mode) |
| 363 | { |
| 364 | switch (mode) { |
| 365 | case MSM_PM_SLEEP_MODE_POWER_COLLAPSE: |
| 366 | return msm7x27a_pm_data |
| 367 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE].latency; |
| 368 | case MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN: |
| 369 | return msm7x27a_pm_data |
| 370 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].latency; |
| 371 | case MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT: |
| 372 | return msm7x27a_pm_data |
| 373 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
| 374 | case MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT: |
| 375 | return msm7x27a_pm_data |
| 376 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT].latency; |
| 377 | default: |
| 378 | return 0; |
| 379 | } |
| 380 | } |
| 381 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 382 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
Sravan Kumar Ambapuram | b22cf4d | 2012-01-02 21:45:04 +0530 | [diff] [blame] | 383 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS, |
| 384 | .p_addr = 0, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 385 | }; |
| 386 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 387 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 388 | .name = "pmem_adsp", |
| 389 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
Mahesh Lanka | c6af7eb | 2011-08-02 18:00:35 +0530 | [diff] [blame] | 390 | .cached = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 391 | .memory_type = MEMTYPE_EBI1, |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 392 | .request_region = request_fmem_c_region, |
| 393 | .release_region = release_fmem_c_region, |
| 394 | .reusable = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 395 | }; |
| 396 | |
| 397 | static struct platform_device android_pmem_adsp_device = { |
| 398 | .name = "android_pmem", |
| 399 | .id = 1, |
| 400 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 401 | }; |
| 402 | |
| 403 | static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 404 | static int __init pmem_mdp_size_setup(char *p) |
| 405 | { |
| 406 | pmem_mdp_size = memparse(p, NULL); |
| 407 | return 0; |
| 408 | } |
| 409 | |
| 410 | early_param("pmem_mdp_size", pmem_mdp_size_setup); |
| 411 | |
| 412 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 413 | static int __init pmem_adsp_size_setup(char *p) |
| 414 | { |
| 415 | pmem_adsp_size = memparse(p, NULL); |
| 416 | return 0; |
| 417 | } |
| 418 | |
| 419 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 420 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 421 | #define SND(desc, num) { .name = #desc, .id = num } |
| 422 | static struct snd_endpoint snd_endpoints_list[] = { |
| 423 | SND(HANDSET, 0), |
| 424 | SND(MONO_HEADSET, 2), |
| 425 | SND(HEADSET, 3), |
| 426 | SND(SPEAKER, 6), |
| 427 | SND(TTY_HEADSET, 8), |
| 428 | SND(TTY_VCO, 9), |
| 429 | SND(TTY_HCO, 10), |
| 430 | SND(BT, 12), |
| 431 | SND(IN_S_SADC_OUT_HANDSET, 16), |
| 432 | SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25), |
| 433 | SND(FM_DIGITAL_STEREO_HEADSET, 26), |
| 434 | SND(FM_DIGITAL_SPEAKER_PHONE, 27), |
| 435 | SND(FM_DIGITAL_BT_A2DP_HEADSET, 28), |
Shashi Kumar | 64e0760 | 2011-10-11 13:18:57 +0530 | [diff] [blame] | 436 | SND(STEREO_HEADSET_AND_SPEAKER, 31), |
Sidipotu Ashok | ab34ca4 | 2011-07-22 16:34:20 +0530 | [diff] [blame] | 437 | SND(CURRENT, 0x7FFFFFFE), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 438 | SND(FM_ANALOG_STEREO_HEADSET, 35), |
| 439 | SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36), |
| 440 | }; |
| 441 | #undef SND |
| 442 | |
| 443 | static struct msm_snd_endpoints msm_device_snd_endpoints = { |
| 444 | .endpoints = snd_endpoints_list, |
| 445 | .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint) |
| 446 | }; |
| 447 | |
| 448 | static struct platform_device msm_device_snd = { |
| 449 | .name = "msm_snd", |
| 450 | .id = -1, |
| 451 | .dev = { |
| 452 | .platform_data = &msm_device_snd_endpoints |
| 453 | }, |
| 454 | }; |
| 455 | |
| 456 | #define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 457 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 458 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 459 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 460 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 461 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 462 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 463 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 464 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 465 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 466 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 467 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 468 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 469 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 470 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 471 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 472 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 473 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 474 | #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 475 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 476 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 477 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 478 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 479 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 480 | #define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI) |
| 481 | |
| 482 | static unsigned int dec_concurrency_table[] = { |
| 483 | /* Audio LP */ |
| 484 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0, |
| 485 | 0, 0, 0, |
| 486 | |
| 487 | /* Concurrency 1 */ |
| 488 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 489 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 490 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 491 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 492 | (DEC4_FORMAT), |
| 493 | |
| 494 | /* Concurrency 2 */ |
| 495 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 496 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 497 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 498 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 499 | (DEC4_FORMAT), |
| 500 | |
| 501 | /* Concurrency 3 */ |
| 502 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 503 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 504 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 505 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 506 | (DEC4_FORMAT), |
| 507 | |
| 508 | /* Concurrency 4 */ |
| 509 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 510 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 511 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 512 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 513 | (DEC4_FORMAT), |
| 514 | |
| 515 | /* Concurrency 5 */ |
| 516 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 517 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 518 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 519 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 520 | (DEC4_FORMAT), |
| 521 | |
| 522 | /* Concurrency 6 */ |
| 523 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 524 | 0, 0, 0, 0, |
| 525 | |
| 526 | /* Concurrency 7 */ |
| 527 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 528 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 529 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 530 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 531 | (DEC4_FORMAT), |
| 532 | }; |
| 533 | |
| 534 | #define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \ |
| 535 | .module_queueid = queueid, .module_decid = decid, \ |
| 536 | .nr_codec_support = nr_codec} |
| 537 | |
| 538 | static struct msm_adspdec_info dec_info_list[] = { |
| 539 | DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */ |
| 540 | DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */ |
| 541 | DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */ |
| 542 | DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */ |
| 543 | DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */ |
| 544 | }; |
| 545 | |
| 546 | static struct msm_adspdec_database msm_device_adspdec_database = { |
| 547 | .num_dec = ARRAY_SIZE(dec_info_list), |
| 548 | .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \ |
| 549 | ARRAY_SIZE(dec_info_list)), |
| 550 | .dec_concurrency_table = dec_concurrency_table, |
| 551 | .dec_info_list = dec_info_list, |
| 552 | }; |
| 553 | |
| 554 | static struct platform_device msm_device_adspdec = { |
| 555 | .name = "msm_adspdec", |
| 556 | .id = -1, |
| 557 | .dev = { |
| 558 | .platform_data = &msm_device_adspdec_database |
| 559 | }, |
| 560 | }; |
| 561 | |
| 562 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 563 | .name = "pmem_audio", |
| 564 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 565 | .cached = 0, |
| 566 | .memory_type = MEMTYPE_EBI1, |
| 567 | }; |
| 568 | |
| 569 | static struct platform_device android_pmem_audio_device = { |
| 570 | .name = "android_pmem", |
| 571 | .id = 2, |
| 572 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 573 | }; |
| 574 | |
| 575 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 576 | .name = "pmem", |
| 577 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 578 | .cached = 1, |
| 579 | .memory_type = MEMTYPE_EBI1, |
| 580 | }; |
| 581 | static struct platform_device android_pmem_device = { |
| 582 | .name = "android_pmem", |
| 583 | .id = 0, |
| 584 | .dev = { .platform_data = &android_pmem_pdata }, |
| 585 | }; |
| 586 | |
| 587 | static u32 msm_calculate_batt_capacity(u32 current_voltage); |
| 588 | |
| 589 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 590 | .voltage_min_design = 2800, |
| 591 | .voltage_max_design = 4300, |
| 592 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 593 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 594 | .calculate_capacity = &msm_calculate_batt_capacity, |
| 595 | }; |
| 596 | |
| 597 | static u32 msm_calculate_batt_capacity(u32 current_voltage) |
| 598 | { |
| 599 | u32 low_voltage = msm_psy_batt_data.voltage_min_design; |
| 600 | u32 high_voltage = msm_psy_batt_data.voltage_max_design; |
| 601 | |
| 602 | return (current_voltage - low_voltage) * 100 |
| 603 | / (high_voltage - low_voltage); |
| 604 | } |
| 605 | |
| 606 | static struct platform_device msm_batt_device = { |
| 607 | .name = "msm-battery", |
| 608 | .id = -1, |
| 609 | .dev.platform_data = &msm_psy_batt_data, |
| 610 | }; |
| 611 | |
| 612 | static struct smsc911x_platform_config smsc911x_config = { |
| 613 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH, |
| 614 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 615 | .flags = SMSC911X_USE_16BIT, |
| 616 | }; |
| 617 | |
| 618 | static struct resource smsc911x_resources[] = { |
| 619 | [0] = { |
| 620 | .start = 0x90000000, |
| 621 | .end = 0x90007fff, |
| 622 | .flags = IORESOURCE_MEM, |
| 623 | }, |
| 624 | [1] = { |
| 625 | .start = MSM_GPIO_TO_INT(48), |
| 626 | .end = MSM_GPIO_TO_INT(48), |
| 627 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 628 | }, |
| 629 | }; |
| 630 | |
| 631 | static struct platform_device smsc911x_device = { |
| 632 | .name = "smsc911x", |
| 633 | .id = 0, |
| 634 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 635 | .resource = smsc911x_resources, |
| 636 | .dev = { |
| 637 | .platform_data = &smsc911x_config, |
| 638 | }, |
| 639 | }; |
| 640 | |
| 641 | static struct msm_gpio smsc911x_gpios[] = { |
| 642 | { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA), |
| 643 | "smsc911x_irq" }, |
| 644 | { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA), |
| 645 | "eth_fifo_sel" }, |
| 646 | }; |
| 647 | |
| 648 | #define ETH_FIFO_SEL_GPIO 49 |
| 649 | static void msm7x27a_cfg_smsc911x(void) |
| 650 | { |
| 651 | int res; |
| 652 | |
| 653 | res = msm_gpios_request_enable(smsc911x_gpios, |
| 654 | ARRAY_SIZE(smsc911x_gpios)); |
| 655 | if (res) { |
| 656 | pr_err("%s: unable to enable gpios for SMSC911x\n", __func__); |
| 657 | return; |
| 658 | } |
| 659 | |
| 660 | /* ETH_FIFO_SEL */ |
| 661 | res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0); |
| 662 | if (res) { |
| 663 | pr_err("%s: unable to get direction for gpio %d\n", __func__, |
| 664 | ETH_FIFO_SEL_GPIO); |
| 665 | msm_gpios_disable_free(smsc911x_gpios, |
| 666 | ARRAY_SIZE(smsc911x_gpios)); |
| 667 | return; |
| 668 | } |
| 669 | gpio_set_value(ETH_FIFO_SEL_GPIO, 0); |
| 670 | } |
| 671 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 672 | #if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \ |
| 673 | && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM) |
| 674 | static struct msm_gpio uart2dm_gpios[] = { |
| 675 | {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 676 | "uart2dm_rfr_n" }, |
| 677 | {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 678 | "uart2dm_cts_n" }, |
| 679 | {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 680 | "uart2dm_rx" }, |
| 681 | {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), |
| 682 | "uart2dm_tx" }, |
| 683 | }; |
| 684 | |
| 685 | static void msm7x27a_cfg_uart2dm_serial(void) |
| 686 | { |
| 687 | int ret; |
| 688 | ret = msm_gpios_request_enable(uart2dm_gpios, |
| 689 | ARRAY_SIZE(uart2dm_gpios)); |
| 690 | if (ret) |
| 691 | pr_err("%s: unable to enable gpios for uart2dm\n", __func__); |
| 692 | } |
| 693 | #else |
| 694 | static void msm7x27a_cfg_uart2dm_serial(void) { } |
| 695 | #endif |
| 696 | |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 697 | struct fmem_platform_data fmem_pdata; |
| 698 | |
| 699 | struct platform_device fmem_device = { |
| 700 | .name = "fmem", |
| 701 | .id = -1, |
| 702 | .dev = { .platform_data = &fmem_pdata }, |
| 703 | }; |
| 704 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 705 | static struct platform_device *rumi_sim_devices[] __initdata = { |
| 706 | &msm_device_dmov, |
| 707 | &msm_device_smd, |
| 708 | &smc91x_device, |
| 709 | &msm_device_uart1, |
| 710 | &msm_device_nand, |
| 711 | &msm_device_uart_dm1, |
| 712 | &msm_gsbi0_qup_i2c_device, |
| 713 | &msm_gsbi1_qup_i2c_device, |
| 714 | }; |
| 715 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 716 | static struct platform_device *msm8625_rumi3_devices[] __initdata = { |
| 717 | &msm8625_device_dmov, |
Angshuman Sarkar | fb1cce9 | 2012-02-21 15:20:43 +0530 | [diff] [blame] | 718 | &msm8625_device_smd, |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 719 | &msm8625_device_uart1, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 720 | &msm8625_gsbi0_qup_i2c_device, |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 721 | }; |
| 722 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 723 | static struct platform_device *msm7627a_surf_ffa_devices[] __initdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 724 | &msm_device_dmov, |
| 725 | &msm_device_smd, |
| 726 | &msm_device_uart1, |
| 727 | &msm_device_uart_dm1, |
| 728 | &msm_device_uart_dm2, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 729 | &msm_gsbi0_qup_i2c_device, |
| 730 | &msm_gsbi1_qup_i2c_device, |
| 731 | &msm_device_otg, |
| 732 | &msm_device_gadget_peripheral, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 733 | &smsc911x_device, |
| 734 | &msm_kgsl_3d0, |
| 735 | }; |
| 736 | |
| 737 | static struct platform_device *common_devices[] __initdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 738 | &android_usb_device, |
| 739 | &android_pmem_device, |
| 740 | &android_pmem_adsp_device, |
| 741 | &android_pmem_audio_device, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 742 | &fmem_device, |
| 743 | &msm_device_nand, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 744 | &msm_device_snd, |
| 745 | &msm_device_adspdec, |
Manish Dewangan | 3a26099 | 2011-06-24 18:01:34 +0530 | [diff] [blame] | 746 | &asoc_msm_pcm, |
| 747 | &asoc_msm_dai0, |
| 748 | &asoc_msm_dai1, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 749 | &msm_batt_device, |
| 750 | }; |
| 751 | |
| 752 | static struct platform_device *msm8625_surf_devices[] __initdata = { |
| 753 | &msm8625_device_dmov, |
| 754 | &msm8625_device_uart1, |
| 755 | &msm8625_device_uart_dm1, |
| 756 | &msm8625_device_uart_dm2, |
| 757 | &msm8625_gsbi0_qup_i2c_device, |
| 758 | &msm8625_gsbi1_qup_i2c_device, |
Taniya Das | f266530 | 2012-02-28 16:54:54 +0530 | [diff] [blame] | 759 | &msm8625_device_smd, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 760 | &msm8625_device_otg, |
| 761 | &msm8625_device_gadget_peripheral, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 762 | }; |
| 763 | |
| 764 | static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE; |
| 765 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 766 | { |
| 767 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 768 | return 0; |
| 769 | } |
| 770 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 771 | |
| 772 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 773 | static int __init pmem_audio_size_setup(char *p) |
| 774 | { |
| 775 | pmem_audio_size = memparse(p, NULL); |
| 776 | return 0; |
| 777 | } |
| 778 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 779 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 780 | static struct memtype_reserve msm7x27a_reserve_table[] __initdata = { |
| 781 | [MEMTYPE_SMI] = { |
| 782 | }, |
| 783 | [MEMTYPE_EBI0] = { |
| 784 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 785 | }, |
| 786 | [MEMTYPE_EBI1] = { |
| 787 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 788 | }, |
| 789 | }; |
| 790 | |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 791 | #ifdef CONFIG_ANDROID_PMEM |
| 792 | static struct android_pmem_platform_data *pmem_pdata_array[] __initdata = { |
| 793 | &android_pmem_adsp_pdata, |
| 794 | &android_pmem_audio_pdata, |
| 795 | &android_pmem_pdata, |
| 796 | }; |
| 797 | #endif |
| 798 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 799 | static void __init size_pmem_devices(void) |
| 800 | { |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 801 | #ifdef CONFIG_ANDROID_PMEM |
| 802 | unsigned int i; |
| 803 | unsigned int reusable_count = 0; |
Jeevan Shriram | f40764e | 2011-10-31 23:28:26 +0530 | [diff] [blame] | 804 | |
| 805 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) { |
| 806 | pmem_mdp_size = MSM7x25A_MSM_PMEM_MDP_SIZE; |
| 807 | pmem_adsp_size = MSM7x25A_MSM_PMEM_ADSP_SIZE; |
| 808 | } else { |
| 809 | pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 810 | pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 811 | } |
| 812 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 813 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 814 | android_pmem_pdata.size = pmem_mdp_size; |
| 815 | android_pmem_audio_pdata.size = pmem_audio_size; |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 816 | |
| 817 | fmem_pdata.size = 0; |
| 818 | |
| 819 | /* Find pmem devices that should use FMEM (reusable) memory. |
| 820 | */ |
| 821 | for (i = 0; i < ARRAY_SIZE(pmem_pdata_array); ++i) { |
| 822 | struct android_pmem_platform_data *pdata = pmem_pdata_array[i]; |
| 823 | |
| 824 | if (!reusable_count && pdata->reusable) |
| 825 | fmem_pdata.size += pdata->size; |
| 826 | |
| 827 | reusable_count += (pdata->reusable) ? 1 : 0; |
| 828 | |
| 829 | if (pdata->reusable && reusable_count > 1) { |
| 830 | pr_err("%s: Too many PMEM devices specified as reusable. PMEM device %s was not configured as reusable.\n", |
| 831 | __func__, pdata->name); |
| 832 | pdata->reusable = 0; |
| 833 | } |
| 834 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 835 | #endif |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 836 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 837 | } |
| 838 | |
| 839 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 840 | { |
| 841 | msm7x27a_reserve_table[p->memory_type].size += p->size; |
| 842 | } |
| 843 | |
| 844 | static void __init reserve_pmem_memory(void) |
| 845 | { |
| 846 | #ifdef CONFIG_ANDROID_PMEM |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 847 | unsigned int i; |
| 848 | for (i = 0; i < ARRAY_SIZE(pmem_pdata_array); ++i) { |
| 849 | if (!pmem_pdata_array[i]->reusable) |
| 850 | reserve_memory_for(pmem_pdata_array[i]); |
| 851 | } |
| 852 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 853 | msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 854 | #endif |
| 855 | } |
| 856 | |
| 857 | static void __init msm7x27a_calculate_reserve_sizes(void) |
| 858 | { |
| 859 | size_pmem_devices(); |
| 860 | reserve_pmem_memory(); |
| 861 | } |
| 862 | |
| 863 | static int msm7x27a_paddr_to_memtype(unsigned int paddr) |
| 864 | { |
| 865 | return MEMTYPE_EBI1; |
| 866 | } |
| 867 | |
| 868 | static struct reserve_info msm7x27a_reserve_info __initdata = { |
| 869 | .memtype_reserve_table = msm7x27a_reserve_table, |
| 870 | .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes, |
| 871 | .paddr_to_memtype = msm7x27a_paddr_to_memtype, |
| 872 | }; |
| 873 | |
| 874 | static void __init msm7x27a_reserve(void) |
| 875 | { |
| 876 | reserve_info = &msm7x27a_reserve_info; |
| 877 | msm_reserve(); |
Laura Abbott | 8f3d58b | 2011-12-18 10:47:03 -0800 | [diff] [blame] | 878 | fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 879 | } |
| 880 | |
Taniya Das | 2b16d1d | 2011-12-02 14:44:19 +0530 | [diff] [blame] | 881 | static void __init msm8625_reserve(void) |
| 882 | { |
| 883 | memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8); |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 884 | msm7x27a_reserve(); |
Taniya Das | 2b16d1d | 2011-12-02 14:44:19 +0530 | [diff] [blame] | 885 | } |
| 886 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 887 | static void __init msm7x27a_device_i2c_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 888 | { |
| 889 | msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata; |
| 890 | msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata; |
| 891 | } |
| 892 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 893 | static void __init msm8625_device_i2c_init(void) |
| 894 | { |
| 895 | msm8625_gsbi0_qup_i2c_device.dev.platform_data = |
| 896 | &msm_gsbi0_qup_i2c_pdata; |
| 897 | msm8625_gsbi1_qup_i2c_device.dev.platform_data = |
| 898 | &msm_gsbi1_qup_i2c_pdata; |
| 899 | } |
| 900 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 901 | #define MSM_EBI2_PHYS 0xa0d00000 |
| 902 | #define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030 |
| 903 | |
| 904 | static void __init msm7x27a_init_ebi2(void) |
| 905 | { |
| 906 | uint32_t ebi2_cfg; |
| 907 | void __iomem *ebi2_cfg_ptr; |
| 908 | |
| 909 | ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t)); |
| 910 | if (!ebi2_cfg_ptr) |
| 911 | return; |
| 912 | |
| 913 | ebi2_cfg = readl(ebi2_cfg_ptr); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 914 | if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() || |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 915 | machine_is_msm7625a_surf() || machine_is_msm8625_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 916 | ebi2_cfg |= (1 << 4); /* CS2 */ |
| 917 | |
| 918 | writel(ebi2_cfg, ebi2_cfg_ptr); |
| 919 | iounmap(ebi2_cfg_ptr); |
| 920 | |
| 921 | /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */ |
| 922 | ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1, |
| 923 | sizeof(uint32_t)); |
| 924 | if (!ebi2_cfg_ptr) |
| 925 | return; |
| 926 | |
| 927 | ebi2_cfg = readl(ebi2_cfg_ptr); |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 928 | if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 929 | ebi2_cfg |= (1 << 31); |
| 930 | |
| 931 | writel(ebi2_cfg, ebi2_cfg_ptr); |
| 932 | iounmap(ebi2_cfg_ptr); |
| 933 | } |
| 934 | |
| 935 | #define ATMEL_TS_I2C_NAME "maXTouch" |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 936 | |
| 937 | static struct regulator_bulk_data regs_atmel[] = { |
| 938 | { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 939 | { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 }, |
| 940 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 941 | |
| 942 | #define ATMEL_TS_GPIO_IRQ 82 |
| 943 | |
| 944 | static int atmel_ts_power_on(bool on) |
| 945 | { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 946 | int rc = on ? |
| 947 | regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) : |
| 948 | regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 949 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 950 | if (rc) |
| 951 | pr_err("%s: could not %sable regulators: %d\n", |
| 952 | __func__, on ? "en" : "dis", rc); |
| 953 | else |
| 954 | msleep(50); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 955 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 956 | return rc; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 957 | } |
| 958 | |
| 959 | static int atmel_ts_platform_init(struct i2c_client *client) |
| 960 | { |
| 961 | int rc; |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 962 | struct device *dev = &client->dev; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 963 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 964 | rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 965 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 966 | dev_err(dev, "%s: could not get regulators: %d\n", |
| 967 | __func__, rc); |
| 968 | goto out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 969 | } |
| 970 | |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 971 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 972 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 973 | dev_err(dev, "%s: could not set voltages: %d\n", |
| 974 | __func__, rc); |
| 975 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 976 | } |
| 977 | |
| 978 | rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0, |
| 979 | GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, |
| 980 | GPIO_CFG_8MA), GPIO_CFG_ENABLE); |
| 981 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 982 | dev_err(dev, "%s: gpio_tlmm_config for %d failed\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 983 | __func__, ATMEL_TS_GPIO_IRQ); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 984 | goto reg_free; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 985 | } |
| 986 | |
| 987 | /* configure touchscreen interrupt gpio */ |
| 988 | rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio"); |
| 989 | if (rc) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 990 | dev_err(dev, "%s: unable to request gpio %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 991 | __func__, ATMEL_TS_GPIO_IRQ); |
| 992 | goto ts_gpio_tlmm_unconfig; |
| 993 | } |
| 994 | |
| 995 | rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ); |
| 996 | if (rc < 0) { |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 997 | dev_err(dev, "%s: unable to set the direction of gpio %d\n", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 998 | __func__, ATMEL_TS_GPIO_IRQ); |
| 999 | goto free_ts_gpio; |
| 1000 | } |
| 1001 | return 0; |
| 1002 | |
| 1003 | free_ts_gpio: |
| 1004 | gpio_free(ATMEL_TS_GPIO_IRQ); |
| 1005 | ts_gpio_tlmm_unconfig: |
| 1006 | gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0, |
| 1007 | GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, |
| 1008 | GPIO_CFG_2MA), GPIO_CFG_DISABLE); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1009 | reg_free: |
| 1010 | regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel); |
| 1011 | out: |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1012 | return rc; |
| 1013 | } |
| 1014 | |
| 1015 | static int atmel_ts_platform_exit(struct i2c_client *client) |
| 1016 | { |
| 1017 | gpio_free(ATMEL_TS_GPIO_IRQ); |
| 1018 | gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0, |
| 1019 | GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, |
| 1020 | GPIO_CFG_2MA), GPIO_CFG_DISABLE); |
Justin Paupore | d98328e | 2011-08-19 13:48:31 -0700 | [diff] [blame] | 1021 | regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1022 | return 0; |
| 1023 | } |
| 1024 | |
| 1025 | static u8 atmel_ts_read_chg(void) |
| 1026 | { |
| 1027 | return gpio_get_value(ATMEL_TS_GPIO_IRQ); |
| 1028 | } |
| 1029 | |
| 1030 | static u8 atmel_ts_valid_interrupt(void) |
| 1031 | { |
| 1032 | return !atmel_ts_read_chg(); |
| 1033 | } |
| 1034 | |
| 1035 | #define ATMEL_X_OFFSET 13 |
| 1036 | #define ATMEL_Y_OFFSET 0 |
| 1037 | |
Mohan Pallaka | 4e9a94e | 2011-11-23 16:34:21 +0530 | [diff] [blame] | 1038 | static struct maxtouch_platform_data atmel_ts_pdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1039 | .numtouch = 4, |
| 1040 | .init_platform_hw = atmel_ts_platform_init, |
| 1041 | .exit_platform_hw = atmel_ts_platform_exit, |
| 1042 | .power_on = atmel_ts_power_on, |
| 1043 | .display_res_x = 480, |
| 1044 | .display_res_y = 864, |
| 1045 | .min_x = ATMEL_X_OFFSET, |
| 1046 | .max_x = (505 - ATMEL_X_OFFSET), |
| 1047 | .min_y = ATMEL_Y_OFFSET, |
| 1048 | .max_y = (863 - ATMEL_Y_OFFSET), |
| 1049 | .valid_interrupt = atmel_ts_valid_interrupt, |
| 1050 | .read_chg = atmel_ts_read_chg, |
| 1051 | }; |
| 1052 | |
| 1053 | static struct i2c_board_info atmel_ts_i2c_info[] __initdata = { |
| 1054 | { |
| 1055 | I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a), |
| 1056 | .platform_data = &atmel_ts_pdata, |
| 1057 | .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ), |
| 1058 | }, |
| 1059 | }; |
| 1060 | |
| 1061 | #define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col)) |
| 1062 | |
| 1063 | static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35}; |
| 1064 | static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40}; |
| 1065 | |
| 1066 | static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) * |
| 1067 | ARRAY_SIZE(kp_row_gpios)] = { |
| 1068 | [KP_INDEX(0, 0)] = KEY_7, |
| 1069 | [KP_INDEX(0, 1)] = KEY_DOWN, |
| 1070 | [KP_INDEX(0, 2)] = KEY_UP, |
| 1071 | [KP_INDEX(0, 3)] = KEY_RIGHT, |
| 1072 | [KP_INDEX(0, 4)] = KEY_ENTER, |
| 1073 | |
| 1074 | [KP_INDEX(1, 0)] = KEY_LEFT, |
| 1075 | [KP_INDEX(1, 1)] = KEY_SEND, |
| 1076 | [KP_INDEX(1, 2)] = KEY_1, |
| 1077 | [KP_INDEX(1, 3)] = KEY_4, |
| 1078 | [KP_INDEX(1, 4)] = KEY_CLEAR, |
| 1079 | |
| 1080 | [KP_INDEX(2, 0)] = KEY_6, |
| 1081 | [KP_INDEX(2, 1)] = KEY_5, |
| 1082 | [KP_INDEX(2, 2)] = KEY_8, |
| 1083 | [KP_INDEX(2, 3)] = KEY_3, |
| 1084 | [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR, |
| 1085 | |
| 1086 | [KP_INDEX(3, 0)] = KEY_9, |
| 1087 | [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND, |
| 1088 | [KP_INDEX(3, 2)] = KEY_0, |
| 1089 | [KP_INDEX(3, 3)] = KEY_2, |
| 1090 | [KP_INDEX(3, 4)] = KEY_SLEEP, |
| 1091 | |
| 1092 | [KP_INDEX(4, 0)] = KEY_BACK, |
| 1093 | [KP_INDEX(4, 1)] = KEY_HOME, |
| 1094 | [KP_INDEX(4, 2)] = KEY_MENU, |
| 1095 | [KP_INDEX(4, 3)] = KEY_VOLUMEUP, |
| 1096 | [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN, |
| 1097 | }; |
| 1098 | |
| 1099 | /* SURF keypad platform device information */ |
| 1100 | static struct gpio_event_matrix_info kp_matrix_info = { |
| 1101 | .info.func = gpio_event_matrix_func, |
| 1102 | .keymap = keymap, |
| 1103 | .output_gpios = kp_row_gpios, |
| 1104 | .input_gpios = kp_col_gpios, |
| 1105 | .noutputs = ARRAY_SIZE(kp_row_gpios), |
| 1106 | .ninputs = ARRAY_SIZE(kp_col_gpios), |
| 1107 | .settle_time.tv_nsec = 40 * NSEC_PER_USEC, |
| 1108 | .poll_time.tv_nsec = 20 * NSEC_PER_MSEC, |
| 1109 | .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | |
| 1110 | GPIOKPF_PRINT_UNMAPPED_KEYS, |
| 1111 | }; |
| 1112 | |
| 1113 | static struct gpio_event_info *kp_info[] = { |
| 1114 | &kp_matrix_info.info |
| 1115 | }; |
| 1116 | |
| 1117 | static struct gpio_event_platform_data kp_pdata = { |
| 1118 | .name = "7x27a_kp", |
| 1119 | .info = kp_info, |
| 1120 | .info_count = ARRAY_SIZE(kp_info) |
| 1121 | }; |
| 1122 | |
| 1123 | static struct platform_device kp_pdev = { |
| 1124 | .name = GPIO_EVENT_DEV_NAME, |
| 1125 | .id = -1, |
| 1126 | .dev = { |
| 1127 | .platform_data = &kp_pdata, |
| 1128 | }, |
| 1129 | }; |
| 1130 | |
| 1131 | static struct msm_handset_platform_data hs_platform_data = { |
| 1132 | .hs_name = "7k_handset", |
| 1133 | .pwr_key_delay_ms = 500, /* 0 will disable end key */ |
| 1134 | }; |
| 1135 | |
| 1136 | static struct platform_device hs_pdev = { |
| 1137 | .name = "msm-handset", |
| 1138 | .id = -1, |
| 1139 | .dev = { |
| 1140 | .platform_data = &hs_platform_data, |
| 1141 | }, |
| 1142 | }; |
| 1143 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 1144 | static struct platform_device msm_proccomm_regulator_dev = { |
| 1145 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 1146 | .id = -1, |
| 1147 | .dev = { |
| 1148 | .platform_data = &msm7x27a_proccomm_regulator_data |
| 1149 | } |
| 1150 | }; |
| 1151 | |
Laxminath Kasam | 5faa1ca | 2012-02-15 12:06:45 +0530 | [diff] [blame] | 1152 | static void msm_adsp_add_pdev(void) |
| 1153 | { |
| 1154 | int rc = 0; |
| 1155 | struct rpc_board_dev *rpc_adsp_pdev; |
| 1156 | |
| 1157 | rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL); |
| 1158 | if (rpc_adsp_pdev == NULL) { |
| 1159 | pr_err("%s: Memory Allocation failure\n", __func__); |
| 1160 | return; |
| 1161 | } |
| 1162 | rpc_adsp_pdev->prog = ADSP_RPC_PROG; |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1163 | |
| 1164 | if (cpu_is_msm8625()) |
| 1165 | rpc_adsp_pdev->pdev = msm8625_device_adsp; |
| 1166 | else |
| 1167 | rpc_adsp_pdev->pdev = msm_adsp_device; |
Laxminath Kasam | 5faa1ca | 2012-02-15 12:06:45 +0530 | [diff] [blame] | 1168 | rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1); |
| 1169 | if (rc < 0) { |
| 1170 | pr_err("%s: return val: %d\n", __func__, rc); |
| 1171 | kfree(rpc_adsp_pdev); |
| 1172 | } |
| 1173 | } |
| 1174 | |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1175 | static void __init msm7627a_rumi3_init(void) |
| 1176 | { |
| 1177 | msm7x27a_init_ebi2(); |
| 1178 | platform_add_devices(rumi_sim_devices, |
| 1179 | ARRAY_SIZE(rumi_sim_devices)); |
| 1180 | } |
| 1181 | |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1182 | static void __init msm8625_rumi3_init(void) |
| 1183 | { |
| 1184 | msm7x2x_misc_init(); |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1185 | msm_adsp_add_pdev(); |
| 1186 | msm8625_device_i2c_init(); |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1187 | platform_add_devices(msm8625_rumi3_devices, |
| 1188 | ARRAY_SIZE(msm8625_rumi3_devices)); |
| 1189 | } |
| 1190 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1191 | #define LED_GPIO_PDM 96 |
| 1192 | #define UART1DM_RX_GPIO 45 |
Santosh Sajjan | b479f0f | 2011-08-18 21:00:44 +0530 | [diff] [blame] | 1193 | |
| 1194 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
| 1195 | static int __init msm7x27a_init_ar6000pm(void) |
| 1196 | { |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 1197 | msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power; |
Santosh Sajjan | b479f0f | 2011-08-18 21:00:44 +0530 | [diff] [blame] | 1198 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 1199 | } |
| 1200 | #else |
| 1201 | static int __init msm7x27a_init_ar6000pm(void) { return 0; } |
| 1202 | #endif |
| 1203 | |
Justin Paupore | b3a33b7 | 2011-08-23 15:30:32 -0700 | [diff] [blame] | 1204 | static void __init msm7x27a_init_regulators(void) |
| 1205 | { |
| 1206 | int rc = platform_device_register(&msm_proccomm_regulator_dev); |
| 1207 | if (rc) |
| 1208 | pr_err("%s: could not register regulator device: %d\n", |
| 1209 | __func__, rc); |
| 1210 | } |
| 1211 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1212 | static void __init msm7x27a_add_footswitch_devices(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1213 | { |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1214 | platform_add_devices(msm_footswitch_devices, |
| 1215 | msm_num_footswitch_devices); |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1216 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1217 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1218 | static void __init msm7x27a_add_platform_devices(void) |
| 1219 | { |
| 1220 | if (machine_is_msm8625_surf()) { |
| 1221 | platform_add_devices(msm8625_surf_devices, |
| 1222 | ARRAY_SIZE(msm8625_surf_devices)); |
| 1223 | } else { |
| 1224 | platform_add_devices(msm7627a_surf_ffa_devices, |
| 1225 | ARRAY_SIZE(msm7627a_surf_ffa_devices)); |
| 1226 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1227 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1228 | platform_add_devices(common_devices, |
| 1229 | ARRAY_SIZE(common_devices)); |
| 1230 | } |
| 1231 | |
| 1232 | static void __init msm7x27a_uartdm_config(void) |
| 1233 | { |
| 1234 | msm7x27a_cfg_uart2dm_serial(); |
| 1235 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO); |
| 1236 | if (cpu_is_msm8625()) |
| 1237 | msm8625_device_uart_dm1.dev.platform_data = |
| 1238 | &msm_uart_dm1_pdata; |
| 1239 | else |
| 1240 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 1241 | } |
| 1242 | |
| 1243 | static void __init msm7x27a_otg_gadget(void) |
| 1244 | { |
| 1245 | msm_otg_pdata.swfi_latency = |
| 1246 | msm7x27a_pm_data[ |
| 1247 | MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
| 1248 | if (cpu_is_msm8625()) { |
| 1249 | msm8625_device_otg.dev.platform_data = &msm_otg_pdata; |
| 1250 | msm8625_device_gadget_peripheral.dev.platform_data = |
| 1251 | &msm_gadget_pdata; |
| 1252 | } else { |
| 1253 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 1254 | msm_device_gadget_peripheral.dev.platform_data = |
| 1255 | &msm_gadget_pdata; |
| 1256 | } |
| 1257 | } |
| 1258 | |
| 1259 | static void __init msm7x27a_add_io_devices(void) |
| 1260 | { |
| 1261 | /* touchscreen */ |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1262 | if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1263 | atmel_ts_pdata.min_x = 0; |
| 1264 | atmel_ts_pdata.max_x = 480; |
| 1265 | atmel_ts_pdata.min_y = 0; |
| 1266 | atmel_ts_pdata.max_y = 320; |
| 1267 | } |
| 1268 | |
| 1269 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1270 | atmel_ts_i2c_info, |
| 1271 | ARRAY_SIZE(atmel_ts_i2c_info)); |
| 1272 | /* keypad */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1273 | platform_device_register(&kp_pdev); |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1274 | |
| 1275 | /* headset */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1276 | platform_device_register(&hs_pdev); |
| 1277 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1278 | /* LED: configure it as a pdm function */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1279 | if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3, |
| 1280 | GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, |
| 1281 | GPIO_CFG_8MA), GPIO_CFG_ENABLE)) |
| 1282 | pr_err("%s: gpio_tlmm_config for %d failed\n", |
| 1283 | __func__, LED_GPIO_PDM); |
| 1284 | else |
| 1285 | platform_device_register(&led_pdev); |
| 1286 | |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1287 | /* Vibrator */ |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1288 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1289 | msm_init_pmic_vibrator(); |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1290 | } |
| 1291 | |
| 1292 | static void __init msm7x27a_pm_init(void) |
| 1293 | { |
| 1294 | if (machine_is_msm8625_surf()) |
| 1295 | return; |
| 1296 | |
| 1297 | msm_pm_set_platform_data(msm7x27a_pm_data, |
| 1298 | ARRAY_SIZE(msm7x27a_pm_data)); |
| 1299 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
| 1300 | } |
| 1301 | |
| 1302 | static void __init msm7x2x_init(void) |
| 1303 | { |
| 1304 | msm7x2x_misc_init(); |
| 1305 | |
| 1306 | /* Initialize regulators first so that other devices can use them */ |
| 1307 | msm7x27a_init_regulators(); |
| 1308 | msm_adsp_add_pdev(); |
| 1309 | if (cpu_is_msm8625()) |
| 1310 | msm8625_device_i2c_init(); |
| 1311 | else |
| 1312 | msm7x27a_device_i2c_init(); |
| 1313 | msm7x27a_init_ebi2(); |
| 1314 | msm7x27a_uartdm_config(); |
| 1315 | |
| 1316 | msm7x27a_otg_gadget(); |
| 1317 | msm7x27a_cfg_smsc911x(); |
| 1318 | |
| 1319 | msm7x27a_add_footswitch_devices(); |
| 1320 | msm7x27a_add_platform_devices(); |
| 1321 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 1322 | msm7x27a_init_ar6000pm(); |
| 1323 | msm7627a_init_mmc(); |
| 1324 | msm_fb_add_devices(); |
| 1325 | msm7x2x_init_host(); |
| 1326 | msm7x27a_pm_init(); |
| 1327 | register_i2c_devices(); |
| 1328 | msm7627a_bt_power_init(); |
| 1329 | msm7627a_camera_init(); |
| 1330 | msm7x27a_add_io_devices(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1331 | /*7x25a kgsl initializations*/ |
| 1332 | msm7x25a_kgsl_3d0_init(); |
| 1333 | } |
| 1334 | |
| 1335 | static void __init msm7x2x_init_early(void) |
| 1336 | { |
Chintan Pandya | 250c2e5 | 2012-01-19 17:15:49 +0530 | [diff] [blame] | 1337 | msm_msm7627a_allocate_memory_regions(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1338 | } |
| 1339 | |
| 1340 | MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3") |
| 1341 | .boot_params = PHYS_OFFSET + 0x100, |
| 1342 | .map_io = msm_common_io_init, |
| 1343 | .reserve = msm7x27a_reserve, |
| 1344 | .init_irq = msm_init_irq, |
Trilok Soni | 16f61af | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1345 | .init_machine = msm7627a_rumi3_init, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1346 | .timer = &msm_timer, |
| 1347 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 1348 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1349 | MACHINE_END |
| 1350 | MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF") |
| 1351 | .boot_params = PHYS_OFFSET + 0x100, |
| 1352 | .map_io = msm_common_io_init, |
| 1353 | .reserve = msm7x27a_reserve, |
| 1354 | .init_irq = msm_init_irq, |
| 1355 | .init_machine = msm7x2x_init, |
| 1356 | .timer = &msm_timer, |
| 1357 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 1358 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1359 | MACHINE_END |
| 1360 | MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA") |
| 1361 | .boot_params = PHYS_OFFSET + 0x100, |
| 1362 | .map_io = msm_common_io_init, |
| 1363 | .reserve = msm7x27a_reserve, |
| 1364 | .init_irq = msm_init_irq, |
| 1365 | .init_machine = msm7x2x_init, |
| 1366 | .timer = &msm_timer, |
| 1367 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 1368 | .handle_irq = vic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1369 | MACHINE_END |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1370 | MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF") |
| 1371 | .boot_params = PHYS_OFFSET + 0x100, |
| 1372 | .map_io = msm_common_io_init, |
| 1373 | .reserve = msm7x27a_reserve, |
| 1374 | .init_irq = msm_init_irq, |
| 1375 | .init_machine = msm7x2x_init, |
| 1376 | .timer = &msm_timer, |
| 1377 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 1378 | .handle_irq = vic_handle_irq, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1379 | MACHINE_END |
| 1380 | MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA") |
| 1381 | .boot_params = PHYS_OFFSET + 0x100, |
| 1382 | .map_io = msm_common_io_init, |
| 1383 | .reserve = msm7x27a_reserve, |
| 1384 | .init_irq = msm_init_irq, |
| 1385 | .init_machine = msm7x2x_init, |
| 1386 | .timer = &msm_timer, |
| 1387 | .init_early = msm7x2x_init_early, |
Taniya Das | 86e0e13 | 2011-10-19 11:32:00 +0530 | [diff] [blame] | 1388 | .handle_irq = vic_handle_irq, |
Trilok Soni | 3d0f6c5 | 2011-07-26 16:06:58 +0530 | [diff] [blame] | 1389 | MACHINE_END |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1390 | MACHINE_START(MSM8625_RUMI3, "QCT MSM8625 RUMI3") |
| 1391 | .boot_params = PHYS_OFFSET + 0x100, |
| 1392 | .map_io = msm8625_map_io, |
Taniya Das | 2b16d1d | 2011-12-02 14:44:19 +0530 | [diff] [blame] | 1393 | .reserve = msm8625_reserve, |
Taniya Das | 43bcdd6 | 2011-12-02 17:33:27 +0530 | [diff] [blame] | 1394 | .init_irq = msm8625_init_irq, |
| 1395 | .init_machine = msm8625_rumi3_init, |
| 1396 | .timer = &msm_timer, |
| 1397 | .handle_irq = gic_handle_irq, |
| 1398 | MACHINE_END |
Taniya Das | e3027e2 | 2012-02-27 16:32:27 +0530 | [diff] [blame] | 1399 | MACHINE_START(MSM8625_SURF, "QCT MSM8625 SURF") |
| 1400 | .boot_params = PHYS_OFFSET + 0x100, |
| 1401 | .map_io = msm8625_map_io, |
| 1402 | .reserve = msm8625_reserve, |
| 1403 | .init_irq = msm8625_init_irq, |
| 1404 | .init_machine = msm7x2x_init, |
| 1405 | .timer = &msm_timer, |
| 1406 | .init_early = msm7x2x_init_early, |
| 1407 | .handle_irq = gic_handle_irq, |
| 1408 | MACHINE_END |