blob: 91bb455281a4ecb7b9df7e1dd64c8ba63ac0addf [file] [log] [blame]
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301/* 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
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/gpio_event.h>
Pankaj Kumar6f841742011-10-10 15:52:14 +053016#include <linux/usb/android.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053017#include <linux/platform_device.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
20#include <linux/mtd/nand.h>
21#include <linux/mtd/partitions.h>
22#include <linux/i2c.h>
23#include <linux/android_pmem.h>
24#include <linux/bootmem.h>
25#include <linux/mfd/marimba.h>
26#include <linux/power_supply.h>
Taniya Dasda408822011-09-06 12:54:06 +053027#include <linux/input/rmi_platformdata.h>
28#include <linux/input/rmi_i2c.h>
Pankaj Kumar3cec0582011-11-18 11:13:29 +053029#include <linux/regulator/consumer.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053030#include <asm/mach/mmc.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <mach/board.h>
34#include <mach/msm_iomap.h>
35#include <mach/msm_hsusb.h>
36#include <mach/rpc_hsusb.h>
37#include <mach/rpc_pmapp.h>
38#include <mach/usbdiag.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053039#include <mach/msm_memtypes.h>
40#include <mach/msm_serial_hs.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053041#include <mach/pmic.h>
42#include <mach/socinfo.h>
43#include <mach/vreg.h>
44#include <mach/rpc_pmapp.h>
45#include <mach/msm_battery.h>
46#include <mach/rpc_server_handset.h>
47#include <mach/socinfo.h>
Pankaj Kumar27c02642011-09-22 15:55:55 +053048#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053049#include "devices.h"
50#include "devices-msm7x2xa.h"
51#include "pm.h"
52#include "timer.h"
Murali Nalajalaa1827842011-11-13 14:12:39 +053053#include "pm-boot.h"
Pankaj Kumar3cec0582011-11-18 11:13:29 +053054#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053055
56#define PMEM_KERNEL_EBI1_SIZE 0x3A000
57#define MSM_PMEM_AUDIO_SIZE 0x5B000
58#define BAHAMA_SLAVE_ID_FM_ADDR 0x2A
59#define BAHAMA_SLAVE_ID_QMEMBIST_ADDR 0x7B
60#define BAHAMA_SLAVE_ID_FM_REG 0x02
61#define FM_GPIO 83
62
63enum {
64 GPIO_HOST_VBUS_EN = 107,
65 GPIO_BT_SYS_REST_EN = 114,
66 GPIO_WAKE_ON_WIRELESS,
67 GPIO_BACKLIGHT_EN,
Taniya Das7a22cdd2011-09-08 14:57:00 +053068 GPIO_NC,
69 GPIO_CAM_3MP_PWDN, /* CAM_VGA */
Taniya Dasc98bfbc2011-08-23 09:58:55 +053070 GPIO_WLAN_EN,
71 GPIO_CAM_5MP_SHDN_EN,
72 GPIO_CAM_5MP_RESET,
Taniya Das7a22cdd2011-09-08 14:57:00 +053073 GPIO_TP,
74 GPIO_CAM_GP_CAMIF_RESET,
Taniya Dasc98bfbc2011-08-23 09:58:55 +053075};
76
77 /* FM Platform power and shutdown routines */
78#define FPGA_MSM_CNTRL_REG2 0x90008010
79
Chintan Pandya3b2aff72011-11-25 16:26:08 +053080#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Taniya Dasc98bfbc2011-08-23 09:58:55 +053081static void config_pcm_i2s_mode(int mode)
82{
83 void __iomem *cfg_ptr;
84 u8 reg2;
85
86 cfg_ptr = ioremap_nocache(FPGA_MSM_CNTRL_REG2, sizeof(char));
87
88 if (!cfg_ptr)
89 return;
90 if (mode) {
91 /*enable the pcm mode in FPGA*/
92 reg2 = readb_relaxed(cfg_ptr);
93 if (reg2 == 0) {
94 reg2 = 1;
95 writeb_relaxed(reg2, cfg_ptr);
96 }
97 } else {
98 /*enable i2s mode in FPGA*/
99 reg2 = readb_relaxed(cfg_ptr);
100 if (reg2 == 1) {
101 reg2 = 0;
102 writeb_relaxed(reg2, cfg_ptr);
103 }
104 }
105 iounmap(cfg_ptr);
106}
107
108static unsigned fm_i2s_config_power_on[] = {
109 /*FM_I2S_SD*/
110 GPIO_CFG(68, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
111 /*FM_I2S_WS*/
112 GPIO_CFG(70, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
113 /*FM_I2S_SCK*/
114 GPIO_CFG(71, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
115};
116
117static unsigned fm_i2s_config_power_off[] = {
118 /*FM_I2S_SD*/
119 GPIO_CFG(68, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
120 /*FM_I2S_WS*/
121 GPIO_CFG(70, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
122 /*FM_I2S_SCK*/
123 GPIO_CFG(71, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
124};
125
126static unsigned bt_config_power_on[] = {
127 /*RFR*/
128 GPIO_CFG(43, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
129 /*CTS*/
130 GPIO_CFG(44, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
131 /*RX*/
132 GPIO_CFG(45, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
133 /*TX*/
134 GPIO_CFG(46, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
135};
136static unsigned bt_config_pcm_on[] = {
137 /*PCM_DOUT*/
138 GPIO_CFG(68, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
139 /*PCM_DIN*/
140 GPIO_CFG(69, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
141 /*PCM_SYNC*/
142 GPIO_CFG(70, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
143 /*PCM_CLK*/
144 GPIO_CFG(71, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
145};
146static unsigned bt_config_power_off[] = {
147 /*RFR*/
148 GPIO_CFG(43, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
149 /*CTS*/
150 GPIO_CFG(44, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
151 /*RX*/
152 GPIO_CFG(45, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
153 /*TX*/
154 GPIO_CFG(46, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
155};
156static unsigned bt_config_pcm_off[] = {
157 /*PCM_DOUT*/
158 GPIO_CFG(68, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
159 /*PCM_DIN*/
160 GPIO_CFG(69, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
161 /*PCM_SYNC*/
162 GPIO_CFG(70, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
163 /*PCM_CLK*/
164 GPIO_CFG(71, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
165};
166
167
168static int config_i2s(int mode)
169{
170 int pin, rc = 0;
171
172 if (mode == FM_I2S_ON) {
173 if (machine_is_msm7627a_qrd1())
174 config_pcm_i2s_mode(0);
175 pr_err("%s mode = FM_I2S_ON", __func__);
176 for (pin = 0; pin < ARRAY_SIZE(fm_i2s_config_power_on);
177 pin++) {
178 rc = gpio_tlmm_config(
179 fm_i2s_config_power_on[pin],
180 GPIO_CFG_ENABLE
181 );
182 if (rc < 0)
183 return rc;
184 }
185 } else if (mode == FM_I2S_OFF) {
186 pr_err("%s mode = FM_I2S_OFF", __func__);
187 for (pin = 0; pin < ARRAY_SIZE(fm_i2s_config_power_off);
188 pin++) {
189 rc = gpio_tlmm_config(
190 fm_i2s_config_power_off[pin],
191 GPIO_CFG_ENABLE
192 );
193 if (rc < 0)
194 return rc;
195 }
196 }
197 return rc;
198}
199static int config_pcm(int mode)
200{
201 int pin, rc = 0;
202
203 if (mode == BT_PCM_ON) {
204 if (machine_is_msm7627a_qrd1())
205 config_pcm_i2s_mode(1);
206 pr_err("%s mode =BT_PCM_ON", __func__);
207 for (pin = 0; pin < ARRAY_SIZE(bt_config_pcm_on);
208 pin++) {
209 rc = gpio_tlmm_config(bt_config_pcm_on[pin],
210 GPIO_CFG_ENABLE);
211 if (rc < 0)
212 return rc;
213 }
214 } else if (mode == BT_PCM_OFF) {
215 pr_err("%s mode =BT_PCM_OFF", __func__);
216 for (pin = 0; pin < ARRAY_SIZE(bt_config_pcm_off);
217 pin++) {
218 rc = gpio_tlmm_config(bt_config_pcm_off[pin],
219 GPIO_CFG_ENABLE);
220 if (rc < 0)
221 return rc;
222 }
223
224 }
225
226 return rc;
227}
228
229static int msm_bahama_setup_pcm_i2s(int mode)
230{
231 int fm_state = 0, bt_state = 0;
232 int rc = 0;
233 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
234
235 fm_state = marimba_get_fm_status(&config);
236 bt_state = marimba_get_bt_status(&config);
237
238 switch (mode) {
239 case BT_PCM_ON:
240 case BT_PCM_OFF:
241 if (!fm_state)
242 rc = config_pcm(mode);
243 break;
244 case FM_I2S_ON:
245 rc = config_i2s(mode);
246 break;
247 case FM_I2S_OFF:
248 if (bt_state)
249 rc = config_pcm(BT_PCM_ON);
250 else
251 rc = config_i2s(mode);
252 break;
253 default:
254 rc = -EIO;
255 pr_err("%s:Unsupported mode", __func__);
256 }
257 return rc;
258}
259
260static int bt_set_gpio(int on)
261{
262 int rc = 0;
263 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
264
265 if (on) {
266 rc = gpio_direction_output(GPIO_BT_SYS_REST_EN, 1);
267 msleep(100);
268 } else {
269 if (!marimba_get_fm_status(&config) &&
270 !marimba_get_bt_status(&config)) {
271 gpio_set_value_cansleep(GPIO_BT_SYS_REST_EN, 0);
272 rc = gpio_direction_input(GPIO_BT_SYS_REST_EN);
273 msleep(100);
274 }
275 }
276 if (rc)
277 pr_err("%s: BT sys_reset_en GPIO : Error", __func__);
278
279 return rc;
280}
Pankaj Kumar27c02642011-09-22 15:55:55 +0530281static struct regulator *fm_regulator;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530282static int fm_radio_setup(struct marimba_fm_platform_data *pdata)
283{
284 int rc = 0;
285 const char *id = "FMPW";
286 uint32_t irqcfg;
287 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
288 u8 value;
289
290 /* Voting for 1.8V Regulator */
Pankaj Kumar27c02642011-09-22 15:55:55 +0530291 fm_regulator = regulator_get(NULL , "msme1");
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530292 if (IS_ERR(fm_regulator)) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530293 rc = PTR_ERR(fm_regulator);
294 pr_err("%s: could not get regulator: %d\n", __func__, rc);
295 goto out;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530296 }
297
298 /* Set the voltage level to 1.8V */
Pankaj Kumar27c02642011-09-22 15:55:55 +0530299 rc = regulator_set_voltage(fm_regulator, 1800000, 1800000);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530300 if (rc < 0) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530301 pr_err("%s: could not set voltage: %d\n", __func__, rc);
302 goto reg_free;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530303 }
304
305 /* Enabling the 1.8V regulator */
Pankaj Kumar27c02642011-09-22 15:55:55 +0530306 rc = regulator_enable(fm_regulator);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530307 if (rc) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530308 pr_err("%s: could not enable regulator: %d\n", __func__, rc);
309 goto reg_free;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530310 }
311
312 /* Voting for 19.2MHz clock */
313 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
314 PMAPP_CLOCK_VOTE_ON);
315 if (rc < 0) {
316 pr_err("%s: clock vote failed with :(%d)\n",
317 __func__, rc);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530318 goto reg_disable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530319 }
320
321 rc = bt_set_gpio(1);
322 if (rc) {
323 pr_err("%s: bt_set_gpio = %d", __func__, rc);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530324 goto gpio_deconfig;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530325 }
326 /*re-write FM Slave Id, after reset*/
327 value = BAHAMA_SLAVE_ID_FM_ADDR;
328 rc = marimba_write_bit_mask(&config,
329 BAHAMA_SLAVE_ID_FM_REG, &value, 1, 0xFF);
330 if (rc < 0) {
331 pr_err("%s: FM Slave ID rewrite Failed = %d", __func__, rc);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530332 goto gpio_deconfig;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530333 }
334 /* Configuring the FM GPIO */
335 irqcfg = GPIO_CFG(FM_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
336 GPIO_CFG_2MA);
337
338 rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE);
339 if (rc) {
340 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
341 __func__, irqcfg, rc);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530342 goto gpio_deconfig;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530343 }
344
345 return 0;
346
Pankaj Kumar27c02642011-09-22 15:55:55 +0530347gpio_deconfig:
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530348 pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
349 PMAPP_CLOCK_VOTE_OFF);
350 bt_set_gpio(0);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530351reg_disable:
352 regulator_disable(fm_regulator);
353reg_free:
354 regulator_put(fm_regulator);
355 fm_regulator = NULL;
356out:
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530357 return rc;
358};
359
360static void fm_radio_shutdown(struct marimba_fm_platform_data *pdata)
361{
362 int rc;
363 const char *id = "FMPW";
364
365 /* Releasing the GPIO line used by FM */
366 uint32_t irqcfg = GPIO_CFG(FM_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
367 GPIO_CFG_2MA);
368
369 rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE);
370 if (rc)
371 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
372 __func__, irqcfg, rc);
373
374 /* Releasing the 1.8V Regulator */
Pankaj Kumar27c02642011-09-22 15:55:55 +0530375 if (!IS_ERR_OR_NULL(fm_regulator)) {
376 rc = regulator_disable(fm_regulator);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530377 if (rc)
Pankaj Kumar27c02642011-09-22 15:55:55 +0530378 pr_err("%s: could not disable regulator: %d\n",
379 __func__, rc);
380 regulator_put(fm_regulator);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530381 fm_regulator = NULL;
382 }
383
384 /* Voting off the clock */
385 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
386 PMAPP_CLOCK_VOTE_OFF);
387 if (rc < 0)
388 pr_err("%s: voting off failed with :(%d)\n",
389 __func__, rc);
390 rc = bt_set_gpio(0);
391 if (rc)
392 pr_err("%s: bt_set_gpio = %d", __func__, rc);
393}
394
395static struct marimba_fm_platform_data marimba_fm_pdata = {
396 .fm_setup = fm_radio_setup,
397 .fm_shutdown = fm_radio_shutdown,
398 .irq = MSM_GPIO_TO_INT(FM_GPIO),
399 .vreg_s2 = NULL,
400 .vreg_xo_out = NULL,
401 /* Configuring the FM SoC as I2S Master */
402 .is_fm_soc_i2s_master = true,
403 .config_i2s_gpio = msm_bahama_setup_pcm_i2s,
404};
Chintan Pandya3b2aff72011-11-25 16:26:08 +0530405#endif
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530406
407static struct platform_device msm_wlan_ar6000_pm_device = {
408 .name = "wlan_ar6000_pm_dev",
409 .id = -1,
410};
411
412#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
413
414static struct platform_device msm_bt_power_device = {
415 .name = "bt_power",
416};
417struct bahama_config_register {
418 u8 reg;
419 u8 value;
420 u8 mask;
421};
422struct bt_vreg_info {
423 const char *name;
424 unsigned int pmapp_id;
Pankaj Kumar27c02642011-09-22 15:55:55 +0530425 unsigned int min_level;
426 unsigned int max_level;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530427 unsigned int is_pin_controlled;
Pankaj Kumar27c02642011-09-22 15:55:55 +0530428 struct regulator *reg;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530429};
430static struct bt_vreg_info bt_vregs[] = {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530431 {"msme1", 2, 1800000, 1800000, 0, NULL},
432 {"bt", 21, 2900000, 3050000, 1, NULL}
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530433};
434
435static int bahama_bt(int on)
436{
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530437 int rc = 0;
438 int i;
439
440 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
441
442 struct bahama_variant_register {
443 const size_t size;
444 const struct bahama_config_register *set;
445 };
446
447 const struct bahama_config_register *p;
448
449 u8 version;
450
451 const struct bahama_config_register v10_bt_on[] = {
452 { 0xE9, 0x00, 0xFF },
453 { 0xF4, 0x80, 0xFF },
454 { 0xE4, 0x00, 0xFF },
455 { 0xE5, 0x00, 0x0F },
456#ifdef CONFIG_WLAN
457 { 0xE6, 0x38, 0x7F },
458 { 0xE7, 0x06, 0xFF },
459#endif
460 { 0xE9, 0x21, 0xFF },
461 { 0x01, 0x0C, 0x1F },
462 { 0x01, 0x08, 0x1F },
463 };
464
465 const struct bahama_config_register v20_bt_on_fm_off[] = {
466 { 0x11, 0x0C, 0xFF },
467 { 0x13, 0x01, 0xFF },
468 { 0xF4, 0x80, 0xFF },
469 { 0xF0, 0x00, 0xFF },
470 { 0xE9, 0x00, 0xFF },
471#ifdef CONFIG_WLAN
472 { 0x81, 0x00, 0x7F },
473 { 0x82, 0x00, 0xFF },
474 { 0xE6, 0x38, 0x7F },
475 { 0xE7, 0x06, 0xFF },
476#endif
477 { 0x8E, 0x15, 0xFF },
478 { 0x8F, 0x15, 0xFF },
479 { 0x90, 0x15, 0xFF },
480
481 { 0xE9, 0x21, 0xFF },
482 };
483
484 const struct bahama_config_register v20_bt_on_fm_on[] = {
485 { 0x11, 0x0C, 0xFF },
486 { 0x13, 0x01, 0xFF },
487 { 0xF4, 0x86, 0xFF },
488 { 0xF0, 0x06, 0xFF },
489 { 0xE9, 0x00, 0xFF },
490#ifdef CONFIG_WLAN
491 { 0x81, 0x00, 0x7F },
492 { 0x82, 0x00, 0xFF },
493 { 0xE6, 0x38, 0x7F },
494 { 0xE7, 0x06, 0xFF },
495#endif
496 { 0xE9, 0x21, 0xFF },
497 };
498
499 const struct bahama_config_register v10_bt_off[] = {
500 { 0xE9, 0x00, 0xFF },
501 };
502
503 const struct bahama_config_register v20_bt_off_fm_off[] = {
504 { 0xF4, 0x84, 0xFF },
505 { 0xF0, 0x04, 0xFF },
506 { 0xE9, 0x00, 0xFF }
507 };
508
509 const struct bahama_config_register v20_bt_off_fm_on[] = {
510 { 0xF4, 0x86, 0xFF },
511 { 0xF0, 0x06, 0xFF },
512 { 0xE9, 0x00, 0xFF }
513 };
514 const struct bahama_variant_register bt_bahama[2][3] = {
515 {
516 { ARRAY_SIZE(v10_bt_off), v10_bt_off },
517 { ARRAY_SIZE(v20_bt_off_fm_off), v20_bt_off_fm_off },
518 { ARRAY_SIZE(v20_bt_off_fm_on), v20_bt_off_fm_on }
519 },
520 {
521 { ARRAY_SIZE(v10_bt_on), v10_bt_on },
522 { ARRAY_SIZE(v20_bt_on_fm_off), v20_bt_on_fm_off },
523 { ARRAY_SIZE(v20_bt_on_fm_on), v20_bt_on_fm_on }
524 }
525 };
526
527 u8 offset = 0; /* index into bahama configs */
528 on = on ? 1 : 0;
529 version = marimba_read_bahama_ver(&config);
530 if ((int)version < 0 || version == BAHAMA_VER_UNSUPPORTED) {
531 dev_err(&msm_bt_power_device.dev, "%s: Bahama \
532 version read Error, version = %d \n",
533 __func__, version);
534 return -EIO;
535 }
536
537 if (version == BAHAMA_VER_2_0) {
538 if (marimba_get_fm_status(&config))
539 offset = 0x01;
540 }
541
542 p = bt_bahama[on][version + offset].set;
543
544 dev_info(&msm_bt_power_device.dev,
545 "%s: found version %d\n", __func__, version);
546
547 for (i = 0; i < bt_bahama[on][version + offset].size; i++) {
548 u8 value = (p+i)->value;
549 rc = marimba_write_bit_mask(&config,
550 (p+i)->reg,
551 &value,
552 sizeof((p+i)->value),
553 (p+i)->mask);
554 if (rc < 0) {
555 dev_err(&msm_bt_power_device.dev,
556 "%s: reg %x write failed: %d\n",
557 __func__, (p+i)->reg, rc);
558 return rc;
559 }
560 dev_dbg(&msm_bt_power_device.dev,
561 "%s: reg 0x%02x write value 0x%02x mask 0x%02x\n",
562 __func__, (p+i)->reg,
563 value, (p+i)->mask);
564 value = 0;
565 rc = marimba_read_bit_mask(&config,
566 (p+i)->reg, &value,
567 sizeof((p+i)->value), (p+i)->mask);
568 if (rc < 0)
569 dev_err(&msm_bt_power_device.dev, "%s marimba_read_bit_mask- error",
570 __func__);
571 dev_dbg(&msm_bt_power_device.dev,
572 "%s: reg 0x%02x read value 0x%02x mask 0x%02x\n",
573 __func__, (p+i)->reg,
574 value, (p+i)->mask);
575 }
576 /* Update BT Status */
577 if (on)
578 marimba_set_bt_status(&config, true);
579 else
580 marimba_set_bt_status(&config, false);
581 return rc;
582}
583static int bluetooth_switch_regulators(int on)
584{
585 int i, rc = 0;
586 const char *id = "BTPW";
587
588 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530589 if (IS_ERR_OR_NULL(bt_vregs[i].reg)) {
590 rc = bt_vregs[i].reg ?
591 PTR_ERR(bt_vregs[i].reg) :
592 -ENODEV;
593 dev_err(&msm_bt_power_device.dev,
594 "%s: invalid regulator handle for %s: %d\n",
595 __func__, bt_vregs[i].name, rc);
596 goto reg_disable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530597 }
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530598
Pankaj Kumar27c02642011-09-22 15:55:55 +0530599 rc = on ? regulator_set_voltage(bt_vregs[i].reg,
600 bt_vregs[i].min_level,
601 bt_vregs[i].max_level) : 0;
602 if (rc) {
603 dev_err(&msm_bt_power_device.dev,
604 "%s: could not set voltage for %s: %d\n",
605 __func__, bt_vregs[i].name, rc);
606 goto reg_disable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530607 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530608
609 rc = on ? regulator_enable(bt_vregs[i].reg) : 0;
610 if (rc) {
611 dev_err(&msm_bt_power_device.dev,
612 "%s: could not %sable regulator %s: %d\n",
613 __func__, "en", bt_vregs[i].name, rc);
614 goto reg_disable;
615 }
616
617 if (bt_vregs[i].is_pin_controlled) {
618 rc = pmapp_vreg_lpm_pincntrl_vote(id,
619 bt_vregs[i].pmapp_id,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530620 PMAPP_CLOCK_ID_D1,
621 on ? PMAPP_CLOCK_VOTE_ON :
Pankaj Kumar27c02642011-09-22 15:55:55 +0530622 PMAPP_CLOCK_VOTE_OFF);
623 if (rc) {
624 dev_err(&msm_bt_power_device.dev,
625 "%s: pin control failed for %s: %d\n",
626 __func__, bt_vregs[i].name, rc);
627 goto pin_cnt_fail;
628 }
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530629 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530630 rc = on ? 0 : regulator_disable(bt_vregs[i].reg);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530631
Pankaj Kumar27c02642011-09-22 15:55:55 +0530632 if (rc) {
633 dev_err(&msm_bt_power_device.dev,
634 "%s: could not %sable regulator %s: %d\n",
635 __func__, "dis", bt_vregs[i].name, rc);
636 goto reg_disable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530637 }
638 }
639
640 return rc;
Pankaj Kumar27c02642011-09-22 15:55:55 +0530641pin_cnt_fail:
642 if (on)
643 regulator_disable(bt_vregs[i].reg);
644reg_disable:
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530645 while (i) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530646 if (on) {
647 i--;
648 regulator_disable(bt_vregs[i].reg);
649 regulator_put(bt_vregs[i].reg);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530650 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530651 }
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530652 return rc;
653}
654
Pankaj Kumar27c02642011-09-22 15:55:55 +0530655static struct regulator *reg_s3;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530656static unsigned int msm_bahama_setup_power(void)
657{
658 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530659
Pankaj Kumar27c02642011-09-22 15:55:55 +0530660 reg_s3 = regulator_get(NULL, "msme1");
661 if (IS_ERR(reg_s3)) {
662 rc = PTR_ERR(reg_s3);
663 pr_err("%s: could not get regulator: %d\n", __func__, rc);
664 goto out;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530665 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530666
667 rc = regulator_set_voltage(reg_s3, 1800000, 1800000);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530668 if (rc < 0) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530669 pr_err("%s: could not set voltage: %d\n", __func__, rc);
670 goto reg_fail;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530671 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530672
673 rc = regulator_enable(reg_s3);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530674 if (rc < 0) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530675 pr_err("%s: could not enable regulator: %d\n", __func__, rc);
676 goto reg_fail;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530677 }
678
679 /*setup Bahama_sys_reset_n*/
680 rc = gpio_request(GPIO_BT_SYS_REST_EN, "bahama sys_rst_n");
681 if (rc < 0) {
682 pr_err("%s: gpio_request %d = %d\n", __func__,
683 GPIO_BT_SYS_REST_EN, rc);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530684 goto reg_disable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530685 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530686
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530687 rc = bt_set_gpio(1);
688 if (rc < 0) {
689 pr_err("%s: bt_set_gpio %d = %d\n", __func__,
690 GPIO_BT_SYS_REST_EN, rc);
691 goto gpio_fail;
692 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530693
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530694 return rc;
695
696gpio_fail:
697 gpio_free(GPIO_BT_SYS_REST_EN);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530698reg_disable:
699 regulator_disable(reg_s3);
700reg_fail:
701 regulator_put(reg_s3);
702out:
703 reg_s3 = NULL;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530704 return rc;
705}
706
707static unsigned int msm_bahama_shutdown_power(int value)
708{
709 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530710
Pankaj Kumar27c02642011-09-22 15:55:55 +0530711 if (IS_ERR_OR_NULL(reg_s3)) {
712 rc = reg_s3 ? PTR_ERR(reg_s3) : -ENODEV;
713 goto out;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530714 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530715
716 rc = regulator_disable(reg_s3);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530717 if (rc) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530718 pr_err("%s: could not disable regulator: %d\n", __func__, rc);
719 goto out;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530720 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530721
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530722 if (value == BAHAMA_ID) {
723 rc = bt_set_gpio(0);
724 if (rc) {
725 pr_err("%s: bt_set_gpio = %d\n",
726 __func__, rc);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530727 goto reg_enable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530728 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530729 gpio_free(GPIO_BT_SYS_REST_EN);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530730 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530731
732 regulator_put(reg_s3);
733 reg_s3 = NULL;
734
735 return 0;
736
737reg_enable:
738 regulator_enable(reg_s3);
739out:
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530740 return rc;
741}
742
743static unsigned int msm_bahama_core_config(int type)
744{
745 int rc = 0;
746
747 if (type == BAHAMA_ID) {
748 int i;
749 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
750 const struct bahama_config_register v20_init[] = {
751 /* reg, value, mask */
752 { 0xF4, 0x84, 0xFF }, /* AREG */
753 { 0xF0, 0x04, 0xFF } /* DREG */
754 };
755 if (marimba_read_bahama_ver(&config) == BAHAMA_VER_2_0) {
756 for (i = 0; i < ARRAY_SIZE(v20_init); i++) {
757 u8 value = v20_init[i].value;
758 rc = marimba_write_bit_mask(&config,
759 v20_init[i].reg,
760 &value,
761 sizeof(v20_init[i].value),
762 v20_init[i].mask);
763 if (rc < 0) {
764 pr_err("%s: reg %d write failed: %d\n",
765 __func__, v20_init[i].reg, rc);
766 return rc;
767 }
768 pr_debug("%s: reg 0x%02x value 0x%02x"
769 " mask 0x%02x\n",
770 __func__, v20_init[i].reg,
771 v20_init[i].value, v20_init[i].mask);
772 }
773 }
774 }
775 rc = bt_set_gpio(0);
776 if (rc) {
777 pr_err("%s: bt_set_gpio = %d\n",
778 __func__, rc);
779 }
780 pr_debug("core type: %d\n", type);
781 return rc;
782}
783
784static int bluetooth_power(int on)
785{
786 int pin, rc = 0;
787 const char *id = "BTPW";
788 int cid = 0;
789
790 cid = adie_get_detected_connectivity_type();
791 if (cid != BAHAMA_ID) {
792 pr_err("%s: unexpected adie connectivity type: %d\n",
793 __func__, cid);
794 return -ENODEV;
795 }
796 if (on) {
797 /*setup power for BT SOC*/
798 rc = bt_set_gpio(on);
799 if (rc) {
800 pr_err("%s: bt_set_gpio = %d\n",
801 __func__, rc);
802 goto exit;
803 }
804 rc = bluetooth_switch_regulators(on);
805 if (rc < 0) {
806 pr_err("%s: bluetooth_switch_regulators rc = %d",
807 __func__, rc);
808 goto exit;
809 }
810 /*setup BT GPIO lines*/
811 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_on);
812 pin++) {
813 rc = gpio_tlmm_config(bt_config_power_on[pin],
814 GPIO_CFG_ENABLE);
815 if (rc < 0) {
816 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
817 __func__,
818 bt_config_power_on[pin],
819 rc);
820 goto fail_power;
821 }
822 }
823 /*Setup BT clocks*/
824 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
825 PMAPP_CLOCK_VOTE_ON);
826 if (rc < 0) {
827 pr_err("Failed to vote for TCXO_D1 ON\n");
828 goto fail_clock;
829 }
830 msleep(20);
831
832 /*I2C config for Bahama*/
833 rc = bahama_bt(1);
834 if (rc < 0) {
835 pr_err("%s: bahama_bt rc = %d", __func__, rc);
836 goto fail_i2c;
837 }
838 msleep(20);
839
840 /*setup BT PCM lines*/
841 rc = msm_bahama_setup_pcm_i2s(BT_PCM_ON);
842 if (rc < 0) {
843 pr_err("%s: msm_bahama_setup_pcm_i2s , rc =%d\n",
844 __func__, rc);
845 goto fail_power;
846 }
847 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
848 PMAPP_CLOCK_VOTE_PIN_CTRL);
849 if (rc < 0)
850 pr_err("%s:Pin Control Failed, rc = %d",
851 __func__, rc);
852
853 } else {
854 rc = bahama_bt(0);
855 if (rc < 0)
856 pr_err("%s: bahama_bt rc = %d", __func__, rc);
857
858 rc = bt_set_gpio(on);
859 if (rc) {
860 pr_err("%s: bt_set_gpio = %d\n",
861 __func__, rc);
862 }
863fail_i2c:
864 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
865 PMAPP_CLOCK_VOTE_OFF);
866 if (rc < 0)
867 pr_err("%s: Failed to vote Off D1\n", __func__);
868fail_clock:
869 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_off);
870 pin++) {
871 rc = gpio_tlmm_config(bt_config_power_off[pin],
872 GPIO_CFG_ENABLE);
873 if (rc < 0) {
874 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
875 __func__, bt_config_power_off[pin], rc);
876 }
877 }
878 rc = msm_bahama_setup_pcm_i2s(BT_PCM_OFF);
879 if (rc < 0) {
880 pr_err("%s: msm_bahama_setup_pcm_i2s, rc =%d\n",
881 __func__, rc);
882 }
883fail_power:
884 rc = bluetooth_switch_regulators(0);
885 if (rc < 0) {
886 pr_err("%s: switch_regulators : rc = %d",\
887 __func__, rc);
888 goto exit;
889 }
890 }
891 return rc;
892exit:
893 pr_err("%s: failed with rc = %d", __func__, rc);
894 return rc;
895}
896
897static int __init bt_power_init(void)
898{
899 int i, rc = 0;
Pankaj Kumar27c02642011-09-22 15:55:55 +0530900 struct device *dev = &msm_bt_power_device.dev;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530901
Pankaj Kumar27c02642011-09-22 15:55:55 +0530902 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
903 bt_vregs[i].reg = regulator_get(dev, bt_vregs[i].name);
904 if (IS_ERR(bt_vregs[i].reg)) {
905 rc = PTR_ERR(bt_vregs[i].reg);
906 dev_err(dev, "%s: could not get regulator %s: %d\n",
907 __func__, bt_vregs[i].name, rc);
908 goto reg_get_fail;
909 }
910 }
911
912 dev->platform_data = &bluetooth_power;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530913
914 return rc;
915
Pankaj Kumar27c02642011-09-22 15:55:55 +0530916reg_get_fail:
917 while (i--) {
918 regulator_put(bt_vregs[i].reg);
919 bt_vregs[i].reg = NULL;
920 }
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530921 return rc;
922}
923
924static struct marimba_platform_data marimba_pdata = {
925 .slave_id[SLAVE_ID_BAHAMA_FM] = BAHAMA_SLAVE_ID_FM_ADDR,
926 .slave_id[SLAVE_ID_BAHAMA_QMEMBIST] = BAHAMA_SLAVE_ID_QMEMBIST_ADDR,
927 .bahama_setup = msm_bahama_setup_power,
928 .bahama_shutdown = msm_bahama_shutdown_power,
929 .bahama_core_config = msm_bahama_core_config,
930 .fm = &marimba_fm_pdata,
931};
932
933#endif
934
935#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
936static struct i2c_board_info bahama_devices[] = {
937{
938 I2C_BOARD_INFO("marimba", 0xc),
939 .platform_data = &marimba_pdata,
940},
941};
942#endif
943
944static struct msm_gpio qup_i2c_gpios_io[] = {
945 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
946 "qup_scl" },
947 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
948 "qup_sda" },
949 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
950 "qup_scl" },
951 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
952 "qup_sda" },
953};
954
955static struct msm_gpio qup_i2c_gpios_hw[] = {
956 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
957 "qup_scl" },
958 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
959 "qup_sda" },
960 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
961 "qup_scl" },
962 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
963 "qup_sda" },
964};
965
966static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
967{
968 int rc;
969
970 if (adap_id < 0 || adap_id > 1)
971 return;
972
973 /* Each adapter gets 2 lines from the table */
974 if (config_type)
975 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
976 else
977 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
978 if (rc < 0)
979 pr_err("QUP GPIO request/enable failed: %d\n", rc);
980}
981
982static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
983 .clk_freq = 100000,
984 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
985};
986
987static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
988 .clk_freq = 100000,
989 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
990};
991
992#ifdef CONFIG_ARCH_MSM7X27A
993#define MSM_PMEM_MDP_SIZE 0x1DD1000
994#define MSM_PMEM_ADSP_SIZE 0x1000000
995
996#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
997#define MSM_FB_SIZE 0x260000
998#else
999#define MSM_FB_SIZE 0x195000
1000#endif
1001
1002#endif
1003
Taniya Dasda408822011-09-06 12:54:06 +05301004#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \
1005defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE)
1006
1007#ifndef CLEARPAD3000_ATTEN_GPIO
1008#define CLEARPAD3000_ATTEN_GPIO (48)
1009#endif
1010
1011#ifndef CLEARPAD3000_RESET_GPIO
1012#define CLEARPAD3000_RESET_GPIO (26)
1013#endif
1014
1015static int synaptics_touchpad_setup(void);
1016
1017static struct msm_gpio clearpad3000_cfg_data[] = {
1018 {GPIO_CFG(CLEARPAD3000_ATTEN_GPIO, 0, GPIO_CFG_INPUT,
1019 GPIO_CFG_NO_PULL, GPIO_CFG_6MA), "rmi4_attn"},
1020 {GPIO_CFG(CLEARPAD3000_RESET_GPIO, 0, GPIO_CFG_OUTPUT,
1021 GPIO_CFG_PULL_DOWN, GPIO_CFG_8MA), "rmi4_reset"},
1022};
1023
1024static struct rmi_XY_pair rmi_offset = {.x = 0, .y = 0};
1025static struct rmi_range rmi_clipx = {.min = 48, .max = 980};
1026static struct rmi_range rmi_clipy = {.min = 7, .max = 1647};
1027static struct rmi_f11_functiondata synaptics_f11_data = {
1028 .swap_axes = false,
1029 .flipX = false,
1030 .flipY = false,
1031 .offset = &rmi_offset,
1032 .button_height = 113,
1033 .clipX = &rmi_clipx,
1034 .clipY = &rmi_clipy,
1035};
1036
1037#define MAX_LEN 100
1038
1039static ssize_t clearpad3000_virtual_keys_register(struct kobject *kobj,
1040 struct kobj_attribute *attr, char *buf)
1041{
1042 char *virtual_keys = __stringify(EV_KEY) ":" __stringify(KEY_MENU) \
1043 ":60:830:120:60" ":" __stringify(EV_KEY) \
1044 ":" __stringify(KEY_HOME) ":180:830:120:60" \
1045 ":" __stringify(EV_KEY) ":" \
1046 __stringify(KEY_SEARCH) ":300:830:120:60" \
1047 ":" __stringify(EV_KEY) ":" \
1048 __stringify(KEY_BACK) ":420:830:120:60" "\n";
1049
1050 return snprintf(buf, strnlen(virtual_keys, MAX_LEN) + 1 , "%s",
1051 virtual_keys);
1052}
1053
1054static struct kobj_attribute clearpad3000_virtual_keys_attr = {
1055 .attr = {
1056 .name = "virtualkeys.sensor00fn11",
1057 .mode = S_IRUGO,
1058 },
1059 .show = &clearpad3000_virtual_keys_register,
1060};
1061
1062static struct attribute *virtual_key_properties_attrs[] = {
1063 &clearpad3000_virtual_keys_attr.attr,
1064 NULL
1065};
1066
1067static struct attribute_group virtual_key_properties_attr_group = {
1068 .attrs = virtual_key_properties_attrs,
1069};
1070
1071struct kobject *virtual_key_properties_kobj;
1072
1073static struct rmi_functiondata synaptics_functiondata[] = {
1074 {
1075 .function_index = RMI_F11_INDEX,
1076 .data = &synaptics_f11_data,
1077 },
1078};
1079
1080static struct rmi_functiondata_list synaptics_perfunctiondata = {
1081 .count = ARRAY_SIZE(synaptics_functiondata),
1082 .functiondata = synaptics_functiondata,
1083};
1084
1085static struct rmi_sensordata synaptics_sensordata = {
1086 .perfunctiondata = &synaptics_perfunctiondata,
1087 .rmi_sensor_setup = synaptics_touchpad_setup,
1088};
1089
1090static struct rmi_i2c_platformdata synaptics_platformdata = {
1091 .i2c_address = 0x2c,
1092 .irq_type = IORESOURCE_IRQ_LOWLEVEL,
1093 .sensordata = &synaptics_sensordata,
1094};
1095
1096static struct i2c_board_info synaptic_i2c_clearpad3k[] = {
1097 {
1098 I2C_BOARD_INFO("rmi4_ts", 0x2c),
1099 .platform_data = &synaptics_platformdata,
1100 },
1101};
1102
1103static int synaptics_touchpad_setup(void)
1104{
1105 int retval = 0;
1106
1107 virtual_key_properties_kobj =
1108 kobject_create_and_add("board_properties", NULL);
1109 if (virtual_key_properties_kobj)
1110 retval = sysfs_create_group(virtual_key_properties_kobj,
1111 &virtual_key_properties_attr_group);
1112 if (!virtual_key_properties_kobj || retval)
1113 pr_err("failed to create ft5202 board_properties\n");
1114
1115 retval = msm_gpios_request_enable(clearpad3000_cfg_data,
1116 sizeof(clearpad3000_cfg_data)/sizeof(struct msm_gpio));
1117 if (retval) {
1118 pr_err("%s:Failed to obtain touchpad GPIO %d. Code: %d.",
1119 __func__, CLEARPAD3000_ATTEN_GPIO, retval);
1120 retval = 0; /* ignore the err */
1121 }
1122 synaptics_platformdata.irq = gpio_to_irq(CLEARPAD3000_ATTEN_GPIO);
1123
1124 gpio_set_value(CLEARPAD3000_RESET_GPIO, 0);
1125 usleep(10000);
1126 gpio_set_value(CLEARPAD3000_RESET_GPIO, 1);
1127 usleep(50000);
1128
1129 return retval;
1130}
1131#endif
1132
1133
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301134static struct android_usb_platform_data android_usb_pdata = {
Pankaj Kumar6f841742011-10-10 15:52:14 +05301135 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301136};
1137
1138static struct platform_device android_usb_device = {
1139 .name = "android_usb",
1140 .id = -1,
1141 .dev = {
1142 .platform_data = &android_usb_pdata,
1143 },
1144};
1145
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301146#ifdef CONFIG_USB_EHCI_MSM_72K
1147static void msm_hsusb_vbus_power(unsigned phy_info, int on)
1148{
1149 int rc = 0;
1150 unsigned gpio;
1151
1152 gpio = GPIO_HOST_VBUS_EN;
1153
1154 rc = gpio_request(gpio, "i2c_host_vbus_en");
1155 if (rc < 0) {
1156 pr_err("failed to request %d GPIO\n", gpio);
1157 return;
1158 }
1159 gpio_direction_output(gpio, !!on);
1160 gpio_set_value_cansleep(gpio, !!on);
1161 gpio_free(gpio);
1162}
1163
1164static struct msm_usb_host_platform_data msm_usb_host_pdata = {
1165 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
1166};
1167
1168static void __init msm7627a_init_host(void)
1169{
1170 msm_add_host(0, &msm_usb_host_pdata);
1171}
1172#endif
1173
1174#ifdef CONFIG_USB_MSM_OTG_72K
1175static int hsusb_rpc_connect(int connect)
1176{
1177 if (connect)
1178 return msm_hsusb_rpc_connect();
1179 else
1180 return msm_hsusb_rpc_close();
1181}
1182
Pankaj Kumar27c02642011-09-22 15:55:55 +05301183static struct regulator *reg_hsusb;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301184static int msm_hsusb_ldo_init(int init)
1185{
Pankaj Kumar27c02642011-09-22 15:55:55 +05301186 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301187
Pankaj Kumar27c02642011-09-22 15:55:55 +05301188 if (init) {
1189 reg_hsusb = regulator_get(NULL, "usb");
1190 if (IS_ERR(reg_hsusb)) {
1191 rc = PTR_ERR(reg_hsusb);
1192 pr_err("%s: could not get regulator: %d\n",
1193 __func__, rc);
1194 goto out;
1195 }
1196
1197 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
1198 if (rc) {
1199 pr_err("%s: could not set voltage: %d\n",
1200 __func__, rc);
1201 goto reg_free;
1202 }
1203
1204 return 0;
1205 }
1206 /* else fall through */
1207reg_free:
1208 regulator_put(reg_hsusb);
1209out:
1210 reg_hsusb = NULL;
1211 return rc;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301212}
1213
1214static int msm_hsusb_ldo_enable(int enable)
1215{
1216 static int ldo_status;
1217
Pankaj Kumar27c02642011-09-22 15:55:55 +05301218 if (IS_ERR_OR_NULL(reg_hsusb))
1219 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301220
1221 if (ldo_status == enable)
1222 return 0;
1223
1224 ldo_status = enable;
1225
Pankaj Kumar27c02642011-09-22 15:55:55 +05301226 return enable ?
1227 regulator_enable(reg_hsusb) :
1228 regulator_disable(reg_hsusb);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301229}
1230
1231#ifndef CONFIG_USB_EHCI_MSM_72K
1232static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
1233{
1234 int ret = 0;
1235
1236 if (init)
1237 ret = msm_pm_app_rpc_init(callback);
1238 else
1239 msm_pm_app_rpc_deinit(callback);
1240
1241 return ret;
1242}
1243#endif
1244
1245static struct msm_otg_platform_data msm_otg_pdata = {
1246#ifndef CONFIG_USB_EHCI_MSM_72K
1247 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
1248#else
1249 .vbus_power = msm_hsusb_vbus_power,
1250#endif
1251 .rpc_connect = hsusb_rpc_connect,
1252 .core_clk = 1,
1253 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
1254 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
1255 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
1256 .se1_gating = SE1_GATING_DISABLE,
1257 .ldo_init = msm_hsusb_ldo_init,
1258 .ldo_enable = msm_hsusb_ldo_enable,
1259 .chg_init = hsusb_chg_init,
1260 .chg_connected = hsusb_chg_connected,
1261 .chg_vbus_draw = hsusb_chg_vbus_draw,
1262};
1263#endif
1264
1265static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
1266 .is_phy_status_timer_on = 1,
1267};
1268
1269#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
1270 || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\
1271 || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\
1272 || defined(CONFIG_MMC_MSM_SDC4_SUPPORT))
1273
1274static unsigned long vreg_sts, gpio_sts;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301275
1276struct sdcc_gpio {
1277 struct msm_gpio *cfg_data;
1278 uint32_t size;
1279 struct msm_gpio *sleep_cfg_data;
1280};
1281
1282/**
1283 * Due to insufficient drive strengths for SDC GPIO lines some old versioned
1284 * SD/MMC cards may cause data CRC errors. Hence, set optimal values
1285 * for SDC slots based on timing closure and marginality. SDC1 slot
1286 * require higher value since it should handle bad signal quality due
1287 * to size of T-flash adapters.
1288 */
1289static struct msm_gpio sdc1_cfg_data[] = {
1290 {GPIO_CFG(51, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1291 "sdc1_dat_3"},
1292 {GPIO_CFG(52, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1293 "sdc1_dat_2"},
1294 {GPIO_CFG(53, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1295 "sdc1_dat_1"},
1296 {GPIO_CFG(54, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1297 "sdc1_dat_0"},
1298 {GPIO_CFG(55, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1299 "sdc1_cmd"},
1300 {GPIO_CFG(56, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_14MA),
1301 "sdc1_clk"},
1302};
1303
1304static struct msm_gpio sdc2_cfg_data[] = {
1305 {GPIO_CFG(62, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1306 "sdc2_clk"},
1307 {GPIO_CFG(63, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1308 "sdc2_cmd"},
1309 {GPIO_CFG(64, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1310 "sdc2_dat_3"},
1311 {GPIO_CFG(65, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1312 "sdc2_dat_2"},
1313 {GPIO_CFG(66, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1314 "sdc2_dat_1"},
1315 {GPIO_CFG(67, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1316 "sdc2_dat_0"},
1317};
1318
1319static struct msm_gpio sdc2_sleep_cfg_data[] = {
1320 {GPIO_CFG(62, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1321 "sdc2_clk"},
1322 {GPIO_CFG(63, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1323 "sdc2_cmd"},
1324 {GPIO_CFG(64, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1325 "sdc2_dat_3"},
1326 {GPIO_CFG(65, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1327 "sdc2_dat_2"},
1328 {GPIO_CFG(66, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1329 "sdc2_dat_1"},
1330 {GPIO_CFG(67, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1331 "sdc2_dat_0"},
1332};
1333static struct msm_gpio sdc3_cfg_data[] = {
1334 {GPIO_CFG(88, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1335 "sdc3_clk"},
1336 {GPIO_CFG(89, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1337 "sdc3_cmd"},
1338 {GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1339 "sdc3_dat_3"},
1340 {GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1341 "sdc3_dat_2"},
1342 {GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1343 "sdc3_dat_1"},
1344 {GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1345 "sdc3_dat_0"},
1346#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
1347 {GPIO_CFG(19, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1348 "sdc3_dat_7"},
1349 {GPIO_CFG(20, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1350 "sdc3_dat_6"},
1351 {GPIO_CFG(21, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1352 "sdc3_dat_5"},
1353 {GPIO_CFG(108, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1354 "sdc3_dat_4"},
1355#endif
1356};
1357
1358static struct msm_gpio sdc4_cfg_data[] = {
1359 {GPIO_CFG(19, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1360 "sdc4_dat_3"},
1361 {GPIO_CFG(20, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1362 "sdc4_dat_2"},
1363 {GPIO_CFG(21, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1364 "sdc4_dat_1"},
1365 {GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1366 "sdc4_cmd"},
1367 {GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1368 "sdc4_dat_0"},
1369 {GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1370 "sdc4_clk"},
1371};
1372
1373static struct sdcc_gpio sdcc_cfg_data[] = {
1374 {
1375 .cfg_data = sdc1_cfg_data,
1376 .size = ARRAY_SIZE(sdc1_cfg_data),
1377 },
1378 {
1379 .cfg_data = sdc2_cfg_data,
1380 .size = ARRAY_SIZE(sdc2_cfg_data),
1381 .sleep_cfg_data = sdc2_sleep_cfg_data,
1382 },
1383 {
1384 .cfg_data = sdc3_cfg_data,
1385 .size = ARRAY_SIZE(sdc3_cfg_data),
1386 },
1387 {
1388 .cfg_data = sdc4_cfg_data,
1389 .size = ARRAY_SIZE(sdc4_cfg_data),
1390 },
1391};
1392
Pankaj Kumar27c02642011-09-22 15:55:55 +05301393static struct regulator *sdcc_vreg_data[ARRAY_SIZE(sdcc_cfg_data)];
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301394static int msm_sdcc_setup_gpio(int dev_id, unsigned int enable)
1395{
1396 int rc = 0;
1397 struct sdcc_gpio *curr;
1398
1399 curr = &sdcc_cfg_data[dev_id - 1];
1400 if (!(test_bit(dev_id, &gpio_sts)^enable))
1401 return rc;
1402
1403 if (enable) {
1404 set_bit(dev_id, &gpio_sts);
1405 rc = msm_gpios_request_enable(curr->cfg_data, curr->size);
1406 if (rc)
1407 pr_err("%s: Failed to turn on GPIOs for slot %d\n",
1408 __func__, dev_id);
1409 } else {
1410 clear_bit(dev_id, &gpio_sts);
1411 if (curr->sleep_cfg_data) {
1412 rc = msm_gpios_enable(curr->sleep_cfg_data, curr->size);
1413 msm_gpios_free(curr->sleep_cfg_data, curr->size);
1414 return rc;
1415 }
1416 msm_gpios_disable_free(curr->cfg_data, curr->size);
1417 }
1418 return rc;
1419}
1420
1421static int msm_sdcc_setup_vreg(int dev_id, unsigned int enable)
1422{
1423 int rc = 0;
Pankaj Kumar27c02642011-09-22 15:55:55 +05301424 struct regulator *curr = sdcc_vreg_data[dev_id - 1];
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301425
Pankaj Kumar27c02642011-09-22 15:55:55 +05301426 if (test_bit(dev_id, &vreg_sts) == enable)
1427 return 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301428
Pankaj Kumar27c02642011-09-22 15:55:55 +05301429 if (!curr)
1430 return -ENODEV;
1431
1432 if (IS_ERR(curr))
1433 return PTR_ERR(curr);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301434
1435 if (enable) {
1436 set_bit(dev_id, &vreg_sts);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301437
Pankaj Kumar27c02642011-09-22 15:55:55 +05301438 rc = regulator_enable(curr);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301439 if (rc)
Pankaj Kumar27c02642011-09-22 15:55:55 +05301440 pr_err("%s: could not enable regulator: %d\n",
1441 __func__, rc);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301442 } else {
1443 clear_bit(dev_id, &vreg_sts);
Pankaj Kumar27c02642011-09-22 15:55:55 +05301444
1445 rc = regulator_disable(curr);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301446 if (rc)
Pankaj Kumar27c02642011-09-22 15:55:55 +05301447 pr_err("%s: could not disable regulator: %d\n",
1448 __func__, rc);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301449 }
1450 return rc;
1451}
1452
1453static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
1454{
1455 int rc = 0;
1456 struct platform_device *pdev;
1457
1458 pdev = container_of(dv, struct platform_device, dev);
1459
1460 rc = msm_sdcc_setup_gpio(pdev->id, !!vdd);
1461 if (rc)
1462 goto out;
1463
1464 rc = msm_sdcc_setup_vreg(pdev->id, !!vdd);
1465out:
1466 return rc;
1467}
1468
Sujit Reddy Thumma535c9e32011-10-28 09:45:33 +05301469#define GPIO_SDC1_HW_DET 42
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301470
1471#if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) \
1472 && defined(CONFIG_MMC_MSM_CARD_HW_DETECTION)
1473static unsigned int msm7627a_sdcc_slot_status(struct device *dev)
1474{
1475 int status;
1476
1477 status = gpio_tlmm_config(GPIO_CFG(GPIO_SDC1_HW_DET, 2, GPIO_CFG_INPUT,
1478 GPIO_CFG_PULL_UP, GPIO_CFG_8MA), GPIO_CFG_ENABLE);
1479 if (status)
1480 pr_err("%s:Failed to configure tlmm for GPIO %d\n", __func__,
1481 GPIO_SDC1_HW_DET);
1482
1483 status = gpio_request(GPIO_SDC1_HW_DET, "SD_HW_Detect");
1484 if (status) {
1485 pr_err("%s:Failed to request GPIO %d\n", __func__,
1486 GPIO_SDC1_HW_DET);
1487 } else {
1488 status = gpio_direction_input(GPIO_SDC1_HW_DET);
1489 if (!status)
Sujit Reddy Thumma535c9e32011-10-28 09:45:33 +05301490 status = !gpio_get_value(GPIO_SDC1_HW_DET);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301491 gpio_free(GPIO_SDC1_HW_DET);
1492 }
1493 return status;
1494}
1495#endif
1496
1497#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1498static struct mmc_platform_data sdc1_plat_data = {
1499 .ocr_mask = MMC_VDD_28_29,
1500 .translate_vdd = msm_sdcc_setup_power,
1501 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1502 .msmsdcc_fmin = 144000,
1503 .msmsdcc_fmid = 24576000,
1504 .msmsdcc_fmax = 49152000,
1505#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
1506 .status = msm7627a_sdcc_slot_status,
1507 .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET),
1508 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
1509#endif
1510};
1511#endif
1512
1513#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1514static struct mmc_platform_data sdc2_plat_data = {
1515 /*
1516 * SDC2 supports only 1.8V, claim for 2.85V range is just
1517 * for allowing buggy cards who advertise 2.8V even though
1518 * they can operate at 1.8V supply.
1519 */
1520 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_165_195,
1521 .translate_vdd = msm_sdcc_setup_power,
1522 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1523#ifdef CONFIG_MMC_MSM_SDIO_SUPPORT
1524 .sdiowakeup_irq = MSM_GPIO_TO_INT(66),
1525#endif
1526 .msmsdcc_fmin = 144000,
1527 .msmsdcc_fmid = 24576000,
1528 .msmsdcc_fmax = 49152000,
1529#ifdef CONFIG_MMC_MSM_SDC2_DUMMY52_REQUIRED
1530 .dummy52_required = 1,
1531#endif
1532};
1533#endif
1534
1535#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1536static struct mmc_platform_data sdc3_plat_data = {
1537 .ocr_mask = MMC_VDD_28_29,
1538 .translate_vdd = msm_sdcc_setup_power,
1539#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
1540 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
1541#else
1542 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1543#endif
1544 .msmsdcc_fmin = 144000,
1545 .msmsdcc_fmid = 24576000,
1546 .msmsdcc_fmax = 49152000,
1547 .nonremovable = 1,
1548};
1549#endif
1550
1551#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1552 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
1553static struct mmc_platform_data sdc4_plat_data = {
1554 .ocr_mask = MMC_VDD_28_29,
1555 .translate_vdd = msm_sdcc_setup_power,
1556 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1557 .msmsdcc_fmin = 144000,
1558 .msmsdcc_fmid = 24576000,
1559 .msmsdcc_fmax = 49152000,
1560};
1561#endif
1562#endif
1563
1564#ifdef CONFIG_SERIAL_MSM_HS
1565static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
1566 .inject_rx_on_wakeup = 1,
1567 .rx_to_inject = 0xFD,
1568};
1569#endif
1570static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
1571 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
1572 .idle_supported = 1,
1573 .suspend_supported = 1,
1574 .idle_enabled = 1,
1575 .suspend_enabled = 1,
1576 .latency = 16000,
1577 .residency = 20000,
1578 },
1579 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
1580 .idle_supported = 1,
1581 .suspend_supported = 1,
1582 .idle_enabled = 1,
1583 .suspend_enabled = 1,
1584 .latency = 12000,
1585 .residency = 20000,
1586 },
1587 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
1588 .idle_supported = 1,
1589 .suspend_supported = 1,
1590 .idle_enabled = 0,
1591 .suspend_enabled = 1,
1592 .latency = 2000,
1593 .residency = 0,
1594 },
1595 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
1596 .idle_supported = 1,
1597 .suspend_supported = 1,
1598 .idle_enabled = 1,
1599 .suspend_enabled = 1,
1600 .latency = 2,
1601 .residency = 0,
1602 },
1603};
1604
1605static struct android_pmem_platform_data android_pmem_adsp_pdata = {
1606 .name = "pmem_adsp",
1607 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
1608 .cached = 1,
1609 .memory_type = MEMTYPE_EBI1,
1610};
1611
1612static struct platform_device android_pmem_adsp_device = {
1613 .name = "android_pmem",
1614 .id = 1,
1615 .dev = { .platform_data = &android_pmem_adsp_pdata },
1616};
1617
1618static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
1619static int __init pmem_mdp_size_setup(char *p)
1620{
1621 pmem_mdp_size = memparse(p, NULL);
1622 return 0;
1623}
1624
1625early_param("pmem_mdp_size", pmem_mdp_size_setup);
1626
1627static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
1628static int __init pmem_adsp_size_setup(char *p)
1629{
1630 pmem_adsp_size = memparse(p, NULL);
1631 return 0;
1632}
1633
1634early_param("pmem_adsp_size", pmem_adsp_size_setup);
1635
1636static unsigned fb_size = MSM_FB_SIZE;
1637static int __init fb_size_setup(char *p)
1638{
1639 fb_size = memparse(p, NULL);
1640 return 0;
1641}
1642
1643early_param("fb_size", fb_size_setup);
1644
Taniya Das0a5303a2011-08-23 18:47:48 +05301645static struct resource msm_fb_resources[] = {
1646 {
1647 .flags = IORESOURCE_DMA,
1648 }
1649};
1650
1651static int msm_fb_detect_panel(const char *name)
1652{
1653 int ret;
1654
1655 if (!strncmp(name, "mipi_video_truly_wvga", 21))
1656 ret = 0;
1657 else
1658 ret = -ENODEV;
1659
1660 return ret;
1661}
1662
1663static int mipi_truly_set_bl(int on)
1664{
1665 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, !!on);
1666
1667 return 1;
1668}
1669
1670static struct msm_fb_platform_data msm_fb_pdata = {
1671 .detect_client = msm_fb_detect_panel,
1672};
1673
1674static struct platform_device msm_fb_device = {
1675 .name = "msm_fb",
1676 .id = 0,
1677 .num_resources = ARRAY_SIZE(msm_fb_resources),
1678 .resource = msm_fb_resources,
1679 .dev = {
1680 .platform_data = &msm_fb_pdata,
1681 }
1682};
1683
1684static struct msm_panel_common_pdata mipi_truly_pdata = {
1685 .pmic_backlight = mipi_truly_set_bl,
1686};
1687
1688static struct platform_device mipi_dsi_truly_panel_device = {
1689 .name = "mipi_truly",
1690 .id = 0,
1691 .dev = {
1692 .platform_data = &mipi_truly_pdata,
1693 }
1694};
1695
Pankaj Kumar27c02642011-09-22 15:55:55 +05301696static int __init mmc_regulator_init(int sdcc_no, const char *supply, int uV)
1697{
1698 int rc;
1699
1700 BUG_ON(sdcc_no < 1 || sdcc_no > 4);
1701
1702 sdcc_no--;
1703
1704 sdcc_vreg_data[sdcc_no] = regulator_get(NULL, supply);
1705
1706 if (IS_ERR(sdcc_vreg_data[sdcc_no])) {
1707 rc = PTR_ERR(sdcc_vreg_data[sdcc_no]);
1708 pr_err("%s: could not get regulator \"%s\": %d\n",
1709 __func__, supply, rc);
1710 goto out;
1711 }
1712
1713 rc = regulator_set_voltage(sdcc_vreg_data[sdcc_no], uV, uV);
1714
1715 if (rc) {
1716 pr_err("%s: could not set voltage for \"%s\" to %d uV: %d\n",
1717 __func__, supply, uV, rc);
1718 goto reg_free;
1719 }
1720
1721 return rc;
1722
1723reg_free:
1724 regulator_put(sdcc_vreg_data[sdcc_no]);
1725out:
1726 sdcc_vreg_data[sdcc_no] = NULL;
1727 return rc;
1728}
1729
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301730static void __init msm7627a_init_mmc(void)
1731{
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301732 /* eMMC slot */
1733#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
Pankaj Kumar27c02642011-09-22 15:55:55 +05301734 if (mmc_regulator_init(3, "emmc", 3000000))
1735 return;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301736 msm_add_sdcc(3, &sdc3_plat_data);
1737#endif
1738 /* Micro-SD slot */
1739#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
Pankaj Kumar27c02642011-09-22 15:55:55 +05301740 if (mmc_regulator_init(1, "mmc", 2850000))
1741 return;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301742 msm_add_sdcc(1, &sdc1_plat_data);
1743#endif
1744 /* SDIO WLAN slot */
1745#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
Pankaj Kumar27c02642011-09-22 15:55:55 +05301746 if (mmc_regulator_init(2, "mmc", 2850000))
1747 return;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301748 msm_add_sdcc(2, &sdc2_plat_data);
1749#endif
1750 /* Not Used */
1751#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1752 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
Pankaj Kumar27c02642011-09-22 15:55:55 +05301753 if (mmc_regulator_init(4, "mmc", 2850000))
1754 return;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301755 msm_add_sdcc(4, &sdc4_plat_data);
1756#endif
1757}
1758
1759#define SND(desc, num) { .name = #desc, .id = num }
1760static struct snd_endpoint snd_endpoints_list[] = {
1761 SND(HANDSET, 0),
1762 SND(MONO_HEADSET, 2),
1763 SND(HEADSET, 3),
1764 SND(SPEAKER, 6),
1765 SND(TTY_HEADSET, 8),
1766 SND(TTY_VCO, 9),
1767 SND(TTY_HCO, 10),
1768 SND(BT, 12),
1769 SND(IN_S_SADC_OUT_HANDSET, 16),
1770 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
1771 SND(FM_DIGITAL_STEREO_HEADSET, 26),
1772 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
1773 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +05301774 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Phani Kumar Alladad6971252011-10-19 10:50:15 +05301775 SND(CURRENT, 0x7FFFFFFE),
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301776 SND(FM_ANALOG_STEREO_HEADSET, 35),
1777 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
1778};
1779#undef SND
1780
1781static struct msm_snd_endpoints msm_device_snd_endpoints = {
1782 .endpoints = snd_endpoints_list,
1783 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
1784};
1785
1786static struct platform_device msm_device_snd = {
1787 .name = "msm_snd",
1788 .id = -1,
1789 .dev = {
1790 .platform_data = &msm_device_snd_endpoints
1791 },
1792};
1793
1794#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1795 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1796 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1797 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1798 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1799 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1800#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1801 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1802 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1803 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1804 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1805 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1806#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1807 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1808 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1809 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1810 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1811 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1812#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1813 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1814 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1815 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1816 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1817 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1818#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
1819
1820static unsigned int dec_concurrency_table[] = {
1821 /* Audio LP */
1822 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
1823 0, 0, 0,
1824
1825 /* Concurrency 1 */
1826 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1827 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1828 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1829 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1830 (DEC4_FORMAT),
1831
1832 /* Concurrency 2 */
1833 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1834 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1835 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1836 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1837 (DEC4_FORMAT),
1838
1839 /* Concurrency 3 */
1840 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1841 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1842 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1843 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1844 (DEC4_FORMAT),
1845
1846 /* Concurrency 4 */
1847 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1848 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1849 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1850 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1851 (DEC4_FORMAT),
1852
1853 /* Concurrency 5 */
1854 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1855 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1856 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1857 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1858 (DEC4_FORMAT),
1859
1860 /* Concurrency 6 */
1861 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1862 0, 0, 0, 0,
1863
1864 /* Concurrency 7 */
1865 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1866 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1867 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1868 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1869 (DEC4_FORMAT),
1870};
1871
1872#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
1873 .module_queueid = queueid, .module_decid = decid, \
1874 .nr_codec_support = nr_codec}
1875
1876static struct msm_adspdec_info dec_info_list[] = {
1877 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
1878 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
1879 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
1880 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
1881 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
1882};
1883
1884static struct msm_adspdec_database msm_device_adspdec_database = {
1885 .num_dec = ARRAY_SIZE(dec_info_list),
1886 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
1887 ARRAY_SIZE(dec_info_list)),
1888 .dec_concurrency_table = dec_concurrency_table,
1889 .dec_info_list = dec_info_list,
1890};
1891
1892static struct platform_device msm_device_adspdec = {
1893 .name = "msm_adspdec",
1894 .id = -1,
1895 .dev = {
1896 .platform_data = &msm_device_adspdec_database
1897 },
1898};
1899
1900static struct android_pmem_platform_data android_pmem_audio_pdata = {
1901 .name = "pmem_audio",
1902 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
1903 .cached = 0,
1904 .memory_type = MEMTYPE_EBI1,
1905};
1906
1907static struct platform_device android_pmem_audio_device = {
1908 .name = "android_pmem",
1909 .id = 2,
1910 .dev = { .platform_data = &android_pmem_audio_pdata },
1911};
1912
1913static struct android_pmem_platform_data android_pmem_pdata = {
1914 .name = "pmem",
1915 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
1916 .cached = 1,
1917 .memory_type = MEMTYPE_EBI1,
1918};
1919static struct platform_device android_pmem_device = {
1920 .name = "android_pmem",
1921 .id = 0,
1922 .dev = { .platform_data = &android_pmem_pdata },
1923};
1924
1925static u32 msm_calculate_batt_capacity(u32 current_voltage);
1926
1927static struct msm_psy_batt_pdata msm_psy_batt_data = {
1928 .voltage_min_design = 2800,
1929 .voltage_max_design = 4300,
1930 .avail_chg_sources = AC_CHG | USB_CHG ,
1931 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
1932 .calculate_capacity = &msm_calculate_batt_capacity,
1933};
1934
1935static u32 msm_calculate_batt_capacity(u32 current_voltage)
1936{
1937 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
1938 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
1939
1940 return (current_voltage - low_voltage) * 100
1941 / (high_voltage - low_voltage);
1942}
1943
1944static struct platform_device msm_batt_device = {
1945 .name = "msm-battery",
1946 .id = -1,
1947 .dev.platform_data = &msm_psy_batt_data,
1948};
1949
Taniya Das7a22cdd2011-09-08 14:57:00 +05301950#ifdef CONFIG_MSM_CAMERA
1951static uint32_t camera_off_gpio_table[] = {
1952 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1953};
1954
1955static uint32_t camera_on_gpio_table[] = {
1956 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1957};
1958
1959static void qrd1_camera_gpio_cfg(void)
1960{
1961
1962 int rc = 0;
1963
1964 rc = gpio_request(GPIO_CAM_5MP_SHDN_EN, "ov5640");
1965 if (rc < 0)
1966 pr_err("%s: gpio_request---GPIO_CAM_5MP_SHDN_EN failed!",
1967 __func__);
1968
1969
1970 rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_5MP_SHDN_EN, 0,
1971 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
1972 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
1973 if (rc < 0) {
1974 pr_err("%s: unable to enable Power Down gpio for main"
1975 "camera!\n", __func__);
1976 gpio_free(GPIO_CAM_5MP_SHDN_EN);
1977 }
1978
1979
1980 rc = gpio_request(GPIO_CAM_5MP_RESET, "ov5640");
1981 if (rc < 0) {
1982 pr_err("%s: gpio_request---GPIO_CAM_5MP_RESET failed!",
1983 __func__);
1984 gpio_free(GPIO_CAM_5MP_SHDN_EN);
1985 }
1986
1987
1988 rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_5MP_RESET, 0,
1989 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
1990 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
1991 if (rc < 0) {
1992 pr_err("%s: unable to enable reset gpio for main camera!\n",
1993 __func__);
1994 gpio_free(GPIO_CAM_5MP_RESET);
1995 }
1996
1997 rc = gpio_request(GPIO_CAM_3MP_PWDN, "ov7692");
1998 if (rc < 0)
1999 pr_err("%s: gpio_request---GPIO_CAM_3MP_PWDN failed!",
2000 __func__);
2001
2002 rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_3MP_PWDN, 0,
2003 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
2004 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
2005 if (rc < 0) {
2006 pr_err("%s: unable to enable Power Down gpio for front"
2007 "camera!\n", __func__);
2008 gpio_free(GPIO_CAM_3MP_PWDN);
2009 }
2010
2011 gpio_direction_output(GPIO_CAM_5MP_SHDN_EN, 1);
2012 gpio_direction_output(GPIO_CAM_5MP_RESET, 1);
2013 gpio_direction_output(GPIO_CAM_3MP_PWDN, 1);
2014}
2015
2016#endif
Pankaj Kumar27c02642011-09-22 15:55:55 +05302017static struct regulator_bulk_data regs_camera[] = {
2018 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
2019 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2020 { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
2021};
2022
2023static void __init msm_camera_vreg_init(void)
Taniya Das7a22cdd2011-09-08 14:57:00 +05302024{
2025 int rc;
2026
Pankaj Kumar27c02642011-09-22 15:55:55 +05302027 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
2028 if (rc) {
2029 pr_err("%s: could not get regulators: %d\n", __func__, rc);
2030 return;
Taniya Das7a22cdd2011-09-08 14:57:00 +05302031 }
2032
Pankaj Kumar27c02642011-09-22 15:55:55 +05302033 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
2034 if (rc) {
2035 pr_err("%s: could not set voltages: %d\n", __func__, rc);
2036 return;
Taniya Das7a22cdd2011-09-08 14:57:00 +05302037 }
2038}
2039
Pankaj Kumar27c02642011-09-22 15:55:55 +05302040static void msm_camera_vreg_config(int vreg_en)
2041{
2042 int rc = vreg_en ?
2043 regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
2044 regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
2045
2046 if (rc)
2047 pr_err("%s: could not %sable regulators: %d\n",
2048 __func__, vreg_en ? "en" : "dis", rc);
2049}
Taniya Das7a22cdd2011-09-08 14:57:00 +05302050static int config_gpio_table(uint32_t *table, int len)
2051{
2052 int rc = 0, i = 0;
2053
2054 for (i = 0; i < len; i++) {
2055 rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
2056 if (rc) {
2057 pr_err("%s not able to get gpio\n", __func__);
2058 for (i--; i >= 0; i--)
2059 gpio_tlmm_config(camera_off_gpio_table[i],
2060 GPIO_CFG_ENABLE);
2061 break;
2062 }
2063 }
2064 return rc;
2065}
2066
2067static int config_camera_on_gpios_rear(void)
2068{
2069 int rc = 0;
2070
2071 msm_camera_vreg_config(1);
2072
2073 rc = config_gpio_table(camera_on_gpio_table,
2074 ARRAY_SIZE(camera_on_gpio_table));
2075 if (rc < 0) {
2076 pr_err("%s: CAMSENSOR gpio table request"
2077 "failed\n", __func__);
2078 return rc;
2079 }
2080
2081 return rc;
2082}
2083
2084static void config_camera_off_gpios_rear(void)
2085{
2086 msm_camera_vreg_config(0);
2087 config_gpio_table(camera_off_gpio_table,
2088 ARRAY_SIZE(camera_off_gpio_table));
2089}
2090
2091static int config_camera_on_gpios_front(void)
2092{
2093 int rc = 0;
2094
2095 msm_camera_vreg_config(1);
2096
2097 rc = config_gpio_table(camera_on_gpio_table,
2098 ARRAY_SIZE(camera_on_gpio_table));
2099 if (rc < 0) {
2100 pr_err("%s: CAMSENSOR gpio table request"
2101 "failed\n", __func__);
2102 return rc;
2103 }
2104
2105 return rc;
2106}
2107
2108static void config_camera_off_gpios_front(void)
2109{
2110 msm_camera_vreg_config(0);
2111
2112 config_gpio_table(camera_off_gpio_table,
2113 ARRAY_SIZE(camera_off_gpio_table));
2114}
2115
2116struct msm_camera_device_platform_data msm_camera_data_rear = {
2117 .camera_gpio_on = config_camera_on_gpios_rear,
2118 .camera_gpio_off = config_camera_off_gpios_rear,
2119 .ioext.csiphy = 0xA1000000,
2120 .ioext.csisz = 0x00100000,
2121 .ioext.csiirq = INT_CSI_IRQ_1,
2122 .ioclk.mclk_clk_rate = 24000000,
2123 .ioclk.vfe_clk_rate = 192000000,
2124 .ioext.appphy = MSM_CLK_CTL_PHYS,
2125 .ioext.appsz = MSM_CLK_CTL_SIZE,
2126};
2127
2128struct msm_camera_device_platform_data msm_camera_data_front = {
2129 .camera_gpio_on = config_camera_on_gpios_front,
2130 .camera_gpio_off = config_camera_off_gpios_front,
2131 .ioext.csiphy = 0xA0F00000,
2132 .ioext.csisz = 0x00100000,
2133 .ioext.csiirq = INT_CSI_IRQ_0,
2134 .ioclk.mclk_clk_rate = 24000000,
2135 .ioclk.vfe_clk_rate = 192000000,
2136 .ioext.appphy = MSM_CLK_CTL_PHYS,
2137 .ioext.appsz = MSM_CLK_CTL_SIZE,
2138};
2139
2140#ifdef CONFIG_OV5640
2141static struct msm_camera_sensor_platform_info ov5640_sensor_info = {
2142 .mount_angle = 90
2143};
2144
2145static struct msm_camera_sensor_flash_src msm_flash_src_ov5640 = {
2146 .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED,
2147 ._fsrc.led_src.led_name = "flashlight",
2148 ._fsrc.led_src.led_name_len = 10,
2149};
2150
2151static struct msm_camera_sensor_flash_data flash_ov5640 = {
2152 .flash_type = MSM_CAMERA_FLASH_LED,
2153 .flash_src = &msm_flash_src_ov5640,
2154};
2155
2156static struct msm_camera_sensor_info msm_camera_sensor_ov5640_data = {
2157 .sensor_name = "ov5640",
2158 .sensor_reset_enable = 1,
2159 .sensor_reset = GPIO_CAM_5MP_RESET,
2160 .sensor_pwd = GPIO_CAM_5MP_SHDN_EN,
2161 .vcm_pwd = 0,
2162 .vcm_enable = 0,
2163 .pdata = &msm_camera_data_rear,
2164 .flash_data = &flash_ov5640,
2165 .sensor_platform_info = &ov5640_sensor_info,
2166 .csi_if = 1,
2167};
2168
2169static struct platform_device msm_camera_sensor_ov5640 = {
2170 .name = "msm_camera_ov5640",
2171 .dev = {
2172 .platform_data = &msm_camera_sensor_ov5640_data,
2173 },
2174};
2175#endif
2176
2177#ifdef CONFIG_WEBCAM_OV7692_QRD
2178static struct msm_camera_sensor_platform_info ov7692_sensor_7627a_info = {
2179 .mount_angle = 90
2180};
2181
2182static struct msm_camera_sensor_flash_data flash_ov7692 = {
2183 .flash_type = MSM_CAMERA_FLASH_NONE,
2184};
2185
2186static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = {
2187 .sensor_name = "ov7692",
2188 .sensor_reset_enable = 0,
2189 .sensor_reset = 0,
2190 .sensor_pwd = GPIO_CAM_3MP_PWDN,
2191 .vcm_pwd = 0,
2192 .vcm_enable = 0,
2193 .pdata = &msm_camera_data_front,
2194 .flash_data = &flash_ov7692,
2195 .sensor_platform_info = &ov7692_sensor_7627a_info,
2196 .csi_if = 1,
2197};
2198
2199static struct platform_device msm_camera_sensor_ov7692 = {
2200 .name = "msm_camera_ov7692",
2201 .dev = {
2202 .platform_data = &msm_camera_sensor_ov7692_data,
2203 },
2204};
2205#endif
2206
2207static struct i2c_board_info i2c_camera_devices[] = {
2208 #ifdef CONFIG_OV5640
2209 {
2210 I2C_BOARD_INFO("ov5640", 0x78 >> 1),
2211 },
2212 #endif
2213 #ifdef CONFIG_WEBCAM_OV7692_QRD
2214 {
2215 I2C_BOARD_INFO("ov7692", 0x78),
2216 },
2217 #endif
2218};
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302219static struct platform_device *qrd1_devices[] __initdata = {
2220 &msm_device_dmov,
2221 &msm_device_smd,
2222 &msm_device_uart1,
2223 &msm_device_uart_dm1,
2224 &msm_gsbi0_qup_i2c_device,
2225 &msm_gsbi1_qup_i2c_device,
2226 &msm_device_otg,
2227 &msm_device_gadget_peripheral,
2228 &android_usb_device,
2229 &android_pmem_device,
2230 &android_pmem_adsp_device,
Taniya Das0a5303a2011-08-23 18:47:48 +05302231 &msm_fb_device,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302232 &android_pmem_audio_device,
2233 &msm_device_snd,
2234 &msm_device_adspdec,
2235 &msm_batt_device,
Taniya Das7a22cdd2011-09-08 14:57:00 +05302236#ifdef CONFIG_OV5640
2237 &msm_camera_sensor_ov5640,
2238#endif
2239#ifdef CONFIG_WEBCAM_OV7692_QRD
2240 &msm_camera_sensor_ov7692,
2241#endif
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302242 &msm_kgsl_3d0,
2243#ifdef CONFIG_BT
2244 &msm_bt_power_device,
2245#endif
Taniya Das0a5303a2011-08-23 18:47:48 +05302246 &mipi_dsi_truly_panel_device,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302247 &msm_wlan_ar6000_pm_device,
2248 &asoc_msm_pcm,
2249 &asoc_msm_dai0,
2250 &asoc_msm_dai1,
2251};
2252
2253static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
2254static int __init pmem_kernel_ebi1_size_setup(char *p)
2255{
2256 pmem_kernel_ebi1_size = memparse(p, NULL);
2257 return 0;
2258}
2259early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
2260
2261static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
2262static int __init pmem_audio_size_setup(char *p)
2263{
2264 pmem_audio_size = memparse(p, NULL);
2265 return 0;
2266}
2267early_param("pmem_audio_size", pmem_audio_size_setup);
2268
2269static void __init msm_msm7627a_allocate_memory_regions(void)
2270{
Taniya Das0a5303a2011-08-23 18:47:48 +05302271 void *addr;
2272 unsigned long size;
2273
2274 size = fb_size ? : MSM_FB_SIZE;
2275 addr = alloc_bootmem_align(size, 0x1000);
2276 msm_fb_resources[0].start = __pa(addr);
2277 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2278 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", size,
2279 addr, __pa(addr));
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302280}
2281
2282static struct memtype_reserve msm7627a_reserve_table[] __initdata = {
2283 [MEMTYPE_SMI] = {
2284 },
2285 [MEMTYPE_EBI0] = {
2286 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2287 },
2288 [MEMTYPE_EBI1] = {
2289 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2290 },
2291};
2292
Taniya Das0a5303a2011-08-23 18:47:48 +05302293static struct msm_panel_common_pdata mdp_pdata = {
2294 .gpio = 97,
2295 .mdp_rev = MDP_REV_303,
2296};
2297
2298#define GPIO_LCDC_BRDG_PD 128
2299#define GPIO_LCDC_BRDG_RESET_N 129
2300#define GPIO_LCD_DSI_SEL 125
2301
2302static unsigned mipi_dsi_gpio[] = {
2303 GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT,
2304 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2305 GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT,
2306 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_PD */
2307};
2308
2309static unsigned lcd_dsi_sel_gpio[] = {
2310 GPIO_CFG(GPIO_LCD_DSI_SEL, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
2311 GPIO_CFG_2MA),
2312};
2313
2314enum {
2315 DSI_SINGLE_LANE = 1,
2316 DSI_TWO_LANES,
2317};
2318
2319static int msm_fb_get_lane_config(void)
2320{
2321 pr_info("DSI_TWO_LANES\n");
2322 return DSI_TWO_LANES;
2323}
2324
2325static int mipi_truly_sel_mode(int video_mode)
2326{
2327 int rc = 0;
2328
2329 rc = gpio_request(GPIO_LCD_DSI_SEL, "lcd_dsi_sel");
2330 if (rc < 0)
2331 goto gpio_error;
2332
2333 rc = gpio_tlmm_config(lcd_dsi_sel_gpio[0], GPIO_CFG_ENABLE);
2334 if (rc)
2335 goto gpio_error;
2336
2337 rc = gpio_direction_output(GPIO_LCD_DSI_SEL, 1);
2338 if (!rc) {
2339 gpio_set_value_cansleep(GPIO_LCD_DSI_SEL, video_mode);
2340 return rc;
2341 } else {
2342 goto gpio_error;
2343 }
2344
2345gpio_error:
2346 pr_err("mipi_truly_sel_mode failed\n");
2347 gpio_free(GPIO_LCD_DSI_SEL);
2348 return rc;
2349}
2350
2351static int msm_fb_dsi_client_qrd1_reset(void)
2352{
2353 int rc = 0;
2354
2355 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
2356 if (rc < 0) {
2357 pr_err("failed to request lcd brdg reset_n\n");
2358 return rc;
2359 }
2360
2361 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
2362 if (rc < 0) {
2363 pr_err("Failed to enable LCDC Bridge reset enable\n");
2364 return rc;
2365 }
2366
2367 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
2368 if (rc < 0) {
2369 pr_err("Failed GPIO bridge pd\n");
2370 gpio_free(GPIO_LCDC_BRDG_RESET_N);
2371 return rc;
2372 }
2373
2374 mipi_truly_sel_mode(1);
2375
2376 return rc;
2377}
2378
2379static int msm_fb_dsi_client_reset(void)
2380{
2381 int rc = 0;
2382
2383 rc = msm_fb_dsi_client_qrd1_reset();
2384 return rc;
2385}
2386
2387static int dsi_gpio_initialized;
2388
2389static int mipi_dsi_panel_qrd1_power(int on)
2390{
2391 int rc = 0;
2392
2393 if (!dsi_gpio_initialized) {
2394 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
2395 if (rc < 0)
2396 return rc;
2397
Jeevan Shriram72e4cc62011-11-10 14:57:22 +05302398 rc = gpio_tlmm_config(GPIO_CFG(GPIO_BACKLIGHT_EN, 0,
2399 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2400 GPIO_CFG_ENABLE);
2401 if (rc < 0) {
2402 pr_err("failed GPIO_BACKLIGHT_EN tlmm config\n");
2403 return rc;
2404 }
2405
Taniya Das0a5303a2011-08-23 18:47:48 +05302406 rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
2407 if (rc < 0) {
2408 pr_err("failed to enable backlight\n");
2409 gpio_free(GPIO_BACKLIGHT_EN);
2410 return rc;
2411 }
2412 dsi_gpio_initialized = 1;
2413 }
2414
2415 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, !!on);
2416
2417 if (!on) {
2418 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
2419 msleep(20);
2420 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
2421 msleep(20);
2422 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
2423
2424 }
2425
2426 return rc;
2427}
2428
2429static int mipi_dsi_panel_power(int on)
2430{
2431 int rc = 0;
2432
2433 rc = mipi_dsi_panel_qrd1_power(on);
2434 return rc;
2435}
2436
2437#define MDP_303_VSYNC_GPIO 97
2438
2439#ifdef CONFIG_FB_MSM_MDP303
2440static struct mipi_dsi_platform_data mipi_dsi_pdata = {
2441 .vsync_gpio = MDP_303_VSYNC_GPIO,
2442 .dsi_power_save = mipi_dsi_panel_power,
2443 .dsi_client_reset = msm_fb_dsi_client_reset,
2444 .get_lane_config = msm_fb_get_lane_config,
2445};
2446#endif
2447
2448static void __init msm_fb_add_devices(void)
2449{
2450 msm_fb_register_device("mdp", &mdp_pdata);
2451 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
2452}
2453
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302454static void __init size_pmem_devices(void)
2455{
2456#ifdef CONFIG_ANDROID_PMEM
2457 android_pmem_adsp_pdata.size = pmem_adsp_size;
2458 android_pmem_pdata.size = pmem_mdp_size;
2459 android_pmem_audio_pdata.size = pmem_audio_size;
2460#endif
2461}
2462
2463static void __init reserve_memory_for(struct android_pmem_platform_data *p)
2464{
2465 msm7627a_reserve_table[p->memory_type].size += p->size;
2466}
2467
2468static void __init reserve_pmem_memory(void)
2469{
2470#ifdef CONFIG_ANDROID_PMEM
2471 reserve_memory_for(&android_pmem_adsp_pdata);
2472 reserve_memory_for(&android_pmem_pdata);
2473 reserve_memory_for(&android_pmem_audio_pdata);
2474 msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
2475#endif
2476}
2477
2478static void __init msm7627a_calculate_reserve_sizes(void)
2479{
2480 size_pmem_devices();
2481 reserve_pmem_memory();
2482}
2483
2484static int msm7627a_paddr_to_memtype(unsigned int paddr)
2485{
2486 return MEMTYPE_EBI1;
2487}
2488
2489static struct reserve_info msm7627a_reserve_info __initdata = {
2490 .memtype_reserve_table = msm7627a_reserve_table,
2491 .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes,
2492 .paddr_to_memtype = msm7627a_paddr_to_memtype,
2493};
2494
2495static void __init msm7627a_reserve(void)
2496{
2497 reserve_info = &msm7627a_reserve_info;
2498 msm_reserve();
2499}
2500
2501static void __init msm_device_i2c_init(void)
2502{
2503 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
2504 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
2505}
2506
2507static struct msm_handset_platform_data hs_platform_data = {
2508 .hs_name = "7k_handset",
2509 .pwr_key_delay_ms = 500, /* 0 will disable end key */
2510};
2511
2512static struct platform_device hs_pdev = {
2513 .name = "msm-handset",
2514 .id = -1,
2515 .dev = {
2516 .platform_data = &hs_platform_data,
2517 },
2518};
2519
Pankaj Kumar3cec0582011-11-18 11:13:29 +05302520static struct platform_device msm_proccomm_regulator_dev = {
2521 .name = PROCCOMM_REGULATOR_DEV_NAME,
2522 .id = -1,
2523 .dev = {
2524 .platform_data = &msm7x27a_proccomm_regulator_data
2525 }
2526};
2527
2528static void __init msm7627a_init_regulators(void)
2529{
2530 int rc = platform_device_register(&msm_proccomm_regulator_dev);
2531 if (rc)
2532 pr_err("%s: could not register regulator device: %d\n",
2533 __func__, rc);
2534}
2535
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302536#define UART1DM_RX_GPIO 45
2537static void __init msm_qrd1_init(void)
2538{
2539 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +05302540 msm7627a_init_regulators();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302541 msm_device_i2c_init();
2542 msm7627a_init_mmc();
2543
Taniya Das7a22cdd2011-09-08 14:57:00 +05302544 qrd1_camera_gpio_cfg();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302545#ifdef CONFIG_SERIAL_MSM_HS
2546 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
2547 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
2548#endif
2549
2550#ifdef CONFIG_USB_MSM_OTG_72K
2551 msm_otg_pdata.swfi_latency = msm7627a_pm_data
2552 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
2553 msm_device_otg.dev.platform_data = &msm_otg_pdata;
2554#endif
2555 msm_device_gadget_peripheral.dev.platform_data =
Taniya Das7a22cdd2011-09-08 14:57:00 +05302556 &msm_gadget_pdata;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302557 platform_add_devices(qrd1_devices,
Taniya Das7a22cdd2011-09-08 14:57:00 +05302558 ARRAY_SIZE(qrd1_devices));
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302559#ifdef CONFIG_USB_EHCI_MSM_72K
2560 msm7627a_init_host();
2561#endif
2562 msm_pm_set_platform_data(msm7627a_pm_data,
2563 ARRAY_SIZE(msm7627a_pm_data));
Murali Nalajalaa1827842011-11-13 14:12:39 +05302564 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_RESET_VECTOR,
2565 ioremap(0, PAGE_SIZE)));
2566
Taniya Das0a5303a2011-08-23 18:47:48 +05302567 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302568
2569#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
2570 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
Taniya Das7a22cdd2011-09-08 14:57:00 +05302571 bahama_devices,
2572 ARRAY_SIZE(bahama_devices));
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302573 bt_power_init();
2574#endif
Taniya Dasda408822011-09-06 12:54:06 +05302575
Pankaj Kumar27c02642011-09-22 15:55:55 +05302576 msm_camera_vreg_init();
Taniya Das7a22cdd2011-09-08 14:57:00 +05302577 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, i2c_camera_devices,
2578 ARRAY_SIZE(i2c_camera_devices));
2579
Taniya Dasda408822011-09-06 12:54:06 +05302580#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \
2581 defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE)
2582 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
2583 synaptic_i2c_clearpad3k,
2584 ARRAY_SIZE(synaptic_i2c_clearpad3k));
2585#endif
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302586 platform_device_register(&hs_pdev);
2587
2588#ifdef CONFIG_MSM_RPC_VIBRATOR
2589 msm_init_pmic_vibrator();
2590#endif
2591}
2592
2593static void __init qrd7627a_init_early(void)
2594{
2595 msm_msm7627a_allocate_memory_regions();
2596}
2597
2598MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
2599 .boot_params = PHYS_OFFSET + 0x100,
2600 .map_io = msm_common_io_init,
2601 .reserve = msm7627a_reserve,
2602 .init_irq = msm_init_irq,
2603 .init_machine = msm_qrd1_init,
2604 .timer = &msm_timer,
2605 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +05302606 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302607MACHINE_END