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> |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 27 | #include <linux/input/rmi_platformdata.h> |
| 28 | #include <linux/input/rmi_i2c.h> |
Mohan Pallaka | 4c5bb92 | 2011-11-23 15:54:51 +0530 | [diff] [blame] | 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> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 33 | #include <asm/mach/mmc.h> |
| 34 | #include <asm/mach-types.h> |
| 35 | #include <asm/mach/arch.h> |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 36 | #include <asm/hardware/gic.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 37 | #include <mach/board.h> |
| 38 | #include <mach/msm_iomap.h> |
| 39 | #include <mach/msm_hsusb.h> |
| 40 | #include <mach/rpc_hsusb.h> |
| 41 | #include <mach/rpc_pmapp.h> |
| 42 | #include <mach/usbdiag.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 43 | #include <mach/msm_memtypes.h> |
| 44 | #include <mach/msm_serial_hs.h> |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 45 | #include <mach/pmic.h> |
| 46 | #include <mach/socinfo.h> |
| 47 | #include <mach/vreg.h> |
| 48 | #include <mach/rpc_pmapp.h> |
| 49 | #include <mach/msm_battery.h> |
| 50 | #include <mach/rpc_server_handset.h> |
| 51 | #include <mach/socinfo.h> |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 52 | #include "board-msm7x27a-regulator.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 53 | #include "devices.h" |
| 54 | #include "devices-msm7x2xa.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 55 | #include "pm.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 56 | #include "timer.h" |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 57 | #include "pm-boot.h" |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 58 | #include "board-msm7x27a-regulator.h" |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 59 | #include "board-msm7627a.h" |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 60 | |
| 61 | #define PMEM_KERNEL_EBI1_SIZE 0x3A000 |
| 62 | #define MSM_PMEM_AUDIO_SIZE 0x5B000 |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 63 | #define BAHAMA_SLAVE_ID_FM_REG 0x02 |
| 64 | #define FM_GPIO 83 |
Rahul Kashyap | 8b4a786 | 2011-12-13 18:40:54 +0530 | [diff] [blame] | 65 | #define BT_PCM_BCLK_MODE 0x88 |
| 66 | #define BT_PCM_DIN_MODE 0x89 |
| 67 | #define BT_PCM_DOUT_MODE 0x8A |
| 68 | #define BT_PCM_SYNC_MODE 0x8B |
| 69 | #define FM_I2S_SD_MODE 0x8E |
| 70 | #define FM_I2S_WS_MODE 0x8F |
| 71 | #define FM_I2S_SCK_MODE 0x90 |
| 72 | #define I2C_PIN_CTL 0x15 |
| 73 | #define I2C_NORMAL 0x40 |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 74 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 75 | static struct platform_device msm_wlan_ar6000_pm_device = { |
| 76 | .name = "wlan_ar6000_pm_dev", |
| 77 | .id = -1, |
| 78 | }; |
| 79 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 80 | static struct msm_gpio qup_i2c_gpios_io[] = { |
| 81 | { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 82 | "qup_scl" }, |
| 83 | { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 84 | "qup_sda" }, |
| 85 | { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 86 | "qup_scl" }, |
| 87 | { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 88 | "qup_sda" }, |
| 89 | }; |
| 90 | |
| 91 | static struct msm_gpio qup_i2c_gpios_hw[] = { |
| 92 | { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 93 | "qup_scl" }, |
| 94 | { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 95 | "qup_sda" }, |
| 96 | { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 97 | "qup_scl" }, |
| 98 | { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA), |
| 99 | "qup_sda" }, |
| 100 | }; |
| 101 | |
| 102 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 103 | { |
| 104 | int rc; |
| 105 | |
| 106 | if (adap_id < 0 || adap_id > 1) |
| 107 | return; |
| 108 | |
| 109 | /* Each adapter gets 2 lines from the table */ |
| 110 | if (config_type) |
| 111 | rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2); |
| 112 | else |
| 113 | rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2); |
| 114 | if (rc < 0) |
| 115 | pr_err("QUP GPIO request/enable failed: %d\n", rc); |
| 116 | } |
| 117 | |
| 118 | static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = { |
| 119 | .clk_freq = 100000, |
| 120 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 121 | }; |
| 122 | |
| 123 | static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = { |
| 124 | .clk_freq = 100000, |
| 125 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 126 | }; |
| 127 | |
| 128 | #ifdef CONFIG_ARCH_MSM7X27A |
| 129 | #define MSM_PMEM_MDP_SIZE 0x1DD1000 |
Mahesh Lanka | c054d35 | 2012-02-29 16:11:51 +0530 | [diff] [blame] | 130 | #define MSM_PMEM_ADSP_SIZE 0x1100000 |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 131 | #endif |
| 132 | |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 133 | #if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \ |
| 134 | defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE) |
| 135 | |
| 136 | #ifndef CLEARPAD3000_ATTEN_GPIO |
| 137 | #define CLEARPAD3000_ATTEN_GPIO (48) |
| 138 | #endif |
| 139 | |
| 140 | #ifndef CLEARPAD3000_RESET_GPIO |
| 141 | #define CLEARPAD3000_RESET_GPIO (26) |
| 142 | #endif |
| 143 | |
| 144 | static int synaptics_touchpad_setup(void); |
| 145 | |
| 146 | static struct msm_gpio clearpad3000_cfg_data[] = { |
| 147 | {GPIO_CFG(CLEARPAD3000_ATTEN_GPIO, 0, GPIO_CFG_INPUT, |
| 148 | GPIO_CFG_NO_PULL, GPIO_CFG_6MA), "rmi4_attn"}, |
| 149 | {GPIO_CFG(CLEARPAD3000_RESET_GPIO, 0, GPIO_CFG_OUTPUT, |
| 150 | GPIO_CFG_PULL_DOWN, GPIO_CFG_8MA), "rmi4_reset"}, |
| 151 | }; |
| 152 | |
| 153 | static struct rmi_XY_pair rmi_offset = {.x = 0, .y = 0}; |
| 154 | static struct rmi_range rmi_clipx = {.min = 48, .max = 980}; |
| 155 | static struct rmi_range rmi_clipy = {.min = 7, .max = 1647}; |
| 156 | static struct rmi_f11_functiondata synaptics_f11_data = { |
| 157 | .swap_axes = false, |
| 158 | .flipX = false, |
| 159 | .flipY = false, |
| 160 | .offset = &rmi_offset, |
| 161 | .button_height = 113, |
| 162 | .clipX = &rmi_clipx, |
| 163 | .clipY = &rmi_clipy, |
| 164 | }; |
| 165 | |
| 166 | #define MAX_LEN 100 |
| 167 | |
| 168 | static ssize_t clearpad3000_virtual_keys_register(struct kobject *kobj, |
| 169 | struct kobj_attribute *attr, char *buf) |
| 170 | { |
| 171 | char *virtual_keys = __stringify(EV_KEY) ":" __stringify(KEY_MENU) \ |
| 172 | ":60:830:120:60" ":" __stringify(EV_KEY) \ |
| 173 | ":" __stringify(KEY_HOME) ":180:830:120:60" \ |
| 174 | ":" __stringify(EV_KEY) ":" \ |
| 175 | __stringify(KEY_SEARCH) ":300:830:120:60" \ |
| 176 | ":" __stringify(EV_KEY) ":" \ |
| 177 | __stringify(KEY_BACK) ":420:830:120:60" "\n"; |
| 178 | |
| 179 | return snprintf(buf, strnlen(virtual_keys, MAX_LEN) + 1 , "%s", |
| 180 | virtual_keys); |
| 181 | } |
| 182 | |
| 183 | static struct kobj_attribute clearpad3000_virtual_keys_attr = { |
| 184 | .attr = { |
| 185 | .name = "virtualkeys.sensor00fn11", |
| 186 | .mode = S_IRUGO, |
| 187 | }, |
| 188 | .show = &clearpad3000_virtual_keys_register, |
| 189 | }; |
| 190 | |
| 191 | static struct attribute *virtual_key_properties_attrs[] = { |
| 192 | &clearpad3000_virtual_keys_attr.attr, |
| 193 | NULL |
| 194 | }; |
| 195 | |
| 196 | static struct attribute_group virtual_key_properties_attr_group = { |
| 197 | .attrs = virtual_key_properties_attrs, |
| 198 | }; |
| 199 | |
| 200 | struct kobject *virtual_key_properties_kobj; |
| 201 | |
| 202 | static struct rmi_functiondata synaptics_functiondata[] = { |
| 203 | { |
| 204 | .function_index = RMI_F11_INDEX, |
| 205 | .data = &synaptics_f11_data, |
| 206 | }, |
| 207 | }; |
| 208 | |
| 209 | static struct rmi_functiondata_list synaptics_perfunctiondata = { |
| 210 | .count = ARRAY_SIZE(synaptics_functiondata), |
| 211 | .functiondata = synaptics_functiondata, |
| 212 | }; |
| 213 | |
| 214 | static struct rmi_sensordata synaptics_sensordata = { |
| 215 | .perfunctiondata = &synaptics_perfunctiondata, |
| 216 | .rmi_sensor_setup = synaptics_touchpad_setup, |
| 217 | }; |
| 218 | |
| 219 | static struct rmi_i2c_platformdata synaptics_platformdata = { |
| 220 | .i2c_address = 0x2c, |
| 221 | .irq_type = IORESOURCE_IRQ_LOWLEVEL, |
| 222 | .sensordata = &synaptics_sensordata, |
| 223 | }; |
| 224 | |
| 225 | static struct i2c_board_info synaptic_i2c_clearpad3k[] = { |
| 226 | { |
| 227 | I2C_BOARD_INFO("rmi4_ts", 0x2c), |
| 228 | .platform_data = &synaptics_platformdata, |
| 229 | }, |
| 230 | }; |
| 231 | |
| 232 | static int synaptics_touchpad_setup(void) |
| 233 | { |
| 234 | int retval = 0; |
| 235 | |
| 236 | virtual_key_properties_kobj = |
| 237 | kobject_create_and_add("board_properties", NULL); |
| 238 | if (virtual_key_properties_kobj) |
| 239 | retval = sysfs_create_group(virtual_key_properties_kobj, |
| 240 | &virtual_key_properties_attr_group); |
| 241 | if (!virtual_key_properties_kobj || retval) |
| 242 | pr_err("failed to create ft5202 board_properties\n"); |
| 243 | |
| 244 | retval = msm_gpios_request_enable(clearpad3000_cfg_data, |
| 245 | sizeof(clearpad3000_cfg_data)/sizeof(struct msm_gpio)); |
| 246 | if (retval) { |
| 247 | pr_err("%s:Failed to obtain touchpad GPIO %d. Code: %d.", |
| 248 | __func__, CLEARPAD3000_ATTEN_GPIO, retval); |
| 249 | retval = 0; /* ignore the err */ |
| 250 | } |
| 251 | synaptics_platformdata.irq = gpio_to_irq(CLEARPAD3000_ATTEN_GPIO); |
| 252 | |
| 253 | gpio_set_value(CLEARPAD3000_RESET_GPIO, 0); |
| 254 | usleep(10000); |
| 255 | gpio_set_value(CLEARPAD3000_RESET_GPIO, 1); |
| 256 | usleep(50000); |
| 257 | |
| 258 | return retval; |
| 259 | } |
| 260 | #endif |
| 261 | |
Mohan Pallaka | 5afe985 | 2012-01-12 23:12:06 +0530 | [diff] [blame] | 262 | #define FT5X06_IRQ_GPIO 48 |
| 263 | #define FT5X06_RESET_GPIO 26 |
| 264 | |
| 265 | static ssize_t |
| 266 | ft5x06_virtual_keys_register(struct kobject *kobj, |
| 267 | struct kobj_attribute *attr, |
| 268 | char *buf) |
| 269 | { |
| 270 | return snprintf(buf, 200, |
| 271 | __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":40:510:80:60" |
| 272 | ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":120:510:80:60" |
| 273 | ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":200:510:80:60" |
| 274 | ":" __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":280:510:80:60" |
| 275 | "\n"); |
| 276 | } |
| 277 | |
| 278 | static struct kobj_attribute ft5x06_virtual_keys_attr = { |
| 279 | .attr = { |
| 280 | .name = "virtualkeys.ft5x06_ts", |
| 281 | .mode = S_IRUGO, |
| 282 | }, |
| 283 | .show = &ft5x06_virtual_keys_register, |
| 284 | }; |
| 285 | |
| 286 | static struct attribute *ft5x06_virtual_key_properties_attrs[] = { |
| 287 | &ft5x06_virtual_keys_attr.attr, |
| 288 | NULL, |
| 289 | }; |
| 290 | |
| 291 | static struct attribute_group ft5x06_virtual_key_properties_attr_group = { |
| 292 | .attrs = ft5x06_virtual_key_properties_attrs, |
| 293 | }; |
| 294 | |
| 295 | struct kobject *ft5x06_virtual_key_properties_kobj; |
| 296 | |
| 297 | static struct ft5x06_ts_platform_data ft5x06_platformdata = { |
| 298 | .x_max = 320, |
| 299 | .y_max = 480, |
| 300 | .reset_gpio = FT5X06_RESET_GPIO, |
| 301 | .irq_gpio = FT5X06_IRQ_GPIO, |
| 302 | .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 303 | }; |
| 304 | |
| 305 | static struct i2c_board_info ft5x06_device_info[] __initdata = { |
| 306 | { |
| 307 | I2C_BOARD_INFO("ft5x06_ts", 0x38), |
| 308 | .platform_data = &ft5x06_platformdata, |
| 309 | .irq = MSM_GPIO_TO_INT(FT5X06_IRQ_GPIO), |
| 310 | }, |
| 311 | }; |
| 312 | |
| 313 | static void ft5x06_touchpad_setup(void) |
| 314 | { |
| 315 | int rc; |
| 316 | |
| 317 | rc = gpio_tlmm_config(GPIO_CFG(FT5X06_IRQ_GPIO, 0, |
| 318 | GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, |
| 319 | GPIO_CFG_8MA), GPIO_CFG_ENABLE); |
| 320 | if (rc) |
| 321 | pr_err("%s: gpio_tlmm_config for %d failed\n", |
| 322 | __func__, FT5X06_IRQ_GPIO); |
| 323 | |
| 324 | rc = gpio_tlmm_config(GPIO_CFG(FT5X06_RESET_GPIO, 0, |
| 325 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, |
| 326 | GPIO_CFG_8MA), GPIO_CFG_ENABLE); |
| 327 | if (rc) |
| 328 | pr_err("%s: gpio_tlmm_config for %d failed\n", |
| 329 | __func__, FT5X06_RESET_GPIO); |
| 330 | |
| 331 | ft5x06_virtual_key_properties_kobj = |
| 332 | kobject_create_and_add("board_properties", NULL); |
| 333 | |
| 334 | if (ft5x06_virtual_key_properties_kobj) |
| 335 | rc = sysfs_create_group(ft5x06_virtual_key_properties_kobj, |
| 336 | &ft5x06_virtual_key_properties_attr_group); |
| 337 | |
| 338 | if (!ft5x06_virtual_key_properties_kobj || rc) |
| 339 | pr_err("%s: failed to create board_properties\n", __func__); |
| 340 | |
| 341 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 342 | ft5x06_device_info, |
| 343 | ARRAY_SIZE(ft5x06_device_info)); |
| 344 | } |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 345 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 346 | static struct android_usb_platform_data android_usb_pdata = { |
Pankaj Kumar | 6f84174 | 2011-10-10 15:52:14 +0530 | [diff] [blame] | 347 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 348 | }; |
| 349 | |
| 350 | static struct platform_device android_usb_device = { |
| 351 | .name = "android_usb", |
| 352 | .id = -1, |
| 353 | .dev = { |
| 354 | .platform_data = &android_usb_pdata, |
| 355 | }, |
| 356 | }; |
| 357 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 358 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 359 | static void msm_hsusb_vbus_power(unsigned phy_info, int on) |
| 360 | { |
| 361 | int rc = 0; |
| 362 | unsigned gpio; |
| 363 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 364 | gpio = QRD_GPIO_HOST_VBUS_EN; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 365 | |
| 366 | rc = gpio_request(gpio, "i2c_host_vbus_en"); |
| 367 | if (rc < 0) { |
| 368 | pr_err("failed to request %d GPIO\n", gpio); |
| 369 | return; |
| 370 | } |
| 371 | gpio_direction_output(gpio, !!on); |
| 372 | gpio_set_value_cansleep(gpio, !!on); |
| 373 | gpio_free(gpio); |
| 374 | } |
| 375 | |
| 376 | static struct msm_usb_host_platform_data msm_usb_host_pdata = { |
| 377 | .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM), |
| 378 | }; |
| 379 | |
| 380 | static void __init msm7627a_init_host(void) |
| 381 | { |
| 382 | msm_add_host(0, &msm_usb_host_pdata); |
| 383 | } |
| 384 | #endif |
| 385 | |
| 386 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 387 | static int hsusb_rpc_connect(int connect) |
| 388 | { |
| 389 | if (connect) |
| 390 | return msm_hsusb_rpc_connect(); |
| 391 | else |
| 392 | return msm_hsusb_rpc_close(); |
| 393 | } |
| 394 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 395 | static struct regulator *reg_hsusb; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 396 | static int msm_hsusb_ldo_init(int init) |
| 397 | { |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 398 | int rc = 0; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 399 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 400 | if (init) { |
| 401 | reg_hsusb = regulator_get(NULL, "usb"); |
| 402 | if (IS_ERR(reg_hsusb)) { |
| 403 | rc = PTR_ERR(reg_hsusb); |
| 404 | pr_err("%s: could not get regulator: %d\n", |
| 405 | __func__, rc); |
| 406 | goto out; |
| 407 | } |
| 408 | |
| 409 | rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000); |
| 410 | if (rc) { |
| 411 | pr_err("%s: could not set voltage: %d\n", |
| 412 | __func__, rc); |
| 413 | goto reg_free; |
| 414 | } |
| 415 | |
| 416 | return 0; |
| 417 | } |
| 418 | /* else fall through */ |
| 419 | reg_free: |
| 420 | regulator_put(reg_hsusb); |
| 421 | out: |
| 422 | reg_hsusb = NULL; |
| 423 | return rc; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 424 | } |
| 425 | |
| 426 | static int msm_hsusb_ldo_enable(int enable) |
| 427 | { |
| 428 | static int ldo_status; |
| 429 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 430 | if (IS_ERR_OR_NULL(reg_hsusb)) |
| 431 | return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV; |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 432 | |
| 433 | if (ldo_status == enable) |
| 434 | return 0; |
| 435 | |
| 436 | ldo_status = enable; |
| 437 | |
Pankaj Kumar | 27c0264 | 2011-09-22 15:55:55 +0530 | [diff] [blame] | 438 | return enable ? |
| 439 | regulator_enable(reg_hsusb) : |
| 440 | regulator_disable(reg_hsusb); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 441 | } |
| 442 | |
| 443 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 444 | static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init) |
| 445 | { |
| 446 | int ret = 0; |
| 447 | |
| 448 | if (init) |
| 449 | ret = msm_pm_app_rpc_init(callback); |
| 450 | else |
| 451 | msm_pm_app_rpc_deinit(callback); |
| 452 | |
| 453 | return ret; |
| 454 | } |
| 455 | #endif |
| 456 | |
| 457 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 458 | #ifndef CONFIG_USB_EHCI_MSM_72K |
| 459 | .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init, |
| 460 | #else |
| 461 | .vbus_power = msm_hsusb_vbus_power, |
| 462 | #endif |
| 463 | .rpc_connect = hsusb_rpc_connect, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 464 | .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT, |
| 465 | .cdr_autoreset = CDR_AUTO_RESET_DISABLE, |
| 466 | .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT, |
| 467 | .se1_gating = SE1_GATING_DISABLE, |
| 468 | .ldo_init = msm_hsusb_ldo_init, |
| 469 | .ldo_enable = msm_hsusb_ldo_enable, |
| 470 | .chg_init = hsusb_chg_init, |
| 471 | .chg_connected = hsusb_chg_connected, |
| 472 | .chg_vbus_draw = hsusb_chg_vbus_draw, |
| 473 | }; |
| 474 | #endif |
| 475 | |
| 476 | static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = { |
| 477 | .is_phy_status_timer_on = 1, |
| 478 | }; |
| 479 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 480 | #ifdef CONFIG_SERIAL_MSM_HS |
| 481 | static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = { |
| 482 | .inject_rx_on_wakeup = 1, |
| 483 | .rx_to_inject = 0xFD, |
| 484 | }; |
| 485 | #endif |
| 486 | static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = { |
| 487 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = { |
| 488 | .idle_supported = 1, |
| 489 | .suspend_supported = 1, |
| 490 | .idle_enabled = 1, |
| 491 | .suspend_enabled = 1, |
| 492 | .latency = 16000, |
| 493 | .residency = 20000, |
| 494 | }, |
| 495 | [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = { |
| 496 | .idle_supported = 1, |
| 497 | .suspend_supported = 1, |
| 498 | .idle_enabled = 1, |
| 499 | .suspend_enabled = 1, |
| 500 | .latency = 12000, |
| 501 | .residency = 20000, |
| 502 | }, |
| 503 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = { |
| 504 | .idle_supported = 1, |
| 505 | .suspend_supported = 1, |
| 506 | .idle_enabled = 0, |
| 507 | .suspend_enabled = 1, |
| 508 | .latency = 2000, |
| 509 | .residency = 0, |
| 510 | }, |
| 511 | [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = { |
| 512 | .idle_supported = 1, |
| 513 | .suspend_supported = 1, |
| 514 | .idle_enabled = 1, |
| 515 | .suspend_enabled = 1, |
| 516 | .latency = 2, |
| 517 | .residency = 0, |
| 518 | }, |
| 519 | }; |
| 520 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 521 | 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] | 522 | .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS, |
| 523 | .p_addr = 0, |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 524 | }; |
| 525 | |
Murali Nalajala | 4c996be | 2012-03-12 17:05:41 +0530 | [diff] [blame] | 526 | /* 8625 PM platform data */ |
| 527 | static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { |
| 528 | /* CORE0 entries */ |
| 529 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 530 | .idle_supported = 1, |
| 531 | .suspend_supported = 1, |
| 532 | .idle_enabled = 0, |
| 533 | .suspend_enabled = 0, |
| 534 | .latency = 16000, |
| 535 | .residency = 20000, |
| 536 | }, |
| 537 | |
| 538 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = { |
| 539 | .idle_supported = 1, |
| 540 | .suspend_supported = 1, |
| 541 | .idle_enabled = 0, |
| 542 | .suspend_enabled = 0, |
| 543 | .latency = 12000, |
| 544 | .residency = 20000, |
| 545 | }, |
| 546 | |
| 547 | /* picked latency & redisdency values from 7x30 */ |
| 548 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 549 | .idle_supported = 1, |
| 550 | .suspend_supported = 1, |
| 551 | .idle_enabled = 0, |
| 552 | .suspend_enabled = 0, |
| 553 | .latency = 500, |
| 554 | .residency = 6000, |
| 555 | }, |
| 556 | |
| 557 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 558 | .idle_supported = 1, |
| 559 | .suspend_supported = 1, |
| 560 | .idle_enabled = 1, |
| 561 | .suspend_enabled = 1, |
| 562 | .latency = 2, |
| 563 | .residency = 10, |
| 564 | }, |
| 565 | |
| 566 | /* picked latency & redisdency values from 7x30 */ |
| 567 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 568 | .idle_supported = 1, |
| 569 | .suspend_supported = 1, |
| 570 | .idle_enabled = 0, |
| 571 | .suspend_enabled = 0, |
| 572 | .latency = 500, |
| 573 | .residency = 6000, |
| 574 | }, |
| 575 | |
| 576 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 577 | .idle_supported = 1, |
| 578 | .suspend_supported = 1, |
| 579 | .idle_enabled = 1, |
| 580 | .suspend_enabled = 1, |
| 581 | .latency = 2, |
| 582 | .residency = 10, |
| 583 | }, |
| 584 | |
| 585 | }; |
| 586 | |
| 587 | static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = { |
| 588 | .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR, |
| 589 | .v_addr = MSM_CFG_CTL_BASE, |
| 590 | }; |
| 591 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 592 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 593 | .name = "pmem_adsp", |
| 594 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 595 | .cached = 1, |
| 596 | .memory_type = MEMTYPE_EBI1, |
| 597 | }; |
| 598 | |
| 599 | static struct platform_device android_pmem_adsp_device = { |
| 600 | .name = "android_pmem", |
| 601 | .id = 1, |
| 602 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 603 | }; |
| 604 | |
| 605 | static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE; |
| 606 | static int __init pmem_mdp_size_setup(char *p) |
| 607 | { |
| 608 | pmem_mdp_size = memparse(p, NULL); |
| 609 | return 0; |
| 610 | } |
| 611 | |
| 612 | early_param("pmem_mdp_size", pmem_mdp_size_setup); |
| 613 | |
| 614 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 615 | static int __init pmem_adsp_size_setup(char *p) |
| 616 | { |
| 617 | pmem_adsp_size = memparse(p, NULL); |
| 618 | return 0; |
| 619 | } |
| 620 | |
| 621 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 622 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 623 | #define SND(desc, num) { .name = #desc, .id = num } |
| 624 | static struct snd_endpoint snd_endpoints_list[] = { |
| 625 | SND(HANDSET, 0), |
| 626 | SND(MONO_HEADSET, 2), |
| 627 | SND(HEADSET, 3), |
| 628 | SND(SPEAKER, 6), |
| 629 | SND(TTY_HEADSET, 8), |
| 630 | SND(TTY_VCO, 9), |
| 631 | SND(TTY_HCO, 10), |
| 632 | SND(BT, 12), |
| 633 | SND(IN_S_SADC_OUT_HANDSET, 16), |
| 634 | SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25), |
| 635 | SND(FM_DIGITAL_STEREO_HEADSET, 26), |
| 636 | SND(FM_DIGITAL_SPEAKER_PHONE, 27), |
| 637 | SND(FM_DIGITAL_BT_A2DP_HEADSET, 28), |
Shashi Kumar | 64e0760 | 2011-10-11 13:18:57 +0530 | [diff] [blame] | 638 | SND(STEREO_HEADSET_AND_SPEAKER, 31), |
Phani Kumar Allada | d697125 | 2011-10-19 10:50:15 +0530 | [diff] [blame] | 639 | SND(CURRENT, 0x7FFFFFFE), |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 640 | SND(FM_ANALOG_STEREO_HEADSET, 35), |
| 641 | SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36), |
| 642 | }; |
| 643 | #undef SND |
| 644 | |
| 645 | static struct msm_snd_endpoints msm_device_snd_endpoints = { |
| 646 | .endpoints = snd_endpoints_list, |
| 647 | .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint) |
| 648 | }; |
| 649 | |
| 650 | static struct platform_device msm_device_snd = { |
| 651 | .name = "msm_snd", |
| 652 | .id = -1, |
| 653 | .dev = { |
| 654 | .platform_data = &msm_device_snd_endpoints |
| 655 | }, |
| 656 | }; |
| 657 | |
| 658 | #define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 659 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 660 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 661 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 662 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 663 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 664 | #define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 665 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 666 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 667 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 668 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 669 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 670 | #define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 671 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 672 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 673 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 674 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 675 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 676 | #define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \ |
| 677 | (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \ |
| 678 | (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \ |
| 679 | (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \ |
| 680 | (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \ |
| 681 | (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP)) |
| 682 | #define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI) |
| 683 | |
| 684 | static unsigned int dec_concurrency_table[] = { |
| 685 | /* Audio LP */ |
| 686 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0, |
| 687 | 0, 0, 0, |
| 688 | |
| 689 | /* Concurrency 1 */ |
| 690 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 691 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 692 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 693 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 694 | (DEC4_FORMAT), |
| 695 | |
| 696 | /* Concurrency 2 */ |
| 697 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 698 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 699 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 700 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 701 | (DEC4_FORMAT), |
| 702 | |
| 703 | /* Concurrency 3 */ |
| 704 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 705 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 706 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 707 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 708 | (DEC4_FORMAT), |
| 709 | |
| 710 | /* Concurrency 4 */ |
| 711 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 712 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 713 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 714 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 715 | (DEC4_FORMAT), |
| 716 | |
| 717 | /* Concurrency 5 */ |
| 718 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 719 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 720 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 721 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 722 | (DEC4_FORMAT), |
| 723 | |
| 724 | /* Concurrency 6 */ |
| 725 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 726 | 0, 0, 0, 0, |
| 727 | |
| 728 | /* Concurrency 7 */ |
| 729 | (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 730 | (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 731 | (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 732 | (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)), |
| 733 | (DEC4_FORMAT), |
| 734 | }; |
| 735 | |
| 736 | #define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \ |
| 737 | .module_queueid = queueid, .module_decid = decid, \ |
| 738 | .nr_codec_support = nr_codec} |
| 739 | |
| 740 | static struct msm_adspdec_info dec_info_list[] = { |
| 741 | DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */ |
| 742 | DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */ |
| 743 | DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */ |
| 744 | DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */ |
| 745 | DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */ |
| 746 | }; |
| 747 | |
| 748 | static struct msm_adspdec_database msm_device_adspdec_database = { |
| 749 | .num_dec = ARRAY_SIZE(dec_info_list), |
| 750 | .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \ |
| 751 | ARRAY_SIZE(dec_info_list)), |
| 752 | .dec_concurrency_table = dec_concurrency_table, |
| 753 | .dec_info_list = dec_info_list, |
| 754 | }; |
| 755 | |
| 756 | static struct platform_device msm_device_adspdec = { |
| 757 | .name = "msm_adspdec", |
| 758 | .id = -1, |
| 759 | .dev = { |
| 760 | .platform_data = &msm_device_adspdec_database |
| 761 | }, |
| 762 | }; |
| 763 | |
| 764 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 765 | .name = "pmem_audio", |
| 766 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 767 | .cached = 0, |
| 768 | .memory_type = MEMTYPE_EBI1, |
| 769 | }; |
| 770 | |
| 771 | static struct platform_device android_pmem_audio_device = { |
| 772 | .name = "android_pmem", |
| 773 | .id = 2, |
| 774 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 775 | }; |
| 776 | |
| 777 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 778 | .name = "pmem", |
| 779 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 780 | .cached = 1, |
| 781 | .memory_type = MEMTYPE_EBI1, |
| 782 | }; |
| 783 | static struct platform_device android_pmem_device = { |
| 784 | .name = "android_pmem", |
| 785 | .id = 0, |
| 786 | .dev = { .platform_data = &android_pmem_pdata }, |
| 787 | }; |
| 788 | |
| 789 | static u32 msm_calculate_batt_capacity(u32 current_voltage); |
| 790 | |
| 791 | static struct msm_psy_batt_pdata msm_psy_batt_data = { |
| 792 | .voltage_min_design = 2800, |
| 793 | .voltage_max_design = 4300, |
| 794 | .avail_chg_sources = AC_CHG | USB_CHG , |
| 795 | .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION, |
| 796 | .calculate_capacity = &msm_calculate_batt_capacity, |
| 797 | }; |
| 798 | |
| 799 | static u32 msm_calculate_batt_capacity(u32 current_voltage) |
| 800 | { |
| 801 | u32 low_voltage = msm_psy_batt_data.voltage_min_design; |
| 802 | u32 high_voltage = msm_psy_batt_data.voltage_max_design; |
| 803 | |
| 804 | return (current_voltage - low_voltage) * 100 |
| 805 | / (high_voltage - low_voltage); |
| 806 | } |
| 807 | |
| 808 | static struct platform_device msm_batt_device = { |
| 809 | .name = "msm-battery", |
| 810 | .id = -1, |
| 811 | .dev.platform_data = &msm_psy_batt_data, |
| 812 | }; |
| 813 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 814 | static struct platform_device *common_devices[] __initdata = { |
| 815 | &android_usb_device, |
| 816 | &android_pmem_device, |
| 817 | &android_pmem_adsp_device, |
| 818 | &android_pmem_audio_device, |
| 819 | &msm_batt_device, |
| 820 | &msm_device_adspdec, |
| 821 | &msm_device_snd, |
| 822 | &asoc_msm_pcm, |
| 823 | &asoc_msm_dai0, |
| 824 | &asoc_msm_dai1, |
| 825 | }; |
| 826 | |
| 827 | static struct platform_device *qrd7627a_devices[] __initdata = { |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 828 | &msm_device_dmov, |
| 829 | &msm_device_smd, |
| 830 | &msm_device_uart1, |
| 831 | &msm_device_uart_dm1, |
| 832 | &msm_gsbi0_qup_i2c_device, |
| 833 | &msm_gsbi1_qup_i2c_device, |
| 834 | &msm_device_otg, |
| 835 | &msm_device_gadget_peripheral, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 836 | &msm_kgsl_3d0, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 837 | }; |
| 838 | |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 839 | static struct platform_device *qrd3_devices[] __initdata = { |
| 840 | &msm_device_nand, |
| 841 | }; |
| 842 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 843 | static struct platform_device *msm8625_evb_devices[] __initdata = { |
| 844 | &msm8625_device_dmov, |
| 845 | &msm8625_device_smd, |
| 846 | &msm8625_gsbi0_qup_i2c_device, |
| 847 | &msm8625_gsbi1_qup_i2c_device, |
| 848 | &msm8625_device_uart1, |
Ram Mohan Korukonda | 5ee9fb8 | 2012-03-09 12:10:01 +0530 | [diff] [blame] | 849 | &msm8625_device_uart_dm1, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 850 | &msm8625_device_otg, |
| 851 | &msm8625_device_gadget_peripheral, |
Aparna Mallavarapu | d95d8fc | 2012-03-08 12:07:37 +0530 | [diff] [blame] | 852 | &msm8625_kgsl_3d0, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 853 | }; |
| 854 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 855 | static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE; |
| 856 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 857 | { |
| 858 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 859 | return 0; |
| 860 | } |
| 861 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 862 | |
| 863 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 864 | static int __init pmem_audio_size_setup(char *p) |
| 865 | { |
| 866 | pmem_audio_size = memparse(p, NULL); |
| 867 | return 0; |
| 868 | } |
| 869 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 870 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 871 | static struct memtype_reserve msm7627a_reserve_table[] __initdata = { |
| 872 | [MEMTYPE_SMI] = { |
| 873 | }, |
| 874 | [MEMTYPE_EBI0] = { |
| 875 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 876 | }, |
| 877 | [MEMTYPE_EBI1] = { |
| 878 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 879 | }, |
| 880 | }; |
| 881 | |
| 882 | static void __init size_pmem_devices(void) |
| 883 | { |
| 884 | #ifdef CONFIG_ANDROID_PMEM |
| 885 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 886 | android_pmem_pdata.size = pmem_mdp_size; |
| 887 | android_pmem_audio_pdata.size = pmem_audio_size; |
| 888 | #endif |
| 889 | } |
| 890 | |
| 891 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 892 | { |
| 893 | msm7627a_reserve_table[p->memory_type].size += p->size; |
| 894 | } |
| 895 | |
| 896 | static void __init reserve_pmem_memory(void) |
| 897 | { |
| 898 | #ifdef CONFIG_ANDROID_PMEM |
| 899 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 900 | reserve_memory_for(&android_pmem_pdata); |
| 901 | reserve_memory_for(&android_pmem_audio_pdata); |
| 902 | msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 903 | #endif |
| 904 | } |
| 905 | |
| 906 | static void __init msm7627a_calculate_reserve_sizes(void) |
| 907 | { |
| 908 | size_pmem_devices(); |
| 909 | reserve_pmem_memory(); |
| 910 | } |
| 911 | |
| 912 | static int msm7627a_paddr_to_memtype(unsigned int paddr) |
| 913 | { |
| 914 | return MEMTYPE_EBI1; |
| 915 | } |
| 916 | |
| 917 | static struct reserve_info msm7627a_reserve_info __initdata = { |
| 918 | .memtype_reserve_table = msm7627a_reserve_table, |
| 919 | .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes, |
| 920 | .paddr_to_memtype = msm7627a_paddr_to_memtype, |
| 921 | }; |
| 922 | |
| 923 | static void __init msm7627a_reserve(void) |
| 924 | { |
| 925 | reserve_info = &msm7627a_reserve_info; |
| 926 | msm_reserve(); |
Murali Nalajala | 4c996be | 2012-03-12 17:05:41 +0530 | [diff] [blame] | 927 | msm_pm_8625_boot_pdata.p_addr = memblock_alloc(SZ_8, SZ_64K); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 928 | } |
| 929 | |
Taniya Das | fe04d4f | 2012-03-14 11:13:21 +0530 | [diff] [blame] | 930 | static void __init msm8625_reserve(void) |
| 931 | { |
| 932 | memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8); |
| 933 | msm7627a_reserve(); |
| 934 | } |
| 935 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 936 | static void msmqrd_adsp_add_pdev(void) |
| 937 | { |
| 938 | int rc = 0; |
| 939 | struct rpc_board_dev *rpc_adsp_pdev; |
| 940 | |
| 941 | rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL); |
| 942 | if (rpc_adsp_pdev == NULL) { |
| 943 | pr_err("%s: Memory Allocation failure\n", __func__); |
| 944 | return; |
| 945 | } |
| 946 | rpc_adsp_pdev->prog = ADSP_RPC_PROG; |
| 947 | |
| 948 | if (cpu_is_msm8625()) |
| 949 | rpc_adsp_pdev->pdev = msm8625_device_adsp; |
| 950 | else |
| 951 | rpc_adsp_pdev->pdev = msm_adsp_device; |
| 952 | rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1); |
| 953 | if (rc < 0) { |
| 954 | pr_err("%s: return val: %d\n", __func__, rc); |
| 955 | kfree(rpc_adsp_pdev); |
| 956 | } |
| 957 | } |
| 958 | |
| 959 | static void __init msm7627a_device_i2c_init(void) |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 960 | { |
| 961 | msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata; |
| 962 | msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata; |
| 963 | } |
| 964 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 965 | static void __init msm8625_device_i2c_init(void) |
| 966 | { |
| 967 | msm8625_gsbi0_qup_i2c_device.dev.platform_data |
| 968 | = &msm_gsbi0_qup_i2c_pdata; |
| 969 | msm8625_gsbi1_qup_i2c_device.dev.platform_data |
| 970 | = &msm_gsbi1_qup_i2c_pdata; |
| 971 | } |
| 972 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 973 | static struct msm_handset_platform_data hs_platform_data = { |
| 974 | .hs_name = "7k_handset", |
| 975 | .pwr_key_delay_ms = 500, /* 0 will disable end key */ |
| 976 | }; |
| 977 | |
| 978 | static struct platform_device hs_pdev = { |
| 979 | .name = "msm-handset", |
| 980 | .id = -1, |
| 981 | .dev = { |
| 982 | .platform_data = &hs_platform_data, |
| 983 | }, |
| 984 | }; |
| 985 | |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 986 | static struct platform_device msm_proccomm_regulator_dev = { |
| 987 | .name = PROCCOMM_REGULATOR_DEV_NAME, |
| 988 | .id = -1, |
| 989 | .dev = { |
| 990 | .platform_data = &msm7x27a_proccomm_regulator_data |
| 991 | } |
| 992 | }; |
| 993 | |
| 994 | static void __init msm7627a_init_regulators(void) |
| 995 | { |
| 996 | int rc = platform_device_register(&msm_proccomm_regulator_dev); |
| 997 | if (rc) |
| 998 | pr_err("%s: could not register regulator device: %d\n", |
| 999 | __func__, rc); |
| 1000 | } |
| 1001 | |
Mohan Pallaka | b6c44b3 | 2011-11-23 15:19:57 +0530 | [diff] [blame] | 1002 | /* 8625 keypad device information */ |
| 1003 | static unsigned int kp_row_gpios_8625[] = {31}; |
| 1004 | static unsigned int kp_col_gpios_8625[] = {36, 37}; |
| 1005 | |
| 1006 | static const unsigned short keymap_8625[] = { |
| 1007 | KEY_VOLUMEUP, |
| 1008 | KEY_VOLUMEDOWN, |
| 1009 | }; |
| 1010 | |
| 1011 | static struct gpio_event_matrix_info kp_matrix_info_8625 = { |
| 1012 | .info.func = gpio_event_matrix_func, |
| 1013 | .keymap = keymap_8625, |
| 1014 | .output_gpios = kp_row_gpios_8625, |
| 1015 | .input_gpios = kp_col_gpios_8625, |
| 1016 | .noutputs = ARRAY_SIZE(kp_row_gpios_8625), |
| 1017 | .ninputs = ARRAY_SIZE(kp_col_gpios_8625), |
| 1018 | .settle_time.tv_nsec = 40 * NSEC_PER_USEC, |
| 1019 | .poll_time.tv_nsec = 20 * NSEC_PER_MSEC, |
| 1020 | .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | |
| 1021 | GPIOKPF_PRINT_UNMAPPED_KEYS, |
| 1022 | }; |
| 1023 | |
| 1024 | static struct gpio_event_info *kp_info_8625[] = { |
| 1025 | &kp_matrix_info_8625.info, |
| 1026 | }; |
| 1027 | static struct gpio_event_platform_data kp_pdata_8625 = { |
| 1028 | .name = "8625_kp", |
| 1029 | .info = kp_info_8625, |
| 1030 | .info_count = ARRAY_SIZE(kp_info_8625) |
| 1031 | }; |
| 1032 | |
| 1033 | static struct platform_device kp_pdev_8625 = { |
| 1034 | .name = GPIO_EVENT_DEV_NAME, |
| 1035 | .id = -1, |
| 1036 | .dev = { |
| 1037 | .platform_data = &kp_pdata_8625, |
| 1038 | }, |
| 1039 | }; |
| 1040 | |
Mohan Pallaka | ad78af8 | 2011-11-23 15:30:07 +0530 | [diff] [blame] | 1041 | #define LED_RED_GPIO_8625 49 |
| 1042 | #define LED_GREEN_GPIO_8625 34 |
| 1043 | |
| 1044 | static struct gpio_led gpio_leds_config_8625[] = { |
| 1045 | { |
| 1046 | .name = "green", |
| 1047 | .gpio = LED_GREEN_GPIO_8625, |
| 1048 | }, |
| 1049 | { |
| 1050 | .name = "red", |
| 1051 | .gpio = LED_RED_GPIO_8625, |
| 1052 | }, |
| 1053 | }; |
| 1054 | |
| 1055 | static struct gpio_led_platform_data gpio_leds_pdata_8625 = { |
| 1056 | .num_leds = ARRAY_SIZE(gpio_leds_config_8625), |
| 1057 | .leds = gpio_leds_config_8625, |
| 1058 | }; |
| 1059 | |
| 1060 | static struct platform_device gpio_leds_8625 = { |
| 1061 | .name = "leds-gpio", |
| 1062 | .id = -1, |
| 1063 | .dev = { |
| 1064 | .platform_data = &gpio_leds_pdata_8625, |
| 1065 | }, |
| 1066 | }; |
| 1067 | |
Mohan Pallaka | 4c5bb92 | 2011-11-23 15:54:51 +0530 | [diff] [blame] | 1068 | #define MXT_TS_IRQ_GPIO 48 |
| 1069 | #define MXT_TS_RESET_GPIO 26 |
| 1070 | |
| 1071 | static const u8 mxt_config_data[] = { |
| 1072 | /* T6 Object */ |
| 1073 | 0, 0, 0, 0, 0, 0, |
| 1074 | /* T38 Object */ |
| 1075 | 16, 0, 0, 0, 0, 0, 0, 0, |
| 1076 | /* T7 Object */ |
Mohan Pallaka | 2c74a13 | 2012-03-05 15:50:40 +0530 | [diff] [blame] | 1077 | 32, 16, 50, |
Mohan Pallaka | 4c5bb92 | 2011-11-23 15:54:51 +0530 | [diff] [blame] | 1078 | /* T8 Object */ |
| 1079 | 30, 0, 20, 20, 0, 0, 20, 0, 50, 0, |
| 1080 | /* T9 Object */ |
| 1081 | 3, 0, 0, 18, 11, 0, 32, 75, 3, 3, |
| 1082 | 0, 1, 1, 0, 10, 10, 10, 10, 31, 3, |
| 1083 | 223, 1, 11, 11, 15, 15, 151, 43, 145, 80, |
| 1084 | 100, 15, 0, 0, 0, |
| 1085 | /* T15 Object */ |
| 1086 | 131, 0, 11, 11, 1, 1, 0, 45, 3, 0, |
| 1087 | 0, |
| 1088 | /* T18 Object */ |
| 1089 | 0, 0, |
| 1090 | /* T19 Object */ |
| 1091 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1092 | 0, 0, 0, 0, 0, 0, |
| 1093 | /* T23 Object */ |
| 1094 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1095 | 0, 0, 0, 0, 0, |
| 1096 | /* T25 Object */ |
| 1097 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1098 | 0, 0, 0, 0, |
| 1099 | /* T40 Object */ |
| 1100 | 0, 0, 0, 0, 0, |
| 1101 | /* T42 Object */ |
| 1102 | 0, 0, 0, 0, 0, 0, 0, 0, |
| 1103 | /* T46 Object */ |
| 1104 | 0, 2, 32, 48, 0, 0, 0, 0, 0, |
| 1105 | /* T47 Object */ |
| 1106 | 1, 20, 60, 5, 2, 50, 40, 0, 0, 40, |
| 1107 | /* T48 Object */ |
| 1108 | 1, 12, 80, 0, 0, 0, 0, 0, 0, 0, |
| 1109 | 0, 0, 0, 6, 6, 0, 0, 100, 4, 64, |
| 1110 | 10, 0, 20, 5, 0, 38, 0, 20, 0, 0, |
| 1111 | 0, 0, 0, 0, 16, 65, 3, 1, 1, 0, |
| 1112 | 10, 10, 10, 0, 0, 15, 15, 154, 58, 145, |
| 1113 | 80, 100, 15, 3, |
| 1114 | }; |
| 1115 | |
| 1116 | static struct mxt_config_info mxt_config_array[] = { |
| 1117 | { |
| 1118 | .config = mxt_config_data, |
| 1119 | .config_length = ARRAY_SIZE(mxt_config_data), |
| 1120 | .family_id = 0x81, |
| 1121 | .variant_id = 0x01, |
| 1122 | .version = 0x10, |
| 1123 | .build = 0xAA, |
| 1124 | }, |
| 1125 | }; |
| 1126 | |
| 1127 | static int mxt_key_codes[MXT_KEYARRAY_MAX_KEYS] = { |
| 1128 | [0] = KEY_HOME, |
| 1129 | [1] = KEY_MENU, |
| 1130 | [9] = KEY_BACK, |
| 1131 | [10] = KEY_SEARCH, |
| 1132 | }; |
| 1133 | |
| 1134 | static struct mxt_platform_data mxt_platform_data = { |
| 1135 | .config_array = mxt_config_array, |
| 1136 | .config_array_size = ARRAY_SIZE(mxt_config_array), |
Mohan Pallaka | 56a1a5d | 2012-02-23 12:05:13 -0800 | [diff] [blame^] | 1137 | .panel_minx = 0, |
| 1138 | .panel_maxx = 479, |
| 1139 | .panel_miny = 0, |
| 1140 | .panel_maxy = 799, |
| 1141 | .disp_minx = 0, |
| 1142 | .disp_maxx = 479, |
| 1143 | .disp_miny = 0, |
| 1144 | .disp_maxy = 799, |
Mohan Pallaka | 4c5bb92 | 2011-11-23 15:54:51 +0530 | [diff] [blame] | 1145 | .irqflags = IRQF_TRIGGER_FALLING, |
| 1146 | .i2c_pull_up = true, |
| 1147 | .reset_gpio = MXT_TS_RESET_GPIO, |
| 1148 | .irq_gpio = MXT_TS_IRQ_GPIO, |
| 1149 | .key_codes = mxt_key_codes, |
| 1150 | }; |
| 1151 | |
| 1152 | static struct i2c_board_info mxt_device_info[] __initdata = { |
| 1153 | { |
| 1154 | I2C_BOARD_INFO("atmel_mxt_ts", 0x4a), |
| 1155 | .platform_data = &mxt_platform_data, |
| 1156 | .irq = MSM_GPIO_TO_INT(MXT_TS_IRQ_GPIO), |
| 1157 | }, |
| 1158 | }; |
| 1159 | |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1160 | static void msm7627a_add_io_devices(void) |
| 1161 | { |
Mohan Pallaka | ad78af8 | 2011-11-23 15:30:07 +0530 | [diff] [blame] | 1162 | int rc; |
| 1163 | |
Mohan Pallaka | 4c5bb92 | 2011-11-23 15:54:51 +0530 | [diff] [blame] | 1164 | /* touchscreen */ |
| 1165 | if (machine_is_msm7627a_qrd1()) { |
| 1166 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 1167 | synaptic_i2c_clearpad3k, |
| 1168 | ARRAY_SIZE(synaptic_i2c_clearpad3k)); |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1169 | } else if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()) { |
Mohan Pallaka | 4c5bb92 | 2011-11-23 15:54:51 +0530 | [diff] [blame] | 1170 | rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_IRQ_GPIO, 0, |
| 1171 | GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, |
| 1172 | GPIO_CFG_8MA), GPIO_CFG_ENABLE); |
| 1173 | if (rc) { |
| 1174 | pr_err("%s: gpio_tlmm_config for %d failed\n", |
| 1175 | __func__, MXT_TS_IRQ_GPIO); |
| 1176 | } |
| 1177 | |
| 1178 | rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_RESET_GPIO, 0, |
| 1179 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, |
| 1180 | GPIO_CFG_8MA), GPIO_CFG_ENABLE); |
| 1181 | if (rc) { |
| 1182 | pr_err("%s: gpio_tlmm_config for %d failed\n", |
| 1183 | __func__, MXT_TS_RESET_GPIO); |
| 1184 | } |
| 1185 | |
| 1186 | i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID, |
| 1187 | mxt_device_info, |
| 1188 | ARRAY_SIZE(mxt_device_info)); |
Mohan Pallaka | 5afe985 | 2012-01-12 23:12:06 +0530 | [diff] [blame] | 1189 | } else if (machine_is_msm7627a_qrd3()) { |
| 1190 | ft5x06_touchpad_setup(); |
Mohan Pallaka | 4c5bb92 | 2011-11-23 15:54:51 +0530 | [diff] [blame] | 1191 | } |
| 1192 | |
| 1193 | /* headset */ |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1194 | platform_device_register(&hs_pdev); |
| 1195 | |
Mohan Pallaka | 4c5bb92 | 2011-11-23 15:54:51 +0530 | [diff] [blame] | 1196 | /* vibrator */ |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1197 | #ifdef CONFIG_MSM_RPC_VIBRATOR |
| 1198 | msm_init_pmic_vibrator(); |
| 1199 | #endif |
| 1200 | |
Mohan Pallaka | b6c44b3 | 2011-11-23 15:19:57 +0530 | [diff] [blame] | 1201 | /* keypad */ |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1202 | if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()) |
Mohan Pallaka | b6c44b3 | 2011-11-23 15:19:57 +0530 | [diff] [blame] | 1203 | platform_device_register(&kp_pdev_8625); |
Mohan Pallaka | ad78af8 | 2011-11-23 15:30:07 +0530 | [diff] [blame] | 1204 | |
| 1205 | /* leds */ |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1206 | if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()) { |
Mohan Pallaka | ad78af8 | 2011-11-23 15:30:07 +0530 | [diff] [blame] | 1207 | rc = gpio_tlmm_config(GPIO_CFG(LED_RED_GPIO_8625, 0, |
| 1208 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 1209 | GPIO_CFG_16MA), GPIO_CFG_ENABLE); |
| 1210 | if (rc) { |
| 1211 | pr_err("%s: gpio_tlmm_config for %d failed\n", |
| 1212 | __func__, LED_RED_GPIO_8625); |
| 1213 | } |
| 1214 | |
| 1215 | rc = gpio_tlmm_config(GPIO_CFG(LED_GREEN_GPIO_8625, 0, |
| 1216 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 1217 | GPIO_CFG_16MA), GPIO_CFG_ENABLE); |
| 1218 | if (rc) { |
| 1219 | pr_err("%s: gpio_tlmm_config for %d failed\n", |
| 1220 | __func__, LED_GREEN_GPIO_8625); |
| 1221 | } |
| 1222 | |
| 1223 | platform_device_register(&gpio_leds_8625); |
| 1224 | } |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1225 | } |
| 1226 | |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 1227 | static int __init msm_qrd_init_ar6000pm(void) |
| 1228 | { |
| 1229 | msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power; |
| 1230 | return platform_device_register(&msm_wlan_ar6000_pm_device); |
| 1231 | } |
| 1232 | |
Taniya Das | e380a2d | 2012-03-09 13:02:41 +0530 | [diff] [blame] | 1233 | static void __init msm_add_footswitch_devices(void) |
| 1234 | { |
| 1235 | platform_add_devices(msm_footswitch_devices, |
| 1236 | msm_num_footswitch_devices); |
| 1237 | } |
| 1238 | |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 1239 | static void add_platform_devices(void) |
| 1240 | { |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 1241 | if (machine_is_msm8625_evb() || machine_is_msm8625_qrd7()) { |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1242 | platform_add_devices(msm8625_evb_devices, |
| 1243 | ARRAY_SIZE(msm8625_evb_devices)); |
Aparna Mallavarapu | beafcbc | 2012-03-13 16:57:39 +0530 | [diff] [blame] | 1244 | platform_add_devices(qrd3_devices, |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 1245 | ARRAY_SIZE(qrd3_devices)); |
Aparna Mallavarapu | beafcbc | 2012-03-13 16:57:39 +0530 | [diff] [blame] | 1246 | } else { |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1247 | platform_add_devices(qrd7627a_devices, |
| 1248 | ARRAY_SIZE(qrd7627a_devices)); |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1249 | } |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 1250 | |
| 1251 | if (machine_is_msm7627a_qrd3()) |
| 1252 | platform_add_devices(qrd3_devices, |
| 1253 | ARRAY_SIZE(qrd3_devices)); |
| 1254 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1255 | platform_add_devices(common_devices, |
| 1256 | ARRAY_SIZE(common_devices)); |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 1257 | } |
| 1258 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1259 | #define UART1DM_RX_GPIO 45 |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1260 | static void __init qrd7627a_uart1dm_config(void) |
| 1261 | { |
| 1262 | msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO); |
| 1263 | if (cpu_is_msm8625()) |
| 1264 | msm8625_device_uart_dm1.dev.platform_data = |
| 1265 | &msm_uart_dm1_pdata; |
| 1266 | else |
| 1267 | msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata; |
| 1268 | } |
| 1269 | |
| 1270 | static void __init qrd7627a_otg_gadget(void) |
| 1271 | { |
| 1272 | msm_otg_pdata.swfi_latency = msm7627a_pm_data |
| 1273 | [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency; |
| 1274 | |
| 1275 | if (cpu_is_msm8625()) { |
| 1276 | msm8625_device_otg.dev.platform_data = &msm_otg_pdata; |
| 1277 | msm8625_device_gadget_peripheral.dev.platform_data = |
| 1278 | &msm_gadget_pdata; |
| 1279 | |
| 1280 | } else { |
| 1281 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 1282 | msm_device_gadget_peripheral.dev.platform_data = |
| 1283 | &msm_gadget_pdata; |
| 1284 | } |
| 1285 | } |
| 1286 | |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 1287 | static void __init msm_pm_init(void) |
| 1288 | { |
| 1289 | if (machine_is_msm8625_qrd7()) |
| 1290 | return; |
| 1291 | |
| 1292 | if (!machine_is_msm8625_evb()) { |
| 1293 | msm_pm_set_platform_data(msm7627a_pm_data, |
| 1294 | ARRAY_SIZE(msm7627a_pm_data)); |
| 1295 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
| 1296 | } else { |
| 1297 | msm_pm_set_platform_data(msm8625_pm_data, |
| 1298 | ARRAY_SIZE(msm8625_pm_data)); |
| 1299 | BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata)); |
| 1300 | msm8x25_spm_device_init(); |
| 1301 | } |
| 1302 | } |
| 1303 | |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1304 | static void __init msm_qrd_init(void) |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1305 | { |
| 1306 | msm7x2x_misc_init(); |
Pankaj Kumar | 3cec058 | 2011-11-18 11:13:29 +0530 | [diff] [blame] | 1307 | msm7627a_init_regulators(); |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1308 | msmqrd_adsp_add_pdev(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1309 | |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1310 | if (cpu_is_msm8625()) |
| 1311 | msm8625_device_i2c_init(); |
| 1312 | else |
| 1313 | msm7627a_device_i2c_init(); |
| 1314 | |
| 1315 | /* uart1dm*/ |
| 1316 | qrd7627a_uart1dm_config(); |
| 1317 | /*OTG gadget*/ |
| 1318 | qrd7627a_otg_gadget(); |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1319 | |
Taniya Das | e380a2d | 2012-03-09 13:02:41 +0530 | [diff] [blame] | 1320 | msm_add_footswitch_devices(); |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 1321 | add_platform_devices(); |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1322 | |
Santosh Sajjan | 374d659 | 2012-01-19 23:16:46 +0530 | [diff] [blame] | 1323 | /* Ensure ar6000pm device is registered before MMC/SDC */ |
| 1324 | msm_qrd_init_ar6000pm(); |
Chintan Pandya | cf467fc | 2011-12-01 17:11:11 +0530 | [diff] [blame] | 1325 | msm7627a_init_mmc(); |
| 1326 | |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1327 | #ifdef CONFIG_USB_EHCI_MSM_72K |
| 1328 | msm7627a_init_host(); |
| 1329 | #endif |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 1330 | msm_pm_init(); |
Murali Nalajala | a182784 | 2011-11-13 14:12:39 +0530 | [diff] [blame] | 1331 | |
Murali Nalajala | 2a0bbda | 2012-03-28 12:12:54 +0530 | [diff] [blame] | 1332 | msm_pm_register_irqs(); |
Taniya Das | 0a5303a | 2011-08-23 18:47:48 +0530 | [diff] [blame] | 1333 | msm_fb_add_devices(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1334 | |
| 1335 | #if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE) |
Chintan Pandya | 13490c0 | 2011-12-20 13:03:36 +0530 | [diff] [blame] | 1336 | msm7627a_bt_power_init(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1337 | #endif |
Taniya Das | da40882 | 2011-09-06 12:54:06 +0530 | [diff] [blame] | 1338 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1339 | msm7627a_camera_init(); |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1340 | msm7627a_add_io_devices(); |
Aparna Mallavarapu | d95d8fc | 2012-03-08 12:07:37 +0530 | [diff] [blame] | 1341 | msm7x25a_kgsl_3d0_init(); |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1342 | } |
| 1343 | |
| 1344 | static void __init qrd7627a_init_early(void) |
| 1345 | { |
| 1346 | msm_msm7627a_allocate_memory_regions(); |
| 1347 | } |
| 1348 | |
| 1349 | MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1") |
| 1350 | .boot_params = PHYS_OFFSET + 0x100, |
| 1351 | .map_io = msm_common_io_init, |
| 1352 | .reserve = msm7627a_reserve, |
| 1353 | .init_irq = msm_init_irq, |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1354 | .init_machine = msm_qrd_init, |
| 1355 | .timer = &msm_timer, |
| 1356 | .init_early = qrd7627a_init_early, |
| 1357 | .handle_irq = vic_handle_irq, |
| 1358 | MACHINE_END |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 1359 | MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3") |
| 1360 | .boot_params = PHYS_OFFSET + 0x100, |
| 1361 | .map_io = msm_common_io_init, |
| 1362 | .reserve = msm7627a_reserve, |
| 1363 | .init_irq = msm_init_irq, |
| 1364 | .init_machine = msm_qrd_init, |
| 1365 | .timer = &msm_timer, |
| 1366 | .init_early = qrd7627a_init_early, |
| 1367 | .handle_irq = vic_handle_irq, |
| 1368 | MACHINE_END |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1369 | MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB") |
| 1370 | .boot_params = PHYS_OFFSET + 0x100, |
| 1371 | .map_io = msm_common_io_init, |
| 1372 | .reserve = msm7627a_reserve, |
| 1373 | .init_irq = msm_init_irq, |
| 1374 | .init_machine = msm_qrd_init, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1375 | .timer = &msm_timer, |
| 1376 | .init_early = qrd7627a_init_early, |
Pankaj Kumar | bf8a2a3 | 2011-10-21 11:47:21 +0530 | [diff] [blame] | 1377 | .handle_irq = vic_handle_irq, |
Taniya Das | c98bfbc | 2011-08-23 09:58:55 +0530 | [diff] [blame] | 1378 | MACHINE_END |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1379 | MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB") |
| 1380 | .boot_params = PHYS_OFFSET + 0x100, |
| 1381 | .map_io = msm8625_map_io, |
Taniya Das | fe04d4f | 2012-03-14 11:13:21 +0530 | [diff] [blame] | 1382 | .reserve = msm8625_reserve, |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1383 | .init_irq = msm8625_init_irq, |
| 1384 | .init_machine = msm_qrd_init, |
| 1385 | .timer = &msm_timer, |
| 1386 | .init_early = qrd7627a_init_early, |
| 1387 | .handle_irq = gic_handle_irq, |
| 1388 | MACHINE_END |
Taniya Das | bd09654 | 2012-03-15 17:43:45 +0530 | [diff] [blame] | 1389 | MACHINE_START(MSM8625_QRD7, "QRD MSM8625 QRD7") |
| 1390 | .boot_params = PHYS_OFFSET + 0x100, |
| 1391 | .map_io = msm8625_map_io, |
| 1392 | .reserve = msm7627a_reserve, |
| 1393 | .init_irq = msm8625_init_irq, |
| 1394 | .init_machine = msm_qrd_init, |
| 1395 | .timer = &msm_timer, |
| 1396 | .init_early = qrd7627a_init_early, |
| 1397 | .handle_irq = gic_handle_irq, |
| 1398 | MACHINE_END |