blob: 92879bc7c8b30b6262c20da9a2302391378276b1 [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),
Shashi Kumar64e07602011-10-11 13:18:57 +05301919 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Sidipotu Ashokab34ca42011-07-22 16:34:20 +05301920 SND(CURRENT, 0x7FFFFFFE),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001921 SND(FM_ANALOG_STEREO_HEADSET, 35),
1922 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
1923};
1924#undef SND
1925
1926static struct msm_snd_endpoints msm_device_snd_endpoints = {
1927 .endpoints = snd_endpoints_list,
1928 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
1929};
1930
1931static struct platform_device msm_device_snd = {
1932 .name = "msm_snd",
1933 .id = -1,
1934 .dev = {
1935 .platform_data = &msm_device_snd_endpoints
1936 },
1937};
1938
1939#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1940 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1941 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1942 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1943 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1944 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1945#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1946 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1947 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1948 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1949 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1950 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1951#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1952 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1953 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1954 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1955 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1956 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1957#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1958 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1959 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1960 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1961 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1962 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1963#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
1964
1965static unsigned int dec_concurrency_table[] = {
1966 /* Audio LP */
1967 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
1968 0, 0, 0,
1969
1970 /* Concurrency 1 */
1971 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1972 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1973 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1974 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1975 (DEC4_FORMAT),
1976
1977 /* Concurrency 2 */
1978 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1979 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1980 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1981 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1982 (DEC4_FORMAT),
1983
1984 /* Concurrency 3 */
1985 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1986 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1987 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1988 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1989 (DEC4_FORMAT),
1990
1991 /* Concurrency 4 */
1992 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1993 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1994 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1995 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1996 (DEC4_FORMAT),
1997
1998 /* Concurrency 5 */
1999 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2000 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2001 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2002 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2003 (DEC4_FORMAT),
2004
2005 /* Concurrency 6 */
2006 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2007 0, 0, 0, 0,
2008
2009 /* Concurrency 7 */
2010 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2011 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2012 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2013 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2014 (DEC4_FORMAT),
2015};
2016
2017#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
2018 .module_queueid = queueid, .module_decid = decid, \
2019 .nr_codec_support = nr_codec}
2020
2021static struct msm_adspdec_info dec_info_list[] = {
2022 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
2023 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
2024 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
2025 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
2026 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
2027};
2028
2029static struct msm_adspdec_database msm_device_adspdec_database = {
2030 .num_dec = ARRAY_SIZE(dec_info_list),
2031 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
2032 ARRAY_SIZE(dec_info_list)),
2033 .dec_concurrency_table = dec_concurrency_table,
2034 .dec_info_list = dec_info_list,
2035};
2036
2037static struct platform_device msm_device_adspdec = {
2038 .name = "msm_adspdec",
2039 .id = -1,
2040 .dev = {
2041 .platform_data = &msm_device_adspdec_database
2042 },
2043};
2044
2045static struct android_pmem_platform_data android_pmem_audio_pdata = {
2046 .name = "pmem_audio",
2047 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
2048 .cached = 0,
2049 .memory_type = MEMTYPE_EBI1,
2050};
2051
2052static struct platform_device android_pmem_audio_device = {
2053 .name = "android_pmem",
2054 .id = 2,
2055 .dev = { .platform_data = &android_pmem_audio_pdata },
2056};
2057
2058static struct android_pmem_platform_data android_pmem_pdata = {
2059 .name = "pmem",
2060 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
2061 .cached = 1,
2062 .memory_type = MEMTYPE_EBI1,
2063};
2064static struct platform_device android_pmem_device = {
2065 .name = "android_pmem",
2066 .id = 0,
2067 .dev = { .platform_data = &android_pmem_pdata },
2068};
2069
2070static u32 msm_calculate_batt_capacity(u32 current_voltage);
2071
2072static struct msm_psy_batt_pdata msm_psy_batt_data = {
2073 .voltage_min_design = 2800,
2074 .voltage_max_design = 4300,
2075 .avail_chg_sources = AC_CHG | USB_CHG ,
2076 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
2077 .calculate_capacity = &msm_calculate_batt_capacity,
2078};
2079
2080static u32 msm_calculate_batt_capacity(u32 current_voltage)
2081{
2082 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
2083 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
2084
2085 return (current_voltage - low_voltage) * 100
2086 / (high_voltage - low_voltage);
2087}
2088
2089static struct platform_device msm_batt_device = {
2090 .name = "msm-battery",
2091 .id = -1,
2092 .dev.platform_data = &msm_psy_batt_data,
2093};
2094
2095static struct smsc911x_platform_config smsc911x_config = {
2096 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
2097 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
2098 .flags = SMSC911X_USE_16BIT,
2099};
2100
2101static struct resource smsc911x_resources[] = {
2102 [0] = {
2103 .start = 0x90000000,
2104 .end = 0x90007fff,
2105 .flags = IORESOURCE_MEM,
2106 },
2107 [1] = {
2108 .start = MSM_GPIO_TO_INT(48),
2109 .end = MSM_GPIO_TO_INT(48),
2110 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
2111 },
2112};
2113
2114static struct platform_device smsc911x_device = {
2115 .name = "smsc911x",
2116 .id = 0,
2117 .num_resources = ARRAY_SIZE(smsc911x_resources),
2118 .resource = smsc911x_resources,
2119 .dev = {
2120 .platform_data = &smsc911x_config,
2121 },
2122};
2123
2124static struct msm_gpio smsc911x_gpios[] = {
2125 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
2126 "smsc911x_irq" },
2127 { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
2128 "eth_fifo_sel" },
2129};
2130
2131#define ETH_FIFO_SEL_GPIO 49
2132static void msm7x27a_cfg_smsc911x(void)
2133{
2134 int res;
2135
2136 res = msm_gpios_request_enable(smsc911x_gpios,
2137 ARRAY_SIZE(smsc911x_gpios));
2138 if (res) {
2139 pr_err("%s: unable to enable gpios for SMSC911x\n", __func__);
2140 return;
2141 }
2142
2143 /* ETH_FIFO_SEL */
2144 res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0);
2145 if (res) {
2146 pr_err("%s: unable to get direction for gpio %d\n", __func__,
2147 ETH_FIFO_SEL_GPIO);
2148 msm_gpios_disable_free(smsc911x_gpios,
2149 ARRAY_SIZE(smsc911x_gpios));
2150 return;
2151 }
2152 gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
2153}
2154
2155#ifdef CONFIG_MSM_CAMERA
2156static uint32_t camera_off_gpio_table[] = {
2157 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
2158};
2159
2160static uint32_t camera_on_gpio_table[] = {
2161 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
2162};
2163
2164#ifdef CONFIG_MSM_CAMERA_FLASH
2165static struct msm_camera_sensor_flash_src msm_flash_src = {
Nishant Pandit474f2252011-07-23 23:17:56 +05302166 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
2167 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
2168 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002169};
2170#endif
2171
Justin Paupored98328e2011-08-19 13:48:31 -07002172static struct regulator_bulk_data regs_camera[] = {
2173 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
2174 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2175 { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
2176};
2177
2178static void __init msm_camera_vreg_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002179{
2180 int rc;
2181
Justin Paupored98328e2011-08-19 13:48:31 -07002182 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002183
Justin Paupored98328e2011-08-19 13:48:31 -07002184 if (rc) {
2185 pr_err("%s: could not get regulators: %d\n", __func__, rc);
2186 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002187 }
2188
Justin Paupored98328e2011-08-19 13:48:31 -07002189 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002190
Justin Paupored98328e2011-08-19 13:48:31 -07002191 if (rc) {
2192 pr_err("%s: could not set voltages: %d\n", __func__, rc);
2193 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002194 }
Justin Paupored98328e2011-08-19 13:48:31 -07002195}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002196
Justin Paupored98328e2011-08-19 13:48:31 -07002197static void msm_camera_vreg_config(int vreg_en)
2198{
2199 int rc = vreg_en ?
2200 regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
2201 regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002202
Justin Paupored98328e2011-08-19 13:48:31 -07002203 if (rc)
2204 pr_err("%s: could not %sable regulators: %d\n",
2205 __func__, vreg_en ? "en" : "dis", rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002206}
2207
2208static int config_gpio_table(uint32_t *table, int len)
2209{
2210 int rc = 0, i = 0;
2211
2212 for (i = 0; i < len; i++) {
2213 rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
2214 if (rc) {
2215 pr_err("%s not able to get gpio\n", __func__);
2216 for (i--; i >= 0; i--)
2217 gpio_tlmm_config(camera_off_gpio_table[i],
2218 GPIO_CFG_ENABLE);
2219 break;
2220 }
2221 }
2222 return rc;
2223}
2224
2225static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data;
2226static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data;
2227static int config_camera_on_gpios_rear(void)
2228{
2229 int rc = 0;
2230
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302231 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002232 msm_camera_vreg_config(1);
2233
2234 rc = config_gpio_table(camera_on_gpio_table,
2235 ARRAY_SIZE(camera_on_gpio_table));
2236 if (rc < 0) {
2237 pr_err("%s: CAMSENSOR gpio table request"
2238 "failed\n", __func__);
2239 return rc;
2240 }
2241
2242 return rc;
2243}
2244
2245static void config_camera_off_gpios_rear(void)
2246{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302247 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002248 msm_camera_vreg_config(0);
2249
2250 config_gpio_table(camera_off_gpio_table,
2251 ARRAY_SIZE(camera_off_gpio_table));
2252}
2253
2254static int config_camera_on_gpios_front(void)
2255{
2256 int rc = 0;
2257
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302258 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002259 msm_camera_vreg_config(1);
2260
2261 rc = config_gpio_table(camera_on_gpio_table,
2262 ARRAY_SIZE(camera_on_gpio_table));
2263 if (rc < 0) {
2264 pr_err("%s: CAMSENSOR gpio table request"
2265 "failed\n", __func__);
2266 return rc;
2267 }
2268
2269 return rc;
2270}
2271
2272static void config_camera_off_gpios_front(void)
2273{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302274 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002275 msm_camera_vreg_config(0);
2276
2277 config_gpio_table(camera_off_gpio_table,
2278 ARRAY_SIZE(camera_off_gpio_table));
2279}
2280
2281struct msm_camera_device_platform_data msm_camera_device_data_rear = {
2282 .camera_gpio_on = config_camera_on_gpios_rear,
2283 .camera_gpio_off = config_camera_off_gpios_rear,
2284 .ioext.csiphy = 0xA1000000,
2285 .ioext.csisz = 0x00100000,
2286 .ioext.csiirq = INT_CSI_IRQ_1,
2287 .ioclk.mclk_clk_rate = 24000000,
2288 .ioclk.vfe_clk_rate = 192000000,
2289 .ioext.appphy = MSM_CLK_CTL_PHYS,
2290 .ioext.appsz = MSM_CLK_CTL_SIZE,
2291};
2292
2293struct msm_camera_device_platform_data msm_camera_device_data_front = {
2294 .camera_gpio_on = config_camera_on_gpios_front,
2295 .camera_gpio_off = config_camera_off_gpios_front,
2296 .ioext.csiphy = 0xA0F00000,
2297 .ioext.csisz = 0x00100000,
2298 .ioext.csiirq = INT_CSI_IRQ_0,
2299 .ioclk.mclk_clk_rate = 24000000,
2300 .ioclk.vfe_clk_rate = 192000000,
2301 .ioext.appphy = MSM_CLK_CTL_PHYS,
2302 .ioext.appsz = MSM_CLK_CTL_SIZE,
2303};
2304
2305#ifdef CONFIG_S5K4E1
2306static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = {
2307 .mount_angle = 90
2308};
2309
2310static struct msm_camera_sensor_flash_data flash_s5k4e1 = {
2311 .flash_type = MSM_CAMERA_FLASH_LED,
2312 .flash_src = &msm_flash_src
2313};
2314
2315static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = {
2316 .sensor_name = "s5k4e1",
2317 .sensor_reset_enable = 1,
2318 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N,
2319 .sensor_pwd = 85,
2320 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
2321 .vcm_enable = 1,
2322 .pdata = &msm_camera_device_data_rear,
2323 .flash_data = &flash_s5k4e1,
2324 .sensor_platform_info = &s5k4e1_sensor_7627a_info,
2325 .csi_if = 1
2326};
2327
2328static struct platform_device msm_camera_sensor_s5k4e1 = {
2329 .name = "msm_camera_s5k4e1",
2330 .dev = {
2331 .platform_data = &msm_camera_sensor_s5k4e1_data,
2332 },
2333};
2334#endif
2335
2336#ifdef CONFIG_IMX072
2337static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = {
2338 .mount_angle = 90
2339};
2340
2341static struct msm_camera_sensor_flash_data flash_imx072 = {
2342 .flash_type = MSM_CAMERA_FLASH_LED,
2343 .flash_src = &msm_flash_src
2344};
2345
2346static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = {
2347 .sensor_name = "imx072",
2348 .sensor_reset_enable = 1,
2349 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/
2350 .sensor_pwd = 85,
2351 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
2352 .vcm_enable = 1,
2353 .pdata = &msm_camera_device_data_rear,
2354 .flash_data = &flash_imx072,
2355 .sensor_platform_info = &imx072_sensor_7627a_info,
2356 .csi_if = 1
2357};
2358
2359static struct platform_device msm_camera_sensor_imx072 = {
2360 .name = "msm_camera_imx072",
2361 .dev = {
2362 .platform_data = &msm_camera_sensor_imx072_data,
2363 },
2364};
2365#endif
2366
2367#ifdef CONFIG_WEBCAM_OV9726
2368static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = {
2369 .mount_angle = 90
2370};
2371
2372static struct msm_camera_sensor_flash_data flash_ov9726 = {
2373 .flash_type = MSM_CAMERA_FLASH_NONE,
2374 .flash_src = &msm_flash_src
2375};
2376
2377static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
2378 .sensor_name = "ov9726",
2379 .sensor_reset_enable = 0,
2380 .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR,
2381 .sensor_pwd = 85,
2382 .vcm_pwd = 1,
2383 .vcm_enable = 0,
2384 .pdata = &msm_camera_device_data_front,
2385 .flash_data = &flash_ov9726,
2386 .sensor_platform_info = &ov9726_sensor_7627a_info,
2387 .csi_if = 1
2388};
2389
2390static struct platform_device msm_camera_sensor_ov9726 = {
2391 .name = "msm_camera_ov9726",
2392 .dev = {
2393 .platform_data = &msm_camera_sensor_ov9726_data,
2394 },
2395};
Justin Paupored98328e2011-08-19 13:48:31 -07002396#else
2397static inline void msm_camera_vreg_init(void) { }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002398#endif
2399
2400#ifdef CONFIG_MT9E013
2401static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = {
2402 .mount_angle = 90
2403};
2404
2405static struct msm_camera_sensor_flash_data flash_mt9e013 = {
2406 .flash_type = MSM_CAMERA_FLASH_LED,
2407 .flash_src = &msm_flash_src
2408};
2409
2410static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
2411 .sensor_name = "mt9e013",
2412 .sensor_reset = 0,
2413 .sensor_reset_enable = 1,
2414 .sensor_pwd = 85,
2415 .vcm_pwd = 1,
2416 .vcm_enable = 0,
2417 .pdata = &msm_camera_device_data_rear,
2418 .flash_data = &flash_mt9e013,
2419 .sensor_platform_info = &mt9e013_sensor_7627a_info,
2420 .csi_if = 1
2421};
2422
2423static struct platform_device msm_camera_sensor_mt9e013 = {
2424 .name = "msm_camera_mt9e013",
2425 .dev = {
2426 .platform_data = &msm_camera_sensor_mt9e013_data,
2427 },
2428};
2429#endif
2430
2431static struct i2c_board_info i2c_camera_devices[] = {
2432 #ifdef CONFIG_S5K4E1
2433 {
2434 I2C_BOARD_INFO("s5k4e1", 0x36),
2435 },
2436 {
2437 I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1),
2438 },
2439 #endif
2440 #ifdef CONFIG_WEBCAM_OV9726
2441 {
2442 I2C_BOARD_INFO("ov9726", 0x10),
2443 },
2444 #endif
2445 #ifdef CONFIG_IMX072
2446 {
2447 I2C_BOARD_INFO("imx072", 0x34),
2448 },
2449 #endif
2450 #ifdef CONFIG_MT9E013
2451 {
2452 I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
2453 },
2454 #endif
2455 {
Nishant Pandit474f2252011-07-23 23:17:56 +05302456 I2C_BOARD_INFO("sc628a", 0x6E),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002457 },
2458};
2459#endif
2460#if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \
2461 && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM)
2462static struct msm_gpio uart2dm_gpios[] = {
2463 {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2464 "uart2dm_rfr_n" },
2465 {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2466 "uart2dm_cts_n" },
2467 {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2468 "uart2dm_rx" },
2469 {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2470 "uart2dm_tx" },
2471};
2472
2473static void msm7x27a_cfg_uart2dm_serial(void)
2474{
2475 int ret;
2476 ret = msm_gpios_request_enable(uart2dm_gpios,
2477 ARRAY_SIZE(uart2dm_gpios));
2478 if (ret)
2479 pr_err("%s: unable to enable gpios for uart2dm\n", __func__);
2480}
2481#else
2482static void msm7x27a_cfg_uart2dm_serial(void) { }
2483#endif
2484
2485static struct platform_device *rumi_sim_devices[] __initdata = {
2486 &msm_device_dmov,
2487 &msm_device_smd,
2488 &smc91x_device,
2489 &msm_device_uart1,
2490 &msm_device_nand,
2491 &msm_device_uart_dm1,
2492 &msm_gsbi0_qup_i2c_device,
2493 &msm_gsbi1_qup_i2c_device,
2494};
2495
2496static struct platform_device *surf_ffa_devices[] __initdata = {
2497 &msm_device_dmov,
2498 &msm_device_smd,
2499 &msm_device_uart1,
2500 &msm_device_uart_dm1,
2501 &msm_device_uart_dm2,
2502 &msm_device_nand,
2503 &msm_gsbi0_qup_i2c_device,
2504 &msm_gsbi1_qup_i2c_device,
2505 &msm_device_otg,
2506 &msm_device_gadget_peripheral,
2507 &android_usb_device,
2508 &android_pmem_device,
2509 &android_pmem_adsp_device,
2510 &android_pmem_audio_device,
2511 &msm_device_snd,
2512 &msm_device_adspdec,
2513 &msm_fb_device,
2514 &lcdc_toshiba_panel_device,
2515 &msm_batt_device,
2516 &smsc911x_device,
2517#ifdef CONFIG_S5K4E1
2518 &msm_camera_sensor_s5k4e1,
2519#endif
2520#ifdef CONFIG_IMX072
2521 &msm_camera_sensor_imx072,
2522#endif
2523#ifdef CONFIG_WEBCAM_OV9726
2524 &msm_camera_sensor_ov9726,
2525#endif
2526#ifdef CONFIG_MT9E013
2527 &msm_camera_sensor_mt9e013,
2528#endif
2529#ifdef CONFIG_FB_MSM_MIPI_DSI
2530 &mipi_dsi_renesas_panel_device,
2531#endif
2532 &msm_kgsl_3d0,
2533#ifdef CONFIG_BT
2534 &msm_bt_power_device,
2535#endif
Manish Dewangan3a260992011-06-24 18:01:34 +05302536 &asoc_msm_pcm,
2537 &asoc_msm_dai0,
2538 &asoc_msm_dai1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002539};
2540
2541static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
2542static int __init pmem_kernel_ebi1_size_setup(char *p)
2543{
2544 pmem_kernel_ebi1_size = memparse(p, NULL);
2545 return 0;
2546}
2547early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
2548
2549static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
2550static int __init pmem_audio_size_setup(char *p)
2551{
2552 pmem_audio_size = memparse(p, NULL);
2553 return 0;
2554}
2555early_param("pmem_audio_size", pmem_audio_size_setup);
2556
2557static void __init msm_msm7x2x_allocate_memory_regions(void)
2558{
2559 void *addr;
2560 unsigned long size;
2561
2562 size = fb_size ? : MSM_FB_SIZE;
2563 addr = alloc_bootmem_align(size, 0x1000);
2564 msm_fb_resources[0].start = __pa(addr);
2565 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2566 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2567 size, addr, __pa(addr));
2568}
2569
2570static struct memtype_reserve msm7x27a_reserve_table[] __initdata = {
2571 [MEMTYPE_SMI] = {
2572 },
2573 [MEMTYPE_EBI0] = {
2574 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2575 },
2576 [MEMTYPE_EBI1] = {
2577 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2578 },
2579};
2580
2581static void __init size_pmem_devices(void)
2582{
2583#ifdef CONFIG_ANDROID_PMEM
2584 android_pmem_adsp_pdata.size = pmem_adsp_size;
2585 android_pmem_pdata.size = pmem_mdp_size;
2586 android_pmem_audio_pdata.size = pmem_audio_size;
2587#endif
2588}
2589
2590static void __init reserve_memory_for(struct android_pmem_platform_data *p)
2591{
2592 msm7x27a_reserve_table[p->memory_type].size += p->size;
2593}
2594
2595static void __init reserve_pmem_memory(void)
2596{
2597#ifdef CONFIG_ANDROID_PMEM
2598 reserve_memory_for(&android_pmem_adsp_pdata);
2599 reserve_memory_for(&android_pmem_pdata);
2600 reserve_memory_for(&android_pmem_audio_pdata);
2601 msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
2602#endif
2603}
2604
2605static void __init msm7x27a_calculate_reserve_sizes(void)
2606{
2607 size_pmem_devices();
2608 reserve_pmem_memory();
2609}
2610
2611static int msm7x27a_paddr_to_memtype(unsigned int paddr)
2612{
2613 return MEMTYPE_EBI1;
2614}
2615
2616static struct reserve_info msm7x27a_reserve_info __initdata = {
2617 .memtype_reserve_table = msm7x27a_reserve_table,
2618 .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes,
2619 .paddr_to_memtype = msm7x27a_paddr_to_memtype,
2620};
2621
2622static void __init msm7x27a_reserve(void)
2623{
2624 reserve_info = &msm7x27a_reserve_info;
2625 msm_reserve();
2626}
2627
2628static void __init msm_device_i2c_init(void)
2629{
2630 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
2631 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
2632}
2633
2634static struct msm_panel_common_pdata mdp_pdata = {
2635 .gpio = 97,
2636 .mdp_rev = MDP_REV_303,
2637};
2638
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302639
2640#ifdef CONFIG_FB_MSM
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002641#define GPIO_LCDC_BRDG_PD 128
2642#define GPIO_LCDC_BRDG_RESET_N 129
2643
2644#define LCDC_RESET_PHYS 0x90008014
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302645
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002646static void __iomem *lcdc_reset_ptr;
2647
2648static unsigned mipi_dsi_gpio[] = {
2649 GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
2650 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2651 GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
2652 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2653};
2654
2655enum {
2656 DSI_SINGLE_LANE = 1,
2657 DSI_TWO_LANES,
2658};
2659
2660static int msm_fb_get_lane_config(void)
2661{
2662 int rc = DSI_TWO_LANES;
2663
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302664 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002665 rc = DSI_SINGLE_LANE;
2666 pr_info("DSI Single Lane\n");
2667 } else {
2668 pr_info("DSI Two Lanes\n");
2669 }
2670 return rc;
2671}
2672
2673static int msm_fb_dsi_client_reset(void)
2674{
2675 int rc = 0;
2676
2677 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
2678 if (rc < 0) {
2679 pr_err("failed to request lcd brdg reset_n\n");
2680 return rc;
2681 }
2682
2683 rc = gpio_request(GPIO_LCDC_BRDG_PD, "lcdc_brdg_pd");
2684 if (rc < 0) {
2685 pr_err("failed to request lcd brdg pd\n");
2686 return rc;
2687 }
2688
2689 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
2690 if (rc) {
2691 pr_err("Failed to enable LCDC Bridge reset enable\n");
2692 goto gpio_error;
2693 }
2694
2695 rc = gpio_tlmm_config(mipi_dsi_gpio[1], GPIO_CFG_ENABLE);
2696 if (rc) {
2697 pr_err("Failed to enable LCDC Bridge pd enable\n");
2698 goto gpio_error2;
2699 }
2700
2701 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
2702 rc |= gpio_direction_output(GPIO_LCDC_BRDG_PD, 1);
2703 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
2704
2705 if (!rc) {
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302706 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002707 lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS,
2708 sizeof(uint32_t));
2709
2710 if (!lcdc_reset_ptr)
2711 return 0;
2712 }
2713 return rc;
2714 } else {
2715 goto gpio_error;
2716 }
2717
2718gpio_error2:
2719 pr_err("Failed GPIO bridge pd\n");
2720 gpio_free(GPIO_LCDC_BRDG_PD);
2721
2722gpio_error:
2723 pr_err("Failed GPIO bridge reset\n");
2724 gpio_free(GPIO_LCDC_BRDG_RESET_N);
2725 return rc;
2726}
2727
Justin Paupored98328e2011-08-19 13:48:31 -07002728static struct regulator_bulk_data regs_dsi[] = {
2729 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2730 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002731};
2732
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002733static int dsi_gpio_initialized;
2734
2735static int mipi_dsi_panel_power(int on)
2736{
Justin Paupored98328e2011-08-19 13:48:31 -07002737 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002738 uint32_t lcdc_reset_cfg;
2739
2740 /* I2C-controlled GPIO Expander -init of the GPIOs very late */
Justin Paupored98328e2011-08-19 13:48:31 -07002741 if (unlikely(!dsi_gpio_initialized)) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002742 pmapp_disp_backlight_init();
2743
2744 rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr");
2745 if (rc < 0) {
2746 pr_err("failed to request gpio_disp_pwr\n");
2747 return rc;
2748 }
2749
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302750 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002751 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1);
2752 if (rc < 0) {
2753 pr_err("failed to enable display pwr\n");
2754 goto fail_gpio1;
2755 }
2756
2757 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
2758 if (rc < 0) {
2759 pr_err("failed to request gpio_bkl_en\n");
2760 goto fail_gpio1;
2761 }
2762
2763 rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
2764 if (rc < 0) {
2765 pr_err("failed to enable backlight\n");
2766 goto fail_gpio2;
2767 }
2768 }
2769
Justin Paupored98328e2011-08-19 13:48:31 -07002770 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
2771 if (rc) {
2772 pr_err("%s: could not get regulators: %d\n",
2773 __func__, rc);
2774 goto fail_gpio2;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002775 }
Justin Paupored98328e2011-08-19 13:48:31 -07002776
2777 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi);
2778 if (rc) {
2779 pr_err("%s: could not set voltages: %d\n",
2780 __func__, rc);
2781 goto fail_vreg;
2782 }
2783
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002784 dsi_gpio_initialized = 1;
2785 }
2786
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302787 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07002788 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
2789 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302790 } else if (machine_is_msm7x27a_ffa() ||
2791 machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002792 if (on) {
Justin Paupored98328e2011-08-19 13:48:31 -07002793 /* This line drives an active low pin on FFA */
2794 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on);
2795 if (rc < 0)
2796 pr_err("failed to set direction for "
2797 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002798 } else {
Justin Paupored98328e2011-08-19 13:48:31 -07002799 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on);
2800 rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN);
2801 if (rc < 0)
2802 pr_err("failed to set direction for "
2803 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002804 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002805 }
2806
Justin Paupored98328e2011-08-19 13:48:31 -07002807 if (on) {
2808 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
2809
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302810 if (machine_is_msm7x27a_surf() ||
2811 machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07002812 lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr);
2813 rmb();
2814 lcdc_reset_cfg &= ~1;
2815
2816 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
2817 msleep(20);
2818 wmb();
2819 lcdc_reset_cfg |= 1;
2820 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
2821 } else {
2822 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
2823 msleep(20);
2824 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
2825 }
2826
2827 if (pmapp_disp_backlight_set_brightness(100))
2828 pr_err("backlight set brightness failed\n");
2829 } else {
2830 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1);
2831
2832 if (pmapp_disp_backlight_set_brightness(0))
2833 pr_err("backlight set brightness failed\n");
2834 }
2835
2836 rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) :
2837 regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi);
2838
2839 if (rc)
2840 pr_err("%s: could not %sable regulators: %d\n",
2841 __func__, on ? "en" : "dis", rc);
2842
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002843 return rc;
2844
Justin Paupored98328e2011-08-19 13:48:31 -07002845fail_vreg:
2846 regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002847fail_gpio2:
2848 gpio_free(GPIO_BACKLIGHT_EN);
2849fail_gpio1:
2850 gpio_free(GPIO_DISPLAY_PWR_EN);
2851 dsi_gpio_initialized = 0;
2852 return rc;
2853}
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302854#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002855
2856#define MDP_303_VSYNC_GPIO 97
2857
2858#ifdef CONFIG_FB_MSM_MDP303
2859static struct mipi_dsi_platform_data mipi_dsi_pdata = {
2860 .vsync_gpio = MDP_303_VSYNC_GPIO,
2861 .dsi_power_save = mipi_dsi_panel_power,
2862 .dsi_client_reset = msm_fb_dsi_client_reset,
2863 .get_lane_config = msm_fb_get_lane_config,
2864};
2865#endif
2866
2867static void __init msm_fb_add_devices(void)
2868{
2869 msm_fb_register_device("mdp", &mdp_pdata);
2870 msm_fb_register_device("lcdc", &lcdc_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302871#ifdef CONFIG_FB_MSM_MDP303
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002872 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302873#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002874}
2875
2876#define MSM_EBI2_PHYS 0xa0d00000
2877#define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030
2878
2879static void __init msm7x27a_init_ebi2(void)
2880{
2881 uint32_t ebi2_cfg;
2882 void __iomem *ebi2_cfg_ptr;
2883
2884 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t));
2885 if (!ebi2_cfg_ptr)
2886 return;
2887
2888 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302889 if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() ||
2890 machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002891 ebi2_cfg |= (1 << 4); /* CS2 */
2892
2893 writel(ebi2_cfg, ebi2_cfg_ptr);
2894 iounmap(ebi2_cfg_ptr);
2895
2896 /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */
2897 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1,
2898 sizeof(uint32_t));
2899 if (!ebi2_cfg_ptr)
2900 return;
2901
2902 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302903 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002904 ebi2_cfg |= (1 << 31);
2905
2906 writel(ebi2_cfg, ebi2_cfg_ptr);
2907 iounmap(ebi2_cfg_ptr);
2908}
2909
2910#define ATMEL_TS_I2C_NAME "maXTouch"
Justin Paupored98328e2011-08-19 13:48:31 -07002911
2912static struct regulator_bulk_data regs_atmel[] = {
2913 { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 },
2914 { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 },
2915};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002916
2917#define ATMEL_TS_GPIO_IRQ 82
2918
2919static int atmel_ts_power_on(bool on)
2920{
Justin Paupored98328e2011-08-19 13:48:31 -07002921 int rc = on ?
2922 regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) :
2923 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002924
Justin Paupored98328e2011-08-19 13:48:31 -07002925 if (rc)
2926 pr_err("%s: could not %sable regulators: %d\n",
2927 __func__, on ? "en" : "dis", rc);
2928 else
2929 msleep(50);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002930
Justin Paupored98328e2011-08-19 13:48:31 -07002931 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002932}
2933
2934static int atmel_ts_platform_init(struct i2c_client *client)
2935{
2936 int rc;
Justin Paupored98328e2011-08-19 13:48:31 -07002937 struct device *dev = &client->dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002938
Justin Paupored98328e2011-08-19 13:48:31 -07002939 rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002940 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002941 dev_err(dev, "%s: could not get regulators: %d\n",
2942 __func__, rc);
2943 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002944 }
2945
Justin Paupored98328e2011-08-19 13:48:31 -07002946 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002947 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002948 dev_err(dev, "%s: could not set voltages: %d\n",
2949 __func__, rc);
2950 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002951 }
2952
2953 rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2954 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
2955 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
2956 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002957 dev_err(dev, "%s: gpio_tlmm_config for %d failed\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002958 __func__, ATMEL_TS_GPIO_IRQ);
Justin Paupored98328e2011-08-19 13:48:31 -07002959 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002960 }
2961
2962 /* configure touchscreen interrupt gpio */
2963 rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio");
2964 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002965 dev_err(dev, "%s: unable to request gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002966 __func__, ATMEL_TS_GPIO_IRQ);
2967 goto ts_gpio_tlmm_unconfig;
2968 }
2969
2970 rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ);
2971 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -07002972 dev_err(dev, "%s: unable to set the direction of gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002973 __func__, ATMEL_TS_GPIO_IRQ);
2974 goto free_ts_gpio;
2975 }
2976 return 0;
2977
2978free_ts_gpio:
2979 gpio_free(ATMEL_TS_GPIO_IRQ);
2980ts_gpio_tlmm_unconfig:
2981 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2982 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
2983 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07002984reg_free:
2985 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
2986out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002987 return rc;
2988}
2989
2990static int atmel_ts_platform_exit(struct i2c_client *client)
2991{
2992 gpio_free(ATMEL_TS_GPIO_IRQ);
2993 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2994 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
2995 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07002996 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
2997 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002998 return 0;
2999}
3000
3001static u8 atmel_ts_read_chg(void)
3002{
3003 return gpio_get_value(ATMEL_TS_GPIO_IRQ);
3004}
3005
3006static u8 atmel_ts_valid_interrupt(void)
3007{
3008 return !atmel_ts_read_chg();
3009}
3010
3011#define ATMEL_X_OFFSET 13
3012#define ATMEL_Y_OFFSET 0
3013
3014static struct mxt_platform_data atmel_ts_pdata = {
3015 .numtouch = 4,
3016 .init_platform_hw = atmel_ts_platform_init,
3017 .exit_platform_hw = atmel_ts_platform_exit,
3018 .power_on = atmel_ts_power_on,
3019 .display_res_x = 480,
3020 .display_res_y = 864,
3021 .min_x = ATMEL_X_OFFSET,
3022 .max_x = (505 - ATMEL_X_OFFSET),
3023 .min_y = ATMEL_Y_OFFSET,
3024 .max_y = (863 - ATMEL_Y_OFFSET),
3025 .valid_interrupt = atmel_ts_valid_interrupt,
3026 .read_chg = atmel_ts_read_chg,
3027};
3028
3029static struct i2c_board_info atmel_ts_i2c_info[] __initdata = {
3030 {
3031 I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a),
3032 .platform_data = &atmel_ts_pdata,
3033 .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ),
3034 },
3035};
3036
3037#define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col))
3038
3039static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35};
3040static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40};
3041
3042static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) *
3043 ARRAY_SIZE(kp_row_gpios)] = {
3044 [KP_INDEX(0, 0)] = KEY_7,
3045 [KP_INDEX(0, 1)] = KEY_DOWN,
3046 [KP_INDEX(0, 2)] = KEY_UP,
3047 [KP_INDEX(0, 3)] = KEY_RIGHT,
3048 [KP_INDEX(0, 4)] = KEY_ENTER,
3049
3050 [KP_INDEX(1, 0)] = KEY_LEFT,
3051 [KP_INDEX(1, 1)] = KEY_SEND,
3052 [KP_INDEX(1, 2)] = KEY_1,
3053 [KP_INDEX(1, 3)] = KEY_4,
3054 [KP_INDEX(1, 4)] = KEY_CLEAR,
3055
3056 [KP_INDEX(2, 0)] = KEY_6,
3057 [KP_INDEX(2, 1)] = KEY_5,
3058 [KP_INDEX(2, 2)] = KEY_8,
3059 [KP_INDEX(2, 3)] = KEY_3,
3060 [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR,
3061
3062 [KP_INDEX(3, 0)] = KEY_9,
3063 [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND,
3064 [KP_INDEX(3, 2)] = KEY_0,
3065 [KP_INDEX(3, 3)] = KEY_2,
3066 [KP_INDEX(3, 4)] = KEY_SLEEP,
3067
3068 [KP_INDEX(4, 0)] = KEY_BACK,
3069 [KP_INDEX(4, 1)] = KEY_HOME,
3070 [KP_INDEX(4, 2)] = KEY_MENU,
3071 [KP_INDEX(4, 3)] = KEY_VOLUMEUP,
3072 [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN,
3073};
3074
3075/* SURF keypad platform device information */
3076static struct gpio_event_matrix_info kp_matrix_info = {
3077 .info.func = gpio_event_matrix_func,
3078 .keymap = keymap,
3079 .output_gpios = kp_row_gpios,
3080 .input_gpios = kp_col_gpios,
3081 .noutputs = ARRAY_SIZE(kp_row_gpios),
3082 .ninputs = ARRAY_SIZE(kp_col_gpios),
3083 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
3084 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
3085 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
3086 GPIOKPF_PRINT_UNMAPPED_KEYS,
3087};
3088
3089static struct gpio_event_info *kp_info[] = {
3090 &kp_matrix_info.info
3091};
3092
3093static struct gpio_event_platform_data kp_pdata = {
3094 .name = "7x27a_kp",
3095 .info = kp_info,
3096 .info_count = ARRAY_SIZE(kp_info)
3097};
3098
3099static struct platform_device kp_pdev = {
3100 .name = GPIO_EVENT_DEV_NAME,
3101 .id = -1,
3102 .dev = {
3103 .platform_data = &kp_pdata,
3104 },
3105};
3106
3107static struct msm_handset_platform_data hs_platform_data = {
3108 .hs_name = "7k_handset",
3109 .pwr_key_delay_ms = 500, /* 0 will disable end key */
3110};
3111
3112static struct platform_device hs_pdev = {
3113 .name = "msm-handset",
3114 .id = -1,
3115 .dev = {
3116 .platform_data = &hs_platform_data,
3117 },
3118};
3119
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003120static struct platform_device msm_proccomm_regulator_dev = {
3121 .name = PROCCOMM_REGULATOR_DEV_NAME,
3122 .id = -1,
3123 .dev = {
3124 .platform_data = &msm7x27a_proccomm_regulator_data
3125 }
3126};
3127
Trilok Soni16f61af2011-07-26 16:06:58 +05303128static void __init msm7627a_rumi3_init(void)
3129{
3130 msm7x27a_init_ebi2();
3131 platform_add_devices(rumi_sim_devices,
3132 ARRAY_SIZE(rumi_sim_devices));
3133}
3134
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003135#define LED_GPIO_PDM 96
3136#define UART1DM_RX_GPIO 45
Santosh Sajjanb479f0f2011-08-18 21:00:44 +05303137
3138#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3139static int __init msm7x27a_init_ar6000pm(void)
3140{
3141 return platform_device_register(&msm_wlan_ar6000_pm_device);
3142}
3143#else
3144static int __init msm7x27a_init_ar6000pm(void) { return 0; }
3145#endif
3146
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003147static void __init msm7x27a_init_regulators(void)
3148{
3149 int rc = platform_device_register(&msm_proccomm_regulator_dev);
3150 if (rc)
3151 pr_err("%s: could not register regulator device: %d\n",
3152 __func__, rc);
3153}
3154
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003155static void __init msm7x2x_init(void)
3156{
Trilok Sonia416c492011-07-22 20:20:23 +05303157 msm7x2x_misc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003158
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003159 /* Initialize regulators first so that other devices can use them */
3160 msm7x27a_init_regulators();
3161
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003162 /* Common functions for SURF/FFA/RUMI3 */
3163 msm_device_i2c_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003164 msm7x27a_init_ebi2();
3165 msm7x27a_cfg_uart2dm_serial();
3166#ifdef CONFIG_SERIAL_MSM_HS
3167 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
3168 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
3169#endif
3170
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003171#ifdef CONFIG_USB_MSM_OTG_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05303172 msm_otg_pdata.swfi_latency =
3173 msm7x27a_pm_data
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003174 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Trilok Soni16f61af2011-07-26 16:06:58 +05303175 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003176#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05303177 msm_device_gadget_peripheral.dev.platform_data =
3178 &msm_gadget_pdata;
3179 msm7x27a_cfg_smsc911x();
3180 platform_add_devices(msm_footswitch_devices,
3181 msm_num_footswitch_devices);
3182 platform_add_devices(surf_ffa_devices,
3183 ARRAY_SIZE(surf_ffa_devices));
Sujith Reddy Thummaad7c9a82011-09-30 20:54:38 +05303184 /* Ensure ar6000pm device is registered before MMC/SDC */
3185 msm7x27a_init_ar6000pm();
3186#ifdef CONFIG_MMC_MSM
3187 msm7x27a_init_mmc();
3188#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05303189 msm_fb_add_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003190#ifdef CONFIG_USB_EHCI_MSM_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05303191 msm7x2x_init_host();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003192#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003193
3194 msm_pm_set_platform_data(msm7x27a_pm_data,
3195 ARRAY_SIZE(msm7x27a_pm_data));
3196
3197#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
3198 register_i2c_devices();
3199#endif
3200#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3201 bt_power_init();
3202#endif
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303203 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003204 atmel_ts_pdata.min_x = 0;
3205 atmel_ts_pdata.max_x = 480;
3206 atmel_ts_pdata.min_y = 0;
3207 atmel_ts_pdata.max_y = 320;
3208 }
3209
3210 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
3211 atmel_ts_i2c_info,
3212 ARRAY_SIZE(atmel_ts_i2c_info));
3213
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05303214#if defined(CONFIG_MSM_CAMERA)
Justin Paupored98328e2011-08-19 13:48:31 -07003215 msm_camera_vreg_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003216 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
3217 i2c_camera_devices,
3218 ARRAY_SIZE(i2c_camera_devices));
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05303219#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003220 platform_device_register(&kp_pdev);
3221 platform_device_register(&hs_pdev);
3222
3223 /* configure it as a pdm function*/
3224 if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3,
3225 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
3226 GPIO_CFG_8MA), GPIO_CFG_ENABLE))
3227 pr_err("%s: gpio_tlmm_config for %d failed\n",
3228 __func__, LED_GPIO_PDM);
3229 else
3230 platform_device_register(&led_pdev);
3231
3232#ifdef CONFIG_MSM_RPC_VIBRATOR
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303233 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003234 msm_init_pmic_vibrator();
3235#endif
3236 /*7x25a kgsl initializations*/
3237 msm7x25a_kgsl_3d0_init();
3238}
3239
3240static void __init msm7x2x_init_early(void)
3241{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003242 msm_msm7x2x_allocate_memory_regions();
3243}
3244
3245MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3")
3246 .boot_params = PHYS_OFFSET + 0x100,
3247 .map_io = msm_common_io_init,
3248 .reserve = msm7x27a_reserve,
3249 .init_irq = msm_init_irq,
Trilok Soni16f61af2011-07-26 16:06:58 +05303250 .init_machine = msm7627a_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003251 .timer = &msm_timer,
3252 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303253 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003254MACHINE_END
3255MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF")
3256 .boot_params = PHYS_OFFSET + 0x100,
3257 .map_io = msm_common_io_init,
3258 .reserve = msm7x27a_reserve,
3259 .init_irq = msm_init_irq,
3260 .init_machine = msm7x2x_init,
3261 .timer = &msm_timer,
3262 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303263 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003264MACHINE_END
3265MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA")
3266 .boot_params = PHYS_OFFSET + 0x100,
3267 .map_io = msm_common_io_init,
3268 .reserve = msm7x27a_reserve,
3269 .init_irq = msm_init_irq,
3270 .init_machine = msm7x2x_init,
3271 .timer = &msm_timer,
3272 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303273 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003274MACHINE_END
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303275MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF")
3276 .boot_params = PHYS_OFFSET + 0x100,
3277 .map_io = msm_common_io_init,
3278 .reserve = msm7x27a_reserve,
3279 .init_irq = msm_init_irq,
3280 .init_machine = msm7x2x_init,
3281 .timer = &msm_timer,
3282 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303283 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303284MACHINE_END
3285MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA")
3286 .boot_params = PHYS_OFFSET + 0x100,
3287 .map_io = msm_common_io_init,
3288 .reserve = msm7x27a_reserve,
3289 .init_irq = msm_init_irq,
3290 .init_machine = msm7x2x_init,
3291 .timer = &msm_timer,
3292 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303293 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303294MACHINE_END