blob: 51bd85686dbf341e96622a56e1720e5852bb9d1f [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>
45
46#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"
53#include "pm.h"
54#include <mach/rpc_server_handset.h>
55#include <mach/socinfo.h>
56
57#define PMEM_KERNEL_EBI1_SIZE 0x3A000
58#define MSM_PMEM_AUDIO_SIZE 0x5B000
59#define BAHAMA_SLAVE_ID_FM_ADDR 0x2A
60#define BAHAMA_SLAVE_ID_QMEMBIST_ADDR 0x7B
Rahul Kashyap181d5552011-07-07 10:39:23 +053061#define BAHAMA_SLAVE_ID_FM_REG 0x02
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070062#define FM_GPIO 83
63
64enum {
65 GPIO_EXPANDER_IRQ_BASE = NR_MSM_IRQS + NR_GPIO_IRQS,
66 GPIO_EXPANDER_GPIO_BASE = NR_MSM_GPIOS,
67 /* SURF expander */
68 GPIO_CORE_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
69 GPIO_BT_SYS_REST_EN = GPIO_CORE_EXPANDER_BASE,
70 GPIO_WLAN_EXT_POR_N,
71 GPIO_DISPLAY_PWR_EN,
72 GPIO_BACKLIGHT_EN,
73 GPIO_PRESSURE_XCLR,
74 GPIO_VREG_S3_EXP,
75 GPIO_UBM2M_PWRDWN,
76 GPIO_ETM_MODE_CS_N,
77 GPIO_HOST_VBUS_EN,
78 GPIO_SPI_MOSI,
79 GPIO_SPI_MISO,
80 GPIO_SPI_CLK,
81 GPIO_SPI_CS0_N,
82 GPIO_CORE_EXPANDER_IO13,
83 GPIO_CORE_EXPANDER_IO14,
84 GPIO_CORE_EXPANDER_IO15,
85 /* Camera expander */
86 GPIO_CAM_EXPANDER_BASE = GPIO_CORE_EXPANDER_BASE + 16,
87 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
88 GPIO_CAM_GP_AFBUSY,
89 GPIO_CAM_GP_CAM_PWDN,
90 GPIO_CAM_GP_CAM1MP_XCLR,
91 GPIO_CAM_GP_CAMIF_RESET_N,
92 GPIO_CAM_GP_STROBE_CE,
93 GPIO_CAM_GP_LED_EN1,
94 GPIO_CAM_GP_LED_EN2,
95};
96
97#if defined(CONFIG_GPIO_SX150X)
98enum {
99 SX150X_CORE,
100 SX150X_CAM,
101};
102
103static struct sx150x_platform_data sx150x_data[] __initdata = {
104 [SX150X_CORE] = {
105 .gpio_base = GPIO_CORE_EXPANDER_BASE,
106 .oscio_is_gpo = false,
107 .io_pullup_ena = 0,
pankaj kumarc5c01392011-08-12 13:44:05 +0530108 .io_pulldn_ena = 0x02,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700109 .io_open_drain_ena = 0xfef8,
110 .irq_summary = -1,
111 },
112 [SX150X_CAM] = {
113 .gpio_base = GPIO_CAM_EXPANDER_BASE,
114 .oscio_is_gpo = false,
115 .io_pullup_ena = 0,
116 .io_pulldn_ena = 0,
117 .io_open_drain_ena = 0x23,
118 .irq_summary = -1,
119 },
120};
121#endif
122
123#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
124
125 /* FM Platform power and shutdown routines */
126#define FPGA_MSM_CNTRL_REG2 0x90008010
Rahul Kashyap6e669462011-07-23 16:42:56 +0530127
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700128static void config_pcm_i2s_mode(int mode)
129{
130 void __iomem *cfg_ptr;
131 u8 reg2;
132
133 cfg_ptr = ioremap_nocache(FPGA_MSM_CNTRL_REG2, sizeof(char));
134
135 if (!cfg_ptr)
136 return;
137 if (mode) {
138 /*enable the pcm mode in FPGA*/
139 reg2 = readb_relaxed(cfg_ptr);
140 if (reg2 == 0) {
141 reg2 = 1;
142 writeb_relaxed(reg2, cfg_ptr);
143 }
144 } else {
145 /*enable i2s mode in FPGA*/
146 reg2 = readb_relaxed(cfg_ptr);
147 if (reg2 == 1) {
148 reg2 = 0;
149 writeb_relaxed(reg2, cfg_ptr);
150 }
151 }
152 iounmap(cfg_ptr);
153}
154
155static unsigned fm_i2s_config_power_on[] = {
156 /*FM_I2S_SD*/
157 GPIO_CFG(68, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
158 /*FM_I2S_WS*/
159 GPIO_CFG(70, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
160 /*FM_I2S_SCK*/
161 GPIO_CFG(71, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
162};
163
164static unsigned fm_i2s_config_power_off[] = {
165 /*FM_I2S_SD*/
166 GPIO_CFG(68, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
167 /*FM_I2S_WS*/
168 GPIO_CFG(70, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
169 /*FM_I2S_SCK*/
170 GPIO_CFG(71, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
171};
172
173static unsigned bt_config_power_on[] = {
174 /*RFR*/
175 GPIO_CFG(43, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
176 /*CTS*/
177 GPIO_CFG(44, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
178 /*RX*/
179 GPIO_CFG(45, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
180 /*TX*/
181 GPIO_CFG(46, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
182};
183static unsigned bt_config_pcm_on[] = {
184 /*PCM_DOUT*/
185 GPIO_CFG(68, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
186 /*PCM_DIN*/
187 GPIO_CFG(69, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
188 /*PCM_SYNC*/
189 GPIO_CFG(70, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
190 /*PCM_CLK*/
191 GPIO_CFG(71, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
192};
193static unsigned bt_config_power_off[] = {
194 /*RFR*/
195 GPIO_CFG(43, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
196 /*CTS*/
197 GPIO_CFG(44, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
198 /*RX*/
199 GPIO_CFG(45, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
200 /*TX*/
201 GPIO_CFG(46, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
202};
203static unsigned bt_config_pcm_off[] = {
204 /*PCM_DOUT*/
205 GPIO_CFG(68, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
206 /*PCM_DIN*/
207 GPIO_CFG(69, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
208 /*PCM_SYNC*/
209 GPIO_CFG(70, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
210 /*PCM_CLK*/
211 GPIO_CFG(71, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
212};
213
214static int config_i2s(int mode)
215{
216 int pin, rc = 0;
217
218 if (mode == FM_I2S_ON) {
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530219 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700220 config_pcm_i2s_mode(0);
221 pr_err("%s mode = FM_I2S_ON", __func__);
222 for (pin = 0; pin < ARRAY_SIZE(fm_i2s_config_power_on);
223 pin++) {
224 rc = gpio_tlmm_config(
225 fm_i2s_config_power_on[pin],
226 GPIO_CFG_ENABLE
227 );
228 if (rc < 0)
229 return rc;
230 }
231 } else if (mode == FM_I2S_OFF) {
232 pr_err("%s mode = FM_I2S_OFF", __func__);
233 for (pin = 0; pin < ARRAY_SIZE(fm_i2s_config_power_off);
234 pin++) {
235 rc = gpio_tlmm_config(
236 fm_i2s_config_power_off[pin],
237 GPIO_CFG_ENABLE
238 );
239 if (rc < 0)
240 return rc;
241 }
242 }
243 return rc;
244}
245static int config_pcm(int mode)
246{
247 int pin, rc = 0;
248
249 if (mode == BT_PCM_ON) {
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530250 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700251 config_pcm_i2s_mode(1);
252 pr_err("%s mode =BT_PCM_ON", __func__);
253 for (pin = 0; pin < ARRAY_SIZE(bt_config_pcm_on);
254 pin++) {
255 rc = gpio_tlmm_config(bt_config_pcm_on[pin],
256 GPIO_CFG_ENABLE);
257 if (rc < 0)
258 return rc;
259 }
260 } else if (mode == BT_PCM_OFF) {
261 pr_err("%s mode =BT_PCM_OFF", __func__);
262 for (pin = 0; pin < ARRAY_SIZE(bt_config_pcm_off);
263 pin++) {
264 rc = gpio_tlmm_config(bt_config_pcm_off[pin],
265 GPIO_CFG_ENABLE);
266 if (rc < 0)
267 return rc;
268 }
269
270 }
271
272 return rc;
273}
274
275static int msm_bahama_setup_pcm_i2s(int mode)
276{
277 int fm_state = 0, bt_state = 0;
278 int rc = 0;
279 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
280
281 fm_state = marimba_get_fm_status(&config);
282 bt_state = marimba_get_bt_status(&config);
283
284 switch (mode) {
285 case BT_PCM_ON:
286 case BT_PCM_OFF:
287 if (!fm_state)
288 rc = config_pcm(mode);
289 break;
290 case FM_I2S_ON:
291 rc = config_i2s(mode);
292 break;
293 case FM_I2S_OFF:
294 if (bt_state)
295 rc = config_pcm(BT_PCM_ON);
296 else
297 rc = config_i2s(mode);
298 break;
299 default:
300 rc = -EIO;
301 pr_err("%s:Unsupported mode", __func__);
302 }
303 return rc;
304}
305
Rahul Kashyap181d5552011-07-07 10:39:23 +0530306static int bt_set_gpio(int on)
307{
308 int rc = 0;
309 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
310
311 if (on) {
312 rc = gpio_direction_output(GPIO_BT_SYS_REST_EN, 1);
313 msleep(100);
314 } else {
315 if (!marimba_get_fm_status(&config) &&
316 !marimba_get_bt_status(&config)) {
317 gpio_set_value_cansleep(GPIO_BT_SYS_REST_EN, 0);
318 rc = gpio_direction_input(GPIO_BT_SYS_REST_EN);
319 msleep(100);
320 }
321 }
322 if (rc)
323 pr_err("%s: BT sys_reset_en GPIO : Error", __func__);
324
325 return rc;
326}
Justin Paupored98328e2011-08-19 13:48:31 -0700327static struct regulator *fm_regulator;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700328static int fm_radio_setup(struct marimba_fm_platform_data *pdata)
329{
330 int rc = 0;
331 const char *id = "FMPW";
332 uint32_t irqcfg;
Rahul Kashyap181d5552011-07-07 10:39:23 +0530333 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
334 u8 value;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700335
336 /* Voting for 1.8V Regulator */
Justin Paupored98328e2011-08-19 13:48:31 -0700337 fm_regulator = regulator_get(NULL, "msme1");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700338 if (IS_ERR(fm_regulator)) {
Justin Paupored98328e2011-08-19 13:48:31 -0700339 rc = PTR_ERR(fm_regulator);
340 pr_err("%s: could not get regulator: %d\n", __func__, rc);
341 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700342 }
343
344 /* Set the voltage level to 1.8V */
Justin Paupored98328e2011-08-19 13:48:31 -0700345 rc = regulator_set_voltage(fm_regulator, 1800000, 1800000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700346 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -0700347 pr_err("%s: could not set voltage: %d\n", __func__, rc);
348 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700349 }
350
351 /* Enabling the 1.8V regulator */
Justin Paupored98328e2011-08-19 13:48:31 -0700352 rc = regulator_enable(fm_regulator);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700353 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -0700354 pr_err("%s: could not enable regulator: %d\n", __func__, rc);
355 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700356 }
357
358 /* Voting for 19.2MHz clock */
359 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
360 PMAPP_CLOCK_VOTE_ON);
361 if (rc < 0) {
362 pr_err("%s: clock vote failed with :(%d)\n",
363 __func__, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700364 goto reg_disable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700365 }
366
Rahul Kashyap181d5552011-07-07 10:39:23 +0530367 rc = bt_set_gpio(1);
368 if (rc) {
369 pr_err("%s: bt_set_gpio = %d", __func__, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700370 goto gpio_deconfig;
Rahul Kashyap181d5552011-07-07 10:39:23 +0530371 }
372 /*re-write FM Slave Id, after reset*/
373 value = BAHAMA_SLAVE_ID_FM_ADDR;
374 rc = marimba_write_bit_mask(&config,
375 BAHAMA_SLAVE_ID_FM_REG, &value, 1, 0xFF);
376 if (rc < 0) {
377 pr_err("%s: FM Slave ID rewrite Failed = %d", __func__, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700378 goto gpio_deconfig;
Rahul Kashyap181d5552011-07-07 10:39:23 +0530379 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700380 /* Configuring the FM GPIO */
381 irqcfg = GPIO_CFG(FM_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
382 GPIO_CFG_2MA);
383
384 rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE);
385 if (rc) {
386 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
387 __func__, irqcfg, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700388 goto gpio_deconfig;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700389 }
390
391 return 0;
392
Justin Paupored98328e2011-08-19 13:48:31 -0700393gpio_deconfig:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700394 pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
395 PMAPP_CLOCK_VOTE_OFF);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530396 bt_set_gpio(0);
Justin Paupored98328e2011-08-19 13:48:31 -0700397reg_disable:
398 regulator_disable(fm_regulator);
399reg_free:
400 regulator_put(fm_regulator);
401 fm_regulator = NULL;
402out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700403 return rc;
404};
405
406static void fm_radio_shutdown(struct marimba_fm_platform_data *pdata)
407{
408 int rc;
409 const char *id = "FMPW";
410
411 /* Releasing the GPIO line used by FM */
412 uint32_t irqcfg = GPIO_CFG(FM_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
413 GPIO_CFG_2MA);
414
415 rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE);
416 if (rc)
417 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
418 __func__, irqcfg, rc);
419
420 /* Releasing the 1.8V Regulator */
Justin Paupored98328e2011-08-19 13:48:31 -0700421 if (!IS_ERR_OR_NULL(fm_regulator)) {
422 rc = regulator_disable(fm_regulator);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700423 if (rc)
Justin Paupored98328e2011-08-19 13:48:31 -0700424 pr_err("%s: could not disable regulator: %d\n",
425 __func__, rc);
426 regulator_put(fm_regulator);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700427 fm_regulator = NULL;
428 }
429
430 /* Voting off the clock */
431 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
432 PMAPP_CLOCK_VOTE_OFF);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700433 if (rc < 0)
434 pr_err("%s: voting off failed with :(%d)\n",
435 __func__, rc);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530436 rc = bt_set_gpio(0);
437 if (rc)
438 pr_err("%s: bt_set_gpio = %d", __func__, rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700439}
440
441static struct marimba_fm_platform_data marimba_fm_pdata = {
442 .fm_setup = fm_radio_setup,
443 .fm_shutdown = fm_radio_shutdown,
444 .irq = MSM_GPIO_TO_INT(FM_GPIO),
445 .vreg_s2 = NULL,
446 .vreg_xo_out = NULL,
447 /* Configuring the FM SoC as I2S Master */
448 .is_fm_soc_i2s_master = true,
449 .config_i2s_gpio = msm_bahama_setup_pcm_i2s,
450};
451
Santosh Sajjan6822c682011-07-26 10:49:36 +0530452static struct platform_device msm_wlan_ar6000_pm_device = {
453 .name = "wlan_ar6000_pm_dev",
454 .id = -1,
455};
456
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700457static struct platform_device msm_bt_power_device = {
458 .name = "bt_power",
459};
Rahul Kashyap6e669462011-07-23 16:42:56 +0530460struct bahama_config_register {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700461 u8 reg;
462 u8 value;
463 u8 mask;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700464};
Rahul Kashyap6e669462011-07-23 16:42:56 +0530465struct bt_vreg_info {
466 const char *name;
467 unsigned int pmapp_id;
468 unsigned int level;
469 unsigned int is_pin_controlled;
Justin Paupored98328e2011-08-19 13:48:31 -0700470 struct regulator *reg;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530471};
472static struct bt_vreg_info bt_vregs[] = {
Justin Paupored98328e2011-08-19 13:48:31 -0700473 {"msme1", 2, 1800000, 0, NULL},
474 {"bt", 21, 2900000, 1, NULL}
Rahul Kashyap6e669462011-07-23 16:42:56 +0530475};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700476
477static int bahama_bt(int on)
478{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700479 int rc = 0;
480 int i;
481
482 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
483
484 struct bahama_variant_register {
485 const size_t size;
486 const struct bahama_config_register *set;
487 };
488
489 const struct bahama_config_register *p;
490
491 u8 version;
492
493 const struct bahama_config_register v10_bt_on[] = {
494 { 0xE9, 0x00, 0xFF },
495 { 0xF4, 0x80, 0xFF },
496 { 0xE4, 0x00, 0xFF },
497 { 0xE5, 0x00, 0x0F },
498#ifdef CONFIG_WLAN
499 { 0xE6, 0x38, 0x7F },
500 { 0xE7, 0x06, 0xFF },
501#endif
502 { 0xE9, 0x21, 0xFF },
503 { 0x01, 0x0C, 0x1F },
504 { 0x01, 0x08, 0x1F },
505 };
506
507 const struct bahama_config_register v20_bt_on_fm_off[] = {
508 { 0x11, 0x0C, 0xFF },
509 { 0x13, 0x01, 0xFF },
510 { 0xF4, 0x80, 0xFF },
511 { 0xF0, 0x00, 0xFF },
512 { 0xE9, 0x00, 0xFF },
513#ifdef CONFIG_WLAN
514 { 0x81, 0x00, 0x7F },
515 { 0x82, 0x00, 0xFF },
516 { 0xE6, 0x38, 0x7F },
517 { 0xE7, 0x06, 0xFF },
518#endif
519 { 0x8E, 0x15, 0xFF },
520 { 0x8F, 0x15, 0xFF },
521 { 0x90, 0x15, 0xFF },
522
523 { 0xE9, 0x21, 0xFF },
524 };
525
526 const struct bahama_config_register v20_bt_on_fm_on[] = {
527 { 0x11, 0x0C, 0xFF },
528 { 0x13, 0x01, 0xFF },
529 { 0xF4, 0x86, 0xFF },
530 { 0xF0, 0x06, 0xFF },
531 { 0xE9, 0x00, 0xFF },
532#ifdef CONFIG_WLAN
533 { 0x81, 0x00, 0x7F },
534 { 0x82, 0x00, 0xFF },
535 { 0xE6, 0x38, 0x7F },
536 { 0xE7, 0x06, 0xFF },
537#endif
538 { 0xE9, 0x21, 0xFF },
539 };
540
541 const struct bahama_config_register v10_bt_off[] = {
542 { 0xE9, 0x00, 0xFF },
543 };
544
545 const struct bahama_config_register v20_bt_off_fm_off[] = {
546 { 0xF4, 0x84, 0xFF },
547 { 0xF0, 0x04, 0xFF },
548 { 0xE9, 0x00, 0xFF }
549 };
550
551 const struct bahama_config_register v20_bt_off_fm_on[] = {
552 { 0xF4, 0x86, 0xFF },
553 { 0xF0, 0x06, 0xFF },
554 { 0xE9, 0x00, 0xFF }
555 };
556 const struct bahama_variant_register bt_bahama[2][3] = {
557 {
558 { ARRAY_SIZE(v10_bt_off), v10_bt_off },
559 { ARRAY_SIZE(v20_bt_off_fm_off), v20_bt_off_fm_off },
560 { ARRAY_SIZE(v20_bt_off_fm_on), v20_bt_off_fm_on }
561 },
562 {
563 { ARRAY_SIZE(v10_bt_on), v10_bt_on },
564 { ARRAY_SIZE(v20_bt_on_fm_off), v20_bt_on_fm_off },
565 { ARRAY_SIZE(v20_bt_on_fm_on), v20_bt_on_fm_on }
566 }
567 };
568
569 u8 offset = 0; /* index into bahama configs */
570 on = on ? 1 : 0;
571 version = marimba_read_bahama_ver(&config);
Rahul Kashyap92497af2011-07-07 12:13:52 +0530572 if ((int)version < 0 || version == BAHAMA_VER_UNSUPPORTED) {
573 dev_err(&msm_bt_power_device.dev, "%s: Bahama \
574 version read Error, version = %d \n",
575 __func__, version);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576 return -EIO;
577 }
578
579 if (version == BAHAMA_VER_2_0) {
580 if (marimba_get_fm_status(&config))
581 offset = 0x01;
582 }
583
584 p = bt_bahama[on][version + offset].set;
585
586 dev_info(&msm_bt_power_device.dev,
587 "%s: found version %d\n", __func__, version);
588
589 for (i = 0; i < bt_bahama[on][version + offset].size; i++) {
590 u8 value = (p+i)->value;
591 rc = marimba_write_bit_mask(&config,
592 (p+i)->reg,
593 &value,
594 sizeof((p+i)->value),
595 (p+i)->mask);
596 if (rc < 0) {
597 dev_err(&msm_bt_power_device.dev,
598 "%s: reg %x write failed: %d\n",
599 __func__, (p+i)->reg, rc);
600 return rc;
601 }
Rahul Kashyap92497af2011-07-07 12:13:52 +0530602 dev_dbg(&msm_bt_power_device.dev,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700603 "%s: reg 0x%02x write value 0x%02x mask 0x%02x\n",
604 __func__, (p+i)->reg,
605 value, (p+i)->mask);
606 value = 0;
607 rc = marimba_read_bit_mask(&config,
608 (p+i)->reg, &value,
609 sizeof((p+i)->value), (p+i)->mask);
610 if (rc < 0)
611 dev_err(&msm_bt_power_device.dev, "%s marimba_read_bit_mask- error",
612 __func__);
Rahul Kashyap92497af2011-07-07 12:13:52 +0530613 dev_dbg(&msm_bt_power_device.dev,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700614 "%s: reg 0x%02x read value 0x%02x mask 0x%02x\n",
615 __func__, (p+i)->reg,
616 value, (p+i)->mask);
617 }
618 /* Update BT Status */
619 if (on)
620 marimba_set_bt_status(&config, true);
621 else
622 marimba_set_bt_status(&config, false);
623 return rc;
624}
625static int bluetooth_switch_regulators(int on)
626{
627 int i, rc = 0;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530628 const char *id = "BTPW";
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700629
Rahul Kashyap6e669462011-07-23 16:42:56 +0530630 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
Justin Paupored98328e2011-08-19 13:48:31 -0700631 if (IS_ERR_OR_NULL(bt_vregs[i].reg)) {
632 rc = bt_vregs[i].reg ?
633 PTR_ERR(bt_vregs[i].reg) :
634 -ENODEV;
635 dev_err(&msm_bt_power_device.dev,
636 "%s: invalid regulator handle for %s: %d\n",
637 __func__, bt_vregs[i].name, rc);
638 goto reg_disable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700639 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700640
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530641 rc = on ? regulator_set_voltage(bt_vregs[i].reg,
642 bt_vregs[i].level, bt_vregs[i].level) : 0;
643 if (rc) {
644 dev_err(&msm_bt_power_device.dev,
645 "%s: could not set voltage for %s: %d\n",
646 __func__, bt_vregs[i].name, rc);
647 goto reg_disable;
648 }
649
650 rc = on ? regulator_enable(bt_vregs[i].reg) : 0;
651 if (rc) {
652 dev_err(&msm_bt_power_device.dev,
653 "%s: could not %sable regulator %s: %d\n",
654 __func__, "en", bt_vregs[i].name, rc);
655 goto reg_disable;
656 }
657
Justin Paupored98328e2011-08-19 13:48:31 -0700658 if (bt_vregs[i].is_pin_controlled) {
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530659 rc = pmapp_vreg_lpm_pincntrl_vote(id,
Rahul Kashyap6e669462011-07-23 16:42:56 +0530660 bt_vregs[i].pmapp_id,
661 PMAPP_CLOCK_ID_D1,
662 on ? PMAPP_CLOCK_VOTE_ON :
Justin Paupored98328e2011-08-19 13:48:31 -0700663 PMAPP_CLOCK_VOTE_OFF);
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530664 if (rc) {
665 dev_err(&msm_bt_power_device.dev,
666 "%s: pin control failed for %s: %d\n",
667 __func__, bt_vregs[i].name, rc);
668 goto pin_cnt_fail;
669 }
Rahul Kashyap6e669462011-07-23 16:42:56 +0530670 }
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530671 rc = on ? 0 : regulator_disable(bt_vregs[i].reg);
Justin Paupored98328e2011-08-19 13:48:31 -0700672
673 if (rc) {
674 dev_err(&msm_bt_power_device.dev,
675 "%s: could not %sable regulator %s: %d\n",
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530676 __func__, "dis", bt_vregs[i].name, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700677 goto reg_disable;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530678 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700679 }
Rahul Kashyap6e669462011-07-23 16:42:56 +0530680
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700681 return rc;
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530682pin_cnt_fail:
683 if (on)
684 regulator_disable(bt_vregs[i].reg);
Justin Paupored98328e2011-08-19 13:48:31 -0700685reg_disable:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530686 while (i) {
687 if (on) {
688 i--;
689 regulator_disable(bt_vregs[i].reg);
690 regulator_put(bt_vregs[i].reg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700691 }
Justin Paupored98328e2011-08-19 13:48:31 -0700692 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700693 return rc;
694}
695
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530696static struct regulator *reg_s3;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700697static unsigned int msm_bahama_setup_power(void)
698{
699 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700700
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530701 reg_s3 = regulator_get(NULL, "msme1");
702 if (IS_ERR(reg_s3)) {
703 rc = PTR_ERR(reg_s3);
Justin Paupored98328e2011-08-19 13:48:31 -0700704 pr_err("%s: could not get regulator: %d\n", __func__, rc);
705 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700706 }
Justin Paupored98328e2011-08-19 13:48:31 -0700707
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530708 rc = regulator_set_voltage(reg_s3, 1800000, 1800000);
Justin Paupored98328e2011-08-19 13:48:31 -0700709 if (rc) {
710 pr_err("%s: could not set voltage: %d\n", __func__, rc);
711 goto reg_fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700712 }
Justin Paupored98328e2011-08-19 13:48:31 -0700713
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530714 rc = regulator_enable(reg_s3);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700715 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -0700716 pr_err("%s: could not enable regulator: %d\n", __func__, rc);
717 goto reg_fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700718 }
719
720 /*setup Bahama_sys_reset_n*/
721 rc = gpio_request(GPIO_BT_SYS_REST_EN, "bahama sys_rst_n");
Justin Paupored98328e2011-08-19 13:48:31 -0700722 if (rc) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700723 pr_err("%s: gpio_request %d = %d\n", __func__,
724 GPIO_BT_SYS_REST_EN, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700725 goto reg_disable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700726 }
Justin Paupored98328e2011-08-19 13:48:31 -0700727
Rahul Kashyap181d5552011-07-07 10:39:23 +0530728 rc = bt_set_gpio(1);
Justin Paupored98328e2011-08-19 13:48:31 -0700729 if (rc) {
Rahul Kashyap181d5552011-07-07 10:39:23 +0530730 pr_err("%s: bt_set_gpio %d = %d\n", __func__,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700731 GPIO_BT_SYS_REST_EN, rc);
732 goto gpio_fail;
733 }
Justin Paupored98328e2011-08-19 13:48:31 -0700734
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700735 return rc;
736
737gpio_fail:
738 gpio_free(GPIO_BT_SYS_REST_EN);
Justin Paupored98328e2011-08-19 13:48:31 -0700739reg_disable:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530740 regulator_disable(reg_s3);
Justin Paupored98328e2011-08-19 13:48:31 -0700741reg_fail:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530742 regulator_put(reg_s3);
Justin Paupored98328e2011-08-19 13:48:31 -0700743out:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530744 reg_s3 = NULL;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700745 return rc;
746}
747
748static unsigned int msm_bahama_shutdown_power(int value)
749{
750 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700751
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530752 if (IS_ERR_OR_NULL(reg_s3)) {
753 rc = reg_s3 ? PTR_ERR(reg_s3) : -ENODEV;
Justin Paupored98328e2011-08-19 13:48:31 -0700754 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700755 }
Justin Paupored98328e2011-08-19 13:48:31 -0700756
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530757 rc = regulator_disable(reg_s3);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700758 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -0700759 pr_err("%s: could not disable regulator: %d\n", __func__, rc);
760 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700761 }
Justin Paupored98328e2011-08-19 13:48:31 -0700762
Rahul Kashyape8698c62011-07-20 20:43:05 +0530763 if (value == BAHAMA_ID) {
764 rc = bt_set_gpio(0);
765 if (rc) {
766 pr_err("%s: bt_set_gpio = %d\n",
767 __func__, rc);
768 }
Justin Paupored98328e2011-08-19 13:48:31 -0700769 gpio_free(GPIO_BT_SYS_REST_EN);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530770 }
Justin Paupored98328e2011-08-19 13:48:31 -0700771
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530772 regulator_put(reg_s3);
773 reg_s3 = NULL;
Justin Paupored98328e2011-08-19 13:48:31 -0700774
775 return 0;
776
Justin Paupored98328e2011-08-19 13:48:31 -0700777out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700778 return rc;
779}
780
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700781static unsigned int msm_bahama_core_config(int type)
782{
783 int rc = 0;
784
785 if (type == BAHAMA_ID) {
786 int i;
Rahul Kashyap181d5552011-07-07 10:39:23 +0530787 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700788 const struct bahama_config_register v20_init[] = {
789 /* reg, value, mask */
790 { 0xF4, 0x84, 0xFF }, /* AREG */
791 { 0xF0, 0x04, 0xFF } /* DREG */
792 };
793 if (marimba_read_bahama_ver(&config) == BAHAMA_VER_2_0) {
794 for (i = 0; i < ARRAY_SIZE(v20_init); i++) {
795 u8 value = v20_init[i].value;
796 rc = marimba_write_bit_mask(&config,
797 v20_init[i].reg,
798 &value,
799 sizeof(v20_init[i].value),
800 v20_init[i].mask);
801 if (rc < 0) {
802 pr_err("%s: reg %d write failed: %d\n",
803 __func__, v20_init[i].reg, rc);
804 return rc;
805 }
806 pr_debug("%s: reg 0x%02x value 0x%02x"
807 " mask 0x%02x\n",
808 __func__, v20_init[i].reg,
809 v20_init[i].value, v20_init[i].mask);
810 }
811 }
812 }
Rahul Kashyap181d5552011-07-07 10:39:23 +0530813 rc = bt_set_gpio(0);
814 if (rc) {
815 pr_err("%s: bt_set_gpio = %d\n",
816 __func__, rc);
817 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700818 pr_debug("core type: %d\n", type);
819 return rc;
820}
821
822static int bluetooth_power(int on)
823{
824 int pin, rc = 0;
825 const char *id = "BTPW";
826 int cid = 0;
827
828 cid = adie_get_detected_connectivity_type();
829 if (cid != BAHAMA_ID) {
830 pr_err("%s: unexpected adie connectivity type: %d\n",
831 __func__, cid);
832 return -ENODEV;
833 }
834 if (on) {
835 /*setup power for BT SOC*/
Rahul Kashyap181d5552011-07-07 10:39:23 +0530836 rc = bt_set_gpio(on);
837 if (rc) {
838 pr_err("%s: bt_set_gpio = %d\n",
839 __func__, rc);
840 goto exit;
841 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700842 rc = bluetooth_switch_regulators(on);
843 if (rc < 0) {
844 pr_err("%s: bluetooth_switch_regulators rc = %d",
845 __func__, rc);
846 goto exit;
847 }
848 /*setup BT GPIO lines*/
849 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_on);
850 pin++) {
851 rc = gpio_tlmm_config(bt_config_power_on[pin],
852 GPIO_CFG_ENABLE);
853 if (rc < 0) {
854 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
855 __func__,
856 bt_config_power_on[pin],
857 rc);
858 goto fail_power;
859 }
860 }
861 /*Setup BT clocks*/
862 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
863 PMAPP_CLOCK_VOTE_ON);
864 if (rc < 0) {
865 pr_err("Failed to vote for TCXO_D1 ON\n");
866 goto fail_clock;
867 }
868 msleep(20);
869
870 /*I2C config for Bahama*/
871 rc = bahama_bt(1);
872 if (rc < 0) {
873 pr_err("%s: bahama_bt rc = %d", __func__, rc);
874 goto fail_i2c;
875 }
876 msleep(20);
877
878 /*setup BT PCM lines*/
879 rc = msm_bahama_setup_pcm_i2s(BT_PCM_ON);
880 if (rc < 0) {
881 pr_err("%s: msm_bahama_setup_pcm_i2s , rc =%d\n",
882 __func__, rc);
883 goto fail_power;
884 }
885 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
886 PMAPP_CLOCK_VOTE_PIN_CTRL);
887 if (rc < 0)
888 pr_err("%s:Pin Control Failed, rc = %d",
889 __func__, rc);
890
891 } else {
892 rc = bahama_bt(0);
893 if (rc < 0)
894 pr_err("%s: bahama_bt rc = %d", __func__, rc);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530895
896 rc = bt_set_gpio(on);
897 if (rc) {
898 pr_err("%s: bt_set_gpio = %d\n",
899 __func__, rc);
900 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700901fail_i2c:
902 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
903 PMAPP_CLOCK_VOTE_OFF);
904 if (rc < 0)
905 pr_err("%s: Failed to vote Off D1\n", __func__);
906fail_clock:
907 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_off);
908 pin++) {
909 rc = gpio_tlmm_config(bt_config_power_off[pin],
910 GPIO_CFG_ENABLE);
911 if (rc < 0) {
912 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
913 __func__, bt_config_power_off[pin], rc);
914 }
915 }
916 rc = msm_bahama_setup_pcm_i2s(BT_PCM_OFF);
917 if (rc < 0) {
918 pr_err("%s: msm_bahama_setup_pcm_i2s, rc =%d\n",
919 __func__, rc);
920 }
921fail_power:
922 rc = bluetooth_switch_regulators(0);
923 if (rc < 0) {
924 pr_err("%s: switch_regulators : rc = %d",\
925 __func__, rc);
926 goto exit;
927 }
928 }
929 return rc;
930exit:
931 pr_err("%s: failed with rc = %d", __func__, rc);
932 return rc;
933}
934
935static int __init bt_power_init(void)
936{
937 int i, rc = 0;
Justin Paupored98328e2011-08-19 13:48:31 -0700938 struct device *dev = &msm_bt_power_device.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700939
Justin Paupored98328e2011-08-19 13:48:31 -0700940 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
941 bt_vregs[i].reg = regulator_get(dev, bt_vregs[i].name);
942 if (IS_ERR(bt_vregs[i].reg)) {
943 rc = PTR_ERR(bt_vregs[i].reg);
944 dev_err(dev, "%s: could not get regulator %s: %d\n",
945 __func__, bt_vregs[i].name, rc);
946 goto reg_get_fail;
947 }
Justin Paupored98328e2011-08-19 13:48:31 -0700948 }
949
950 dev->platform_data = &bluetooth_power;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700951
952 return rc;
953
Justin Paupored98328e2011-08-19 13:48:31 -0700954reg_get_fail:
955 while (i--) {
956 regulator_put(bt_vregs[i].reg);
957 bt_vregs[i].reg = NULL;
958 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700959 return rc;
960}
961
962static struct marimba_platform_data marimba_pdata = {
963 .slave_id[SLAVE_ID_BAHAMA_FM] = BAHAMA_SLAVE_ID_FM_ADDR,
964 .slave_id[SLAVE_ID_BAHAMA_QMEMBIST] = BAHAMA_SLAVE_ID_QMEMBIST_ADDR,
965 .bahama_setup = msm_bahama_setup_power,
966 .bahama_shutdown = msm_bahama_shutdown_power,
967 .bahama_core_config = msm_bahama_core_config,
968 .fm = &marimba_fm_pdata,
969};
970
971#endif
972
973#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
974static struct i2c_board_info core_exp_i2c_info[] __initdata = {
975 {
976 I2C_BOARD_INFO("sx1509q", 0x3e),
977 },
978};
979static struct i2c_board_info cam_exp_i2c_info[] __initdata = {
980 {
981 I2C_BOARD_INFO("sx1508q", 0x22),
982 .platform_data = &sx150x_data[SX150X_CAM],
983 },
984};
985#endif
986#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
987static struct i2c_board_info bahama_devices[] = {
988{
989 I2C_BOARD_INFO("marimba", 0xc),
990 .platform_data = &marimba_pdata,
991},
992};
993#endif
994
995#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
996static void __init register_i2c_devices(void)
997{
998
999 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
1000 cam_exp_i2c_info,
1001 ARRAY_SIZE(cam_exp_i2c_info));
1002
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301003 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004 sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0;
1005
1006 core_exp_i2c_info[0].platform_data =
1007 &sx150x_data[SX150X_CORE];
1008
1009 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
1010 core_exp_i2c_info,
1011 ARRAY_SIZE(core_exp_i2c_info));
1012#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
1013 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
1014 bahama_devices,
1015 ARRAY_SIZE(bahama_devices));
1016#endif
1017}
1018#endif
1019
1020static struct msm_gpio qup_i2c_gpios_io[] = {
1021 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1022 "qup_scl" },
1023 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1024 "qup_sda" },
1025 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1026 "qup_scl" },
1027 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1028 "qup_sda" },
1029};
1030
1031static struct msm_gpio qup_i2c_gpios_hw[] = {
1032 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1033 "qup_scl" },
1034 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1035 "qup_sda" },
1036 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1037 "qup_scl" },
1038 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1039 "qup_sda" },
1040};
1041
1042static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
1043{
1044 int rc;
1045
1046 if (adap_id < 0 || adap_id > 1)
1047 return;
1048
1049 /* Each adapter gets 2 lines from the table */
1050 if (config_type)
1051 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
1052 else
1053 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
1054 if (rc < 0)
1055 pr_err("QUP GPIO request/enable failed: %d\n", rc);
1056}
1057
1058static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
1059 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001060 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1061};
1062
1063static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
1064 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001065 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1066};
1067
1068#ifdef CONFIG_ARCH_MSM7X27A
Prabhanjan Kandula1d920742011-08-19 10:28:11 +05301069#define MSM_PMEM_MDP_SIZE 0x1900000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001070#define MSM_PMEM_ADSP_SIZE 0x1000000
1071
1072#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
1073#define MSM_FB_SIZE 0x260000
1074#else
1075#define MSM_FB_SIZE 0x195000
1076#endif
1077
1078#endif
1079
1080static struct android_usb_platform_data android_usb_pdata = {
1081 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1082};
1083
1084static struct platform_device android_usb_device = {
1085 .name = "android_usb",
1086 .id = -1,
1087 .dev = {
1088 .platform_data = &android_usb_pdata,
1089 },
1090};
1091
1092#ifdef CONFIG_USB_EHCI_MSM_72K
1093static void msm_hsusb_vbus_power(unsigned phy_info, int on)
1094{
1095 int rc = 0;
1096 unsigned gpio;
1097
1098 gpio = GPIO_HOST_VBUS_EN;
1099
1100 rc = gpio_request(gpio, "i2c_host_vbus_en");
1101 if (rc < 0) {
1102 pr_err("failed to request %d GPIO\n", gpio);
1103 return;
1104 }
1105 gpio_direction_output(gpio, !!on);
1106 gpio_set_value_cansleep(gpio, !!on);
1107 gpio_free(gpio);
1108}
1109
1110static struct msm_usb_host_platform_data msm_usb_host_pdata = {
1111 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
1112};
1113
1114static void __init msm7x2x_init_host(void)
1115{
1116 msm_add_host(0, &msm_usb_host_pdata);
1117}
1118#endif
1119
1120#ifdef CONFIG_USB_MSM_OTG_72K
1121static int hsusb_rpc_connect(int connect)
1122{
1123 if (connect)
1124 return msm_hsusb_rpc_connect();
1125 else
1126 return msm_hsusb_rpc_close();
1127}
1128
Justin Paupored98328e2011-08-19 13:48:31 -07001129static struct regulator *reg_hsusb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001130static int msm_hsusb_ldo_init(int init)
1131{
Justin Paupored98328e2011-08-19 13:48:31 -07001132 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001133
Justin Paupored98328e2011-08-19 13:48:31 -07001134 if (init) {
1135 reg_hsusb = regulator_get(NULL, "usb");
1136 if (IS_ERR(reg_hsusb)) {
1137 rc = PTR_ERR(reg_hsusb);
1138 pr_err("%s: could not get regulator: %d\n",
1139 __func__, rc);
1140 goto out;
1141 }
1142
1143 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
1144 if (rc) {
1145 pr_err("%s: could not set voltage: %d\n",
1146 __func__, rc);
1147 goto reg_free;
1148 }
1149
1150 return 0;
1151 }
1152 /* else fall through */
1153reg_free:
1154 regulator_put(reg_hsusb);
1155out:
1156 reg_hsusb = NULL;
1157 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001158}
1159
1160static int msm_hsusb_ldo_enable(int enable)
1161{
1162 static int ldo_status;
1163
Justin Paupored98328e2011-08-19 13:48:31 -07001164 if (IS_ERR_OR_NULL(reg_hsusb))
1165 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001166
1167 if (ldo_status == enable)
1168 return 0;
1169
1170 ldo_status = enable;
1171
Justin Paupored98328e2011-08-19 13:48:31 -07001172 return enable ?
1173 regulator_enable(reg_hsusb) :
1174 regulator_disable(reg_hsusb);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001175}
1176
1177#ifndef CONFIG_USB_EHCI_MSM_72K
1178static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
1179{
1180 int ret = 0;
1181
1182 if (init)
1183 ret = msm_pm_app_rpc_init(callback);
1184 else
1185 msm_pm_app_rpc_deinit(callback);
1186
1187 return ret;
1188}
1189#endif
1190
1191static struct msm_otg_platform_data msm_otg_pdata = {
1192#ifndef CONFIG_USB_EHCI_MSM_72K
1193 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
1194#else
1195 .vbus_power = msm_hsusb_vbus_power,
1196#endif
1197 .rpc_connect = hsusb_rpc_connect,
1198 .core_clk = 1,
1199 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
1200 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
1201 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
1202 .se1_gating = SE1_GATING_DISABLE,
1203 .ldo_init = msm_hsusb_ldo_init,
1204 .ldo_enable = msm_hsusb_ldo_enable,
1205 .chg_init = hsusb_chg_init,
1206 .chg_connected = hsusb_chg_connected,
1207 .chg_vbus_draw = hsusb_chg_vbus_draw,
1208};
1209#endif
1210
1211static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
1212 .is_phy_status_timer_on = 1,
1213};
1214
1215static struct resource smc91x_resources[] = {
1216 [0] = {
1217 .start = 0x90000300,
1218 .end = 0x900003ff,
1219 .flags = IORESOURCE_MEM,
1220 },
1221 [1] = {
1222 .start = MSM_GPIO_TO_INT(4),
1223 .end = MSM_GPIO_TO_INT(4),
1224 .flags = IORESOURCE_IRQ,
1225 },
1226};
1227
1228static struct platform_device smc91x_device = {
1229 .name = "smc91x",
1230 .id = 0,
1231 .num_resources = ARRAY_SIZE(smc91x_resources),
1232 .resource = smc91x_resources,
1233};
1234
1235#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
1236 || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\
1237 || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\
1238 || defined(CONFIG_MMC_MSM_SDC4_SUPPORT))
1239
1240static unsigned long vreg_sts, gpio_sts;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001241
1242struct sdcc_gpio {
1243 struct msm_gpio *cfg_data;
1244 uint32_t size;
1245 struct msm_gpio *sleep_cfg_data;
1246};
1247
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301248/**
1249 * Due to insufficient drive strengths for SDC GPIO lines some old versioned
1250 * SD/MMC cards may cause data CRC errors. Hence, set optimal values
1251 * for SDC slots based on timing closure and marginality. SDC1 slot
1252 * require higher value since it should handle bad signal quality due
1253 * to size of T-flash adapters.
1254 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001255static struct msm_gpio sdc1_cfg_data[] = {
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301256 {GPIO_CFG(51, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001257 "sdc1_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301258 {GPIO_CFG(52, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001259 "sdc1_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301260 {GPIO_CFG(53, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001261 "sdc1_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301262 {GPIO_CFG(54, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001263 "sdc1_dat_0"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301264 {GPIO_CFG(55, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001265 "sdc1_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301266 {GPIO_CFG(56, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001267 "sdc1_clk"},
1268};
1269
1270static struct msm_gpio sdc2_cfg_data[] = {
1271 {GPIO_CFG(62, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1272 "sdc2_clk"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301273 {GPIO_CFG(63, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001274 "sdc2_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301275 {GPIO_CFG(64, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001276 "sdc2_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301277 {GPIO_CFG(65, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001278 "sdc2_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301279 {GPIO_CFG(66, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001280 "sdc2_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301281 {GPIO_CFG(67, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282 "sdc2_dat_0"},
1283};
1284
1285static struct msm_gpio sdc2_sleep_cfg_data[] = {
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301286 {GPIO_CFG(62, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001287 "sdc2_clk"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301288 {GPIO_CFG(63, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001289 "sdc2_cmd"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301290 {GPIO_CFG(64, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001291 "sdc2_dat_3"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301292 {GPIO_CFG(65, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001293 "sdc2_dat_2"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301294 {GPIO_CFG(66, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001295 "sdc2_dat_1"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301296 {GPIO_CFG(67, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001297 "sdc2_dat_0"},
1298};
1299static struct msm_gpio sdc3_cfg_data[] = {
1300 {GPIO_CFG(88, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1301 "sdc3_clk"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301302 {GPIO_CFG(89, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303 "sdc3_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301304 {GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001305 "sdc3_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301306 {GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001307 "sdc3_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301308 {GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001309 "sdc3_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301310 {GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001311 "sdc3_dat_0"},
1312#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301313 {GPIO_CFG(19, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001314 "sdc3_dat_7"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301315 {GPIO_CFG(20, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001316 "sdc3_dat_6"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301317 {GPIO_CFG(21, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001318 "sdc3_dat_5"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301319 {GPIO_CFG(108, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001320 "sdc3_dat_4"},
1321#endif
1322};
1323
1324static struct msm_gpio sdc4_cfg_data[] = {
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301325 {GPIO_CFG(19, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326 "sdc4_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301327 {GPIO_CFG(20, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001328 "sdc4_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301329 {GPIO_CFG(21, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001330 "sdc4_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301331 {GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001332 "sdc4_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301333 {GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001334 "sdc4_dat_0"},
1335 {GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1336 "sdc4_clk"},
1337};
1338
1339static struct sdcc_gpio sdcc_cfg_data[] = {
1340 {
1341 .cfg_data = sdc1_cfg_data,
1342 .size = ARRAY_SIZE(sdc1_cfg_data),
1343 },
1344 {
1345 .cfg_data = sdc2_cfg_data,
1346 .size = ARRAY_SIZE(sdc2_cfg_data),
1347 .sleep_cfg_data = sdc2_sleep_cfg_data,
1348 },
1349 {
1350 .cfg_data = sdc3_cfg_data,
1351 .size = ARRAY_SIZE(sdc3_cfg_data),
1352 },
1353 {
1354 .cfg_data = sdc4_cfg_data,
1355 .size = ARRAY_SIZE(sdc4_cfg_data),
1356 },
1357};
1358
Justin Paupored98328e2011-08-19 13:48:31 -07001359static struct regulator *sdcc_vreg_data[ARRAY_SIZE(sdcc_cfg_data)];
1360
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361static int msm_sdcc_setup_gpio(int dev_id, unsigned int enable)
1362{
1363 int rc = 0;
1364 struct sdcc_gpio *curr;
1365
1366 curr = &sdcc_cfg_data[dev_id - 1];
1367 if (!(test_bit(dev_id, &gpio_sts)^enable))
1368 return rc;
1369
1370 if (enable) {
1371 set_bit(dev_id, &gpio_sts);
1372 rc = msm_gpios_request_enable(curr->cfg_data, curr->size);
1373 if (rc)
1374 pr_err("%s: Failed to turn on GPIOs for slot %d\n",
1375 __func__, dev_id);
1376 } else {
1377 clear_bit(dev_id, &gpio_sts);
1378 if (curr->sleep_cfg_data) {
1379 rc = msm_gpios_enable(curr->sleep_cfg_data, curr->size);
1380 msm_gpios_free(curr->sleep_cfg_data, curr->size);
1381 return rc;
1382 }
1383 msm_gpios_disable_free(curr->cfg_data, curr->size);
1384 }
1385 return rc;
1386}
1387
1388static int msm_sdcc_setup_vreg(int dev_id, unsigned int enable)
1389{
1390 int rc = 0;
Justin Paupored98328e2011-08-19 13:48:31 -07001391 struct regulator *curr = sdcc_vreg_data[dev_id - 1];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001392
Justin Paupored98328e2011-08-19 13:48:31 -07001393 if (test_bit(dev_id, &vreg_sts) == enable)
1394 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001395
Justin Paupored98328e2011-08-19 13:48:31 -07001396 if (!curr)
1397 return -ENODEV;
1398
1399 if (IS_ERR(curr))
1400 return PTR_ERR(curr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001401
1402 if (enable) {
1403 set_bit(dev_id, &vreg_sts);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001404
Justin Paupored98328e2011-08-19 13:48:31 -07001405 rc = regulator_enable(curr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001406 if (rc)
Justin Paupored98328e2011-08-19 13:48:31 -07001407 pr_err("%s: could not enable regulator: %d\n",
1408 __func__, rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001409 } else {
1410 clear_bit(dev_id, &vreg_sts);
Justin Paupored98328e2011-08-19 13:48:31 -07001411
1412 rc = regulator_disable(curr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001413 if (rc)
Justin Paupored98328e2011-08-19 13:48:31 -07001414 pr_err("%s: could not disable regulator: %d\n",
1415 __func__, rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001416 }
1417 return rc;
1418}
1419
1420static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
1421{
1422 int rc = 0;
1423 struct platform_device *pdev;
1424
1425 pdev = container_of(dv, struct platform_device, dev);
1426
1427 rc = msm_sdcc_setup_gpio(pdev->id, !!vdd);
1428 if (rc)
1429 goto out;
1430
1431 rc = msm_sdcc_setup_vreg(pdev->id, !!vdd);
1432out:
1433 return rc;
1434}
1435
1436#define GPIO_SDC1_HW_DET 85
1437
1438#if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) \
1439 && defined(CONFIG_MMC_MSM_CARD_HW_DETECTION)
1440static unsigned int msm7x2xa_sdcc_slot_status(struct device *dev)
1441{
1442 int status;
1443
1444 status = gpio_tlmm_config(GPIO_CFG(GPIO_SDC1_HW_DET, 2, GPIO_CFG_INPUT,
1445 GPIO_CFG_PULL_UP, GPIO_CFG_8MA), GPIO_CFG_ENABLE);
1446 if (status)
1447 pr_err("%s:Failed to configure tlmm for GPIO %d\n", __func__,
1448 GPIO_SDC1_HW_DET);
1449
1450 status = gpio_request(GPIO_SDC1_HW_DET, "SD_HW_Detect");
1451 if (status) {
1452 pr_err("%s:Failed to request GPIO %d\n", __func__,
1453 GPIO_SDC1_HW_DET);
1454 } else {
1455 status = gpio_direction_input(GPIO_SDC1_HW_DET);
1456 if (!status)
1457 status = gpio_get_value(GPIO_SDC1_HW_DET);
1458 gpio_free(GPIO_SDC1_HW_DET);
1459 }
1460 return status;
1461}
1462#endif
1463
1464#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1465static struct mmc_platform_data sdc1_plat_data = {
1466 .ocr_mask = MMC_VDD_28_29,
1467 .translate_vdd = msm_sdcc_setup_power,
1468 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1469 .msmsdcc_fmin = 144000,
1470 .msmsdcc_fmid = 24576000,
1471 .msmsdcc_fmax = 49152000,
1472#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
1473 .status = msm7x2xa_sdcc_slot_status,
1474 .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET),
1475 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
1476#endif
1477};
1478#endif
1479
1480#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1481static struct mmc_platform_data sdc2_plat_data = {
1482 /*
1483 * SDC2 supports only 1.8V, claim for 2.85V range is just
1484 * for allowing buggy cards who advertise 2.8V even though
1485 * they can operate at 1.8V supply.
1486 */
1487 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_165_195,
1488 .translate_vdd = msm_sdcc_setup_power,
1489 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1490#ifdef CONFIG_MMC_MSM_SDIO_SUPPORT
1491 .sdiowakeup_irq = MSM_GPIO_TO_INT(66),
1492#endif
1493 .msmsdcc_fmin = 144000,
1494 .msmsdcc_fmid = 24576000,
1495 .msmsdcc_fmax = 49152000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001496};
1497#endif
1498
1499#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1500static struct mmc_platform_data sdc3_plat_data = {
1501 .ocr_mask = MMC_VDD_28_29,
1502 .translate_vdd = msm_sdcc_setup_power,
1503#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
1504 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
1505#else
1506 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1507#endif
1508 .msmsdcc_fmin = 144000,
1509 .msmsdcc_fmid = 24576000,
1510 .msmsdcc_fmax = 49152000,
1511 .nonremovable = 1,
1512};
1513#endif
1514
1515#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1516 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
1517static struct mmc_platform_data sdc4_plat_data = {
1518 .ocr_mask = MMC_VDD_28_29,
1519 .translate_vdd = msm_sdcc_setup_power,
1520 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1521 .msmsdcc_fmin = 144000,
1522 .msmsdcc_fmid = 24576000,
1523 .msmsdcc_fmax = 49152000,
1524};
1525#endif
Pankaj Kumarb3e55c62011-09-26 11:59:39 +05301526
1527static int __init mmc_regulator_init(int sdcc_no, const char *supply, int uV)
1528{
1529 int rc;
1530
1531 BUG_ON(sdcc_no < 1 || sdcc_no > 4);
1532
1533 sdcc_no--;
1534
1535 sdcc_vreg_data[sdcc_no] = regulator_get(NULL, supply);
1536
1537 if (IS_ERR(sdcc_vreg_data[sdcc_no])) {
1538 rc = PTR_ERR(sdcc_vreg_data[sdcc_no]);
1539 pr_err("%s: could not get regulator \"%s\": %d\n",
1540 __func__, supply, rc);
1541 goto out;
1542 }
1543
1544 rc = regulator_set_voltage(sdcc_vreg_data[sdcc_no], uV, uV);
1545
1546 if (rc) {
1547 pr_err("%s: could not set voltage for \"%s\" to %d uV: %d\n",
1548 __func__, supply, uV, rc);
1549 goto reg_free;
1550 }
1551
1552 return rc;
1553
1554reg_free:
1555 regulator_put(sdcc_vreg_data[sdcc_no]);
1556out:
1557 sdcc_vreg_data[sdcc_no] = NULL;
1558 return rc;
1559}
1560
1561static void __init msm7x27a_init_mmc(void)
1562{
1563 /* eMMC slot */
1564#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1565 if (mmc_regulator_init(3, "emmc", 3000000))
1566 return;
1567 msm_add_sdcc(3, &sdc3_plat_data);
1568#endif
1569 /* Micro-SD slot */
1570#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1571 if (mmc_regulator_init(1, "mmc", 2850000))
1572 return;
1573 msm_add_sdcc(1, &sdc1_plat_data);
1574#endif
1575 /* SDIO WLAN slot */
1576#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1577 if (mmc_regulator_init(2, "mmc", 2850000))
1578 return;
1579 msm_add_sdcc(2, &sdc2_plat_data);
1580#endif
1581 /* Not Used */
1582#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1583 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
1584 if (mmc_regulator_init(4, "mmc", 2850000))
1585 return;
1586 msm_add_sdcc(4, &sdc4_plat_data);
1587#endif
1588}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001589#endif
1590
1591#ifdef CONFIG_SERIAL_MSM_HS
1592static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
1593 .inject_rx_on_wakeup = 1,
1594 .rx_to_inject = 0xFD,
1595};
1596#endif
1597static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
1598 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
1599 .idle_supported = 1,
1600 .suspend_supported = 1,
1601 .idle_enabled = 1,
1602 .suspend_enabled = 1,
1603 .latency = 16000,
1604 .residency = 20000,
1605 },
1606 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
1607 .idle_supported = 1,
1608 .suspend_supported = 1,
1609 .idle_enabled = 1,
1610 .suspend_enabled = 1,
1611 .latency = 12000,
1612 .residency = 20000,
1613 },
1614 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
1615 .idle_supported = 1,
1616 .suspend_supported = 1,
1617 .idle_enabled = 0,
1618 .suspend_enabled = 1,
1619 .latency = 2000,
1620 .residency = 0,
1621 },
1622 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
1623 .idle_supported = 1,
1624 .suspend_supported = 1,
1625 .idle_enabled = 1,
1626 .suspend_enabled = 1,
1627 .latency = 2,
1628 .residency = 0,
1629 },
1630};
1631
1632static struct android_pmem_platform_data android_pmem_adsp_pdata = {
1633 .name = "pmem_adsp",
1634 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
Mahesh Lankac6af7eb2011-08-02 18:00:35 +05301635 .cached = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001636 .memory_type = MEMTYPE_EBI1,
1637};
1638
1639static struct platform_device android_pmem_adsp_device = {
1640 .name = "android_pmem",
1641 .id = 1,
1642 .dev = { .platform_data = &android_pmem_adsp_pdata },
1643};
1644
1645static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
1646static int __init pmem_mdp_size_setup(char *p)
1647{
1648 pmem_mdp_size = memparse(p, NULL);
1649 return 0;
1650}
1651
1652early_param("pmem_mdp_size", pmem_mdp_size_setup);
1653
1654static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
1655static int __init pmem_adsp_size_setup(char *p)
1656{
1657 pmem_adsp_size = memparse(p, NULL);
1658 return 0;
1659}
1660
1661early_param("pmem_adsp_size", pmem_adsp_size_setup);
1662
1663static unsigned fb_size = MSM_FB_SIZE;
1664static int __init fb_size_setup(char *p)
1665{
1666 fb_size = memparse(p, NULL);
1667 return 0;
1668}
1669
1670early_param("fb_size", fb_size_setup);
1671
Justin Paupored98328e2011-08-19 13:48:31 -07001672static struct regulator_bulk_data regs_lcdc[] = {
1673 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
1674 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001675};
1676
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001677static uint32_t lcdc_gpio_initialized;
1678
1679static void lcdc_toshiba_gpio_init(void)
1680{
Justin Paupored98328e2011-08-19 13:48:31 -07001681 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001682 if (!lcdc_gpio_initialized) {
1683 if (gpio_request(GPIO_SPI_CLK, "spi_clk")) {
1684 pr_err("failed to request gpio spi_clk\n");
1685 return;
1686 }
1687 if (gpio_request(GPIO_SPI_CS0_N, "spi_cs")) {
1688 pr_err("failed to request gpio spi_cs0_N\n");
1689 goto fail_gpio6;
1690 }
1691 if (gpio_request(GPIO_SPI_MOSI, "spi_mosi")) {
1692 pr_err("failed to request gpio spi_mosi\n");
1693 goto fail_gpio5;
1694 }
1695 if (gpio_request(GPIO_SPI_MISO, "spi_miso")) {
1696 pr_err("failed to request gpio spi_miso\n");
1697 goto fail_gpio4;
1698 }
1699 if (gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr")) {
1700 pr_err("failed to request gpio_disp_pwr\n");
1701 goto fail_gpio3;
1702 }
1703 if (gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en")) {
1704 pr_err("failed to request gpio_bkl_en\n");
1705 goto fail_gpio2;
1706 }
1707 pmapp_disp_backlight_init();
1708
Justin Paupored98328e2011-08-19 13:48:31 -07001709 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_lcdc), regs_lcdc);
1710 if (rc) {
1711 pr_err("%s: could not get regulators: %d\n",
1712 __func__, rc);
1713 goto fail_gpio1;
1714 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001715
Justin Paupored98328e2011-08-19 13:48:31 -07001716 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_lcdc),
1717 regs_lcdc);
1718 if (rc) {
1719 pr_err("%s: could not set voltages: %d\n",
1720 __func__, rc);
1721 goto fail_vreg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001722 }
1723 lcdc_gpio_initialized = 1;
1724 }
1725 return;
Justin Paupored98328e2011-08-19 13:48:31 -07001726fail_vreg:
1727 regulator_bulk_free(ARRAY_SIZE(regs_lcdc), regs_lcdc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001728fail_gpio1:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001729 gpio_free(GPIO_BACKLIGHT_EN);
1730fail_gpio2:
1731 gpio_free(GPIO_DISPLAY_PWR_EN);
1732fail_gpio3:
1733 gpio_free(GPIO_SPI_MISO);
1734fail_gpio4:
1735 gpio_free(GPIO_SPI_MOSI);
1736fail_gpio5:
1737 gpio_free(GPIO_SPI_CS0_N);
1738fail_gpio6:
1739 gpio_free(GPIO_SPI_CLK);
1740 lcdc_gpio_initialized = 0;
1741}
1742
1743static uint32_t lcdc_gpio_table[] = {
1744 GPIO_SPI_CLK,
1745 GPIO_SPI_CS0_N,
1746 GPIO_SPI_MOSI,
1747 GPIO_DISPLAY_PWR_EN,
1748 GPIO_BACKLIGHT_EN,
1749 GPIO_SPI_MISO,
1750};
1751
1752static void config_lcdc_gpio_table(uint32_t *table, int len, unsigned enable)
1753{
1754 int n;
1755
1756 if (lcdc_gpio_initialized) {
1757 /* All are IO Expander GPIOs */
1758 for (n = 0; n < (len - 1); n++)
1759 gpio_direction_output(table[n], 1);
1760 }
1761}
1762
1763static void lcdc_toshiba_config_gpios(int enable)
1764{
1765 config_lcdc_gpio_table(lcdc_gpio_table,
1766 ARRAY_SIZE(lcdc_gpio_table), enable);
1767}
1768
1769static int msm_fb_lcdc_power_save(int on)
1770{
Justin Paupored98328e2011-08-19 13:48:31 -07001771 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001772 /* Doing the init of the LCDC GPIOs very late as they are from
1773 an I2C-controlled IO Expander */
1774 lcdc_toshiba_gpio_init();
1775
1776 if (lcdc_gpio_initialized) {
1777 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
1778 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
1779
Justin Paupored98328e2011-08-19 13:48:31 -07001780 rc = on ? regulator_bulk_enable(
1781 ARRAY_SIZE(regs_lcdc), regs_lcdc) :
1782 regulator_bulk_disable(
1783 ARRAY_SIZE(regs_lcdc), regs_lcdc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001784
Justin Paupored98328e2011-08-19 13:48:31 -07001785 if (rc)
1786 pr_err("%s: could not %sable regulators: %d\n",
1787 __func__, on ? "en" : "dis", rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001788 }
1789
1790 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001791}
1792
1793
1794static int lcdc_toshiba_set_bl(int level)
1795{
1796 int ret;
1797
1798 ret = pmapp_disp_backlight_set_brightness(level);
1799 if (ret)
1800 pr_err("%s: can't set lcd backlight!\n", __func__);
1801
1802 return ret;
1803}
1804
1805
1806static struct lcdc_platform_data lcdc_pdata = {
Jeevan Shriram15f2a5e2011-07-13 21:45:26 +05301807 .lcdc_gpio_config = NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001808 .lcdc_power_save = msm_fb_lcdc_power_save,
1809};
1810
1811static int lcd_panel_spi_gpio_num[] = {
1812 GPIO_SPI_MOSI, /* spi_sdi */
1813 GPIO_SPI_MISO, /* spi_sdoi */
1814 GPIO_SPI_CLK, /* spi_clk */
1815 GPIO_SPI_CS0_N, /* spi_cs */
1816};
1817
1818static struct msm_panel_common_pdata lcdc_toshiba_panel_data = {
1819 .panel_config_gpio = lcdc_toshiba_config_gpios,
1820 .pmic_backlight = lcdc_toshiba_set_bl,
1821 .gpio_num = lcd_panel_spi_gpio_num,
1822};
1823
1824static struct platform_device lcdc_toshiba_panel_device = {
1825 .name = "lcdc_toshiba_fwvga_pt",
1826 .id = 0,
1827 .dev = {
1828 .platform_data = &lcdc_toshiba_panel_data,
1829 }
1830};
1831
1832static struct resource msm_fb_resources[] = {
1833 {
1834 .flags = IORESOURCE_DMA,
1835 }
1836};
1837
Ajay Singh Parmareede70e2011-08-24 17:36:08 +05301838#define PANEL_NAME_MAX_LEN 30
1839#define LCDC_TOSHIBA_FWVGA_PANEL_NAME "lcdc_toshiba_fwvga_pt"
1840#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1841
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001842static int msm_fb_detect_panel(const char *name)
1843{
Ajay Singh Parmareede70e2011-08-24 17:36:08 +05301844 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1845 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1846 PANEL_NAME_MAX_LEN)))
1847 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001848
Ajay Singh Parmareede70e2011-08-24 17:36:08 +05301849#if !defined(CONFIG_FB_MSM_LCDC_AUTO_DETECT) && \
1850 !defined(CONFIG_FB_MSM_MIPI_PANEL_AUTO_DETECT) && \
1851 !defined(CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT)
1852 if (machine_is_msm7x27a_surf() ||
1853 machine_is_msm7625a_surf()) {
1854 if (!strncmp(name, LCDC_TOSHIBA_FWVGA_PANEL_NAME,
1855 strnlen(LCDC_TOSHIBA_FWVGA_PANEL_NAME,
1856 PANEL_NAME_MAX_LEN)))
1857 return 0;
1858 }
1859#endif
1860 return -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001861}
1862
1863static struct msm_fb_platform_data msm_fb_pdata = {
1864 .detect_client = msm_fb_detect_panel,
1865};
1866
1867static struct platform_device msm_fb_device = {
1868 .name = "msm_fb",
1869 .id = 0,
1870 .num_resources = ARRAY_SIZE(msm_fb_resources),
1871 .resource = msm_fb_resources,
1872 .dev = {
1873 .platform_data = &msm_fb_pdata,
1874 }
1875};
1876
1877#ifdef CONFIG_FB_MSM_MIPI_DSI
1878static int mipi_renesas_set_bl(int level)
1879{
1880 int ret;
1881
1882 ret = pmapp_disp_backlight_set_brightness(level);
1883
1884 if (ret)
1885 pr_err("%s: can't set lcd backlight!\n", __func__);
1886
1887 return ret;
1888}
1889
1890static struct msm_panel_common_pdata mipi_renesas_pdata = {
1891 .pmic_backlight = mipi_renesas_set_bl,
1892};
1893
1894
1895static struct platform_device mipi_dsi_renesas_panel_device = {
1896 .name = "mipi_renesas",
1897 .id = 0,
1898 .dev = {
1899 .platform_data = &mipi_renesas_pdata,
1900 }
1901};
1902#endif
1903
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001904#define SND(desc, num) { .name = #desc, .id = num }
1905static struct snd_endpoint snd_endpoints_list[] = {
1906 SND(HANDSET, 0),
1907 SND(MONO_HEADSET, 2),
1908 SND(HEADSET, 3),
1909 SND(SPEAKER, 6),
1910 SND(TTY_HEADSET, 8),
1911 SND(TTY_VCO, 9),
1912 SND(TTY_HCO, 10),
1913 SND(BT, 12),
1914 SND(IN_S_SADC_OUT_HANDSET, 16),
1915 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
1916 SND(FM_DIGITAL_STEREO_HEADSET, 26),
1917 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
1918 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Sidipotu Ashokab34ca42011-07-22 16:34:20 +05301919 SND(CURRENT, 0x7FFFFFFE),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001920 SND(FM_ANALOG_STEREO_HEADSET, 35),
1921 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
1922};
1923#undef SND
1924
1925static struct msm_snd_endpoints msm_device_snd_endpoints = {
1926 .endpoints = snd_endpoints_list,
1927 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
1928};
1929
1930static struct platform_device msm_device_snd = {
1931 .name = "msm_snd",
1932 .id = -1,
1933 .dev = {
1934 .platform_data = &msm_device_snd_endpoints
1935 },
1936};
1937
1938#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1939 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1940 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1941 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1942 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1943 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1944#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1945 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1946 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1947 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1948 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1949 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1950#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1951 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1952 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1953 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1954 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1955 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1956#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1957 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1958 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1959 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1960 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1961 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1962#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
1963
1964static unsigned int dec_concurrency_table[] = {
1965 /* Audio LP */
1966 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
1967 0, 0, 0,
1968
1969 /* Concurrency 1 */
1970 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1971 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1972 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1973 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1974 (DEC4_FORMAT),
1975
1976 /* Concurrency 2 */
1977 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1978 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1979 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1980 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1981 (DEC4_FORMAT),
1982
1983 /* Concurrency 3 */
1984 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1985 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1986 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1987 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1988 (DEC4_FORMAT),
1989
1990 /* Concurrency 4 */
1991 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1992 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1993 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1994 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1995 (DEC4_FORMAT),
1996
1997 /* Concurrency 5 */
1998 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1999 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2000 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2001 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2002 (DEC4_FORMAT),
2003
2004 /* Concurrency 6 */
2005 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2006 0, 0, 0, 0,
2007
2008 /* Concurrency 7 */
2009 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2010 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2011 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2012 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2013 (DEC4_FORMAT),
2014};
2015
2016#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
2017 .module_queueid = queueid, .module_decid = decid, \
2018 .nr_codec_support = nr_codec}
2019
2020static struct msm_adspdec_info dec_info_list[] = {
2021 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
2022 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
2023 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
2024 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
2025 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
2026};
2027
2028static struct msm_adspdec_database msm_device_adspdec_database = {
2029 .num_dec = ARRAY_SIZE(dec_info_list),
2030 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
2031 ARRAY_SIZE(dec_info_list)),
2032 .dec_concurrency_table = dec_concurrency_table,
2033 .dec_info_list = dec_info_list,
2034};
2035
2036static struct platform_device msm_device_adspdec = {
2037 .name = "msm_adspdec",
2038 .id = -1,
2039 .dev = {
2040 .platform_data = &msm_device_adspdec_database
2041 },
2042};
2043
2044static struct android_pmem_platform_data android_pmem_audio_pdata = {
2045 .name = "pmem_audio",
2046 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
2047 .cached = 0,
2048 .memory_type = MEMTYPE_EBI1,
2049};
2050
2051static struct platform_device android_pmem_audio_device = {
2052 .name = "android_pmem",
2053 .id = 2,
2054 .dev = { .platform_data = &android_pmem_audio_pdata },
2055};
2056
2057static struct android_pmem_platform_data android_pmem_pdata = {
2058 .name = "pmem",
2059 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
2060 .cached = 1,
2061 .memory_type = MEMTYPE_EBI1,
2062};
2063static struct platform_device android_pmem_device = {
2064 .name = "android_pmem",
2065 .id = 0,
2066 .dev = { .platform_data = &android_pmem_pdata },
2067};
2068
2069static u32 msm_calculate_batt_capacity(u32 current_voltage);
2070
2071static struct msm_psy_batt_pdata msm_psy_batt_data = {
2072 .voltage_min_design = 2800,
2073 .voltage_max_design = 4300,
2074 .avail_chg_sources = AC_CHG | USB_CHG ,
2075 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
2076 .calculate_capacity = &msm_calculate_batt_capacity,
2077};
2078
2079static u32 msm_calculate_batt_capacity(u32 current_voltage)
2080{
2081 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
2082 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
2083
2084 return (current_voltage - low_voltage) * 100
2085 / (high_voltage - low_voltage);
2086}
2087
2088static struct platform_device msm_batt_device = {
2089 .name = "msm-battery",
2090 .id = -1,
2091 .dev.platform_data = &msm_psy_batt_data,
2092};
2093
2094static struct smsc911x_platform_config smsc911x_config = {
2095 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
2096 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
2097 .flags = SMSC911X_USE_16BIT,
2098};
2099
2100static struct resource smsc911x_resources[] = {
2101 [0] = {
2102 .start = 0x90000000,
2103 .end = 0x90007fff,
2104 .flags = IORESOURCE_MEM,
2105 },
2106 [1] = {
2107 .start = MSM_GPIO_TO_INT(48),
2108 .end = MSM_GPIO_TO_INT(48),
2109 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
2110 },
2111};
2112
2113static struct platform_device smsc911x_device = {
2114 .name = "smsc911x",
2115 .id = 0,
2116 .num_resources = ARRAY_SIZE(smsc911x_resources),
2117 .resource = smsc911x_resources,
2118 .dev = {
2119 .platform_data = &smsc911x_config,
2120 },
2121};
2122
2123static struct msm_gpio smsc911x_gpios[] = {
2124 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
2125 "smsc911x_irq" },
2126 { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
2127 "eth_fifo_sel" },
2128};
2129
2130#define ETH_FIFO_SEL_GPIO 49
2131static void msm7x27a_cfg_smsc911x(void)
2132{
2133 int res;
2134
2135 res = msm_gpios_request_enable(smsc911x_gpios,
2136 ARRAY_SIZE(smsc911x_gpios));
2137 if (res) {
2138 pr_err("%s: unable to enable gpios for SMSC911x\n", __func__);
2139 return;
2140 }
2141
2142 /* ETH_FIFO_SEL */
2143 res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0);
2144 if (res) {
2145 pr_err("%s: unable to get direction for gpio %d\n", __func__,
2146 ETH_FIFO_SEL_GPIO);
2147 msm_gpios_disable_free(smsc911x_gpios,
2148 ARRAY_SIZE(smsc911x_gpios));
2149 return;
2150 }
2151 gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
2152}
2153
2154#ifdef CONFIG_MSM_CAMERA
2155static uint32_t camera_off_gpio_table[] = {
2156 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
2157};
2158
2159static uint32_t camera_on_gpio_table[] = {
2160 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
2161};
2162
2163#ifdef CONFIG_MSM_CAMERA_FLASH
2164static struct msm_camera_sensor_flash_src msm_flash_src = {
Nishant Pandit474f2252011-07-23 23:17:56 +05302165 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
2166 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
2167 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002168};
2169#endif
2170
Justin Paupored98328e2011-08-19 13:48:31 -07002171static struct regulator_bulk_data regs_camera[] = {
2172 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
2173 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2174 { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
2175};
2176
2177static void __init msm_camera_vreg_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002178{
2179 int rc;
2180
Justin Paupored98328e2011-08-19 13:48:31 -07002181 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002182
Justin Paupored98328e2011-08-19 13:48:31 -07002183 if (rc) {
2184 pr_err("%s: could not get regulators: %d\n", __func__, rc);
2185 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002186 }
2187
Justin Paupored98328e2011-08-19 13:48:31 -07002188 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002189
Justin Paupored98328e2011-08-19 13:48:31 -07002190 if (rc) {
2191 pr_err("%s: could not set voltages: %d\n", __func__, rc);
2192 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002193 }
Justin Paupored98328e2011-08-19 13:48:31 -07002194}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002195
Justin Paupored98328e2011-08-19 13:48:31 -07002196static void msm_camera_vreg_config(int vreg_en)
2197{
2198 int rc = vreg_en ?
2199 regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
2200 regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002201
Justin Paupored98328e2011-08-19 13:48:31 -07002202 if (rc)
2203 pr_err("%s: could not %sable regulators: %d\n",
2204 __func__, vreg_en ? "en" : "dis", rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002205}
2206
2207static int config_gpio_table(uint32_t *table, int len)
2208{
2209 int rc = 0, i = 0;
2210
2211 for (i = 0; i < len; i++) {
2212 rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
2213 if (rc) {
2214 pr_err("%s not able to get gpio\n", __func__);
2215 for (i--; i >= 0; i--)
2216 gpio_tlmm_config(camera_off_gpio_table[i],
2217 GPIO_CFG_ENABLE);
2218 break;
2219 }
2220 }
2221 return rc;
2222}
2223
2224static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data;
2225static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data;
2226static int config_camera_on_gpios_rear(void)
2227{
2228 int rc = 0;
2229
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302230 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002231 msm_camera_vreg_config(1);
2232
2233 rc = config_gpio_table(camera_on_gpio_table,
2234 ARRAY_SIZE(camera_on_gpio_table));
2235 if (rc < 0) {
2236 pr_err("%s: CAMSENSOR gpio table request"
2237 "failed\n", __func__);
2238 return rc;
2239 }
2240
2241 return rc;
2242}
2243
2244static void config_camera_off_gpios_rear(void)
2245{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302246 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002247 msm_camera_vreg_config(0);
2248
2249 config_gpio_table(camera_off_gpio_table,
2250 ARRAY_SIZE(camera_off_gpio_table));
2251}
2252
2253static int config_camera_on_gpios_front(void)
2254{
2255 int rc = 0;
2256
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302257 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002258 msm_camera_vreg_config(1);
2259
2260 rc = config_gpio_table(camera_on_gpio_table,
2261 ARRAY_SIZE(camera_on_gpio_table));
2262 if (rc < 0) {
2263 pr_err("%s: CAMSENSOR gpio table request"
2264 "failed\n", __func__);
2265 return rc;
2266 }
2267
2268 return rc;
2269}
2270
2271static void config_camera_off_gpios_front(void)
2272{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302273 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002274 msm_camera_vreg_config(0);
2275
2276 config_gpio_table(camera_off_gpio_table,
2277 ARRAY_SIZE(camera_off_gpio_table));
2278}
2279
2280struct msm_camera_device_platform_data msm_camera_device_data_rear = {
2281 .camera_gpio_on = config_camera_on_gpios_rear,
2282 .camera_gpio_off = config_camera_off_gpios_rear,
2283 .ioext.csiphy = 0xA1000000,
2284 .ioext.csisz = 0x00100000,
2285 .ioext.csiirq = INT_CSI_IRQ_1,
2286 .ioclk.mclk_clk_rate = 24000000,
2287 .ioclk.vfe_clk_rate = 192000000,
2288 .ioext.appphy = MSM_CLK_CTL_PHYS,
2289 .ioext.appsz = MSM_CLK_CTL_SIZE,
2290};
2291
2292struct msm_camera_device_platform_data msm_camera_device_data_front = {
2293 .camera_gpio_on = config_camera_on_gpios_front,
2294 .camera_gpio_off = config_camera_off_gpios_front,
2295 .ioext.csiphy = 0xA0F00000,
2296 .ioext.csisz = 0x00100000,
2297 .ioext.csiirq = INT_CSI_IRQ_0,
2298 .ioclk.mclk_clk_rate = 24000000,
2299 .ioclk.vfe_clk_rate = 192000000,
2300 .ioext.appphy = MSM_CLK_CTL_PHYS,
2301 .ioext.appsz = MSM_CLK_CTL_SIZE,
2302};
2303
2304#ifdef CONFIG_S5K4E1
2305static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = {
2306 .mount_angle = 90
2307};
2308
2309static struct msm_camera_sensor_flash_data flash_s5k4e1 = {
2310 .flash_type = MSM_CAMERA_FLASH_LED,
2311 .flash_src = &msm_flash_src
2312};
2313
2314static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = {
2315 .sensor_name = "s5k4e1",
2316 .sensor_reset_enable = 1,
2317 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N,
2318 .sensor_pwd = 85,
2319 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
2320 .vcm_enable = 1,
2321 .pdata = &msm_camera_device_data_rear,
2322 .flash_data = &flash_s5k4e1,
2323 .sensor_platform_info = &s5k4e1_sensor_7627a_info,
2324 .csi_if = 1
2325};
2326
2327static struct platform_device msm_camera_sensor_s5k4e1 = {
2328 .name = "msm_camera_s5k4e1",
2329 .dev = {
2330 .platform_data = &msm_camera_sensor_s5k4e1_data,
2331 },
2332};
2333#endif
2334
2335#ifdef CONFIG_IMX072
2336static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = {
2337 .mount_angle = 90
2338};
2339
2340static struct msm_camera_sensor_flash_data flash_imx072 = {
2341 .flash_type = MSM_CAMERA_FLASH_LED,
2342 .flash_src = &msm_flash_src
2343};
2344
2345static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = {
2346 .sensor_name = "imx072",
2347 .sensor_reset_enable = 1,
2348 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/
2349 .sensor_pwd = 85,
2350 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
2351 .vcm_enable = 1,
2352 .pdata = &msm_camera_device_data_rear,
2353 .flash_data = &flash_imx072,
2354 .sensor_platform_info = &imx072_sensor_7627a_info,
2355 .csi_if = 1
2356};
2357
2358static struct platform_device msm_camera_sensor_imx072 = {
2359 .name = "msm_camera_imx072",
2360 .dev = {
2361 .platform_data = &msm_camera_sensor_imx072_data,
2362 },
2363};
2364#endif
2365
2366#ifdef CONFIG_WEBCAM_OV9726
2367static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = {
2368 .mount_angle = 90
2369};
2370
2371static struct msm_camera_sensor_flash_data flash_ov9726 = {
2372 .flash_type = MSM_CAMERA_FLASH_NONE,
2373 .flash_src = &msm_flash_src
2374};
2375
2376static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
2377 .sensor_name = "ov9726",
2378 .sensor_reset_enable = 0,
2379 .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR,
2380 .sensor_pwd = 85,
2381 .vcm_pwd = 1,
2382 .vcm_enable = 0,
2383 .pdata = &msm_camera_device_data_front,
2384 .flash_data = &flash_ov9726,
2385 .sensor_platform_info = &ov9726_sensor_7627a_info,
2386 .csi_if = 1
2387};
2388
2389static struct platform_device msm_camera_sensor_ov9726 = {
2390 .name = "msm_camera_ov9726",
2391 .dev = {
2392 .platform_data = &msm_camera_sensor_ov9726_data,
2393 },
2394};
Justin Paupored98328e2011-08-19 13:48:31 -07002395#else
2396static inline void msm_camera_vreg_init(void) { }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002397#endif
2398
2399#ifdef CONFIG_MT9E013
2400static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = {
2401 .mount_angle = 90
2402};
2403
2404static struct msm_camera_sensor_flash_data flash_mt9e013 = {
2405 .flash_type = MSM_CAMERA_FLASH_LED,
2406 .flash_src = &msm_flash_src
2407};
2408
2409static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
2410 .sensor_name = "mt9e013",
2411 .sensor_reset = 0,
2412 .sensor_reset_enable = 1,
2413 .sensor_pwd = 85,
2414 .vcm_pwd = 1,
2415 .vcm_enable = 0,
2416 .pdata = &msm_camera_device_data_rear,
2417 .flash_data = &flash_mt9e013,
2418 .sensor_platform_info = &mt9e013_sensor_7627a_info,
2419 .csi_if = 1
2420};
2421
2422static struct platform_device msm_camera_sensor_mt9e013 = {
2423 .name = "msm_camera_mt9e013",
2424 .dev = {
2425 .platform_data = &msm_camera_sensor_mt9e013_data,
2426 },
2427};
2428#endif
2429
2430static struct i2c_board_info i2c_camera_devices[] = {
2431 #ifdef CONFIG_S5K4E1
2432 {
2433 I2C_BOARD_INFO("s5k4e1", 0x36),
2434 },
2435 {
2436 I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1),
2437 },
2438 #endif
2439 #ifdef CONFIG_WEBCAM_OV9726
2440 {
2441 I2C_BOARD_INFO("ov9726", 0x10),
2442 },
2443 #endif
2444 #ifdef CONFIG_IMX072
2445 {
2446 I2C_BOARD_INFO("imx072", 0x34),
2447 },
2448 #endif
2449 #ifdef CONFIG_MT9E013
2450 {
2451 I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
2452 },
2453 #endif
2454 {
Nishant Pandit474f2252011-07-23 23:17:56 +05302455 I2C_BOARD_INFO("sc628a", 0x6E),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002456 },
2457};
2458#endif
2459#if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \
2460 && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM)
2461static struct msm_gpio uart2dm_gpios[] = {
2462 {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2463 "uart2dm_rfr_n" },
2464 {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2465 "uart2dm_cts_n" },
2466 {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2467 "uart2dm_rx" },
2468 {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2469 "uart2dm_tx" },
2470};
2471
2472static void msm7x27a_cfg_uart2dm_serial(void)
2473{
2474 int ret;
2475 ret = msm_gpios_request_enable(uart2dm_gpios,
2476 ARRAY_SIZE(uart2dm_gpios));
2477 if (ret)
2478 pr_err("%s: unable to enable gpios for uart2dm\n", __func__);
2479}
2480#else
2481static void msm7x27a_cfg_uart2dm_serial(void) { }
2482#endif
2483
2484static struct platform_device *rumi_sim_devices[] __initdata = {
2485 &msm_device_dmov,
2486 &msm_device_smd,
2487 &smc91x_device,
2488 &msm_device_uart1,
2489 &msm_device_nand,
2490 &msm_device_uart_dm1,
2491 &msm_gsbi0_qup_i2c_device,
2492 &msm_gsbi1_qup_i2c_device,
2493};
2494
2495static struct platform_device *surf_ffa_devices[] __initdata = {
2496 &msm_device_dmov,
2497 &msm_device_smd,
2498 &msm_device_uart1,
2499 &msm_device_uart_dm1,
2500 &msm_device_uart_dm2,
2501 &msm_device_nand,
2502 &msm_gsbi0_qup_i2c_device,
2503 &msm_gsbi1_qup_i2c_device,
2504 &msm_device_otg,
2505 &msm_device_gadget_peripheral,
2506 &android_usb_device,
2507 &android_pmem_device,
2508 &android_pmem_adsp_device,
2509 &android_pmem_audio_device,
2510 &msm_device_snd,
2511 &msm_device_adspdec,
2512 &msm_fb_device,
2513 &lcdc_toshiba_panel_device,
2514 &msm_batt_device,
2515 &smsc911x_device,
2516#ifdef CONFIG_S5K4E1
2517 &msm_camera_sensor_s5k4e1,
2518#endif
2519#ifdef CONFIG_IMX072
2520 &msm_camera_sensor_imx072,
2521#endif
2522#ifdef CONFIG_WEBCAM_OV9726
2523 &msm_camera_sensor_ov9726,
2524#endif
2525#ifdef CONFIG_MT9E013
2526 &msm_camera_sensor_mt9e013,
2527#endif
2528#ifdef CONFIG_FB_MSM_MIPI_DSI
2529 &mipi_dsi_renesas_panel_device,
2530#endif
2531 &msm_kgsl_3d0,
2532#ifdef CONFIG_BT
2533 &msm_bt_power_device,
2534#endif
Manish Dewangan3a260992011-06-24 18:01:34 +05302535 &asoc_msm_pcm,
2536 &asoc_msm_dai0,
2537 &asoc_msm_dai1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002538};
2539
2540static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
2541static int __init pmem_kernel_ebi1_size_setup(char *p)
2542{
2543 pmem_kernel_ebi1_size = memparse(p, NULL);
2544 return 0;
2545}
2546early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
2547
2548static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
2549static int __init pmem_audio_size_setup(char *p)
2550{
2551 pmem_audio_size = memparse(p, NULL);
2552 return 0;
2553}
2554early_param("pmem_audio_size", pmem_audio_size_setup);
2555
2556static void __init msm_msm7x2x_allocate_memory_regions(void)
2557{
2558 void *addr;
2559 unsigned long size;
2560
2561 size = fb_size ? : MSM_FB_SIZE;
2562 addr = alloc_bootmem_align(size, 0x1000);
2563 msm_fb_resources[0].start = __pa(addr);
2564 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2565 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2566 size, addr, __pa(addr));
2567}
2568
2569static struct memtype_reserve msm7x27a_reserve_table[] __initdata = {
2570 [MEMTYPE_SMI] = {
2571 },
2572 [MEMTYPE_EBI0] = {
2573 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2574 },
2575 [MEMTYPE_EBI1] = {
2576 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2577 },
2578};
2579
2580static void __init size_pmem_devices(void)
2581{
2582#ifdef CONFIG_ANDROID_PMEM
2583 android_pmem_adsp_pdata.size = pmem_adsp_size;
2584 android_pmem_pdata.size = pmem_mdp_size;
2585 android_pmem_audio_pdata.size = pmem_audio_size;
2586#endif
2587}
2588
2589static void __init reserve_memory_for(struct android_pmem_platform_data *p)
2590{
2591 msm7x27a_reserve_table[p->memory_type].size += p->size;
2592}
2593
2594static void __init reserve_pmem_memory(void)
2595{
2596#ifdef CONFIG_ANDROID_PMEM
2597 reserve_memory_for(&android_pmem_adsp_pdata);
2598 reserve_memory_for(&android_pmem_pdata);
2599 reserve_memory_for(&android_pmem_audio_pdata);
2600 msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
2601#endif
2602}
2603
2604static void __init msm7x27a_calculate_reserve_sizes(void)
2605{
2606 size_pmem_devices();
2607 reserve_pmem_memory();
2608}
2609
2610static int msm7x27a_paddr_to_memtype(unsigned int paddr)
2611{
2612 return MEMTYPE_EBI1;
2613}
2614
2615static struct reserve_info msm7x27a_reserve_info __initdata = {
2616 .memtype_reserve_table = msm7x27a_reserve_table,
2617 .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes,
2618 .paddr_to_memtype = msm7x27a_paddr_to_memtype,
2619};
2620
2621static void __init msm7x27a_reserve(void)
2622{
2623 reserve_info = &msm7x27a_reserve_info;
2624 msm_reserve();
2625}
2626
2627static void __init msm_device_i2c_init(void)
2628{
2629 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
2630 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
2631}
2632
2633static struct msm_panel_common_pdata mdp_pdata = {
2634 .gpio = 97,
2635 .mdp_rev = MDP_REV_303,
2636};
2637
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302638
2639#ifdef CONFIG_FB_MSM
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002640#define GPIO_LCDC_BRDG_PD 128
2641#define GPIO_LCDC_BRDG_RESET_N 129
2642
2643#define LCDC_RESET_PHYS 0x90008014
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302644
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002645static void __iomem *lcdc_reset_ptr;
2646
2647static unsigned mipi_dsi_gpio[] = {
2648 GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
2649 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2650 GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
2651 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2652};
2653
2654enum {
2655 DSI_SINGLE_LANE = 1,
2656 DSI_TWO_LANES,
2657};
2658
2659static int msm_fb_get_lane_config(void)
2660{
2661 int rc = DSI_TWO_LANES;
2662
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302663 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002664 rc = DSI_SINGLE_LANE;
2665 pr_info("DSI Single Lane\n");
2666 } else {
2667 pr_info("DSI Two Lanes\n");
2668 }
2669 return rc;
2670}
2671
2672static int msm_fb_dsi_client_reset(void)
2673{
2674 int rc = 0;
2675
2676 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
2677 if (rc < 0) {
2678 pr_err("failed to request lcd brdg reset_n\n");
2679 return rc;
2680 }
2681
2682 rc = gpio_request(GPIO_LCDC_BRDG_PD, "lcdc_brdg_pd");
2683 if (rc < 0) {
2684 pr_err("failed to request lcd brdg pd\n");
2685 return rc;
2686 }
2687
2688 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
2689 if (rc) {
2690 pr_err("Failed to enable LCDC Bridge reset enable\n");
2691 goto gpio_error;
2692 }
2693
2694 rc = gpio_tlmm_config(mipi_dsi_gpio[1], GPIO_CFG_ENABLE);
2695 if (rc) {
2696 pr_err("Failed to enable LCDC Bridge pd enable\n");
2697 goto gpio_error2;
2698 }
2699
2700 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
2701 rc |= gpio_direction_output(GPIO_LCDC_BRDG_PD, 1);
2702 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
2703
2704 if (!rc) {
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302705 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002706 lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS,
2707 sizeof(uint32_t));
2708
2709 if (!lcdc_reset_ptr)
2710 return 0;
2711 }
2712 return rc;
2713 } else {
2714 goto gpio_error;
2715 }
2716
2717gpio_error2:
2718 pr_err("Failed GPIO bridge pd\n");
2719 gpio_free(GPIO_LCDC_BRDG_PD);
2720
2721gpio_error:
2722 pr_err("Failed GPIO bridge reset\n");
2723 gpio_free(GPIO_LCDC_BRDG_RESET_N);
2724 return rc;
2725}
2726
Justin Paupored98328e2011-08-19 13:48:31 -07002727static struct regulator_bulk_data regs_dsi[] = {
2728 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2729 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002730};
2731
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002732static int dsi_gpio_initialized;
2733
2734static int mipi_dsi_panel_power(int on)
2735{
Justin Paupored98328e2011-08-19 13:48:31 -07002736 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002737 uint32_t lcdc_reset_cfg;
2738
2739 /* I2C-controlled GPIO Expander -init of the GPIOs very late */
Justin Paupored98328e2011-08-19 13:48:31 -07002740 if (unlikely(!dsi_gpio_initialized)) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002741 pmapp_disp_backlight_init();
2742
2743 rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr");
2744 if (rc < 0) {
2745 pr_err("failed to request gpio_disp_pwr\n");
2746 return rc;
2747 }
2748
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302749 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002750 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1);
2751 if (rc < 0) {
2752 pr_err("failed to enable display pwr\n");
2753 goto fail_gpio1;
2754 }
2755
2756 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
2757 if (rc < 0) {
2758 pr_err("failed to request gpio_bkl_en\n");
2759 goto fail_gpio1;
2760 }
2761
2762 rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
2763 if (rc < 0) {
2764 pr_err("failed to enable backlight\n");
2765 goto fail_gpio2;
2766 }
2767 }
2768
Justin Paupored98328e2011-08-19 13:48:31 -07002769 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
2770 if (rc) {
2771 pr_err("%s: could not get regulators: %d\n",
2772 __func__, rc);
2773 goto fail_gpio2;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002774 }
Justin Paupored98328e2011-08-19 13:48:31 -07002775
2776 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi);
2777 if (rc) {
2778 pr_err("%s: could not set voltages: %d\n",
2779 __func__, rc);
2780 goto fail_vreg;
2781 }
2782
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002783 dsi_gpio_initialized = 1;
2784 }
2785
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302786 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07002787 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
2788 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302789 } else if (machine_is_msm7x27a_ffa() ||
2790 machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002791 if (on) {
Justin Paupored98328e2011-08-19 13:48:31 -07002792 /* This line drives an active low pin on FFA */
2793 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on);
2794 if (rc < 0)
2795 pr_err("failed to set direction for "
2796 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002797 } else {
Justin Paupored98328e2011-08-19 13:48:31 -07002798 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on);
2799 rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN);
2800 if (rc < 0)
2801 pr_err("failed to set direction for "
2802 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002803 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002804 }
2805
Justin Paupored98328e2011-08-19 13:48:31 -07002806 if (on) {
2807 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
2808
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302809 if (machine_is_msm7x27a_surf() ||
2810 machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07002811 lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr);
2812 rmb();
2813 lcdc_reset_cfg &= ~1;
2814
2815 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
2816 msleep(20);
2817 wmb();
2818 lcdc_reset_cfg |= 1;
2819 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
2820 } else {
2821 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
2822 msleep(20);
2823 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
2824 }
2825
2826 if (pmapp_disp_backlight_set_brightness(100))
2827 pr_err("backlight set brightness failed\n");
2828 } else {
2829 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1);
2830
2831 if (pmapp_disp_backlight_set_brightness(0))
2832 pr_err("backlight set brightness failed\n");
2833 }
2834
2835 rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) :
2836 regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi);
2837
2838 if (rc)
2839 pr_err("%s: could not %sable regulators: %d\n",
2840 __func__, on ? "en" : "dis", rc);
2841
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002842 return rc;
2843
Justin Paupored98328e2011-08-19 13:48:31 -07002844fail_vreg:
2845 regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002846fail_gpio2:
2847 gpio_free(GPIO_BACKLIGHT_EN);
2848fail_gpio1:
2849 gpio_free(GPIO_DISPLAY_PWR_EN);
2850 dsi_gpio_initialized = 0;
2851 return rc;
2852}
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302853#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002854
2855#define MDP_303_VSYNC_GPIO 97
2856
2857#ifdef CONFIG_FB_MSM_MDP303
2858static struct mipi_dsi_platform_data mipi_dsi_pdata = {
2859 .vsync_gpio = MDP_303_VSYNC_GPIO,
2860 .dsi_power_save = mipi_dsi_panel_power,
2861 .dsi_client_reset = msm_fb_dsi_client_reset,
2862 .get_lane_config = msm_fb_get_lane_config,
2863};
2864#endif
2865
2866static void __init msm_fb_add_devices(void)
2867{
2868 msm_fb_register_device("mdp", &mdp_pdata);
2869 msm_fb_register_device("lcdc", &lcdc_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302870#ifdef CONFIG_FB_MSM_MDP303
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002871 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302872#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002873}
2874
2875#define MSM_EBI2_PHYS 0xa0d00000
2876#define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030
2877
2878static void __init msm7x27a_init_ebi2(void)
2879{
2880 uint32_t ebi2_cfg;
2881 void __iomem *ebi2_cfg_ptr;
2882
2883 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t));
2884 if (!ebi2_cfg_ptr)
2885 return;
2886
2887 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302888 if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() ||
2889 machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002890 ebi2_cfg |= (1 << 4); /* CS2 */
2891
2892 writel(ebi2_cfg, ebi2_cfg_ptr);
2893 iounmap(ebi2_cfg_ptr);
2894
2895 /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */
2896 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1,
2897 sizeof(uint32_t));
2898 if (!ebi2_cfg_ptr)
2899 return;
2900
2901 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302902 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002903 ebi2_cfg |= (1 << 31);
2904
2905 writel(ebi2_cfg, ebi2_cfg_ptr);
2906 iounmap(ebi2_cfg_ptr);
2907}
2908
2909#define ATMEL_TS_I2C_NAME "maXTouch"
Justin Paupored98328e2011-08-19 13:48:31 -07002910
2911static struct regulator_bulk_data regs_atmel[] = {
2912 { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 },
2913 { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 },
2914};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002915
2916#define ATMEL_TS_GPIO_IRQ 82
2917
2918static int atmel_ts_power_on(bool on)
2919{
Justin Paupored98328e2011-08-19 13:48:31 -07002920 int rc = on ?
2921 regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) :
2922 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002923
Justin Paupored98328e2011-08-19 13:48:31 -07002924 if (rc)
2925 pr_err("%s: could not %sable regulators: %d\n",
2926 __func__, on ? "en" : "dis", rc);
2927 else
2928 msleep(50);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002929
Justin Paupored98328e2011-08-19 13:48:31 -07002930 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002931}
2932
2933static int atmel_ts_platform_init(struct i2c_client *client)
2934{
2935 int rc;
Justin Paupored98328e2011-08-19 13:48:31 -07002936 struct device *dev = &client->dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002937
Justin Paupored98328e2011-08-19 13:48:31 -07002938 rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002939 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002940 dev_err(dev, "%s: could not get regulators: %d\n",
2941 __func__, rc);
2942 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002943 }
2944
Justin Paupored98328e2011-08-19 13:48:31 -07002945 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002946 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002947 dev_err(dev, "%s: could not set voltages: %d\n",
2948 __func__, rc);
2949 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002950 }
2951
2952 rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2953 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
2954 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
2955 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002956 dev_err(dev, "%s: gpio_tlmm_config for %d failed\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002957 __func__, ATMEL_TS_GPIO_IRQ);
Justin Paupored98328e2011-08-19 13:48:31 -07002958 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002959 }
2960
2961 /* configure touchscreen interrupt gpio */
2962 rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio");
2963 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002964 dev_err(dev, "%s: unable to request gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002965 __func__, ATMEL_TS_GPIO_IRQ);
2966 goto ts_gpio_tlmm_unconfig;
2967 }
2968
2969 rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ);
2970 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -07002971 dev_err(dev, "%s: unable to set the direction of gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002972 __func__, ATMEL_TS_GPIO_IRQ);
2973 goto free_ts_gpio;
2974 }
2975 return 0;
2976
2977free_ts_gpio:
2978 gpio_free(ATMEL_TS_GPIO_IRQ);
2979ts_gpio_tlmm_unconfig:
2980 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2981 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
2982 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07002983reg_free:
2984 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
2985out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002986 return rc;
2987}
2988
2989static int atmel_ts_platform_exit(struct i2c_client *client)
2990{
2991 gpio_free(ATMEL_TS_GPIO_IRQ);
2992 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2993 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
2994 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07002995 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
2996 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002997 return 0;
2998}
2999
3000static u8 atmel_ts_read_chg(void)
3001{
3002 return gpio_get_value(ATMEL_TS_GPIO_IRQ);
3003}
3004
3005static u8 atmel_ts_valid_interrupt(void)
3006{
3007 return !atmel_ts_read_chg();
3008}
3009
3010#define ATMEL_X_OFFSET 13
3011#define ATMEL_Y_OFFSET 0
3012
3013static struct mxt_platform_data atmel_ts_pdata = {
3014 .numtouch = 4,
3015 .init_platform_hw = atmel_ts_platform_init,
3016 .exit_platform_hw = atmel_ts_platform_exit,
3017 .power_on = atmel_ts_power_on,
3018 .display_res_x = 480,
3019 .display_res_y = 864,
3020 .min_x = ATMEL_X_OFFSET,
3021 .max_x = (505 - ATMEL_X_OFFSET),
3022 .min_y = ATMEL_Y_OFFSET,
3023 .max_y = (863 - ATMEL_Y_OFFSET),
3024 .valid_interrupt = atmel_ts_valid_interrupt,
3025 .read_chg = atmel_ts_read_chg,
3026};
3027
3028static struct i2c_board_info atmel_ts_i2c_info[] __initdata = {
3029 {
3030 I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a),
3031 .platform_data = &atmel_ts_pdata,
3032 .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ),
3033 },
3034};
3035
3036#define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col))
3037
3038static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35};
3039static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40};
3040
3041static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) *
3042 ARRAY_SIZE(kp_row_gpios)] = {
3043 [KP_INDEX(0, 0)] = KEY_7,
3044 [KP_INDEX(0, 1)] = KEY_DOWN,
3045 [KP_INDEX(0, 2)] = KEY_UP,
3046 [KP_INDEX(0, 3)] = KEY_RIGHT,
3047 [KP_INDEX(0, 4)] = KEY_ENTER,
3048
3049 [KP_INDEX(1, 0)] = KEY_LEFT,
3050 [KP_INDEX(1, 1)] = KEY_SEND,
3051 [KP_INDEX(1, 2)] = KEY_1,
3052 [KP_INDEX(1, 3)] = KEY_4,
3053 [KP_INDEX(1, 4)] = KEY_CLEAR,
3054
3055 [KP_INDEX(2, 0)] = KEY_6,
3056 [KP_INDEX(2, 1)] = KEY_5,
3057 [KP_INDEX(2, 2)] = KEY_8,
3058 [KP_INDEX(2, 3)] = KEY_3,
3059 [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR,
3060
3061 [KP_INDEX(3, 0)] = KEY_9,
3062 [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND,
3063 [KP_INDEX(3, 2)] = KEY_0,
3064 [KP_INDEX(3, 3)] = KEY_2,
3065 [KP_INDEX(3, 4)] = KEY_SLEEP,
3066
3067 [KP_INDEX(4, 0)] = KEY_BACK,
3068 [KP_INDEX(4, 1)] = KEY_HOME,
3069 [KP_INDEX(4, 2)] = KEY_MENU,
3070 [KP_INDEX(4, 3)] = KEY_VOLUMEUP,
3071 [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN,
3072};
3073
3074/* SURF keypad platform device information */
3075static struct gpio_event_matrix_info kp_matrix_info = {
3076 .info.func = gpio_event_matrix_func,
3077 .keymap = keymap,
3078 .output_gpios = kp_row_gpios,
3079 .input_gpios = kp_col_gpios,
3080 .noutputs = ARRAY_SIZE(kp_row_gpios),
3081 .ninputs = ARRAY_SIZE(kp_col_gpios),
3082 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
3083 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
3084 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
3085 GPIOKPF_PRINT_UNMAPPED_KEYS,
3086};
3087
3088static struct gpio_event_info *kp_info[] = {
3089 &kp_matrix_info.info
3090};
3091
3092static struct gpio_event_platform_data kp_pdata = {
3093 .name = "7x27a_kp",
3094 .info = kp_info,
3095 .info_count = ARRAY_SIZE(kp_info)
3096};
3097
3098static struct platform_device kp_pdev = {
3099 .name = GPIO_EVENT_DEV_NAME,
3100 .id = -1,
3101 .dev = {
3102 .platform_data = &kp_pdata,
3103 },
3104};
3105
3106static struct msm_handset_platform_data hs_platform_data = {
3107 .hs_name = "7k_handset",
3108 .pwr_key_delay_ms = 500, /* 0 will disable end key */
3109};
3110
3111static struct platform_device hs_pdev = {
3112 .name = "msm-handset",
3113 .id = -1,
3114 .dev = {
3115 .platform_data = &hs_platform_data,
3116 },
3117};
3118
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003119static struct platform_device msm_proccomm_regulator_dev = {
3120 .name = PROCCOMM_REGULATOR_DEV_NAME,
3121 .id = -1,
3122 .dev = {
3123 .platform_data = &msm7x27a_proccomm_regulator_data
3124 }
3125};
3126
Trilok Soni16f61af2011-07-26 16:06:58 +05303127static void __init msm7627a_rumi3_init(void)
3128{
3129 msm7x27a_init_ebi2();
3130 platform_add_devices(rumi_sim_devices,
3131 ARRAY_SIZE(rumi_sim_devices));
3132}
3133
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003134#define LED_GPIO_PDM 96
3135#define UART1DM_RX_GPIO 45
Santosh Sajjanb479f0f2011-08-18 21:00:44 +05303136
3137#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3138static int __init msm7x27a_init_ar6000pm(void)
3139{
3140 return platform_device_register(&msm_wlan_ar6000_pm_device);
3141}
3142#else
3143static int __init msm7x27a_init_ar6000pm(void) { return 0; }
3144#endif
3145
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003146static void __init msm7x27a_init_regulators(void)
3147{
3148 int rc = platform_device_register(&msm_proccomm_regulator_dev);
3149 if (rc)
3150 pr_err("%s: could not register regulator device: %d\n",
3151 __func__, rc);
3152}
3153
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003154static void __init msm7x2x_init(void)
3155{
Trilok Sonia416c492011-07-22 20:20:23 +05303156 msm7x2x_misc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003157
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003158 /* Initialize regulators first so that other devices can use them */
3159 msm7x27a_init_regulators();
3160
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003161 /* Common functions for SURF/FFA/RUMI3 */
3162 msm_device_i2c_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003163 msm7x27a_init_ebi2();
3164 msm7x27a_cfg_uart2dm_serial();
3165#ifdef CONFIG_SERIAL_MSM_HS
3166 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
3167 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
3168#endif
3169
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003170#ifdef CONFIG_USB_MSM_OTG_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05303171 msm_otg_pdata.swfi_latency =
3172 msm7x27a_pm_data
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003173 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Trilok Soni16f61af2011-07-26 16:06:58 +05303174 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003175#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05303176 msm_device_gadget_peripheral.dev.platform_data =
3177 &msm_gadget_pdata;
3178 msm7x27a_cfg_smsc911x();
3179 platform_add_devices(msm_footswitch_devices,
3180 msm_num_footswitch_devices);
3181 platform_add_devices(surf_ffa_devices,
3182 ARRAY_SIZE(surf_ffa_devices));
Sujith Reddy Thummaad7c9a82011-09-30 20:54:38 +05303183 /* Ensure ar6000pm device is registered before MMC/SDC */
3184 msm7x27a_init_ar6000pm();
3185#ifdef CONFIG_MMC_MSM
3186 msm7x27a_init_mmc();
3187#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05303188 msm_fb_add_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003189#ifdef CONFIG_USB_EHCI_MSM_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05303190 msm7x2x_init_host();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003191#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003192
3193 msm_pm_set_platform_data(msm7x27a_pm_data,
3194 ARRAY_SIZE(msm7x27a_pm_data));
3195
3196#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
3197 register_i2c_devices();
3198#endif
3199#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3200 bt_power_init();
3201#endif
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303202 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003203 atmel_ts_pdata.min_x = 0;
3204 atmel_ts_pdata.max_x = 480;
3205 atmel_ts_pdata.min_y = 0;
3206 atmel_ts_pdata.max_y = 320;
3207 }
3208
3209 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
3210 atmel_ts_i2c_info,
3211 ARRAY_SIZE(atmel_ts_i2c_info));
3212
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05303213#if defined(CONFIG_MSM_CAMERA)
Justin Paupored98328e2011-08-19 13:48:31 -07003214 msm_camera_vreg_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003215 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
3216 i2c_camera_devices,
3217 ARRAY_SIZE(i2c_camera_devices));
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05303218#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003219 platform_device_register(&kp_pdev);
3220 platform_device_register(&hs_pdev);
3221
3222 /* configure it as a pdm function*/
3223 if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3,
3224 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
3225 GPIO_CFG_8MA), GPIO_CFG_ENABLE))
3226 pr_err("%s: gpio_tlmm_config for %d failed\n",
3227 __func__, LED_GPIO_PDM);
3228 else
3229 platform_device_register(&led_pdev);
3230
3231#ifdef CONFIG_MSM_RPC_VIBRATOR
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303232 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003233 msm_init_pmic_vibrator();
3234#endif
3235 /*7x25a kgsl initializations*/
3236 msm7x25a_kgsl_3d0_init();
3237}
3238
3239static void __init msm7x2x_init_early(void)
3240{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003241 msm_msm7x2x_allocate_memory_regions();
3242}
3243
3244MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3")
3245 .boot_params = PHYS_OFFSET + 0x100,
3246 .map_io = msm_common_io_init,
3247 .reserve = msm7x27a_reserve,
3248 .init_irq = msm_init_irq,
Trilok Soni16f61af2011-07-26 16:06:58 +05303249 .init_machine = msm7627a_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003250 .timer = &msm_timer,
3251 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303252 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003253MACHINE_END
3254MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF")
3255 .boot_params = PHYS_OFFSET + 0x100,
3256 .map_io = msm_common_io_init,
3257 .reserve = msm7x27a_reserve,
3258 .init_irq = msm_init_irq,
3259 .init_machine = msm7x2x_init,
3260 .timer = &msm_timer,
3261 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303262 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003263MACHINE_END
3264MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA")
3265 .boot_params = PHYS_OFFSET + 0x100,
3266 .map_io = msm_common_io_init,
3267 .reserve = msm7x27a_reserve,
3268 .init_irq = msm_init_irq,
3269 .init_machine = msm7x2x_init,
3270 .timer = &msm_timer,
3271 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303272 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003273MACHINE_END
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303274MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF")
3275 .boot_params = PHYS_OFFSET + 0x100,
3276 .map_io = msm_common_io_init,
3277 .reserve = msm7x27a_reserve,
3278 .init_irq = msm_init_irq,
3279 .init_machine = msm7x2x_init,
3280 .timer = &msm_timer,
3281 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303282 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303283MACHINE_END
3284MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA")
3285 .boot_params = PHYS_OFFSET + 0x100,
3286 .map_io = msm_common_io_init,
3287 .reserve = msm7x27a_reserve,
3288 .init_irq = msm_init_irq,
3289 .init_machine = msm7x2x_init,
3290 .timer = &msm_timer,
3291 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303292 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303293MACHINE_END