blob: 56c135ddc06db14e4ffdf366ad4c5139695d04f4 [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>
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060056#include "pm-boot.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057
58#define PMEM_KERNEL_EBI1_SIZE 0x3A000
59#define MSM_PMEM_AUDIO_SIZE 0x5B000
60#define BAHAMA_SLAVE_ID_FM_ADDR 0x2A
61#define BAHAMA_SLAVE_ID_QMEMBIST_ADDR 0x7B
Rahul Kashyap181d5552011-07-07 10:39:23 +053062#define BAHAMA_SLAVE_ID_FM_REG 0x02
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#define FM_GPIO 83
64
65enum {
66 GPIO_EXPANDER_IRQ_BASE = NR_MSM_IRQS + NR_GPIO_IRQS,
67 GPIO_EXPANDER_GPIO_BASE = NR_MSM_GPIOS,
68 /* SURF expander */
69 GPIO_CORE_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
70 GPIO_BT_SYS_REST_EN = GPIO_CORE_EXPANDER_BASE,
71 GPIO_WLAN_EXT_POR_N,
72 GPIO_DISPLAY_PWR_EN,
73 GPIO_BACKLIGHT_EN,
74 GPIO_PRESSURE_XCLR,
75 GPIO_VREG_S3_EXP,
76 GPIO_UBM2M_PWRDWN,
77 GPIO_ETM_MODE_CS_N,
78 GPIO_HOST_VBUS_EN,
79 GPIO_SPI_MOSI,
80 GPIO_SPI_MISO,
81 GPIO_SPI_CLK,
82 GPIO_SPI_CS0_N,
83 GPIO_CORE_EXPANDER_IO13,
84 GPIO_CORE_EXPANDER_IO14,
85 GPIO_CORE_EXPANDER_IO15,
86 /* Camera expander */
87 GPIO_CAM_EXPANDER_BASE = GPIO_CORE_EXPANDER_BASE + 16,
88 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
89 GPIO_CAM_GP_AFBUSY,
90 GPIO_CAM_GP_CAM_PWDN,
91 GPIO_CAM_GP_CAM1MP_XCLR,
92 GPIO_CAM_GP_CAMIF_RESET_N,
93 GPIO_CAM_GP_STROBE_CE,
94 GPIO_CAM_GP_LED_EN1,
95 GPIO_CAM_GP_LED_EN2,
96};
97
98#if defined(CONFIG_GPIO_SX150X)
99enum {
100 SX150X_CORE,
101 SX150X_CAM,
102};
103
104static struct sx150x_platform_data sx150x_data[] __initdata = {
105 [SX150X_CORE] = {
106 .gpio_base = GPIO_CORE_EXPANDER_BASE,
107 .oscio_is_gpo = false,
108 .io_pullup_ena = 0,
pankaj kumarc5c01392011-08-12 13:44:05 +0530109 .io_pulldn_ena = 0x02,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700110 .io_open_drain_ena = 0xfef8,
111 .irq_summary = -1,
112 },
113 [SX150X_CAM] = {
114 .gpio_base = GPIO_CAM_EXPANDER_BASE,
115 .oscio_is_gpo = false,
116 .io_pullup_ena = 0,
117 .io_pulldn_ena = 0,
118 .io_open_drain_ena = 0x23,
119 .irq_summary = -1,
120 },
121};
122#endif
123
124#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
125
126 /* FM Platform power and shutdown routines */
127#define FPGA_MSM_CNTRL_REG2 0x90008010
Rahul Kashyap6e669462011-07-23 16:42:56 +0530128
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700129static void config_pcm_i2s_mode(int mode)
130{
131 void __iomem *cfg_ptr;
132 u8 reg2;
133
134 cfg_ptr = ioremap_nocache(FPGA_MSM_CNTRL_REG2, sizeof(char));
135
136 if (!cfg_ptr)
137 return;
138 if (mode) {
139 /*enable the pcm mode in FPGA*/
140 reg2 = readb_relaxed(cfg_ptr);
141 if (reg2 == 0) {
142 reg2 = 1;
143 writeb_relaxed(reg2, cfg_ptr);
144 }
145 } else {
146 /*enable i2s mode in FPGA*/
147 reg2 = readb_relaxed(cfg_ptr);
148 if (reg2 == 1) {
149 reg2 = 0;
150 writeb_relaxed(reg2, cfg_ptr);
151 }
152 }
153 iounmap(cfg_ptr);
154}
155
156static unsigned fm_i2s_config_power_on[] = {
157 /*FM_I2S_SD*/
158 GPIO_CFG(68, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
159 /*FM_I2S_WS*/
160 GPIO_CFG(70, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
161 /*FM_I2S_SCK*/
162 GPIO_CFG(71, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
163};
164
165static unsigned fm_i2s_config_power_off[] = {
166 /*FM_I2S_SD*/
167 GPIO_CFG(68, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
168 /*FM_I2S_WS*/
169 GPIO_CFG(70, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
170 /*FM_I2S_SCK*/
171 GPIO_CFG(71, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
172};
173
174static unsigned bt_config_power_on[] = {
175 /*RFR*/
176 GPIO_CFG(43, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
177 /*CTS*/
178 GPIO_CFG(44, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
179 /*RX*/
180 GPIO_CFG(45, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
181 /*TX*/
182 GPIO_CFG(46, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
183};
184static unsigned bt_config_pcm_on[] = {
185 /*PCM_DOUT*/
186 GPIO_CFG(68, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
187 /*PCM_DIN*/
188 GPIO_CFG(69, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
189 /*PCM_SYNC*/
190 GPIO_CFG(70, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
191 /*PCM_CLK*/
192 GPIO_CFG(71, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
193};
194static unsigned bt_config_power_off[] = {
195 /*RFR*/
196 GPIO_CFG(43, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
197 /*CTS*/
198 GPIO_CFG(44, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
199 /*RX*/
200 GPIO_CFG(45, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
201 /*TX*/
202 GPIO_CFG(46, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
203};
204static unsigned bt_config_pcm_off[] = {
205 /*PCM_DOUT*/
206 GPIO_CFG(68, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
207 /*PCM_DIN*/
208 GPIO_CFG(69, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
209 /*PCM_SYNC*/
210 GPIO_CFG(70, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
211 /*PCM_CLK*/
212 GPIO_CFG(71, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
213};
214
215static int config_i2s(int mode)
216{
217 int pin, rc = 0;
218
219 if (mode == FM_I2S_ON) {
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530220 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700221 config_pcm_i2s_mode(0);
222 pr_err("%s mode = FM_I2S_ON", __func__);
223 for (pin = 0; pin < ARRAY_SIZE(fm_i2s_config_power_on);
224 pin++) {
225 rc = gpio_tlmm_config(
226 fm_i2s_config_power_on[pin],
227 GPIO_CFG_ENABLE
228 );
229 if (rc < 0)
230 return rc;
231 }
232 } else if (mode == FM_I2S_OFF) {
233 pr_err("%s mode = FM_I2S_OFF", __func__);
234 for (pin = 0; pin < ARRAY_SIZE(fm_i2s_config_power_off);
235 pin++) {
236 rc = gpio_tlmm_config(
237 fm_i2s_config_power_off[pin],
238 GPIO_CFG_ENABLE
239 );
240 if (rc < 0)
241 return rc;
242 }
243 }
244 return rc;
245}
246static int config_pcm(int mode)
247{
248 int pin, rc = 0;
249
250 if (mode == BT_PCM_ON) {
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530251 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700252 config_pcm_i2s_mode(1);
253 pr_err("%s mode =BT_PCM_ON", __func__);
254 for (pin = 0; pin < ARRAY_SIZE(bt_config_pcm_on);
255 pin++) {
256 rc = gpio_tlmm_config(bt_config_pcm_on[pin],
257 GPIO_CFG_ENABLE);
258 if (rc < 0)
259 return rc;
260 }
261 } else if (mode == BT_PCM_OFF) {
262 pr_err("%s mode =BT_PCM_OFF", __func__);
263 for (pin = 0; pin < ARRAY_SIZE(bt_config_pcm_off);
264 pin++) {
265 rc = gpio_tlmm_config(bt_config_pcm_off[pin],
266 GPIO_CFG_ENABLE);
267 if (rc < 0)
268 return rc;
269 }
270
271 }
272
273 return rc;
274}
275
276static int msm_bahama_setup_pcm_i2s(int mode)
277{
278 int fm_state = 0, bt_state = 0;
279 int rc = 0;
280 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
281
282 fm_state = marimba_get_fm_status(&config);
283 bt_state = marimba_get_bt_status(&config);
284
285 switch (mode) {
286 case BT_PCM_ON:
287 case BT_PCM_OFF:
288 if (!fm_state)
289 rc = config_pcm(mode);
290 break;
291 case FM_I2S_ON:
292 rc = config_i2s(mode);
293 break;
294 case FM_I2S_OFF:
295 if (bt_state)
296 rc = config_pcm(BT_PCM_ON);
297 else
298 rc = config_i2s(mode);
299 break;
300 default:
301 rc = -EIO;
302 pr_err("%s:Unsupported mode", __func__);
303 }
304 return rc;
305}
306
Rahul Kashyap181d5552011-07-07 10:39:23 +0530307static int bt_set_gpio(int on)
308{
309 int rc = 0;
310 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
311
312 if (on) {
313 rc = gpio_direction_output(GPIO_BT_SYS_REST_EN, 1);
314 msleep(100);
315 } else {
316 if (!marimba_get_fm_status(&config) &&
317 !marimba_get_bt_status(&config)) {
318 gpio_set_value_cansleep(GPIO_BT_SYS_REST_EN, 0);
319 rc = gpio_direction_input(GPIO_BT_SYS_REST_EN);
320 msleep(100);
321 }
322 }
323 if (rc)
324 pr_err("%s: BT sys_reset_en GPIO : Error", __func__);
325
326 return rc;
327}
Justin Paupored98328e2011-08-19 13:48:31 -0700328static struct regulator *fm_regulator;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329static int fm_radio_setup(struct marimba_fm_platform_data *pdata)
330{
331 int rc = 0;
332 const char *id = "FMPW";
333 uint32_t irqcfg;
Rahul Kashyap181d5552011-07-07 10:39:23 +0530334 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
335 u8 value;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336
337 /* Voting for 1.8V Regulator */
Justin Paupored98328e2011-08-19 13:48:31 -0700338 fm_regulator = regulator_get(NULL, "msme1");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700339 if (IS_ERR(fm_regulator)) {
Justin Paupored98328e2011-08-19 13:48:31 -0700340 rc = PTR_ERR(fm_regulator);
341 pr_err("%s: could not get regulator: %d\n", __func__, rc);
342 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343 }
344
345 /* Set the voltage level to 1.8V */
Justin Paupored98328e2011-08-19 13:48:31 -0700346 rc = regulator_set_voltage(fm_regulator, 1800000, 1800000);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700347 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -0700348 pr_err("%s: could not set voltage: %d\n", __func__, rc);
349 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700350 }
351
352 /* Enabling the 1.8V regulator */
Justin Paupored98328e2011-08-19 13:48:31 -0700353 rc = regulator_enable(fm_regulator);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700354 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -0700355 pr_err("%s: could not enable regulator: %d\n", __func__, rc);
356 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700357 }
358
359 /* Voting for 19.2MHz clock */
360 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
361 PMAPP_CLOCK_VOTE_ON);
362 if (rc < 0) {
363 pr_err("%s: clock vote failed with :(%d)\n",
364 __func__, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700365 goto reg_disable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700366 }
367
Rahul Kashyap181d5552011-07-07 10:39:23 +0530368 rc = bt_set_gpio(1);
369 if (rc) {
370 pr_err("%s: bt_set_gpio = %d", __func__, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700371 goto gpio_deconfig;
Rahul Kashyap181d5552011-07-07 10:39:23 +0530372 }
373 /*re-write FM Slave Id, after reset*/
374 value = BAHAMA_SLAVE_ID_FM_ADDR;
375 rc = marimba_write_bit_mask(&config,
376 BAHAMA_SLAVE_ID_FM_REG, &value, 1, 0xFF);
377 if (rc < 0) {
378 pr_err("%s: FM Slave ID rewrite Failed = %d", __func__, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700379 goto gpio_deconfig;
Rahul Kashyap181d5552011-07-07 10:39:23 +0530380 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700381 /* Configuring the FM GPIO */
382 irqcfg = GPIO_CFG(FM_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
383 GPIO_CFG_2MA);
384
385 rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE);
386 if (rc) {
387 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
388 __func__, irqcfg, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700389 goto gpio_deconfig;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700390 }
391
392 return 0;
393
Justin Paupored98328e2011-08-19 13:48:31 -0700394gpio_deconfig:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700395 pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
396 PMAPP_CLOCK_VOTE_OFF);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530397 bt_set_gpio(0);
Justin Paupored98328e2011-08-19 13:48:31 -0700398reg_disable:
399 regulator_disable(fm_regulator);
400reg_free:
401 regulator_put(fm_regulator);
402 fm_regulator = NULL;
403out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700404 return rc;
405};
406
407static void fm_radio_shutdown(struct marimba_fm_platform_data *pdata)
408{
409 int rc;
410 const char *id = "FMPW";
411
412 /* Releasing the GPIO line used by FM */
413 uint32_t irqcfg = GPIO_CFG(FM_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
414 GPIO_CFG_2MA);
415
416 rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE);
417 if (rc)
418 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
419 __func__, irqcfg, rc);
420
421 /* Releasing the 1.8V Regulator */
Justin Paupored98328e2011-08-19 13:48:31 -0700422 if (!IS_ERR_OR_NULL(fm_regulator)) {
423 rc = regulator_disable(fm_regulator);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700424 if (rc)
Justin Paupored98328e2011-08-19 13:48:31 -0700425 pr_err("%s: could not disable regulator: %d\n",
426 __func__, rc);
427 regulator_put(fm_regulator);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700428 fm_regulator = NULL;
429 }
430
431 /* Voting off the clock */
432 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
433 PMAPP_CLOCK_VOTE_OFF);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700434 if (rc < 0)
435 pr_err("%s: voting off failed with :(%d)\n",
436 __func__, rc);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530437 rc = bt_set_gpio(0);
438 if (rc)
439 pr_err("%s: bt_set_gpio = %d", __func__, rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700440}
441
442static struct marimba_fm_platform_data marimba_fm_pdata = {
443 .fm_setup = fm_radio_setup,
444 .fm_shutdown = fm_radio_shutdown,
445 .irq = MSM_GPIO_TO_INT(FM_GPIO),
446 .vreg_s2 = NULL,
447 .vreg_xo_out = NULL,
448 /* Configuring the FM SoC as I2S Master */
449 .is_fm_soc_i2s_master = true,
450 .config_i2s_gpio = msm_bahama_setup_pcm_i2s,
451};
452
Santosh Sajjan6822c682011-07-26 10:49:36 +0530453static struct platform_device msm_wlan_ar6000_pm_device = {
454 .name = "wlan_ar6000_pm_dev",
455 .id = -1,
456};
457
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700458static struct platform_device msm_bt_power_device = {
459 .name = "bt_power",
460};
Rahul Kashyap6e669462011-07-23 16:42:56 +0530461struct bahama_config_register {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700462 u8 reg;
463 u8 value;
464 u8 mask;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700465};
Rahul Kashyap6e669462011-07-23 16:42:56 +0530466struct bt_vreg_info {
467 const char *name;
468 unsigned int pmapp_id;
469 unsigned int level;
470 unsigned int is_pin_controlled;
Justin Paupored98328e2011-08-19 13:48:31 -0700471 struct regulator *reg;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530472};
473static struct bt_vreg_info bt_vregs[] = {
Justin Paupored98328e2011-08-19 13:48:31 -0700474 {"msme1", 2, 1800000, 0, NULL},
475 {"bt", 21, 2900000, 1, NULL}
Rahul Kashyap6e669462011-07-23 16:42:56 +0530476};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700477
478static int bahama_bt(int on)
479{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700480 int rc = 0;
481 int i;
482
483 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
484
485 struct bahama_variant_register {
486 const size_t size;
487 const struct bahama_config_register *set;
488 };
489
490 const struct bahama_config_register *p;
491
492 u8 version;
493
494 const struct bahama_config_register v10_bt_on[] = {
495 { 0xE9, 0x00, 0xFF },
496 { 0xF4, 0x80, 0xFF },
497 { 0xE4, 0x00, 0xFF },
498 { 0xE5, 0x00, 0x0F },
499#ifdef CONFIG_WLAN
500 { 0xE6, 0x38, 0x7F },
501 { 0xE7, 0x06, 0xFF },
502#endif
503 { 0xE9, 0x21, 0xFF },
504 { 0x01, 0x0C, 0x1F },
505 { 0x01, 0x08, 0x1F },
506 };
507
508 const struct bahama_config_register v20_bt_on_fm_off[] = {
509 { 0x11, 0x0C, 0xFF },
510 { 0x13, 0x01, 0xFF },
511 { 0xF4, 0x80, 0xFF },
512 { 0xF0, 0x00, 0xFF },
513 { 0xE9, 0x00, 0xFF },
514#ifdef CONFIG_WLAN
515 { 0x81, 0x00, 0x7F },
516 { 0x82, 0x00, 0xFF },
517 { 0xE6, 0x38, 0x7F },
518 { 0xE7, 0x06, 0xFF },
519#endif
520 { 0x8E, 0x15, 0xFF },
521 { 0x8F, 0x15, 0xFF },
522 { 0x90, 0x15, 0xFF },
523
524 { 0xE9, 0x21, 0xFF },
525 };
526
527 const struct bahama_config_register v20_bt_on_fm_on[] = {
528 { 0x11, 0x0C, 0xFF },
529 { 0x13, 0x01, 0xFF },
530 { 0xF4, 0x86, 0xFF },
531 { 0xF0, 0x06, 0xFF },
532 { 0xE9, 0x00, 0xFF },
533#ifdef CONFIG_WLAN
534 { 0x81, 0x00, 0x7F },
535 { 0x82, 0x00, 0xFF },
536 { 0xE6, 0x38, 0x7F },
537 { 0xE7, 0x06, 0xFF },
538#endif
539 { 0xE9, 0x21, 0xFF },
540 };
541
542 const struct bahama_config_register v10_bt_off[] = {
543 { 0xE9, 0x00, 0xFF },
544 };
545
546 const struct bahama_config_register v20_bt_off_fm_off[] = {
547 { 0xF4, 0x84, 0xFF },
548 { 0xF0, 0x04, 0xFF },
549 { 0xE9, 0x00, 0xFF }
550 };
551
552 const struct bahama_config_register v20_bt_off_fm_on[] = {
553 { 0xF4, 0x86, 0xFF },
554 { 0xF0, 0x06, 0xFF },
555 { 0xE9, 0x00, 0xFF }
556 };
557 const struct bahama_variant_register bt_bahama[2][3] = {
558 {
559 { ARRAY_SIZE(v10_bt_off), v10_bt_off },
560 { ARRAY_SIZE(v20_bt_off_fm_off), v20_bt_off_fm_off },
561 { ARRAY_SIZE(v20_bt_off_fm_on), v20_bt_off_fm_on }
562 },
563 {
564 { ARRAY_SIZE(v10_bt_on), v10_bt_on },
565 { ARRAY_SIZE(v20_bt_on_fm_off), v20_bt_on_fm_off },
566 { ARRAY_SIZE(v20_bt_on_fm_on), v20_bt_on_fm_on }
567 }
568 };
569
570 u8 offset = 0; /* index into bahama configs */
571 on = on ? 1 : 0;
572 version = marimba_read_bahama_ver(&config);
Rahul Kashyap92497af2011-07-07 12:13:52 +0530573 if ((int)version < 0 || version == BAHAMA_VER_UNSUPPORTED) {
574 dev_err(&msm_bt_power_device.dev, "%s: Bahama \
575 version read Error, version = %d \n",
576 __func__, version);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700577 return -EIO;
578 }
579
580 if (version == BAHAMA_VER_2_0) {
581 if (marimba_get_fm_status(&config))
582 offset = 0x01;
583 }
584
585 p = bt_bahama[on][version + offset].set;
586
587 dev_info(&msm_bt_power_device.dev,
588 "%s: found version %d\n", __func__, version);
589
590 for (i = 0; i < bt_bahama[on][version + offset].size; i++) {
591 u8 value = (p+i)->value;
592 rc = marimba_write_bit_mask(&config,
593 (p+i)->reg,
594 &value,
595 sizeof((p+i)->value),
596 (p+i)->mask);
597 if (rc < 0) {
598 dev_err(&msm_bt_power_device.dev,
599 "%s: reg %x write failed: %d\n",
600 __func__, (p+i)->reg, rc);
601 return rc;
602 }
Rahul Kashyap92497af2011-07-07 12:13:52 +0530603 dev_dbg(&msm_bt_power_device.dev,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700604 "%s: reg 0x%02x write value 0x%02x mask 0x%02x\n",
605 __func__, (p+i)->reg,
606 value, (p+i)->mask);
607 value = 0;
608 rc = marimba_read_bit_mask(&config,
609 (p+i)->reg, &value,
610 sizeof((p+i)->value), (p+i)->mask);
611 if (rc < 0)
612 dev_err(&msm_bt_power_device.dev, "%s marimba_read_bit_mask- error",
613 __func__);
Rahul Kashyap92497af2011-07-07 12:13:52 +0530614 dev_dbg(&msm_bt_power_device.dev,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700615 "%s: reg 0x%02x read value 0x%02x mask 0x%02x\n",
616 __func__, (p+i)->reg,
617 value, (p+i)->mask);
618 }
619 /* Update BT Status */
620 if (on)
621 marimba_set_bt_status(&config, true);
622 else
623 marimba_set_bt_status(&config, false);
624 return rc;
625}
626static int bluetooth_switch_regulators(int on)
627{
628 int i, rc = 0;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530629 const char *id = "BTPW";
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700630
Rahul Kashyap6e669462011-07-23 16:42:56 +0530631 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
Justin Paupored98328e2011-08-19 13:48:31 -0700632 if (IS_ERR_OR_NULL(bt_vregs[i].reg)) {
633 rc = bt_vregs[i].reg ?
634 PTR_ERR(bt_vregs[i].reg) :
635 -ENODEV;
636 dev_err(&msm_bt_power_device.dev,
637 "%s: invalid regulator handle for %s: %d\n",
638 __func__, bt_vregs[i].name, rc);
639 goto reg_disable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700640 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700641
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530642 rc = on ? regulator_set_voltage(bt_vregs[i].reg,
643 bt_vregs[i].level, bt_vregs[i].level) : 0;
644 if (rc) {
645 dev_err(&msm_bt_power_device.dev,
646 "%s: could not set voltage for %s: %d\n",
647 __func__, bt_vregs[i].name, rc);
648 goto reg_disable;
649 }
650
651 rc = on ? regulator_enable(bt_vregs[i].reg) : 0;
652 if (rc) {
653 dev_err(&msm_bt_power_device.dev,
654 "%s: could not %sable regulator %s: %d\n",
655 __func__, "en", bt_vregs[i].name, rc);
656 goto reg_disable;
657 }
658
Justin Paupored98328e2011-08-19 13:48:31 -0700659 if (bt_vregs[i].is_pin_controlled) {
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530660 rc = pmapp_vreg_lpm_pincntrl_vote(id,
Rahul Kashyap6e669462011-07-23 16:42:56 +0530661 bt_vregs[i].pmapp_id,
662 PMAPP_CLOCK_ID_D1,
663 on ? PMAPP_CLOCK_VOTE_ON :
Justin Paupored98328e2011-08-19 13:48:31 -0700664 PMAPP_CLOCK_VOTE_OFF);
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530665 if (rc) {
666 dev_err(&msm_bt_power_device.dev,
667 "%s: pin control failed for %s: %d\n",
668 __func__, bt_vregs[i].name, rc);
669 goto pin_cnt_fail;
670 }
Rahul Kashyap6e669462011-07-23 16:42:56 +0530671 }
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530672 rc = on ? 0 : regulator_disable(bt_vregs[i].reg);
Justin Paupored98328e2011-08-19 13:48:31 -0700673
674 if (rc) {
675 dev_err(&msm_bt_power_device.dev,
676 "%s: could not %sable regulator %s: %d\n",
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530677 __func__, "dis", bt_vregs[i].name, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700678 goto reg_disable;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530679 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700680 }
Rahul Kashyap6e669462011-07-23 16:42:56 +0530681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700682 return rc;
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530683pin_cnt_fail:
684 if (on)
685 regulator_disable(bt_vregs[i].reg);
Justin Paupored98328e2011-08-19 13:48:31 -0700686reg_disable:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530687 while (i) {
688 if (on) {
689 i--;
690 regulator_disable(bt_vregs[i].reg);
691 regulator_put(bt_vregs[i].reg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700692 }
Justin Paupored98328e2011-08-19 13:48:31 -0700693 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700694 return rc;
695}
696
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530697static struct regulator *reg_s3;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700698static unsigned int msm_bahama_setup_power(void)
699{
700 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700701
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530702 reg_s3 = regulator_get(NULL, "msme1");
703 if (IS_ERR(reg_s3)) {
704 rc = PTR_ERR(reg_s3);
Justin Paupored98328e2011-08-19 13:48:31 -0700705 pr_err("%s: could not get regulator: %d\n", __func__, rc);
706 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700707 }
Justin Paupored98328e2011-08-19 13:48:31 -0700708
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530709 rc = regulator_set_voltage(reg_s3, 1800000, 1800000);
Justin Paupored98328e2011-08-19 13:48:31 -0700710 if (rc) {
711 pr_err("%s: could not set voltage: %d\n", __func__, rc);
712 goto reg_fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700713 }
Justin Paupored98328e2011-08-19 13:48:31 -0700714
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530715 rc = regulator_enable(reg_s3);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700716 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -0700717 pr_err("%s: could not enable regulator: %d\n", __func__, rc);
718 goto reg_fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700719 }
720
721 /*setup Bahama_sys_reset_n*/
722 rc = gpio_request(GPIO_BT_SYS_REST_EN, "bahama sys_rst_n");
Justin Paupored98328e2011-08-19 13:48:31 -0700723 if (rc) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700724 pr_err("%s: gpio_request %d = %d\n", __func__,
725 GPIO_BT_SYS_REST_EN, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700726 goto reg_disable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700727 }
Justin Paupored98328e2011-08-19 13:48:31 -0700728
Rahul Kashyap181d5552011-07-07 10:39:23 +0530729 rc = bt_set_gpio(1);
Justin Paupored98328e2011-08-19 13:48:31 -0700730 if (rc) {
Rahul Kashyap181d5552011-07-07 10:39:23 +0530731 pr_err("%s: bt_set_gpio %d = %d\n", __func__,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700732 GPIO_BT_SYS_REST_EN, rc);
733 goto gpio_fail;
734 }
Justin Paupored98328e2011-08-19 13:48:31 -0700735
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700736 return rc;
737
738gpio_fail:
739 gpio_free(GPIO_BT_SYS_REST_EN);
Justin Paupored98328e2011-08-19 13:48:31 -0700740reg_disable:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530741 regulator_disable(reg_s3);
Justin Paupored98328e2011-08-19 13:48:31 -0700742reg_fail:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530743 regulator_put(reg_s3);
Justin Paupored98328e2011-08-19 13:48:31 -0700744out:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530745 reg_s3 = NULL;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700746 return rc;
747}
748
749static unsigned int msm_bahama_shutdown_power(int value)
750{
751 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700752
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530753 if (IS_ERR_OR_NULL(reg_s3)) {
754 rc = reg_s3 ? PTR_ERR(reg_s3) : -ENODEV;
Justin Paupored98328e2011-08-19 13:48:31 -0700755 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700756 }
Justin Paupored98328e2011-08-19 13:48:31 -0700757
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530758 rc = regulator_disable(reg_s3);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700759 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -0700760 pr_err("%s: could not disable regulator: %d\n", __func__, rc);
761 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700762 }
Justin Paupored98328e2011-08-19 13:48:31 -0700763
Rahul Kashyape8698c62011-07-20 20:43:05 +0530764 if (value == BAHAMA_ID) {
765 rc = bt_set_gpio(0);
766 if (rc) {
767 pr_err("%s: bt_set_gpio = %d\n",
768 __func__, rc);
769 }
Justin Paupored98328e2011-08-19 13:48:31 -0700770 gpio_free(GPIO_BT_SYS_REST_EN);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530771 }
Justin Paupored98328e2011-08-19 13:48:31 -0700772
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530773 regulator_put(reg_s3);
774 reg_s3 = NULL;
Justin Paupored98328e2011-08-19 13:48:31 -0700775
776 return 0;
777
Justin Paupored98328e2011-08-19 13:48:31 -0700778out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700779 return rc;
780}
781
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700782static unsigned int msm_bahama_core_config(int type)
783{
784 int rc = 0;
785
786 if (type == BAHAMA_ID) {
787 int i;
Rahul Kashyap181d5552011-07-07 10:39:23 +0530788 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700789 const struct bahama_config_register v20_init[] = {
790 /* reg, value, mask */
791 { 0xF4, 0x84, 0xFF }, /* AREG */
792 { 0xF0, 0x04, 0xFF } /* DREG */
793 };
794 if (marimba_read_bahama_ver(&config) == BAHAMA_VER_2_0) {
795 for (i = 0; i < ARRAY_SIZE(v20_init); i++) {
796 u8 value = v20_init[i].value;
797 rc = marimba_write_bit_mask(&config,
798 v20_init[i].reg,
799 &value,
800 sizeof(v20_init[i].value),
801 v20_init[i].mask);
802 if (rc < 0) {
803 pr_err("%s: reg %d write failed: %d\n",
804 __func__, v20_init[i].reg, rc);
805 return rc;
806 }
807 pr_debug("%s: reg 0x%02x value 0x%02x"
808 " mask 0x%02x\n",
809 __func__, v20_init[i].reg,
810 v20_init[i].value, v20_init[i].mask);
811 }
812 }
813 }
Rahul Kashyap181d5552011-07-07 10:39:23 +0530814 rc = bt_set_gpio(0);
815 if (rc) {
816 pr_err("%s: bt_set_gpio = %d\n",
817 __func__, rc);
818 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700819 pr_debug("core type: %d\n", type);
820 return rc;
821}
822
823static int bluetooth_power(int on)
824{
825 int pin, rc = 0;
826 const char *id = "BTPW";
827 int cid = 0;
828
829 cid = adie_get_detected_connectivity_type();
830 if (cid != BAHAMA_ID) {
831 pr_err("%s: unexpected adie connectivity type: %d\n",
832 __func__, cid);
833 return -ENODEV;
834 }
835 if (on) {
836 /*setup power for BT SOC*/
Rahul Kashyap181d5552011-07-07 10:39:23 +0530837 rc = bt_set_gpio(on);
838 if (rc) {
839 pr_err("%s: bt_set_gpio = %d\n",
840 __func__, rc);
841 goto exit;
842 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700843 rc = bluetooth_switch_regulators(on);
844 if (rc < 0) {
845 pr_err("%s: bluetooth_switch_regulators rc = %d",
846 __func__, rc);
847 goto exit;
848 }
849 /*setup BT GPIO lines*/
850 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_on);
851 pin++) {
852 rc = gpio_tlmm_config(bt_config_power_on[pin],
853 GPIO_CFG_ENABLE);
854 if (rc < 0) {
855 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
856 __func__,
857 bt_config_power_on[pin],
858 rc);
859 goto fail_power;
860 }
861 }
862 /*Setup BT clocks*/
863 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
864 PMAPP_CLOCK_VOTE_ON);
865 if (rc < 0) {
866 pr_err("Failed to vote for TCXO_D1 ON\n");
867 goto fail_clock;
868 }
869 msleep(20);
870
871 /*I2C config for Bahama*/
872 rc = bahama_bt(1);
873 if (rc < 0) {
874 pr_err("%s: bahama_bt rc = %d", __func__, rc);
875 goto fail_i2c;
876 }
877 msleep(20);
878
879 /*setup BT PCM lines*/
880 rc = msm_bahama_setup_pcm_i2s(BT_PCM_ON);
881 if (rc < 0) {
882 pr_err("%s: msm_bahama_setup_pcm_i2s , rc =%d\n",
883 __func__, rc);
884 goto fail_power;
885 }
886 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
887 PMAPP_CLOCK_VOTE_PIN_CTRL);
888 if (rc < 0)
889 pr_err("%s:Pin Control Failed, rc = %d",
890 __func__, rc);
891
892 } else {
893 rc = bahama_bt(0);
894 if (rc < 0)
895 pr_err("%s: bahama_bt rc = %d", __func__, rc);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530896
897 rc = bt_set_gpio(on);
898 if (rc) {
899 pr_err("%s: bt_set_gpio = %d\n",
900 __func__, rc);
901 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700902fail_i2c:
903 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
904 PMAPP_CLOCK_VOTE_OFF);
905 if (rc < 0)
906 pr_err("%s: Failed to vote Off D1\n", __func__);
907fail_clock:
908 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_off);
909 pin++) {
910 rc = gpio_tlmm_config(bt_config_power_off[pin],
911 GPIO_CFG_ENABLE);
912 if (rc < 0) {
913 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
914 __func__, bt_config_power_off[pin], rc);
915 }
916 }
917 rc = msm_bahama_setup_pcm_i2s(BT_PCM_OFF);
918 if (rc < 0) {
919 pr_err("%s: msm_bahama_setup_pcm_i2s, rc =%d\n",
920 __func__, rc);
921 }
922fail_power:
923 rc = bluetooth_switch_regulators(0);
924 if (rc < 0) {
925 pr_err("%s: switch_regulators : rc = %d",\
926 __func__, rc);
927 goto exit;
928 }
929 }
930 return rc;
931exit:
932 pr_err("%s: failed with rc = %d", __func__, rc);
933 return rc;
934}
935
936static int __init bt_power_init(void)
937{
938 int i, rc = 0;
Justin Paupored98328e2011-08-19 13:48:31 -0700939 struct device *dev = &msm_bt_power_device.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700940
Justin Paupored98328e2011-08-19 13:48:31 -0700941 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
942 bt_vregs[i].reg = regulator_get(dev, bt_vregs[i].name);
943 if (IS_ERR(bt_vregs[i].reg)) {
944 rc = PTR_ERR(bt_vregs[i].reg);
945 dev_err(dev, "%s: could not get regulator %s: %d\n",
946 __func__, bt_vregs[i].name, rc);
947 goto reg_get_fail;
948 }
Justin Paupored98328e2011-08-19 13:48:31 -0700949 }
950
951 dev->platform_data = &bluetooth_power;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700952
953 return rc;
954
Justin Paupored98328e2011-08-19 13:48:31 -0700955reg_get_fail:
956 while (i--) {
957 regulator_put(bt_vregs[i].reg);
958 bt_vregs[i].reg = NULL;
959 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700960 return rc;
961}
962
963static struct marimba_platform_data marimba_pdata = {
964 .slave_id[SLAVE_ID_BAHAMA_FM] = BAHAMA_SLAVE_ID_FM_ADDR,
965 .slave_id[SLAVE_ID_BAHAMA_QMEMBIST] = BAHAMA_SLAVE_ID_QMEMBIST_ADDR,
966 .bahama_setup = msm_bahama_setup_power,
967 .bahama_shutdown = msm_bahama_shutdown_power,
968 .bahama_core_config = msm_bahama_core_config,
969 .fm = &marimba_fm_pdata,
970};
971
972#endif
973
974#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
975static struct i2c_board_info core_exp_i2c_info[] __initdata = {
976 {
977 I2C_BOARD_INFO("sx1509q", 0x3e),
978 },
979};
980static struct i2c_board_info cam_exp_i2c_info[] __initdata = {
981 {
982 I2C_BOARD_INFO("sx1508q", 0x22),
983 .platform_data = &sx150x_data[SX150X_CAM],
984 },
985};
986#endif
987#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
988static struct i2c_board_info bahama_devices[] = {
989{
990 I2C_BOARD_INFO("marimba", 0xc),
991 .platform_data = &marimba_pdata,
992},
993};
994#endif
995
996#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
997static void __init register_i2c_devices(void)
998{
999
1000 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
1001 cam_exp_i2c_info,
1002 ARRAY_SIZE(cam_exp_i2c_info));
1003
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301004 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001005 sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0;
1006
1007 core_exp_i2c_info[0].platform_data =
1008 &sx150x_data[SX150X_CORE];
1009
1010 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
1011 core_exp_i2c_info,
1012 ARRAY_SIZE(core_exp_i2c_info));
1013#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
1014 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
1015 bahama_devices,
1016 ARRAY_SIZE(bahama_devices));
1017#endif
1018}
1019#endif
1020
1021static struct msm_gpio qup_i2c_gpios_io[] = {
1022 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1023 "qup_scl" },
1024 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1025 "qup_sda" },
1026 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1027 "qup_scl" },
1028 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1029 "qup_sda" },
1030};
1031
1032static struct msm_gpio qup_i2c_gpios_hw[] = {
1033 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1034 "qup_scl" },
1035 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1036 "qup_sda" },
1037 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1038 "qup_scl" },
1039 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1040 "qup_sda" },
1041};
1042
1043static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
1044{
1045 int rc;
1046
1047 if (adap_id < 0 || adap_id > 1)
1048 return;
1049
1050 /* Each adapter gets 2 lines from the table */
1051 if (config_type)
1052 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
1053 else
1054 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
1055 if (rc < 0)
1056 pr_err("QUP GPIO request/enable failed: %d\n", rc);
1057}
1058
1059static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
1060 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001061 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1062};
1063
1064static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
1065 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001066 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1067};
1068
1069#ifdef CONFIG_ARCH_MSM7X27A
Prabhanjan Kandula1d920742011-08-19 10:28:11 +05301070#define MSM_PMEM_MDP_SIZE 0x1900000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001071#define MSM_PMEM_ADSP_SIZE 0x1000000
1072
1073#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
1074#define MSM_FB_SIZE 0x260000
1075#else
1076#define MSM_FB_SIZE 0x195000
1077#endif
1078
1079#endif
1080
1081static struct android_usb_platform_data android_usb_pdata = {
1082 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1083};
1084
1085static struct platform_device android_usb_device = {
1086 .name = "android_usb",
1087 .id = -1,
1088 .dev = {
1089 .platform_data = &android_usb_pdata,
1090 },
1091};
1092
1093#ifdef CONFIG_USB_EHCI_MSM_72K
1094static void msm_hsusb_vbus_power(unsigned phy_info, int on)
1095{
1096 int rc = 0;
1097 unsigned gpio;
1098
1099 gpio = GPIO_HOST_VBUS_EN;
1100
1101 rc = gpio_request(gpio, "i2c_host_vbus_en");
1102 if (rc < 0) {
1103 pr_err("failed to request %d GPIO\n", gpio);
1104 return;
1105 }
1106 gpio_direction_output(gpio, !!on);
1107 gpio_set_value_cansleep(gpio, !!on);
1108 gpio_free(gpio);
1109}
1110
1111static struct msm_usb_host_platform_data msm_usb_host_pdata = {
1112 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
1113};
1114
1115static void __init msm7x2x_init_host(void)
1116{
1117 msm_add_host(0, &msm_usb_host_pdata);
1118}
1119#endif
1120
1121#ifdef CONFIG_USB_MSM_OTG_72K
1122static int hsusb_rpc_connect(int connect)
1123{
1124 if (connect)
1125 return msm_hsusb_rpc_connect();
1126 else
1127 return msm_hsusb_rpc_close();
1128}
1129
Justin Paupored98328e2011-08-19 13:48:31 -07001130static struct regulator *reg_hsusb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001131static int msm_hsusb_ldo_init(int init)
1132{
Justin Paupored98328e2011-08-19 13:48:31 -07001133 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001134
Justin Paupored98328e2011-08-19 13:48:31 -07001135 if (init) {
1136 reg_hsusb = regulator_get(NULL, "usb");
1137 if (IS_ERR(reg_hsusb)) {
1138 rc = PTR_ERR(reg_hsusb);
1139 pr_err("%s: could not get regulator: %d\n",
1140 __func__, rc);
1141 goto out;
1142 }
1143
1144 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
1145 if (rc) {
1146 pr_err("%s: could not set voltage: %d\n",
1147 __func__, rc);
1148 goto reg_free;
1149 }
1150
1151 return 0;
1152 }
1153 /* else fall through */
1154reg_free:
1155 regulator_put(reg_hsusb);
1156out:
1157 reg_hsusb = NULL;
1158 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001159}
1160
1161static int msm_hsusb_ldo_enable(int enable)
1162{
1163 static int ldo_status;
1164
Justin Paupored98328e2011-08-19 13:48:31 -07001165 if (IS_ERR_OR_NULL(reg_hsusb))
1166 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001167
1168 if (ldo_status == enable)
1169 return 0;
1170
1171 ldo_status = enable;
1172
Justin Paupored98328e2011-08-19 13:48:31 -07001173 return enable ?
1174 regulator_enable(reg_hsusb) :
1175 regulator_disable(reg_hsusb);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001176}
1177
1178#ifndef CONFIG_USB_EHCI_MSM_72K
1179static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
1180{
1181 int ret = 0;
1182
1183 if (init)
1184 ret = msm_pm_app_rpc_init(callback);
1185 else
1186 msm_pm_app_rpc_deinit(callback);
1187
1188 return ret;
1189}
1190#endif
1191
1192static struct msm_otg_platform_data msm_otg_pdata = {
1193#ifndef CONFIG_USB_EHCI_MSM_72K
1194 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
1195#else
1196 .vbus_power = msm_hsusb_vbus_power,
1197#endif
1198 .rpc_connect = hsusb_rpc_connect,
1199 .core_clk = 1,
1200 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
1201 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
1202 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
1203 .se1_gating = SE1_GATING_DISABLE,
1204 .ldo_init = msm_hsusb_ldo_init,
1205 .ldo_enable = msm_hsusb_ldo_enable,
1206 .chg_init = hsusb_chg_init,
1207 .chg_connected = hsusb_chg_connected,
1208 .chg_vbus_draw = hsusb_chg_vbus_draw,
1209};
1210#endif
1211
1212static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
1213 .is_phy_status_timer_on = 1,
1214};
1215
1216static struct resource smc91x_resources[] = {
1217 [0] = {
1218 .start = 0x90000300,
1219 .end = 0x900003ff,
1220 .flags = IORESOURCE_MEM,
1221 },
1222 [1] = {
1223 .start = MSM_GPIO_TO_INT(4),
1224 .end = MSM_GPIO_TO_INT(4),
1225 .flags = IORESOURCE_IRQ,
1226 },
1227};
1228
1229static struct platform_device smc91x_device = {
1230 .name = "smc91x",
1231 .id = 0,
1232 .num_resources = ARRAY_SIZE(smc91x_resources),
1233 .resource = smc91x_resources,
1234};
1235
1236#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
1237 || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\
1238 || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\
1239 || defined(CONFIG_MMC_MSM_SDC4_SUPPORT))
1240
1241static unsigned long vreg_sts, gpio_sts;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001242
1243struct sdcc_gpio {
1244 struct msm_gpio *cfg_data;
1245 uint32_t size;
1246 struct msm_gpio *sleep_cfg_data;
1247};
1248
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301249/**
1250 * Due to insufficient drive strengths for SDC GPIO lines some old versioned
1251 * SD/MMC cards may cause data CRC errors. Hence, set optimal values
1252 * for SDC slots based on timing closure and marginality. SDC1 slot
1253 * require higher value since it should handle bad signal quality due
1254 * to size of T-flash adapters.
1255 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001256static struct msm_gpio sdc1_cfg_data[] = {
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301257 {GPIO_CFG(51, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001258 "sdc1_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301259 {GPIO_CFG(52, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001260 "sdc1_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301261 {GPIO_CFG(53, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001262 "sdc1_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301263 {GPIO_CFG(54, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001264 "sdc1_dat_0"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301265 {GPIO_CFG(55, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001266 "sdc1_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301267 {GPIO_CFG(56, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001268 "sdc1_clk"},
1269};
1270
1271static struct msm_gpio sdc2_cfg_data[] = {
1272 {GPIO_CFG(62, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1273 "sdc2_clk"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301274 {GPIO_CFG(63, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001275 "sdc2_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301276 {GPIO_CFG(64, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001277 "sdc2_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301278 {GPIO_CFG(65, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001279 "sdc2_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301280 {GPIO_CFG(66, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001281 "sdc2_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301282 {GPIO_CFG(67, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001283 "sdc2_dat_0"},
1284};
1285
1286static struct msm_gpio sdc2_sleep_cfg_data[] = {
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301287 {GPIO_CFG(62, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001288 "sdc2_clk"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301289 {GPIO_CFG(63, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001290 "sdc2_cmd"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301291 {GPIO_CFG(64, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001292 "sdc2_dat_3"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301293 {GPIO_CFG(65, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001294 "sdc2_dat_2"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301295 {GPIO_CFG(66, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001296 "sdc2_dat_1"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301297 {GPIO_CFG(67, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001298 "sdc2_dat_0"},
1299};
1300static struct msm_gpio sdc3_cfg_data[] = {
1301 {GPIO_CFG(88, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1302 "sdc3_clk"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301303 {GPIO_CFG(89, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001304 "sdc3_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301305 {GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306 "sdc3_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301307 {GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001308 "sdc3_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301309 {GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001310 "sdc3_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301311 {GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001312 "sdc3_dat_0"},
1313#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301314 {GPIO_CFG(19, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001315 "sdc3_dat_7"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301316 {GPIO_CFG(20, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001317 "sdc3_dat_6"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301318 {GPIO_CFG(21, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001319 "sdc3_dat_5"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301320 {GPIO_CFG(108, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321 "sdc3_dat_4"},
1322#endif
1323};
1324
1325static struct msm_gpio sdc4_cfg_data[] = {
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301326 {GPIO_CFG(19, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001327 "sdc4_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301328 {GPIO_CFG(20, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001329 "sdc4_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301330 {GPIO_CFG(21, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001331 "sdc4_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301332 {GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001333 "sdc4_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301334 {GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001335 "sdc4_dat_0"},
1336 {GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1337 "sdc4_clk"},
1338};
1339
1340static struct sdcc_gpio sdcc_cfg_data[] = {
1341 {
1342 .cfg_data = sdc1_cfg_data,
1343 .size = ARRAY_SIZE(sdc1_cfg_data),
1344 },
1345 {
1346 .cfg_data = sdc2_cfg_data,
1347 .size = ARRAY_SIZE(sdc2_cfg_data),
1348 .sleep_cfg_data = sdc2_sleep_cfg_data,
1349 },
1350 {
1351 .cfg_data = sdc3_cfg_data,
1352 .size = ARRAY_SIZE(sdc3_cfg_data),
1353 },
1354 {
1355 .cfg_data = sdc4_cfg_data,
1356 .size = ARRAY_SIZE(sdc4_cfg_data),
1357 },
1358};
1359
Justin Paupored98328e2011-08-19 13:48:31 -07001360static struct regulator *sdcc_vreg_data[ARRAY_SIZE(sdcc_cfg_data)];
1361
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001362static int msm_sdcc_setup_gpio(int dev_id, unsigned int enable)
1363{
1364 int rc = 0;
1365 struct sdcc_gpio *curr;
1366
1367 curr = &sdcc_cfg_data[dev_id - 1];
1368 if (!(test_bit(dev_id, &gpio_sts)^enable))
1369 return rc;
1370
1371 if (enable) {
1372 set_bit(dev_id, &gpio_sts);
1373 rc = msm_gpios_request_enable(curr->cfg_data, curr->size);
1374 if (rc)
1375 pr_err("%s: Failed to turn on GPIOs for slot %d\n",
1376 __func__, dev_id);
1377 } else {
1378 clear_bit(dev_id, &gpio_sts);
1379 if (curr->sleep_cfg_data) {
1380 rc = msm_gpios_enable(curr->sleep_cfg_data, curr->size);
1381 msm_gpios_free(curr->sleep_cfg_data, curr->size);
1382 return rc;
1383 }
1384 msm_gpios_disable_free(curr->cfg_data, curr->size);
1385 }
1386 return rc;
1387}
1388
1389static int msm_sdcc_setup_vreg(int dev_id, unsigned int enable)
1390{
1391 int rc = 0;
Justin Paupored98328e2011-08-19 13:48:31 -07001392 struct regulator *curr = sdcc_vreg_data[dev_id - 1];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001393
Justin Paupored98328e2011-08-19 13:48:31 -07001394 if (test_bit(dev_id, &vreg_sts) == enable)
1395 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001396
Justin Paupored98328e2011-08-19 13:48:31 -07001397 if (!curr)
1398 return -ENODEV;
1399
1400 if (IS_ERR(curr))
1401 return PTR_ERR(curr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001402
1403 if (enable) {
1404 set_bit(dev_id, &vreg_sts);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001405
Justin Paupored98328e2011-08-19 13:48:31 -07001406 rc = regulator_enable(curr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001407 if (rc)
Justin Paupored98328e2011-08-19 13:48:31 -07001408 pr_err("%s: could not enable regulator: %d\n",
1409 __func__, rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001410 } else {
1411 clear_bit(dev_id, &vreg_sts);
Justin Paupored98328e2011-08-19 13:48:31 -07001412
1413 rc = regulator_disable(curr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001414 if (rc)
Justin Paupored98328e2011-08-19 13:48:31 -07001415 pr_err("%s: could not disable regulator: %d\n",
1416 __func__, rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001417 }
1418 return rc;
1419}
1420
1421static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
1422{
1423 int rc = 0;
1424 struct platform_device *pdev;
1425
1426 pdev = container_of(dv, struct platform_device, dev);
1427
1428 rc = msm_sdcc_setup_gpio(pdev->id, !!vdd);
1429 if (rc)
1430 goto out;
1431
1432 rc = msm_sdcc_setup_vreg(pdev->id, !!vdd);
1433out:
1434 return rc;
1435}
1436
1437#define GPIO_SDC1_HW_DET 85
1438
1439#if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) \
1440 && defined(CONFIG_MMC_MSM_CARD_HW_DETECTION)
1441static unsigned int msm7x2xa_sdcc_slot_status(struct device *dev)
1442{
1443 int status;
1444
1445 status = gpio_tlmm_config(GPIO_CFG(GPIO_SDC1_HW_DET, 2, GPIO_CFG_INPUT,
1446 GPIO_CFG_PULL_UP, GPIO_CFG_8MA), GPIO_CFG_ENABLE);
1447 if (status)
1448 pr_err("%s:Failed to configure tlmm for GPIO %d\n", __func__,
1449 GPIO_SDC1_HW_DET);
1450
1451 status = gpio_request(GPIO_SDC1_HW_DET, "SD_HW_Detect");
1452 if (status) {
1453 pr_err("%s:Failed to request GPIO %d\n", __func__,
1454 GPIO_SDC1_HW_DET);
1455 } else {
1456 status = gpio_direction_input(GPIO_SDC1_HW_DET);
1457 if (!status)
1458 status = gpio_get_value(GPIO_SDC1_HW_DET);
1459 gpio_free(GPIO_SDC1_HW_DET);
1460 }
1461 return status;
1462}
1463#endif
1464
1465#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1466static struct mmc_platform_data sdc1_plat_data = {
1467 .ocr_mask = MMC_VDD_28_29,
1468 .translate_vdd = msm_sdcc_setup_power,
1469 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1470 .msmsdcc_fmin = 144000,
1471 .msmsdcc_fmid = 24576000,
1472 .msmsdcc_fmax = 49152000,
1473#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
1474 .status = msm7x2xa_sdcc_slot_status,
1475 .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET),
1476 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
1477#endif
1478};
1479#endif
1480
1481#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1482static struct mmc_platform_data sdc2_plat_data = {
1483 /*
1484 * SDC2 supports only 1.8V, claim for 2.85V range is just
1485 * for allowing buggy cards who advertise 2.8V even though
1486 * they can operate at 1.8V supply.
1487 */
1488 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_165_195,
1489 .translate_vdd = msm_sdcc_setup_power,
1490 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1491#ifdef CONFIG_MMC_MSM_SDIO_SUPPORT
1492 .sdiowakeup_irq = MSM_GPIO_TO_INT(66),
1493#endif
1494 .msmsdcc_fmin = 144000,
1495 .msmsdcc_fmid = 24576000,
1496 .msmsdcc_fmax = 49152000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001497};
1498#endif
1499
1500#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1501static struct mmc_platform_data sdc3_plat_data = {
1502 .ocr_mask = MMC_VDD_28_29,
1503 .translate_vdd = msm_sdcc_setup_power,
1504#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
1505 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
1506#else
1507 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1508#endif
1509 .msmsdcc_fmin = 144000,
1510 .msmsdcc_fmid = 24576000,
1511 .msmsdcc_fmax = 49152000,
1512 .nonremovable = 1,
1513};
1514#endif
1515
1516#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1517 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
1518static struct mmc_platform_data sdc4_plat_data = {
1519 .ocr_mask = MMC_VDD_28_29,
1520 .translate_vdd = msm_sdcc_setup_power,
1521 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1522 .msmsdcc_fmin = 144000,
1523 .msmsdcc_fmid = 24576000,
1524 .msmsdcc_fmax = 49152000,
1525};
1526#endif
Pankaj Kumarb3e55c62011-09-26 11:59:39 +05301527
1528static int __init mmc_regulator_init(int sdcc_no, const char *supply, int uV)
1529{
1530 int rc;
1531
1532 BUG_ON(sdcc_no < 1 || sdcc_no > 4);
1533
1534 sdcc_no--;
1535
1536 sdcc_vreg_data[sdcc_no] = regulator_get(NULL, supply);
1537
1538 if (IS_ERR(sdcc_vreg_data[sdcc_no])) {
1539 rc = PTR_ERR(sdcc_vreg_data[sdcc_no]);
1540 pr_err("%s: could not get regulator \"%s\": %d\n",
1541 __func__, supply, rc);
1542 goto out;
1543 }
1544
1545 rc = regulator_set_voltage(sdcc_vreg_data[sdcc_no], uV, uV);
1546
1547 if (rc) {
1548 pr_err("%s: could not set voltage for \"%s\" to %d uV: %d\n",
1549 __func__, supply, uV, rc);
1550 goto reg_free;
1551 }
1552
1553 return rc;
1554
1555reg_free:
1556 regulator_put(sdcc_vreg_data[sdcc_no]);
1557out:
1558 sdcc_vreg_data[sdcc_no] = NULL;
1559 return rc;
1560}
1561
1562static void __init msm7x27a_init_mmc(void)
1563{
1564 /* eMMC slot */
1565#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1566 if (mmc_regulator_init(3, "emmc", 3000000))
1567 return;
1568 msm_add_sdcc(3, &sdc3_plat_data);
1569#endif
1570 /* Micro-SD slot */
1571#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1572 if (mmc_regulator_init(1, "mmc", 2850000))
1573 return;
1574 msm_add_sdcc(1, &sdc1_plat_data);
1575#endif
1576 /* SDIO WLAN slot */
1577#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1578 if (mmc_regulator_init(2, "mmc", 2850000))
1579 return;
1580 msm_add_sdcc(2, &sdc2_plat_data);
1581#endif
1582 /* Not Used */
1583#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1584 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
1585 if (mmc_regulator_init(4, "mmc", 2850000))
1586 return;
1587 msm_add_sdcc(4, &sdc4_plat_data);
1588#endif
1589}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001590#endif
1591
1592#ifdef CONFIG_SERIAL_MSM_HS
1593static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
1594 .inject_rx_on_wakeup = 1,
1595 .rx_to_inject = 0xFD,
1596};
1597#endif
1598static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
1599 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
1600 .idle_supported = 1,
1601 .suspend_supported = 1,
1602 .idle_enabled = 1,
1603 .suspend_enabled = 1,
1604 .latency = 16000,
1605 .residency = 20000,
1606 },
1607 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
1608 .idle_supported = 1,
1609 .suspend_supported = 1,
1610 .idle_enabled = 1,
1611 .suspend_enabled = 1,
1612 .latency = 12000,
1613 .residency = 20000,
1614 },
1615 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
1616 .idle_supported = 1,
1617 .suspend_supported = 1,
1618 .idle_enabled = 0,
1619 .suspend_enabled = 1,
1620 .latency = 2000,
1621 .residency = 0,
1622 },
1623 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
1624 .idle_supported = 1,
1625 .suspend_supported = 1,
1626 .idle_enabled = 1,
1627 .suspend_enabled = 1,
1628 .latency = 2,
1629 .residency = 0,
1630 },
1631};
1632
1633static struct android_pmem_platform_data android_pmem_adsp_pdata = {
1634 .name = "pmem_adsp",
1635 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
Mahesh Lankac6af7eb2011-08-02 18:00:35 +05301636 .cached = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001637 .memory_type = MEMTYPE_EBI1,
1638};
1639
1640static struct platform_device android_pmem_adsp_device = {
1641 .name = "android_pmem",
1642 .id = 1,
1643 .dev = { .platform_data = &android_pmem_adsp_pdata },
1644};
1645
1646static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
1647static int __init pmem_mdp_size_setup(char *p)
1648{
1649 pmem_mdp_size = memparse(p, NULL);
1650 return 0;
1651}
1652
1653early_param("pmem_mdp_size", pmem_mdp_size_setup);
1654
1655static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
1656static int __init pmem_adsp_size_setup(char *p)
1657{
1658 pmem_adsp_size = memparse(p, NULL);
1659 return 0;
1660}
1661
1662early_param("pmem_adsp_size", pmem_adsp_size_setup);
1663
1664static unsigned fb_size = MSM_FB_SIZE;
1665static int __init fb_size_setup(char *p)
1666{
1667 fb_size = memparse(p, NULL);
1668 return 0;
1669}
1670
1671early_param("fb_size", fb_size_setup);
1672
Justin Paupored98328e2011-08-19 13:48:31 -07001673static struct regulator_bulk_data regs_lcdc[] = {
1674 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
1675 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001676};
1677
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001678static uint32_t lcdc_gpio_initialized;
1679
1680static void lcdc_toshiba_gpio_init(void)
1681{
Justin Paupored98328e2011-08-19 13:48:31 -07001682 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683 if (!lcdc_gpio_initialized) {
1684 if (gpio_request(GPIO_SPI_CLK, "spi_clk")) {
1685 pr_err("failed to request gpio spi_clk\n");
1686 return;
1687 }
1688 if (gpio_request(GPIO_SPI_CS0_N, "spi_cs")) {
1689 pr_err("failed to request gpio spi_cs0_N\n");
1690 goto fail_gpio6;
1691 }
1692 if (gpio_request(GPIO_SPI_MOSI, "spi_mosi")) {
1693 pr_err("failed to request gpio spi_mosi\n");
1694 goto fail_gpio5;
1695 }
1696 if (gpio_request(GPIO_SPI_MISO, "spi_miso")) {
1697 pr_err("failed to request gpio spi_miso\n");
1698 goto fail_gpio4;
1699 }
1700 if (gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr")) {
1701 pr_err("failed to request gpio_disp_pwr\n");
1702 goto fail_gpio3;
1703 }
1704 if (gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en")) {
1705 pr_err("failed to request gpio_bkl_en\n");
1706 goto fail_gpio2;
1707 }
1708 pmapp_disp_backlight_init();
1709
Justin Paupored98328e2011-08-19 13:48:31 -07001710 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_lcdc), regs_lcdc);
1711 if (rc) {
1712 pr_err("%s: could not get regulators: %d\n",
1713 __func__, rc);
1714 goto fail_gpio1;
1715 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716
Justin Paupored98328e2011-08-19 13:48:31 -07001717 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_lcdc),
1718 regs_lcdc);
1719 if (rc) {
1720 pr_err("%s: could not set voltages: %d\n",
1721 __func__, rc);
1722 goto fail_vreg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001723 }
1724 lcdc_gpio_initialized = 1;
1725 }
1726 return;
Justin Paupored98328e2011-08-19 13:48:31 -07001727fail_vreg:
1728 regulator_bulk_free(ARRAY_SIZE(regs_lcdc), regs_lcdc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001729fail_gpio1:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001730 gpio_free(GPIO_BACKLIGHT_EN);
1731fail_gpio2:
1732 gpio_free(GPIO_DISPLAY_PWR_EN);
1733fail_gpio3:
1734 gpio_free(GPIO_SPI_MISO);
1735fail_gpio4:
1736 gpio_free(GPIO_SPI_MOSI);
1737fail_gpio5:
1738 gpio_free(GPIO_SPI_CS0_N);
1739fail_gpio6:
1740 gpio_free(GPIO_SPI_CLK);
1741 lcdc_gpio_initialized = 0;
1742}
1743
1744static uint32_t lcdc_gpio_table[] = {
1745 GPIO_SPI_CLK,
1746 GPIO_SPI_CS0_N,
1747 GPIO_SPI_MOSI,
1748 GPIO_DISPLAY_PWR_EN,
1749 GPIO_BACKLIGHT_EN,
1750 GPIO_SPI_MISO,
1751};
1752
1753static void config_lcdc_gpio_table(uint32_t *table, int len, unsigned enable)
1754{
1755 int n;
1756
1757 if (lcdc_gpio_initialized) {
1758 /* All are IO Expander GPIOs */
1759 for (n = 0; n < (len - 1); n++)
1760 gpio_direction_output(table[n], 1);
1761 }
1762}
1763
1764static void lcdc_toshiba_config_gpios(int enable)
1765{
1766 config_lcdc_gpio_table(lcdc_gpio_table,
1767 ARRAY_SIZE(lcdc_gpio_table), enable);
1768}
1769
1770static int msm_fb_lcdc_power_save(int on)
1771{
Justin Paupored98328e2011-08-19 13:48:31 -07001772 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001773 /* Doing the init of the LCDC GPIOs very late as they are from
1774 an I2C-controlled IO Expander */
1775 lcdc_toshiba_gpio_init();
1776
1777 if (lcdc_gpio_initialized) {
1778 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
1779 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
1780
Justin Paupored98328e2011-08-19 13:48:31 -07001781 rc = on ? regulator_bulk_enable(
1782 ARRAY_SIZE(regs_lcdc), regs_lcdc) :
1783 regulator_bulk_disable(
1784 ARRAY_SIZE(regs_lcdc), regs_lcdc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001785
Justin Paupored98328e2011-08-19 13:48:31 -07001786 if (rc)
1787 pr_err("%s: could not %sable regulators: %d\n",
1788 __func__, on ? "en" : "dis", rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001789 }
1790
1791 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001792}
1793
1794
1795static int lcdc_toshiba_set_bl(int level)
1796{
1797 int ret;
1798
1799 ret = pmapp_disp_backlight_set_brightness(level);
1800 if (ret)
1801 pr_err("%s: can't set lcd backlight!\n", __func__);
1802
1803 return ret;
1804}
1805
1806
1807static struct lcdc_platform_data lcdc_pdata = {
Jeevan Shriram15f2a5e2011-07-13 21:45:26 +05301808 .lcdc_gpio_config = NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001809 .lcdc_power_save = msm_fb_lcdc_power_save,
1810};
1811
1812static int lcd_panel_spi_gpio_num[] = {
1813 GPIO_SPI_MOSI, /* spi_sdi */
1814 GPIO_SPI_MISO, /* spi_sdoi */
1815 GPIO_SPI_CLK, /* spi_clk */
1816 GPIO_SPI_CS0_N, /* spi_cs */
1817};
1818
1819static struct msm_panel_common_pdata lcdc_toshiba_panel_data = {
1820 .panel_config_gpio = lcdc_toshiba_config_gpios,
1821 .pmic_backlight = lcdc_toshiba_set_bl,
1822 .gpio_num = lcd_panel_spi_gpio_num,
1823};
1824
1825static struct platform_device lcdc_toshiba_panel_device = {
1826 .name = "lcdc_toshiba_fwvga_pt",
1827 .id = 0,
1828 .dev = {
1829 .platform_data = &lcdc_toshiba_panel_data,
1830 }
1831};
1832
1833static struct resource msm_fb_resources[] = {
1834 {
1835 .flags = IORESOURCE_DMA,
1836 }
1837};
1838
Ajay Singh Parmareede70e2011-08-24 17:36:08 +05301839#define PANEL_NAME_MAX_LEN 30
1840#define LCDC_TOSHIBA_FWVGA_PANEL_NAME "lcdc_toshiba_fwvga_pt"
1841#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1842
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001843static int msm_fb_detect_panel(const char *name)
1844{
Taniya Das0a5303a2011-08-23 18:47:48 +05301845 int ret = -ENODEV;
1846
1847 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
1848 if (!strncmp(name, "lcdc_toshiba_fwvga_pt", 21) ||
1849 !strncmp(name, "mipi_cmd_renesas_fwvga", 22))
1850 ret = 0;
Jeevan Shriram29c9e952011-10-27 11:22:46 +05301851 } else if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) {
Taniya Das0a5303a2011-08-23 18:47:48 +05301852 if (!strncmp(name, "mipi_cmd_renesas_fwvga", 22))
1853 ret = 0;
1854 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001855
Ajay Singh Parmareede70e2011-08-24 17:36:08 +05301856#if !defined(CONFIG_FB_MSM_LCDC_AUTO_DETECT) && \
1857 !defined(CONFIG_FB_MSM_MIPI_PANEL_AUTO_DETECT) && \
1858 !defined(CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT)
1859 if (machine_is_msm7x27a_surf() ||
1860 machine_is_msm7625a_surf()) {
1861 if (!strncmp(name, LCDC_TOSHIBA_FWVGA_PANEL_NAME,
1862 strnlen(LCDC_TOSHIBA_FWVGA_PANEL_NAME,
1863 PANEL_NAME_MAX_LEN)))
1864 return 0;
1865 }
1866#endif
Taniya Das0a5303a2011-08-23 18:47:48 +05301867 return ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001868}
1869
1870static struct msm_fb_platform_data msm_fb_pdata = {
1871 .detect_client = msm_fb_detect_panel,
1872};
1873
1874static struct platform_device msm_fb_device = {
1875 .name = "msm_fb",
1876 .id = 0,
1877 .num_resources = ARRAY_SIZE(msm_fb_resources),
1878 .resource = msm_fb_resources,
1879 .dev = {
1880 .platform_data = &msm_fb_pdata,
1881 }
1882};
1883
1884#ifdef CONFIG_FB_MSM_MIPI_DSI
1885static int mipi_renesas_set_bl(int level)
1886{
1887 int ret;
1888
1889 ret = pmapp_disp_backlight_set_brightness(level);
1890
1891 if (ret)
1892 pr_err("%s: can't set lcd backlight!\n", __func__);
1893
1894 return ret;
1895}
1896
1897static struct msm_panel_common_pdata mipi_renesas_pdata = {
1898 .pmic_backlight = mipi_renesas_set_bl,
1899};
1900
1901
1902static struct platform_device mipi_dsi_renesas_panel_device = {
1903 .name = "mipi_renesas",
1904 .id = 0,
1905 .dev = {
1906 .platform_data = &mipi_renesas_pdata,
1907 }
1908};
1909#endif
1910
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001911#define SND(desc, num) { .name = #desc, .id = num }
1912static struct snd_endpoint snd_endpoints_list[] = {
1913 SND(HANDSET, 0),
1914 SND(MONO_HEADSET, 2),
1915 SND(HEADSET, 3),
1916 SND(SPEAKER, 6),
1917 SND(TTY_HEADSET, 8),
1918 SND(TTY_VCO, 9),
1919 SND(TTY_HCO, 10),
1920 SND(BT, 12),
1921 SND(IN_S_SADC_OUT_HANDSET, 16),
1922 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
1923 SND(FM_DIGITAL_STEREO_HEADSET, 26),
1924 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
1925 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +05301926 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Sidipotu Ashokab34ca42011-07-22 16:34:20 +05301927 SND(CURRENT, 0x7FFFFFFE),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001928 SND(FM_ANALOG_STEREO_HEADSET, 35),
1929 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
1930};
1931#undef SND
1932
1933static struct msm_snd_endpoints msm_device_snd_endpoints = {
1934 .endpoints = snd_endpoints_list,
1935 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
1936};
1937
1938static struct platform_device msm_device_snd = {
1939 .name = "msm_snd",
1940 .id = -1,
1941 .dev = {
1942 .platform_data = &msm_device_snd_endpoints
1943 },
1944};
1945
1946#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1947 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1948 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1949 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1950 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1951 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1952#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1953 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1954 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1955 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1956 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1957 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1958#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1959 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1960 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1961 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1962 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1963 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1964#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1965 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1966 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1967 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1968 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1969 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1970#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
1971
1972static unsigned int dec_concurrency_table[] = {
1973 /* Audio LP */
1974 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
1975 0, 0, 0,
1976
1977 /* Concurrency 1 */
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 2 */
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_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1989 (DEC4_FORMAT),
1990
1991 /* Concurrency 3 */
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_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1995 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1996 (DEC4_FORMAT),
1997
1998 /* Concurrency 4 */
1999 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2000 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(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 5 */
2006 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2007 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2008 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2009 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2010 (DEC4_FORMAT),
2011
2012 /* Concurrency 6 */
2013 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2014 0, 0, 0, 0,
2015
2016 /* Concurrency 7 */
2017 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2018 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2019 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2020 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2021 (DEC4_FORMAT),
2022};
2023
2024#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
2025 .module_queueid = queueid, .module_decid = decid, \
2026 .nr_codec_support = nr_codec}
2027
2028static struct msm_adspdec_info dec_info_list[] = {
2029 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
2030 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
2031 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
2032 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
2033 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
2034};
2035
2036static struct msm_adspdec_database msm_device_adspdec_database = {
2037 .num_dec = ARRAY_SIZE(dec_info_list),
2038 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
2039 ARRAY_SIZE(dec_info_list)),
2040 .dec_concurrency_table = dec_concurrency_table,
2041 .dec_info_list = dec_info_list,
2042};
2043
2044static struct platform_device msm_device_adspdec = {
2045 .name = "msm_adspdec",
2046 .id = -1,
2047 .dev = {
2048 .platform_data = &msm_device_adspdec_database
2049 },
2050};
2051
2052static struct android_pmem_platform_data android_pmem_audio_pdata = {
2053 .name = "pmem_audio",
2054 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
2055 .cached = 0,
2056 .memory_type = MEMTYPE_EBI1,
2057};
2058
2059static struct platform_device android_pmem_audio_device = {
2060 .name = "android_pmem",
2061 .id = 2,
2062 .dev = { .platform_data = &android_pmem_audio_pdata },
2063};
2064
2065static struct android_pmem_platform_data android_pmem_pdata = {
2066 .name = "pmem",
2067 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
2068 .cached = 1,
2069 .memory_type = MEMTYPE_EBI1,
2070};
2071static struct platform_device android_pmem_device = {
2072 .name = "android_pmem",
2073 .id = 0,
2074 .dev = { .platform_data = &android_pmem_pdata },
2075};
2076
2077static u32 msm_calculate_batt_capacity(u32 current_voltage);
2078
2079static struct msm_psy_batt_pdata msm_psy_batt_data = {
2080 .voltage_min_design = 2800,
2081 .voltage_max_design = 4300,
2082 .avail_chg_sources = AC_CHG | USB_CHG ,
2083 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
2084 .calculate_capacity = &msm_calculate_batt_capacity,
2085};
2086
2087static u32 msm_calculate_batt_capacity(u32 current_voltage)
2088{
2089 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
2090 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
2091
2092 return (current_voltage - low_voltage) * 100
2093 / (high_voltage - low_voltage);
2094}
2095
2096static struct platform_device msm_batt_device = {
2097 .name = "msm-battery",
2098 .id = -1,
2099 .dev.platform_data = &msm_psy_batt_data,
2100};
2101
2102static struct smsc911x_platform_config smsc911x_config = {
2103 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
2104 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
2105 .flags = SMSC911X_USE_16BIT,
2106};
2107
2108static struct resource smsc911x_resources[] = {
2109 [0] = {
2110 .start = 0x90000000,
2111 .end = 0x90007fff,
2112 .flags = IORESOURCE_MEM,
2113 },
2114 [1] = {
2115 .start = MSM_GPIO_TO_INT(48),
2116 .end = MSM_GPIO_TO_INT(48),
2117 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
2118 },
2119};
2120
2121static struct platform_device smsc911x_device = {
2122 .name = "smsc911x",
2123 .id = 0,
2124 .num_resources = ARRAY_SIZE(smsc911x_resources),
2125 .resource = smsc911x_resources,
2126 .dev = {
2127 .platform_data = &smsc911x_config,
2128 },
2129};
2130
2131static struct msm_gpio smsc911x_gpios[] = {
2132 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
2133 "smsc911x_irq" },
2134 { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
2135 "eth_fifo_sel" },
2136};
2137
2138#define ETH_FIFO_SEL_GPIO 49
2139static void msm7x27a_cfg_smsc911x(void)
2140{
2141 int res;
2142
2143 res = msm_gpios_request_enable(smsc911x_gpios,
2144 ARRAY_SIZE(smsc911x_gpios));
2145 if (res) {
2146 pr_err("%s: unable to enable gpios for SMSC911x\n", __func__);
2147 return;
2148 }
2149
2150 /* ETH_FIFO_SEL */
2151 res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0);
2152 if (res) {
2153 pr_err("%s: unable to get direction for gpio %d\n", __func__,
2154 ETH_FIFO_SEL_GPIO);
2155 msm_gpios_disable_free(smsc911x_gpios,
2156 ARRAY_SIZE(smsc911x_gpios));
2157 return;
2158 }
2159 gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
2160}
2161
2162#ifdef CONFIG_MSM_CAMERA
2163static uint32_t camera_off_gpio_table[] = {
2164 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
2165};
2166
2167static uint32_t camera_on_gpio_table[] = {
2168 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
2169};
2170
2171#ifdef CONFIG_MSM_CAMERA_FLASH
2172static struct msm_camera_sensor_flash_src msm_flash_src = {
Nishant Pandit474f2252011-07-23 23:17:56 +05302173 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
2174 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
2175 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002176};
2177#endif
2178
Justin Paupored98328e2011-08-19 13:48:31 -07002179static struct regulator_bulk_data regs_camera[] = {
2180 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
2181 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2182 { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
2183};
2184
2185static void __init msm_camera_vreg_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002186{
2187 int rc;
2188
Justin Paupored98328e2011-08-19 13:48:31 -07002189 rc = regulator_bulk_get(NULL, 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 get regulators: %d\n", __func__, rc);
2193 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002194 }
2195
Justin Paupored98328e2011-08-19 13:48:31 -07002196 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002197
Justin Paupored98328e2011-08-19 13:48:31 -07002198 if (rc) {
2199 pr_err("%s: could not set voltages: %d\n", __func__, rc);
2200 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002201 }
Justin Paupored98328e2011-08-19 13:48:31 -07002202}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002203
Justin Paupored98328e2011-08-19 13:48:31 -07002204static void msm_camera_vreg_config(int vreg_en)
2205{
2206 int rc = vreg_en ?
2207 regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
2208 regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002209
Justin Paupored98328e2011-08-19 13:48:31 -07002210 if (rc)
2211 pr_err("%s: could not %sable regulators: %d\n",
2212 __func__, vreg_en ? "en" : "dis", rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002213}
2214
2215static int config_gpio_table(uint32_t *table, int len)
2216{
2217 int rc = 0, i = 0;
2218
2219 for (i = 0; i < len; i++) {
2220 rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
2221 if (rc) {
2222 pr_err("%s not able to get gpio\n", __func__);
2223 for (i--; i >= 0; i--)
2224 gpio_tlmm_config(camera_off_gpio_table[i],
2225 GPIO_CFG_ENABLE);
2226 break;
2227 }
2228 }
2229 return rc;
2230}
2231
2232static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data;
2233static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data;
2234static int config_camera_on_gpios_rear(void)
2235{
2236 int rc = 0;
2237
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302238 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002239 msm_camera_vreg_config(1);
2240
2241 rc = config_gpio_table(camera_on_gpio_table,
2242 ARRAY_SIZE(camera_on_gpio_table));
2243 if (rc < 0) {
2244 pr_err("%s: CAMSENSOR gpio table request"
2245 "failed\n", __func__);
2246 return rc;
2247 }
2248
2249 return rc;
2250}
2251
2252static void config_camera_off_gpios_rear(void)
2253{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302254 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002255 msm_camera_vreg_config(0);
2256
2257 config_gpio_table(camera_off_gpio_table,
2258 ARRAY_SIZE(camera_off_gpio_table));
2259}
2260
2261static int config_camera_on_gpios_front(void)
2262{
2263 int rc = 0;
2264
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302265 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002266 msm_camera_vreg_config(1);
2267
2268 rc = config_gpio_table(camera_on_gpio_table,
2269 ARRAY_SIZE(camera_on_gpio_table));
2270 if (rc < 0) {
2271 pr_err("%s: CAMSENSOR gpio table request"
2272 "failed\n", __func__);
2273 return rc;
2274 }
2275
2276 return rc;
2277}
2278
2279static void config_camera_off_gpios_front(void)
2280{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302281 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002282 msm_camera_vreg_config(0);
2283
2284 config_gpio_table(camera_off_gpio_table,
2285 ARRAY_SIZE(camera_off_gpio_table));
2286}
2287
2288struct msm_camera_device_platform_data msm_camera_device_data_rear = {
2289 .camera_gpio_on = config_camera_on_gpios_rear,
2290 .camera_gpio_off = config_camera_off_gpios_rear,
2291 .ioext.csiphy = 0xA1000000,
2292 .ioext.csisz = 0x00100000,
2293 .ioext.csiirq = INT_CSI_IRQ_1,
2294 .ioclk.mclk_clk_rate = 24000000,
2295 .ioclk.vfe_clk_rate = 192000000,
2296 .ioext.appphy = MSM_CLK_CTL_PHYS,
2297 .ioext.appsz = MSM_CLK_CTL_SIZE,
2298};
2299
2300struct msm_camera_device_platform_data msm_camera_device_data_front = {
2301 .camera_gpio_on = config_camera_on_gpios_front,
2302 .camera_gpio_off = config_camera_off_gpios_front,
2303 .ioext.csiphy = 0xA0F00000,
2304 .ioext.csisz = 0x00100000,
2305 .ioext.csiirq = INT_CSI_IRQ_0,
2306 .ioclk.mclk_clk_rate = 24000000,
2307 .ioclk.vfe_clk_rate = 192000000,
2308 .ioext.appphy = MSM_CLK_CTL_PHYS,
2309 .ioext.appsz = MSM_CLK_CTL_SIZE,
2310};
2311
2312#ifdef CONFIG_S5K4E1
2313static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = {
2314 .mount_angle = 90
2315};
2316
2317static struct msm_camera_sensor_flash_data flash_s5k4e1 = {
2318 .flash_type = MSM_CAMERA_FLASH_LED,
2319 .flash_src = &msm_flash_src
2320};
2321
2322static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = {
2323 .sensor_name = "s5k4e1",
2324 .sensor_reset_enable = 1,
2325 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N,
2326 .sensor_pwd = 85,
2327 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
2328 .vcm_enable = 1,
2329 .pdata = &msm_camera_device_data_rear,
2330 .flash_data = &flash_s5k4e1,
2331 .sensor_platform_info = &s5k4e1_sensor_7627a_info,
2332 .csi_if = 1
2333};
2334
2335static struct platform_device msm_camera_sensor_s5k4e1 = {
2336 .name = "msm_camera_s5k4e1",
2337 .dev = {
2338 .platform_data = &msm_camera_sensor_s5k4e1_data,
2339 },
2340};
2341#endif
2342
2343#ifdef CONFIG_IMX072
2344static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = {
2345 .mount_angle = 90
2346};
2347
2348static struct msm_camera_sensor_flash_data flash_imx072 = {
2349 .flash_type = MSM_CAMERA_FLASH_LED,
2350 .flash_src = &msm_flash_src
2351};
2352
2353static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = {
2354 .sensor_name = "imx072",
2355 .sensor_reset_enable = 1,
2356 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/
2357 .sensor_pwd = 85,
2358 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
2359 .vcm_enable = 1,
2360 .pdata = &msm_camera_device_data_rear,
2361 .flash_data = &flash_imx072,
2362 .sensor_platform_info = &imx072_sensor_7627a_info,
2363 .csi_if = 1
2364};
2365
2366static struct platform_device msm_camera_sensor_imx072 = {
2367 .name = "msm_camera_imx072",
2368 .dev = {
2369 .platform_data = &msm_camera_sensor_imx072_data,
2370 },
2371};
2372#endif
2373
2374#ifdef CONFIG_WEBCAM_OV9726
2375static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = {
2376 .mount_angle = 90
2377};
2378
2379static struct msm_camera_sensor_flash_data flash_ov9726 = {
2380 .flash_type = MSM_CAMERA_FLASH_NONE,
2381 .flash_src = &msm_flash_src
2382};
2383
2384static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
2385 .sensor_name = "ov9726",
2386 .sensor_reset_enable = 0,
2387 .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR,
2388 .sensor_pwd = 85,
2389 .vcm_pwd = 1,
2390 .vcm_enable = 0,
2391 .pdata = &msm_camera_device_data_front,
2392 .flash_data = &flash_ov9726,
2393 .sensor_platform_info = &ov9726_sensor_7627a_info,
2394 .csi_if = 1
2395};
2396
2397static struct platform_device msm_camera_sensor_ov9726 = {
2398 .name = "msm_camera_ov9726",
2399 .dev = {
2400 .platform_data = &msm_camera_sensor_ov9726_data,
2401 },
2402};
Justin Paupored98328e2011-08-19 13:48:31 -07002403#else
2404static inline void msm_camera_vreg_init(void) { }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002405#endif
2406
2407#ifdef CONFIG_MT9E013
2408static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = {
2409 .mount_angle = 90
2410};
2411
2412static struct msm_camera_sensor_flash_data flash_mt9e013 = {
2413 .flash_type = MSM_CAMERA_FLASH_LED,
2414 .flash_src = &msm_flash_src
2415};
2416
2417static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
2418 .sensor_name = "mt9e013",
2419 .sensor_reset = 0,
2420 .sensor_reset_enable = 1,
2421 .sensor_pwd = 85,
2422 .vcm_pwd = 1,
2423 .vcm_enable = 0,
2424 .pdata = &msm_camera_device_data_rear,
2425 .flash_data = &flash_mt9e013,
2426 .sensor_platform_info = &mt9e013_sensor_7627a_info,
2427 .csi_if = 1
2428};
2429
2430static struct platform_device msm_camera_sensor_mt9e013 = {
2431 .name = "msm_camera_mt9e013",
2432 .dev = {
2433 .platform_data = &msm_camera_sensor_mt9e013_data,
2434 },
2435};
2436#endif
2437
2438static struct i2c_board_info i2c_camera_devices[] = {
2439 #ifdef CONFIG_S5K4E1
2440 {
2441 I2C_BOARD_INFO("s5k4e1", 0x36),
2442 },
2443 {
2444 I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1),
2445 },
2446 #endif
2447 #ifdef CONFIG_WEBCAM_OV9726
2448 {
2449 I2C_BOARD_INFO("ov9726", 0x10),
2450 },
2451 #endif
2452 #ifdef CONFIG_IMX072
2453 {
2454 I2C_BOARD_INFO("imx072", 0x34),
2455 },
2456 #endif
2457 #ifdef CONFIG_MT9E013
2458 {
2459 I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
2460 },
2461 #endif
2462 {
Nishant Pandit474f2252011-07-23 23:17:56 +05302463 I2C_BOARD_INFO("sc628a", 0x6E),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002464 },
2465};
2466#endif
2467#if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \
2468 && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM)
2469static struct msm_gpio uart2dm_gpios[] = {
2470 {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2471 "uart2dm_rfr_n" },
2472 {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2473 "uart2dm_cts_n" },
2474 {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2475 "uart2dm_rx" },
2476 {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2477 "uart2dm_tx" },
2478};
2479
2480static void msm7x27a_cfg_uart2dm_serial(void)
2481{
2482 int ret;
2483 ret = msm_gpios_request_enable(uart2dm_gpios,
2484 ARRAY_SIZE(uart2dm_gpios));
2485 if (ret)
2486 pr_err("%s: unable to enable gpios for uart2dm\n", __func__);
2487}
2488#else
2489static void msm7x27a_cfg_uart2dm_serial(void) { }
2490#endif
2491
2492static struct platform_device *rumi_sim_devices[] __initdata = {
2493 &msm_device_dmov,
2494 &msm_device_smd,
2495 &smc91x_device,
2496 &msm_device_uart1,
2497 &msm_device_nand,
2498 &msm_device_uart_dm1,
2499 &msm_gsbi0_qup_i2c_device,
2500 &msm_gsbi1_qup_i2c_device,
2501};
2502
2503static struct platform_device *surf_ffa_devices[] __initdata = {
2504 &msm_device_dmov,
2505 &msm_device_smd,
2506 &msm_device_uart1,
2507 &msm_device_uart_dm1,
2508 &msm_device_uart_dm2,
2509 &msm_device_nand,
2510 &msm_gsbi0_qup_i2c_device,
2511 &msm_gsbi1_qup_i2c_device,
2512 &msm_device_otg,
2513 &msm_device_gadget_peripheral,
2514 &android_usb_device,
2515 &android_pmem_device,
2516 &android_pmem_adsp_device,
2517 &android_pmem_audio_device,
2518 &msm_device_snd,
2519 &msm_device_adspdec,
2520 &msm_fb_device,
2521 &lcdc_toshiba_panel_device,
2522 &msm_batt_device,
2523 &smsc911x_device,
2524#ifdef CONFIG_S5K4E1
2525 &msm_camera_sensor_s5k4e1,
2526#endif
2527#ifdef CONFIG_IMX072
2528 &msm_camera_sensor_imx072,
2529#endif
2530#ifdef CONFIG_WEBCAM_OV9726
2531 &msm_camera_sensor_ov9726,
2532#endif
2533#ifdef CONFIG_MT9E013
2534 &msm_camera_sensor_mt9e013,
2535#endif
2536#ifdef CONFIG_FB_MSM_MIPI_DSI
2537 &mipi_dsi_renesas_panel_device,
2538#endif
2539 &msm_kgsl_3d0,
2540#ifdef CONFIG_BT
2541 &msm_bt_power_device,
2542#endif
Manish Dewangan3a260992011-06-24 18:01:34 +05302543 &asoc_msm_pcm,
2544 &asoc_msm_dai0,
2545 &asoc_msm_dai1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002546};
2547
2548static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
2549static int __init pmem_kernel_ebi1_size_setup(char *p)
2550{
2551 pmem_kernel_ebi1_size = memparse(p, NULL);
2552 return 0;
2553}
2554early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
2555
2556static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
2557static int __init pmem_audio_size_setup(char *p)
2558{
2559 pmem_audio_size = memparse(p, NULL);
2560 return 0;
2561}
2562early_param("pmem_audio_size", pmem_audio_size_setup);
2563
2564static void __init msm_msm7x2x_allocate_memory_regions(void)
2565{
2566 void *addr;
2567 unsigned long size;
2568
2569 size = fb_size ? : MSM_FB_SIZE;
2570 addr = alloc_bootmem_align(size, 0x1000);
2571 msm_fb_resources[0].start = __pa(addr);
2572 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2573 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2574 size, addr, __pa(addr));
2575}
2576
2577static struct memtype_reserve msm7x27a_reserve_table[] __initdata = {
2578 [MEMTYPE_SMI] = {
2579 },
2580 [MEMTYPE_EBI0] = {
2581 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2582 },
2583 [MEMTYPE_EBI1] = {
2584 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2585 },
2586};
2587
2588static void __init size_pmem_devices(void)
2589{
2590#ifdef CONFIG_ANDROID_PMEM
2591 android_pmem_adsp_pdata.size = pmem_adsp_size;
2592 android_pmem_pdata.size = pmem_mdp_size;
2593 android_pmem_audio_pdata.size = pmem_audio_size;
2594#endif
2595}
2596
2597static void __init reserve_memory_for(struct android_pmem_platform_data *p)
2598{
2599 msm7x27a_reserve_table[p->memory_type].size += p->size;
2600}
2601
2602static void __init reserve_pmem_memory(void)
2603{
2604#ifdef CONFIG_ANDROID_PMEM
2605 reserve_memory_for(&android_pmem_adsp_pdata);
2606 reserve_memory_for(&android_pmem_pdata);
2607 reserve_memory_for(&android_pmem_audio_pdata);
2608 msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
2609#endif
2610}
2611
2612static void __init msm7x27a_calculate_reserve_sizes(void)
2613{
2614 size_pmem_devices();
2615 reserve_pmem_memory();
2616}
2617
2618static int msm7x27a_paddr_to_memtype(unsigned int paddr)
2619{
2620 return MEMTYPE_EBI1;
2621}
2622
2623static struct reserve_info msm7x27a_reserve_info __initdata = {
2624 .memtype_reserve_table = msm7x27a_reserve_table,
2625 .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes,
2626 .paddr_to_memtype = msm7x27a_paddr_to_memtype,
2627};
2628
2629static void __init msm7x27a_reserve(void)
2630{
2631 reserve_info = &msm7x27a_reserve_info;
2632 msm_reserve();
2633}
2634
2635static void __init msm_device_i2c_init(void)
2636{
2637 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
2638 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
2639}
2640
2641static struct msm_panel_common_pdata mdp_pdata = {
2642 .gpio = 97,
2643 .mdp_rev = MDP_REV_303,
2644};
2645
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302646
2647#ifdef CONFIG_FB_MSM
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002648#define GPIO_LCDC_BRDG_PD 128
2649#define GPIO_LCDC_BRDG_RESET_N 129
2650
2651#define LCDC_RESET_PHYS 0x90008014
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302652
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002653static void __iomem *lcdc_reset_ptr;
2654
2655static unsigned mipi_dsi_gpio[] = {
2656 GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
2657 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2658 GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
2659 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2660};
2661
2662enum {
2663 DSI_SINGLE_LANE = 1,
2664 DSI_TWO_LANES,
2665};
2666
2667static int msm_fb_get_lane_config(void)
2668{
2669 int rc = DSI_TWO_LANES;
2670
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302671 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002672 rc = DSI_SINGLE_LANE;
2673 pr_info("DSI Single Lane\n");
2674 } else {
2675 pr_info("DSI Two Lanes\n");
2676 }
2677 return rc;
2678}
2679
2680static int msm_fb_dsi_client_reset(void)
2681{
2682 int rc = 0;
2683
2684 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
2685 if (rc < 0) {
2686 pr_err("failed to request lcd brdg reset_n\n");
2687 return rc;
2688 }
2689
2690 rc = gpio_request(GPIO_LCDC_BRDG_PD, "lcdc_brdg_pd");
2691 if (rc < 0) {
2692 pr_err("failed to request lcd brdg pd\n");
2693 return rc;
2694 }
2695
2696 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
2697 if (rc) {
2698 pr_err("Failed to enable LCDC Bridge reset enable\n");
2699 goto gpio_error;
2700 }
2701
2702 rc = gpio_tlmm_config(mipi_dsi_gpio[1], GPIO_CFG_ENABLE);
2703 if (rc) {
2704 pr_err("Failed to enable LCDC Bridge pd enable\n");
2705 goto gpio_error2;
2706 }
2707
2708 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
2709 rc |= gpio_direction_output(GPIO_LCDC_BRDG_PD, 1);
2710 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
2711
2712 if (!rc) {
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302713 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002714 lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS,
2715 sizeof(uint32_t));
2716
2717 if (!lcdc_reset_ptr)
2718 return 0;
2719 }
2720 return rc;
2721 } else {
2722 goto gpio_error;
2723 }
2724
2725gpio_error2:
2726 pr_err("Failed GPIO bridge pd\n");
2727 gpio_free(GPIO_LCDC_BRDG_PD);
2728
2729gpio_error:
2730 pr_err("Failed GPIO bridge reset\n");
2731 gpio_free(GPIO_LCDC_BRDG_RESET_N);
2732 return rc;
2733}
2734
Justin Paupored98328e2011-08-19 13:48:31 -07002735static struct regulator_bulk_data regs_dsi[] = {
2736 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2737 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002738};
2739
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740static int dsi_gpio_initialized;
2741
2742static int mipi_dsi_panel_power(int on)
2743{
Justin Paupored98328e2011-08-19 13:48:31 -07002744 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002745 uint32_t lcdc_reset_cfg;
2746
2747 /* I2C-controlled GPIO Expander -init of the GPIOs very late */
Justin Paupored98328e2011-08-19 13:48:31 -07002748 if (unlikely(!dsi_gpio_initialized)) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002749 pmapp_disp_backlight_init();
2750
2751 rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr");
2752 if (rc < 0) {
2753 pr_err("failed to request gpio_disp_pwr\n");
2754 return rc;
2755 }
2756
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302757 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002758 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1);
2759 if (rc < 0) {
2760 pr_err("failed to enable display pwr\n");
2761 goto fail_gpio1;
2762 }
2763
2764 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
2765 if (rc < 0) {
2766 pr_err("failed to request gpio_bkl_en\n");
2767 goto fail_gpio1;
2768 }
2769
2770 rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
2771 if (rc < 0) {
2772 pr_err("failed to enable backlight\n");
2773 goto fail_gpio2;
2774 }
2775 }
2776
Justin Paupored98328e2011-08-19 13:48:31 -07002777 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
2778 if (rc) {
2779 pr_err("%s: could not get regulators: %d\n",
2780 __func__, rc);
2781 goto fail_gpio2;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002782 }
Justin Paupored98328e2011-08-19 13:48:31 -07002783
2784 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi);
2785 if (rc) {
2786 pr_err("%s: could not set voltages: %d\n",
2787 __func__, rc);
2788 goto fail_vreg;
2789 }
2790
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002791 dsi_gpio_initialized = 1;
2792 }
2793
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302794 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07002795 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
2796 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302797 } else if (machine_is_msm7x27a_ffa() ||
2798 machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002799 if (on) {
Justin Paupored98328e2011-08-19 13:48:31 -07002800 /* This line drives an active low pin on FFA */
2801 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on);
2802 if (rc < 0)
2803 pr_err("failed to set direction for "
2804 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002805 } else {
Justin Paupored98328e2011-08-19 13:48:31 -07002806 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on);
2807 rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN);
2808 if (rc < 0)
2809 pr_err("failed to set direction for "
2810 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002811 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002812 }
2813
Justin Paupored98328e2011-08-19 13:48:31 -07002814 if (on) {
2815 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
2816
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302817 if (machine_is_msm7x27a_surf() ||
2818 machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07002819 lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr);
2820 rmb();
2821 lcdc_reset_cfg &= ~1;
2822
2823 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
2824 msleep(20);
2825 wmb();
2826 lcdc_reset_cfg |= 1;
2827 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
2828 } else {
2829 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
2830 msleep(20);
2831 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
2832 }
2833
2834 if (pmapp_disp_backlight_set_brightness(100))
2835 pr_err("backlight set brightness failed\n");
2836 } else {
2837 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1);
2838
2839 if (pmapp_disp_backlight_set_brightness(0))
2840 pr_err("backlight set brightness failed\n");
2841 }
2842
2843 rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) :
2844 regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi);
2845
2846 if (rc)
2847 pr_err("%s: could not %sable regulators: %d\n",
2848 __func__, on ? "en" : "dis", rc);
2849
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002850 return rc;
2851
Justin Paupored98328e2011-08-19 13:48:31 -07002852fail_vreg:
2853 regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002854fail_gpio2:
2855 gpio_free(GPIO_BACKLIGHT_EN);
2856fail_gpio1:
2857 gpio_free(GPIO_DISPLAY_PWR_EN);
2858 dsi_gpio_initialized = 0;
2859 return rc;
2860}
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302861#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002862
2863#define MDP_303_VSYNC_GPIO 97
2864
2865#ifdef CONFIG_FB_MSM_MDP303
2866static struct mipi_dsi_platform_data mipi_dsi_pdata = {
2867 .vsync_gpio = MDP_303_VSYNC_GPIO,
2868 .dsi_power_save = mipi_dsi_panel_power,
2869 .dsi_client_reset = msm_fb_dsi_client_reset,
2870 .get_lane_config = msm_fb_get_lane_config,
2871};
2872#endif
2873
2874static void __init msm_fb_add_devices(void)
2875{
2876 msm_fb_register_device("mdp", &mdp_pdata);
2877 msm_fb_register_device("lcdc", &lcdc_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302878#ifdef CONFIG_FB_MSM_MDP303
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002879 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302880#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002881}
2882
2883#define MSM_EBI2_PHYS 0xa0d00000
2884#define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030
2885
2886static void __init msm7x27a_init_ebi2(void)
2887{
2888 uint32_t ebi2_cfg;
2889 void __iomem *ebi2_cfg_ptr;
2890
2891 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t));
2892 if (!ebi2_cfg_ptr)
2893 return;
2894
2895 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302896 if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() ||
2897 machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002898 ebi2_cfg |= (1 << 4); /* CS2 */
2899
2900 writel(ebi2_cfg, ebi2_cfg_ptr);
2901 iounmap(ebi2_cfg_ptr);
2902
2903 /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */
2904 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1,
2905 sizeof(uint32_t));
2906 if (!ebi2_cfg_ptr)
2907 return;
2908
2909 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302910 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002911 ebi2_cfg |= (1 << 31);
2912
2913 writel(ebi2_cfg, ebi2_cfg_ptr);
2914 iounmap(ebi2_cfg_ptr);
2915}
2916
2917#define ATMEL_TS_I2C_NAME "maXTouch"
Justin Paupored98328e2011-08-19 13:48:31 -07002918
2919static struct regulator_bulk_data regs_atmel[] = {
2920 { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 },
2921 { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 },
2922};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002923
2924#define ATMEL_TS_GPIO_IRQ 82
2925
2926static int atmel_ts_power_on(bool on)
2927{
Justin Paupored98328e2011-08-19 13:48:31 -07002928 int rc = on ?
2929 regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) :
2930 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002931
Justin Paupored98328e2011-08-19 13:48:31 -07002932 if (rc)
2933 pr_err("%s: could not %sable regulators: %d\n",
2934 __func__, on ? "en" : "dis", rc);
2935 else
2936 msleep(50);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002937
Justin Paupored98328e2011-08-19 13:48:31 -07002938 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002939}
2940
2941static int atmel_ts_platform_init(struct i2c_client *client)
2942{
2943 int rc;
Justin Paupored98328e2011-08-19 13:48:31 -07002944 struct device *dev = &client->dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002945
Justin Paupored98328e2011-08-19 13:48:31 -07002946 rc = regulator_bulk_get(dev, 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 get regulators: %d\n",
2949 __func__, rc);
2950 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002951 }
2952
Justin Paupored98328e2011-08-19 13:48:31 -07002953 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002954 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002955 dev_err(dev, "%s: could not set voltages: %d\n",
2956 __func__, rc);
2957 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002958 }
2959
2960 rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2961 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
2962 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
2963 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002964 dev_err(dev, "%s: gpio_tlmm_config for %d failed\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002965 __func__, ATMEL_TS_GPIO_IRQ);
Justin Paupored98328e2011-08-19 13:48:31 -07002966 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002967 }
2968
2969 /* configure touchscreen interrupt gpio */
2970 rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio");
2971 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002972 dev_err(dev, "%s: unable to request gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002973 __func__, ATMEL_TS_GPIO_IRQ);
2974 goto ts_gpio_tlmm_unconfig;
2975 }
2976
2977 rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ);
2978 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -07002979 dev_err(dev, "%s: unable to set the direction of gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002980 __func__, ATMEL_TS_GPIO_IRQ);
2981 goto free_ts_gpio;
2982 }
2983 return 0;
2984
2985free_ts_gpio:
2986 gpio_free(ATMEL_TS_GPIO_IRQ);
2987ts_gpio_tlmm_unconfig:
2988 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2989 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
2990 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07002991reg_free:
2992 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
2993out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002994 return rc;
2995}
2996
2997static int atmel_ts_platform_exit(struct i2c_client *client)
2998{
2999 gpio_free(ATMEL_TS_GPIO_IRQ);
3000 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
3001 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
3002 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07003003 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
3004 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003005 return 0;
3006}
3007
3008static u8 atmel_ts_read_chg(void)
3009{
3010 return gpio_get_value(ATMEL_TS_GPIO_IRQ);
3011}
3012
3013static u8 atmel_ts_valid_interrupt(void)
3014{
3015 return !atmel_ts_read_chg();
3016}
3017
3018#define ATMEL_X_OFFSET 13
3019#define ATMEL_Y_OFFSET 0
3020
3021static struct mxt_platform_data atmel_ts_pdata = {
3022 .numtouch = 4,
3023 .init_platform_hw = atmel_ts_platform_init,
3024 .exit_platform_hw = atmel_ts_platform_exit,
3025 .power_on = atmel_ts_power_on,
3026 .display_res_x = 480,
3027 .display_res_y = 864,
3028 .min_x = ATMEL_X_OFFSET,
3029 .max_x = (505 - ATMEL_X_OFFSET),
3030 .min_y = ATMEL_Y_OFFSET,
3031 .max_y = (863 - ATMEL_Y_OFFSET),
3032 .valid_interrupt = atmel_ts_valid_interrupt,
3033 .read_chg = atmel_ts_read_chg,
3034};
3035
3036static struct i2c_board_info atmel_ts_i2c_info[] __initdata = {
3037 {
3038 I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a),
3039 .platform_data = &atmel_ts_pdata,
3040 .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ),
3041 },
3042};
3043
3044#define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col))
3045
3046static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35};
3047static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40};
3048
3049static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) *
3050 ARRAY_SIZE(kp_row_gpios)] = {
3051 [KP_INDEX(0, 0)] = KEY_7,
3052 [KP_INDEX(0, 1)] = KEY_DOWN,
3053 [KP_INDEX(0, 2)] = KEY_UP,
3054 [KP_INDEX(0, 3)] = KEY_RIGHT,
3055 [KP_INDEX(0, 4)] = KEY_ENTER,
3056
3057 [KP_INDEX(1, 0)] = KEY_LEFT,
3058 [KP_INDEX(1, 1)] = KEY_SEND,
3059 [KP_INDEX(1, 2)] = KEY_1,
3060 [KP_INDEX(1, 3)] = KEY_4,
3061 [KP_INDEX(1, 4)] = KEY_CLEAR,
3062
3063 [KP_INDEX(2, 0)] = KEY_6,
3064 [KP_INDEX(2, 1)] = KEY_5,
3065 [KP_INDEX(2, 2)] = KEY_8,
3066 [KP_INDEX(2, 3)] = KEY_3,
3067 [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR,
3068
3069 [KP_INDEX(3, 0)] = KEY_9,
3070 [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND,
3071 [KP_INDEX(3, 2)] = KEY_0,
3072 [KP_INDEX(3, 3)] = KEY_2,
3073 [KP_INDEX(3, 4)] = KEY_SLEEP,
3074
3075 [KP_INDEX(4, 0)] = KEY_BACK,
3076 [KP_INDEX(4, 1)] = KEY_HOME,
3077 [KP_INDEX(4, 2)] = KEY_MENU,
3078 [KP_INDEX(4, 3)] = KEY_VOLUMEUP,
3079 [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN,
3080};
3081
3082/* SURF keypad platform device information */
3083static struct gpio_event_matrix_info kp_matrix_info = {
3084 .info.func = gpio_event_matrix_func,
3085 .keymap = keymap,
3086 .output_gpios = kp_row_gpios,
3087 .input_gpios = kp_col_gpios,
3088 .noutputs = ARRAY_SIZE(kp_row_gpios),
3089 .ninputs = ARRAY_SIZE(kp_col_gpios),
3090 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
3091 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
3092 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
3093 GPIOKPF_PRINT_UNMAPPED_KEYS,
3094};
3095
3096static struct gpio_event_info *kp_info[] = {
3097 &kp_matrix_info.info
3098};
3099
3100static struct gpio_event_platform_data kp_pdata = {
3101 .name = "7x27a_kp",
3102 .info = kp_info,
3103 .info_count = ARRAY_SIZE(kp_info)
3104};
3105
3106static struct platform_device kp_pdev = {
3107 .name = GPIO_EVENT_DEV_NAME,
3108 .id = -1,
3109 .dev = {
3110 .platform_data = &kp_pdata,
3111 },
3112};
3113
3114static struct msm_handset_platform_data hs_platform_data = {
3115 .hs_name = "7k_handset",
3116 .pwr_key_delay_ms = 500, /* 0 will disable end key */
3117};
3118
3119static struct platform_device hs_pdev = {
3120 .name = "msm-handset",
3121 .id = -1,
3122 .dev = {
3123 .platform_data = &hs_platform_data,
3124 },
3125};
3126
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003127static struct platform_device msm_proccomm_regulator_dev = {
3128 .name = PROCCOMM_REGULATOR_DEV_NAME,
3129 .id = -1,
3130 .dev = {
3131 .platform_data = &msm7x27a_proccomm_regulator_data
3132 }
3133};
3134
Trilok Soni16f61af2011-07-26 16:06:58 +05303135static void __init msm7627a_rumi3_init(void)
3136{
3137 msm7x27a_init_ebi2();
3138 platform_add_devices(rumi_sim_devices,
3139 ARRAY_SIZE(rumi_sim_devices));
3140}
3141
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003142#define LED_GPIO_PDM 96
3143#define UART1DM_RX_GPIO 45
Santosh Sajjanb479f0f2011-08-18 21:00:44 +05303144
3145#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3146static int __init msm7x27a_init_ar6000pm(void)
3147{
3148 return platform_device_register(&msm_wlan_ar6000_pm_device);
3149}
3150#else
3151static int __init msm7x27a_init_ar6000pm(void) { return 0; }
3152#endif
3153
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003154static void __init msm7x27a_init_regulators(void)
3155{
3156 int rc = platform_device_register(&msm_proccomm_regulator_dev);
3157 if (rc)
3158 pr_err("%s: could not register regulator device: %d\n",
3159 __func__, rc);
3160}
3161
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003162static void __init msm7x2x_init(void)
3163{
Trilok Sonia416c492011-07-22 20:20:23 +05303164 msm7x2x_misc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003165
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003166 /* Initialize regulators first so that other devices can use them */
3167 msm7x27a_init_regulators();
3168
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003169 /* Common functions for SURF/FFA/RUMI3 */
3170 msm_device_i2c_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003171 msm7x27a_init_ebi2();
3172 msm7x27a_cfg_uart2dm_serial();
3173#ifdef CONFIG_SERIAL_MSM_HS
3174 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
3175 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
3176#endif
3177
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003178#ifdef CONFIG_USB_MSM_OTG_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05303179 msm_otg_pdata.swfi_latency =
3180 msm7x27a_pm_data
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003181 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Trilok Soni16f61af2011-07-26 16:06:58 +05303182 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003183#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05303184 msm_device_gadget_peripheral.dev.platform_data =
3185 &msm_gadget_pdata;
3186 msm7x27a_cfg_smsc911x();
3187 platform_add_devices(msm_footswitch_devices,
3188 msm_num_footswitch_devices);
3189 platform_add_devices(surf_ffa_devices,
3190 ARRAY_SIZE(surf_ffa_devices));
Sujith Reddy Thummaad7c9a82011-09-30 20:54:38 +05303191 /* Ensure ar6000pm device is registered before MMC/SDC */
3192 msm7x27a_init_ar6000pm();
3193#ifdef CONFIG_MMC_MSM
3194 msm7x27a_init_mmc();
3195#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05303196 msm_fb_add_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003197#ifdef CONFIG_USB_EHCI_MSM_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05303198 msm7x2x_init_host();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003199#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003200
3201 msm_pm_set_platform_data(msm7x27a_pm_data,
3202 ARRAY_SIZE(msm7x27a_pm_data));
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06003203 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_RESET_VECTOR,
3204 ioremap(0, PAGE_SIZE)));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003205
3206#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
3207 register_i2c_devices();
3208#endif
3209#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3210 bt_power_init();
3211#endif
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303212 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003213 atmel_ts_pdata.min_x = 0;
3214 atmel_ts_pdata.max_x = 480;
3215 atmel_ts_pdata.min_y = 0;
3216 atmel_ts_pdata.max_y = 320;
3217 }
3218
3219 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
3220 atmel_ts_i2c_info,
3221 ARRAY_SIZE(atmel_ts_i2c_info));
3222
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05303223#if defined(CONFIG_MSM_CAMERA)
Justin Paupored98328e2011-08-19 13:48:31 -07003224 msm_camera_vreg_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003225 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
3226 i2c_camera_devices,
3227 ARRAY_SIZE(i2c_camera_devices));
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05303228#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003229 platform_device_register(&kp_pdev);
3230 platform_device_register(&hs_pdev);
3231
3232 /* configure it as a pdm function*/
3233 if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3,
3234 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
3235 GPIO_CFG_8MA), GPIO_CFG_ENABLE))
3236 pr_err("%s: gpio_tlmm_config for %d failed\n",
3237 __func__, LED_GPIO_PDM);
3238 else
3239 platform_device_register(&led_pdev);
3240
3241#ifdef CONFIG_MSM_RPC_VIBRATOR
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303242 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003243 msm_init_pmic_vibrator();
3244#endif
3245 /*7x25a kgsl initializations*/
3246 msm7x25a_kgsl_3d0_init();
3247}
3248
3249static void __init msm7x2x_init_early(void)
3250{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003251 msm_msm7x2x_allocate_memory_regions();
3252}
3253
3254MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3")
3255 .boot_params = PHYS_OFFSET + 0x100,
3256 .map_io = msm_common_io_init,
3257 .reserve = msm7x27a_reserve,
3258 .init_irq = msm_init_irq,
Trilok Soni16f61af2011-07-26 16:06:58 +05303259 .init_machine = msm7627a_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003260 .timer = &msm_timer,
3261 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303262 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003263MACHINE_END
3264MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF")
3265 .boot_params = PHYS_OFFSET + 0x100,
3266 .map_io = msm_common_io_init,
3267 .reserve = msm7x27a_reserve,
3268 .init_irq = msm_init_irq,
3269 .init_machine = msm7x2x_init,
3270 .timer = &msm_timer,
3271 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303272 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003273MACHINE_END
3274MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA")
3275 .boot_params = PHYS_OFFSET + 0x100,
3276 .map_io = msm_common_io_init,
3277 .reserve = msm7x27a_reserve,
3278 .init_irq = msm_init_irq,
3279 .init_machine = msm7x2x_init,
3280 .timer = &msm_timer,
3281 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303282 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003283MACHINE_END
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303284MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF")
3285 .boot_params = PHYS_OFFSET + 0x100,
3286 .map_io = msm_common_io_init,
3287 .reserve = msm7x27a_reserve,
3288 .init_irq = msm_init_irq,
3289 .init_machine = msm7x2x_init,
3290 .timer = &msm_timer,
3291 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303292 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303293MACHINE_END
3294MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA")
3295 .boot_params = PHYS_OFFSET + 0x100,
3296 .map_io = msm_common_io_init,
3297 .reserve = msm7x27a_reserve,
3298 .init_irq = msm_init_irq,
3299 .init_machine = msm7x2x_init,
3300 .timer = &msm_timer,
3301 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303302 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303303MACHINE_END