blob: 8b50c5365a71b90b9514e6040346efb780695356 [file] [log] [blame]
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/gpio_event.h>
15#include <asm/mach-types.h>
16#include <asm/mach/arch.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053017#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070018#include <mach/board.h>
19#include <mach/msm_iomap.h>
20#include <mach/msm_hsusb.h>
21#include <mach/rpc_hsusb.h>
22#include <mach/rpc_pmapp.h>
23#include <mach/usbdiag.h>
24#include <mach/msm_memtypes.h>
25#include <mach/msm_serial_hs.h>
26#include <linux/usb/android.h>
27#include <linux/platform_device.h>
28#include <linux/io.h>
29#include <linux/gpio.h>
30#include <mach/vreg.h>
31#include <mach/pmic.h>
32#include <mach/socinfo.h>
33#include <linux/mtd/nand.h>
34#include <linux/mtd/partitions.h>
35#include <asm/mach/mmc.h>
36#include <linux/i2c.h>
37#include <linux/i2c/sx150x.h>
38#include <linux/gpio.h>
39#include <linux/android_pmem.h>
40#include <linux/bootmem.h>
41#include <linux/mfd/marimba.h>
42#include <mach/vreg.h>
43#include <linux/power_supply.h>
Justin Paupored98328e2011-08-19 13:48:31 -070044#include <linux/regulator/consumer.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include <mach/rpc_pmapp.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <mach/msm_battery.h>
47#include <linux/smsc911x.h>
48#include <linux/atmel_maxtouch.h>
49#include "devices.h"
50#include "timer.h"
Justin Pauporeb3a33b72011-08-23 15:30:32 -070051#include "board-msm7x27a-regulator.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include "devices-msm7x2xa.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080053#include <mach/pm.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054#include <mach/rpc_server_handset.h>
55#include <mach/socinfo.h>
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060056#include "pm-boot.h"
Chintan Pandyacf467fc2011-12-01 17:11:11 +053057#include "board-msm7627a.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058
59#define PMEM_KERNEL_EBI1_SIZE 0x3A000
60#define MSM_PMEM_AUDIO_SIZE 0x5B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070062#if defined(CONFIG_GPIO_SX150X)
63enum {
64 SX150X_CORE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065};
66
67static struct sx150x_platform_data sx150x_data[] __initdata = {
68 [SX150X_CORE] = {
69 .gpio_base = GPIO_CORE_EXPANDER_BASE,
70 .oscio_is_gpo = false,
71 .io_pullup_ena = 0,
pankaj kumarc5c01392011-08-12 13:44:05 +053072 .io_pulldn_ena = 0x02,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070073 .io_open_drain_ena = 0xfef8,
74 .irq_summary = -1,
75 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076};
77#endif
78
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079
Santosh Sajjan6822c682011-07-26 10:49:36 +053080static struct platform_device msm_wlan_ar6000_pm_device = {
81 .name = "wlan_ar6000_pm_dev",
82 .id = -1,
83};
84
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070085#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
86static struct i2c_board_info core_exp_i2c_info[] __initdata = {
87 {
88 I2C_BOARD_INFO("sx1509q", 0x3e),
89 },
90};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092static void __init register_i2c_devices(void)
93{
Trilok Soni3d0f6c52011-07-26 16:06:58 +053094 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095 sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0;
96
97 core_exp_i2c_info[0].platform_data =
98 &sx150x_data[SX150X_CORE];
99
100 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
101 core_exp_i2c_info,
102 ARRAY_SIZE(core_exp_i2c_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700103}
104#endif
105
106static struct msm_gpio qup_i2c_gpios_io[] = {
107 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
108 "qup_scl" },
109 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
110 "qup_sda" },
111 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
112 "qup_scl" },
113 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
114 "qup_sda" },
115};
116
117static struct msm_gpio qup_i2c_gpios_hw[] = {
118 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
119 "qup_scl" },
120 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
121 "qup_sda" },
122 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
123 "qup_scl" },
124 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
125 "qup_sda" },
126};
127
128static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
129{
130 int rc;
131
132 if (adap_id < 0 || adap_id > 1)
133 return;
134
135 /* Each adapter gets 2 lines from the table */
136 if (config_type)
137 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
138 else
139 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
140 if (rc < 0)
141 pr_err("QUP GPIO request/enable failed: %d\n", rc);
142}
143
144static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
145 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700146 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
147};
148
149static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
150 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700151 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
152};
153
154#ifdef CONFIG_ARCH_MSM7X27A
Neti Ravi Kumar061726e2011-12-08 15:14:57 +0530155#define MSM_PMEM_MDP_SIZE 0x2300000
156#define MSM7x25A_MSM_PMEM_MDP_SIZE 0x1500000
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530157
Mahesh Lankaa2f6df12012-01-05 16:54:40 +0530158#define MSM_PMEM_ADSP_SIZE 0x1100000
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530159#define MSM7x25A_MSM_PMEM_ADSP_SIZE 0xB91000
160
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700161#endif
162
163static struct android_usb_platform_data android_usb_pdata = {
164 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
165};
166
167static struct platform_device android_usb_device = {
168 .name = "android_usb",
169 .id = -1,
170 .dev = {
171 .platform_data = &android_usb_pdata,
172 },
173};
174
175#ifdef CONFIG_USB_EHCI_MSM_72K
176static void msm_hsusb_vbus_power(unsigned phy_info, int on)
177{
178 int rc = 0;
179 unsigned gpio;
180
181 gpio = GPIO_HOST_VBUS_EN;
182
183 rc = gpio_request(gpio, "i2c_host_vbus_en");
184 if (rc < 0) {
185 pr_err("failed to request %d GPIO\n", gpio);
186 return;
187 }
188 gpio_direction_output(gpio, !!on);
189 gpio_set_value_cansleep(gpio, !!on);
190 gpio_free(gpio);
191}
192
193static struct msm_usb_host_platform_data msm_usb_host_pdata = {
194 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
195};
196
197static void __init msm7x2x_init_host(void)
198{
199 msm_add_host(0, &msm_usb_host_pdata);
200}
201#endif
202
203#ifdef CONFIG_USB_MSM_OTG_72K
204static int hsusb_rpc_connect(int connect)
205{
206 if (connect)
207 return msm_hsusb_rpc_connect();
208 else
209 return msm_hsusb_rpc_close();
210}
211
Justin Paupored98328e2011-08-19 13:48:31 -0700212static struct regulator *reg_hsusb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700213static int msm_hsusb_ldo_init(int init)
214{
Justin Paupored98328e2011-08-19 13:48:31 -0700215 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700216
Justin Paupored98328e2011-08-19 13:48:31 -0700217 if (init) {
218 reg_hsusb = regulator_get(NULL, "usb");
219 if (IS_ERR(reg_hsusb)) {
220 rc = PTR_ERR(reg_hsusb);
221 pr_err("%s: could not get regulator: %d\n",
222 __func__, rc);
223 goto out;
224 }
225
226 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
227 if (rc) {
228 pr_err("%s: could not set voltage: %d\n",
229 __func__, rc);
230 goto reg_free;
231 }
232
233 return 0;
234 }
235 /* else fall through */
236reg_free:
237 regulator_put(reg_hsusb);
238out:
239 reg_hsusb = NULL;
240 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700241}
242
243static int msm_hsusb_ldo_enable(int enable)
244{
245 static int ldo_status;
246
Justin Paupored98328e2011-08-19 13:48:31 -0700247 if (IS_ERR_OR_NULL(reg_hsusb))
248 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700249
250 if (ldo_status == enable)
251 return 0;
252
253 ldo_status = enable;
254
Justin Paupored98328e2011-08-19 13:48:31 -0700255 return enable ?
256 regulator_enable(reg_hsusb) :
257 regulator_disable(reg_hsusb);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700258}
259
260#ifndef CONFIG_USB_EHCI_MSM_72K
261static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
262{
263 int ret = 0;
264
265 if (init)
266 ret = msm_pm_app_rpc_init(callback);
267 else
268 msm_pm_app_rpc_deinit(callback);
269
270 return ret;
271}
272#endif
273
274static struct msm_otg_platform_data msm_otg_pdata = {
275#ifndef CONFIG_USB_EHCI_MSM_72K
276 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
277#else
278 .vbus_power = msm_hsusb_vbus_power,
279#endif
280 .rpc_connect = hsusb_rpc_connect,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700281 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
282 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
283 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
284 .se1_gating = SE1_GATING_DISABLE,
285 .ldo_init = msm_hsusb_ldo_init,
286 .ldo_enable = msm_hsusb_ldo_enable,
287 .chg_init = hsusb_chg_init,
288 .chg_connected = hsusb_chg_connected,
289 .chg_vbus_draw = hsusb_chg_vbus_draw,
290};
291#endif
292
293static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
294 .is_phy_status_timer_on = 1,
295};
296
297static struct resource smc91x_resources[] = {
298 [0] = {
299 .start = 0x90000300,
300 .end = 0x900003ff,
301 .flags = IORESOURCE_MEM,
302 },
303 [1] = {
304 .start = MSM_GPIO_TO_INT(4),
305 .end = MSM_GPIO_TO_INT(4),
306 .flags = IORESOURCE_IRQ,
307 },
308};
309
310static struct platform_device smc91x_device = {
311 .name = "smc91x",
312 .id = 0,
313 .num_resources = ARRAY_SIZE(smc91x_resources),
314 .resource = smc91x_resources,
315};
316
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317#ifdef CONFIG_SERIAL_MSM_HS
318static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
319 .inject_rx_on_wakeup = 1,
320 .rx_to_inject = 0xFD,
321};
322#endif
323static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
324 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
325 .idle_supported = 1,
326 .suspend_supported = 1,
327 .idle_enabled = 1,
328 .suspend_enabled = 1,
329 .latency = 16000,
330 .residency = 20000,
331 },
332 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
333 .idle_supported = 1,
334 .suspend_supported = 1,
335 .idle_enabled = 1,
336 .suspend_enabled = 1,
337 .latency = 12000,
338 .residency = 20000,
339 },
340 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
341 .idle_supported = 1,
342 .suspend_supported = 1,
343 .idle_enabled = 0,
344 .suspend_enabled = 1,
345 .latency = 2000,
346 .residency = 0,
347 },
348 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
349 .idle_supported = 1,
350 .suspend_supported = 1,
351 .idle_enabled = 1,
352 .suspend_enabled = 1,
353 .latency = 2,
354 .residency = 0,
355 },
356};
357
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600358static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +0530359 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS,
360 .p_addr = 0,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600361};
362
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700363static struct android_pmem_platform_data android_pmem_adsp_pdata = {
364 .name = "pmem_adsp",
365 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
Mahesh Lankac6af7eb2011-08-02 18:00:35 +0530366 .cached = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700367 .memory_type = MEMTYPE_EBI1,
368};
369
370static struct platform_device android_pmem_adsp_device = {
371 .name = "android_pmem",
372 .id = 1,
373 .dev = { .platform_data = &android_pmem_adsp_pdata },
374};
375
376static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
377static int __init pmem_mdp_size_setup(char *p)
378{
379 pmem_mdp_size = memparse(p, NULL);
380 return 0;
381}
382
383early_param("pmem_mdp_size", pmem_mdp_size_setup);
384
385static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
386static int __init pmem_adsp_size_setup(char *p)
387{
388 pmem_adsp_size = memparse(p, NULL);
389 return 0;
390}
391
392early_param("pmem_adsp_size", pmem_adsp_size_setup);
393
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700394#define SND(desc, num) { .name = #desc, .id = num }
395static struct snd_endpoint snd_endpoints_list[] = {
396 SND(HANDSET, 0),
397 SND(MONO_HEADSET, 2),
398 SND(HEADSET, 3),
399 SND(SPEAKER, 6),
400 SND(TTY_HEADSET, 8),
401 SND(TTY_VCO, 9),
402 SND(TTY_HCO, 10),
403 SND(BT, 12),
404 SND(IN_S_SADC_OUT_HANDSET, 16),
405 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
406 SND(FM_DIGITAL_STEREO_HEADSET, 26),
407 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
408 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +0530409 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Sidipotu Ashokab34ca42011-07-22 16:34:20 +0530410 SND(CURRENT, 0x7FFFFFFE),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700411 SND(FM_ANALOG_STEREO_HEADSET, 35),
412 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
413};
414#undef SND
415
416static struct msm_snd_endpoints msm_device_snd_endpoints = {
417 .endpoints = snd_endpoints_list,
418 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
419};
420
421static struct platform_device msm_device_snd = {
422 .name = "msm_snd",
423 .id = -1,
424 .dev = {
425 .platform_data = &msm_device_snd_endpoints
426 },
427};
428
429#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
430 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
431 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
432 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
433 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
434 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
435#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
436 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
437 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
438 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
439 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
440 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
441#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
442 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
443 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
444 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
445 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
446 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
447#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
448 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
449 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
450 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
451 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
452 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
453#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
454
455static unsigned int dec_concurrency_table[] = {
456 /* Audio LP */
457 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
458 0, 0, 0,
459
460 /* Concurrency 1 */
461 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
462 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
463 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
464 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
465 (DEC4_FORMAT),
466
467 /* Concurrency 2 */
468 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
469 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
470 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
471 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
472 (DEC4_FORMAT),
473
474 /* Concurrency 3 */
475 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
476 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
477 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
478 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
479 (DEC4_FORMAT),
480
481 /* Concurrency 4 */
482 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
483 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
484 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
485 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
486 (DEC4_FORMAT),
487
488 /* Concurrency 5 */
489 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
490 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
491 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
492 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
493 (DEC4_FORMAT),
494
495 /* Concurrency 6 */
496 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
497 0, 0, 0, 0,
498
499 /* Concurrency 7 */
500 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
501 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
502 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
503 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
504 (DEC4_FORMAT),
505};
506
507#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
508 .module_queueid = queueid, .module_decid = decid, \
509 .nr_codec_support = nr_codec}
510
511static struct msm_adspdec_info dec_info_list[] = {
512 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
513 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
514 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
515 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
516 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
517};
518
519static struct msm_adspdec_database msm_device_adspdec_database = {
520 .num_dec = ARRAY_SIZE(dec_info_list),
521 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
522 ARRAY_SIZE(dec_info_list)),
523 .dec_concurrency_table = dec_concurrency_table,
524 .dec_info_list = dec_info_list,
525};
526
527static struct platform_device msm_device_adspdec = {
528 .name = "msm_adspdec",
529 .id = -1,
530 .dev = {
531 .platform_data = &msm_device_adspdec_database
532 },
533};
534
535static struct android_pmem_platform_data android_pmem_audio_pdata = {
536 .name = "pmem_audio",
537 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
538 .cached = 0,
539 .memory_type = MEMTYPE_EBI1,
540};
541
542static struct platform_device android_pmem_audio_device = {
543 .name = "android_pmem",
544 .id = 2,
545 .dev = { .platform_data = &android_pmem_audio_pdata },
546};
547
548static struct android_pmem_platform_data android_pmem_pdata = {
549 .name = "pmem",
550 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
551 .cached = 1,
552 .memory_type = MEMTYPE_EBI1,
553};
554static struct platform_device android_pmem_device = {
555 .name = "android_pmem",
556 .id = 0,
557 .dev = { .platform_data = &android_pmem_pdata },
558};
559
560static u32 msm_calculate_batt_capacity(u32 current_voltage);
561
562static struct msm_psy_batt_pdata msm_psy_batt_data = {
563 .voltage_min_design = 2800,
564 .voltage_max_design = 4300,
565 .avail_chg_sources = AC_CHG | USB_CHG ,
566 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
567 .calculate_capacity = &msm_calculate_batt_capacity,
568};
569
570static u32 msm_calculate_batt_capacity(u32 current_voltage)
571{
572 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
573 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
574
575 return (current_voltage - low_voltage) * 100
576 / (high_voltage - low_voltage);
577}
578
579static struct platform_device msm_batt_device = {
580 .name = "msm-battery",
581 .id = -1,
582 .dev.platform_data = &msm_psy_batt_data,
583};
584
585static struct smsc911x_platform_config smsc911x_config = {
586 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
587 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
588 .flags = SMSC911X_USE_16BIT,
589};
590
591static struct resource smsc911x_resources[] = {
592 [0] = {
593 .start = 0x90000000,
594 .end = 0x90007fff,
595 .flags = IORESOURCE_MEM,
596 },
597 [1] = {
598 .start = MSM_GPIO_TO_INT(48),
599 .end = MSM_GPIO_TO_INT(48),
600 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
601 },
602};
603
604static struct platform_device smsc911x_device = {
605 .name = "smsc911x",
606 .id = 0,
607 .num_resources = ARRAY_SIZE(smsc911x_resources),
608 .resource = smsc911x_resources,
609 .dev = {
610 .platform_data = &smsc911x_config,
611 },
612};
613
614static struct msm_gpio smsc911x_gpios[] = {
615 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
616 "smsc911x_irq" },
617 { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
618 "eth_fifo_sel" },
619};
620
621#define ETH_FIFO_SEL_GPIO 49
622static void msm7x27a_cfg_smsc911x(void)
623{
624 int res;
625
626 res = msm_gpios_request_enable(smsc911x_gpios,
627 ARRAY_SIZE(smsc911x_gpios));
628 if (res) {
629 pr_err("%s: unable to enable gpios for SMSC911x\n", __func__);
630 return;
631 }
632
633 /* ETH_FIFO_SEL */
634 res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0);
635 if (res) {
636 pr_err("%s: unable to get direction for gpio %d\n", __func__,
637 ETH_FIFO_SEL_GPIO);
638 msm_gpios_disable_free(smsc911x_gpios,
639 ARRAY_SIZE(smsc911x_gpios));
640 return;
641 }
642 gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
643}
644
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700645#if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \
646 && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM)
647static struct msm_gpio uart2dm_gpios[] = {
648 {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
649 "uart2dm_rfr_n" },
650 {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
651 "uart2dm_cts_n" },
652 {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
653 "uart2dm_rx" },
654 {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
655 "uart2dm_tx" },
656};
657
658static void msm7x27a_cfg_uart2dm_serial(void)
659{
660 int ret;
661 ret = msm_gpios_request_enable(uart2dm_gpios,
662 ARRAY_SIZE(uart2dm_gpios));
663 if (ret)
664 pr_err("%s: unable to enable gpios for uart2dm\n", __func__);
665}
666#else
667static void msm7x27a_cfg_uart2dm_serial(void) { }
668#endif
669
670static struct platform_device *rumi_sim_devices[] __initdata = {
671 &msm_device_dmov,
672 &msm_device_smd,
673 &smc91x_device,
674 &msm_device_uart1,
675 &msm_device_nand,
676 &msm_device_uart_dm1,
677 &msm_gsbi0_qup_i2c_device,
678 &msm_gsbi1_qup_i2c_device,
679};
680
Taniya Das43bcdd62011-12-02 17:33:27 +0530681static struct platform_device *msm8625_rumi3_devices[] __initdata = {
682 &msm8625_device_dmov,
683 &msm8625_device_uart1,
684};
685
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700686static struct platform_device *surf_ffa_devices[] __initdata = {
687 &msm_device_dmov,
688 &msm_device_smd,
689 &msm_device_uart1,
690 &msm_device_uart_dm1,
691 &msm_device_uart_dm2,
692 &msm_device_nand,
693 &msm_gsbi0_qup_i2c_device,
694 &msm_gsbi1_qup_i2c_device,
695 &msm_device_otg,
696 &msm_device_gadget_peripheral,
697 &android_usb_device,
698 &android_pmem_device,
699 &android_pmem_adsp_device,
700 &android_pmem_audio_device,
701 &msm_device_snd,
702 &msm_device_adspdec,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700703 &msm_batt_device,
704 &smsc911x_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700705 &msm_kgsl_3d0,
706#ifdef CONFIG_BT
707 &msm_bt_power_device,
708#endif
Manish Dewangan3a260992011-06-24 18:01:34 +0530709 &asoc_msm_pcm,
710 &asoc_msm_dai0,
711 &asoc_msm_dai1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700712};
713
714static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
715static int __init pmem_kernel_ebi1_size_setup(char *p)
716{
717 pmem_kernel_ebi1_size = memparse(p, NULL);
718 return 0;
719}
720early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
721
722static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
723static int __init pmem_audio_size_setup(char *p)
724{
725 pmem_audio_size = memparse(p, NULL);
726 return 0;
727}
728early_param("pmem_audio_size", pmem_audio_size_setup);
729
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700730static struct memtype_reserve msm7x27a_reserve_table[] __initdata = {
731 [MEMTYPE_SMI] = {
732 },
733 [MEMTYPE_EBI0] = {
734 .flags = MEMTYPE_FLAGS_1M_ALIGN,
735 },
736 [MEMTYPE_EBI1] = {
737 .flags = MEMTYPE_FLAGS_1M_ALIGN,
738 },
739};
740
741static void __init size_pmem_devices(void)
742{
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530743
744 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
745 pmem_mdp_size = MSM7x25A_MSM_PMEM_MDP_SIZE;
746 pmem_adsp_size = MSM7x25A_MSM_PMEM_ADSP_SIZE;
747 } else {
748 pmem_mdp_size = MSM_PMEM_MDP_SIZE;
749 pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
750 }
751
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700752#ifdef CONFIG_ANDROID_PMEM
753 android_pmem_adsp_pdata.size = pmem_adsp_size;
754 android_pmem_pdata.size = pmem_mdp_size;
755 android_pmem_audio_pdata.size = pmem_audio_size;
756#endif
757}
758
759static void __init reserve_memory_for(struct android_pmem_platform_data *p)
760{
761 msm7x27a_reserve_table[p->memory_type].size += p->size;
762}
763
764static void __init reserve_pmem_memory(void)
765{
766#ifdef CONFIG_ANDROID_PMEM
767 reserve_memory_for(&android_pmem_adsp_pdata);
768 reserve_memory_for(&android_pmem_pdata);
769 reserve_memory_for(&android_pmem_audio_pdata);
770 msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
771#endif
772}
773
774static void __init msm7x27a_calculate_reserve_sizes(void)
775{
776 size_pmem_devices();
777 reserve_pmem_memory();
778}
779
780static int msm7x27a_paddr_to_memtype(unsigned int paddr)
781{
782 return MEMTYPE_EBI1;
783}
784
785static struct reserve_info msm7x27a_reserve_info __initdata = {
786 .memtype_reserve_table = msm7x27a_reserve_table,
787 .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes,
788 .paddr_to_memtype = msm7x27a_paddr_to_memtype,
789};
790
791static void __init msm7x27a_reserve(void)
792{
793 reserve_info = &msm7x27a_reserve_info;
794 msm_reserve();
795}
796
797static void __init msm_device_i2c_init(void)
798{
799 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
800 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
801}
802
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700803#define MSM_EBI2_PHYS 0xa0d00000
804#define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030
805
806static void __init msm7x27a_init_ebi2(void)
807{
808 uint32_t ebi2_cfg;
809 void __iomem *ebi2_cfg_ptr;
810
811 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t));
812 if (!ebi2_cfg_ptr)
813 return;
814
815 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530816 if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() ||
817 machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700818 ebi2_cfg |= (1 << 4); /* CS2 */
819
820 writel(ebi2_cfg, ebi2_cfg_ptr);
821 iounmap(ebi2_cfg_ptr);
822
823 /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */
824 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1,
825 sizeof(uint32_t));
826 if (!ebi2_cfg_ptr)
827 return;
828
829 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530830 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700831 ebi2_cfg |= (1 << 31);
832
833 writel(ebi2_cfg, ebi2_cfg_ptr);
834 iounmap(ebi2_cfg_ptr);
835}
836
837#define ATMEL_TS_I2C_NAME "maXTouch"
Justin Paupored98328e2011-08-19 13:48:31 -0700838
839static struct regulator_bulk_data regs_atmel[] = {
840 { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 },
841 { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 },
842};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700843
844#define ATMEL_TS_GPIO_IRQ 82
845
846static int atmel_ts_power_on(bool on)
847{
Justin Paupored98328e2011-08-19 13:48:31 -0700848 int rc = on ?
849 regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) :
850 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700851
Justin Paupored98328e2011-08-19 13:48:31 -0700852 if (rc)
853 pr_err("%s: could not %sable regulators: %d\n",
854 __func__, on ? "en" : "dis", rc);
855 else
856 msleep(50);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700857
Justin Paupored98328e2011-08-19 13:48:31 -0700858 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700859}
860
861static int atmel_ts_platform_init(struct i2c_client *client)
862{
863 int rc;
Justin Paupored98328e2011-08-19 13:48:31 -0700864 struct device *dev = &client->dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700865
Justin Paupored98328e2011-08-19 13:48:31 -0700866 rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700867 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -0700868 dev_err(dev, "%s: could not get regulators: %d\n",
869 __func__, rc);
870 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700871 }
872
Justin Paupored98328e2011-08-19 13:48:31 -0700873 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700874 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -0700875 dev_err(dev, "%s: could not set voltages: %d\n",
876 __func__, rc);
877 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700878 }
879
880 rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
881 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
882 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
883 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -0700884 dev_err(dev, "%s: gpio_tlmm_config for %d failed\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700885 __func__, ATMEL_TS_GPIO_IRQ);
Justin Paupored98328e2011-08-19 13:48:31 -0700886 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700887 }
888
889 /* configure touchscreen interrupt gpio */
890 rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio");
891 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -0700892 dev_err(dev, "%s: unable to request gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700893 __func__, ATMEL_TS_GPIO_IRQ);
894 goto ts_gpio_tlmm_unconfig;
895 }
896
897 rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ);
898 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -0700899 dev_err(dev, "%s: unable to set the direction of gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700900 __func__, ATMEL_TS_GPIO_IRQ);
901 goto free_ts_gpio;
902 }
903 return 0;
904
905free_ts_gpio:
906 gpio_free(ATMEL_TS_GPIO_IRQ);
907ts_gpio_tlmm_unconfig:
908 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
909 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
910 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -0700911reg_free:
912 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
913out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700914 return rc;
915}
916
917static int atmel_ts_platform_exit(struct i2c_client *client)
918{
919 gpio_free(ATMEL_TS_GPIO_IRQ);
920 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
921 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
922 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -0700923 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700924 return 0;
925}
926
927static u8 atmel_ts_read_chg(void)
928{
929 return gpio_get_value(ATMEL_TS_GPIO_IRQ);
930}
931
932static u8 atmel_ts_valid_interrupt(void)
933{
934 return !atmel_ts_read_chg();
935}
936
937#define ATMEL_X_OFFSET 13
938#define ATMEL_Y_OFFSET 0
939
Mohan Pallaka4e9a94e2011-11-23 16:34:21 +0530940static struct maxtouch_platform_data atmel_ts_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700941 .numtouch = 4,
942 .init_platform_hw = atmel_ts_platform_init,
943 .exit_platform_hw = atmel_ts_platform_exit,
944 .power_on = atmel_ts_power_on,
945 .display_res_x = 480,
946 .display_res_y = 864,
947 .min_x = ATMEL_X_OFFSET,
948 .max_x = (505 - ATMEL_X_OFFSET),
949 .min_y = ATMEL_Y_OFFSET,
950 .max_y = (863 - ATMEL_Y_OFFSET),
951 .valid_interrupt = atmel_ts_valid_interrupt,
952 .read_chg = atmel_ts_read_chg,
953};
954
955static struct i2c_board_info atmel_ts_i2c_info[] __initdata = {
956 {
957 I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a),
958 .platform_data = &atmel_ts_pdata,
959 .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ),
960 },
961};
962
963#define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col))
964
965static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35};
966static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40};
967
968static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) *
969 ARRAY_SIZE(kp_row_gpios)] = {
970 [KP_INDEX(0, 0)] = KEY_7,
971 [KP_INDEX(0, 1)] = KEY_DOWN,
972 [KP_INDEX(0, 2)] = KEY_UP,
973 [KP_INDEX(0, 3)] = KEY_RIGHT,
974 [KP_INDEX(0, 4)] = KEY_ENTER,
975
976 [KP_INDEX(1, 0)] = KEY_LEFT,
977 [KP_INDEX(1, 1)] = KEY_SEND,
978 [KP_INDEX(1, 2)] = KEY_1,
979 [KP_INDEX(1, 3)] = KEY_4,
980 [KP_INDEX(1, 4)] = KEY_CLEAR,
981
982 [KP_INDEX(2, 0)] = KEY_6,
983 [KP_INDEX(2, 1)] = KEY_5,
984 [KP_INDEX(2, 2)] = KEY_8,
985 [KP_INDEX(2, 3)] = KEY_3,
986 [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR,
987
988 [KP_INDEX(3, 0)] = KEY_9,
989 [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND,
990 [KP_INDEX(3, 2)] = KEY_0,
991 [KP_INDEX(3, 3)] = KEY_2,
992 [KP_INDEX(3, 4)] = KEY_SLEEP,
993
994 [KP_INDEX(4, 0)] = KEY_BACK,
995 [KP_INDEX(4, 1)] = KEY_HOME,
996 [KP_INDEX(4, 2)] = KEY_MENU,
997 [KP_INDEX(4, 3)] = KEY_VOLUMEUP,
998 [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN,
999};
1000
1001/* SURF keypad platform device information */
1002static struct gpio_event_matrix_info kp_matrix_info = {
1003 .info.func = gpio_event_matrix_func,
1004 .keymap = keymap,
1005 .output_gpios = kp_row_gpios,
1006 .input_gpios = kp_col_gpios,
1007 .noutputs = ARRAY_SIZE(kp_row_gpios),
1008 .ninputs = ARRAY_SIZE(kp_col_gpios),
1009 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
1010 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
1011 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
1012 GPIOKPF_PRINT_UNMAPPED_KEYS,
1013};
1014
1015static struct gpio_event_info *kp_info[] = {
1016 &kp_matrix_info.info
1017};
1018
1019static struct gpio_event_platform_data kp_pdata = {
1020 .name = "7x27a_kp",
1021 .info = kp_info,
1022 .info_count = ARRAY_SIZE(kp_info)
1023};
1024
1025static struct platform_device kp_pdev = {
1026 .name = GPIO_EVENT_DEV_NAME,
1027 .id = -1,
1028 .dev = {
1029 .platform_data = &kp_pdata,
1030 },
1031};
1032
1033static struct msm_handset_platform_data hs_platform_data = {
1034 .hs_name = "7k_handset",
1035 .pwr_key_delay_ms = 500, /* 0 will disable end key */
1036};
1037
1038static struct platform_device hs_pdev = {
1039 .name = "msm-handset",
1040 .id = -1,
1041 .dev = {
1042 .platform_data = &hs_platform_data,
1043 },
1044};
1045
Justin Pauporeb3a33b72011-08-23 15:30:32 -07001046static struct platform_device msm_proccomm_regulator_dev = {
1047 .name = PROCCOMM_REGULATOR_DEV_NAME,
1048 .id = -1,
1049 .dev = {
1050 .platform_data = &msm7x27a_proccomm_regulator_data
1051 }
1052};
1053
Trilok Soni16f61af2011-07-26 16:06:58 +05301054static void __init msm7627a_rumi3_init(void)
1055{
1056 msm7x27a_init_ebi2();
1057 platform_add_devices(rumi_sim_devices,
1058 ARRAY_SIZE(rumi_sim_devices));
1059}
1060
Taniya Das43bcdd62011-12-02 17:33:27 +05301061static void __init msm8625_rumi3_init(void)
1062{
1063 msm7x2x_misc_init();
1064 platform_add_devices(msm8625_rumi3_devices,
1065 ARRAY_SIZE(msm8625_rumi3_devices));
1066}
1067
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001068#define LED_GPIO_PDM 96
1069#define UART1DM_RX_GPIO 45
Santosh Sajjanb479f0f2011-08-18 21:00:44 +05301070
1071#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
1072static int __init msm7x27a_init_ar6000pm(void)
1073{
1074 return platform_device_register(&msm_wlan_ar6000_pm_device);
1075}
1076#else
1077static int __init msm7x27a_init_ar6000pm(void) { return 0; }
1078#endif
1079
Justin Pauporeb3a33b72011-08-23 15:30:32 -07001080static void __init msm7x27a_init_regulators(void)
1081{
1082 int rc = platform_device_register(&msm_proccomm_regulator_dev);
1083 if (rc)
1084 pr_err("%s: could not register regulator device: %d\n",
1085 __func__, rc);
1086}
1087
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001088static void __init msm7x2x_init(void)
1089{
Trilok Sonia416c492011-07-22 20:20:23 +05301090 msm7x2x_misc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001091
Justin Pauporeb3a33b72011-08-23 15:30:32 -07001092 /* Initialize regulators first so that other devices can use them */
1093 msm7x27a_init_regulators();
1094
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001095 /* Common functions for SURF/FFA/RUMI3 */
1096 msm_device_i2c_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001097 msm7x27a_init_ebi2();
1098 msm7x27a_cfg_uart2dm_serial();
1099#ifdef CONFIG_SERIAL_MSM_HS
1100 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
1101 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
1102#endif
1103
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001104#ifdef CONFIG_USB_MSM_OTG_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05301105 msm_otg_pdata.swfi_latency =
1106 msm7x27a_pm_data
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001107 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Trilok Soni16f61af2011-07-26 16:06:58 +05301108 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001109#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05301110 msm_device_gadget_peripheral.dev.platform_data =
1111 &msm_gadget_pdata;
1112 msm7x27a_cfg_smsc911x();
1113 platform_add_devices(msm_footswitch_devices,
1114 msm_num_footswitch_devices);
1115 platform_add_devices(surf_ffa_devices,
1116 ARRAY_SIZE(surf_ffa_devices));
Sujith Reddy Thummaad7c9a82011-09-30 20:54:38 +05301117 /* Ensure ar6000pm device is registered before MMC/SDC */
1118 msm7x27a_init_ar6000pm();
1119#ifdef CONFIG_MMC_MSM
Chintan Pandyacf467fc2011-12-01 17:11:11 +05301120 msm7627a_init_mmc();
Sujith Reddy Thummaad7c9a82011-09-30 20:54:38 +05301121#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05301122 msm_fb_add_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001123#ifdef CONFIG_USB_EHCI_MSM_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05301124 msm7x2x_init_host();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001125#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001126
1127 msm_pm_set_platform_data(msm7x27a_pm_data,
1128 ARRAY_SIZE(msm7x27a_pm_data));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001129 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001130
1131#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
1132 register_i2c_devices();
1133#endif
1134#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +05301135 msm7627a_bt_power_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001136#endif
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301137 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001138 atmel_ts_pdata.min_x = 0;
1139 atmel_ts_pdata.max_x = 480;
1140 atmel_ts_pdata.min_y = 0;
1141 atmel_ts_pdata.max_y = 320;
1142 }
1143
1144 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
1145 atmel_ts_i2c_info,
1146 ARRAY_SIZE(atmel_ts_i2c_info));
1147
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05301148#if defined(CONFIG_MSM_CAMERA)
Chintan Pandya40762702011-12-06 13:47:06 +05301149 msm7627a_camera_init();
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05301150#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001151 platform_device_register(&kp_pdev);
1152 platform_device_register(&hs_pdev);
1153
1154 /* configure it as a pdm function*/
1155 if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3,
1156 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
1157 GPIO_CFG_8MA), GPIO_CFG_ENABLE))
1158 pr_err("%s: gpio_tlmm_config for %d failed\n",
1159 __func__, LED_GPIO_PDM);
1160 else
1161 platform_device_register(&led_pdev);
1162
1163#ifdef CONFIG_MSM_RPC_VIBRATOR
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301164 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001165 msm_init_pmic_vibrator();
1166#endif
1167 /*7x25a kgsl initializations*/
1168 msm7x25a_kgsl_3d0_init();
1169}
1170
1171static void __init msm7x2x_init_early(void)
1172{
Chintan Pandya250c2e52012-01-19 17:15:49 +05301173 msm_msm7627a_allocate_memory_regions();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001174}
1175
1176MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3")
1177 .boot_params = PHYS_OFFSET + 0x100,
1178 .map_io = msm_common_io_init,
1179 .reserve = msm7x27a_reserve,
1180 .init_irq = msm_init_irq,
Trilok Soni16f61af2011-07-26 16:06:58 +05301181 .init_machine = msm7627a_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001182 .timer = &msm_timer,
1183 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301184 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001185MACHINE_END
1186MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF")
1187 .boot_params = PHYS_OFFSET + 0x100,
1188 .map_io = msm_common_io_init,
1189 .reserve = msm7x27a_reserve,
1190 .init_irq = msm_init_irq,
1191 .init_machine = msm7x2x_init,
1192 .timer = &msm_timer,
1193 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301194 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001195MACHINE_END
1196MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA")
1197 .boot_params = PHYS_OFFSET + 0x100,
1198 .map_io = msm_common_io_init,
1199 .reserve = msm7x27a_reserve,
1200 .init_irq = msm_init_irq,
1201 .init_machine = msm7x2x_init,
1202 .timer = &msm_timer,
1203 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301204 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001205MACHINE_END
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301206MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF")
1207 .boot_params = PHYS_OFFSET + 0x100,
1208 .map_io = msm_common_io_init,
1209 .reserve = msm7x27a_reserve,
1210 .init_irq = msm_init_irq,
1211 .init_machine = msm7x2x_init,
1212 .timer = &msm_timer,
1213 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301214 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301215MACHINE_END
1216MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA")
1217 .boot_params = PHYS_OFFSET + 0x100,
1218 .map_io = msm_common_io_init,
1219 .reserve = msm7x27a_reserve,
1220 .init_irq = msm_init_irq,
1221 .init_machine = msm7x2x_init,
1222 .timer = &msm_timer,
1223 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301224 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301225MACHINE_END
Taniya Das43bcdd62011-12-02 17:33:27 +05301226MACHINE_START(MSM8625_RUMI3, "QCT MSM8625 RUMI3")
1227 .boot_params = PHYS_OFFSET + 0x100,
1228 .map_io = msm8625_map_io,
1229 .init_irq = msm8625_init_irq,
1230 .init_machine = msm8625_rumi3_init,
1231 .timer = &msm_timer,
1232 .handle_irq = gic_handle_irq,
1233MACHINE_END