Sravan Kumar Ambapuram | b22cf4d | 2012-01-02 21:45:04 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/gpio_event.h> |
Pankaj Kumar | 6f84174 | 2011-10-10 15:52:14 +0530 | [diff] [blame] | 16 | #include <linux/usb/android.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/io.h> |
| 19 | #include <linux/gpio.h> |
| 20 | #include <linux/mtd/nand.h> |
| 21 | #include <linux/mtd/partitions.h> |
| 22 | #include <linux/i2c.h> |
| 23 | #include <linux/android_pmem.h> |
| 24 | #include <linux/bootmem.h> |
| 25 | #include <linux/mfd/marimba.h> |
| 26 | #include <linux/power_supply.h> |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 27 | #include <linux/input/rmi_platformdata.h> |
| 28 | #include <linux/input/rmi_i2c.h> |
| 29 | #include <linux/i2c/atmel_mxt_ts.h> |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 30 | #include <linux/regulator/consumer.h> |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 31 | #include <linux/memblock.h> |
Mohan Pallaka | 5afe985 | 2012-01-12 23:12:06 +0530 | [diff] [blame] | 32 | #include <linux/input/ft5x06_ts.h> |
Siddartha Mohanadoss | bc2103f | 2012-03-20 11:41:48 -0700 | [diff] [blame] | 33 | #include <linux/msm_adc.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 34 | #include <asm/mach/mmc.h> |
| 35 | #include <asm/mach-types.h> |
| 36 | #include <asm/mach/arch.h> |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 37 | #include <asm/hardware/gic.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 38 | #include <mach/board.h> |
| 39 | #include <mach/msm_iomap.h> |
| 40 | #include <mach/msm_hsusb.h> |
| 41 | #include <mach/rpc_hsusb.h> |
| 42 | #include <mach/rpc_pmapp.h> |
| 43 | #include <mach/usbdiag.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 44 | #include <mach/msm_memtypes.h> |
| 45 | #include <mach/msm_serial_hs.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 46 | #include <mach/pmic.h> |
| 47 | #include <mach/socinfo.h> |
| 48 | #include <mach/vreg.h> |
| 49 | #include <mach/rpc_pmapp.h> |
| 50 | #include <mach/msm_battery.h> |
| 51 | #include <mach/rpc_server_handset.h> |
| 52 | #include <mach/socinfo.h> |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 53 | #include "board-msm7x27a-regulator.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 54 | #include "devices.h" |
| 55 | #include "devices-msm7x2xa.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 56 | #include "pm.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 57 | #include "timer.h" |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 58 | #include "pm-boot.h" |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 59 | #include "board-msm7x27a-regulator.h" |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 60 | #include "board-msm7627a.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 61 | |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 62 | #define PMEM_KERNEL_EBI1_SIZE 0x3A000 |
Sidipotu Ashok | 4f1ddc9 | 2012-04-11 13:51:34 +0530 | [diff] [blame] | 63 | #define MSM_PMEM_AUDIO_SIZE 0x1F4000 |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 64 | #define BAHAMA_SLAVE_ID_FM_REG 0x02 |
| 65 | #define FM_GPIO 83 |
| 66 | #define BT_PCM_BCLK_MODE 0x88 |
| 67 | #define BT_PCM_DIN_MODE 0x89 |
| 68 | #define BT_PCM_DOUT_MODE 0x8A |
| 69 | #define BT_PCM_SYNC_MODE 0x8B |
| 70 | #define FM_I2S_SD_MODE 0x8E |
| 71 | #define FM_I2S_WS_MODE 0x8F |
| 72 | #define FM_I2S_SCK_MODE 0x90 |
| 73 | #define I2C_PIN_CTL 0x15 |
| 74 | #define I2C_NORMAL 0x40 |
| 75 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 76 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 77 | .name = "wlan_ar6000_pm_dev", |
| 78 | .id = -1, |
| 79 | }; |
| 80 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 81 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 82 | { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 83 | "qup_scl" }, |
| 84 | { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 85 | "qup_sda" }, |
| 86 | { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 87 | "qup_scl" }, |
| 88 | { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 89 | "qup_sda" }, |
| 90 | }; |
| 91 | |
| 92 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 93 | { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 94 | "qup_scl" }, |
| 95 | { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 96 | "qup_sda" }, |
| 97 | { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 98 | "qup_scl" }, |
| 99 | { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 100 | "qup_sda" }, |
| 101 | }; |
| 102 | |
| 103 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 104 | { |
| 105 | int rc; |
| 106 | |
| 107 | if (adap_id < 0 || adap_id > 1) |
| 108 | return; |
| 109 | |
| 110 | /* Each adapter gets 2 lines from the table */ |
| 111 | if (config_type) |
| 112 | rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2); |
| 113 | else |
| 114 | rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2); |
| 115 | if (rc < 0) |
| 116 | pr_err("QUP GPIO request/enable failed: %d\n", rc); |
| 117 | } |
| 118 | |
| 119 | static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = { |
| 120 | .clk_freq = 100000, |
| 121 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 122 | }; |
| 123 | |
| 124 | static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = { |
| 125 | .clk_freq = 100000, |
| 126 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 127 | }; |
| 128 | |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 129 | #ifdef CONFIG_ARCH_MSM7X27A |
Sravan Kumar D.V.N | d0b59d6 | 2012-04-17 15:08:14 +0530 | [diff] [blame] | 130 | #define MSM_PMEM_MDP_SIZE 0x2300000 |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 131 | #define MSM_PMEM_ADSP_SIZE 0x1100000 |
| 132 | #endif |
| 133 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 134 | static struct android_usb_platform_data android_usb_pdata = { |
Pankaj Kumar | 6f84174 | 2011-10-10 15:52:14 +0530 | [diff] [blame] | 135 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 136 | }; |
| 137 | |
| 138 | static struct platform_device android_usb_device = { |
| 139 | .name = "android_usb", |
| 140 | .id = -1, |
| 141 | .dev = { |
| 142 | .platform_data = &android_usb_pdata, |
| 143 | }, |
| 144 | }; |
| 145 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 146 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 147 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 148 | { |
| 149 | int rc = 0; |
| 150 | unsigned gpio; |
| 151 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 152 | gpio = QRD_GPIO_HOST_VBUS_EN; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 153 | |
| 154 | rc = gpio_request(gpio, "i2c_host_vbus_en"); |
| 155 | if (rc < 0) { |
| 156 | pr_err("failed to request %d GPIO\n", gpio); |
| 157 | return; |
| 158 | } |
| 159 | gpio_direction_output(gpio, !!on); |
| 160 | gpio_set_value_cansleep(gpio, !!on); |
| 161 | gpio_free(gpio); |
| 162 | } |
| 163 | |
| 164 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 165 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 166 | }; |
| 167 | |
| 168 | static void __init msm7627a_init_host(void) |
| 169 | { |
| 170 | msm_add_host(0, &msm_usb_host_pdata); |
| 171 | } |
| 172 | #endif |
| 173 | |
| 174 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 175 | static int hsusb_rpc_connect(int connect) |
| 176 | { |
| 177 | if (connect) |
| 178 | return msm_hsusb_rpc_connect(); |
| 179 | else |
| 180 | return msm_hsusb_rpc_close(); |
| 181 | } |
| 182 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 183 | static struct regulator *reg_hsusb; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 184 | static int msm_hsusb_ldo_init(int init) |
| 185 | { |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 186 | int rc = 0; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 187 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 188 | if (init) { |
| 189 | reg_hsusb = regulator_get(NULL, "usb"); |
| 190 | if (IS_ERR(reg_hsusb)) { |
| 191 | rc = PTR_ERR(reg_hsusb); |
| 192 | pr_err("%s: could not get regulator: %d\n", |
| 193 | __func__, rc); |
| 194 | goto out; |
| 195 | } |
| 196 | |
| 197 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); |
| 198 | if (rc) { |
| 199 | pr_err("%s: could not set voltage: %d\n", |
| 200 | __func__, rc); |
| 201 | goto reg_free; |
| 202 | } |
| 203 | |
| 204 | return 0; |
| 205 | } |
| 206 | /* else fall through */ |
| 207 | reg_free: |
| 208 | regulator_put(reg_hsusb); |
| 209 | out: |
| 210 | reg_hsusb = NULL; |
| 211 | return rc; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | static int msm_hsusb_ldo_enable(int enable) |
| 215 | { |
| 216 | static int ldo_status; |
| 217 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 218 | if (IS_ERR_OR_NULL(reg_hsusb)) |
| 219 | return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 220 | |
| 221 | if (ldo_status == enable) |
| 222 | return 0; |
| 223 | |
| 224 | ldo_status = enable; |
| 225 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 226 | return enable ? |
| 227 | regulator_enable(reg_hsusb) : |
| 228 | regulator_disable(reg_hsusb); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 232 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 233 | { |
| 234 | int ret = 0; |
| 235 | |
| 236 | if (init) |
| 237 | ret = msm_pm_app_rpc_init(callback); |
| 238 | else |
| 239 | msm_pm_app_rpc_deinit(callback); |
| 240 | |
| 241 | return ret; |
| 242 | } |
| 243 | #endif |
| 244 | |
| 245 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 246 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 247 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 248 | #else |
| 249 | .vbus_power = msm_hsusb_vbus_power, |
| 250 | #endif |
| 251 | .rpc_connect = hsusb_rpc_connect, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 252 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 253 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 254 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 255 | .se1_gating = SE1_GATING_DISABLE, |
| 256 | .ldo_init = msm_hsusb_ldo_init, |
| 257 | .ldo_enable = msm_hsusb_ldo_enable, |
| 258 | .chg_init = hsusb_chg_init, |
| 259 | .chg_connected = hsusb_chg_connected, |
| 260 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 261 | }; |
| 262 | #endif |
| 263 | |
| 264 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 265 | .is_phy_status_timer_on = 1, |
| 266 | }; |
| 267 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 268 | #ifdef CONFIG_SERIAL_MSM_HS |
| 269 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 270 | .inject_rx_on_wakeup = 1, |
| 271 | .rx_to_inject = 0xFD, |
| 272 | }; |
| 273 | #endif |
| 274 | static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 275 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = { |
| 276 | .idle_supported = 1, |
| 277 | .suspend_supported = 1, |
| 278 | .idle_enabled = 1, |
| 279 | .suspend_enabled = 1, |
| 280 | .latency = 16000, |
| 281 | .residency = 20000, |
| 282 | }, |
| 283 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = { |
| 284 | .idle_supported = 1, |
| 285 | .suspend_supported = 1, |
| 286 | .idle_enabled = 1, |
| 287 | .suspend_enabled = 1, |
| 288 | .latency = 12000, |
| 289 | .residency = 20000, |
| 290 | }, |
| 291 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = { |
| 292 | .idle_supported = 1, |
| 293 | .suspend_supported = 1, |
| 294 | .idle_enabled = 0, |
| 295 | .suspend_enabled = 1, |
| 296 | .latency = 2000, |
| 297 | .residency = 0, |
| 298 | }, |
| 299 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = { |
| 300 | .idle_supported = 1, |
| 301 | .suspend_supported = 1, |
| 302 | .idle_enabled = 1, |
| 303 | .suspend_enabled = 1, |
| 304 | .latency = 2, |
| 305 | .residency = 0, |
| 306 | }, |
| 307 | }; |
| 308 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 309 | 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] | 310 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS, |
| 311 | .p_addr = 0, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 312 | }; |
| 313 | |
Murali Nalajala | 4c996be | 2012-03-12 17:05:41 +0530 | [diff] [blame] | 314 | /* 8625 PM platform data */ |
| 315 | static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { |
| 316 | /* CORE0 entries */ |
| 317 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 318 | .idle_supported = 1, |
| 319 | .suspend_supported = 1, |
| 320 | .idle_enabled = 0, |
| 321 | .suspend_enabled = 0, |
| 322 | .latency = 16000, |
| 323 | .residency = 20000, |
| 324 | }, |
| 325 | |
| 326 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = { |
| 327 | .idle_supported = 1, |
| 328 | .suspend_supported = 1, |
| 329 | .idle_enabled = 0, |
| 330 | .suspend_enabled = 0, |
| 331 | .latency = 12000, |
| 332 | .residency = 20000, |
| 333 | }, |
| 334 | |
| 335 | /* picked latency & redisdency values from 7x30 */ |
| 336 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 337 | .idle_supported = 1, |
| 338 | .suspend_supported = 1, |
| 339 | .idle_enabled = 0, |
| 340 | .suspend_enabled = 0, |
| 341 | .latency = 500, |
| 342 | .residency = 6000, |
| 343 | }, |
| 344 | |
| 345 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 346 | .idle_supported = 1, |
| 347 | .suspend_supported = 1, |
| 348 | .idle_enabled = 1, |
| 349 | .suspend_enabled = 1, |
| 350 | .latency = 2, |
| 351 | .residency = 10, |
| 352 | }, |
| 353 | |
| 354 | /* picked latency & redisdency values from 7x30 */ |
| 355 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 356 | .idle_supported = 1, |
| 357 | .suspend_supported = 1, |
| 358 | .idle_enabled = 0, |
| 359 | .suspend_enabled = 0, |
| 360 | .latency = 500, |
| 361 | .residency = 6000, |
| 362 | }, |
| 363 | |
| 364 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 365 | .idle_supported = 1, |
| 366 | .suspend_supported = 1, |
| 367 | .idle_enabled = 1, |
| 368 | .suspend_enabled = 1, |
| 369 | .latency = 2, |
| 370 | .residency = 10, |
| 371 | }, |
| 372 | |
| 373 | }; |
| 374 | |
| 375 | static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = { |
| 376 | .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR, |
| 377 | .v_addr = MSM_CFG_CTL_BASE, |
| 378 | }; |
| 379 | |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 380 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 381 | .name = "pmem_adsp", |
| 382 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 383 | .cached = 1, |
| 384 | .memory_type = MEMTYPE_EBI1, |
| 385 | }; |
| 386 | |
| 387 | static struct platform_device android_pmem_adsp_device = { |
| 388 | .name = "android_pmem", |
| 389 | .id = 1, |
| 390 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 391 | }; |
| 392 | |
| 393 | static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 394 | static int __init pmem_mdp_size_setup(char *p) |
| 395 | { |
| 396 | pmem_mdp_size = memparse(p, NULL); |
| 397 | return 0; |
| 398 | } |
| 399 | |
| 400 | early_param("pmem_mdp_size", pmem_mdp_size_setup); |
| 401 | |
| 402 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 403 | static int __init pmem_adsp_size_setup(char *p) |
| 404 | { |
| 405 | pmem_adsp_size = memparse(p, NULL); |
| 406 | return 0; |
| 407 | } |
| 408 | |
| 409 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 410 | |
| 411 | #define SND(desc, num) { .name = #desc, .id = num } |
| 412 | static struct snd_endpoint snd_endpoints_list[] = { |
| 413 | SND(HANDSET, 0), |
| 414 | SND(MONO_HEADSET, 2), |
| 415 | SND(HEADSET, 3), |
| 416 | SND(SPEAKER, 6), |
| 417 | SND(TTY_HEADSET, 8), |
| 418 | SND(TTY_VCO, 9), |
| 419 | SND(TTY_HCO, 10), |
| 420 | SND(BT, 12), |
| 421 | SND(IN_S_SADC_OUT_HANDSET, 16), |
| 422 | SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25), |
| 423 | SND(FM_DIGITAL_STEREO_HEADSET, 26), |
| 424 | SND(FM_DIGITAL_SPEAKER_PHONE, 27), |
| 425 | SND(FM_DIGITAL_BT_A2DP_HEADSET, 28), |
| 426 | SND(STEREO_HEADSET_AND_SPEAKER, 31), |
| 427 | SND(CURRENT, 0x7FFFFFFE), |
| 428 | SND(FM_ANALOG_STEREO_HEADSET, 35), |
| 429 | SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36), |
| 430 | }; |
| 431 | #undef SND |
| 432 | |
| 433 | static struct msm_snd_endpoints msm_device_snd_endpoints = { |
| 434 | .endpoints = snd_endpoints_list, |
| 435 | .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint) |
| 436 | }; |
| 437 | |
| 438 | static struct platform_device msm_device_snd = { |
| 439 | .name = "msm_snd", |
| 440 | .id = -1, |
| 441 | .dev = { |
| 442 | .platform_data = &msm_device_snd_endpoints |
| 443 | }, |
| 444 | }; |
| 445 | |
| 446 | #define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 447 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 448 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 449 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 450 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 451 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 452 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 453 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 454 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 455 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 456 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 457 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 458 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 459 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 460 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 461 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 462 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 463 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 464 | #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 465 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 466 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 467 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 468 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 469 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 470 | #define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI) |
| 471 | |
| 472 | static unsigned int dec_concurrency_table[] = { |
| 473 | /* Audio LP */ |
| 474 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0, |
| 475 | 0, 0, 0, |
| 476 | |
| 477 | /* Concurrency 1 */ |
| 478 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 479 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 480 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 481 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 482 | (DEC4_FORMAT), |
| 483 | |
| 484 | /* Concurrency 2 */ |
| 485 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 486 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 487 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 488 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 489 | (DEC4_FORMAT), |
| 490 | |
| 491 | /* Concurrency 3 */ |
| 492 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 493 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 494 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 495 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 496 | (DEC4_FORMAT), |
| 497 | |
| 498 | /* Concurrency 4 */ |
| 499 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 500 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 501 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 502 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 503 | (DEC4_FORMAT), |
| 504 | |
| 505 | /* Concurrency 5 */ |
| 506 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 507 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 508 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 509 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 510 | (DEC4_FORMAT), |
| 511 | |
| 512 | /* Concurrency 6 */ |
Chaithanya Krishna Bacharaju | 41f09e2 | 2012-04-30 14:56:17 +0530 | [diff] [blame] | 513 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 514 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
Sidipotu Ashok | 451d844 | 2012-04-12 12:12:23 +0530 | [diff] [blame] | 515 | 0, 0, 0, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 516 | |
| 517 | /* Concurrency 7 */ |
| 518 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 519 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 520 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 521 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 522 | (DEC4_FORMAT), |
| 523 | }; |
| 524 | |
| 525 | #define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \ |
| 526 | .module_queueid = queueid, .module_decid = decid, \ |
| 527 | .nr_codec_support = nr_codec} |
| 528 | |
| 529 | static struct msm_adspdec_info dec_info_list[] = { |
| 530 | DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */ |
| 531 | DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */ |
| 532 | DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */ |
| 533 | DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */ |
| 534 | DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */ |
| 535 | }; |
| 536 | |
| 537 | static struct msm_adspdec_database msm_device_adspdec_database = { |
| 538 | .num_dec = ARRAY_SIZE(dec_info_list), |
| 539 | .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \ |
| 540 | ARRAY_SIZE(dec_info_list)), |
| 541 | .dec_concurrency_table = dec_concurrency_table, |
| 542 | .dec_info_list = dec_info_list, |
| 543 | }; |
| 544 | |
| 545 | static struct platform_device msm_device_adspdec = { |
| 546 | .name = "msm_adspdec", |
| 547 | .id = -1, |
| 548 | .dev = { |
| 549 | .platform_data = &msm_device_adspdec_database |
| 550 | }, |
| 551 | }; |
| 552 | |
| 553 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 554 | .name = "pmem_audio", |
| 555 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 556 | .cached = 0, |
| 557 | .memory_type = MEMTYPE_EBI1, |
| 558 | }; |
| 559 | |
| 560 | static struct platform_device android_pmem_audio_device = { |
| 561 | .name = "android_pmem", |
| 562 | .id = 2, |
| 563 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 564 | }; |
| 565 | |
| 566 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 567 | .name = "pmem", |
| 568 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 569 | .cached = 1, |
| 570 | .memory_type = MEMTYPE_EBI1, |
| 571 | }; |
| 572 | static struct platform_device android_pmem_device = { |
| 573 | .name = "android_pmem", |
| 574 | .id = 0, |
| 575 | .dev = { .platform_data = &android_pmem_pdata }, |
| 576 | }; |
| 577 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 578 | static u32 msm_calculate_batt_capacity(u32 current_voltage); |
| 579 | |
| 580 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 581 | .voltage_min_design = 2800, |
| 582 | .voltage_max_design = 4300, |
| 583 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 584 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 585 | .calculate_capacity = &msm_calculate_batt_capacity, |
| 586 | }; |
| 587 | |
| 588 | static u32 msm_calculate_batt_capacity(u32 current_voltage) |
| 589 | { |
| 590 | u32 low_voltage = msm_psy_batt_data.voltage_min_design; |
| 591 | u32 high_voltage = msm_psy_batt_data.voltage_max_design; |
| 592 | |
| 593 | return (current_voltage - low_voltage) * 100 |
| 594 | / (high_voltage - low_voltage); |
| 595 | } |
| 596 | |
| 597 | static struct platform_device msm_batt_device = { |
| 598 | .name = "msm-battery", |
| 599 | .id = -1, |
| 600 | .dev.platform_data = &msm_psy_batt_data, |
| 601 | }; |
| 602 | |
Siddartha Mohanadoss | bc2103f | 2012-03-20 11:41:48 -0700 | [diff] [blame] | 603 | static char *msm_adc_surf_device_names[] = { |
| 604 | "XO_ADC", |
| 605 | }; |
| 606 | |
| 607 | static struct msm_adc_platform_data msm_adc_pdata = { |
| 608 | .dev_names = msm_adc_surf_device_names, |
| 609 | .num_adc = ARRAY_SIZE(msm_adc_surf_device_names), |
| 610 | .target_hw = MSM_8x25, |
| 611 | }; |
| 612 | |
| 613 | static struct platform_device msm_adc_device = { |
| 614 | .name = "msm_adc", |
| 615 | .id = -1, |
| 616 | .dev = { |
| 617 | .platform_data = &msm_adc_pdata, |
| 618 | }, |
| 619 | }; |
| 620 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 621 | static struct platform_device *common_devices[] __initdata = { |
| 622 | &android_usb_device, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 623 | &android_pmem_device, |
| 624 | &android_pmem_adsp_device, |
| 625 | &android_pmem_audio_device, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 626 | &msm_batt_device, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 627 | &msm_device_adspdec, |
| 628 | &msm_device_snd, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 629 | &asoc_msm_pcm, |
| 630 | &asoc_msm_dai0, |
| 631 | &asoc_msm_dai1, |
Siddartha Mohanadoss | bc2103f | 2012-03-20 11:41:48 -0700 | [diff] [blame] | 632 | &msm_adc_device, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 633 | }; |
| 634 | |
| 635 | static struct platform_device *qrd7627a_devices[] __initdata = { |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 636 | &msm_device_dmov, |
| 637 | &msm_device_smd, |
| 638 | &msm_device_uart1, |
| 639 | &msm_device_uart_dm1, |
| 640 | &msm_gsbi0_qup_i2c_device, |
| 641 | &msm_gsbi1_qup_i2c_device, |
| 642 | &msm_device_otg, |
| 643 | &msm_device_gadget_peripheral, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 644 | &msm_kgsl_3d0, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 645 | }; |
| 646 | |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 647 | static struct platform_device *qrd3_devices[] __initdata = { |
| 648 | &msm_device_nand, |
| 649 | }; |
| 650 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 651 | static struct platform_device *msm8625_evb_devices[] __initdata = { |
| 652 | &msm8625_device_dmov, |
| 653 | &msm8625_device_smd, |
| 654 | &msm8625_gsbi0_qup_i2c_device, |
| 655 | &msm8625_gsbi1_qup_i2c_device, |
| 656 | &msm8625_device_uart1, |
Ram Mohan Korukonda | 5ee9fb8 | 2012-03-09 12:10:01 +0530 | [diff] [blame] | 657 | &msm8625_device_uart_dm1, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 658 | &msm8625_device_otg, |
| 659 | &msm8625_device_gadget_peripheral, |
Aparna Mallavarapu | d95d8fc | 2012-03-08 12:07:37 +0530 | [diff] [blame] | 660 | &msm8625_kgsl_3d0, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 661 | }; |
| 662 | |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 663 | static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE; |
| 664 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 665 | { |
| 666 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 667 | return 0; |
| 668 | } |
| 669 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 670 | |
| 671 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 672 | static int __init pmem_audio_size_setup(char *p) |
| 673 | { |
| 674 | pmem_audio_size = memparse(p, NULL); |
| 675 | return 0; |
| 676 | } |
| 677 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 678 | |
| 679 | static struct memtype_reserve msm7627a_reserve_table[] __initdata = { |
| 680 | [MEMTYPE_SMI] = { |
| 681 | }, |
| 682 | [MEMTYPE_EBI0] = { |
| 683 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 684 | }, |
| 685 | [MEMTYPE_EBI1] = { |
| 686 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 687 | }, |
| 688 | }; |
| 689 | |
| 690 | static void __init size_pmem_devices(void) |
| 691 | { |
| 692 | #ifdef CONFIG_ANDROID_PMEM |
| 693 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 694 | android_pmem_pdata.size = pmem_mdp_size; |
| 695 | android_pmem_audio_pdata.size = pmem_audio_size; |
| 696 | #endif |
| 697 | } |
| 698 | |
| 699 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 700 | { |
| 701 | msm7627a_reserve_table[p->memory_type].size += p->size; |
| 702 | } |
| 703 | |
| 704 | static void __init reserve_pmem_memory(void) |
| 705 | { |
| 706 | #ifdef CONFIG_ANDROID_PMEM |
| 707 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 708 | reserve_memory_for(&android_pmem_pdata); |
| 709 | reserve_memory_for(&android_pmem_audio_pdata); |
| 710 | msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 711 | #endif |
| 712 | } |
| 713 | |
| 714 | static void __init msm7627a_calculate_reserve_sizes(void) |
| 715 | { |
| 716 | size_pmem_devices(); |
| 717 | reserve_pmem_memory(); |
| 718 | } |
| 719 | |
| 720 | static int msm7627a_paddr_to_memtype(unsigned int paddr) |
| 721 | { |
| 722 | return MEMTYPE_EBI1; |
| 723 | } |
| 724 | |
| 725 | static struct reserve_info msm7627a_reserve_info __initdata = { |
| 726 | .memtype_reserve_table = msm7627a_reserve_table, |
| 727 | .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes, |
| 728 | .paddr_to_memtype = msm7627a_paddr_to_memtype, |
| 729 | }; |
| 730 | |
| 731 | static void __init msm7627a_reserve(void) |
| 732 | { |
| 733 | reserve_info = &msm7627a_reserve_info; |
| 734 | msm_reserve(); |
| 735 | memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32); |
| 736 | } |
| 737 | |
| 738 | static void __init msm8625_reserve(void) |
| 739 | { |
| 740 | memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8); |
| 741 | msm7627a_reserve(); |
| 742 | } |
| 743 | |
| 744 | static void msmqrd_adsp_add_pdev(void) |
| 745 | { |
| 746 | int rc = 0; |
| 747 | struct rpc_board_dev *rpc_adsp_pdev; |
| 748 | |
| 749 | rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL); |
| 750 | if (rpc_adsp_pdev == NULL) { |
| 751 | pr_err("%s: Memory Allocation failure\n", __func__); |
| 752 | return; |
| 753 | } |
| 754 | rpc_adsp_pdev->prog = ADSP_RPC_PROG; |
| 755 | |
| 756 | if (cpu_is_msm8625()) |
| 757 | rpc_adsp_pdev->pdev = msm8625_device_adsp; |
| 758 | else |
| 759 | rpc_adsp_pdev->pdev = msm_adsp_device; |
| 760 | rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1); |
| 761 | if (rc < 0) { |
| 762 | pr_err("%s: return val: %d\n", __func__, rc); |
| 763 | kfree(rpc_adsp_pdev); |
| 764 | } |
| 765 | } |
| 766 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 767 | static void __init msm7627a_device_i2c_init(void) |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 768 | { |
| 769 | msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata; |
| 770 | msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata; |
| 771 | } |
| 772 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 773 | static void __init msm8625_device_i2c_init(void) |
| 774 | { |
| 775 | msm8625_gsbi0_qup_i2c_device.dev.platform_data |
| 776 | = &msm_gsbi0_qup_i2c_pdata; |
| 777 | msm8625_gsbi1_qup_i2c_device.dev.platform_data |
| 778 | = &msm_gsbi1_qup_i2c_pdata; |
| 779 | } |
| 780 | |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 781 | static struct platform_device msm_proccomm_regulator_dev = { |
| 782 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 783 | .id = -1, |
| 784 | .dev = { |
| 785 | .platform_data = &msm7x27a_proccomm_regulator_data |
| 786 | } |
| 787 | }; |
| 788 | |
| 789 | static void __init msm7627a_init_regulators(void) |
| 790 | { |
| 791 | int rc = platform_device_register(&msm_proccomm_regulator_dev); |
| 792 | if (rc) |
| 793 | pr_err("%s: could not register regulator device: %d\n", |
| 794 | __func__, rc); |
| 795 | } |
| 796 | |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 797 | static int __init msm_qrd_init_ar6000pm(void) |
| 798 | { |
| 799 | msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power; |
| 800 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 801 | } |
| 802 | |
Taniya Das | e380a2d | 2012-03-09 13:02:41 +0530 | [diff] [blame] | 803 | static void __init msm_add_footswitch_devices(void) |
| 804 | { |
| 805 | platform_add_devices(msm_footswitch_devices, |
| 806 | msm_num_footswitch_devices); |
| 807 | } |
| 808 | |
Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 809 | static void __init add_platform_devices(void) |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 810 | { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 811 | if (machine_is_msm8625_evb() || machine_is_msm8625_qrd7()) { |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 812 | platform_add_devices(msm8625_evb_devices, |
| 813 | ARRAY_SIZE(msm8625_evb_devices)); |
Aparna Mallavarapu | beafcbc | 2012-03-13 16:57:39 +0530 | [diff] [blame] | 814 | platform_add_devices(qrd3_devices, |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 815 | ARRAY_SIZE(qrd3_devices)); |
Aparna Mallavarapu | beafcbc | 2012-03-13 16:57:39 +0530 | [diff] [blame] | 816 | } else { |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 817 | platform_add_devices(qrd7627a_devices, |
| 818 | ARRAY_SIZE(qrd7627a_devices)); |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 819 | } |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 820 | |
Aparna Mallavarapu | 0b69ca2 | 2012-03-26 15:58:35 +0530 | [diff] [blame] | 821 | if (machine_is_msm7627a_qrd3() || machine_is_msm7627a_evb()) |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 822 | platform_add_devices(qrd3_devices, |
Aparna Mallavarapu | 0b69ca2 | 2012-03-26 15:58:35 +0530 | [diff] [blame] | 823 | ARRAY_SIZE(qrd3_devices)); |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 824 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 825 | platform_add_devices(common_devices, |
| 826 | ARRAY_SIZE(common_devices)); |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 827 | } |
| 828 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 829 | #define UART1DM_RX_GPIO 45 |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 830 | static void __init qrd7627a_uart1dm_config(void) |
| 831 | { |
| 832 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO); |
| 833 | if (cpu_is_msm8625()) |
| 834 | msm8625_device_uart_dm1.dev.platform_data = |
| 835 | &msm_uart_dm1_pdata; |
| 836 | else |
| 837 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 838 | } |
| 839 | |
| 840 | static void __init qrd7627a_otg_gadget(void) |
| 841 | { |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 842 | if (cpu_is_msm8625()) { |
Murali Nalajala | 6ff8fb1 | 2012-05-02 18:50:50 +0530 | [diff] [blame^] | 843 | msm_otg_pdata.swfi_latency = msm8625_pm_data |
| 844 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT].latency; |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 845 | msm8625_device_otg.dev.platform_data = &msm_otg_pdata; |
| 846 | msm8625_device_gadget_peripheral.dev.platform_data = |
| 847 | &msm_gadget_pdata; |
| 848 | |
| 849 | } else { |
Murali Nalajala | 6ff8fb1 | 2012-05-02 18:50:50 +0530 | [diff] [blame^] | 850 | msm_otg_pdata.swfi_latency = msm7627a_pm_data |
| 851 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 852 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 853 | msm_device_gadget_peripheral.dev.platform_data = |
| 854 | &msm_gadget_pdata; |
| 855 | } |
| 856 | } |
| 857 | |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 858 | static void __init msm_pm_init(void) |
| 859 | { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 860 | |
Aparna Mallavarapu | 6d969eb | 2012-04-03 15:10:25 +0530 | [diff] [blame] | 861 | if (!cpu_is_msm8625()) { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 862 | msm_pm_set_platform_data(msm7627a_pm_data, |
| 863 | ARRAY_SIZE(msm7627a_pm_data)); |
| 864 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
| 865 | } else { |
| 866 | msm_pm_set_platform_data(msm8625_pm_data, |
| 867 | ARRAY_SIZE(msm8625_pm_data)); |
| 868 | BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata)); |
| 869 | msm8x25_spm_device_init(); |
| 870 | } |
| 871 | } |
| 872 | |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 873 | static void __init msm_qrd_init(void) |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 874 | { |
| 875 | msm7x2x_misc_init(); |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 876 | msm7627a_init_regulators(); |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 877 | msmqrd_adsp_add_pdev(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 878 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 879 | if (cpu_is_msm8625()) |
| 880 | msm8625_device_i2c_init(); |
| 881 | else |
| 882 | msm7627a_device_i2c_init(); |
| 883 | |
| 884 | /* uart1dm*/ |
| 885 | qrd7627a_uart1dm_config(); |
| 886 | /*OTG gadget*/ |
| 887 | qrd7627a_otg_gadget(); |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 888 | |
Taniya Das | e380a2d | 2012-03-09 13:02:41 +0530 | [diff] [blame] | 889 | msm_add_footswitch_devices(); |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 890 | add_platform_devices(); |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 891 | |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 892 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 893 | msm_qrd_init_ar6000pm(); |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 894 | msm7627a_init_mmc(); |
| 895 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 896 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 897 | msm7627a_init_host(); |
| 898 | #endif |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 899 | msm_pm_init(); |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 900 | |
Murali Nalajala | 2a0bbda | 2012-03-28 12:12:54 +0530 | [diff] [blame] | 901 | msm_pm_register_irqs(); |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 902 | msm_fb_add_devices(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 903 | |
| 904 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
Chintan Pandya | 13490c0 | 2011-12-20 13:03:36 +0530 | [diff] [blame] | 905 | msm7627a_bt_power_init(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 906 | #endif |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 907 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 908 | msm7627a_camera_init(); |
Chintan Pandya | 0d45319 | 2012-03-09 13:20:33 +0530 | [diff] [blame] | 909 | qrd7627a_add_io_devices(); |
Aparna Mallavarapu | d95d8fc | 2012-03-08 12:07:37 +0530 | [diff] [blame] | 910 | msm7x25a_kgsl_3d0_init(); |
Sudhakara Rao Tentu | 38ad6e1 | 2012-03-30 15:25:18 -0700 | [diff] [blame] | 911 | msm8x25_kgsl_3d0_init(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 912 | } |
| 913 | |
| 914 | static void __init qrd7627a_init_early(void) |
| 915 | { |
| 916 | msm_msm7627a_allocate_memory_regions(); |
| 917 | } |
| 918 | |
| 919 | MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1") |
| 920 | .boot_params = PHYS_OFFSET + 0x100, |
| 921 | .map_io = msm_common_io_init, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 922 | .reserve = msm7627a_reserve, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 923 | .init_irq = msm_init_irq, |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 924 | .init_machine = msm_qrd_init, |
| 925 | .timer = &msm_timer, |
| 926 | .init_early = qrd7627a_init_early, |
| 927 | .handle_irq = vic_handle_irq, |
| 928 | MACHINE_END |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 929 | MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3") |
| 930 | .boot_params = PHYS_OFFSET + 0x100, |
| 931 | .map_io = msm_common_io_init, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 932 | .reserve = msm7627a_reserve, |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 933 | .init_irq = msm_init_irq, |
| 934 | .init_machine = msm_qrd_init, |
| 935 | .timer = &msm_timer, |
| 936 | .init_early = qrd7627a_init_early, |
| 937 | .handle_irq = vic_handle_irq, |
| 938 | MACHINE_END |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 939 | MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB") |
| 940 | .boot_params = PHYS_OFFSET + 0x100, |
| 941 | .map_io = msm_common_io_init, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 942 | .reserve = msm7627a_reserve, |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 943 | .init_irq = msm_init_irq, |
| 944 | .init_machine = msm_qrd_init, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 945 | .timer = &msm_timer, |
| 946 | .init_early = qrd7627a_init_early, |
Pankaj Kumar | bf8a2a3 | 2011-10-21 11:47:21 +0530 | [diff] [blame] | 947 | .handle_irq = vic_handle_irq, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 948 | MACHINE_END |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 949 | MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB") |
| 950 | .boot_params = PHYS_OFFSET + 0x100, |
| 951 | .map_io = msm8625_map_io, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 952 | .reserve = msm8625_reserve, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 953 | .init_irq = msm8625_init_irq, |
| 954 | .init_machine = msm_qrd_init, |
| 955 | .timer = &msm_timer, |
| 956 | .init_early = qrd7627a_init_early, |
| 957 | .handle_irq = gic_handle_irq, |
| 958 | MACHINE_END |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 959 | MACHINE_START(MSM8625_QRD7, "QRD MSM8625 QRD7") |
| 960 | .boot_params = PHYS_OFFSET + 0x100, |
| 961 | .map_io = msm8625_map_io, |
Trilok Soni | b941079 | 2012-04-07 15:37:13 +0530 | [diff] [blame] | 962 | .reserve = msm8625_reserve, |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 963 | .init_irq = msm8625_init_irq, |
| 964 | .init_machine = msm_qrd_init, |
| 965 | .timer = &msm_timer, |
| 966 | .init_early = qrd7627a_init_early, |
| 967 | .handle_irq = gic_handle_irq, |
| 968 | MACHINE_END |