blob: 0427632778ae23601dfb0b10378d63548df30c10 [file] [log] [blame]
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302 *
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 Kumar6f841742011-10-10 15:52:14 +053016#include <linux/usb/android.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053017#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 Dasda408822011-09-06 12:54:06 +053027#include <linux/input/rmi_platformdata.h>
28#include <linux/input/rmi_i2c.h>
Mohan Pallaka4c5bb922011-11-23 15:54:51 +053029#include <linux/i2c/atmel_mxt_ts.h>
Pankaj Kumar3cec0582011-11-18 11:13:29 +053030#include <linux/regulator/consumer.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053031#include <asm/mach/mmc.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <mach/board.h>
35#include <mach/msm_iomap.h>
36#include <mach/msm_hsusb.h>
37#include <mach/rpc_hsusb.h>
38#include <mach/rpc_pmapp.h>
39#include <mach/usbdiag.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053040#include <mach/msm_memtypes.h>
41#include <mach/msm_serial_hs.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053042#include <mach/pmic.h>
43#include <mach/socinfo.h>
44#include <mach/vreg.h>
45#include <mach/rpc_pmapp.h>
46#include <mach/msm_battery.h>
47#include <mach/rpc_server_handset.h>
48#include <mach/socinfo.h>
Pankaj Kumar27c02642011-09-22 15:55:55 +053049#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053050#include "devices.h"
51#include "devices-msm7x2xa.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080052#include "pm.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053053#include "timer.h"
Murali Nalajalaa1827842011-11-13 14:12:39 +053054#include "pm-boot.h"
Pankaj Kumar3cec0582011-11-18 11:13:29 +053055#include "board-msm7x27a-regulator.h"
Chintan Pandyacf467fc2011-12-01 17:11:11 +053056#include "board-msm7627a.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053057
58#define PMEM_KERNEL_EBI1_SIZE 0x3A000
59#define MSM_PMEM_AUDIO_SIZE 0x5B000
Taniya Dasc98bfbc2011-08-23 09:58:55 +053060#define BAHAMA_SLAVE_ID_FM_REG 0x02
61#define FM_GPIO 83
Rahul Kashyap8b4a7862011-12-13 18:40:54 +053062#define BT_PCM_BCLK_MODE 0x88
63#define BT_PCM_DIN_MODE 0x89
64#define BT_PCM_DOUT_MODE 0x8A
65#define BT_PCM_SYNC_MODE 0x8B
66#define FM_I2S_SD_MODE 0x8E
67#define FM_I2S_WS_MODE 0x8F
68#define FM_I2S_SCK_MODE 0x90
69#define I2C_PIN_CTL 0x15
70#define I2C_NORMAL 0x40
Taniya Dasc98bfbc2011-08-23 09:58:55 +053071
Taniya Dasc98bfbc2011-08-23 09:58:55 +053072static struct platform_device msm_wlan_ar6000_pm_device = {
73 .name = "wlan_ar6000_pm_dev",
74 .id = -1,
75};
76
Taniya Dasc98bfbc2011-08-23 09:58:55 +053077static struct msm_gpio qup_i2c_gpios_io[] = {
78 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
79 "qup_scl" },
80 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
81 "qup_sda" },
82 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
83 "qup_scl" },
84 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
85 "qup_sda" },
86};
87
88static struct msm_gpio qup_i2c_gpios_hw[] = {
89 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
90 "qup_scl" },
91 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
92 "qup_sda" },
93 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
94 "qup_scl" },
95 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
96 "qup_sda" },
97};
98
99static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
100{
101 int rc;
102
103 if (adap_id < 0 || adap_id > 1)
104 return;
105
106 /* Each adapter gets 2 lines from the table */
107 if (config_type)
108 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
109 else
110 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
111 if (rc < 0)
112 pr_err("QUP GPIO request/enable failed: %d\n", rc);
113}
114
115static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
116 .clk_freq = 100000,
117 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
118};
119
120static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
121 .clk_freq = 100000,
122 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
123};
124
125#ifdef CONFIG_ARCH_MSM7X27A
126#define MSM_PMEM_MDP_SIZE 0x1DD1000
127#define MSM_PMEM_ADSP_SIZE 0x1000000
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530128#endif
129
Taniya Dasda408822011-09-06 12:54:06 +0530130#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \
131defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE)
132
133#ifndef CLEARPAD3000_ATTEN_GPIO
134#define CLEARPAD3000_ATTEN_GPIO (48)
135#endif
136
137#ifndef CLEARPAD3000_RESET_GPIO
138#define CLEARPAD3000_RESET_GPIO (26)
139#endif
140
141static int synaptics_touchpad_setup(void);
142
143static struct msm_gpio clearpad3000_cfg_data[] = {
144 {GPIO_CFG(CLEARPAD3000_ATTEN_GPIO, 0, GPIO_CFG_INPUT,
145 GPIO_CFG_NO_PULL, GPIO_CFG_6MA), "rmi4_attn"},
146 {GPIO_CFG(CLEARPAD3000_RESET_GPIO, 0, GPIO_CFG_OUTPUT,
147 GPIO_CFG_PULL_DOWN, GPIO_CFG_8MA), "rmi4_reset"},
148};
149
150static struct rmi_XY_pair rmi_offset = {.x = 0, .y = 0};
151static struct rmi_range rmi_clipx = {.min = 48, .max = 980};
152static struct rmi_range rmi_clipy = {.min = 7, .max = 1647};
153static struct rmi_f11_functiondata synaptics_f11_data = {
154 .swap_axes = false,
155 .flipX = false,
156 .flipY = false,
157 .offset = &rmi_offset,
158 .button_height = 113,
159 .clipX = &rmi_clipx,
160 .clipY = &rmi_clipy,
161};
162
163#define MAX_LEN 100
164
165static ssize_t clearpad3000_virtual_keys_register(struct kobject *kobj,
166 struct kobj_attribute *attr, char *buf)
167{
168 char *virtual_keys = __stringify(EV_KEY) ":" __stringify(KEY_MENU) \
169 ":60:830:120:60" ":" __stringify(EV_KEY) \
170 ":" __stringify(KEY_HOME) ":180:830:120:60" \
171 ":" __stringify(EV_KEY) ":" \
172 __stringify(KEY_SEARCH) ":300:830:120:60" \
173 ":" __stringify(EV_KEY) ":" \
174 __stringify(KEY_BACK) ":420:830:120:60" "\n";
175
176 return snprintf(buf, strnlen(virtual_keys, MAX_LEN) + 1 , "%s",
177 virtual_keys);
178}
179
180static struct kobj_attribute clearpad3000_virtual_keys_attr = {
181 .attr = {
182 .name = "virtualkeys.sensor00fn11",
183 .mode = S_IRUGO,
184 },
185 .show = &clearpad3000_virtual_keys_register,
186};
187
188static struct attribute *virtual_key_properties_attrs[] = {
189 &clearpad3000_virtual_keys_attr.attr,
190 NULL
191};
192
193static struct attribute_group virtual_key_properties_attr_group = {
194 .attrs = virtual_key_properties_attrs,
195};
196
197struct kobject *virtual_key_properties_kobj;
198
199static struct rmi_functiondata synaptics_functiondata[] = {
200 {
201 .function_index = RMI_F11_INDEX,
202 .data = &synaptics_f11_data,
203 },
204};
205
206static struct rmi_functiondata_list synaptics_perfunctiondata = {
207 .count = ARRAY_SIZE(synaptics_functiondata),
208 .functiondata = synaptics_functiondata,
209};
210
211static struct rmi_sensordata synaptics_sensordata = {
212 .perfunctiondata = &synaptics_perfunctiondata,
213 .rmi_sensor_setup = synaptics_touchpad_setup,
214};
215
216static struct rmi_i2c_platformdata synaptics_platformdata = {
217 .i2c_address = 0x2c,
218 .irq_type = IORESOURCE_IRQ_LOWLEVEL,
219 .sensordata = &synaptics_sensordata,
220};
221
222static struct i2c_board_info synaptic_i2c_clearpad3k[] = {
223 {
224 I2C_BOARD_INFO("rmi4_ts", 0x2c),
225 .platform_data = &synaptics_platformdata,
226 },
227};
228
229static int synaptics_touchpad_setup(void)
230{
231 int retval = 0;
232
233 virtual_key_properties_kobj =
234 kobject_create_and_add("board_properties", NULL);
235 if (virtual_key_properties_kobj)
236 retval = sysfs_create_group(virtual_key_properties_kobj,
237 &virtual_key_properties_attr_group);
238 if (!virtual_key_properties_kobj || retval)
239 pr_err("failed to create ft5202 board_properties\n");
240
241 retval = msm_gpios_request_enable(clearpad3000_cfg_data,
242 sizeof(clearpad3000_cfg_data)/sizeof(struct msm_gpio));
243 if (retval) {
244 pr_err("%s:Failed to obtain touchpad GPIO %d. Code: %d.",
245 __func__, CLEARPAD3000_ATTEN_GPIO, retval);
246 retval = 0; /* ignore the err */
247 }
248 synaptics_platformdata.irq = gpio_to_irq(CLEARPAD3000_ATTEN_GPIO);
249
250 gpio_set_value(CLEARPAD3000_RESET_GPIO, 0);
251 usleep(10000);
252 gpio_set_value(CLEARPAD3000_RESET_GPIO, 1);
253 usleep(50000);
254
255 return retval;
256}
257#endif
258
259
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530260static struct android_usb_platform_data android_usb_pdata = {
Pankaj Kumar6f841742011-10-10 15:52:14 +0530261 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530262};
263
264static struct platform_device android_usb_device = {
265 .name = "android_usb",
266 .id = -1,
267 .dev = {
268 .platform_data = &android_usb_pdata,
269 },
270};
271
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530272#ifdef CONFIG_USB_EHCI_MSM_72K
273static void msm_hsusb_vbus_power(unsigned phy_info, int on)
274{
275 int rc = 0;
276 unsigned gpio;
277
Chintan Pandya40762702011-12-06 13:47:06 +0530278 gpio = QRD_GPIO_HOST_VBUS_EN;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530279
280 rc = gpio_request(gpio, "i2c_host_vbus_en");
281 if (rc < 0) {
282 pr_err("failed to request %d GPIO\n", gpio);
283 return;
284 }
285 gpio_direction_output(gpio, !!on);
286 gpio_set_value_cansleep(gpio, !!on);
287 gpio_free(gpio);
288}
289
290static struct msm_usb_host_platform_data msm_usb_host_pdata = {
291 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
292};
293
294static void __init msm7627a_init_host(void)
295{
296 msm_add_host(0, &msm_usb_host_pdata);
297}
298#endif
299
300#ifdef CONFIG_USB_MSM_OTG_72K
301static int hsusb_rpc_connect(int connect)
302{
303 if (connect)
304 return msm_hsusb_rpc_connect();
305 else
306 return msm_hsusb_rpc_close();
307}
308
Pankaj Kumar27c02642011-09-22 15:55:55 +0530309static struct regulator *reg_hsusb;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530310static int msm_hsusb_ldo_init(int init)
311{
Pankaj Kumar27c02642011-09-22 15:55:55 +0530312 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530313
Pankaj Kumar27c02642011-09-22 15:55:55 +0530314 if (init) {
315 reg_hsusb = regulator_get(NULL, "usb");
316 if (IS_ERR(reg_hsusb)) {
317 rc = PTR_ERR(reg_hsusb);
318 pr_err("%s: could not get regulator: %d\n",
319 __func__, rc);
320 goto out;
321 }
322
323 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
324 if (rc) {
325 pr_err("%s: could not set voltage: %d\n",
326 __func__, rc);
327 goto reg_free;
328 }
329
330 return 0;
331 }
332 /* else fall through */
333reg_free:
334 regulator_put(reg_hsusb);
335out:
336 reg_hsusb = NULL;
337 return rc;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530338}
339
340static int msm_hsusb_ldo_enable(int enable)
341{
342 static int ldo_status;
343
Pankaj Kumar27c02642011-09-22 15:55:55 +0530344 if (IS_ERR_OR_NULL(reg_hsusb))
345 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530346
347 if (ldo_status == enable)
348 return 0;
349
350 ldo_status = enable;
351
Pankaj Kumar27c02642011-09-22 15:55:55 +0530352 return enable ?
353 regulator_enable(reg_hsusb) :
354 regulator_disable(reg_hsusb);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530355}
356
357#ifndef CONFIG_USB_EHCI_MSM_72K
358static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
359{
360 int ret = 0;
361
362 if (init)
363 ret = msm_pm_app_rpc_init(callback);
364 else
365 msm_pm_app_rpc_deinit(callback);
366
367 return ret;
368}
369#endif
370
371static struct msm_otg_platform_data msm_otg_pdata = {
372#ifndef CONFIG_USB_EHCI_MSM_72K
373 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
374#else
375 .vbus_power = msm_hsusb_vbus_power,
376#endif
377 .rpc_connect = hsusb_rpc_connect,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530378 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
379 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
380 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
381 .se1_gating = SE1_GATING_DISABLE,
382 .ldo_init = msm_hsusb_ldo_init,
383 .ldo_enable = msm_hsusb_ldo_enable,
384 .chg_init = hsusb_chg_init,
385 .chg_connected = hsusb_chg_connected,
386 .chg_vbus_draw = hsusb_chg_vbus_draw,
387};
388#endif
389
390static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
391 .is_phy_status_timer_on = 1,
392};
393
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530394#ifdef CONFIG_SERIAL_MSM_HS
395static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
396 .inject_rx_on_wakeup = 1,
397 .rx_to_inject = 0xFD,
398};
399#endif
400static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
401 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
402 .idle_supported = 1,
403 .suspend_supported = 1,
404 .idle_enabled = 1,
405 .suspend_enabled = 1,
406 .latency = 16000,
407 .residency = 20000,
408 },
409 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
410 .idle_supported = 1,
411 .suspend_supported = 1,
412 .idle_enabled = 1,
413 .suspend_enabled = 1,
414 .latency = 12000,
415 .residency = 20000,
416 },
417 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
418 .idle_supported = 1,
419 .suspend_supported = 1,
420 .idle_enabled = 0,
421 .suspend_enabled = 1,
422 .latency = 2000,
423 .residency = 0,
424 },
425 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
426 .idle_supported = 1,
427 .suspend_supported = 1,
428 .idle_enabled = 1,
429 .suspend_enabled = 1,
430 .latency = 2,
431 .residency = 0,
432 },
433};
434
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600435static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +0530436 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS,
437 .p_addr = 0,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600438};
439
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530440static struct android_pmem_platform_data android_pmem_adsp_pdata = {
441 .name = "pmem_adsp",
442 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
443 .cached = 1,
444 .memory_type = MEMTYPE_EBI1,
445};
446
447static struct platform_device android_pmem_adsp_device = {
448 .name = "android_pmem",
449 .id = 1,
450 .dev = { .platform_data = &android_pmem_adsp_pdata },
451};
452
453static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
454static int __init pmem_mdp_size_setup(char *p)
455{
456 pmem_mdp_size = memparse(p, NULL);
457 return 0;
458}
459
460early_param("pmem_mdp_size", pmem_mdp_size_setup);
461
462static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
463static int __init pmem_adsp_size_setup(char *p)
464{
465 pmem_adsp_size = memparse(p, NULL);
466 return 0;
467}
468
469early_param("pmem_adsp_size", pmem_adsp_size_setup);
470
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530471#define SND(desc, num) { .name = #desc, .id = num }
472static struct snd_endpoint snd_endpoints_list[] = {
473 SND(HANDSET, 0),
474 SND(MONO_HEADSET, 2),
475 SND(HEADSET, 3),
476 SND(SPEAKER, 6),
477 SND(TTY_HEADSET, 8),
478 SND(TTY_VCO, 9),
479 SND(TTY_HCO, 10),
480 SND(BT, 12),
481 SND(IN_S_SADC_OUT_HANDSET, 16),
482 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
483 SND(FM_DIGITAL_STEREO_HEADSET, 26),
484 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
485 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +0530486 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Phani Kumar Alladad6971252011-10-19 10:50:15 +0530487 SND(CURRENT, 0x7FFFFFFE),
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530488 SND(FM_ANALOG_STEREO_HEADSET, 35),
489 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
490};
491#undef SND
492
493static struct msm_snd_endpoints msm_device_snd_endpoints = {
494 .endpoints = snd_endpoints_list,
495 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
496};
497
498static struct platform_device msm_device_snd = {
499 .name = "msm_snd",
500 .id = -1,
501 .dev = {
502 .platform_data = &msm_device_snd_endpoints
503 },
504};
505
506#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
507 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
508 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
509 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
510 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
511 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
512#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
513 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
514 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
515 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
516 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
517 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
518#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
519 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
520 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
521 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
522 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
523 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
524#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
525 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
526 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
527 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
528 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
529 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
530#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
531
532static unsigned int dec_concurrency_table[] = {
533 /* Audio LP */
534 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
535 0, 0, 0,
536
537 /* Concurrency 1 */
538 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
539 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
540 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
541 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
542 (DEC4_FORMAT),
543
544 /* Concurrency 2 */
545 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
546 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
547 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
548 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
549 (DEC4_FORMAT),
550
551 /* Concurrency 3 */
552 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
553 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
554 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
555 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
556 (DEC4_FORMAT),
557
558 /* Concurrency 4 */
559 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
560 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
561 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
562 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
563 (DEC4_FORMAT),
564
565 /* Concurrency 5 */
566 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
567 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
568 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
569 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
570 (DEC4_FORMAT),
571
572 /* Concurrency 6 */
573 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
574 0, 0, 0, 0,
575
576 /* Concurrency 7 */
577 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
578 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
579 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
580 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
581 (DEC4_FORMAT),
582};
583
584#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
585 .module_queueid = queueid, .module_decid = decid, \
586 .nr_codec_support = nr_codec}
587
588static struct msm_adspdec_info dec_info_list[] = {
589 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
590 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
591 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
592 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
593 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
594};
595
596static struct msm_adspdec_database msm_device_adspdec_database = {
597 .num_dec = ARRAY_SIZE(dec_info_list),
598 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
599 ARRAY_SIZE(dec_info_list)),
600 .dec_concurrency_table = dec_concurrency_table,
601 .dec_info_list = dec_info_list,
602};
603
604static struct platform_device msm_device_adspdec = {
605 .name = "msm_adspdec",
606 .id = -1,
607 .dev = {
608 .platform_data = &msm_device_adspdec_database
609 },
610};
611
612static struct android_pmem_platform_data android_pmem_audio_pdata = {
613 .name = "pmem_audio",
614 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
615 .cached = 0,
616 .memory_type = MEMTYPE_EBI1,
617};
618
619static struct platform_device android_pmem_audio_device = {
620 .name = "android_pmem",
621 .id = 2,
622 .dev = { .platform_data = &android_pmem_audio_pdata },
623};
624
625static struct android_pmem_platform_data android_pmem_pdata = {
626 .name = "pmem",
627 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
628 .cached = 1,
629 .memory_type = MEMTYPE_EBI1,
630};
631static struct platform_device android_pmem_device = {
632 .name = "android_pmem",
633 .id = 0,
634 .dev = { .platform_data = &android_pmem_pdata },
635};
636
637static u32 msm_calculate_batt_capacity(u32 current_voltage);
638
639static struct msm_psy_batt_pdata msm_psy_batt_data = {
640 .voltage_min_design = 2800,
641 .voltage_max_design = 4300,
642 .avail_chg_sources = AC_CHG | USB_CHG ,
643 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
644 .calculate_capacity = &msm_calculate_batt_capacity,
645};
646
647static u32 msm_calculate_batt_capacity(u32 current_voltage)
648{
649 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
650 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
651
652 return (current_voltage - low_voltage) * 100
653 / (high_voltage - low_voltage);
654}
655
656static struct platform_device msm_batt_device = {
657 .name = "msm-battery",
658 .id = -1,
659 .dev.platform_data = &msm_psy_batt_data,
660};
661
Taniya Dasc868a2e2012-01-03 10:18:47 +0530662static struct platform_device *qrd_common_devices[] __initdata = {
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530663 &msm_device_dmov,
664 &msm_device_smd,
665 &msm_device_uart1,
666 &msm_device_uart_dm1,
667 &msm_gsbi0_qup_i2c_device,
668 &msm_gsbi1_qup_i2c_device,
669 &msm_device_otg,
670 &msm_device_gadget_peripheral,
671 &android_usb_device,
672 &android_pmem_device,
673 &android_pmem_adsp_device,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530674 &android_pmem_audio_device,
675 &msm_device_snd,
676 &msm_device_adspdec,
677 &msm_batt_device,
678 &msm_kgsl_3d0,
679#ifdef CONFIG_BT
680 &msm_bt_power_device,
681#endif
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530682 &asoc_msm_pcm,
683 &asoc_msm_dai0,
684 &asoc_msm_dai1,
685};
686
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530687static struct platform_device *qrd3_devices[] __initdata = {
688 &msm_device_nand,
689};
690
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530691static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
692static int __init pmem_kernel_ebi1_size_setup(char *p)
693{
694 pmem_kernel_ebi1_size = memparse(p, NULL);
695 return 0;
696}
697early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
698
699static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
700static int __init pmem_audio_size_setup(char *p)
701{
702 pmem_audio_size = memparse(p, NULL);
703 return 0;
704}
705early_param("pmem_audio_size", pmem_audio_size_setup);
706
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530707static struct memtype_reserve msm7627a_reserve_table[] __initdata = {
708 [MEMTYPE_SMI] = {
709 },
710 [MEMTYPE_EBI0] = {
711 .flags = MEMTYPE_FLAGS_1M_ALIGN,
712 },
713 [MEMTYPE_EBI1] = {
714 .flags = MEMTYPE_FLAGS_1M_ALIGN,
715 },
716};
717
718static void __init size_pmem_devices(void)
719{
720#ifdef CONFIG_ANDROID_PMEM
721 android_pmem_adsp_pdata.size = pmem_adsp_size;
722 android_pmem_pdata.size = pmem_mdp_size;
723 android_pmem_audio_pdata.size = pmem_audio_size;
724#endif
725}
726
727static void __init reserve_memory_for(struct android_pmem_platform_data *p)
728{
729 msm7627a_reserve_table[p->memory_type].size += p->size;
730}
731
732static void __init reserve_pmem_memory(void)
733{
734#ifdef CONFIG_ANDROID_PMEM
735 reserve_memory_for(&android_pmem_adsp_pdata);
736 reserve_memory_for(&android_pmem_pdata);
737 reserve_memory_for(&android_pmem_audio_pdata);
738 msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
739#endif
740}
741
742static void __init msm7627a_calculate_reserve_sizes(void)
743{
744 size_pmem_devices();
745 reserve_pmem_memory();
746}
747
748static int msm7627a_paddr_to_memtype(unsigned int paddr)
749{
750 return MEMTYPE_EBI1;
751}
752
753static struct reserve_info msm7627a_reserve_info __initdata = {
754 .memtype_reserve_table = msm7627a_reserve_table,
755 .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes,
756 .paddr_to_memtype = msm7627a_paddr_to_memtype,
757};
758
759static void __init msm7627a_reserve(void)
760{
761 reserve_info = &msm7627a_reserve_info;
762 msm_reserve();
763}
764
765static void __init msm_device_i2c_init(void)
766{
767 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
768 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
769}
770
771static struct msm_handset_platform_data hs_platform_data = {
772 .hs_name = "7k_handset",
773 .pwr_key_delay_ms = 500, /* 0 will disable end key */
774};
775
776static struct platform_device hs_pdev = {
777 .name = "msm-handset",
778 .id = -1,
779 .dev = {
780 .platform_data = &hs_platform_data,
781 },
782};
783
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530784static struct platform_device msm_proccomm_regulator_dev = {
785 .name = PROCCOMM_REGULATOR_DEV_NAME,
786 .id = -1,
787 .dev = {
788 .platform_data = &msm7x27a_proccomm_regulator_data
789 }
790};
791
792static void __init msm7627a_init_regulators(void)
793{
794 int rc = platform_device_register(&msm_proccomm_regulator_dev);
795 if (rc)
796 pr_err("%s: could not register regulator device: %d\n",
797 __func__, rc);
798}
799
Mohan Pallakab6c44b32011-11-23 15:19:57 +0530800/* 8625 keypad device information */
801static unsigned int kp_row_gpios_8625[] = {31};
802static unsigned int kp_col_gpios_8625[] = {36, 37};
803
804static const unsigned short keymap_8625[] = {
805 KEY_VOLUMEUP,
806 KEY_VOLUMEDOWN,
807};
808
809static struct gpio_event_matrix_info kp_matrix_info_8625 = {
810 .info.func = gpio_event_matrix_func,
811 .keymap = keymap_8625,
812 .output_gpios = kp_row_gpios_8625,
813 .input_gpios = kp_col_gpios_8625,
814 .noutputs = ARRAY_SIZE(kp_row_gpios_8625),
815 .ninputs = ARRAY_SIZE(kp_col_gpios_8625),
816 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
817 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
818 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
819 GPIOKPF_PRINT_UNMAPPED_KEYS,
820};
821
822static struct gpio_event_info *kp_info_8625[] = {
823 &kp_matrix_info_8625.info,
824};
825static struct gpio_event_platform_data kp_pdata_8625 = {
826 .name = "8625_kp",
827 .info = kp_info_8625,
828 .info_count = ARRAY_SIZE(kp_info_8625)
829};
830
831static struct platform_device kp_pdev_8625 = {
832 .name = GPIO_EVENT_DEV_NAME,
833 .id = -1,
834 .dev = {
835 .platform_data = &kp_pdata_8625,
836 },
837};
838
Mohan Pallakaad78af82011-11-23 15:30:07 +0530839#define LED_RED_GPIO_8625 49
840#define LED_GREEN_GPIO_8625 34
841
842static struct gpio_led gpio_leds_config_8625[] = {
843 {
844 .name = "green",
845 .gpio = LED_GREEN_GPIO_8625,
846 },
847 {
848 .name = "red",
849 .gpio = LED_RED_GPIO_8625,
850 },
851};
852
853static struct gpio_led_platform_data gpio_leds_pdata_8625 = {
854 .num_leds = ARRAY_SIZE(gpio_leds_config_8625),
855 .leds = gpio_leds_config_8625,
856};
857
858static struct platform_device gpio_leds_8625 = {
859 .name = "leds-gpio",
860 .id = -1,
861 .dev = {
862 .platform_data = &gpio_leds_pdata_8625,
863 },
864};
865
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530866#define MXT_TS_IRQ_GPIO 48
867#define MXT_TS_RESET_GPIO 26
868
869static const u8 mxt_config_data[] = {
870 /* T6 Object */
871 0, 0, 0, 0, 0, 0,
872 /* T38 Object */
873 16, 0, 0, 0, 0, 0, 0, 0,
874 /* T7 Object */
875 255, 255, 10,
876 /* T8 Object */
877 30, 0, 20, 20, 0, 0, 20, 0, 50, 0,
878 /* T9 Object */
879 3, 0, 0, 18, 11, 0, 32, 75, 3, 3,
880 0, 1, 1, 0, 10, 10, 10, 10, 31, 3,
881 223, 1, 11, 11, 15, 15, 151, 43, 145, 80,
882 100, 15, 0, 0, 0,
883 /* T15 Object */
884 131, 0, 11, 11, 1, 1, 0, 45, 3, 0,
885 0,
886 /* T18 Object */
887 0, 0,
888 /* T19 Object */
889 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
890 0, 0, 0, 0, 0, 0,
891 /* T23 Object */
892 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
893 0, 0, 0, 0, 0,
894 /* T25 Object */
895 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
896 0, 0, 0, 0,
897 /* T40 Object */
898 0, 0, 0, 0, 0,
899 /* T42 Object */
900 0, 0, 0, 0, 0, 0, 0, 0,
901 /* T46 Object */
902 0, 2, 32, 48, 0, 0, 0, 0, 0,
903 /* T47 Object */
904 1, 20, 60, 5, 2, 50, 40, 0, 0, 40,
905 /* T48 Object */
906 1, 12, 80, 0, 0, 0, 0, 0, 0, 0,
907 0, 0, 0, 6, 6, 0, 0, 100, 4, 64,
908 10, 0, 20, 5, 0, 38, 0, 20, 0, 0,
909 0, 0, 0, 0, 16, 65, 3, 1, 1, 0,
910 10, 10, 10, 0, 0, 15, 15, 154, 58, 145,
911 80, 100, 15, 3,
912};
913
914static struct mxt_config_info mxt_config_array[] = {
915 {
916 .config = mxt_config_data,
917 .config_length = ARRAY_SIZE(mxt_config_data),
918 .family_id = 0x81,
919 .variant_id = 0x01,
920 .version = 0x10,
921 .build = 0xAA,
922 },
923};
924
925static int mxt_key_codes[MXT_KEYARRAY_MAX_KEYS] = {
926 [0] = KEY_HOME,
927 [1] = KEY_MENU,
928 [9] = KEY_BACK,
929 [10] = KEY_SEARCH,
930};
931
932static struct mxt_platform_data mxt_platform_data = {
933 .config_array = mxt_config_array,
934 .config_array_size = ARRAY_SIZE(mxt_config_array),
935 .x_size = 479,
936 .y_size = 799,
937 .irqflags = IRQF_TRIGGER_FALLING,
938 .i2c_pull_up = true,
939 .reset_gpio = MXT_TS_RESET_GPIO,
940 .irq_gpio = MXT_TS_IRQ_GPIO,
941 .key_codes = mxt_key_codes,
942};
943
944static struct i2c_board_info mxt_device_info[] __initdata = {
945 {
946 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
947 .platform_data = &mxt_platform_data,
948 .irq = MSM_GPIO_TO_INT(MXT_TS_IRQ_GPIO),
949 },
950};
951
Taniya Dasc868a2e2012-01-03 10:18:47 +0530952static void msm7627a_add_io_devices(void)
953{
Mohan Pallakaad78af82011-11-23 15:30:07 +0530954 int rc;
955
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530956 /* touchscreen */
957 if (machine_is_msm7627a_qrd1()) {
958 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
959 synaptic_i2c_clearpad3k,
960 ARRAY_SIZE(synaptic_i2c_clearpad3k));
961 } else if (machine_is_msm7627a_evb()) {
962 rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_IRQ_GPIO, 0,
963 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
964 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
965 if (rc) {
966 pr_err("%s: gpio_tlmm_config for %d failed\n",
967 __func__, MXT_TS_IRQ_GPIO);
968 }
969
970 rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_RESET_GPIO, 0,
971 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN,
972 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
973 if (rc) {
974 pr_err("%s: gpio_tlmm_config for %d failed\n",
975 __func__, MXT_TS_RESET_GPIO);
976 }
977
978 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
979 mxt_device_info,
980 ARRAY_SIZE(mxt_device_info));
981 }
982
983 /* headset */
Taniya Dasc868a2e2012-01-03 10:18:47 +0530984 platform_device_register(&hs_pdev);
985
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530986 /* vibrator */
Taniya Dasc868a2e2012-01-03 10:18:47 +0530987#ifdef CONFIG_MSM_RPC_VIBRATOR
988 msm_init_pmic_vibrator();
989#endif
990
Mohan Pallakab6c44b32011-11-23 15:19:57 +0530991 /* keypad */
992 if (machine_is_msm7627a_evb())
993 platform_device_register(&kp_pdev_8625);
Mohan Pallakaad78af82011-11-23 15:30:07 +0530994
995 /* leds */
996 if (machine_is_msm7627a_evb()) {
997 rc = gpio_tlmm_config(GPIO_CFG(LED_RED_GPIO_8625, 0,
998 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
999 GPIO_CFG_16MA), GPIO_CFG_ENABLE);
1000 if (rc) {
1001 pr_err("%s: gpio_tlmm_config for %d failed\n",
1002 __func__, LED_RED_GPIO_8625);
1003 }
1004
1005 rc = gpio_tlmm_config(GPIO_CFG(LED_GREEN_GPIO_8625, 0,
1006 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
1007 GPIO_CFG_16MA), GPIO_CFG_ENABLE);
1008 if (rc) {
1009 pr_err("%s: gpio_tlmm_config for %d failed\n",
1010 __func__, LED_GREEN_GPIO_8625);
1011 }
1012
1013 platform_device_register(&gpio_leds_8625);
1014 }
Taniya Dasc868a2e2012-01-03 10:18:47 +05301015}
1016
Santosh Sajjan374d6592012-01-19 23:16:46 +05301017static int __init msm_qrd_init_ar6000pm(void)
1018{
1019 msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power;
1020 return platform_device_register(&msm_wlan_ar6000_pm_device);
1021}
1022
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301023static void add_platform_devices(void)
1024{
1025 platform_add_devices(qrd_common_devices,
1026 ARRAY_SIZE(qrd_common_devices));
1027
1028 if (machine_is_msm7627a_qrd3())
1029 platform_add_devices(qrd3_devices,
1030 ARRAY_SIZE(qrd3_devices));
1031}
1032
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301033#define UART1DM_RX_GPIO 45
Taniya Dasc868a2e2012-01-03 10:18:47 +05301034static void __init msm_qrd_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301035{
1036 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +05301037 msm7627a_init_regulators();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301038 msm_device_i2c_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301039#ifdef CONFIG_SERIAL_MSM_HS
1040 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
1041 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
1042#endif
1043
1044#ifdef CONFIG_USB_MSM_OTG_72K
1045 msm_otg_pdata.swfi_latency = msm7627a_pm_data
1046 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
1047 msm_device_otg.dev.platform_data = &msm_otg_pdata;
1048#endif
1049 msm_device_gadget_peripheral.dev.platform_data =
Taniya Das7a22cdd2011-09-08 14:57:00 +05301050 &msm_gadget_pdata;
Taniya Dasc868a2e2012-01-03 10:18:47 +05301051
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301052 add_platform_devices();
Taniya Dasc868a2e2012-01-03 10:18:47 +05301053
Santosh Sajjan374d6592012-01-19 23:16:46 +05301054 /* Ensure ar6000pm device is registered before MMC/SDC */
1055 msm_qrd_init_ar6000pm();
Chintan Pandyacf467fc2011-12-01 17:11:11 +05301056 msm7627a_init_mmc();
1057
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301058#ifdef CONFIG_USB_EHCI_MSM_72K
1059 msm7627a_init_host();
1060#endif
1061 msm_pm_set_platform_data(msm7627a_pm_data,
1062 ARRAY_SIZE(msm7627a_pm_data));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001063 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Murali Nalajalaa1827842011-11-13 14:12:39 +05301064
Taniya Das0a5303a2011-08-23 18:47:48 +05301065 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301066
1067#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +05301068 msm7627a_bt_power_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301069#endif
Taniya Dasda408822011-09-06 12:54:06 +05301070
Chintan Pandya40762702011-12-06 13:47:06 +05301071 msm7627a_camera_init();
Taniya Das7a22cdd2011-09-08 14:57:00 +05301072
Taniya Dasc868a2e2012-01-03 10:18:47 +05301073 msm7627a_add_io_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301074}
1075
1076static void __init qrd7627a_init_early(void)
1077{
1078 msm_msm7627a_allocate_memory_regions();
1079}
1080
1081MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
1082 .boot_params = PHYS_OFFSET + 0x100,
1083 .map_io = msm_common_io_init,
1084 .reserve = msm7627a_reserve,
1085 .init_irq = msm_init_irq,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301086 .init_machine = msm_qrd_init,
1087 .timer = &msm_timer,
1088 .init_early = qrd7627a_init_early,
1089 .handle_irq = vic_handle_irq,
1090MACHINE_END
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301091MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3")
1092 .boot_params = PHYS_OFFSET + 0x100,
1093 .map_io = msm_common_io_init,
1094 .reserve = msm7627a_reserve,
1095 .init_irq = msm_init_irq,
1096 .init_machine = msm_qrd_init,
1097 .timer = &msm_timer,
1098 .init_early = qrd7627a_init_early,
1099 .handle_irq = vic_handle_irq,
1100MACHINE_END
Taniya Dasc868a2e2012-01-03 10:18:47 +05301101MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB")
1102 .boot_params = PHYS_OFFSET + 0x100,
1103 .map_io = msm_common_io_init,
1104 .reserve = msm7627a_reserve,
1105 .init_irq = msm_init_irq,
1106 .init_machine = msm_qrd_init,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301107 .timer = &msm_timer,
1108 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +05301109 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301110MACHINE_END