blob: 5052bb04683a880d68c460ef1ade880fde4ad1af [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"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080052#include <mach/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
687static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
688static int __init pmem_kernel_ebi1_size_setup(char *p)
689{
690 pmem_kernel_ebi1_size = memparse(p, NULL);
691 return 0;
692}
693early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
694
695static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
696static int __init pmem_audio_size_setup(char *p)
697{
698 pmem_audio_size = memparse(p, NULL);
699 return 0;
700}
701early_param("pmem_audio_size", pmem_audio_size_setup);
702
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530703static struct memtype_reserve msm7627a_reserve_table[] __initdata = {
704 [MEMTYPE_SMI] = {
705 },
706 [MEMTYPE_EBI0] = {
707 .flags = MEMTYPE_FLAGS_1M_ALIGN,
708 },
709 [MEMTYPE_EBI1] = {
710 .flags = MEMTYPE_FLAGS_1M_ALIGN,
711 },
712};
713
714static void __init size_pmem_devices(void)
715{
716#ifdef CONFIG_ANDROID_PMEM
717 android_pmem_adsp_pdata.size = pmem_adsp_size;
718 android_pmem_pdata.size = pmem_mdp_size;
719 android_pmem_audio_pdata.size = pmem_audio_size;
720#endif
721}
722
723static void __init reserve_memory_for(struct android_pmem_platform_data *p)
724{
725 msm7627a_reserve_table[p->memory_type].size += p->size;
726}
727
728static void __init reserve_pmem_memory(void)
729{
730#ifdef CONFIG_ANDROID_PMEM
731 reserve_memory_for(&android_pmem_adsp_pdata);
732 reserve_memory_for(&android_pmem_pdata);
733 reserve_memory_for(&android_pmem_audio_pdata);
734 msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
735#endif
736}
737
738static void __init msm7627a_calculate_reserve_sizes(void)
739{
740 size_pmem_devices();
741 reserve_pmem_memory();
742}
743
744static int msm7627a_paddr_to_memtype(unsigned int paddr)
745{
746 return MEMTYPE_EBI1;
747}
748
749static struct reserve_info msm7627a_reserve_info __initdata = {
750 .memtype_reserve_table = msm7627a_reserve_table,
751 .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes,
752 .paddr_to_memtype = msm7627a_paddr_to_memtype,
753};
754
755static void __init msm7627a_reserve(void)
756{
757 reserve_info = &msm7627a_reserve_info;
758 msm_reserve();
759}
760
761static void __init msm_device_i2c_init(void)
762{
763 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
764 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
765}
766
767static struct msm_handset_platform_data hs_platform_data = {
768 .hs_name = "7k_handset",
769 .pwr_key_delay_ms = 500, /* 0 will disable end key */
770};
771
772static struct platform_device hs_pdev = {
773 .name = "msm-handset",
774 .id = -1,
775 .dev = {
776 .platform_data = &hs_platform_data,
777 },
778};
779
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530780static struct platform_device msm_proccomm_regulator_dev = {
781 .name = PROCCOMM_REGULATOR_DEV_NAME,
782 .id = -1,
783 .dev = {
784 .platform_data = &msm7x27a_proccomm_regulator_data
785 }
786};
787
788static void __init msm7627a_init_regulators(void)
789{
790 int rc = platform_device_register(&msm_proccomm_regulator_dev);
791 if (rc)
792 pr_err("%s: could not register regulator device: %d\n",
793 __func__, rc);
794}
795
Mohan Pallakab6c44b32011-11-23 15:19:57 +0530796/* 8625 keypad device information */
797static unsigned int kp_row_gpios_8625[] = {31};
798static unsigned int kp_col_gpios_8625[] = {36, 37};
799
800static const unsigned short keymap_8625[] = {
801 KEY_VOLUMEUP,
802 KEY_VOLUMEDOWN,
803};
804
805static struct gpio_event_matrix_info kp_matrix_info_8625 = {
806 .info.func = gpio_event_matrix_func,
807 .keymap = keymap_8625,
808 .output_gpios = kp_row_gpios_8625,
809 .input_gpios = kp_col_gpios_8625,
810 .noutputs = ARRAY_SIZE(kp_row_gpios_8625),
811 .ninputs = ARRAY_SIZE(kp_col_gpios_8625),
812 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
813 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
814 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
815 GPIOKPF_PRINT_UNMAPPED_KEYS,
816};
817
818static struct gpio_event_info *kp_info_8625[] = {
819 &kp_matrix_info_8625.info,
820};
821static struct gpio_event_platform_data kp_pdata_8625 = {
822 .name = "8625_kp",
823 .info = kp_info_8625,
824 .info_count = ARRAY_SIZE(kp_info_8625)
825};
826
827static struct platform_device kp_pdev_8625 = {
828 .name = GPIO_EVENT_DEV_NAME,
829 .id = -1,
830 .dev = {
831 .platform_data = &kp_pdata_8625,
832 },
833};
834
Mohan Pallakaad78af82011-11-23 15:30:07 +0530835#define LED_RED_GPIO_8625 49
836#define LED_GREEN_GPIO_8625 34
837
838static struct gpio_led gpio_leds_config_8625[] = {
839 {
840 .name = "green",
841 .gpio = LED_GREEN_GPIO_8625,
842 },
843 {
844 .name = "red",
845 .gpio = LED_RED_GPIO_8625,
846 },
847};
848
849static struct gpio_led_platform_data gpio_leds_pdata_8625 = {
850 .num_leds = ARRAY_SIZE(gpio_leds_config_8625),
851 .leds = gpio_leds_config_8625,
852};
853
854static struct platform_device gpio_leds_8625 = {
855 .name = "leds-gpio",
856 .id = -1,
857 .dev = {
858 .platform_data = &gpio_leds_pdata_8625,
859 },
860};
861
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530862#define MXT_TS_IRQ_GPIO 48
863#define MXT_TS_RESET_GPIO 26
864
865static const u8 mxt_config_data[] = {
866 /* T6 Object */
867 0, 0, 0, 0, 0, 0,
868 /* T38 Object */
869 16, 0, 0, 0, 0, 0, 0, 0,
870 /* T7 Object */
871 255, 255, 10,
872 /* T8 Object */
873 30, 0, 20, 20, 0, 0, 20, 0, 50, 0,
874 /* T9 Object */
875 3, 0, 0, 18, 11, 0, 32, 75, 3, 3,
876 0, 1, 1, 0, 10, 10, 10, 10, 31, 3,
877 223, 1, 11, 11, 15, 15, 151, 43, 145, 80,
878 100, 15, 0, 0, 0,
879 /* T15 Object */
880 131, 0, 11, 11, 1, 1, 0, 45, 3, 0,
881 0,
882 /* T18 Object */
883 0, 0,
884 /* T19 Object */
885 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
886 0, 0, 0, 0, 0, 0,
887 /* T23 Object */
888 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
889 0, 0, 0, 0, 0,
890 /* T25 Object */
891 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
892 0, 0, 0, 0,
893 /* T40 Object */
894 0, 0, 0, 0, 0,
895 /* T42 Object */
896 0, 0, 0, 0, 0, 0, 0, 0,
897 /* T46 Object */
898 0, 2, 32, 48, 0, 0, 0, 0, 0,
899 /* T47 Object */
900 1, 20, 60, 5, 2, 50, 40, 0, 0, 40,
901 /* T48 Object */
902 1, 12, 80, 0, 0, 0, 0, 0, 0, 0,
903 0, 0, 0, 6, 6, 0, 0, 100, 4, 64,
904 10, 0, 20, 5, 0, 38, 0, 20, 0, 0,
905 0, 0, 0, 0, 16, 65, 3, 1, 1, 0,
906 10, 10, 10, 0, 0, 15, 15, 154, 58, 145,
907 80, 100, 15, 3,
908};
909
910static struct mxt_config_info mxt_config_array[] = {
911 {
912 .config = mxt_config_data,
913 .config_length = ARRAY_SIZE(mxt_config_data),
914 .family_id = 0x81,
915 .variant_id = 0x01,
916 .version = 0x10,
917 .build = 0xAA,
918 },
919};
920
921static int mxt_key_codes[MXT_KEYARRAY_MAX_KEYS] = {
922 [0] = KEY_HOME,
923 [1] = KEY_MENU,
924 [9] = KEY_BACK,
925 [10] = KEY_SEARCH,
926};
927
928static struct mxt_platform_data mxt_platform_data = {
929 .config_array = mxt_config_array,
930 .config_array_size = ARRAY_SIZE(mxt_config_array),
931 .x_size = 479,
932 .y_size = 799,
933 .irqflags = IRQF_TRIGGER_FALLING,
934 .i2c_pull_up = true,
935 .reset_gpio = MXT_TS_RESET_GPIO,
936 .irq_gpio = MXT_TS_IRQ_GPIO,
937 .key_codes = mxt_key_codes,
938};
939
940static struct i2c_board_info mxt_device_info[] __initdata = {
941 {
942 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
943 .platform_data = &mxt_platform_data,
944 .irq = MSM_GPIO_TO_INT(MXT_TS_IRQ_GPIO),
945 },
946};
947
Taniya Dasc868a2e2012-01-03 10:18:47 +0530948static void msm7627a_add_io_devices(void)
949{
Mohan Pallakaad78af82011-11-23 15:30:07 +0530950 int rc;
951
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530952 /* touchscreen */
953 if (machine_is_msm7627a_qrd1()) {
954 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
955 synaptic_i2c_clearpad3k,
956 ARRAY_SIZE(synaptic_i2c_clearpad3k));
957 } else if (machine_is_msm7627a_evb()) {
958 rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_IRQ_GPIO, 0,
959 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
960 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
961 if (rc) {
962 pr_err("%s: gpio_tlmm_config for %d failed\n",
963 __func__, MXT_TS_IRQ_GPIO);
964 }
965
966 rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_RESET_GPIO, 0,
967 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN,
968 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
969 if (rc) {
970 pr_err("%s: gpio_tlmm_config for %d failed\n",
971 __func__, MXT_TS_RESET_GPIO);
972 }
973
974 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
975 mxt_device_info,
976 ARRAY_SIZE(mxt_device_info));
977 }
978
979 /* headset */
Taniya Dasc868a2e2012-01-03 10:18:47 +0530980 platform_device_register(&hs_pdev);
981
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530982 /* vibrator */
Taniya Dasc868a2e2012-01-03 10:18:47 +0530983#ifdef CONFIG_MSM_RPC_VIBRATOR
984 msm_init_pmic_vibrator();
985#endif
986
Mohan Pallakab6c44b32011-11-23 15:19:57 +0530987 /* keypad */
988 if (machine_is_msm7627a_evb())
989 platform_device_register(&kp_pdev_8625);
Mohan Pallakaad78af82011-11-23 15:30:07 +0530990
991 /* leds */
992 if (machine_is_msm7627a_evb()) {
993 rc = gpio_tlmm_config(GPIO_CFG(LED_RED_GPIO_8625, 0,
994 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
995 GPIO_CFG_16MA), GPIO_CFG_ENABLE);
996 if (rc) {
997 pr_err("%s: gpio_tlmm_config for %d failed\n",
998 __func__, LED_RED_GPIO_8625);
999 }
1000
1001 rc = gpio_tlmm_config(GPIO_CFG(LED_GREEN_GPIO_8625, 0,
1002 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
1003 GPIO_CFG_16MA), GPIO_CFG_ENABLE);
1004 if (rc) {
1005 pr_err("%s: gpio_tlmm_config for %d failed\n",
1006 __func__, LED_GREEN_GPIO_8625);
1007 }
1008
1009 platform_device_register(&gpio_leds_8625);
1010 }
Taniya Dasc868a2e2012-01-03 10:18:47 +05301011}
1012
Santosh Sajjan374d6592012-01-19 23:16:46 +05301013static int __init msm_qrd_init_ar6000pm(void)
1014{
1015 msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power;
1016 return platform_device_register(&msm_wlan_ar6000_pm_device);
1017}
1018
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301019#define UART1DM_RX_GPIO 45
Taniya Dasc868a2e2012-01-03 10:18:47 +05301020static void __init msm_qrd_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301021{
1022 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +05301023 msm7627a_init_regulators();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301024 msm_device_i2c_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301025#ifdef CONFIG_SERIAL_MSM_HS
1026 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
1027 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
1028#endif
1029
1030#ifdef CONFIG_USB_MSM_OTG_72K
1031 msm_otg_pdata.swfi_latency = msm7627a_pm_data
1032 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
1033 msm_device_otg.dev.platform_data = &msm_otg_pdata;
1034#endif
1035 msm_device_gadget_peripheral.dev.platform_data =
Taniya Das7a22cdd2011-09-08 14:57:00 +05301036 &msm_gadget_pdata;
Taniya Dasc868a2e2012-01-03 10:18:47 +05301037
1038 platform_add_devices(qrd_common_devices,
1039 ARRAY_SIZE(qrd_common_devices));
1040
Santosh Sajjan374d6592012-01-19 23:16:46 +05301041 /* Ensure ar6000pm device is registered before MMC/SDC */
1042 msm_qrd_init_ar6000pm();
Chintan Pandyacf467fc2011-12-01 17:11:11 +05301043 msm7627a_init_mmc();
1044
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301045#ifdef CONFIG_USB_EHCI_MSM_72K
1046 msm7627a_init_host();
1047#endif
1048 msm_pm_set_platform_data(msm7627a_pm_data,
1049 ARRAY_SIZE(msm7627a_pm_data));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001050 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Murali Nalajalaa1827842011-11-13 14:12:39 +05301051
Taniya Das0a5303a2011-08-23 18:47:48 +05301052 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301053
1054#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +05301055 msm7627a_bt_power_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301056#endif
Taniya Dasda408822011-09-06 12:54:06 +05301057
Chintan Pandya40762702011-12-06 13:47:06 +05301058 msm7627a_camera_init();
Taniya Das7a22cdd2011-09-08 14:57:00 +05301059
Taniya Dasc868a2e2012-01-03 10:18:47 +05301060 msm7627a_add_io_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301061}
1062
1063static void __init qrd7627a_init_early(void)
1064{
1065 msm_msm7627a_allocate_memory_regions();
1066}
1067
1068MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
1069 .boot_params = PHYS_OFFSET + 0x100,
1070 .map_io = msm_common_io_init,
1071 .reserve = msm7627a_reserve,
1072 .init_irq = msm_init_irq,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301073 .init_machine = msm_qrd_init,
1074 .timer = &msm_timer,
1075 .init_early = qrd7627a_init_early,
1076 .handle_irq = vic_handle_irq,
1077MACHINE_END
1078MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB")
1079 .boot_params = PHYS_OFFSET + 0x100,
1080 .map_io = msm_common_io_init,
1081 .reserve = msm7627a_reserve,
1082 .init_irq = msm_init_irq,
1083 .init_machine = msm_qrd_init,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301084 .timer = &msm_timer,
1085 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +05301086 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301087MACHINE_END