blob: 219af6ddc6b395ce398df84be7333b83739f3e8d [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>
Chintan Pandyaf4ad4002012-02-28 19:49:03 +053031#include <linux/memblock.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053032#include <asm/mach/mmc.h>
33#include <asm/mach-types.h>
34#include <asm/mach/arch.h>
Chintan Pandyaf4ad4002012-02-28 19:49:03 +053035#include <asm/hardware/gic.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053036#include <mach/board.h>
37#include <mach/msm_iomap.h>
38#include <mach/msm_hsusb.h>
39#include <mach/rpc_hsusb.h>
40#include <mach/rpc_pmapp.h>
41#include <mach/usbdiag.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053042#include <mach/msm_memtypes.h>
43#include <mach/msm_serial_hs.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053044#include <mach/pmic.h>
45#include <mach/socinfo.h>
46#include <mach/vreg.h>
47#include <mach/rpc_pmapp.h>
48#include <mach/msm_battery.h>
49#include <mach/rpc_server_handset.h>
50#include <mach/socinfo.h>
Pankaj Kumar27c02642011-09-22 15:55:55 +053051#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053052#include "devices.h"
53#include "devices-msm7x2xa.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080054#include "pm.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053055#include "timer.h"
Murali Nalajalaa1827842011-11-13 14:12:39 +053056#include "pm-boot.h"
Pankaj Kumar3cec0582011-11-18 11:13:29 +053057#include "board-msm7x27a-regulator.h"
Chintan Pandyacf467fc2011-12-01 17:11:11 +053058#include "board-msm7627a.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053059
60#define PMEM_KERNEL_EBI1_SIZE 0x3A000
61#define MSM_PMEM_AUDIO_SIZE 0x5B000
Taniya Dasc98bfbc2011-08-23 09:58:55 +053062#define BAHAMA_SLAVE_ID_FM_REG 0x02
63#define FM_GPIO 83
Rahul Kashyap8b4a7862011-12-13 18:40:54 +053064#define BT_PCM_BCLK_MODE 0x88
65#define BT_PCM_DIN_MODE 0x89
66#define BT_PCM_DOUT_MODE 0x8A
67#define BT_PCM_SYNC_MODE 0x8B
68#define FM_I2S_SD_MODE 0x8E
69#define FM_I2S_WS_MODE 0x8F
70#define FM_I2S_SCK_MODE 0x90
71#define I2C_PIN_CTL 0x15
72#define I2C_NORMAL 0x40
Taniya Dasc98bfbc2011-08-23 09:58:55 +053073
Taniya Dasc98bfbc2011-08-23 09:58:55 +053074static struct platform_device msm_wlan_ar6000_pm_device = {
75 .name = "wlan_ar6000_pm_dev",
76 .id = -1,
77};
78
Taniya Dasc98bfbc2011-08-23 09:58:55 +053079static struct msm_gpio qup_i2c_gpios_io[] = {
80 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
81 "qup_scl" },
82 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
83 "qup_sda" },
84 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
85 "qup_scl" },
86 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
87 "qup_sda" },
88};
89
90static struct msm_gpio qup_i2c_gpios_hw[] = {
91 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
92 "qup_scl" },
93 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
94 "qup_sda" },
95 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
96 "qup_scl" },
97 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
98 "qup_sda" },
99};
100
101static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
102{
103 int rc;
104
105 if (adap_id < 0 || adap_id > 1)
106 return;
107
108 /* Each adapter gets 2 lines from the table */
109 if (config_type)
110 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
111 else
112 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
113 if (rc < 0)
114 pr_err("QUP GPIO request/enable failed: %d\n", rc);
115}
116
117static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
118 .clk_freq = 100000,
119 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
120};
121
122static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
123 .clk_freq = 100000,
124 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
125};
126
127#ifdef CONFIG_ARCH_MSM7X27A
128#define MSM_PMEM_MDP_SIZE 0x1DD1000
Mahesh Lankac054d352012-02-29 16:11:51 +0530129#define MSM_PMEM_ADSP_SIZE 0x1100000
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530130#endif
131
Taniya Dasda408822011-09-06 12:54:06 +0530132#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \
133defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE)
134
135#ifndef CLEARPAD3000_ATTEN_GPIO
136#define CLEARPAD3000_ATTEN_GPIO (48)
137#endif
138
139#ifndef CLEARPAD3000_RESET_GPIO
140#define CLEARPAD3000_RESET_GPIO (26)
141#endif
142
143static int synaptics_touchpad_setup(void);
144
145static struct msm_gpio clearpad3000_cfg_data[] = {
146 {GPIO_CFG(CLEARPAD3000_ATTEN_GPIO, 0, GPIO_CFG_INPUT,
147 GPIO_CFG_NO_PULL, GPIO_CFG_6MA), "rmi4_attn"},
148 {GPIO_CFG(CLEARPAD3000_RESET_GPIO, 0, GPIO_CFG_OUTPUT,
149 GPIO_CFG_PULL_DOWN, GPIO_CFG_8MA), "rmi4_reset"},
150};
151
152static struct rmi_XY_pair rmi_offset = {.x = 0, .y = 0};
153static struct rmi_range rmi_clipx = {.min = 48, .max = 980};
154static struct rmi_range rmi_clipy = {.min = 7, .max = 1647};
155static struct rmi_f11_functiondata synaptics_f11_data = {
156 .swap_axes = false,
157 .flipX = false,
158 .flipY = false,
159 .offset = &rmi_offset,
160 .button_height = 113,
161 .clipX = &rmi_clipx,
162 .clipY = &rmi_clipy,
163};
164
165#define MAX_LEN 100
166
167static ssize_t clearpad3000_virtual_keys_register(struct kobject *kobj,
168 struct kobj_attribute *attr, char *buf)
169{
170 char *virtual_keys = __stringify(EV_KEY) ":" __stringify(KEY_MENU) \
171 ":60:830:120:60" ":" __stringify(EV_KEY) \
172 ":" __stringify(KEY_HOME) ":180:830:120:60" \
173 ":" __stringify(EV_KEY) ":" \
174 __stringify(KEY_SEARCH) ":300:830:120:60" \
175 ":" __stringify(EV_KEY) ":" \
176 __stringify(KEY_BACK) ":420:830:120:60" "\n";
177
178 return snprintf(buf, strnlen(virtual_keys, MAX_LEN) + 1 , "%s",
179 virtual_keys);
180}
181
182static struct kobj_attribute clearpad3000_virtual_keys_attr = {
183 .attr = {
184 .name = "virtualkeys.sensor00fn11",
185 .mode = S_IRUGO,
186 },
187 .show = &clearpad3000_virtual_keys_register,
188};
189
190static struct attribute *virtual_key_properties_attrs[] = {
191 &clearpad3000_virtual_keys_attr.attr,
192 NULL
193};
194
195static struct attribute_group virtual_key_properties_attr_group = {
196 .attrs = virtual_key_properties_attrs,
197};
198
199struct kobject *virtual_key_properties_kobj;
200
201static struct rmi_functiondata synaptics_functiondata[] = {
202 {
203 .function_index = RMI_F11_INDEX,
204 .data = &synaptics_f11_data,
205 },
206};
207
208static struct rmi_functiondata_list synaptics_perfunctiondata = {
209 .count = ARRAY_SIZE(synaptics_functiondata),
210 .functiondata = synaptics_functiondata,
211};
212
213static struct rmi_sensordata synaptics_sensordata = {
214 .perfunctiondata = &synaptics_perfunctiondata,
215 .rmi_sensor_setup = synaptics_touchpad_setup,
216};
217
218static struct rmi_i2c_platformdata synaptics_platformdata = {
219 .i2c_address = 0x2c,
220 .irq_type = IORESOURCE_IRQ_LOWLEVEL,
221 .sensordata = &synaptics_sensordata,
222};
223
224static struct i2c_board_info synaptic_i2c_clearpad3k[] = {
225 {
226 I2C_BOARD_INFO("rmi4_ts", 0x2c),
227 .platform_data = &synaptics_platformdata,
228 },
229};
230
231static int synaptics_touchpad_setup(void)
232{
233 int retval = 0;
234
235 virtual_key_properties_kobj =
236 kobject_create_and_add("board_properties", NULL);
237 if (virtual_key_properties_kobj)
238 retval = sysfs_create_group(virtual_key_properties_kobj,
239 &virtual_key_properties_attr_group);
240 if (!virtual_key_properties_kobj || retval)
241 pr_err("failed to create ft5202 board_properties\n");
242
243 retval = msm_gpios_request_enable(clearpad3000_cfg_data,
244 sizeof(clearpad3000_cfg_data)/sizeof(struct msm_gpio));
245 if (retval) {
246 pr_err("%s:Failed to obtain touchpad GPIO %d. Code: %d.",
247 __func__, CLEARPAD3000_ATTEN_GPIO, retval);
248 retval = 0; /* ignore the err */
249 }
250 synaptics_platformdata.irq = gpio_to_irq(CLEARPAD3000_ATTEN_GPIO);
251
252 gpio_set_value(CLEARPAD3000_RESET_GPIO, 0);
253 usleep(10000);
254 gpio_set_value(CLEARPAD3000_RESET_GPIO, 1);
255 usleep(50000);
256
257 return retval;
258}
259#endif
260
261
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530262static struct android_usb_platform_data android_usb_pdata = {
Pankaj Kumar6f841742011-10-10 15:52:14 +0530263 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530264};
265
266static struct platform_device android_usb_device = {
267 .name = "android_usb",
268 .id = -1,
269 .dev = {
270 .platform_data = &android_usb_pdata,
271 },
272};
273
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530274#ifdef CONFIG_USB_EHCI_MSM_72K
275static void msm_hsusb_vbus_power(unsigned phy_info, int on)
276{
277 int rc = 0;
278 unsigned gpio;
279
Chintan Pandya40762702011-12-06 13:47:06 +0530280 gpio = QRD_GPIO_HOST_VBUS_EN;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530281
282 rc = gpio_request(gpio, "i2c_host_vbus_en");
283 if (rc < 0) {
284 pr_err("failed to request %d GPIO\n", gpio);
285 return;
286 }
287 gpio_direction_output(gpio, !!on);
288 gpio_set_value_cansleep(gpio, !!on);
289 gpio_free(gpio);
290}
291
292static struct msm_usb_host_platform_data msm_usb_host_pdata = {
293 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
294};
295
296static void __init msm7627a_init_host(void)
297{
298 msm_add_host(0, &msm_usb_host_pdata);
299}
300#endif
301
302#ifdef CONFIG_USB_MSM_OTG_72K
303static int hsusb_rpc_connect(int connect)
304{
305 if (connect)
306 return msm_hsusb_rpc_connect();
307 else
308 return msm_hsusb_rpc_close();
309}
310
Pankaj Kumar27c02642011-09-22 15:55:55 +0530311static struct regulator *reg_hsusb;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530312static int msm_hsusb_ldo_init(int init)
313{
Pankaj Kumar27c02642011-09-22 15:55:55 +0530314 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530315
Pankaj Kumar27c02642011-09-22 15:55:55 +0530316 if (init) {
317 reg_hsusb = regulator_get(NULL, "usb");
318 if (IS_ERR(reg_hsusb)) {
319 rc = PTR_ERR(reg_hsusb);
320 pr_err("%s: could not get regulator: %d\n",
321 __func__, rc);
322 goto out;
323 }
324
325 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
326 if (rc) {
327 pr_err("%s: could not set voltage: %d\n",
328 __func__, rc);
329 goto reg_free;
330 }
331
332 return 0;
333 }
334 /* else fall through */
335reg_free:
336 regulator_put(reg_hsusb);
337out:
338 reg_hsusb = NULL;
339 return rc;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530340}
341
342static int msm_hsusb_ldo_enable(int enable)
343{
344 static int ldo_status;
345
Pankaj Kumar27c02642011-09-22 15:55:55 +0530346 if (IS_ERR_OR_NULL(reg_hsusb))
347 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530348
349 if (ldo_status == enable)
350 return 0;
351
352 ldo_status = enable;
353
Pankaj Kumar27c02642011-09-22 15:55:55 +0530354 return enable ?
355 regulator_enable(reg_hsusb) :
356 regulator_disable(reg_hsusb);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530357}
358
359#ifndef CONFIG_USB_EHCI_MSM_72K
360static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
361{
362 int ret = 0;
363
364 if (init)
365 ret = msm_pm_app_rpc_init(callback);
366 else
367 msm_pm_app_rpc_deinit(callback);
368
369 return ret;
370}
371#endif
372
373static struct msm_otg_platform_data msm_otg_pdata = {
374#ifndef CONFIG_USB_EHCI_MSM_72K
375 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
376#else
377 .vbus_power = msm_hsusb_vbus_power,
378#endif
379 .rpc_connect = hsusb_rpc_connect,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530380 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
381 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
382 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
383 .se1_gating = SE1_GATING_DISABLE,
384 .ldo_init = msm_hsusb_ldo_init,
385 .ldo_enable = msm_hsusb_ldo_enable,
386 .chg_init = hsusb_chg_init,
387 .chg_connected = hsusb_chg_connected,
388 .chg_vbus_draw = hsusb_chg_vbus_draw,
389};
390#endif
391
392static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
393 .is_phy_status_timer_on = 1,
394};
395
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530396#ifdef CONFIG_SERIAL_MSM_HS
397static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
398 .inject_rx_on_wakeup = 1,
399 .rx_to_inject = 0xFD,
400};
401#endif
402static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
403 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
404 .idle_supported = 1,
405 .suspend_supported = 1,
406 .idle_enabled = 1,
407 .suspend_enabled = 1,
408 .latency = 16000,
409 .residency = 20000,
410 },
411 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
412 .idle_supported = 1,
413 .suspend_supported = 1,
414 .idle_enabled = 1,
415 .suspend_enabled = 1,
416 .latency = 12000,
417 .residency = 20000,
418 },
419 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
420 .idle_supported = 1,
421 .suspend_supported = 1,
422 .idle_enabled = 0,
423 .suspend_enabled = 1,
424 .latency = 2000,
425 .residency = 0,
426 },
427 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
428 .idle_supported = 1,
429 .suspend_supported = 1,
430 .idle_enabled = 1,
431 .suspend_enabled = 1,
432 .latency = 2,
433 .residency = 0,
434 },
435};
436
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600437static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +0530438 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS,
439 .p_addr = 0,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600440};
441
Murali Nalajala4c996be2012-03-12 17:05:41 +0530442/* 8625 PM platform data */
443static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
444 /* CORE0 entries */
445 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
446 .idle_supported = 1,
447 .suspend_supported = 1,
448 .idle_enabled = 0,
449 .suspend_enabled = 0,
450 .latency = 16000,
451 .residency = 20000,
452 },
453
454 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = {
455 .idle_supported = 1,
456 .suspend_supported = 1,
457 .idle_enabled = 0,
458 .suspend_enabled = 0,
459 .latency = 12000,
460 .residency = 20000,
461 },
462
463 /* picked latency & redisdency values from 7x30 */
464 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
465 .idle_supported = 1,
466 .suspend_supported = 1,
467 .idle_enabled = 0,
468 .suspend_enabled = 0,
469 .latency = 500,
470 .residency = 6000,
471 },
472
473 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
474 .idle_supported = 1,
475 .suspend_supported = 1,
476 .idle_enabled = 1,
477 .suspend_enabled = 1,
478 .latency = 2,
479 .residency = 10,
480 },
481
482 /* picked latency & redisdency values from 7x30 */
483 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
484 .idle_supported = 1,
485 .suspend_supported = 1,
486 .idle_enabled = 0,
487 .suspend_enabled = 0,
488 .latency = 500,
489 .residency = 6000,
490 },
491
492 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
493 .idle_supported = 1,
494 .suspend_supported = 1,
495 .idle_enabled = 1,
496 .suspend_enabled = 1,
497 .latency = 2,
498 .residency = 10,
499 },
500
501};
502
503static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = {
504 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
505 .v_addr = MSM_CFG_CTL_BASE,
506};
507
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530508static struct android_pmem_platform_data android_pmem_adsp_pdata = {
509 .name = "pmem_adsp",
510 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
511 .cached = 1,
512 .memory_type = MEMTYPE_EBI1,
513};
514
515static struct platform_device android_pmem_adsp_device = {
516 .name = "android_pmem",
517 .id = 1,
518 .dev = { .platform_data = &android_pmem_adsp_pdata },
519};
520
521static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
522static int __init pmem_mdp_size_setup(char *p)
523{
524 pmem_mdp_size = memparse(p, NULL);
525 return 0;
526}
527
528early_param("pmem_mdp_size", pmem_mdp_size_setup);
529
530static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
531static int __init pmem_adsp_size_setup(char *p)
532{
533 pmem_adsp_size = memparse(p, NULL);
534 return 0;
535}
536
537early_param("pmem_adsp_size", pmem_adsp_size_setup);
538
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530539#define SND(desc, num) { .name = #desc, .id = num }
540static struct snd_endpoint snd_endpoints_list[] = {
541 SND(HANDSET, 0),
542 SND(MONO_HEADSET, 2),
543 SND(HEADSET, 3),
544 SND(SPEAKER, 6),
545 SND(TTY_HEADSET, 8),
546 SND(TTY_VCO, 9),
547 SND(TTY_HCO, 10),
548 SND(BT, 12),
549 SND(IN_S_SADC_OUT_HANDSET, 16),
550 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
551 SND(FM_DIGITAL_STEREO_HEADSET, 26),
552 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
553 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +0530554 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Phani Kumar Alladad6971252011-10-19 10:50:15 +0530555 SND(CURRENT, 0x7FFFFFFE),
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530556 SND(FM_ANALOG_STEREO_HEADSET, 35),
557 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
558};
559#undef SND
560
561static struct msm_snd_endpoints msm_device_snd_endpoints = {
562 .endpoints = snd_endpoints_list,
563 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
564};
565
566static struct platform_device msm_device_snd = {
567 .name = "msm_snd",
568 .id = -1,
569 .dev = {
570 .platform_data = &msm_device_snd_endpoints
571 },
572};
573
574#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
575 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
576 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
577 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
578 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
579 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
580#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
581 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
582 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
583 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
584 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
585 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
586#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
587 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
588 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
589 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
590 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
591 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
592#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
593 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
594 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
595 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
596 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
597 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
598#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
599
600static unsigned int dec_concurrency_table[] = {
601 /* Audio LP */
602 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
603 0, 0, 0,
604
605 /* Concurrency 1 */
606 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
607 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
608 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
609 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
610 (DEC4_FORMAT),
611
612 /* Concurrency 2 */
613 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
614 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
615 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
616 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
617 (DEC4_FORMAT),
618
619 /* Concurrency 3 */
620 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
621 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
622 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
623 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
624 (DEC4_FORMAT),
625
626 /* Concurrency 4 */
627 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
628 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
629 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
630 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
631 (DEC4_FORMAT),
632
633 /* Concurrency 5 */
634 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
635 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
636 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
637 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
638 (DEC4_FORMAT),
639
640 /* Concurrency 6 */
641 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
642 0, 0, 0, 0,
643
644 /* Concurrency 7 */
645 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
646 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
647 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
648 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
649 (DEC4_FORMAT),
650};
651
652#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
653 .module_queueid = queueid, .module_decid = decid, \
654 .nr_codec_support = nr_codec}
655
656static struct msm_adspdec_info dec_info_list[] = {
657 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
658 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
659 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
660 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
661 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
662};
663
664static struct msm_adspdec_database msm_device_adspdec_database = {
665 .num_dec = ARRAY_SIZE(dec_info_list),
666 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
667 ARRAY_SIZE(dec_info_list)),
668 .dec_concurrency_table = dec_concurrency_table,
669 .dec_info_list = dec_info_list,
670};
671
672static struct platform_device msm_device_adspdec = {
673 .name = "msm_adspdec",
674 .id = -1,
675 .dev = {
676 .platform_data = &msm_device_adspdec_database
677 },
678};
679
680static struct android_pmem_platform_data android_pmem_audio_pdata = {
681 .name = "pmem_audio",
682 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
683 .cached = 0,
684 .memory_type = MEMTYPE_EBI1,
685};
686
687static struct platform_device android_pmem_audio_device = {
688 .name = "android_pmem",
689 .id = 2,
690 .dev = { .platform_data = &android_pmem_audio_pdata },
691};
692
693static struct android_pmem_platform_data android_pmem_pdata = {
694 .name = "pmem",
695 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
696 .cached = 1,
697 .memory_type = MEMTYPE_EBI1,
698};
699static struct platform_device android_pmem_device = {
700 .name = "android_pmem",
701 .id = 0,
702 .dev = { .platform_data = &android_pmem_pdata },
703};
704
705static u32 msm_calculate_batt_capacity(u32 current_voltage);
706
707static struct msm_psy_batt_pdata msm_psy_batt_data = {
708 .voltage_min_design = 2800,
709 .voltage_max_design = 4300,
710 .avail_chg_sources = AC_CHG | USB_CHG ,
711 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
712 .calculate_capacity = &msm_calculate_batt_capacity,
713};
714
715static u32 msm_calculate_batt_capacity(u32 current_voltage)
716{
717 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
718 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
719
720 return (current_voltage - low_voltage) * 100
721 / (high_voltage - low_voltage);
722}
723
724static struct platform_device msm_batt_device = {
725 .name = "msm-battery",
726 .id = -1,
727 .dev.platform_data = &msm_psy_batt_data,
728};
729
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530730static struct platform_device *common_devices[] __initdata = {
731 &android_usb_device,
732 &android_pmem_device,
733 &android_pmem_adsp_device,
734 &android_pmem_audio_device,
735 &msm_batt_device,
736 &msm_device_adspdec,
737 &msm_device_snd,
738 &asoc_msm_pcm,
739 &asoc_msm_dai0,
740 &asoc_msm_dai1,
741};
742
743static struct platform_device *qrd7627a_devices[] __initdata = {
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530744 &msm_device_dmov,
745 &msm_device_smd,
746 &msm_device_uart1,
747 &msm_device_uart_dm1,
748 &msm_gsbi0_qup_i2c_device,
749 &msm_gsbi1_qup_i2c_device,
750 &msm_device_otg,
751 &msm_device_gadget_peripheral,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530752 &msm_kgsl_3d0,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530753};
754
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530755static struct platform_device *qrd3_devices[] __initdata = {
756 &msm_device_nand,
757};
758
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530759static struct platform_device *msm8625_evb_devices[] __initdata = {
760 &msm8625_device_dmov,
761 &msm8625_device_smd,
762 &msm8625_gsbi0_qup_i2c_device,
763 &msm8625_gsbi1_qup_i2c_device,
764 &msm8625_device_uart1,
Ram Mohan Korukonda5ee9fb82012-03-09 12:10:01 +0530765 &msm8625_device_uart_dm1,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530766 &msm8625_device_otg,
767 &msm8625_device_gadget_peripheral,
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +0530768 &msm8625_kgsl_3d0,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530769};
770
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530771static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
772static int __init pmem_kernel_ebi1_size_setup(char *p)
773{
774 pmem_kernel_ebi1_size = memparse(p, NULL);
775 return 0;
776}
777early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
778
779static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
780static int __init pmem_audio_size_setup(char *p)
781{
782 pmem_audio_size = memparse(p, NULL);
783 return 0;
784}
785early_param("pmem_audio_size", pmem_audio_size_setup);
786
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530787static struct memtype_reserve msm7627a_reserve_table[] __initdata = {
788 [MEMTYPE_SMI] = {
789 },
790 [MEMTYPE_EBI0] = {
791 .flags = MEMTYPE_FLAGS_1M_ALIGN,
792 },
793 [MEMTYPE_EBI1] = {
794 .flags = MEMTYPE_FLAGS_1M_ALIGN,
795 },
796};
797
798static void __init size_pmem_devices(void)
799{
800#ifdef CONFIG_ANDROID_PMEM
801 android_pmem_adsp_pdata.size = pmem_adsp_size;
802 android_pmem_pdata.size = pmem_mdp_size;
803 android_pmem_audio_pdata.size = pmem_audio_size;
804#endif
805}
806
807static void __init reserve_memory_for(struct android_pmem_platform_data *p)
808{
809 msm7627a_reserve_table[p->memory_type].size += p->size;
810}
811
812static void __init reserve_pmem_memory(void)
813{
814#ifdef CONFIG_ANDROID_PMEM
815 reserve_memory_for(&android_pmem_adsp_pdata);
816 reserve_memory_for(&android_pmem_pdata);
817 reserve_memory_for(&android_pmem_audio_pdata);
818 msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
819#endif
820}
821
822static void __init msm7627a_calculate_reserve_sizes(void)
823{
824 size_pmem_devices();
825 reserve_pmem_memory();
826}
827
828static int msm7627a_paddr_to_memtype(unsigned int paddr)
829{
830 return MEMTYPE_EBI1;
831}
832
833static struct reserve_info msm7627a_reserve_info __initdata = {
834 .memtype_reserve_table = msm7627a_reserve_table,
835 .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes,
836 .paddr_to_memtype = msm7627a_paddr_to_memtype,
837};
838
839static void __init msm7627a_reserve(void)
840{
841 reserve_info = &msm7627a_reserve_info;
842 msm_reserve();
Murali Nalajala4c996be2012-03-12 17:05:41 +0530843 msm_pm_8625_boot_pdata.p_addr = memblock_alloc(SZ_8, SZ_64K);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530844}
845
Taniya Dasfe04d4f2012-03-14 11:13:21 +0530846static void __init msm8625_reserve(void)
847{
848 memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8);
849 msm7627a_reserve();
850}
851
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530852static void msmqrd_adsp_add_pdev(void)
853{
854 int rc = 0;
855 struct rpc_board_dev *rpc_adsp_pdev;
856
857 rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL);
858 if (rpc_adsp_pdev == NULL) {
859 pr_err("%s: Memory Allocation failure\n", __func__);
860 return;
861 }
862 rpc_adsp_pdev->prog = ADSP_RPC_PROG;
863
864 if (cpu_is_msm8625())
865 rpc_adsp_pdev->pdev = msm8625_device_adsp;
866 else
867 rpc_adsp_pdev->pdev = msm_adsp_device;
868 rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1);
869 if (rc < 0) {
870 pr_err("%s: return val: %d\n", __func__, rc);
871 kfree(rpc_adsp_pdev);
872 }
873}
874
875static void __init msm7627a_device_i2c_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530876{
877 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
878 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
879}
880
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530881static void __init msm8625_device_i2c_init(void)
882{
883 msm8625_gsbi0_qup_i2c_device.dev.platform_data
884 = &msm_gsbi0_qup_i2c_pdata;
885 msm8625_gsbi1_qup_i2c_device.dev.platform_data
886 = &msm_gsbi1_qup_i2c_pdata;
887}
888
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530889static struct msm_handset_platform_data hs_platform_data = {
890 .hs_name = "7k_handset",
891 .pwr_key_delay_ms = 500, /* 0 will disable end key */
892};
893
894static struct platform_device hs_pdev = {
895 .name = "msm-handset",
896 .id = -1,
897 .dev = {
898 .platform_data = &hs_platform_data,
899 },
900};
901
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530902static struct platform_device msm_proccomm_regulator_dev = {
903 .name = PROCCOMM_REGULATOR_DEV_NAME,
904 .id = -1,
905 .dev = {
906 .platform_data = &msm7x27a_proccomm_regulator_data
907 }
908};
909
910static void __init msm7627a_init_regulators(void)
911{
912 int rc = platform_device_register(&msm_proccomm_regulator_dev);
913 if (rc)
914 pr_err("%s: could not register regulator device: %d\n",
915 __func__, rc);
916}
917
Mohan Pallakab6c44b32011-11-23 15:19:57 +0530918/* 8625 keypad device information */
919static unsigned int kp_row_gpios_8625[] = {31};
920static unsigned int kp_col_gpios_8625[] = {36, 37};
921
922static const unsigned short keymap_8625[] = {
923 KEY_VOLUMEUP,
924 KEY_VOLUMEDOWN,
925};
926
927static struct gpio_event_matrix_info kp_matrix_info_8625 = {
928 .info.func = gpio_event_matrix_func,
929 .keymap = keymap_8625,
930 .output_gpios = kp_row_gpios_8625,
931 .input_gpios = kp_col_gpios_8625,
932 .noutputs = ARRAY_SIZE(kp_row_gpios_8625),
933 .ninputs = ARRAY_SIZE(kp_col_gpios_8625),
934 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
935 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
936 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
937 GPIOKPF_PRINT_UNMAPPED_KEYS,
938};
939
940static struct gpio_event_info *kp_info_8625[] = {
941 &kp_matrix_info_8625.info,
942};
943static struct gpio_event_platform_data kp_pdata_8625 = {
944 .name = "8625_kp",
945 .info = kp_info_8625,
946 .info_count = ARRAY_SIZE(kp_info_8625)
947};
948
949static struct platform_device kp_pdev_8625 = {
950 .name = GPIO_EVENT_DEV_NAME,
951 .id = -1,
952 .dev = {
953 .platform_data = &kp_pdata_8625,
954 },
955};
956
Mohan Pallakaad78af82011-11-23 15:30:07 +0530957#define LED_RED_GPIO_8625 49
958#define LED_GREEN_GPIO_8625 34
959
960static struct gpio_led gpio_leds_config_8625[] = {
961 {
962 .name = "green",
963 .gpio = LED_GREEN_GPIO_8625,
964 },
965 {
966 .name = "red",
967 .gpio = LED_RED_GPIO_8625,
968 },
969};
970
971static struct gpio_led_platform_data gpio_leds_pdata_8625 = {
972 .num_leds = ARRAY_SIZE(gpio_leds_config_8625),
973 .leds = gpio_leds_config_8625,
974};
975
976static struct platform_device gpio_leds_8625 = {
977 .name = "leds-gpio",
978 .id = -1,
979 .dev = {
980 .platform_data = &gpio_leds_pdata_8625,
981 },
982};
983
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530984#define MXT_TS_IRQ_GPIO 48
985#define MXT_TS_RESET_GPIO 26
986
987static const u8 mxt_config_data[] = {
988 /* T6 Object */
989 0, 0, 0, 0, 0, 0,
990 /* T38 Object */
991 16, 0, 0, 0, 0, 0, 0, 0,
992 /* T7 Object */
Mohan Pallaka2c74a132012-03-05 15:50:40 +0530993 32, 16, 50,
Mohan Pallaka4c5bb922011-11-23 15:54:51 +0530994 /* T8 Object */
995 30, 0, 20, 20, 0, 0, 20, 0, 50, 0,
996 /* T9 Object */
997 3, 0, 0, 18, 11, 0, 32, 75, 3, 3,
998 0, 1, 1, 0, 10, 10, 10, 10, 31, 3,
999 223, 1, 11, 11, 15, 15, 151, 43, 145, 80,
1000 100, 15, 0, 0, 0,
1001 /* T15 Object */
1002 131, 0, 11, 11, 1, 1, 0, 45, 3, 0,
1003 0,
1004 /* T18 Object */
1005 0, 0,
1006 /* T19 Object */
1007 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1008 0, 0, 0, 0, 0, 0,
1009 /* T23 Object */
1010 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1011 0, 0, 0, 0, 0,
1012 /* T25 Object */
1013 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1014 0, 0, 0, 0,
1015 /* T40 Object */
1016 0, 0, 0, 0, 0,
1017 /* T42 Object */
1018 0, 0, 0, 0, 0, 0, 0, 0,
1019 /* T46 Object */
1020 0, 2, 32, 48, 0, 0, 0, 0, 0,
1021 /* T47 Object */
1022 1, 20, 60, 5, 2, 50, 40, 0, 0, 40,
1023 /* T48 Object */
1024 1, 12, 80, 0, 0, 0, 0, 0, 0, 0,
1025 0, 0, 0, 6, 6, 0, 0, 100, 4, 64,
1026 10, 0, 20, 5, 0, 38, 0, 20, 0, 0,
1027 0, 0, 0, 0, 16, 65, 3, 1, 1, 0,
1028 10, 10, 10, 0, 0, 15, 15, 154, 58, 145,
1029 80, 100, 15, 3,
1030};
1031
1032static struct mxt_config_info mxt_config_array[] = {
1033 {
1034 .config = mxt_config_data,
1035 .config_length = ARRAY_SIZE(mxt_config_data),
1036 .family_id = 0x81,
1037 .variant_id = 0x01,
1038 .version = 0x10,
1039 .build = 0xAA,
1040 },
1041};
1042
1043static int mxt_key_codes[MXT_KEYARRAY_MAX_KEYS] = {
1044 [0] = KEY_HOME,
1045 [1] = KEY_MENU,
1046 [9] = KEY_BACK,
1047 [10] = KEY_SEARCH,
1048};
1049
1050static struct mxt_platform_data mxt_platform_data = {
1051 .config_array = mxt_config_array,
1052 .config_array_size = ARRAY_SIZE(mxt_config_array),
1053 .x_size = 479,
1054 .y_size = 799,
1055 .irqflags = IRQF_TRIGGER_FALLING,
1056 .i2c_pull_up = true,
1057 .reset_gpio = MXT_TS_RESET_GPIO,
1058 .irq_gpio = MXT_TS_IRQ_GPIO,
1059 .key_codes = mxt_key_codes,
1060};
1061
1062static struct i2c_board_info mxt_device_info[] __initdata = {
1063 {
1064 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
1065 .platform_data = &mxt_platform_data,
1066 .irq = MSM_GPIO_TO_INT(MXT_TS_IRQ_GPIO),
1067 },
1068};
1069
Taniya Dasc868a2e2012-01-03 10:18:47 +05301070static void msm7627a_add_io_devices(void)
1071{
Mohan Pallakaad78af82011-11-23 15:30:07 +05301072 int rc;
1073
Mohan Pallaka4c5bb922011-11-23 15:54:51 +05301074 /* touchscreen */
1075 if (machine_is_msm7627a_qrd1()) {
1076 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
1077 synaptic_i2c_clearpad3k,
1078 ARRAY_SIZE(synaptic_i2c_clearpad3k));
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301079 } else if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()) {
Mohan Pallaka4c5bb922011-11-23 15:54:51 +05301080 rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_IRQ_GPIO, 0,
1081 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
1082 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
1083 if (rc) {
1084 pr_err("%s: gpio_tlmm_config for %d failed\n",
1085 __func__, MXT_TS_IRQ_GPIO);
1086 }
1087
1088 rc = gpio_tlmm_config(GPIO_CFG(MXT_TS_RESET_GPIO, 0,
1089 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN,
1090 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
1091 if (rc) {
1092 pr_err("%s: gpio_tlmm_config for %d failed\n",
1093 __func__, MXT_TS_RESET_GPIO);
1094 }
1095
1096 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
1097 mxt_device_info,
1098 ARRAY_SIZE(mxt_device_info));
1099 }
1100
1101 /* headset */
Taniya Dasc868a2e2012-01-03 10:18:47 +05301102 platform_device_register(&hs_pdev);
1103
Mohan Pallaka4c5bb922011-11-23 15:54:51 +05301104 /* vibrator */
Taniya Dasc868a2e2012-01-03 10:18:47 +05301105#ifdef CONFIG_MSM_RPC_VIBRATOR
1106 msm_init_pmic_vibrator();
1107#endif
1108
Mohan Pallakab6c44b32011-11-23 15:19:57 +05301109 /* keypad */
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301110 if (machine_is_msm7627a_evb() || machine_is_msm8625_evb())
Mohan Pallakab6c44b32011-11-23 15:19:57 +05301111 platform_device_register(&kp_pdev_8625);
Mohan Pallakaad78af82011-11-23 15:30:07 +05301112
1113 /* leds */
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301114 if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()) {
Mohan Pallakaad78af82011-11-23 15:30:07 +05301115 rc = gpio_tlmm_config(GPIO_CFG(LED_RED_GPIO_8625, 0,
1116 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
1117 GPIO_CFG_16MA), GPIO_CFG_ENABLE);
1118 if (rc) {
1119 pr_err("%s: gpio_tlmm_config for %d failed\n",
1120 __func__, LED_RED_GPIO_8625);
1121 }
1122
1123 rc = gpio_tlmm_config(GPIO_CFG(LED_GREEN_GPIO_8625, 0,
1124 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
1125 GPIO_CFG_16MA), GPIO_CFG_ENABLE);
1126 if (rc) {
1127 pr_err("%s: gpio_tlmm_config for %d failed\n",
1128 __func__, LED_GREEN_GPIO_8625);
1129 }
1130
1131 platform_device_register(&gpio_leds_8625);
1132 }
Taniya Dasc868a2e2012-01-03 10:18:47 +05301133}
1134
Santosh Sajjan374d6592012-01-19 23:16:46 +05301135static int __init msm_qrd_init_ar6000pm(void)
1136{
1137 msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power;
1138 return platform_device_register(&msm_wlan_ar6000_pm_device);
1139}
1140
Taniya Dase380a2d2012-03-09 13:02:41 +05301141static void __init msm_add_footswitch_devices(void)
1142{
1143 platform_add_devices(msm_footswitch_devices,
1144 msm_num_footswitch_devices);
1145}
1146
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301147static void add_platform_devices(void)
1148{
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301149 if (machine_is_msm8625_evb())
1150 platform_add_devices(msm8625_evb_devices,
1151 ARRAY_SIZE(msm8625_evb_devices));
1152 else {
1153 platform_add_devices(qrd7627a_devices,
1154 ARRAY_SIZE(qrd7627a_devices));
1155 if (machine_is_msm7627a_qrd3())
1156 platform_add_devices(qrd3_devices,
1157 ARRAY_SIZE(qrd3_devices));
1158 }
1159 platform_add_devices(common_devices,
1160 ARRAY_SIZE(common_devices));
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301161}
1162
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301163#define UART1DM_RX_GPIO 45
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301164static void __init qrd7627a_uart1dm_config(void)
1165{
1166 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
1167 if (cpu_is_msm8625())
1168 msm8625_device_uart_dm1.dev.platform_data =
1169 &msm_uart_dm1_pdata;
1170 else
1171 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
1172}
1173
1174static void __init qrd7627a_otg_gadget(void)
1175{
1176 msm_otg_pdata.swfi_latency = msm7627a_pm_data
1177 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
1178
1179 if (cpu_is_msm8625()) {
1180 msm8625_device_otg.dev.platform_data = &msm_otg_pdata;
1181 msm8625_device_gadget_peripheral.dev.platform_data =
1182 &msm_gadget_pdata;
1183
1184 } else {
1185 msm_device_otg.dev.platform_data = &msm_otg_pdata;
1186 msm_device_gadget_peripheral.dev.platform_data =
1187 &msm_gadget_pdata;
1188 }
1189}
1190
Taniya Dasc868a2e2012-01-03 10:18:47 +05301191static void __init msm_qrd_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301192{
1193 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +05301194 msm7627a_init_regulators();
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301195 msmqrd_adsp_add_pdev();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301196
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301197 if (cpu_is_msm8625())
1198 msm8625_device_i2c_init();
1199 else
1200 msm7627a_device_i2c_init();
1201
1202 /* uart1dm*/
1203 qrd7627a_uart1dm_config();
1204 /*OTG gadget*/
1205 qrd7627a_otg_gadget();
Taniya Dasc868a2e2012-01-03 10:18:47 +05301206
Taniya Dase380a2d2012-03-09 13:02:41 +05301207 msm_add_footswitch_devices();
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301208 add_platform_devices();
Taniya Dasc868a2e2012-01-03 10:18:47 +05301209
Santosh Sajjan374d6592012-01-19 23:16:46 +05301210 /* Ensure ar6000pm device is registered before MMC/SDC */
1211 msm_qrd_init_ar6000pm();
Chintan Pandyacf467fc2011-12-01 17:11:11 +05301212 msm7627a_init_mmc();
1213
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301214#ifdef CONFIG_USB_EHCI_MSM_72K
1215 msm7627a_init_host();
1216#endif
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301217 if (!machine_is_msm8625_evb()) {
1218 msm_pm_set_platform_data(msm7627a_pm_data,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301219 ARRAY_SIZE(msm7627a_pm_data));
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301220 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Murali Nalajala4c996be2012-03-12 17:05:41 +05301221 } else {
1222 msm_pm_set_platform_data(msm8625_pm_data,
1223 ARRAY_SIZE(msm8625_pm_data));
1224 BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata));
1225 msm8x25_spm_device_init();
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301226 }
Murali Nalajalaa1827842011-11-13 14:12:39 +05301227
Taniya Das0a5303a2011-08-23 18:47:48 +05301228 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301229
1230#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +05301231 msm7627a_bt_power_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301232#endif
Taniya Dasda408822011-09-06 12:54:06 +05301233
Chintan Pandya40762702011-12-06 13:47:06 +05301234 msm7627a_camera_init();
Taniya Dasc868a2e2012-01-03 10:18:47 +05301235 msm7627a_add_io_devices();
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +05301236 msm7x25a_kgsl_3d0_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301237}
1238
1239static void __init qrd7627a_init_early(void)
1240{
1241 msm_msm7627a_allocate_memory_regions();
1242}
1243
1244MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
1245 .boot_params = PHYS_OFFSET + 0x100,
1246 .map_io = msm_common_io_init,
1247 .reserve = msm7627a_reserve,
1248 .init_irq = msm_init_irq,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301249 .init_machine = msm_qrd_init,
1250 .timer = &msm_timer,
1251 .init_early = qrd7627a_init_early,
1252 .handle_irq = vic_handle_irq,
1253MACHINE_END
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301254MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3")
1255 .boot_params = PHYS_OFFSET + 0x100,
1256 .map_io = msm_common_io_init,
1257 .reserve = msm7627a_reserve,
1258 .init_irq = msm_init_irq,
1259 .init_machine = msm_qrd_init,
1260 .timer = &msm_timer,
1261 .init_early = qrd7627a_init_early,
1262 .handle_irq = vic_handle_irq,
1263MACHINE_END
Taniya Dasc868a2e2012-01-03 10:18:47 +05301264MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB")
1265 .boot_params = PHYS_OFFSET + 0x100,
1266 .map_io = msm_common_io_init,
1267 .reserve = msm7627a_reserve,
1268 .init_irq = msm_init_irq,
1269 .init_machine = msm_qrd_init,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301270 .timer = &msm_timer,
1271 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +05301272 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301273MACHINE_END
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301274MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB")
1275 .boot_params = PHYS_OFFSET + 0x100,
1276 .map_io = msm8625_map_io,
Taniya Dasfe04d4f2012-03-14 11:13:21 +05301277 .reserve = msm8625_reserve,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301278 .init_irq = msm8625_init_irq,
1279 .init_machine = msm_qrd_init,
1280 .timer = &msm_timer,
1281 .init_early = qrd7627a_init_early,
1282 .handle_irq = gic_handle_irq,
1283MACHINE_END