blob: ca1da75d6592f86e885680f5957e653585ee38a2 [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;
Pankaj Kumar6ac59af2011-10-12 12:45:40 +0530469 unsigned int min_level;
470 unsigned int max_level;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530471 unsigned int is_pin_controlled;
Justin Paupored98328e2011-08-19 13:48:31 -0700472 struct regulator *reg;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530473};
474static struct bt_vreg_info bt_vregs[] = {
Pankaj Kumar6ac59af2011-10-12 12:45:40 +0530475 {"msme1", 2, 1800000, 1800000, 0, NULL},
476 {"bt", 21, 2900000, 3050000, 1, NULL}
Rahul Kashyap6e669462011-07-23 16:42:56 +0530477};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700478
479static int bahama_bt(int on)
480{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700481 int rc = 0;
482 int i;
483
484 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
485
486 struct bahama_variant_register {
487 const size_t size;
488 const struct bahama_config_register *set;
489 };
490
491 const struct bahama_config_register *p;
492
493 u8 version;
494
495 const struct bahama_config_register v10_bt_on[] = {
496 { 0xE9, 0x00, 0xFF },
497 { 0xF4, 0x80, 0xFF },
498 { 0xE4, 0x00, 0xFF },
499 { 0xE5, 0x00, 0x0F },
500#ifdef CONFIG_WLAN
501 { 0xE6, 0x38, 0x7F },
502 { 0xE7, 0x06, 0xFF },
503#endif
504 { 0xE9, 0x21, 0xFF },
505 { 0x01, 0x0C, 0x1F },
506 { 0x01, 0x08, 0x1F },
507 };
508
509 const struct bahama_config_register v20_bt_on_fm_off[] = {
510 { 0x11, 0x0C, 0xFF },
511 { 0x13, 0x01, 0xFF },
512 { 0xF4, 0x80, 0xFF },
513 { 0xF0, 0x00, 0xFF },
514 { 0xE9, 0x00, 0xFF },
515#ifdef CONFIG_WLAN
516 { 0x81, 0x00, 0x7F },
517 { 0x82, 0x00, 0xFF },
518 { 0xE6, 0x38, 0x7F },
519 { 0xE7, 0x06, 0xFF },
520#endif
521 { 0x8E, 0x15, 0xFF },
522 { 0x8F, 0x15, 0xFF },
523 { 0x90, 0x15, 0xFF },
524
525 { 0xE9, 0x21, 0xFF },
526 };
527
528 const struct bahama_config_register v20_bt_on_fm_on[] = {
529 { 0x11, 0x0C, 0xFF },
530 { 0x13, 0x01, 0xFF },
531 { 0xF4, 0x86, 0xFF },
532 { 0xF0, 0x06, 0xFF },
533 { 0xE9, 0x00, 0xFF },
534#ifdef CONFIG_WLAN
535 { 0x81, 0x00, 0x7F },
536 { 0x82, 0x00, 0xFF },
537 { 0xE6, 0x38, 0x7F },
538 { 0xE7, 0x06, 0xFF },
539#endif
540 { 0xE9, 0x21, 0xFF },
541 };
542
543 const struct bahama_config_register v10_bt_off[] = {
544 { 0xE9, 0x00, 0xFF },
545 };
546
547 const struct bahama_config_register v20_bt_off_fm_off[] = {
548 { 0xF4, 0x84, 0xFF },
549 { 0xF0, 0x04, 0xFF },
550 { 0xE9, 0x00, 0xFF }
551 };
552
553 const struct bahama_config_register v20_bt_off_fm_on[] = {
554 { 0xF4, 0x86, 0xFF },
555 { 0xF0, 0x06, 0xFF },
556 { 0xE9, 0x00, 0xFF }
557 };
558 const struct bahama_variant_register bt_bahama[2][3] = {
559 {
560 { ARRAY_SIZE(v10_bt_off), v10_bt_off },
561 { ARRAY_SIZE(v20_bt_off_fm_off), v20_bt_off_fm_off },
562 { ARRAY_SIZE(v20_bt_off_fm_on), v20_bt_off_fm_on }
563 },
564 {
565 { ARRAY_SIZE(v10_bt_on), v10_bt_on },
566 { ARRAY_SIZE(v20_bt_on_fm_off), v20_bt_on_fm_off },
567 { ARRAY_SIZE(v20_bt_on_fm_on), v20_bt_on_fm_on }
568 }
569 };
570
571 u8 offset = 0; /* index into bahama configs */
572 on = on ? 1 : 0;
573 version = marimba_read_bahama_ver(&config);
Rahul Kashyap92497af2011-07-07 12:13:52 +0530574 if ((int)version < 0 || version == BAHAMA_VER_UNSUPPORTED) {
575 dev_err(&msm_bt_power_device.dev, "%s: Bahama \
576 version read Error, version = %d \n",
577 __func__, version);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700578 return -EIO;
579 }
580
581 if (version == BAHAMA_VER_2_0) {
582 if (marimba_get_fm_status(&config))
583 offset = 0x01;
584 }
585
586 p = bt_bahama[on][version + offset].set;
587
588 dev_info(&msm_bt_power_device.dev,
589 "%s: found version %d\n", __func__, version);
590
591 for (i = 0; i < bt_bahama[on][version + offset].size; i++) {
592 u8 value = (p+i)->value;
593 rc = marimba_write_bit_mask(&config,
594 (p+i)->reg,
595 &value,
596 sizeof((p+i)->value),
597 (p+i)->mask);
598 if (rc < 0) {
599 dev_err(&msm_bt_power_device.dev,
600 "%s: reg %x write failed: %d\n",
601 __func__, (p+i)->reg, rc);
602 return rc;
603 }
Rahul Kashyap92497af2011-07-07 12:13:52 +0530604 dev_dbg(&msm_bt_power_device.dev,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700605 "%s: reg 0x%02x write value 0x%02x mask 0x%02x\n",
606 __func__, (p+i)->reg,
607 value, (p+i)->mask);
608 value = 0;
609 rc = marimba_read_bit_mask(&config,
610 (p+i)->reg, &value,
611 sizeof((p+i)->value), (p+i)->mask);
612 if (rc < 0)
613 dev_err(&msm_bt_power_device.dev, "%s marimba_read_bit_mask- error",
614 __func__);
Rahul Kashyap92497af2011-07-07 12:13:52 +0530615 dev_dbg(&msm_bt_power_device.dev,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700616 "%s: reg 0x%02x read value 0x%02x mask 0x%02x\n",
617 __func__, (p+i)->reg,
618 value, (p+i)->mask);
619 }
620 /* Update BT Status */
621 if (on)
622 marimba_set_bt_status(&config, true);
623 else
624 marimba_set_bt_status(&config, false);
625 return rc;
626}
627static int bluetooth_switch_regulators(int on)
628{
629 int i, rc = 0;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530630 const char *id = "BTPW";
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700631
Rahul Kashyap6e669462011-07-23 16:42:56 +0530632 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
Justin Paupored98328e2011-08-19 13:48:31 -0700633 if (IS_ERR_OR_NULL(bt_vregs[i].reg)) {
634 rc = bt_vregs[i].reg ?
635 PTR_ERR(bt_vregs[i].reg) :
636 -ENODEV;
637 dev_err(&msm_bt_power_device.dev,
638 "%s: invalid regulator handle for %s: %d\n",
639 __func__, bt_vregs[i].name, rc);
640 goto reg_disable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700641 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700642
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530643 rc = on ? regulator_set_voltage(bt_vregs[i].reg,
Pankaj Kumar6ac59af2011-10-12 12:45:40 +0530644 bt_vregs[i].min_level,
645 bt_vregs[i].max_level) : 0;
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530646 if (rc) {
647 dev_err(&msm_bt_power_device.dev,
648 "%s: could not set voltage for %s: %d\n",
649 __func__, bt_vregs[i].name, rc);
650 goto reg_disable;
651 }
652
653 rc = on ? regulator_enable(bt_vregs[i].reg) : 0;
654 if (rc) {
655 dev_err(&msm_bt_power_device.dev,
656 "%s: could not %sable regulator %s: %d\n",
657 __func__, "en", bt_vregs[i].name, rc);
658 goto reg_disable;
659 }
660
Justin Paupored98328e2011-08-19 13:48:31 -0700661 if (bt_vregs[i].is_pin_controlled) {
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530662 rc = pmapp_vreg_lpm_pincntrl_vote(id,
Rahul Kashyap6e669462011-07-23 16:42:56 +0530663 bt_vregs[i].pmapp_id,
664 PMAPP_CLOCK_ID_D1,
665 on ? PMAPP_CLOCK_VOTE_ON :
Justin Paupored98328e2011-08-19 13:48:31 -0700666 PMAPP_CLOCK_VOTE_OFF);
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530667 if (rc) {
668 dev_err(&msm_bt_power_device.dev,
669 "%s: pin control failed for %s: %d\n",
670 __func__, bt_vregs[i].name, rc);
671 goto pin_cnt_fail;
672 }
Rahul Kashyap6e669462011-07-23 16:42:56 +0530673 }
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530674 rc = on ? 0 : regulator_disable(bt_vregs[i].reg);
Justin Paupored98328e2011-08-19 13:48:31 -0700675
676 if (rc) {
677 dev_err(&msm_bt_power_device.dev,
678 "%s: could not %sable regulator %s: %d\n",
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530679 __func__, "dis", bt_vregs[i].name, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700680 goto reg_disable;
Rahul Kashyap6e669462011-07-23 16:42:56 +0530681 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700682 }
Rahul Kashyap6e669462011-07-23 16:42:56 +0530683
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700684 return rc;
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530685pin_cnt_fail:
686 if (on)
687 regulator_disable(bt_vregs[i].reg);
Justin Paupored98328e2011-08-19 13:48:31 -0700688reg_disable:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530689 while (i) {
690 if (on) {
691 i--;
692 regulator_disable(bt_vregs[i].reg);
693 regulator_put(bt_vregs[i].reg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700694 }
Justin Paupored98328e2011-08-19 13:48:31 -0700695 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700696 return rc;
697}
698
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530699static struct regulator *reg_s3;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700700static unsigned int msm_bahama_setup_power(void)
701{
702 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700703
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530704 reg_s3 = regulator_get(NULL, "msme1");
705 if (IS_ERR(reg_s3)) {
706 rc = PTR_ERR(reg_s3);
Justin Paupored98328e2011-08-19 13:48:31 -0700707 pr_err("%s: could not get regulator: %d\n", __func__, rc);
708 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700709 }
Justin Paupored98328e2011-08-19 13:48:31 -0700710
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530711 rc = regulator_set_voltage(reg_s3, 1800000, 1800000);
Justin Paupored98328e2011-08-19 13:48:31 -0700712 if (rc) {
713 pr_err("%s: could not set voltage: %d\n", __func__, rc);
714 goto reg_fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700715 }
Justin Paupored98328e2011-08-19 13:48:31 -0700716
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530717 rc = regulator_enable(reg_s3);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700718 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -0700719 pr_err("%s: could not enable regulator: %d\n", __func__, rc);
720 goto reg_fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700721 }
722
723 /*setup Bahama_sys_reset_n*/
724 rc = gpio_request(GPIO_BT_SYS_REST_EN, "bahama sys_rst_n");
Justin Paupored98328e2011-08-19 13:48:31 -0700725 if (rc) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700726 pr_err("%s: gpio_request %d = %d\n", __func__,
727 GPIO_BT_SYS_REST_EN, rc);
Justin Paupored98328e2011-08-19 13:48:31 -0700728 goto reg_disable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700729 }
Justin Paupored98328e2011-08-19 13:48:31 -0700730
Rahul Kashyap181d5552011-07-07 10:39:23 +0530731 rc = bt_set_gpio(1);
Justin Paupored98328e2011-08-19 13:48:31 -0700732 if (rc) {
Rahul Kashyap181d5552011-07-07 10:39:23 +0530733 pr_err("%s: bt_set_gpio %d = %d\n", __func__,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700734 GPIO_BT_SYS_REST_EN, rc);
735 goto gpio_fail;
736 }
Justin Paupored98328e2011-08-19 13:48:31 -0700737
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700738 return rc;
739
740gpio_fail:
741 gpio_free(GPIO_BT_SYS_REST_EN);
Justin Paupored98328e2011-08-19 13:48:31 -0700742reg_disable:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530743 regulator_disable(reg_s3);
Justin Paupored98328e2011-08-19 13:48:31 -0700744reg_fail:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530745 regulator_put(reg_s3);
Justin Paupored98328e2011-08-19 13:48:31 -0700746out:
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530747 reg_s3 = NULL;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700748 return rc;
749}
750
751static unsigned int msm_bahama_shutdown_power(int value)
752{
753 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700754
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530755 if (IS_ERR_OR_NULL(reg_s3)) {
756 rc = reg_s3 ? PTR_ERR(reg_s3) : -ENODEV;
Justin Paupored98328e2011-08-19 13:48:31 -0700757 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700758 }
Justin Paupored98328e2011-08-19 13:48:31 -0700759
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530760 rc = regulator_disable(reg_s3);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700761 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -0700762 pr_err("%s: could not disable regulator: %d\n", __func__, rc);
763 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700764 }
Justin Paupored98328e2011-08-19 13:48:31 -0700765
Rahul Kashyape8698c62011-07-20 20:43:05 +0530766 if (value == BAHAMA_ID) {
767 rc = bt_set_gpio(0);
768 if (rc) {
769 pr_err("%s: bt_set_gpio = %d\n",
770 __func__, rc);
771 }
Justin Paupored98328e2011-08-19 13:48:31 -0700772 gpio_free(GPIO_BT_SYS_REST_EN);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530773 }
Justin Paupored98328e2011-08-19 13:48:31 -0700774
Pankaj Kumara9d576c2011-09-29 10:56:53 +0530775 regulator_put(reg_s3);
776 reg_s3 = NULL;
Justin Paupored98328e2011-08-19 13:48:31 -0700777
778 return 0;
779
Justin Paupored98328e2011-08-19 13:48:31 -0700780out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700781 return rc;
782}
783
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700784static unsigned int msm_bahama_core_config(int type)
785{
786 int rc = 0;
787
788 if (type == BAHAMA_ID) {
789 int i;
Rahul Kashyap181d5552011-07-07 10:39:23 +0530790 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700791 const struct bahama_config_register v20_init[] = {
792 /* reg, value, mask */
793 { 0xF4, 0x84, 0xFF }, /* AREG */
794 { 0xF0, 0x04, 0xFF } /* DREG */
795 };
796 if (marimba_read_bahama_ver(&config) == BAHAMA_VER_2_0) {
797 for (i = 0; i < ARRAY_SIZE(v20_init); i++) {
798 u8 value = v20_init[i].value;
799 rc = marimba_write_bit_mask(&config,
800 v20_init[i].reg,
801 &value,
802 sizeof(v20_init[i].value),
803 v20_init[i].mask);
804 if (rc < 0) {
805 pr_err("%s: reg %d write failed: %d\n",
806 __func__, v20_init[i].reg, rc);
807 return rc;
808 }
809 pr_debug("%s: reg 0x%02x value 0x%02x"
810 " mask 0x%02x\n",
811 __func__, v20_init[i].reg,
812 v20_init[i].value, v20_init[i].mask);
813 }
814 }
815 }
Rahul Kashyap181d5552011-07-07 10:39:23 +0530816 rc = bt_set_gpio(0);
817 if (rc) {
818 pr_err("%s: bt_set_gpio = %d\n",
819 __func__, rc);
820 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700821 pr_debug("core type: %d\n", type);
822 return rc;
823}
824
825static int bluetooth_power(int on)
826{
827 int pin, rc = 0;
828 const char *id = "BTPW";
829 int cid = 0;
830
831 cid = adie_get_detected_connectivity_type();
832 if (cid != BAHAMA_ID) {
833 pr_err("%s: unexpected adie connectivity type: %d\n",
834 __func__, cid);
835 return -ENODEV;
836 }
837 if (on) {
838 /*setup power for BT SOC*/
Rahul Kashyap181d5552011-07-07 10:39:23 +0530839 rc = bt_set_gpio(on);
840 if (rc) {
841 pr_err("%s: bt_set_gpio = %d\n",
842 __func__, rc);
843 goto exit;
844 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700845 rc = bluetooth_switch_regulators(on);
846 if (rc < 0) {
847 pr_err("%s: bluetooth_switch_regulators rc = %d",
848 __func__, rc);
849 goto exit;
850 }
851 /*setup BT GPIO lines*/
852 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_on);
853 pin++) {
854 rc = gpio_tlmm_config(bt_config_power_on[pin],
855 GPIO_CFG_ENABLE);
856 if (rc < 0) {
857 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
858 __func__,
859 bt_config_power_on[pin],
860 rc);
861 goto fail_power;
862 }
863 }
864 /*Setup BT clocks*/
865 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
866 PMAPP_CLOCK_VOTE_ON);
867 if (rc < 0) {
868 pr_err("Failed to vote for TCXO_D1 ON\n");
869 goto fail_clock;
870 }
871 msleep(20);
872
873 /*I2C config for Bahama*/
874 rc = bahama_bt(1);
875 if (rc < 0) {
876 pr_err("%s: bahama_bt rc = %d", __func__, rc);
877 goto fail_i2c;
878 }
879 msleep(20);
880
881 /*setup BT PCM lines*/
882 rc = msm_bahama_setup_pcm_i2s(BT_PCM_ON);
883 if (rc < 0) {
884 pr_err("%s: msm_bahama_setup_pcm_i2s , rc =%d\n",
885 __func__, rc);
886 goto fail_power;
887 }
888 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
889 PMAPP_CLOCK_VOTE_PIN_CTRL);
890 if (rc < 0)
891 pr_err("%s:Pin Control Failed, rc = %d",
892 __func__, rc);
893
894 } else {
895 rc = bahama_bt(0);
896 if (rc < 0)
897 pr_err("%s: bahama_bt rc = %d", __func__, rc);
Rahul Kashyap181d5552011-07-07 10:39:23 +0530898
899 rc = bt_set_gpio(on);
900 if (rc) {
901 pr_err("%s: bt_set_gpio = %d\n",
902 __func__, rc);
903 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700904fail_i2c:
905 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
906 PMAPP_CLOCK_VOTE_OFF);
907 if (rc < 0)
908 pr_err("%s: Failed to vote Off D1\n", __func__);
909fail_clock:
910 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_off);
911 pin++) {
912 rc = gpio_tlmm_config(bt_config_power_off[pin],
913 GPIO_CFG_ENABLE);
914 if (rc < 0) {
915 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
916 __func__, bt_config_power_off[pin], rc);
917 }
918 }
919 rc = msm_bahama_setup_pcm_i2s(BT_PCM_OFF);
920 if (rc < 0) {
921 pr_err("%s: msm_bahama_setup_pcm_i2s, rc =%d\n",
922 __func__, rc);
923 }
924fail_power:
925 rc = bluetooth_switch_regulators(0);
926 if (rc < 0) {
927 pr_err("%s: switch_regulators : rc = %d",\
928 __func__, rc);
929 goto exit;
930 }
931 }
932 return rc;
933exit:
934 pr_err("%s: failed with rc = %d", __func__, rc);
935 return rc;
936}
937
938static int __init bt_power_init(void)
939{
940 int i, rc = 0;
Justin Paupored98328e2011-08-19 13:48:31 -0700941 struct device *dev = &msm_bt_power_device.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700942
Justin Paupored98328e2011-08-19 13:48:31 -0700943 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
944 bt_vregs[i].reg = regulator_get(dev, bt_vregs[i].name);
945 if (IS_ERR(bt_vregs[i].reg)) {
946 rc = PTR_ERR(bt_vregs[i].reg);
947 dev_err(dev, "%s: could not get regulator %s: %d\n",
948 __func__, bt_vregs[i].name, rc);
949 goto reg_get_fail;
950 }
Justin Paupored98328e2011-08-19 13:48:31 -0700951 }
952
953 dev->platform_data = &bluetooth_power;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700954
955 return rc;
956
Justin Paupored98328e2011-08-19 13:48:31 -0700957reg_get_fail:
958 while (i--) {
959 regulator_put(bt_vregs[i].reg);
960 bt_vregs[i].reg = NULL;
961 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700962 return rc;
963}
964
965static struct marimba_platform_data marimba_pdata = {
966 .slave_id[SLAVE_ID_BAHAMA_FM] = BAHAMA_SLAVE_ID_FM_ADDR,
967 .slave_id[SLAVE_ID_BAHAMA_QMEMBIST] = BAHAMA_SLAVE_ID_QMEMBIST_ADDR,
968 .bahama_setup = msm_bahama_setup_power,
969 .bahama_shutdown = msm_bahama_shutdown_power,
970 .bahama_core_config = msm_bahama_core_config,
971 .fm = &marimba_fm_pdata,
972};
973
974#endif
975
976#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
977static struct i2c_board_info core_exp_i2c_info[] __initdata = {
978 {
979 I2C_BOARD_INFO("sx1509q", 0x3e),
980 },
981};
982static struct i2c_board_info cam_exp_i2c_info[] __initdata = {
983 {
984 I2C_BOARD_INFO("sx1508q", 0x22),
985 .platform_data = &sx150x_data[SX150X_CAM],
986 },
987};
988#endif
989#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
990static struct i2c_board_info bahama_devices[] = {
991{
992 I2C_BOARD_INFO("marimba", 0xc),
993 .platform_data = &marimba_pdata,
994},
995};
996#endif
997
998#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
999static void __init register_i2c_devices(void)
1000{
1001
1002 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
1003 cam_exp_i2c_info,
1004 ARRAY_SIZE(cam_exp_i2c_info));
1005
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301006 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001007 sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0;
1008
1009 core_exp_i2c_info[0].platform_data =
1010 &sx150x_data[SX150X_CORE];
1011
1012 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
1013 core_exp_i2c_info,
1014 ARRAY_SIZE(core_exp_i2c_info));
1015#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
1016 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
1017 bahama_devices,
1018 ARRAY_SIZE(bahama_devices));
1019#endif
1020}
1021#endif
1022
1023static struct msm_gpio qup_i2c_gpios_io[] = {
1024 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1025 "qup_scl" },
1026 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1027 "qup_sda" },
1028 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1029 "qup_scl" },
1030 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1031 "qup_sda" },
1032};
1033
1034static struct msm_gpio qup_i2c_gpios_hw[] = {
1035 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1036 "qup_scl" },
1037 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1038 "qup_sda" },
1039 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1040 "qup_scl" },
1041 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1042 "qup_sda" },
1043};
1044
1045static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
1046{
1047 int rc;
1048
1049 if (adap_id < 0 || adap_id > 1)
1050 return;
1051
1052 /* Each adapter gets 2 lines from the table */
1053 if (config_type)
1054 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
1055 else
1056 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
1057 if (rc < 0)
1058 pr_err("QUP GPIO request/enable failed: %d\n", rc);
1059}
1060
1061static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
1062 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001063 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1064};
1065
1066static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
1067 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001068 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
1069};
1070
1071#ifdef CONFIG_ARCH_MSM7X27A
Prabhanjan Kandula1d920742011-08-19 10:28:11 +05301072#define MSM_PMEM_MDP_SIZE 0x1900000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001073#define MSM_PMEM_ADSP_SIZE 0x1000000
1074
1075#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
1076#define MSM_FB_SIZE 0x260000
1077#else
1078#define MSM_FB_SIZE 0x195000
1079#endif
1080
1081#endif
1082
1083static struct android_usb_platform_data android_usb_pdata = {
1084 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1085};
1086
1087static struct platform_device android_usb_device = {
1088 .name = "android_usb",
1089 .id = -1,
1090 .dev = {
1091 .platform_data = &android_usb_pdata,
1092 },
1093};
1094
1095#ifdef CONFIG_USB_EHCI_MSM_72K
1096static void msm_hsusb_vbus_power(unsigned phy_info, int on)
1097{
1098 int rc = 0;
1099 unsigned gpio;
1100
1101 gpio = GPIO_HOST_VBUS_EN;
1102
1103 rc = gpio_request(gpio, "i2c_host_vbus_en");
1104 if (rc < 0) {
1105 pr_err("failed to request %d GPIO\n", gpio);
1106 return;
1107 }
1108 gpio_direction_output(gpio, !!on);
1109 gpio_set_value_cansleep(gpio, !!on);
1110 gpio_free(gpio);
1111}
1112
1113static struct msm_usb_host_platform_data msm_usb_host_pdata = {
1114 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
1115};
1116
1117static void __init msm7x2x_init_host(void)
1118{
1119 msm_add_host(0, &msm_usb_host_pdata);
1120}
1121#endif
1122
1123#ifdef CONFIG_USB_MSM_OTG_72K
1124static int hsusb_rpc_connect(int connect)
1125{
1126 if (connect)
1127 return msm_hsusb_rpc_connect();
1128 else
1129 return msm_hsusb_rpc_close();
1130}
1131
Justin Paupored98328e2011-08-19 13:48:31 -07001132static struct regulator *reg_hsusb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001133static int msm_hsusb_ldo_init(int init)
1134{
Justin Paupored98328e2011-08-19 13:48:31 -07001135 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001136
Justin Paupored98328e2011-08-19 13:48:31 -07001137 if (init) {
1138 reg_hsusb = regulator_get(NULL, "usb");
1139 if (IS_ERR(reg_hsusb)) {
1140 rc = PTR_ERR(reg_hsusb);
1141 pr_err("%s: could not get regulator: %d\n",
1142 __func__, rc);
1143 goto out;
1144 }
1145
1146 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
1147 if (rc) {
1148 pr_err("%s: could not set voltage: %d\n",
1149 __func__, rc);
1150 goto reg_free;
1151 }
1152
1153 return 0;
1154 }
1155 /* else fall through */
1156reg_free:
1157 regulator_put(reg_hsusb);
1158out:
1159 reg_hsusb = NULL;
1160 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001161}
1162
1163static int msm_hsusb_ldo_enable(int enable)
1164{
1165 static int ldo_status;
1166
Justin Paupored98328e2011-08-19 13:48:31 -07001167 if (IS_ERR_OR_NULL(reg_hsusb))
1168 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001169
1170 if (ldo_status == enable)
1171 return 0;
1172
1173 ldo_status = enable;
1174
Justin Paupored98328e2011-08-19 13:48:31 -07001175 return enable ?
1176 regulator_enable(reg_hsusb) :
1177 regulator_disable(reg_hsusb);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001178}
1179
1180#ifndef CONFIG_USB_EHCI_MSM_72K
1181static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
1182{
1183 int ret = 0;
1184
1185 if (init)
1186 ret = msm_pm_app_rpc_init(callback);
1187 else
1188 msm_pm_app_rpc_deinit(callback);
1189
1190 return ret;
1191}
1192#endif
1193
1194static struct msm_otg_platform_data msm_otg_pdata = {
1195#ifndef CONFIG_USB_EHCI_MSM_72K
1196 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
1197#else
1198 .vbus_power = msm_hsusb_vbus_power,
1199#endif
1200 .rpc_connect = hsusb_rpc_connect,
1201 .core_clk = 1,
1202 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
1203 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
1204 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
1205 .se1_gating = SE1_GATING_DISABLE,
1206 .ldo_init = msm_hsusb_ldo_init,
1207 .ldo_enable = msm_hsusb_ldo_enable,
1208 .chg_init = hsusb_chg_init,
1209 .chg_connected = hsusb_chg_connected,
1210 .chg_vbus_draw = hsusb_chg_vbus_draw,
1211};
1212#endif
1213
1214static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
1215 .is_phy_status_timer_on = 1,
1216};
1217
1218static struct resource smc91x_resources[] = {
1219 [0] = {
1220 .start = 0x90000300,
1221 .end = 0x900003ff,
1222 .flags = IORESOURCE_MEM,
1223 },
1224 [1] = {
1225 .start = MSM_GPIO_TO_INT(4),
1226 .end = MSM_GPIO_TO_INT(4),
1227 .flags = IORESOURCE_IRQ,
1228 },
1229};
1230
1231static struct platform_device smc91x_device = {
1232 .name = "smc91x",
1233 .id = 0,
1234 .num_resources = ARRAY_SIZE(smc91x_resources),
1235 .resource = smc91x_resources,
1236};
1237
1238#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
1239 || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\
1240 || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\
1241 || defined(CONFIG_MMC_MSM_SDC4_SUPPORT))
1242
1243static unsigned long vreg_sts, gpio_sts;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001244
1245struct sdcc_gpio {
1246 struct msm_gpio *cfg_data;
1247 uint32_t size;
1248 struct msm_gpio *sleep_cfg_data;
1249};
1250
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301251/**
1252 * Due to insufficient drive strengths for SDC GPIO lines some old versioned
1253 * SD/MMC cards may cause data CRC errors. Hence, set optimal values
1254 * for SDC slots based on timing closure and marginality. SDC1 slot
1255 * require higher value since it should handle bad signal quality due
1256 * to size of T-flash adapters.
1257 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001258static struct msm_gpio sdc1_cfg_data[] = {
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301259 {GPIO_CFG(51, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001260 "sdc1_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301261 {GPIO_CFG(52, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001262 "sdc1_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301263 {GPIO_CFG(53, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001264 "sdc1_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301265 {GPIO_CFG(54, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001266 "sdc1_dat_0"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301267 {GPIO_CFG(55, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001268 "sdc1_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301269 {GPIO_CFG(56, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_14MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001270 "sdc1_clk"},
1271};
1272
1273static struct msm_gpio sdc2_cfg_data[] = {
1274 {GPIO_CFG(62, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1275 "sdc2_clk"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301276 {GPIO_CFG(63, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001277 "sdc2_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301278 {GPIO_CFG(64, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001279 "sdc2_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301280 {GPIO_CFG(65, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001281 "sdc2_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301282 {GPIO_CFG(66, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001283 "sdc2_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301284 {GPIO_CFG(67, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001285 "sdc2_dat_0"},
1286};
1287
1288static struct msm_gpio sdc2_sleep_cfg_data[] = {
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301289 {GPIO_CFG(62, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001290 "sdc2_clk"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301291 {GPIO_CFG(63, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001292 "sdc2_cmd"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301293 {GPIO_CFG(64, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001294 "sdc2_dat_3"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301295 {GPIO_CFG(65, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001296 "sdc2_dat_2"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301297 {GPIO_CFG(66, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001298 "sdc2_dat_1"},
Sujith Reddy Thummaf3535672011-08-22 08:53:44 +05301299 {GPIO_CFG(67, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300 "sdc2_dat_0"},
1301};
1302static struct msm_gpio sdc3_cfg_data[] = {
1303 {GPIO_CFG(88, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1304 "sdc3_clk"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301305 {GPIO_CFG(89, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306 "sdc3_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301307 {GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001308 "sdc3_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301309 {GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001310 "sdc3_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301311 {GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001312 "sdc3_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301313 {GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001314 "sdc3_dat_0"},
1315#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301316 {GPIO_CFG(19, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001317 "sdc3_dat_7"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301318 {GPIO_CFG(20, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001319 "sdc3_dat_6"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301320 {GPIO_CFG(21, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321 "sdc3_dat_5"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301322 {GPIO_CFG(108, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001323 "sdc3_dat_4"},
1324#endif
1325};
1326
1327static struct msm_gpio sdc4_cfg_data[] = {
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301328 {GPIO_CFG(19, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001329 "sdc4_dat_3"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301330 {GPIO_CFG(20, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001331 "sdc4_dat_2"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301332 {GPIO_CFG(21, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001333 "sdc4_dat_1"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301334 {GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001335 "sdc4_cmd"},
Sujith Reddy Thumma70391a32011-08-01 10:33:21 +05301336 {GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001337 "sdc4_dat_0"},
1338 {GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1339 "sdc4_clk"},
1340};
1341
1342static struct sdcc_gpio sdcc_cfg_data[] = {
1343 {
1344 .cfg_data = sdc1_cfg_data,
1345 .size = ARRAY_SIZE(sdc1_cfg_data),
1346 },
1347 {
1348 .cfg_data = sdc2_cfg_data,
1349 .size = ARRAY_SIZE(sdc2_cfg_data),
1350 .sleep_cfg_data = sdc2_sleep_cfg_data,
1351 },
1352 {
1353 .cfg_data = sdc3_cfg_data,
1354 .size = ARRAY_SIZE(sdc3_cfg_data),
1355 },
1356 {
1357 .cfg_data = sdc4_cfg_data,
1358 .size = ARRAY_SIZE(sdc4_cfg_data),
1359 },
1360};
1361
Justin Paupored98328e2011-08-19 13:48:31 -07001362static struct regulator *sdcc_vreg_data[ARRAY_SIZE(sdcc_cfg_data)];
1363
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364static int msm_sdcc_setup_gpio(int dev_id, unsigned int enable)
1365{
1366 int rc = 0;
1367 struct sdcc_gpio *curr;
1368
1369 curr = &sdcc_cfg_data[dev_id - 1];
1370 if (!(test_bit(dev_id, &gpio_sts)^enable))
1371 return rc;
1372
1373 if (enable) {
1374 set_bit(dev_id, &gpio_sts);
1375 rc = msm_gpios_request_enable(curr->cfg_data, curr->size);
1376 if (rc)
1377 pr_err("%s: Failed to turn on GPIOs for slot %d\n",
1378 __func__, dev_id);
1379 } else {
1380 clear_bit(dev_id, &gpio_sts);
1381 if (curr->sleep_cfg_data) {
1382 rc = msm_gpios_enable(curr->sleep_cfg_data, curr->size);
1383 msm_gpios_free(curr->sleep_cfg_data, curr->size);
1384 return rc;
1385 }
1386 msm_gpios_disable_free(curr->cfg_data, curr->size);
1387 }
1388 return rc;
1389}
1390
1391static int msm_sdcc_setup_vreg(int dev_id, unsigned int enable)
1392{
1393 int rc = 0;
Justin Paupored98328e2011-08-19 13:48:31 -07001394 struct regulator *curr = sdcc_vreg_data[dev_id - 1];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001395
Justin Paupored98328e2011-08-19 13:48:31 -07001396 if (test_bit(dev_id, &vreg_sts) == enable)
1397 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001398
Justin Paupored98328e2011-08-19 13:48:31 -07001399 if (!curr)
1400 return -ENODEV;
1401
1402 if (IS_ERR(curr))
1403 return PTR_ERR(curr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001404
1405 if (enable) {
1406 set_bit(dev_id, &vreg_sts);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001407
Justin Paupored98328e2011-08-19 13:48:31 -07001408 rc = regulator_enable(curr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001409 if (rc)
Justin Paupored98328e2011-08-19 13:48:31 -07001410 pr_err("%s: could not enable regulator: %d\n",
1411 __func__, rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001412 } else {
1413 clear_bit(dev_id, &vreg_sts);
Justin Paupored98328e2011-08-19 13:48:31 -07001414
1415 rc = regulator_disable(curr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001416 if (rc)
Justin Paupored98328e2011-08-19 13:48:31 -07001417 pr_err("%s: could not disable regulator: %d\n",
1418 __func__, rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001419 }
1420 return rc;
1421}
1422
1423static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
1424{
1425 int rc = 0;
1426 struct platform_device *pdev;
1427
1428 pdev = container_of(dv, struct platform_device, dev);
1429
1430 rc = msm_sdcc_setup_gpio(pdev->id, !!vdd);
1431 if (rc)
1432 goto out;
1433
1434 rc = msm_sdcc_setup_vreg(pdev->id, !!vdd);
1435out:
1436 return rc;
1437}
1438
1439#define GPIO_SDC1_HW_DET 85
1440
1441#if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) \
1442 && defined(CONFIG_MMC_MSM_CARD_HW_DETECTION)
1443static unsigned int msm7x2xa_sdcc_slot_status(struct device *dev)
1444{
1445 int status;
1446
1447 status = gpio_tlmm_config(GPIO_CFG(GPIO_SDC1_HW_DET, 2, GPIO_CFG_INPUT,
1448 GPIO_CFG_PULL_UP, GPIO_CFG_8MA), GPIO_CFG_ENABLE);
1449 if (status)
1450 pr_err("%s:Failed to configure tlmm for GPIO %d\n", __func__,
1451 GPIO_SDC1_HW_DET);
1452
1453 status = gpio_request(GPIO_SDC1_HW_DET, "SD_HW_Detect");
1454 if (status) {
1455 pr_err("%s:Failed to request GPIO %d\n", __func__,
1456 GPIO_SDC1_HW_DET);
1457 } else {
1458 status = gpio_direction_input(GPIO_SDC1_HW_DET);
1459 if (!status)
1460 status = gpio_get_value(GPIO_SDC1_HW_DET);
1461 gpio_free(GPIO_SDC1_HW_DET);
1462 }
1463 return status;
1464}
1465#endif
1466
1467#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1468static struct mmc_platform_data sdc1_plat_data = {
1469 .ocr_mask = MMC_VDD_28_29,
1470 .translate_vdd = msm_sdcc_setup_power,
1471 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1472 .msmsdcc_fmin = 144000,
1473 .msmsdcc_fmid = 24576000,
1474 .msmsdcc_fmax = 49152000,
1475#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
1476 .status = msm7x2xa_sdcc_slot_status,
1477 .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET),
1478 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
1479#endif
1480};
1481#endif
1482
1483#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1484static struct mmc_platform_data sdc2_plat_data = {
1485 /*
1486 * SDC2 supports only 1.8V, claim for 2.85V range is just
1487 * for allowing buggy cards who advertise 2.8V even though
1488 * they can operate at 1.8V supply.
1489 */
1490 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_165_195,
1491 .translate_vdd = msm_sdcc_setup_power,
1492 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1493#ifdef CONFIG_MMC_MSM_SDIO_SUPPORT
1494 .sdiowakeup_irq = MSM_GPIO_TO_INT(66),
1495#endif
1496 .msmsdcc_fmin = 144000,
1497 .msmsdcc_fmid = 24576000,
1498 .msmsdcc_fmax = 49152000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001499};
1500#endif
1501
1502#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1503static struct mmc_platform_data sdc3_plat_data = {
1504 .ocr_mask = MMC_VDD_28_29,
1505 .translate_vdd = msm_sdcc_setup_power,
1506#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
1507 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
1508#else
1509 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1510#endif
1511 .msmsdcc_fmin = 144000,
1512 .msmsdcc_fmid = 24576000,
1513 .msmsdcc_fmax = 49152000,
1514 .nonremovable = 1,
1515};
1516#endif
1517
1518#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1519 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
1520static struct mmc_platform_data sdc4_plat_data = {
1521 .ocr_mask = MMC_VDD_28_29,
1522 .translate_vdd = msm_sdcc_setup_power,
1523 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1524 .msmsdcc_fmin = 144000,
1525 .msmsdcc_fmid = 24576000,
1526 .msmsdcc_fmax = 49152000,
1527};
1528#endif
Pankaj Kumarb3e55c62011-09-26 11:59:39 +05301529
1530static int __init mmc_regulator_init(int sdcc_no, const char *supply, int uV)
1531{
1532 int rc;
1533
1534 BUG_ON(sdcc_no < 1 || sdcc_no > 4);
1535
1536 sdcc_no--;
1537
1538 sdcc_vreg_data[sdcc_no] = regulator_get(NULL, supply);
1539
1540 if (IS_ERR(sdcc_vreg_data[sdcc_no])) {
1541 rc = PTR_ERR(sdcc_vreg_data[sdcc_no]);
1542 pr_err("%s: could not get regulator \"%s\": %d\n",
1543 __func__, supply, rc);
1544 goto out;
1545 }
1546
1547 rc = regulator_set_voltage(sdcc_vreg_data[sdcc_no], uV, uV);
1548
1549 if (rc) {
1550 pr_err("%s: could not set voltage for \"%s\" to %d uV: %d\n",
1551 __func__, supply, uV, rc);
1552 goto reg_free;
1553 }
1554
1555 return rc;
1556
1557reg_free:
1558 regulator_put(sdcc_vreg_data[sdcc_no]);
1559out:
1560 sdcc_vreg_data[sdcc_no] = NULL;
1561 return rc;
1562}
1563
1564static void __init msm7x27a_init_mmc(void)
1565{
1566 /* eMMC slot */
1567#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1568 if (mmc_regulator_init(3, "emmc", 3000000))
1569 return;
1570 msm_add_sdcc(3, &sdc3_plat_data);
1571#endif
1572 /* Micro-SD slot */
1573#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1574 if (mmc_regulator_init(1, "mmc", 2850000))
1575 return;
1576 msm_add_sdcc(1, &sdc1_plat_data);
1577#endif
1578 /* SDIO WLAN slot */
1579#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1580 if (mmc_regulator_init(2, "mmc", 2850000))
1581 return;
1582 msm_add_sdcc(2, &sdc2_plat_data);
1583#endif
1584 /* Not Used */
1585#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1586 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
1587 if (mmc_regulator_init(4, "mmc", 2850000))
1588 return;
1589 msm_add_sdcc(4, &sdc4_plat_data);
1590#endif
1591}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001592#endif
1593
1594#ifdef CONFIG_SERIAL_MSM_HS
1595static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
1596 .inject_rx_on_wakeup = 1,
1597 .rx_to_inject = 0xFD,
1598};
1599#endif
1600static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
1601 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
1602 .idle_supported = 1,
1603 .suspend_supported = 1,
1604 .idle_enabled = 1,
1605 .suspend_enabled = 1,
1606 .latency = 16000,
1607 .residency = 20000,
1608 },
1609 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
1610 .idle_supported = 1,
1611 .suspend_supported = 1,
1612 .idle_enabled = 1,
1613 .suspend_enabled = 1,
1614 .latency = 12000,
1615 .residency = 20000,
1616 },
1617 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
1618 .idle_supported = 1,
1619 .suspend_supported = 1,
1620 .idle_enabled = 0,
1621 .suspend_enabled = 1,
1622 .latency = 2000,
1623 .residency = 0,
1624 },
1625 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
1626 .idle_supported = 1,
1627 .suspend_supported = 1,
1628 .idle_enabled = 1,
1629 .suspend_enabled = 1,
1630 .latency = 2,
1631 .residency = 0,
1632 },
1633};
1634
1635static struct android_pmem_platform_data android_pmem_adsp_pdata = {
1636 .name = "pmem_adsp",
1637 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
Mahesh Lankac6af7eb2011-08-02 18:00:35 +05301638 .cached = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001639 .memory_type = MEMTYPE_EBI1,
1640};
1641
1642static struct platform_device android_pmem_adsp_device = {
1643 .name = "android_pmem",
1644 .id = 1,
1645 .dev = { .platform_data = &android_pmem_adsp_pdata },
1646};
1647
1648static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
1649static int __init pmem_mdp_size_setup(char *p)
1650{
1651 pmem_mdp_size = memparse(p, NULL);
1652 return 0;
1653}
1654
1655early_param("pmem_mdp_size", pmem_mdp_size_setup);
1656
1657static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
1658static int __init pmem_adsp_size_setup(char *p)
1659{
1660 pmem_adsp_size = memparse(p, NULL);
1661 return 0;
1662}
1663
1664early_param("pmem_adsp_size", pmem_adsp_size_setup);
1665
1666static unsigned fb_size = MSM_FB_SIZE;
1667static int __init fb_size_setup(char *p)
1668{
1669 fb_size = memparse(p, NULL);
1670 return 0;
1671}
1672
1673early_param("fb_size", fb_size_setup);
1674
Justin Paupored98328e2011-08-19 13:48:31 -07001675static struct regulator_bulk_data regs_lcdc[] = {
1676 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
1677 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001678};
1679
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001680static uint32_t lcdc_gpio_initialized;
1681
1682static void lcdc_toshiba_gpio_init(void)
1683{
Justin Paupored98328e2011-08-19 13:48:31 -07001684 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001685 if (!lcdc_gpio_initialized) {
1686 if (gpio_request(GPIO_SPI_CLK, "spi_clk")) {
1687 pr_err("failed to request gpio spi_clk\n");
1688 return;
1689 }
1690 if (gpio_request(GPIO_SPI_CS0_N, "spi_cs")) {
1691 pr_err("failed to request gpio spi_cs0_N\n");
1692 goto fail_gpio6;
1693 }
1694 if (gpio_request(GPIO_SPI_MOSI, "spi_mosi")) {
1695 pr_err("failed to request gpio spi_mosi\n");
1696 goto fail_gpio5;
1697 }
1698 if (gpio_request(GPIO_SPI_MISO, "spi_miso")) {
1699 pr_err("failed to request gpio spi_miso\n");
1700 goto fail_gpio4;
1701 }
1702 if (gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr")) {
1703 pr_err("failed to request gpio_disp_pwr\n");
1704 goto fail_gpio3;
1705 }
1706 if (gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en")) {
1707 pr_err("failed to request gpio_bkl_en\n");
1708 goto fail_gpio2;
1709 }
1710 pmapp_disp_backlight_init();
1711
Justin Paupored98328e2011-08-19 13:48:31 -07001712 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_lcdc), regs_lcdc);
1713 if (rc) {
1714 pr_err("%s: could not get regulators: %d\n",
1715 __func__, rc);
1716 goto fail_gpio1;
1717 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001718
Justin Paupored98328e2011-08-19 13:48:31 -07001719 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_lcdc),
1720 regs_lcdc);
1721 if (rc) {
1722 pr_err("%s: could not set voltages: %d\n",
1723 __func__, rc);
1724 goto fail_vreg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001725 }
1726 lcdc_gpio_initialized = 1;
1727 }
1728 return;
Justin Paupored98328e2011-08-19 13:48:31 -07001729fail_vreg:
1730 regulator_bulk_free(ARRAY_SIZE(regs_lcdc), regs_lcdc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001731fail_gpio1:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001732 gpio_free(GPIO_BACKLIGHT_EN);
1733fail_gpio2:
1734 gpio_free(GPIO_DISPLAY_PWR_EN);
1735fail_gpio3:
1736 gpio_free(GPIO_SPI_MISO);
1737fail_gpio4:
1738 gpio_free(GPIO_SPI_MOSI);
1739fail_gpio5:
1740 gpio_free(GPIO_SPI_CS0_N);
1741fail_gpio6:
1742 gpio_free(GPIO_SPI_CLK);
1743 lcdc_gpio_initialized = 0;
1744}
1745
1746static uint32_t lcdc_gpio_table[] = {
1747 GPIO_SPI_CLK,
1748 GPIO_SPI_CS0_N,
1749 GPIO_SPI_MOSI,
1750 GPIO_DISPLAY_PWR_EN,
1751 GPIO_BACKLIGHT_EN,
1752 GPIO_SPI_MISO,
1753};
1754
1755static void config_lcdc_gpio_table(uint32_t *table, int len, unsigned enable)
1756{
1757 int n;
1758
1759 if (lcdc_gpio_initialized) {
1760 /* All are IO Expander GPIOs */
1761 for (n = 0; n < (len - 1); n++)
1762 gpio_direction_output(table[n], 1);
1763 }
1764}
1765
1766static void lcdc_toshiba_config_gpios(int enable)
1767{
1768 config_lcdc_gpio_table(lcdc_gpio_table,
1769 ARRAY_SIZE(lcdc_gpio_table), enable);
1770}
1771
1772static int msm_fb_lcdc_power_save(int on)
1773{
Justin Paupored98328e2011-08-19 13:48:31 -07001774 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001775 /* Doing the init of the LCDC GPIOs very late as they are from
1776 an I2C-controlled IO Expander */
1777 lcdc_toshiba_gpio_init();
1778
1779 if (lcdc_gpio_initialized) {
1780 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
1781 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
1782
Justin Paupored98328e2011-08-19 13:48:31 -07001783 rc = on ? regulator_bulk_enable(
1784 ARRAY_SIZE(regs_lcdc), regs_lcdc) :
1785 regulator_bulk_disable(
1786 ARRAY_SIZE(regs_lcdc), regs_lcdc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001787
Justin Paupored98328e2011-08-19 13:48:31 -07001788 if (rc)
1789 pr_err("%s: could not %sable regulators: %d\n",
1790 __func__, on ? "en" : "dis", rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001791 }
1792
1793 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001794}
1795
1796
1797static int lcdc_toshiba_set_bl(int level)
1798{
1799 int ret;
1800
1801 ret = pmapp_disp_backlight_set_brightness(level);
1802 if (ret)
1803 pr_err("%s: can't set lcd backlight!\n", __func__);
1804
1805 return ret;
1806}
1807
1808
1809static struct lcdc_platform_data lcdc_pdata = {
Jeevan Shriram15f2a5e2011-07-13 21:45:26 +05301810 .lcdc_gpio_config = NULL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001811 .lcdc_power_save = msm_fb_lcdc_power_save,
1812};
1813
1814static int lcd_panel_spi_gpio_num[] = {
1815 GPIO_SPI_MOSI, /* spi_sdi */
1816 GPIO_SPI_MISO, /* spi_sdoi */
1817 GPIO_SPI_CLK, /* spi_clk */
1818 GPIO_SPI_CS0_N, /* spi_cs */
1819};
1820
1821static struct msm_panel_common_pdata lcdc_toshiba_panel_data = {
1822 .panel_config_gpio = lcdc_toshiba_config_gpios,
1823 .pmic_backlight = lcdc_toshiba_set_bl,
1824 .gpio_num = lcd_panel_spi_gpio_num,
1825};
1826
1827static struct platform_device lcdc_toshiba_panel_device = {
1828 .name = "lcdc_toshiba_fwvga_pt",
1829 .id = 0,
1830 .dev = {
1831 .platform_data = &lcdc_toshiba_panel_data,
1832 }
1833};
1834
1835static struct resource msm_fb_resources[] = {
1836 {
1837 .flags = IORESOURCE_DMA,
1838 }
1839};
1840
Ajay Singh Parmareede70e2011-08-24 17:36:08 +05301841#define PANEL_NAME_MAX_LEN 30
1842#define LCDC_TOSHIBA_FWVGA_PANEL_NAME "lcdc_toshiba_fwvga_pt"
1843#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1844
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001845static int msm_fb_detect_panel(const char *name)
1846{
Taniya Das0a5303a2011-08-23 18:47:48 +05301847 int ret = -ENODEV;
1848
1849 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
1850 if (!strncmp(name, "lcdc_toshiba_fwvga_pt", 21) ||
1851 !strncmp(name, "mipi_cmd_renesas_fwvga", 22))
1852 ret = 0;
Jeevan Shriram29c9e952011-10-27 11:22:46 +05301853 } else if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) {
Taniya Das0a5303a2011-08-23 18:47:48 +05301854 if (!strncmp(name, "mipi_cmd_renesas_fwvga", 22))
1855 ret = 0;
1856 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001857
Ajay Singh Parmareede70e2011-08-24 17:36:08 +05301858#if !defined(CONFIG_FB_MSM_LCDC_AUTO_DETECT) && \
1859 !defined(CONFIG_FB_MSM_MIPI_PANEL_AUTO_DETECT) && \
1860 !defined(CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT)
1861 if (machine_is_msm7x27a_surf() ||
1862 machine_is_msm7625a_surf()) {
1863 if (!strncmp(name, LCDC_TOSHIBA_FWVGA_PANEL_NAME,
1864 strnlen(LCDC_TOSHIBA_FWVGA_PANEL_NAME,
1865 PANEL_NAME_MAX_LEN)))
1866 return 0;
1867 }
1868#endif
Taniya Das0a5303a2011-08-23 18:47:48 +05301869 return ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001870}
1871
1872static struct msm_fb_platform_data msm_fb_pdata = {
1873 .detect_client = msm_fb_detect_panel,
1874};
1875
1876static struct platform_device msm_fb_device = {
1877 .name = "msm_fb",
1878 .id = 0,
1879 .num_resources = ARRAY_SIZE(msm_fb_resources),
1880 .resource = msm_fb_resources,
1881 .dev = {
1882 .platform_data = &msm_fb_pdata,
1883 }
1884};
1885
1886#ifdef CONFIG_FB_MSM_MIPI_DSI
1887static int mipi_renesas_set_bl(int level)
1888{
1889 int ret;
1890
1891 ret = pmapp_disp_backlight_set_brightness(level);
1892
1893 if (ret)
1894 pr_err("%s: can't set lcd backlight!\n", __func__);
1895
1896 return ret;
1897}
1898
1899static struct msm_panel_common_pdata mipi_renesas_pdata = {
1900 .pmic_backlight = mipi_renesas_set_bl,
1901};
1902
1903
1904static struct platform_device mipi_dsi_renesas_panel_device = {
1905 .name = "mipi_renesas",
1906 .id = 0,
1907 .dev = {
1908 .platform_data = &mipi_renesas_pdata,
1909 }
1910};
1911#endif
1912
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001913#define SND(desc, num) { .name = #desc, .id = num }
1914static struct snd_endpoint snd_endpoints_list[] = {
1915 SND(HANDSET, 0),
1916 SND(MONO_HEADSET, 2),
1917 SND(HEADSET, 3),
1918 SND(SPEAKER, 6),
1919 SND(TTY_HEADSET, 8),
1920 SND(TTY_VCO, 9),
1921 SND(TTY_HCO, 10),
1922 SND(BT, 12),
1923 SND(IN_S_SADC_OUT_HANDSET, 16),
1924 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
1925 SND(FM_DIGITAL_STEREO_HEADSET, 26),
1926 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
1927 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +05301928 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Sidipotu Ashokab34ca42011-07-22 16:34:20 +05301929 SND(CURRENT, 0x7FFFFFFE),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001930 SND(FM_ANALOG_STEREO_HEADSET, 35),
1931 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
1932};
1933#undef SND
1934
1935static struct msm_snd_endpoints msm_device_snd_endpoints = {
1936 .endpoints = snd_endpoints_list,
1937 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
1938};
1939
1940static struct platform_device msm_device_snd = {
1941 .name = "msm_snd",
1942 .id = -1,
1943 .dev = {
1944 .platform_data = &msm_device_snd_endpoints
1945 },
1946};
1947
1948#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1949 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1950 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1951 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1952 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1953 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1954#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1955 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1956 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1957 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1958 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1959 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1960#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1961 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1962 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1963 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1964 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1965 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1966#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1967 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1968 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1969 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1970 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1971 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1972#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
1973
1974static unsigned int dec_concurrency_table[] = {
1975 /* Audio LP */
1976 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
1977 0, 0, 0,
1978
1979 /* Concurrency 1 */
1980 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1981 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1982 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1983 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1984 (DEC4_FORMAT),
1985
1986 /* Concurrency 2 */
1987 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1988 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1989 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1990 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1991 (DEC4_FORMAT),
1992
1993 /* Concurrency 3 */
1994 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1995 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1996 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1997 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1998 (DEC4_FORMAT),
1999
2000 /* Concurrency 4 */
2001 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2002 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2003 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2004 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2005 (DEC4_FORMAT),
2006
2007 /* Concurrency 5 */
2008 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
2009 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2010 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2011 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2012 (DEC4_FORMAT),
2013
2014 /* Concurrency 6 */
2015 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2016 0, 0, 0, 0,
2017
2018 /* Concurrency 7 */
2019 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2020 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2021 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2022 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
2023 (DEC4_FORMAT),
2024};
2025
2026#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
2027 .module_queueid = queueid, .module_decid = decid, \
2028 .nr_codec_support = nr_codec}
2029
2030static struct msm_adspdec_info dec_info_list[] = {
2031 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
2032 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
2033 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
2034 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
2035 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
2036};
2037
2038static struct msm_adspdec_database msm_device_adspdec_database = {
2039 .num_dec = ARRAY_SIZE(dec_info_list),
2040 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
2041 ARRAY_SIZE(dec_info_list)),
2042 .dec_concurrency_table = dec_concurrency_table,
2043 .dec_info_list = dec_info_list,
2044};
2045
2046static struct platform_device msm_device_adspdec = {
2047 .name = "msm_adspdec",
2048 .id = -1,
2049 .dev = {
2050 .platform_data = &msm_device_adspdec_database
2051 },
2052};
2053
2054static struct android_pmem_platform_data android_pmem_audio_pdata = {
2055 .name = "pmem_audio",
2056 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
2057 .cached = 0,
2058 .memory_type = MEMTYPE_EBI1,
2059};
2060
2061static struct platform_device android_pmem_audio_device = {
2062 .name = "android_pmem",
2063 .id = 2,
2064 .dev = { .platform_data = &android_pmem_audio_pdata },
2065};
2066
2067static struct android_pmem_platform_data android_pmem_pdata = {
2068 .name = "pmem",
2069 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
2070 .cached = 1,
2071 .memory_type = MEMTYPE_EBI1,
2072};
2073static struct platform_device android_pmem_device = {
2074 .name = "android_pmem",
2075 .id = 0,
2076 .dev = { .platform_data = &android_pmem_pdata },
2077};
2078
2079static u32 msm_calculate_batt_capacity(u32 current_voltage);
2080
2081static struct msm_psy_batt_pdata msm_psy_batt_data = {
2082 .voltage_min_design = 2800,
2083 .voltage_max_design = 4300,
2084 .avail_chg_sources = AC_CHG | USB_CHG ,
2085 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
2086 .calculate_capacity = &msm_calculate_batt_capacity,
2087};
2088
2089static u32 msm_calculate_batt_capacity(u32 current_voltage)
2090{
2091 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
2092 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
2093
2094 return (current_voltage - low_voltage) * 100
2095 / (high_voltage - low_voltage);
2096}
2097
2098static struct platform_device msm_batt_device = {
2099 .name = "msm-battery",
2100 .id = -1,
2101 .dev.platform_data = &msm_psy_batt_data,
2102};
2103
2104static struct smsc911x_platform_config smsc911x_config = {
2105 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
2106 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
2107 .flags = SMSC911X_USE_16BIT,
2108};
2109
2110static struct resource smsc911x_resources[] = {
2111 [0] = {
2112 .start = 0x90000000,
2113 .end = 0x90007fff,
2114 .flags = IORESOURCE_MEM,
2115 },
2116 [1] = {
2117 .start = MSM_GPIO_TO_INT(48),
2118 .end = MSM_GPIO_TO_INT(48),
2119 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
2120 },
2121};
2122
2123static struct platform_device smsc911x_device = {
2124 .name = "smsc911x",
2125 .id = 0,
2126 .num_resources = ARRAY_SIZE(smsc911x_resources),
2127 .resource = smsc911x_resources,
2128 .dev = {
2129 .platform_data = &smsc911x_config,
2130 },
2131};
2132
2133static struct msm_gpio smsc911x_gpios[] = {
2134 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
2135 "smsc911x_irq" },
2136 { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
2137 "eth_fifo_sel" },
2138};
2139
2140#define ETH_FIFO_SEL_GPIO 49
2141static void msm7x27a_cfg_smsc911x(void)
2142{
2143 int res;
2144
2145 res = msm_gpios_request_enable(smsc911x_gpios,
2146 ARRAY_SIZE(smsc911x_gpios));
2147 if (res) {
2148 pr_err("%s: unable to enable gpios for SMSC911x\n", __func__);
2149 return;
2150 }
2151
2152 /* ETH_FIFO_SEL */
2153 res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0);
2154 if (res) {
2155 pr_err("%s: unable to get direction for gpio %d\n", __func__,
2156 ETH_FIFO_SEL_GPIO);
2157 msm_gpios_disable_free(smsc911x_gpios,
2158 ARRAY_SIZE(smsc911x_gpios));
2159 return;
2160 }
2161 gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
2162}
2163
2164#ifdef CONFIG_MSM_CAMERA
2165static uint32_t camera_off_gpio_table[] = {
2166 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
2167};
2168
2169static uint32_t camera_on_gpio_table[] = {
2170 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
2171};
2172
2173#ifdef CONFIG_MSM_CAMERA_FLASH
2174static struct msm_camera_sensor_flash_src msm_flash_src = {
Nishant Pandit474f2252011-07-23 23:17:56 +05302175 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
2176 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
2177 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002178};
2179#endif
2180
Justin Paupored98328e2011-08-19 13:48:31 -07002181static struct regulator_bulk_data regs_camera[] = {
2182 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
2183 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2184 { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
2185};
2186
2187static void __init msm_camera_vreg_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002188{
2189 int rc;
2190
Justin Paupored98328e2011-08-19 13:48:31 -07002191 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002192
Justin Paupored98328e2011-08-19 13:48:31 -07002193 if (rc) {
2194 pr_err("%s: could not get regulators: %d\n", __func__, rc);
2195 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002196 }
2197
Justin Paupored98328e2011-08-19 13:48:31 -07002198 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002199
Justin Paupored98328e2011-08-19 13:48:31 -07002200 if (rc) {
2201 pr_err("%s: could not set voltages: %d\n", __func__, rc);
2202 return;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002203 }
Justin Paupored98328e2011-08-19 13:48:31 -07002204}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002205
Justin Paupored98328e2011-08-19 13:48:31 -07002206static void msm_camera_vreg_config(int vreg_en)
2207{
2208 int rc = vreg_en ?
2209 regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
2210 regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002211
Justin Paupored98328e2011-08-19 13:48:31 -07002212 if (rc)
2213 pr_err("%s: could not %sable regulators: %d\n",
2214 __func__, vreg_en ? "en" : "dis", rc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002215}
2216
2217static int config_gpio_table(uint32_t *table, int len)
2218{
2219 int rc = 0, i = 0;
2220
2221 for (i = 0; i < len; i++) {
2222 rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
2223 if (rc) {
2224 pr_err("%s not able to get gpio\n", __func__);
2225 for (i--; i >= 0; i--)
2226 gpio_tlmm_config(camera_off_gpio_table[i],
2227 GPIO_CFG_ENABLE);
2228 break;
2229 }
2230 }
2231 return rc;
2232}
2233
2234static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data;
2235static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data;
2236static int config_camera_on_gpios_rear(void)
2237{
2238 int rc = 0;
2239
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302240 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002241 msm_camera_vreg_config(1);
2242
2243 rc = config_gpio_table(camera_on_gpio_table,
2244 ARRAY_SIZE(camera_on_gpio_table));
2245 if (rc < 0) {
2246 pr_err("%s: CAMSENSOR gpio table request"
2247 "failed\n", __func__);
2248 return rc;
2249 }
2250
2251 return rc;
2252}
2253
2254static void config_camera_off_gpios_rear(void)
2255{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302256 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002257 msm_camera_vreg_config(0);
2258
2259 config_gpio_table(camera_off_gpio_table,
2260 ARRAY_SIZE(camera_off_gpio_table));
2261}
2262
2263static int config_camera_on_gpios_front(void)
2264{
2265 int rc = 0;
2266
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302267 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002268 msm_camera_vreg_config(1);
2269
2270 rc = config_gpio_table(camera_on_gpio_table,
2271 ARRAY_SIZE(camera_on_gpio_table));
2272 if (rc < 0) {
2273 pr_err("%s: CAMSENSOR gpio table request"
2274 "failed\n", __func__);
2275 return rc;
2276 }
2277
2278 return rc;
2279}
2280
2281static void config_camera_off_gpios_front(void)
2282{
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302283 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002284 msm_camera_vreg_config(0);
2285
2286 config_gpio_table(camera_off_gpio_table,
2287 ARRAY_SIZE(camera_off_gpio_table));
2288}
2289
2290struct msm_camera_device_platform_data msm_camera_device_data_rear = {
2291 .camera_gpio_on = config_camera_on_gpios_rear,
2292 .camera_gpio_off = config_camera_off_gpios_rear,
2293 .ioext.csiphy = 0xA1000000,
2294 .ioext.csisz = 0x00100000,
2295 .ioext.csiirq = INT_CSI_IRQ_1,
2296 .ioclk.mclk_clk_rate = 24000000,
2297 .ioclk.vfe_clk_rate = 192000000,
2298 .ioext.appphy = MSM_CLK_CTL_PHYS,
2299 .ioext.appsz = MSM_CLK_CTL_SIZE,
2300};
2301
2302struct msm_camera_device_platform_data msm_camera_device_data_front = {
2303 .camera_gpio_on = config_camera_on_gpios_front,
2304 .camera_gpio_off = config_camera_off_gpios_front,
2305 .ioext.csiphy = 0xA0F00000,
2306 .ioext.csisz = 0x00100000,
2307 .ioext.csiirq = INT_CSI_IRQ_0,
2308 .ioclk.mclk_clk_rate = 24000000,
2309 .ioclk.vfe_clk_rate = 192000000,
2310 .ioext.appphy = MSM_CLK_CTL_PHYS,
2311 .ioext.appsz = MSM_CLK_CTL_SIZE,
2312};
2313
2314#ifdef CONFIG_S5K4E1
2315static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = {
2316 .mount_angle = 90
2317};
2318
2319static struct msm_camera_sensor_flash_data flash_s5k4e1 = {
2320 .flash_type = MSM_CAMERA_FLASH_LED,
2321 .flash_src = &msm_flash_src
2322};
2323
2324static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = {
2325 .sensor_name = "s5k4e1",
2326 .sensor_reset_enable = 1,
2327 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N,
2328 .sensor_pwd = 85,
2329 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
2330 .vcm_enable = 1,
2331 .pdata = &msm_camera_device_data_rear,
2332 .flash_data = &flash_s5k4e1,
2333 .sensor_platform_info = &s5k4e1_sensor_7627a_info,
2334 .csi_if = 1
2335};
2336
2337static struct platform_device msm_camera_sensor_s5k4e1 = {
2338 .name = "msm_camera_s5k4e1",
2339 .dev = {
2340 .platform_data = &msm_camera_sensor_s5k4e1_data,
2341 },
2342};
2343#endif
2344
2345#ifdef CONFIG_IMX072
2346static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = {
2347 .mount_angle = 90
2348};
2349
2350static struct msm_camera_sensor_flash_data flash_imx072 = {
2351 .flash_type = MSM_CAMERA_FLASH_LED,
2352 .flash_src = &msm_flash_src
2353};
2354
2355static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = {
2356 .sensor_name = "imx072",
2357 .sensor_reset_enable = 1,
2358 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/
2359 .sensor_pwd = 85,
2360 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
2361 .vcm_enable = 1,
2362 .pdata = &msm_camera_device_data_rear,
2363 .flash_data = &flash_imx072,
2364 .sensor_platform_info = &imx072_sensor_7627a_info,
2365 .csi_if = 1
2366};
2367
2368static struct platform_device msm_camera_sensor_imx072 = {
2369 .name = "msm_camera_imx072",
2370 .dev = {
2371 .platform_data = &msm_camera_sensor_imx072_data,
2372 },
2373};
2374#endif
2375
2376#ifdef CONFIG_WEBCAM_OV9726
2377static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = {
2378 .mount_angle = 90
2379};
2380
2381static struct msm_camera_sensor_flash_data flash_ov9726 = {
2382 .flash_type = MSM_CAMERA_FLASH_NONE,
2383 .flash_src = &msm_flash_src
2384};
2385
2386static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
2387 .sensor_name = "ov9726",
2388 .sensor_reset_enable = 0,
2389 .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR,
2390 .sensor_pwd = 85,
2391 .vcm_pwd = 1,
2392 .vcm_enable = 0,
2393 .pdata = &msm_camera_device_data_front,
2394 .flash_data = &flash_ov9726,
2395 .sensor_platform_info = &ov9726_sensor_7627a_info,
2396 .csi_if = 1
2397};
2398
2399static struct platform_device msm_camera_sensor_ov9726 = {
2400 .name = "msm_camera_ov9726",
2401 .dev = {
2402 .platform_data = &msm_camera_sensor_ov9726_data,
2403 },
2404};
Justin Paupored98328e2011-08-19 13:48:31 -07002405#else
2406static inline void msm_camera_vreg_init(void) { }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002407#endif
2408
2409#ifdef CONFIG_MT9E013
2410static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = {
2411 .mount_angle = 90
2412};
2413
2414static struct msm_camera_sensor_flash_data flash_mt9e013 = {
2415 .flash_type = MSM_CAMERA_FLASH_LED,
2416 .flash_src = &msm_flash_src
2417};
2418
2419static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
2420 .sensor_name = "mt9e013",
2421 .sensor_reset = 0,
2422 .sensor_reset_enable = 1,
2423 .sensor_pwd = 85,
2424 .vcm_pwd = 1,
2425 .vcm_enable = 0,
2426 .pdata = &msm_camera_device_data_rear,
2427 .flash_data = &flash_mt9e013,
2428 .sensor_platform_info = &mt9e013_sensor_7627a_info,
2429 .csi_if = 1
2430};
2431
2432static struct platform_device msm_camera_sensor_mt9e013 = {
2433 .name = "msm_camera_mt9e013",
2434 .dev = {
2435 .platform_data = &msm_camera_sensor_mt9e013_data,
2436 },
2437};
2438#endif
2439
2440static struct i2c_board_info i2c_camera_devices[] = {
2441 #ifdef CONFIG_S5K4E1
2442 {
2443 I2C_BOARD_INFO("s5k4e1", 0x36),
2444 },
2445 {
2446 I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1),
2447 },
2448 #endif
2449 #ifdef CONFIG_WEBCAM_OV9726
2450 {
2451 I2C_BOARD_INFO("ov9726", 0x10),
2452 },
2453 #endif
2454 #ifdef CONFIG_IMX072
2455 {
2456 I2C_BOARD_INFO("imx072", 0x34),
2457 },
2458 #endif
2459 #ifdef CONFIG_MT9E013
2460 {
2461 I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
2462 },
2463 #endif
2464 {
Nishant Pandit474f2252011-07-23 23:17:56 +05302465 I2C_BOARD_INFO("sc628a", 0x6E),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002466 },
2467};
2468#endif
2469#if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \
2470 && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM)
2471static struct msm_gpio uart2dm_gpios[] = {
2472 {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2473 "uart2dm_rfr_n" },
2474 {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2475 "uart2dm_cts_n" },
2476 {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2477 "uart2dm_rx" },
2478 {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2479 "uart2dm_tx" },
2480};
2481
2482static void msm7x27a_cfg_uart2dm_serial(void)
2483{
2484 int ret;
2485 ret = msm_gpios_request_enable(uart2dm_gpios,
2486 ARRAY_SIZE(uart2dm_gpios));
2487 if (ret)
2488 pr_err("%s: unable to enable gpios for uart2dm\n", __func__);
2489}
2490#else
2491static void msm7x27a_cfg_uart2dm_serial(void) { }
2492#endif
2493
2494static struct platform_device *rumi_sim_devices[] __initdata = {
2495 &msm_device_dmov,
2496 &msm_device_smd,
2497 &smc91x_device,
2498 &msm_device_uart1,
2499 &msm_device_nand,
2500 &msm_device_uart_dm1,
2501 &msm_gsbi0_qup_i2c_device,
2502 &msm_gsbi1_qup_i2c_device,
2503};
2504
2505static struct platform_device *surf_ffa_devices[] __initdata = {
2506 &msm_device_dmov,
2507 &msm_device_smd,
2508 &msm_device_uart1,
2509 &msm_device_uart_dm1,
2510 &msm_device_uart_dm2,
2511 &msm_device_nand,
2512 &msm_gsbi0_qup_i2c_device,
2513 &msm_gsbi1_qup_i2c_device,
2514 &msm_device_otg,
2515 &msm_device_gadget_peripheral,
2516 &android_usb_device,
2517 &android_pmem_device,
2518 &android_pmem_adsp_device,
2519 &android_pmem_audio_device,
2520 &msm_device_snd,
2521 &msm_device_adspdec,
2522 &msm_fb_device,
2523 &lcdc_toshiba_panel_device,
2524 &msm_batt_device,
2525 &smsc911x_device,
2526#ifdef CONFIG_S5K4E1
2527 &msm_camera_sensor_s5k4e1,
2528#endif
2529#ifdef CONFIG_IMX072
2530 &msm_camera_sensor_imx072,
2531#endif
2532#ifdef CONFIG_WEBCAM_OV9726
2533 &msm_camera_sensor_ov9726,
2534#endif
2535#ifdef CONFIG_MT9E013
2536 &msm_camera_sensor_mt9e013,
2537#endif
2538#ifdef CONFIG_FB_MSM_MIPI_DSI
2539 &mipi_dsi_renesas_panel_device,
2540#endif
2541 &msm_kgsl_3d0,
2542#ifdef CONFIG_BT
2543 &msm_bt_power_device,
2544#endif
Manish Dewangan3a260992011-06-24 18:01:34 +05302545 &asoc_msm_pcm,
2546 &asoc_msm_dai0,
2547 &asoc_msm_dai1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002548};
2549
2550static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
2551static int __init pmem_kernel_ebi1_size_setup(char *p)
2552{
2553 pmem_kernel_ebi1_size = memparse(p, NULL);
2554 return 0;
2555}
2556early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
2557
2558static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
2559static int __init pmem_audio_size_setup(char *p)
2560{
2561 pmem_audio_size = memparse(p, NULL);
2562 return 0;
2563}
2564early_param("pmem_audio_size", pmem_audio_size_setup);
2565
2566static void __init msm_msm7x2x_allocate_memory_regions(void)
2567{
2568 void *addr;
2569 unsigned long size;
2570
2571 size = fb_size ? : MSM_FB_SIZE;
2572 addr = alloc_bootmem_align(size, 0x1000);
2573 msm_fb_resources[0].start = __pa(addr);
2574 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2575 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2576 size, addr, __pa(addr));
2577}
2578
2579static struct memtype_reserve msm7x27a_reserve_table[] __initdata = {
2580 [MEMTYPE_SMI] = {
2581 },
2582 [MEMTYPE_EBI0] = {
2583 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2584 },
2585 [MEMTYPE_EBI1] = {
2586 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2587 },
2588};
2589
2590static void __init size_pmem_devices(void)
2591{
2592#ifdef CONFIG_ANDROID_PMEM
2593 android_pmem_adsp_pdata.size = pmem_adsp_size;
2594 android_pmem_pdata.size = pmem_mdp_size;
2595 android_pmem_audio_pdata.size = pmem_audio_size;
2596#endif
2597}
2598
2599static void __init reserve_memory_for(struct android_pmem_platform_data *p)
2600{
2601 msm7x27a_reserve_table[p->memory_type].size += p->size;
2602}
2603
2604static void __init reserve_pmem_memory(void)
2605{
2606#ifdef CONFIG_ANDROID_PMEM
2607 reserve_memory_for(&android_pmem_adsp_pdata);
2608 reserve_memory_for(&android_pmem_pdata);
2609 reserve_memory_for(&android_pmem_audio_pdata);
2610 msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
2611#endif
2612}
2613
2614static void __init msm7x27a_calculate_reserve_sizes(void)
2615{
2616 size_pmem_devices();
2617 reserve_pmem_memory();
2618}
2619
2620static int msm7x27a_paddr_to_memtype(unsigned int paddr)
2621{
2622 return MEMTYPE_EBI1;
2623}
2624
2625static struct reserve_info msm7x27a_reserve_info __initdata = {
2626 .memtype_reserve_table = msm7x27a_reserve_table,
2627 .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes,
2628 .paddr_to_memtype = msm7x27a_paddr_to_memtype,
2629};
2630
2631static void __init msm7x27a_reserve(void)
2632{
2633 reserve_info = &msm7x27a_reserve_info;
2634 msm_reserve();
2635}
2636
2637static void __init msm_device_i2c_init(void)
2638{
2639 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
2640 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
2641}
2642
2643static struct msm_panel_common_pdata mdp_pdata = {
2644 .gpio = 97,
2645 .mdp_rev = MDP_REV_303,
2646};
2647
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302648
2649#ifdef CONFIG_FB_MSM
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002650#define GPIO_LCDC_BRDG_PD 128
2651#define GPIO_LCDC_BRDG_RESET_N 129
2652
2653#define LCDC_RESET_PHYS 0x90008014
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302654
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002655static void __iomem *lcdc_reset_ptr;
2656
2657static unsigned mipi_dsi_gpio[] = {
2658 GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
2659 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2660 GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
2661 GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2662};
2663
2664enum {
2665 DSI_SINGLE_LANE = 1,
2666 DSI_TWO_LANES,
2667};
2668
2669static int msm_fb_get_lane_config(void)
2670{
2671 int rc = DSI_TWO_LANES;
2672
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302673 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002674 rc = DSI_SINGLE_LANE;
2675 pr_info("DSI Single Lane\n");
2676 } else {
2677 pr_info("DSI Two Lanes\n");
2678 }
2679 return rc;
2680}
2681
2682static int msm_fb_dsi_client_reset(void)
2683{
2684 int rc = 0;
2685
2686 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
2687 if (rc < 0) {
2688 pr_err("failed to request lcd brdg reset_n\n");
2689 return rc;
2690 }
2691
2692 rc = gpio_request(GPIO_LCDC_BRDG_PD, "lcdc_brdg_pd");
2693 if (rc < 0) {
2694 pr_err("failed to request lcd brdg pd\n");
2695 return rc;
2696 }
2697
2698 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
2699 if (rc) {
2700 pr_err("Failed to enable LCDC Bridge reset enable\n");
2701 goto gpio_error;
2702 }
2703
2704 rc = gpio_tlmm_config(mipi_dsi_gpio[1], GPIO_CFG_ENABLE);
2705 if (rc) {
2706 pr_err("Failed to enable LCDC Bridge pd enable\n");
2707 goto gpio_error2;
2708 }
2709
2710 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
2711 rc |= gpio_direction_output(GPIO_LCDC_BRDG_PD, 1);
2712 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
2713
2714 if (!rc) {
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302715 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002716 lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS,
2717 sizeof(uint32_t));
2718
2719 if (!lcdc_reset_ptr)
2720 return 0;
2721 }
2722 return rc;
2723 } else {
2724 goto gpio_error;
2725 }
2726
2727gpio_error2:
2728 pr_err("Failed GPIO bridge pd\n");
2729 gpio_free(GPIO_LCDC_BRDG_PD);
2730
2731gpio_error:
2732 pr_err("Failed GPIO bridge reset\n");
2733 gpio_free(GPIO_LCDC_BRDG_RESET_N);
2734 return rc;
2735}
2736
Justin Paupored98328e2011-08-19 13:48:31 -07002737static struct regulator_bulk_data regs_dsi[] = {
2738 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2739 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740};
2741
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002742static int dsi_gpio_initialized;
2743
2744static int mipi_dsi_panel_power(int on)
2745{
Justin Paupored98328e2011-08-19 13:48:31 -07002746 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002747 uint32_t lcdc_reset_cfg;
2748
2749 /* I2C-controlled GPIO Expander -init of the GPIOs very late */
Justin Paupored98328e2011-08-19 13:48:31 -07002750 if (unlikely(!dsi_gpio_initialized)) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002751 pmapp_disp_backlight_init();
2752
2753 rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr");
2754 if (rc < 0) {
2755 pr_err("failed to request gpio_disp_pwr\n");
2756 return rc;
2757 }
2758
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302759 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002760 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1);
2761 if (rc < 0) {
2762 pr_err("failed to enable display pwr\n");
2763 goto fail_gpio1;
2764 }
2765
2766 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
2767 if (rc < 0) {
2768 pr_err("failed to request gpio_bkl_en\n");
2769 goto fail_gpio1;
2770 }
2771
2772 rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
2773 if (rc < 0) {
2774 pr_err("failed to enable backlight\n");
2775 goto fail_gpio2;
2776 }
2777 }
2778
Justin Paupored98328e2011-08-19 13:48:31 -07002779 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
2780 if (rc) {
2781 pr_err("%s: could not get regulators: %d\n",
2782 __func__, rc);
2783 goto fail_gpio2;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002784 }
Justin Paupored98328e2011-08-19 13:48:31 -07002785
2786 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi);
2787 if (rc) {
2788 pr_err("%s: could not set voltages: %d\n",
2789 __func__, rc);
2790 goto fail_vreg;
2791 }
2792
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002793 dsi_gpio_initialized = 1;
2794 }
2795
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302796 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07002797 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
2798 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302799 } else if (machine_is_msm7x27a_ffa() ||
2800 machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002801 if (on) {
Justin Paupored98328e2011-08-19 13:48:31 -07002802 /* This line drives an active low pin on FFA */
2803 rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on);
2804 if (rc < 0)
2805 pr_err("failed to set direction for "
2806 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002807 } else {
Justin Paupored98328e2011-08-19 13:48:31 -07002808 gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on);
2809 rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN);
2810 if (rc < 0)
2811 pr_err("failed to set direction for "
2812 "display pwr\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002813 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002814 }
2815
Justin Paupored98328e2011-08-19 13:48:31 -07002816 if (on) {
2817 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);
2818
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302819 if (machine_is_msm7x27a_surf() ||
2820 machine_is_msm7625a_surf()) {
Justin Paupored98328e2011-08-19 13:48:31 -07002821 lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr);
2822 rmb();
2823 lcdc_reset_cfg &= ~1;
2824
2825 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
2826 msleep(20);
2827 wmb();
2828 lcdc_reset_cfg |= 1;
2829 writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
2830 } else {
2831 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
2832 msleep(20);
2833 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
2834 }
2835
2836 if (pmapp_disp_backlight_set_brightness(100))
2837 pr_err("backlight set brightness failed\n");
2838 } else {
2839 gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1);
2840
2841 if (pmapp_disp_backlight_set_brightness(0))
2842 pr_err("backlight set brightness failed\n");
2843 }
2844
2845 rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) :
2846 regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi);
2847
2848 if (rc)
2849 pr_err("%s: could not %sable regulators: %d\n",
2850 __func__, on ? "en" : "dis", rc);
2851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002852 return rc;
2853
Justin Paupored98328e2011-08-19 13:48:31 -07002854fail_vreg:
2855 regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002856fail_gpio2:
2857 gpio_free(GPIO_BACKLIGHT_EN);
2858fail_gpio1:
2859 gpio_free(GPIO_DISPLAY_PWR_EN);
2860 dsi_gpio_initialized = 0;
2861 return rc;
2862}
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302863#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002864
2865#define MDP_303_VSYNC_GPIO 97
2866
2867#ifdef CONFIG_FB_MSM_MDP303
2868static struct mipi_dsi_platform_data mipi_dsi_pdata = {
2869 .vsync_gpio = MDP_303_VSYNC_GPIO,
2870 .dsi_power_save = mipi_dsi_panel_power,
2871 .dsi_client_reset = msm_fb_dsi_client_reset,
2872 .get_lane_config = msm_fb_get_lane_config,
2873};
2874#endif
2875
2876static void __init msm_fb_add_devices(void)
2877{
2878 msm_fb_register_device("mdp", &mdp_pdata);
2879 msm_fb_register_device("lcdc", &lcdc_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302880#ifdef CONFIG_FB_MSM_MDP303
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002881 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Pankaj Kumarffdaec82011-09-26 12:24:45 +05302882#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002883}
2884
2885#define MSM_EBI2_PHYS 0xa0d00000
2886#define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030
2887
2888static void __init msm7x27a_init_ebi2(void)
2889{
2890 uint32_t ebi2_cfg;
2891 void __iomem *ebi2_cfg_ptr;
2892
2893 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t));
2894 if (!ebi2_cfg_ptr)
2895 return;
2896
2897 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302898 if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() ||
2899 machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002900 ebi2_cfg |= (1 << 4); /* CS2 */
2901
2902 writel(ebi2_cfg, ebi2_cfg_ptr);
2903 iounmap(ebi2_cfg_ptr);
2904
2905 /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */
2906 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1,
2907 sizeof(uint32_t));
2908 if (!ebi2_cfg_ptr)
2909 return;
2910
2911 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +05302912 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002913 ebi2_cfg |= (1 << 31);
2914
2915 writel(ebi2_cfg, ebi2_cfg_ptr);
2916 iounmap(ebi2_cfg_ptr);
2917}
2918
2919#define ATMEL_TS_I2C_NAME "maXTouch"
Justin Paupored98328e2011-08-19 13:48:31 -07002920
2921static struct regulator_bulk_data regs_atmel[] = {
2922 { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 },
2923 { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 },
2924};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002925
2926#define ATMEL_TS_GPIO_IRQ 82
2927
2928static int atmel_ts_power_on(bool on)
2929{
Justin Paupored98328e2011-08-19 13:48:31 -07002930 int rc = on ?
2931 regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) :
2932 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002933
Justin Paupored98328e2011-08-19 13:48:31 -07002934 if (rc)
2935 pr_err("%s: could not %sable regulators: %d\n",
2936 __func__, on ? "en" : "dis", rc);
2937 else
2938 msleep(50);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002939
Justin Paupored98328e2011-08-19 13:48:31 -07002940 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002941}
2942
2943static int atmel_ts_platform_init(struct i2c_client *client)
2944{
2945 int rc;
Justin Paupored98328e2011-08-19 13:48:31 -07002946 struct device *dev = &client->dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002947
Justin Paupored98328e2011-08-19 13:48:31 -07002948 rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002949 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002950 dev_err(dev, "%s: could not get regulators: %d\n",
2951 __func__, rc);
2952 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002953 }
2954
Justin Paupored98328e2011-08-19 13:48:31 -07002955 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002956 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002957 dev_err(dev, "%s: could not set voltages: %d\n",
2958 __func__, rc);
2959 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002960 }
2961
2962 rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2963 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
2964 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
2965 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002966 dev_err(dev, "%s: gpio_tlmm_config for %d failed\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002967 __func__, ATMEL_TS_GPIO_IRQ);
Justin Paupored98328e2011-08-19 13:48:31 -07002968 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002969 }
2970
2971 /* configure touchscreen interrupt gpio */
2972 rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio");
2973 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07002974 dev_err(dev, "%s: unable to request gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002975 __func__, ATMEL_TS_GPIO_IRQ);
2976 goto ts_gpio_tlmm_unconfig;
2977 }
2978
2979 rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ);
2980 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -07002981 dev_err(dev, "%s: unable to set the direction of gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002982 __func__, ATMEL_TS_GPIO_IRQ);
2983 goto free_ts_gpio;
2984 }
2985 return 0;
2986
2987free_ts_gpio:
2988 gpio_free(ATMEL_TS_GPIO_IRQ);
2989ts_gpio_tlmm_unconfig:
2990 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
2991 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
2992 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07002993reg_free:
2994 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
2995out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002996 return rc;
2997}
2998
2999static int atmel_ts_platform_exit(struct i2c_client *client)
3000{
3001 gpio_free(ATMEL_TS_GPIO_IRQ);
3002 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
3003 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
3004 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07003005 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
3006 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003007 return 0;
3008}
3009
3010static u8 atmel_ts_read_chg(void)
3011{
3012 return gpio_get_value(ATMEL_TS_GPIO_IRQ);
3013}
3014
3015static u8 atmel_ts_valid_interrupt(void)
3016{
3017 return !atmel_ts_read_chg();
3018}
3019
3020#define ATMEL_X_OFFSET 13
3021#define ATMEL_Y_OFFSET 0
3022
3023static struct mxt_platform_data atmel_ts_pdata = {
3024 .numtouch = 4,
3025 .init_platform_hw = atmel_ts_platform_init,
3026 .exit_platform_hw = atmel_ts_platform_exit,
3027 .power_on = atmel_ts_power_on,
3028 .display_res_x = 480,
3029 .display_res_y = 864,
3030 .min_x = ATMEL_X_OFFSET,
3031 .max_x = (505 - ATMEL_X_OFFSET),
3032 .min_y = ATMEL_Y_OFFSET,
3033 .max_y = (863 - ATMEL_Y_OFFSET),
3034 .valid_interrupt = atmel_ts_valid_interrupt,
3035 .read_chg = atmel_ts_read_chg,
3036};
3037
3038static struct i2c_board_info atmel_ts_i2c_info[] __initdata = {
3039 {
3040 I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a),
3041 .platform_data = &atmel_ts_pdata,
3042 .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ),
3043 },
3044};
3045
3046#define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col))
3047
3048static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35};
3049static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40};
3050
3051static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) *
3052 ARRAY_SIZE(kp_row_gpios)] = {
3053 [KP_INDEX(0, 0)] = KEY_7,
3054 [KP_INDEX(0, 1)] = KEY_DOWN,
3055 [KP_INDEX(0, 2)] = KEY_UP,
3056 [KP_INDEX(0, 3)] = KEY_RIGHT,
3057 [KP_INDEX(0, 4)] = KEY_ENTER,
3058
3059 [KP_INDEX(1, 0)] = KEY_LEFT,
3060 [KP_INDEX(1, 1)] = KEY_SEND,
3061 [KP_INDEX(1, 2)] = KEY_1,
3062 [KP_INDEX(1, 3)] = KEY_4,
3063 [KP_INDEX(1, 4)] = KEY_CLEAR,
3064
3065 [KP_INDEX(2, 0)] = KEY_6,
3066 [KP_INDEX(2, 1)] = KEY_5,
3067 [KP_INDEX(2, 2)] = KEY_8,
3068 [KP_INDEX(2, 3)] = KEY_3,
3069 [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR,
3070
3071 [KP_INDEX(3, 0)] = KEY_9,
3072 [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND,
3073 [KP_INDEX(3, 2)] = KEY_0,
3074 [KP_INDEX(3, 3)] = KEY_2,
3075 [KP_INDEX(3, 4)] = KEY_SLEEP,
3076
3077 [KP_INDEX(4, 0)] = KEY_BACK,
3078 [KP_INDEX(4, 1)] = KEY_HOME,
3079 [KP_INDEX(4, 2)] = KEY_MENU,
3080 [KP_INDEX(4, 3)] = KEY_VOLUMEUP,
3081 [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN,
3082};
3083
3084/* SURF keypad platform device information */
3085static struct gpio_event_matrix_info kp_matrix_info = {
3086 .info.func = gpio_event_matrix_func,
3087 .keymap = keymap,
3088 .output_gpios = kp_row_gpios,
3089 .input_gpios = kp_col_gpios,
3090 .noutputs = ARRAY_SIZE(kp_row_gpios),
3091 .ninputs = ARRAY_SIZE(kp_col_gpios),
3092 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
3093 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
3094 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
3095 GPIOKPF_PRINT_UNMAPPED_KEYS,
3096};
3097
3098static struct gpio_event_info *kp_info[] = {
3099 &kp_matrix_info.info
3100};
3101
3102static struct gpio_event_platform_data kp_pdata = {
3103 .name = "7x27a_kp",
3104 .info = kp_info,
3105 .info_count = ARRAY_SIZE(kp_info)
3106};
3107
3108static struct platform_device kp_pdev = {
3109 .name = GPIO_EVENT_DEV_NAME,
3110 .id = -1,
3111 .dev = {
3112 .platform_data = &kp_pdata,
3113 },
3114};
3115
3116static struct msm_handset_platform_data hs_platform_data = {
3117 .hs_name = "7k_handset",
3118 .pwr_key_delay_ms = 500, /* 0 will disable end key */
3119};
3120
3121static struct platform_device hs_pdev = {
3122 .name = "msm-handset",
3123 .id = -1,
3124 .dev = {
3125 .platform_data = &hs_platform_data,
3126 },
3127};
3128
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003129static struct platform_device msm_proccomm_regulator_dev = {
3130 .name = PROCCOMM_REGULATOR_DEV_NAME,
3131 .id = -1,
3132 .dev = {
3133 .platform_data = &msm7x27a_proccomm_regulator_data
3134 }
3135};
3136
Trilok Soni16f61af2011-07-26 16:06:58 +05303137static void __init msm7627a_rumi3_init(void)
3138{
3139 msm7x27a_init_ebi2();
3140 platform_add_devices(rumi_sim_devices,
3141 ARRAY_SIZE(rumi_sim_devices));
3142}
3143
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003144#define LED_GPIO_PDM 96
3145#define UART1DM_RX_GPIO 45
Santosh Sajjanb479f0f2011-08-18 21:00:44 +05303146
3147#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3148static int __init msm7x27a_init_ar6000pm(void)
3149{
3150 return platform_device_register(&msm_wlan_ar6000_pm_device);
3151}
3152#else
3153static int __init msm7x27a_init_ar6000pm(void) { return 0; }
3154#endif
3155
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003156static void __init msm7x27a_init_regulators(void)
3157{
3158 int rc = platform_device_register(&msm_proccomm_regulator_dev);
3159 if (rc)
3160 pr_err("%s: could not register regulator device: %d\n",
3161 __func__, rc);
3162}
3163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003164static void __init msm7x2x_init(void)
3165{
Trilok Sonia416c492011-07-22 20:20:23 +05303166 msm7x2x_misc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003167
Justin Pauporeb3a33b72011-08-23 15:30:32 -07003168 /* Initialize regulators first so that other devices can use them */
3169 msm7x27a_init_regulators();
3170
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003171 /* Common functions for SURF/FFA/RUMI3 */
3172 msm_device_i2c_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003173 msm7x27a_init_ebi2();
3174 msm7x27a_cfg_uart2dm_serial();
3175#ifdef CONFIG_SERIAL_MSM_HS
3176 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
3177 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
3178#endif
3179
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003180#ifdef CONFIG_USB_MSM_OTG_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05303181 msm_otg_pdata.swfi_latency =
3182 msm7x27a_pm_data
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003183 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Trilok Soni16f61af2011-07-26 16:06:58 +05303184 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003185#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05303186 msm_device_gadget_peripheral.dev.platform_data =
3187 &msm_gadget_pdata;
3188 msm7x27a_cfg_smsc911x();
3189 platform_add_devices(msm_footswitch_devices,
3190 msm_num_footswitch_devices);
3191 platform_add_devices(surf_ffa_devices,
3192 ARRAY_SIZE(surf_ffa_devices));
Sujith Reddy Thummaad7c9a82011-09-30 20:54:38 +05303193 /* Ensure ar6000pm device is registered before MMC/SDC */
3194 msm7x27a_init_ar6000pm();
3195#ifdef CONFIG_MMC_MSM
3196 msm7x27a_init_mmc();
3197#endif
Trilok Soni16f61af2011-07-26 16:06:58 +05303198 msm_fb_add_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003199#ifdef CONFIG_USB_EHCI_MSM_72K
Trilok Soni16f61af2011-07-26 16:06:58 +05303200 msm7x2x_init_host();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003201#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003202
3203 msm_pm_set_platform_data(msm7x27a_pm_data,
3204 ARRAY_SIZE(msm7x27a_pm_data));
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06003205 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_RESET_VECTOR,
3206 ioremap(0, PAGE_SIZE)));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003207
3208#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
3209 register_i2c_devices();
3210#endif
3211#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3212 bt_power_init();
3213#endif
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303214 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003215 atmel_ts_pdata.min_x = 0;
3216 atmel_ts_pdata.max_x = 480;
3217 atmel_ts_pdata.min_y = 0;
3218 atmel_ts_pdata.max_y = 320;
3219 }
3220
3221 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
3222 atmel_ts_i2c_info,
3223 ARRAY_SIZE(atmel_ts_i2c_info));
3224
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05303225#if defined(CONFIG_MSM_CAMERA)
Justin Paupored98328e2011-08-19 13:48:31 -07003226 msm_camera_vreg_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003227 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
3228 i2c_camera_devices,
3229 ARRAY_SIZE(i2c_camera_devices));
Pankaj Kumar5be2a3e2011-09-26 11:45:02 +05303230#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003231 platform_device_register(&kp_pdev);
3232 platform_device_register(&hs_pdev);
3233
3234 /* configure it as a pdm function*/
3235 if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3,
3236 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
3237 GPIO_CFG_8MA), GPIO_CFG_ENABLE))
3238 pr_err("%s: gpio_tlmm_config for %d failed\n",
3239 __func__, LED_GPIO_PDM);
3240 else
3241 platform_device_register(&led_pdev);
3242
3243#ifdef CONFIG_MSM_RPC_VIBRATOR
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303244 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003245 msm_init_pmic_vibrator();
3246#endif
3247 /*7x25a kgsl initializations*/
3248 msm7x25a_kgsl_3d0_init();
3249}
3250
3251static void __init msm7x2x_init_early(void)
3252{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003253 msm_msm7x2x_allocate_memory_regions();
3254}
3255
3256MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3")
3257 .boot_params = PHYS_OFFSET + 0x100,
3258 .map_io = msm_common_io_init,
3259 .reserve = msm7x27a_reserve,
3260 .init_irq = msm_init_irq,
Trilok Soni16f61af2011-07-26 16:06:58 +05303261 .init_machine = msm7627a_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003262 .timer = &msm_timer,
3263 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303264 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003265MACHINE_END
3266MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF")
3267 .boot_params = PHYS_OFFSET + 0x100,
3268 .map_io = msm_common_io_init,
3269 .reserve = msm7x27a_reserve,
3270 .init_irq = msm_init_irq,
3271 .init_machine = msm7x2x_init,
3272 .timer = &msm_timer,
3273 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303274 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003275MACHINE_END
3276MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA")
3277 .boot_params = PHYS_OFFSET + 0x100,
3278 .map_io = msm_common_io_init,
3279 .reserve = msm7x27a_reserve,
3280 .init_irq = msm_init_irq,
3281 .init_machine = msm7x2x_init,
3282 .timer = &msm_timer,
3283 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303284 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003285MACHINE_END
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303286MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF")
3287 .boot_params = PHYS_OFFSET + 0x100,
3288 .map_io = msm_common_io_init,
3289 .reserve = msm7x27a_reserve,
3290 .init_irq = msm_init_irq,
3291 .init_machine = msm7x2x_init,
3292 .timer = &msm_timer,
3293 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303294 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303295MACHINE_END
3296MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA")
3297 .boot_params = PHYS_OFFSET + 0x100,
3298 .map_io = msm_common_io_init,
3299 .reserve = msm7x27a_reserve,
3300 .init_irq = msm_init_irq,
3301 .init_machine = msm7x2x_init,
3302 .timer = &msm_timer,
3303 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05303304 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05303305MACHINE_END