blob: 219bc5d373f8ea16301bc5eb21dc43e765daf541 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12#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>
17#include <mach/board.h>
18#include <mach/msm_iomap.h>
19#include <mach/msm_hsusb.h>
20#include <mach/rpc_hsusb.h>
21#include <mach/rpc_pmapp.h>
22#include <mach/usbdiag.h>
23#include <mach/msm_memtypes.h>
24#include <mach/msm_serial_hs.h>
25#include <linux/usb/android.h>
26#include <linux/platform_device.h>
27#include <linux/io.h>
28#include <linux/gpio.h>
29#include <mach/vreg.h>
30#include <mach/pmic.h>
31#include <mach/socinfo.h>
32#include <linux/mtd/nand.h>
33#include <linux/mtd/partitions.h>
34#include <asm/mach/mmc.h>
35#include <linux/i2c.h>
36#include <linux/i2c/sx150x.h>
37#include <linux/gpio.h>
38#include <linux/android_pmem.h>
39#include <linux/bootmem.h>
40#include <linux/mfd/marimba.h>
41#include <mach/vreg.h>
42#include <linux/power_supply.h>
Justin Paupored98328e2011-08-19 13:48:31 -070043#include <linux/regulator/consumer.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070044#include <mach/rpc_pmapp.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include <mach/msm_battery.h>
46#include <linux/smsc911x.h>
47#include <linux/atmel_maxtouch.h>
48#include "devices.h"
49#include "timer.h"
Justin Pauporeb3a33b72011-08-23 15:30:32 -070050#include "board-msm7x27a-regulator.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include "devices-msm7x2xa.h"
52#include "pm.h"
53#include <mach/rpc_server_handset.h>
54#include <mach/socinfo.h>
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060055#include "pm-boot.h"
Chintan Pandyacf467fc2011-12-01 17:11:11 +053056#include "board-msm7627a.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057
58#define PMEM_KERNEL_EBI1_SIZE 0x3A000
59#define MSM_PMEM_AUDIO_SIZE 0x5B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070060
61enum {
62 GPIO_EXPANDER_IRQ_BASE = NR_MSM_IRQS + NR_GPIO_IRQS,
63 GPIO_EXPANDER_GPIO_BASE = NR_MSM_GPIOS,
64 /* SURF expander */
65 GPIO_CORE_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
66 GPIO_BT_SYS_REST_EN = GPIO_CORE_EXPANDER_BASE,
67 GPIO_WLAN_EXT_POR_N,
68 GPIO_DISPLAY_PWR_EN,
69 GPIO_BACKLIGHT_EN,
70 GPIO_PRESSURE_XCLR,
71 GPIO_VREG_S3_EXP,
72 GPIO_UBM2M_PWRDWN,
73 GPIO_ETM_MODE_CS_N,
74 GPIO_HOST_VBUS_EN,
75 GPIO_SPI_MOSI,
76 GPIO_SPI_MISO,
77 GPIO_SPI_CLK,
78 GPIO_SPI_CS0_N,
79 GPIO_CORE_EXPANDER_IO13,
80 GPIO_CORE_EXPANDER_IO14,
81 GPIO_CORE_EXPANDER_IO15,
82 /* Camera expander */
83 GPIO_CAM_EXPANDER_BASE = GPIO_CORE_EXPANDER_BASE + 16,
84 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
85 GPIO_CAM_GP_AFBUSY,
86 GPIO_CAM_GP_CAM_PWDN,
87 GPIO_CAM_GP_CAM1MP_XCLR,
88 GPIO_CAM_GP_CAMIF_RESET_N,
89 GPIO_CAM_GP_STROBE_CE,
90 GPIO_CAM_GP_LED_EN1,
91 GPIO_CAM_GP_LED_EN2,
92};
93
94#if defined(CONFIG_GPIO_SX150X)
95enum {
96 SX150X_CORE,
97 SX150X_CAM,
98};
99
100static struct sx150x_platform_data sx150x_data[] __initdata = {
101 [SX150X_CORE] = {
102 .gpio_base = GPIO_CORE_EXPANDER_BASE,
103 .oscio_is_gpo = false,
104 .io_pullup_ena = 0,
pankaj kumarc5c01392011-08-12 13:44:05 +0530105 .io_pulldn_ena = 0x02,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700106 .io_open_drain_ena = 0xfef8,
107 .irq_summary = -1,
108 },
109 [SX150X_CAM] = {
110 .gpio_base = GPIO_CAM_EXPANDER_BASE,
111 .oscio_is_gpo = false,
112 .io_pullup_ena = 0,
113 .io_pulldn_ena = 0,
114 .io_open_drain_ena = 0x23,
115 .irq_summary = -1,
116 },
117};
118#endif
119
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700120
Santosh Sajjan6822c682011-07-26 10:49:36 +0530121static struct platform_device msm_wlan_ar6000_pm_device = {
122 .name = "wlan_ar6000_pm_dev",
123 .id = -1,
124};
125
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700126#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
127static struct i2c_board_info core_exp_i2c_info[] __initdata = {
128 {
129 I2C_BOARD_INFO("sx1509q", 0x3e),
130 },
131};
132static struct i2c_board_info cam_exp_i2c_info[] __initdata = {
133 {
134 I2C_BOARD_INFO("sx1508q", 0x22),
135 .platform_data = &sx150x_data[SX150X_CAM],
136 },
137};
138#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700139
140#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
141static void __init register_i2c_devices(void)
142{
143
144 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
145 cam_exp_i2c_info,
146 ARRAY_SIZE(cam_exp_i2c_info));
147
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530148 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700149 sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0;
150
151 core_exp_i2c_info[0].platform_data =
152 &sx150x_data[SX150X_CORE];
153
154 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
155 core_exp_i2c_info,
156 ARRAY_SIZE(core_exp_i2c_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700157}
158#endif
159
160static struct msm_gpio qup_i2c_gpios_io[] = {
161 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
162 "qup_scl" },
163 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
164 "qup_sda" },
165 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
166 "qup_scl" },
167 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
168 "qup_sda" },
169};
170
171static struct msm_gpio qup_i2c_gpios_hw[] = {
172 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
173 "qup_scl" },
174 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
175 "qup_sda" },
176 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
177 "qup_scl" },
178 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
179 "qup_sda" },
180};
181
182static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
183{
184 int rc;
185
186 if (adap_id < 0 || adap_id > 1)
187 return;
188
189 /* Each adapter gets 2 lines from the table */
190 if (config_type)
191 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
192 else
193 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
194 if (rc < 0)
195 pr_err("QUP GPIO request/enable failed: %d\n", rc);
196}
197
198static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
199 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700200 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
201};
202
203static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
204 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700205 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
206};
207
208#ifdef CONFIG_ARCH_MSM7X27A
Neti Ravi Kumar061726e2011-12-08 15:14:57 +0530209#define MSM_PMEM_MDP_SIZE 0x2300000
210#define MSM7x25A_MSM_PMEM_MDP_SIZE 0x1500000
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530211
Roja Rani Yarubandi09986562011-12-06 18:54:47 +0530212#define MSM_PMEM_ADSP_SIZE 0x1000000
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530213#define MSM7x25A_MSM_PMEM_ADSP_SIZE 0xB91000
214
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700215
216#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530217#define MSM_FB_SIZE 0x260000
218#define MSM7x25A_MSM_FB_SIZE 0xE1000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700219#else
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530220#define MSM_FB_SIZE 0x195000
221#define MSM7x25A_MSM_FB_SIZE 0xE1000
222
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700223#endif
224
225#endif
226
227static struct android_usb_platform_data android_usb_pdata = {
228 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
229};
230
231static struct platform_device android_usb_device = {
232 .name = "android_usb",
233 .id = -1,
234 .dev = {
235 .platform_data = &android_usb_pdata,
236 },
237};
238
239#ifdef CONFIG_USB_EHCI_MSM_72K
240static void msm_hsusb_vbus_power(unsigned phy_info, int on)
241{
242 int rc = 0;
243 unsigned gpio;
244
245 gpio = GPIO_HOST_VBUS_EN;
246
247 rc = gpio_request(gpio, "i2c_host_vbus_en");
248 if (rc < 0) {
249 pr_err("failed to request %d GPIO\n", gpio);
250 return;
251 }
252 gpio_direction_output(gpio, !!on);
253 gpio_set_value_cansleep(gpio, !!on);
254 gpio_free(gpio);
255}
256
257static struct msm_usb_host_platform_data msm_usb_host_pdata = {
258 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
259};
260
261static void __init msm7x2x_init_host(void)
262{
263 msm_add_host(0, &msm_usb_host_pdata);
264}
265#endif
266
267#ifdef CONFIG_USB_MSM_OTG_72K
268static int hsusb_rpc_connect(int connect)
269{
270 if (connect)
271 return msm_hsusb_rpc_connect();
272 else
273 return msm_hsusb_rpc_close();
274}
275
Justin Paupored98328e2011-08-19 13:48:31 -0700276static struct regulator *reg_hsusb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700277static int msm_hsusb_ldo_init(int init)
278{
Justin Paupored98328e2011-08-19 13:48:31 -0700279 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700280
Justin Paupored98328e2011-08-19 13:48:31 -0700281 if (init) {
282 reg_hsusb = regulator_get(NULL, "usb");
283 if (IS_ERR(reg_hsusb)) {
284 rc = PTR_ERR(reg_hsusb);
285 pr_err("%s: could not get regulator: %d\n",
286 __func__, rc);
287 goto out;
288 }
289
290 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
291 if (rc) {
292 pr_err("%s: could not set voltage: %d\n",
293 __func__, rc);
294 goto reg_free;
295 }
296
297 return 0;
298 }
299 /* else fall through */
300reg_free:
301 regulator_put(reg_hsusb);
302out:
303 reg_hsusb = NULL;
304 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700305}
306
307static int msm_hsusb_ldo_enable(int enable)
308{
309 static int ldo_status;
310
Justin Paupored98328e2011-08-19 13:48:31 -0700311 if (IS_ERR_OR_NULL(reg_hsusb))
312 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313
314 if (ldo_status == enable)
315 return 0;
316
317 ldo_status = enable;
318
Justin Paupored98328e2011-08-19 13:48:31 -0700319 return enable ?
320 regulator_enable(reg_hsusb) :
321 regulator_disable(reg_hsusb);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322}
323
324#ifndef CONFIG_USB_EHCI_MSM_72K
325static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
326{
327 int ret = 0;
328
329 if (init)
330 ret = msm_pm_app_rpc_init(callback);
331 else
332 msm_pm_app_rpc_deinit(callback);
333
334 return ret;
335}
336#endif
337
338static struct msm_otg_platform_data msm_otg_pdata = {
339#ifndef CONFIG_USB_EHCI_MSM_72K
340 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
341#else
342 .vbus_power = msm_hsusb_vbus_power,
343#endif
344 .rpc_connect = hsusb_rpc_connect,
345 .core_clk = 1,
346 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
347 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
348 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
349 .se1_gating = SE1_GATING_DISABLE,
350 .ldo_init = msm_hsusb_ldo_init,
351 .ldo_enable = msm_hsusb_ldo_enable,
352 .chg_init = hsusb_chg_init,
353 .chg_connected = hsusb_chg_connected,
354 .chg_vbus_draw = hsusb_chg_vbus_draw,
355};
356#endif
357
358static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
359 .is_phy_status_timer_on = 1,
360};
361
362static struct resource smc91x_resources[] = {
363 [0] = {
364 .start = 0x90000300,
365 .end = 0x900003ff,
366 .flags = IORESOURCE_MEM,
367 },
368 [1] = {
369 .start = MSM_GPIO_TO_INT(4),
370 .end = MSM_GPIO_TO_INT(4),
371 .flags = IORESOURCE_IRQ,
372 },
373};
374
375static struct platform_device smc91x_device = {
376 .name = "smc91x",
377 .id = 0,
378 .num_resources = ARRAY_SIZE(smc91x_resources),
379 .resource = smc91x_resources,
380};
381
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700382#ifdef CONFIG_SERIAL_MSM_HS
383static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
384 .inject_rx_on_wakeup = 1,
385 .rx_to_inject = 0xFD,
386};
387#endif
388static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
389 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
390 .idle_supported = 1,
391 .suspend_supported = 1,
392 .idle_enabled = 1,
393 .suspend_enabled = 1,
394 .latency = 16000,
395 .residency = 20000,
396 },
397 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
398 .idle_supported = 1,
399 .suspend_supported = 1,
400 .idle_enabled = 1,
401 .suspend_enabled = 1,
402 .latency = 12000,
403 .residency = 20000,
404 },
405 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
406 .idle_supported = 1,
407 .suspend_supported = 1,
408 .idle_enabled = 0,
409 .suspend_enabled = 1,
410 .latency = 2000,
411 .residency = 0,
412 },
413 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
414 .idle_supported = 1,
415 .suspend_supported = 1,
416 .idle_enabled = 1,
417 .suspend_enabled = 1,
418 .latency = 2,
419 .residency = 0,
420 },
421};
422
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600423static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
424 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_VIRT,
425 .v_addr = (uint32_t *)PAGE_OFFSET,
426};
427
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700428static struct android_pmem_platform_data android_pmem_adsp_pdata = {
429 .name = "pmem_adsp",
430 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
Mahesh Lankac6af7eb2011-08-02 18:00:35 +0530431 .cached = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700432 .memory_type = MEMTYPE_EBI1,
433};
434
435static struct platform_device android_pmem_adsp_device = {
436 .name = "android_pmem",
437 .id = 1,
438 .dev = { .platform_data = &android_pmem_adsp_pdata },
439};
440
441static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
442static int __init pmem_mdp_size_setup(char *p)
443{
444 pmem_mdp_size = memparse(p, NULL);
445 return 0;
446}
447
448early_param("pmem_mdp_size", pmem_mdp_size_setup);
449
450static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
451static int __init pmem_adsp_size_setup(char *p)
452{
453 pmem_adsp_size = memparse(p, NULL);
454 return 0;
455}
456
457early_param("pmem_adsp_size", pmem_adsp_size_setup);
458
459static unsigned fb_size = MSM_FB_SIZE;
460static int __init fb_size_setup(char *p)
461{
462 fb_size = memparse(p, NULL);
463 return 0;
464}
465
466early_param("fb_size", fb_size_setup);
467
Justin Paupored98328e2011-08-19 13:48:31 -0700468static struct regulator_bulk_data regs_lcdc[] = {
469 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
470 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700471};
472
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700473static uint32_t lcdc_gpio_initialized;
474
475static void lcdc_toshiba_gpio_init(void)
476{
Justin Paupored98328e2011-08-19 13:48:31 -0700477 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700478 if (!lcdc_gpio_initialized) {
479 if (gpio_request(GPIO_SPI_CLK, "spi_clk")) {
480 pr_err("failed to request gpio spi_clk\n");
481 return;
482 }
483 if (gpio_request(GPIO_SPI_CS0_N, "spi_cs")) {
484 pr_err("failed to request gpio spi_cs0_N\n");
485 goto fail_gpio6;
486 }
487 if (gpio_request(GPIO_SPI_MOSI, "spi_mosi")) {
488 pr_err("failed to request gpio spi_mosi\n");
489 goto fail_gpio5;
490 }
491 if (gpio_request(GPIO_SPI_MISO, "spi_miso")) {
492 pr_err("failed to request gpio spi_miso\n");
493 goto fail_gpio4;
494 }
495 if (gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr")) {
496 pr_err("failed to request gpio_disp_pwr\n");
497 goto fail_gpio3;
498 }
499 if (gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en")) {
500 pr_err("failed to request gpio_bkl_en\n");
501 goto fail_gpio2;
502 }
503 pmapp_disp_backlight_init();
504
Justin Paupored98328e2011-08-19 13:48:31 -0700505 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_lcdc), regs_lcdc);
506 if (rc) {
507 pr_err("%s: could not get regulators: %d\n",
508 __func__, rc);
509 goto fail_gpio1;
510 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700511
Justin Paupored98328e2011-08-19 13:48:31 -0700512 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_lcdc),
513 regs_lcdc);
514 if (rc) {
515 pr_err("%s: could not set voltages: %d\n",
516 __func__, rc);
517 goto fail_vreg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700518 }
519 lcdc_gpio_initialized = 1;
520 }
521 return;
Justin Paupored98328e2011-08-19 13:48:31 -0700522fail_vreg:
523 regulator_bulk_free(ARRAY_SIZE(regs_lcdc), regs_lcdc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700524fail_gpio1:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700525 gpio_free(GPIO_BACKLIGHT_EN);
526fail_gpio2:
527 gpio_free(GPIO_DISPLAY_PWR_EN);
528fail_gpio3:
529 gpio_free(GPIO_SPI_MISO);
530fail_gpio4:
531 gpio_free(GPIO_SPI_MOSI);
532fail_gpio5:
533 gpio_free(GPIO_SPI_CS0_N);
534fail_gpio6:
535 gpio_free(GPIO_SPI_CLK);
536 lcdc_gpio_initialized = 0;
537}
538
539static uint32_t lcdc_gpio_table[] = {
540 GPIO_SPI_CLK,
541 GPIO_SPI_CS0_N,
542 GPIO_SPI_MOSI,
543 GPIO_DISPLAY_PWR_EN,
544 GPIO_BACKLIGHT_EN,
545 GPIO_SPI_MISO,
546};
547
548static void config_lcdc_gpio_table(uint32_t *table, int len, unsigned enable)
549{
550 int n;
551
552 if (lcdc_gpio_initialized) {
553 /* All are IO Expander GPIOs */
554 for (n = 0; n < (len - 1); n++)
555 gpio_direction_output(table[n], 1);
556 }
557}
558
559static void lcdc_toshiba_config_gpios(int enable)
560{
561 config_lcdc_gpio_table(lcdc_gpio_table,
562 ARRAY_SIZE(lcdc_gpio_table), enable);
563}
564
565static int msm_fb_lcdc_power_save(int on)
566{
Justin Paupored98328e2011-08-19 13:48:31 -0700567 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568 /* Doing the init of the LCDC GPIOs very late as they are from
569 an I2C-controlled IO Expander */
570 lcdc_toshiba_gpio_init();
571
572 if (lcdc_gpio_initialized) {
573 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
574 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
575
Justin Paupored98328e2011-08-19 13:48:31 -0700576 rc = on ? regulator_bulk_enable(
577 ARRAY_SIZE(regs_lcdc), regs_lcdc) :
578 regulator_bulk_disable(
579 ARRAY_SIZE(regs_lcdc), regs_lcdc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700580
Justin Paupored98328e2011-08-19 13:48:31 -0700581 if (rc)
582 pr_err("%s: could not %sable regulators: %d\n",
583 __func__, on ? "en" : "dis", rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700584 }
585
586 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700587}
588
589
590static int lcdc_toshiba_set_bl(int level)
591{
592 int ret;
593
594 ret = pmapp_disp_backlight_set_brightness(level);
595 if (ret)
596 pr_err("%s: can't set lcd backlight!\n", __func__);
597
598 return ret;
599}
600
601
602static struct lcdc_platform_data lcdc_pdata = {
Jeevan Shriram15f2a5e2011-07-13 21:45:26 +0530603 .lcdc_gpio_config = NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700604 .lcdc_power_save = msm_fb_lcdc_power_save,
605};
606
607static int lcd_panel_spi_gpio_num[] = {
608 GPIO_SPI_MOSI, /* spi_sdi */
609 GPIO_SPI_MISO, /* spi_sdoi */
610 GPIO_SPI_CLK, /* spi_clk */
611 GPIO_SPI_CS0_N, /* spi_cs */
612};
613
614static struct msm_panel_common_pdata lcdc_toshiba_panel_data = {
615 .panel_config_gpio = lcdc_toshiba_config_gpios,
616 .pmic_backlight = lcdc_toshiba_set_bl,
617 .gpio_num = lcd_panel_spi_gpio_num,
618};
619
620static struct platform_device lcdc_toshiba_panel_device = {
621 .name = "lcdc_toshiba_fwvga_pt",
622 .id = 0,
623 .dev = {
624 .platform_data = &lcdc_toshiba_panel_data,
625 }
626};
627
628static struct resource msm_fb_resources[] = {
629 {
630 .flags = IORESOURCE_DMA,
631 }
632};
633
Ajay Singh Parmareede70e2011-08-24 17:36:08 +0530634#define PANEL_NAME_MAX_LEN 30
635#define LCDC_TOSHIBA_FWVGA_PANEL_NAME "lcdc_toshiba_fwvga_pt"
636#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
637
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700638static int msm_fb_detect_panel(const char *name)
639{
Taniya Das0a5303a2011-08-23 18:47:48 +0530640 int ret = -ENODEV;
641
642 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
643 if (!strncmp(name, "lcdc_toshiba_fwvga_pt", 21) ||
644 !strncmp(name, "mipi_cmd_renesas_fwvga", 22))
645 ret = 0;
Jeevan Shriram29c9e952011-10-27 11:22:46 +0530646 } else if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) {
Taniya Das0a5303a2011-08-23 18:47:48 +0530647 if (!strncmp(name, "mipi_cmd_renesas_fwvga", 22))
648 ret = 0;
649 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700650
Ajay Singh Parmareede70e2011-08-24 17:36:08 +0530651#if !defined(CONFIG_FB_MSM_LCDC_AUTO_DETECT) && \
652 !defined(CONFIG_FB_MSM_MIPI_PANEL_AUTO_DETECT) && \
653 !defined(CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT)
654 if (machine_is_msm7x27a_surf() ||
655 machine_is_msm7625a_surf()) {
656 if (!strncmp(name, LCDC_TOSHIBA_FWVGA_PANEL_NAME,
657 strnlen(LCDC_TOSHIBA_FWVGA_PANEL_NAME,
658 PANEL_NAME_MAX_LEN)))
659 return 0;
660 }
661#endif
Taniya Das0a5303a2011-08-23 18:47:48 +0530662 return ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700663}
664
665static struct msm_fb_platform_data msm_fb_pdata = {
666 .detect_client = msm_fb_detect_panel,
667};
668
669static struct platform_device msm_fb_device = {
670 .name = "msm_fb",
671 .id = 0,
672 .num_resources = ARRAY_SIZE(msm_fb_resources),
673 .resource = msm_fb_resources,
674 .dev = {
675 .platform_data = &msm_fb_pdata,
676 }
677};
678
679#ifdef CONFIG_FB_MSM_MIPI_DSI
680static int mipi_renesas_set_bl(int level)
681{
682 int ret;
683
684 ret = pmapp_disp_backlight_set_brightness(level);
685
686 if (ret)
687 pr_err("%s: can't set lcd backlight!\n", __func__);
688
689 return ret;
690}
691
692static struct msm_panel_common_pdata mipi_renesas_pdata = {
693 .pmic_backlight = mipi_renesas_set_bl,
694};
695
696
697static struct platform_device mipi_dsi_renesas_panel_device = {
698 .name = "mipi_renesas",
699 .id = 0,
700 .dev = {
701 .platform_data = &mipi_renesas_pdata,
702 }
703};
704#endif
705
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700706#define SND(desc, num) { .name = #desc, .id = num }
707static struct snd_endpoint snd_endpoints_list[] = {
708 SND(HANDSET, 0),
709 SND(MONO_HEADSET, 2),
710 SND(HEADSET, 3),
711 SND(SPEAKER, 6),
712 SND(TTY_HEADSET, 8),
713 SND(TTY_VCO, 9),
714 SND(TTY_HCO, 10),
715 SND(BT, 12),
716 SND(IN_S_SADC_OUT_HANDSET, 16),
717 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
718 SND(FM_DIGITAL_STEREO_HEADSET, 26),
719 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
720 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +0530721 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Sidipotu Ashokab34ca42011-07-22 16:34:20 +0530722 SND(CURRENT, 0x7FFFFFFE),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700723 SND(FM_ANALOG_STEREO_HEADSET, 35),
724 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
725};
726#undef SND
727
728static struct msm_snd_endpoints msm_device_snd_endpoints = {
729 .endpoints = snd_endpoints_list,
730 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
731};
732
733static struct platform_device msm_device_snd = {
734 .name = "msm_snd",
735 .id = -1,
736 .dev = {
737 .platform_data = &msm_device_snd_endpoints
738 },
739};
740
741#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
742 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
743 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
744 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
745 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
746 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
747#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
748 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
749 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
750 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
751 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
752 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
753#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
754 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
755 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
756 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
757 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
758 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
759#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
760 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
761 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
762 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
763 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
764 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
765#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
766
767static unsigned int dec_concurrency_table[] = {
768 /* Audio LP */
769 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
770 0, 0, 0,
771
772 /* Concurrency 1 */
773 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
774 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
775 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
776 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
777 (DEC4_FORMAT),
778
779 /* Concurrency 2 */
780 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
781 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
782 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
783 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
784 (DEC4_FORMAT),
785
786 /* Concurrency 3 */
787 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
788 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
789 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
790 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
791 (DEC4_FORMAT),
792
793 /* Concurrency 4 */
794 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
795 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
796 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
797 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
798 (DEC4_FORMAT),
799
800 /* Concurrency 5 */
801 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
802 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
803 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
804 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
805 (DEC4_FORMAT),
806
807 /* Concurrency 6 */
808 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
809 0, 0, 0, 0,
810
811 /* Concurrency 7 */
812 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
813 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
814 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
815 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
816 (DEC4_FORMAT),
817};
818
819#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
820 .module_queueid = queueid, .module_decid = decid, \
821 .nr_codec_support = nr_codec}
822
823static struct msm_adspdec_info dec_info_list[] = {
824 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
825 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
826 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
827 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
828 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
829};
830
831static struct msm_adspdec_database msm_device_adspdec_database = {
832 .num_dec = ARRAY_SIZE(dec_info_list),
833 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
834 ARRAY_SIZE(dec_info_list)),
835 .dec_concurrency_table = dec_concurrency_table,
836 .dec_info_list = dec_info_list,
837};
838
839static struct platform_device msm_device_adspdec = {
840 .name = "msm_adspdec",
841 .id = -1,
842 .dev = {
843 .platform_data = &msm_device_adspdec_database
844 },
845};
846
847static struct android_pmem_platform_data android_pmem_audio_pdata = {
848 .name = "pmem_audio",
849 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
850 .cached = 0,
851 .memory_type = MEMTYPE_EBI1,
852};
853
854static struct platform_device android_pmem_audio_device = {
855 .name = "android_pmem",
856 .id = 2,
857 .dev = { .platform_data = &android_pmem_audio_pdata },
858};
859
860static struct android_pmem_platform_data android_pmem_pdata = {
861 .name = "pmem",
862 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
863 .cached = 1,
864 .memory_type = MEMTYPE_EBI1,
865};
866static struct platform_device android_pmem_device = {
867 .name = "android_pmem",
868 .id = 0,
869 .dev = { .platform_data = &android_pmem_pdata },
870};
871
872static u32 msm_calculate_batt_capacity(u32 current_voltage);
873
874static struct msm_psy_batt_pdata msm_psy_batt_data = {
875 .voltage_min_design = 2800,
876 .voltage_max_design = 4300,
877 .avail_chg_sources = AC_CHG | USB_CHG ,
878 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
879 .calculate_capacity = &msm_calculate_batt_capacity,
880};
881
882static u32 msm_calculate_batt_capacity(u32 current_voltage)
883{
884 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
885 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
886
887 return (current_voltage - low_voltage) * 100
888 / (high_voltage - low_voltage);
889}
890
891static struct platform_device msm_batt_device = {
892 .name = "msm-battery",
893 .id = -1,
894 .dev.platform_data = &msm_psy_batt_data,
895};
896
897static struct smsc911x_platform_config smsc911x_config = {
898 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
899 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
900 .flags = SMSC911X_USE_16BIT,
901};
902
903static struct resource smsc911x_resources[] = {
904 [0] = {
905 .start = 0x90000000,
906 .end = 0x90007fff,
907 .flags = IORESOURCE_MEM,
908 },
909 [1] = {
910 .start = MSM_GPIO_TO_INT(48),
911 .end = MSM_GPIO_TO_INT(48),
912 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
913 },
914};
915
916static struct platform_device smsc911x_device = {
917 .name = "smsc911x",
918 .id = 0,
919 .num_resources = ARRAY_SIZE(smsc911x_resources),
920 .resource = smsc911x_resources,
921 .dev = {
922 .platform_data = &smsc911x_config,
923 },
924};
925
926static struct msm_gpio smsc911x_gpios[] = {
927 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
928 "smsc911x_irq" },
929 { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
930 "eth_fifo_sel" },
931};
932
933#define ETH_FIFO_SEL_GPIO 49
934static void msm7x27a_cfg_smsc911x(void)
935{
936 int res;
937
938 res = msm_gpios_request_enable(smsc911x_gpios,
939 ARRAY_SIZE(smsc911x_gpios));
940 if (res) {
941 pr_err("%s: unable to enable gpios for SMSC911x\n", __func__);
942 return;
943 }
944
945 /* ETH_FIFO_SEL */
946 res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0);
947 if (res) {
948 pr_err("%s: unable to get direction for gpio %d\n", __func__,
949 ETH_FIFO_SEL_GPIO);
950 msm_gpios_disable_free(smsc911x_gpios,
951 ARRAY_SIZE(smsc911x_gpios));
952 return;
953 }
954 gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
955}
956
957#ifdef CONFIG_MSM_CAMERA
958static uint32_t camera_off_gpio_table[] = {
959 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
960};
961
962static uint32_t camera_on_gpio_table[] = {
963 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
964};
965
966#ifdef CONFIG_MSM_CAMERA_FLASH
967static struct msm_camera_sensor_flash_src msm_flash_src = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530968 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
969 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
970 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700971};
972#endif
973
Justin Paupored98328e2011-08-19 13:48:31 -0700974static struct regulator_bulk_data regs_camera[] = {
975 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
976 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
977 { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
978};
979
980static void __init msm_camera_vreg_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700981{
982 int rc;
983
Justin Paupored98328e2011-08-19 13:48:31 -0700984 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700985
Justin Paupored98328e2011-08-19 13:48:31 -0700986 if (rc) {
987 pr_err("%s: could not get regulators: %d\n", __func__, rc);
988 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700989 }
990
Justin Paupored98328e2011-08-19 13:48:31 -0700991 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700992
Justin Paupored98328e2011-08-19 13:48:31 -0700993 if (rc) {
994 pr_err("%s: could not set voltages: %d\n", __func__, rc);
995 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700996 }
Justin Paupored98328e2011-08-19 13:48:31 -0700997}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700998
Justin Paupored98328e2011-08-19 13:48:31 -0700999static void msm_camera_vreg_config(int vreg_en)
1000{
1001 int rc = vreg_en ?
1002 regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
1003 regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004
Justin Paupored98328e2011-08-19 13:48:31 -07001005 if (rc)
1006 pr_err("%s: could not %sable regulators: %d\n",
1007 __func__, vreg_en ? "en" : "dis", rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001008}
1009
1010static int config_gpio_table(uint32_t *table, int len)
1011{
1012 int rc = 0, i = 0;
1013
1014 for (i = 0; i < len; i++) {
1015 rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
1016 if (rc) {
1017 pr_err("%s not able to get gpio\n", __func__);
1018 for (i--; i >= 0; i--)
1019 gpio_tlmm_config(camera_off_gpio_table[i],
1020 GPIO_CFG_ENABLE);
1021 break;
1022 }
1023 }
1024 return rc;
1025}
1026
1027static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data;
1028static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data;
1029static int config_camera_on_gpios_rear(void)
1030{
1031 int rc = 0;
1032
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301033 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001034 msm_camera_vreg_config(1);
1035
1036 rc = config_gpio_table(camera_on_gpio_table,
1037 ARRAY_SIZE(camera_on_gpio_table));
1038 if (rc < 0) {
1039 pr_err("%s: CAMSENSOR gpio table request"
1040 "failed\n", __func__);
1041 return rc;
1042 }
1043
1044 return rc;
1045}
1046
1047static void config_camera_off_gpios_rear(void)
1048{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301049 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001050 msm_camera_vreg_config(0);
1051
1052 config_gpio_table(camera_off_gpio_table,
1053 ARRAY_SIZE(camera_off_gpio_table));
1054}
1055
1056static int config_camera_on_gpios_front(void)
1057{
1058 int rc = 0;
1059
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301060 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001061 msm_camera_vreg_config(1);
1062
1063 rc = config_gpio_table(camera_on_gpio_table,
1064 ARRAY_SIZE(camera_on_gpio_table));
1065 if (rc < 0) {
1066 pr_err("%s: CAMSENSOR gpio table request"
1067 "failed\n", __func__);
1068 return rc;
1069 }
1070
1071 return rc;
1072}
1073
1074static void config_camera_off_gpios_front(void)
1075{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301076 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001077 msm_camera_vreg_config(0);
1078
1079 config_gpio_table(camera_off_gpio_table,
1080 ARRAY_SIZE(camera_off_gpio_table));
1081}
1082
1083struct msm_camera_device_platform_data msm_camera_device_data_rear = {
1084 .camera_gpio_on = config_camera_on_gpios_rear,
1085 .camera_gpio_off = config_camera_off_gpios_rear,
1086 .ioext.csiphy = 0xA1000000,
1087 .ioext.csisz = 0x00100000,
1088 .ioext.csiirq = INT_CSI_IRQ_1,
1089 .ioclk.mclk_clk_rate = 24000000,
1090 .ioclk.vfe_clk_rate = 192000000,
1091 .ioext.appphy = MSM_CLK_CTL_PHYS,
1092 .ioext.appsz = MSM_CLK_CTL_SIZE,
1093};
1094
1095struct msm_camera_device_platform_data msm_camera_device_data_front = {
1096 .camera_gpio_on = config_camera_on_gpios_front,
1097 .camera_gpio_off = config_camera_off_gpios_front,
1098 .ioext.csiphy = 0xA0F00000,
1099 .ioext.csisz = 0x00100000,
1100 .ioext.csiirq = INT_CSI_IRQ_0,
1101 .ioclk.mclk_clk_rate = 24000000,
1102 .ioclk.vfe_clk_rate = 192000000,
1103 .ioext.appphy = MSM_CLK_CTL_PHYS,
1104 .ioext.appsz = MSM_CLK_CTL_SIZE,
1105};
1106
1107#ifdef CONFIG_S5K4E1
1108static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = {
1109 .mount_angle = 90
1110};
1111
1112static struct msm_camera_sensor_flash_data flash_s5k4e1 = {
1113 .flash_type = MSM_CAMERA_FLASH_LED,
1114 .flash_src = &msm_flash_src
1115};
1116
1117static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = {
1118 .sensor_name = "s5k4e1",
1119 .sensor_reset_enable = 1,
1120 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N,
1121 .sensor_pwd = 85,
1122 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
1123 .vcm_enable = 1,
1124 .pdata = &msm_camera_device_data_rear,
1125 .flash_data = &flash_s5k4e1,
1126 .sensor_platform_info = &s5k4e1_sensor_7627a_info,
1127 .csi_if = 1
1128};
1129
1130static struct platform_device msm_camera_sensor_s5k4e1 = {
1131 .name = "msm_camera_s5k4e1",
1132 .dev = {
1133 .platform_data = &msm_camera_sensor_s5k4e1_data,
1134 },
1135};
1136#endif
1137
1138#ifdef CONFIG_IMX072
1139static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = {
1140 .mount_angle = 90
1141};
1142
1143static struct msm_camera_sensor_flash_data flash_imx072 = {
1144 .flash_type = MSM_CAMERA_FLASH_LED,
1145 .flash_src = &msm_flash_src
1146};
1147
1148static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = {
1149 .sensor_name = "imx072",
1150 .sensor_reset_enable = 1,
1151 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/
1152 .sensor_pwd = 85,
1153 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
1154 .vcm_enable = 1,
1155 .pdata = &msm_camera_device_data_rear,
1156 .flash_data = &flash_imx072,
1157 .sensor_platform_info = &imx072_sensor_7627a_info,
1158 .csi_if = 1
1159};
1160
1161static struct platform_device msm_camera_sensor_imx072 = {
1162 .name = "msm_camera_imx072",
1163 .dev = {
1164 .platform_data = &msm_camera_sensor_imx072_data,
1165 },
1166};
1167#endif
1168
1169#ifdef CONFIG_WEBCAM_OV9726
1170static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = {
1171 .mount_angle = 90
1172};
1173
1174static struct msm_camera_sensor_flash_data flash_ov9726 = {
1175 .flash_type = MSM_CAMERA_FLASH_NONE,
1176 .flash_src = &msm_flash_src
1177};
1178
1179static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
1180 .sensor_name = "ov9726",
1181 .sensor_reset_enable = 0,
1182 .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR,
1183 .sensor_pwd = 85,
1184 .vcm_pwd = 1,
1185 .vcm_enable = 0,
1186 .pdata = &msm_camera_device_data_front,
1187 .flash_data = &flash_ov9726,
1188 .sensor_platform_info = &ov9726_sensor_7627a_info,
1189 .csi_if = 1
1190};
1191
1192static struct platform_device msm_camera_sensor_ov9726 = {
1193 .name = "msm_camera_ov9726",
1194 .dev = {
1195 .platform_data = &msm_camera_sensor_ov9726_data,
1196 },
1197};
Justin Paupored98328e2011-08-19 13:48:31 -07001198#else
1199static inline void msm_camera_vreg_init(void) { }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001200#endif
1201
1202#ifdef CONFIG_MT9E013
1203static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = {
1204 .mount_angle = 90
1205};
1206
1207static struct msm_camera_sensor_flash_data flash_mt9e013 = {
1208 .flash_type = MSM_CAMERA_FLASH_LED,
1209 .flash_src = &msm_flash_src
1210};
1211
1212static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
1213 .sensor_name = "mt9e013",
1214 .sensor_reset = 0,
1215 .sensor_reset_enable = 1,
1216 .sensor_pwd = 85,
1217 .vcm_pwd = 1,
1218 .vcm_enable = 0,
1219 .pdata = &msm_camera_device_data_rear,
1220 .flash_data = &flash_mt9e013,
1221 .sensor_platform_info = &mt9e013_sensor_7627a_info,
1222 .csi_if = 1
1223};
1224
1225static struct platform_device msm_camera_sensor_mt9e013 = {
1226 .name = "msm_camera_mt9e013",
1227 .dev = {
1228 .platform_data = &msm_camera_sensor_mt9e013_data,
1229 },
1230};
1231#endif
1232
1233static struct i2c_board_info i2c_camera_devices[] = {
1234 #ifdef CONFIG_S5K4E1
1235 {
1236 I2C_BOARD_INFO("s5k4e1", 0x36),
1237 },
1238 {
1239 I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1),
1240 },
1241 #endif
1242 #ifdef CONFIG_WEBCAM_OV9726
1243 {
1244 I2C_BOARD_INFO("ov9726", 0x10),
1245 },
1246 #endif
1247 #ifdef CONFIG_IMX072
1248 {
1249 I2C_BOARD_INFO("imx072", 0x34),
1250 },
1251 #endif
1252 #ifdef CONFIG_MT9E013
1253 {
1254 I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
1255 },
1256 #endif
1257 {
Nishant Pandit474f2252011-07-23 23:17:56 +05301258 I2C_BOARD_INFO("sc628a", 0x6E),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001259 },
1260};
1261#endif
1262#if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \
1263 && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM)
1264static struct msm_gpio uart2dm_gpios[] = {
1265 {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1266 "uart2dm_rfr_n" },
1267 {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1268 "uart2dm_cts_n" },
1269 {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1270 "uart2dm_rx" },
1271 {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
1272 "uart2dm_tx" },
1273};
1274
1275static void msm7x27a_cfg_uart2dm_serial(void)
1276{
1277 int ret;
1278 ret = msm_gpios_request_enable(uart2dm_gpios,
1279 ARRAY_SIZE(uart2dm_gpios));
1280 if (ret)
1281 pr_err("%s: unable to enable gpios for uart2dm\n", __func__);
1282}
1283#else
1284static void msm7x27a_cfg_uart2dm_serial(void) { }
1285#endif
1286
1287static struct platform_device *rumi_sim_devices[] __initdata = {
1288 &msm_device_dmov,
1289 &msm_device_smd,
1290 &smc91x_device,
1291 &msm_device_uart1,
1292 &msm_device_nand,
1293 &msm_device_uart_dm1,
1294 &msm_gsbi0_qup_i2c_device,
1295 &msm_gsbi1_qup_i2c_device,
1296};
1297
1298static struct platform_device *surf_ffa_devices[] __initdata = {
1299 &msm_device_dmov,
1300 &msm_device_smd,
1301 &msm_device_uart1,
1302 &msm_device_uart_dm1,
1303 &msm_device_uart_dm2,
1304 &msm_device_nand,
1305 &msm_gsbi0_qup_i2c_device,
1306 &msm_gsbi1_qup_i2c_device,
1307 &msm_device_otg,
1308 &msm_device_gadget_peripheral,
1309 &android_usb_device,
1310 &android_pmem_device,
1311 &android_pmem_adsp_device,
1312 &android_pmem_audio_device,
1313 &msm_device_snd,
1314 &msm_device_adspdec,
1315 &msm_fb_device,
1316 &lcdc_toshiba_panel_device,
1317 &msm_batt_device,
1318 &smsc911x_device,
1319#ifdef CONFIG_S5K4E1
1320 &msm_camera_sensor_s5k4e1,
1321#endif
1322#ifdef CONFIG_IMX072
1323 &msm_camera_sensor_imx072,
1324#endif
1325#ifdef CONFIG_WEBCAM_OV9726
1326 &msm_camera_sensor_ov9726,
1327#endif
1328#ifdef CONFIG_MT9E013
1329 &msm_camera_sensor_mt9e013,
1330#endif
1331#ifdef CONFIG_FB_MSM_MIPI_DSI
1332 &mipi_dsi_renesas_panel_device,
1333#endif
1334 &msm_kgsl_3d0,
1335#ifdef CONFIG_BT
1336 &msm_bt_power_device,
1337#endif
Manish Dewangan3a260992011-06-24 18:01:34 +05301338 &asoc_msm_pcm,
1339 &asoc_msm_dai0,
1340 &asoc_msm_dai1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001341};
1342
1343static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
1344static int __init pmem_kernel_ebi1_size_setup(char *p)
1345{
1346 pmem_kernel_ebi1_size = memparse(p, NULL);
1347 return 0;
1348}
1349early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
1350
1351static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
1352static int __init pmem_audio_size_setup(char *p)
1353{
1354 pmem_audio_size = memparse(p, NULL);
1355 return 0;
1356}
1357early_param("pmem_audio_size", pmem_audio_size_setup);
1358
1359static void __init msm_msm7x2x_allocate_memory_regions(void)
1360{
1361 void *addr;
1362 unsigned long size;
1363
Jeevan Shriramf40764e2011-10-31 23:28:26 +05301364 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa())
1365 fb_size = MSM7x25A_MSM_FB_SIZE;
1366 else
1367 fb_size = MSM_FB_SIZE;
1368
1369 size = fb_size;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001370 addr = alloc_bootmem_align(size, 0x1000);
1371 msm_fb_resources[0].start = __pa(addr);
1372 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1373 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1374 size, addr, __pa(addr));
1375}
1376
1377static struct memtype_reserve msm7x27a_reserve_table[] __initdata = {
1378 [MEMTYPE_SMI] = {
1379 },
1380 [MEMTYPE_EBI0] = {
1381 .flags = MEMTYPE_FLAGS_1M_ALIGN,
1382 },
1383 [MEMTYPE_EBI1] = {
1384 .flags = MEMTYPE_FLAGS_1M_ALIGN,
1385 },
1386};
1387
1388static void __init size_pmem_devices(void)
1389{
Jeevan Shriramf40764e2011-10-31 23:28:26 +05301390
1391 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
1392 pmem_mdp_size = MSM7x25A_MSM_PMEM_MDP_SIZE;
1393 pmem_adsp_size = MSM7x25A_MSM_PMEM_ADSP_SIZE;
1394 } else {
1395 pmem_mdp_size = MSM_PMEM_MDP_SIZE;
1396 pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
1397 }
1398
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001399#ifdef CONFIG_ANDROID_PMEM
1400 android_pmem_adsp_pdata.size = pmem_adsp_size;
1401 android_pmem_pdata.size = pmem_mdp_size;
1402 android_pmem_audio_pdata.size = pmem_audio_size;
1403#endif
1404}
1405
1406static void __init reserve_memory_for(struct android_pmem_platform_data *p)
1407{
1408 msm7x27a_reserve_table[p->memory_type].size += p->size;
1409}
1410
1411static void __init reserve_pmem_memory(void)
1412{
1413#ifdef CONFIG_ANDROID_PMEM
1414 reserve_memory_for(&android_pmem_adsp_pdata);
1415 reserve_memory_for(&android_pmem_pdata);
1416 reserve_memory_for(&android_pmem_audio_pdata);
1417 msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
1418#endif
1419}
1420
1421static void __init msm7x27a_calculate_reserve_sizes(void)
1422{
1423 size_pmem_devices();
1424 reserve_pmem_memory();
1425}
1426
1427static int msm7x27a_paddr_to_memtype(unsigned int paddr)
1428{
1429 return MEMTYPE_EBI1;
1430}
1431
1432static struct reserve_info msm7x27a_reserve_info __initdata = {
1433 .memtype_reserve_table = msm7x27a_reserve_table,
1434 .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes,
1435 .paddr_to_memtype = msm7x27a_paddr_to_memtype,
1436};
1437
1438static void __init msm7x27a_reserve(void)
1439{
1440 reserve_info = &msm7x27a_reserve_info;
1441 msm_reserve();
1442}
1443
1444static void __init msm_device_i2c_init(void)
1445{
1446 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
1447 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
1448}
1449
1450static struct msm_panel_common_pdata mdp_pdata = {
1451 .gpio = 97,
1452 .mdp_rev = MDP_REV_303,
1453};
1454
Pankaj Kumarffdaec82011-09-26 12:24:45 +05301455
1456#ifdef CONFIG_FB_MSM
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001457#define GPIO_LCDC_BRDG_PD 128
1458#define GPIO_LCDC_BRDG_RESET_N 129
1459
1460#define LCDC_RESET_PHYS 0x90008014
Pankaj Kumarffdaec82011-09-26 12:24:45 +05301461
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001462static void __iomem *lcdc_reset_ptr;
1463
1464static unsigned mipi_dsi_gpio[] = {
1465 GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
1466 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
1467 GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
1468 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
1469};
1470
1471enum {
1472 DSI_SINGLE_LANE = 1,
1473 DSI_TWO_LANES,
1474};
1475
1476static int msm_fb_get_lane_config(void)
1477{
1478 int rc = DSI_TWO_LANES;
1479
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301480 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001481 rc = DSI_SINGLE_LANE;
1482 pr_info("DSI Single Lane\n");
1483 } else {
1484 pr_info("DSI Two Lanes\n");
1485 }
1486 return rc;
1487}
1488
1489static int msm_fb_dsi_client_reset(void)
1490{
1491 int rc = 0;
1492
1493 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
1494 if (rc < 0) {
1495 pr_err("failed to request lcd brdg reset_n\n");
1496 return rc;
1497 }
1498
1499 rc = gpio_request(GPIO_LCDC_BRDG_PD, "lcdc_brdg_pd");
1500 if (rc < 0) {
1501 pr_err("failed to request lcd brdg pd\n");
1502 return rc;
1503 }
1504
1505 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
1506 if (rc) {
1507 pr_err("Failed to enable LCDC Bridge reset enable\n");
1508 goto gpio_error;
1509 }
1510
1511 rc = gpio_tlmm_config(mipi_dsi_gpio[1], GPIO_CFG_ENABLE);
1512 if (rc) {
1513 pr_err("Failed to enable LCDC Bridge pd enable\n");
1514 goto gpio_error2;
1515 }
1516
1517 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
1518 rc |= gpio_direction_output(GPIO_LCDC_BRDG_PD, 1);
1519 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
1520
1521 if (!rc) {
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301522 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001523 lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS,
1524 sizeof(uint32_t));
1525
1526 if (!lcdc_reset_ptr)
1527 return 0;
1528 }
1529 return rc;
1530 } else {
1531 goto gpio_error;
1532 }
1533
1534gpio_error2:
1535 pr_err("Failed GPIO bridge pd\n");
1536 gpio_free(GPIO_LCDC_BRDG_PD);
1537
1538gpio_error:
1539 pr_err("Failed GPIO bridge reset\n");
1540 gpio_free(GPIO_LCDC_BRDG_RESET_N);
1541 return rc;
1542}
1543
Justin Paupored98328e2011-08-19 13:48:31 -07001544static struct regulator_bulk_data regs_dsi[] = {
1545 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
1546 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001547};
1548
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001549static int dsi_gpio_initialized;
1550
1551static int mipi_dsi_panel_power(int on)
1552{
Justin Paupored98328e2011-08-19 13:48:31 -07001553 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001554 uint32_t lcdc_reset_cfg;
1555
1556 /* I2C-controlled GPIO Expander -init of the GPIOs very late */
Justin Paupored98328e2011-08-19 13:48:31 -07001557 if (unlikely(!dsi_gpio_initialized)) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558 pmapp_disp_backlight_init();
1559
1560 rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr");
1561 if (rc < 0) {
1562 pr_err("failed to request gpio_disp_pwr\n");
1563 return rc;
1564 }
1565
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301566 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001567 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1);
1568 if (rc < 0) {
1569 pr_err("failed to enable display pwr\n");
1570 goto fail_gpio1;
1571 }
1572
1573 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
1574 if (rc < 0) {
1575 pr_err("failed to request gpio_bkl_en\n");
1576 goto fail_gpio1;
1577 }
1578
1579 rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
1580 if (rc < 0) {
1581 pr_err("failed to enable backlight\n");
1582 goto fail_gpio2;
1583 }
1584 }
1585
Justin Paupored98328e2011-08-19 13:48:31 -07001586 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
1587 if (rc) {
1588 pr_err("%s: could not get regulators: %d\n",
1589 __func__, rc);
1590 goto fail_gpio2;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001591 }
Justin Paupored98328e2011-08-19 13:48:31 -07001592
1593 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi);
1594 if (rc) {
1595 pr_err("%s: could not set voltages: %d\n",
1596 __func__, rc);
1597 goto fail_vreg;
1598 }
1599
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001600 dsi_gpio_initialized = 1;
1601 }
1602
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301603 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07001604 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
1605 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301606 } else if (machine_is_msm7x27a_ffa() ||
1607 machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001608 if (on) {
Justin Paupored98328e2011-08-19 13:48:31 -07001609 /* This line drives an active low pin on FFA */
1610 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on);
1611 if (rc < 0)
1612 pr_err("failed to set direction for "
1613 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001614 } else {
Justin Paupored98328e2011-08-19 13:48:31 -07001615 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on);
1616 rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN);
1617 if (rc < 0)
1618 pr_err("failed to set direction for "
1619 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001620 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001621 }
1622
Justin Paupored98328e2011-08-19 13:48:31 -07001623 if (on) {
1624 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
1625
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301626 if (machine_is_msm7x27a_surf() ||
1627 machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07001628 lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr);
1629 rmb();
1630 lcdc_reset_cfg &= ~1;
1631
1632 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
1633 msleep(20);
1634 wmb();
1635 lcdc_reset_cfg |= 1;
1636 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
1637 } else {
1638 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
1639 msleep(20);
1640 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
1641 }
1642
1643 if (pmapp_disp_backlight_set_brightness(100))
1644 pr_err("backlight set brightness failed\n");
1645 } else {
1646 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1);
1647
1648 if (pmapp_disp_backlight_set_brightness(0))
1649 pr_err("backlight set brightness failed\n");
1650 }
1651
1652 rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) :
1653 regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi);
1654
1655 if (rc)
1656 pr_err("%s: could not %sable regulators: %d\n",
1657 __func__, on ? "en" : "dis", rc);
1658
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001659 return rc;
1660
Justin Paupored98328e2011-08-19 13:48:31 -07001661fail_vreg:
1662 regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001663fail_gpio2:
1664 gpio_free(GPIO_BACKLIGHT_EN);
1665fail_gpio1:
1666 gpio_free(GPIO_DISPLAY_PWR_EN);
1667 dsi_gpio_initialized = 0;
1668 return rc;
1669}
Pankaj Kumarffdaec82011-09-26 12:24:45 +05301670#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001671
1672#define MDP_303_VSYNC_GPIO 97
1673
1674#ifdef CONFIG_FB_MSM_MDP303
1675static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1676 .vsync_gpio = MDP_303_VSYNC_GPIO,
1677 .dsi_power_save = mipi_dsi_panel_power,
1678 .dsi_client_reset = msm_fb_dsi_client_reset,
1679 .get_lane_config = msm_fb_get_lane_config,
1680};
1681#endif
1682
1683static void __init msm_fb_add_devices(void)
1684{
1685 msm_fb_register_device("mdp", &mdp_pdata);
1686 msm_fb_register_device("lcdc", &lcdc_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05301687#ifdef CONFIG_FB_MSM_MDP303
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001688 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05301689#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001690}
1691
1692#define MSM_EBI2_PHYS 0xa0d00000
1693#define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030
1694
1695static void __init msm7x27a_init_ebi2(void)
1696{
1697 uint32_t ebi2_cfg;
1698 void __iomem *ebi2_cfg_ptr;
1699
1700 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t));
1701 if (!ebi2_cfg_ptr)
1702 return;
1703
1704 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301705 if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() ||
1706 machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001707 ebi2_cfg |= (1 << 4); /* CS2 */
1708
1709 writel(ebi2_cfg, ebi2_cfg_ptr);
1710 iounmap(ebi2_cfg_ptr);
1711
1712 /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */
1713 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1,
1714 sizeof(uint32_t));
1715 if (!ebi2_cfg_ptr)
1716 return;
1717
1718 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301719 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001720 ebi2_cfg |= (1 << 31);
1721
1722 writel(ebi2_cfg, ebi2_cfg_ptr);
1723 iounmap(ebi2_cfg_ptr);
1724}
1725
1726#define ATMEL_TS_I2C_NAME "maXTouch"
Justin Paupored98328e2011-08-19 13:48:31 -07001727
1728static struct regulator_bulk_data regs_atmel[] = {
1729 { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 },
1730 { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 },
1731};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001732
1733#define ATMEL_TS_GPIO_IRQ 82
1734
1735static int atmel_ts_power_on(bool on)
1736{
Justin Paupored98328e2011-08-19 13:48:31 -07001737 int rc = on ?
1738 regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) :
1739 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001740
Justin Paupored98328e2011-08-19 13:48:31 -07001741 if (rc)
1742 pr_err("%s: could not %sable regulators: %d\n",
1743 __func__, on ? "en" : "dis", rc);
1744 else
1745 msleep(50);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001746
Justin Paupored98328e2011-08-19 13:48:31 -07001747 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001748}
1749
1750static int atmel_ts_platform_init(struct i2c_client *client)
1751{
1752 int rc;
Justin Paupored98328e2011-08-19 13:48:31 -07001753 struct device *dev = &client->dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001754
Justin Paupored98328e2011-08-19 13:48:31 -07001755 rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001756 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07001757 dev_err(dev, "%s: could not get regulators: %d\n",
1758 __func__, rc);
1759 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001760 }
1761
Justin Paupored98328e2011-08-19 13:48:31 -07001762 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001763 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07001764 dev_err(dev, "%s: could not set voltages: %d\n",
1765 __func__, rc);
1766 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001767 }
1768
1769 rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
1770 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
1771 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
1772 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07001773 dev_err(dev, "%s: gpio_tlmm_config for %d failed\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001774 __func__, ATMEL_TS_GPIO_IRQ);
Justin Paupored98328e2011-08-19 13:48:31 -07001775 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001776 }
1777
1778 /* configure touchscreen interrupt gpio */
1779 rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio");
1780 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07001781 dev_err(dev, "%s: unable to request gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001782 __func__, ATMEL_TS_GPIO_IRQ);
1783 goto ts_gpio_tlmm_unconfig;
1784 }
1785
1786 rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ);
1787 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -07001788 dev_err(dev, "%s: unable to set the direction of gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001789 __func__, ATMEL_TS_GPIO_IRQ);
1790 goto free_ts_gpio;
1791 }
1792 return 0;
1793
1794free_ts_gpio:
1795 gpio_free(ATMEL_TS_GPIO_IRQ);
1796ts_gpio_tlmm_unconfig:
1797 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
1798 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
1799 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07001800reg_free:
1801 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
1802out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001803 return rc;
1804}
1805
1806static int atmel_ts_platform_exit(struct i2c_client *client)
1807{
1808 gpio_free(ATMEL_TS_GPIO_IRQ);
1809 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
1810 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
1811 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07001812 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001813 return 0;
1814}
1815
1816static u8 atmel_ts_read_chg(void)
1817{
1818 return gpio_get_value(ATMEL_TS_GPIO_IRQ);
1819}
1820
1821static u8 atmel_ts_valid_interrupt(void)
1822{
1823 return !atmel_ts_read_chg();
1824}
1825
1826#define ATMEL_X_OFFSET 13
1827#define ATMEL_Y_OFFSET 0
1828
Mohan Pallaka4e9a94e2011-11-23 16:34:21 +05301829static struct maxtouch_platform_data atmel_ts_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001830 .numtouch = 4,
1831 .init_platform_hw = atmel_ts_platform_init,
1832 .exit_platform_hw = atmel_ts_platform_exit,
1833 .power_on = atmel_ts_power_on,
1834 .display_res_x = 480,
1835 .display_res_y = 864,
1836 .min_x = ATMEL_X_OFFSET,
1837 .max_x = (505 - ATMEL_X_OFFSET),
1838 .min_y = ATMEL_Y_OFFSET,
1839 .max_y = (863 - ATMEL_Y_OFFSET),
1840 .valid_interrupt = atmel_ts_valid_interrupt,
1841 .read_chg = atmel_ts_read_chg,
1842};
1843
1844static struct i2c_board_info atmel_ts_i2c_info[] __initdata = {
1845 {
1846 I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a),
1847 .platform_data = &atmel_ts_pdata,
1848 .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ),
1849 },
1850};
1851
1852#define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col))
1853
1854static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35};
1855static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40};
1856
1857static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) *
1858 ARRAY_SIZE(kp_row_gpios)] = {
1859 [KP_INDEX(0, 0)] = KEY_7,
1860 [KP_INDEX(0, 1)] = KEY_DOWN,
1861 [KP_INDEX(0, 2)] = KEY_UP,
1862 [KP_INDEX(0, 3)] = KEY_RIGHT,
1863 [KP_INDEX(0, 4)] = KEY_ENTER,
1864
1865 [KP_INDEX(1, 0)] = KEY_LEFT,
1866 [KP_INDEX(1, 1)] = KEY_SEND,
1867 [KP_INDEX(1, 2)] = KEY_1,
1868 [KP_INDEX(1, 3)] = KEY_4,
1869 [KP_INDEX(1, 4)] = KEY_CLEAR,
1870
1871 [KP_INDEX(2, 0)] = KEY_6,
1872 [KP_INDEX(2, 1)] = KEY_5,
1873 [KP_INDEX(2, 2)] = KEY_8,
1874 [KP_INDEX(2, 3)] = KEY_3,
1875 [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR,
1876
1877 [KP_INDEX(3, 0)] = KEY_9,
1878 [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND,
1879 [KP_INDEX(3, 2)] = KEY_0,
1880 [KP_INDEX(3, 3)] = KEY_2,
1881 [KP_INDEX(3, 4)] = KEY_SLEEP,
1882
1883 [KP_INDEX(4, 0)] = KEY_BACK,
1884 [KP_INDEX(4, 1)] = KEY_HOME,
1885 [KP_INDEX(4, 2)] = KEY_MENU,
1886 [KP_INDEX(4, 3)] = KEY_VOLUMEUP,
1887 [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN,
1888};
1889
1890/* SURF keypad platform device information */
1891static struct gpio_event_matrix_info kp_matrix_info = {
1892 .info.func = gpio_event_matrix_func,
1893 .keymap = keymap,
1894 .output_gpios = kp_row_gpios,
1895 .input_gpios = kp_col_gpios,
1896 .noutputs = ARRAY_SIZE(kp_row_gpios),
1897 .ninputs = ARRAY_SIZE(kp_col_gpios),
1898 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
1899 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
1900 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
1901 GPIOKPF_PRINT_UNMAPPED_KEYS,
1902};
1903
1904static struct gpio_event_info *kp_info[] = {
1905 &kp_matrix_info.info
1906};
1907
1908static struct gpio_event_platform_data kp_pdata = {
1909 .name = "7x27a_kp",
1910 .info = kp_info,
1911 .info_count = ARRAY_SIZE(kp_info)
1912};
1913
1914static struct platform_device kp_pdev = {
1915 .name = GPIO_EVENT_DEV_NAME,
1916 .id = -1,
1917 .dev = {
1918 .platform_data = &kp_pdata,
1919 },
1920};
1921
1922static struct msm_handset_platform_data hs_platform_data = {
1923 .hs_name = "7k_handset",
1924 .pwr_key_delay_ms = 500, /* 0 will disable end key */
1925};
1926
1927static struct platform_device hs_pdev = {
1928 .name = "msm-handset",
1929 .id = -1,
1930 .dev = {
1931 .platform_data = &hs_platform_data,
1932 },
1933};
1934
Justin Pauporeb3a33b72011-08-23 15:30:32 -07001935static struct platform_device msm_proccomm_regulator_dev = {
1936 .name = PROCCOMM_REGULATOR_DEV_NAME,
1937 .id = -1,
1938 .dev = {
1939 .platform_data = &msm7x27a_proccomm_regulator_data
1940 }
1941};
1942
Trilok Soni16f61af2011-07-26 16:06:58 +05301943static void __init msm7627a_rumi3_init(void)
1944{
1945 msm7x27a_init_ebi2();
1946 platform_add_devices(rumi_sim_devices,
1947 ARRAY_SIZE(rumi_sim_devices));
1948}
1949
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950#define LED_GPIO_PDM 96
1951#define UART1DM_RX_GPIO 45
Santosh Sajjanb479f0f2011-08-18 21:00:44 +05301952
1953#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
1954static int __init msm7x27a_init_ar6000pm(void)
1955{
1956 return platform_device_register(&msm_wlan_ar6000_pm_device);
1957}
1958#else
1959static int __init msm7x27a_init_ar6000pm(void) { return 0; }
1960#endif
1961
Justin Pauporeb3a33b72011-08-23 15:30:32 -07001962static void __init msm7x27a_init_regulators(void)
1963{
1964 int rc = platform_device_register(&msm_proccomm_regulator_dev);
1965 if (rc)
1966 pr_err("%s: could not register regulator device: %d\n",
1967 __func__, rc);
1968}
1969
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001970static void __init msm7x2x_init(void)
1971{
Trilok Sonia416c492011-07-22 20:20:23 +05301972 msm7x2x_misc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001973
Justin Pauporeb3a33b72011-08-23 15:30:32 -07001974 /* Initialize regulators first so that other devices can use them */
1975 msm7x27a_init_regulators();
1976
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001977 /* Common functions for SURF/FFA/RUMI3 */
1978 msm_device_i2c_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001979 msm7x27a_init_ebi2();
1980 msm7x27a_cfg_uart2dm_serial();
1981#ifdef CONFIG_SERIAL_MSM_HS
1982 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
1983 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
1984#endif
1985
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001986#ifdef CONFIG_USB_MSM_OTG_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05301987 msm_otg_pdata.swfi_latency =
1988 msm7x27a_pm_data
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001989 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Trilok Soni16f61af2011-07-26 16:06:58 +05301990 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001991#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05301992 msm_device_gadget_peripheral.dev.platform_data =
1993 &msm_gadget_pdata;
1994 msm7x27a_cfg_smsc911x();
1995 platform_add_devices(msm_footswitch_devices,
1996 msm_num_footswitch_devices);
1997 platform_add_devices(surf_ffa_devices,
1998 ARRAY_SIZE(surf_ffa_devices));
Sujith Reddy Thummaad7c9a82011-09-30 20:54:38 +05301999 /* Ensure ar6000pm device is registered before MMC/SDC */
2000 msm7x27a_init_ar6000pm();
2001#ifdef CONFIG_MMC_MSM
Chintan Pandyacf467fc2011-12-01 17:11:11 +05302002 msm7627a_init_mmc();
Sujith Reddy Thummaad7c9a82011-09-30 20:54:38 +05302003#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05302004 msm_fb_add_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002005#ifdef CONFIG_USB_EHCI_MSM_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05302006 msm7x2x_init_host();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002007#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002008
2009 msm_pm_set_platform_data(msm7x27a_pm_data,
2010 ARRAY_SIZE(msm7x27a_pm_data));
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06002011 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002012
2013#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
2014 register_i2c_devices();
2015#endif
2016#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +05302017 msm7627a_bt_power_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002018#endif
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302019 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002020 atmel_ts_pdata.min_x = 0;
2021 atmel_ts_pdata.max_x = 480;
2022 atmel_ts_pdata.min_y = 0;
2023 atmel_ts_pdata.max_y = 320;
2024 }
2025
2026 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
2027 atmel_ts_i2c_info,
2028 ARRAY_SIZE(atmel_ts_i2c_info));
2029
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05302030#if defined(CONFIG_MSM_CAMERA)
Justin Paupored98328e2011-08-19 13:48:31 -07002031 msm_camera_vreg_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002032 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
2033 i2c_camera_devices,
2034 ARRAY_SIZE(i2c_camera_devices));
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05302035#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002036 platform_device_register(&kp_pdev);
2037 platform_device_register(&hs_pdev);
2038
2039 /* configure it as a pdm function*/
2040 if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3,
2041 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
2042 GPIO_CFG_8MA), GPIO_CFG_ENABLE))
2043 pr_err("%s: gpio_tlmm_config for %d failed\n",
2044 __func__, LED_GPIO_PDM);
2045 else
2046 platform_device_register(&led_pdev);
2047
2048#ifdef CONFIG_MSM_RPC_VIBRATOR
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302049 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002050 msm_init_pmic_vibrator();
2051#endif
2052 /*7x25a kgsl initializations*/
2053 msm7x25a_kgsl_3d0_init();
2054}
2055
2056static void __init msm7x2x_init_early(void)
2057{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002058 msm_msm7x2x_allocate_memory_regions();
2059}
2060
2061MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3")
2062 .boot_params = PHYS_OFFSET + 0x100,
2063 .map_io = msm_common_io_init,
2064 .reserve = msm7x27a_reserve,
2065 .init_irq = msm_init_irq,
Trilok Soni16f61af2011-07-26 16:06:58 +05302066 .init_machine = msm7627a_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002067 .timer = &msm_timer,
2068 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05302069 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002070MACHINE_END
2071MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF")
2072 .boot_params = PHYS_OFFSET + 0x100,
2073 .map_io = msm_common_io_init,
2074 .reserve = msm7x27a_reserve,
2075 .init_irq = msm_init_irq,
2076 .init_machine = msm7x2x_init,
2077 .timer = &msm_timer,
2078 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05302079 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002080MACHINE_END
2081MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA")
2082 .boot_params = PHYS_OFFSET + 0x100,
2083 .map_io = msm_common_io_init,
2084 .reserve = msm7x27a_reserve,
2085 .init_irq = msm_init_irq,
2086 .init_machine = msm7x2x_init,
2087 .timer = &msm_timer,
2088 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05302089 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002090MACHINE_END
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302091MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF")
2092 .boot_params = PHYS_OFFSET + 0x100,
2093 .map_io = msm_common_io_init,
2094 .reserve = msm7x27a_reserve,
2095 .init_irq = msm_init_irq,
2096 .init_machine = msm7x2x_init,
2097 .timer = &msm_timer,
2098 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05302099 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302100MACHINE_END
2101MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA")
2102 .boot_params = PHYS_OFFSET + 0x100,
2103 .map_io = msm_common_io_init,
2104 .reserve = msm7x27a_reserve,
2105 .init_irq = msm_init_irq,
2106 .init_machine = msm7x2x_init,
2107 .timer = &msm_timer,
2108 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05302109 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302110MACHINE_END