blob: 31767c31cf35c88f78e0681cddf042b8da3e9051 [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>
39#include <mach/usb_gadget_fserial.h>
40#include <mach/msm_memtypes.h>
41#include <mach/msm_serial_hs.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053042#include <mach/pmic.h>
43#include <mach/socinfo.h>
44#include <mach/vreg.h>
45#include <mach/rpc_pmapp.h>
46#include <mach/msm_battery.h>
47#include <mach/rpc_server_handset.h>
48#include <mach/socinfo.h>
Pankaj Kumar27c02642011-09-22 15:55:55 +053049#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053050#include "devices.h"
51#include "devices-msm7x2xa.h"
52#include "pm.h"
53#include "timer.h"
Murali Nalajalaa1827842011-11-13 14:12:39 +053054#include "pm-boot.h"
Pankaj Kumar3cec0582011-11-18 11:13:29 +053055#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053056
57#define PMEM_KERNEL_EBI1_SIZE 0x3A000
58#define MSM_PMEM_AUDIO_SIZE 0x5B000
59#define BAHAMA_SLAVE_ID_FM_ADDR 0x2A
60#define BAHAMA_SLAVE_ID_QMEMBIST_ADDR 0x7B
61#define BAHAMA_SLAVE_ID_FM_REG 0x02
62#define FM_GPIO 83
63
64enum {
65 GPIO_HOST_VBUS_EN = 107,
66 GPIO_BT_SYS_REST_EN = 114,
67 GPIO_WAKE_ON_WIRELESS,
68 GPIO_BACKLIGHT_EN,
Taniya Das7a22cdd2011-09-08 14:57:00 +053069 GPIO_NC,
70 GPIO_CAM_3MP_PWDN, /* CAM_VGA */
Taniya Dasc98bfbc2011-08-23 09:58:55 +053071 GPIO_WLAN_EN,
72 GPIO_CAM_5MP_SHDN_EN,
73 GPIO_CAM_5MP_RESET,
Taniya Das7a22cdd2011-09-08 14:57:00 +053074 GPIO_TP,
75 GPIO_CAM_GP_CAMIF_RESET,
Taniya Dasc98bfbc2011-08-23 09:58:55 +053076};
77
78 /* FM Platform power and shutdown routines */
79#define FPGA_MSM_CNTRL_REG2 0x90008010
80
81static 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};
405
406static struct platform_device msm_wlan_ar6000_pm_device = {
407 .name = "wlan_ar6000_pm_dev",
408 .id = -1,
409};
410
411#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
412
413static struct platform_device msm_bt_power_device = {
414 .name = "bt_power",
415};
416struct bahama_config_register {
417 u8 reg;
418 u8 value;
419 u8 mask;
420};
421struct bt_vreg_info {
422 const char *name;
423 unsigned int pmapp_id;
Pankaj Kumar27c02642011-09-22 15:55:55 +0530424 unsigned int min_level;
425 unsigned int max_level;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530426 unsigned int is_pin_controlled;
Pankaj Kumar27c02642011-09-22 15:55:55 +0530427 struct regulator *reg;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530428};
429static struct bt_vreg_info bt_vregs[] = {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530430 {"msme1", 2, 1800000, 1800000, 0, NULL},
431 {"bt", 21, 2900000, 3050000, 1, NULL}
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530432};
433
434static int bahama_bt(int on)
435{
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530436 int rc = 0;
437 int i;
438
439 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
440
441 struct bahama_variant_register {
442 const size_t size;
443 const struct bahama_config_register *set;
444 };
445
446 const struct bahama_config_register *p;
447
448 u8 version;
449
450 const struct bahama_config_register v10_bt_on[] = {
451 { 0xE9, 0x00, 0xFF },
452 { 0xF4, 0x80, 0xFF },
453 { 0xE4, 0x00, 0xFF },
454 { 0xE5, 0x00, 0x0F },
455#ifdef CONFIG_WLAN
456 { 0xE6, 0x38, 0x7F },
457 { 0xE7, 0x06, 0xFF },
458#endif
459 { 0xE9, 0x21, 0xFF },
460 { 0x01, 0x0C, 0x1F },
461 { 0x01, 0x08, 0x1F },
462 };
463
464 const struct bahama_config_register v20_bt_on_fm_off[] = {
465 { 0x11, 0x0C, 0xFF },
466 { 0x13, 0x01, 0xFF },
467 { 0xF4, 0x80, 0xFF },
468 { 0xF0, 0x00, 0xFF },
469 { 0xE9, 0x00, 0xFF },
470#ifdef CONFIG_WLAN
471 { 0x81, 0x00, 0x7F },
472 { 0x82, 0x00, 0xFF },
473 { 0xE6, 0x38, 0x7F },
474 { 0xE7, 0x06, 0xFF },
475#endif
476 { 0x8E, 0x15, 0xFF },
477 { 0x8F, 0x15, 0xFF },
478 { 0x90, 0x15, 0xFF },
479
480 { 0xE9, 0x21, 0xFF },
481 };
482
483 const struct bahama_config_register v20_bt_on_fm_on[] = {
484 { 0x11, 0x0C, 0xFF },
485 { 0x13, 0x01, 0xFF },
486 { 0xF4, 0x86, 0xFF },
487 { 0xF0, 0x06, 0xFF },
488 { 0xE9, 0x00, 0xFF },
489#ifdef CONFIG_WLAN
490 { 0x81, 0x00, 0x7F },
491 { 0x82, 0x00, 0xFF },
492 { 0xE6, 0x38, 0x7F },
493 { 0xE7, 0x06, 0xFF },
494#endif
495 { 0xE9, 0x21, 0xFF },
496 };
497
498 const struct bahama_config_register v10_bt_off[] = {
499 { 0xE9, 0x00, 0xFF },
500 };
501
502 const struct bahama_config_register v20_bt_off_fm_off[] = {
503 { 0xF4, 0x84, 0xFF },
504 { 0xF0, 0x04, 0xFF },
505 { 0xE9, 0x00, 0xFF }
506 };
507
508 const struct bahama_config_register v20_bt_off_fm_on[] = {
509 { 0xF4, 0x86, 0xFF },
510 { 0xF0, 0x06, 0xFF },
511 { 0xE9, 0x00, 0xFF }
512 };
513 const struct bahama_variant_register bt_bahama[2][3] = {
514 {
515 { ARRAY_SIZE(v10_bt_off), v10_bt_off },
516 { ARRAY_SIZE(v20_bt_off_fm_off), v20_bt_off_fm_off },
517 { ARRAY_SIZE(v20_bt_off_fm_on), v20_bt_off_fm_on }
518 },
519 {
520 { ARRAY_SIZE(v10_bt_on), v10_bt_on },
521 { ARRAY_SIZE(v20_bt_on_fm_off), v20_bt_on_fm_off },
522 { ARRAY_SIZE(v20_bt_on_fm_on), v20_bt_on_fm_on }
523 }
524 };
525
526 u8 offset = 0; /* index into bahama configs */
527 on = on ? 1 : 0;
528 version = marimba_read_bahama_ver(&config);
529 if ((int)version < 0 || version == BAHAMA_VER_UNSUPPORTED) {
530 dev_err(&msm_bt_power_device.dev, "%s: Bahama \
531 version read Error, version = %d \n",
532 __func__, version);
533 return -EIO;
534 }
535
536 if (version == BAHAMA_VER_2_0) {
537 if (marimba_get_fm_status(&config))
538 offset = 0x01;
539 }
540
541 p = bt_bahama[on][version + offset].set;
542
543 dev_info(&msm_bt_power_device.dev,
544 "%s: found version %d\n", __func__, version);
545
546 for (i = 0; i < bt_bahama[on][version + offset].size; i++) {
547 u8 value = (p+i)->value;
548 rc = marimba_write_bit_mask(&config,
549 (p+i)->reg,
550 &value,
551 sizeof((p+i)->value),
552 (p+i)->mask);
553 if (rc < 0) {
554 dev_err(&msm_bt_power_device.dev,
555 "%s: reg %x write failed: %d\n",
556 __func__, (p+i)->reg, rc);
557 return rc;
558 }
559 dev_dbg(&msm_bt_power_device.dev,
560 "%s: reg 0x%02x write value 0x%02x mask 0x%02x\n",
561 __func__, (p+i)->reg,
562 value, (p+i)->mask);
563 value = 0;
564 rc = marimba_read_bit_mask(&config,
565 (p+i)->reg, &value,
566 sizeof((p+i)->value), (p+i)->mask);
567 if (rc < 0)
568 dev_err(&msm_bt_power_device.dev, "%s marimba_read_bit_mask- error",
569 __func__);
570 dev_dbg(&msm_bt_power_device.dev,
571 "%s: reg 0x%02x read value 0x%02x mask 0x%02x\n",
572 __func__, (p+i)->reg,
573 value, (p+i)->mask);
574 }
575 /* Update BT Status */
576 if (on)
577 marimba_set_bt_status(&config, true);
578 else
579 marimba_set_bt_status(&config, false);
580 return rc;
581}
582static int bluetooth_switch_regulators(int on)
583{
584 int i, rc = 0;
585 const char *id = "BTPW";
586
587 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530588 if (IS_ERR_OR_NULL(bt_vregs[i].reg)) {
589 rc = bt_vregs[i].reg ?
590 PTR_ERR(bt_vregs[i].reg) :
591 -ENODEV;
592 dev_err(&msm_bt_power_device.dev,
593 "%s: invalid regulator handle for %s: %d\n",
594 __func__, bt_vregs[i].name, rc);
595 goto reg_disable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530596 }
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530597
Pankaj Kumar27c02642011-09-22 15:55:55 +0530598 rc = on ? regulator_set_voltage(bt_vregs[i].reg,
599 bt_vregs[i].min_level,
600 bt_vregs[i].max_level) : 0;
601 if (rc) {
602 dev_err(&msm_bt_power_device.dev,
603 "%s: could not set voltage for %s: %d\n",
604 __func__, bt_vregs[i].name, rc);
605 goto reg_disable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530606 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530607
608 rc = on ? regulator_enable(bt_vregs[i].reg) : 0;
609 if (rc) {
610 dev_err(&msm_bt_power_device.dev,
611 "%s: could not %sable regulator %s: %d\n",
612 __func__, "en", bt_vregs[i].name, rc);
613 goto reg_disable;
614 }
615
616 if (bt_vregs[i].is_pin_controlled) {
617 rc = pmapp_vreg_lpm_pincntrl_vote(id,
618 bt_vregs[i].pmapp_id,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530619 PMAPP_CLOCK_ID_D1,
620 on ? PMAPP_CLOCK_VOTE_ON :
Pankaj Kumar27c02642011-09-22 15:55:55 +0530621 PMAPP_CLOCK_VOTE_OFF);
622 if (rc) {
623 dev_err(&msm_bt_power_device.dev,
624 "%s: pin control failed for %s: %d\n",
625 __func__, bt_vregs[i].name, rc);
626 goto pin_cnt_fail;
627 }
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530628 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530629 rc = on ? 0 : regulator_disable(bt_vregs[i].reg);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530630
Pankaj Kumar27c02642011-09-22 15:55:55 +0530631 if (rc) {
632 dev_err(&msm_bt_power_device.dev,
633 "%s: could not %sable regulator %s: %d\n",
634 __func__, "dis", bt_vregs[i].name, rc);
635 goto reg_disable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530636 }
637 }
638
639 return rc;
Pankaj Kumar27c02642011-09-22 15:55:55 +0530640pin_cnt_fail:
641 if (on)
642 regulator_disable(bt_vregs[i].reg);
643reg_disable:
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530644 while (i) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530645 if (on) {
646 i--;
647 regulator_disable(bt_vregs[i].reg);
648 regulator_put(bt_vregs[i].reg);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530649 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530650 }
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530651 return rc;
652}
653
Pankaj Kumar27c02642011-09-22 15:55:55 +0530654static struct regulator *reg_s3;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530655static unsigned int msm_bahama_setup_power(void)
656{
657 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530658
Pankaj Kumar27c02642011-09-22 15:55:55 +0530659 reg_s3 = regulator_get(NULL, "msme1");
660 if (IS_ERR(reg_s3)) {
661 rc = PTR_ERR(reg_s3);
662 pr_err("%s: could not get regulator: %d\n", __func__, rc);
663 goto out;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530664 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530665
666 rc = regulator_set_voltage(reg_s3, 1800000, 1800000);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530667 if (rc < 0) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530668 pr_err("%s: could not set voltage: %d\n", __func__, rc);
669 goto reg_fail;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530670 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530671
672 rc = regulator_enable(reg_s3);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530673 if (rc < 0) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530674 pr_err("%s: could not enable regulator: %d\n", __func__, rc);
675 goto reg_fail;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530676 }
677
678 /*setup Bahama_sys_reset_n*/
679 rc = gpio_request(GPIO_BT_SYS_REST_EN, "bahama sys_rst_n");
680 if (rc < 0) {
681 pr_err("%s: gpio_request %d = %d\n", __func__,
682 GPIO_BT_SYS_REST_EN, rc);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530683 goto reg_disable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530684 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530685
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530686 rc = bt_set_gpio(1);
687 if (rc < 0) {
688 pr_err("%s: bt_set_gpio %d = %d\n", __func__,
689 GPIO_BT_SYS_REST_EN, rc);
690 goto gpio_fail;
691 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530692
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530693 return rc;
694
695gpio_fail:
696 gpio_free(GPIO_BT_SYS_REST_EN);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530697reg_disable:
698 regulator_disable(reg_s3);
699reg_fail:
700 regulator_put(reg_s3);
701out:
702 reg_s3 = NULL;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530703 return rc;
704}
705
706static unsigned int msm_bahama_shutdown_power(int value)
707{
708 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530709
Pankaj Kumar27c02642011-09-22 15:55:55 +0530710 if (IS_ERR_OR_NULL(reg_s3)) {
711 rc = reg_s3 ? PTR_ERR(reg_s3) : -ENODEV;
712 goto out;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530713 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530714
715 rc = regulator_disable(reg_s3);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530716 if (rc) {
Pankaj Kumar27c02642011-09-22 15:55:55 +0530717 pr_err("%s: could not disable regulator: %d\n", __func__, rc);
718 goto out;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530719 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530720
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530721 if (value == BAHAMA_ID) {
722 rc = bt_set_gpio(0);
723 if (rc) {
724 pr_err("%s: bt_set_gpio = %d\n",
725 __func__, rc);
Pankaj Kumar27c02642011-09-22 15:55:55 +0530726 goto reg_enable;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530727 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530728 gpio_free(GPIO_BT_SYS_REST_EN);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530729 }
Pankaj Kumar27c02642011-09-22 15:55:55 +0530730
731 regulator_put(reg_s3);
732 reg_s3 = NULL;
733
734 return 0;
735
736reg_enable:
737 regulator_enable(reg_s3);
738out:
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530739 return rc;
740}
741
742static unsigned int msm_bahama_core_config(int type)
743{
744 int rc = 0;
745
746 if (type == BAHAMA_ID) {
747 int i;
748 struct marimba config = { .mod_id = SLAVE_ID_BAHAMA};
749 const struct bahama_config_register v20_init[] = {
750 /* reg, value, mask */
751 { 0xF4, 0x84, 0xFF }, /* AREG */
752 { 0xF0, 0x04, 0xFF } /* DREG */
753 };
754 if (marimba_read_bahama_ver(&config) == BAHAMA_VER_2_0) {
755 for (i = 0; i < ARRAY_SIZE(v20_init); i++) {
756 u8 value = v20_init[i].value;
757 rc = marimba_write_bit_mask(&config,
758 v20_init[i].reg,
759 &value,
760 sizeof(v20_init[i].value),
761 v20_init[i].mask);
762 if (rc < 0) {
763 pr_err("%s: reg %d write failed: %d\n",
764 __func__, v20_init[i].reg, rc);
765 return rc;
766 }
767 pr_debug("%s: reg 0x%02x value 0x%02x"
768 " mask 0x%02x\n",
769 __func__, v20_init[i].reg,
770 v20_init[i].value, v20_init[i].mask);
771 }
772 }
773 }
774 rc = bt_set_gpio(0);
775 if (rc) {
776 pr_err("%s: bt_set_gpio = %d\n",
777 __func__, rc);
778 }
779 pr_debug("core type: %d\n", type);
780 return rc;
781}
782
783static int bluetooth_power(int on)
784{
785 int pin, rc = 0;
786 const char *id = "BTPW";
787 int cid = 0;
788
789 cid = adie_get_detected_connectivity_type();
790 if (cid != BAHAMA_ID) {
791 pr_err("%s: unexpected adie connectivity type: %d\n",
792 __func__, cid);
793 return -ENODEV;
794 }
795 if (on) {
796 /*setup power for BT SOC*/
797 rc = bt_set_gpio(on);
798 if (rc) {
799 pr_err("%s: bt_set_gpio = %d\n",
800 __func__, rc);
801 goto exit;
802 }
803 rc = bluetooth_switch_regulators(on);
804 if (rc < 0) {
805 pr_err("%s: bluetooth_switch_regulators rc = %d",
806 __func__, rc);
807 goto exit;
808 }
809 /*setup BT GPIO lines*/
810 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_on);
811 pin++) {
812 rc = gpio_tlmm_config(bt_config_power_on[pin],
813 GPIO_CFG_ENABLE);
814 if (rc < 0) {
815 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
816 __func__,
817 bt_config_power_on[pin],
818 rc);
819 goto fail_power;
820 }
821 }
822 /*Setup BT clocks*/
823 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
824 PMAPP_CLOCK_VOTE_ON);
825 if (rc < 0) {
826 pr_err("Failed to vote for TCXO_D1 ON\n");
827 goto fail_clock;
828 }
829 msleep(20);
830
831 /*I2C config for Bahama*/
832 rc = bahama_bt(1);
833 if (rc < 0) {
834 pr_err("%s: bahama_bt rc = %d", __func__, rc);
835 goto fail_i2c;
836 }
837 msleep(20);
838
839 /*setup BT PCM lines*/
840 rc = msm_bahama_setup_pcm_i2s(BT_PCM_ON);
841 if (rc < 0) {
842 pr_err("%s: msm_bahama_setup_pcm_i2s , rc =%d\n",
843 __func__, rc);
844 goto fail_power;
845 }
846 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
847 PMAPP_CLOCK_VOTE_PIN_CTRL);
848 if (rc < 0)
849 pr_err("%s:Pin Control Failed, rc = %d",
850 __func__, rc);
851
852 } else {
853 rc = bahama_bt(0);
854 if (rc < 0)
855 pr_err("%s: bahama_bt rc = %d", __func__, rc);
856
857 rc = bt_set_gpio(on);
858 if (rc) {
859 pr_err("%s: bt_set_gpio = %d\n",
860 __func__, rc);
861 }
862fail_i2c:
863 rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
864 PMAPP_CLOCK_VOTE_OFF);
865 if (rc < 0)
866 pr_err("%s: Failed to vote Off D1\n", __func__);
867fail_clock:
868 for (pin = 0; pin < ARRAY_SIZE(bt_config_power_off);
869 pin++) {
870 rc = gpio_tlmm_config(bt_config_power_off[pin],
871 GPIO_CFG_ENABLE);
872 if (rc < 0) {
873 pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
874 __func__, bt_config_power_off[pin], rc);
875 }
876 }
877 rc = msm_bahama_setup_pcm_i2s(BT_PCM_OFF);
878 if (rc < 0) {
879 pr_err("%s: msm_bahama_setup_pcm_i2s, rc =%d\n",
880 __func__, rc);
881 }
882fail_power:
883 rc = bluetooth_switch_regulators(0);
884 if (rc < 0) {
885 pr_err("%s: switch_regulators : rc = %d",\
886 __func__, rc);
887 goto exit;
888 }
889 }
890 return rc;
891exit:
892 pr_err("%s: failed with rc = %d", __func__, rc);
893 return rc;
894}
895
896static int __init bt_power_init(void)
897{
898 int i, rc = 0;
Pankaj Kumar27c02642011-09-22 15:55:55 +0530899 struct device *dev = &msm_bt_power_device.dev;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530900
Pankaj Kumar27c02642011-09-22 15:55:55 +0530901 for (i = 0; i < ARRAY_SIZE(bt_vregs); i++) {
902 bt_vregs[i].reg = regulator_get(dev, bt_vregs[i].name);
903 if (IS_ERR(bt_vregs[i].reg)) {
904 rc = PTR_ERR(bt_vregs[i].reg);
905 dev_err(dev, "%s: could not get regulator %s: %d\n",
906 __func__, bt_vregs[i].name, rc);
907 goto reg_get_fail;
908 }
909 }
910
911 dev->platform_data = &bluetooth_power;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530912
913 return rc;
914
Pankaj Kumar27c02642011-09-22 15:55:55 +0530915reg_get_fail:
916 while (i--) {
917 regulator_put(bt_vregs[i].reg);
918 bt_vregs[i].reg = NULL;
919 }
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530920 return rc;
921}
922
923static struct marimba_platform_data marimba_pdata = {
924 .slave_id[SLAVE_ID_BAHAMA_FM] = BAHAMA_SLAVE_ID_FM_ADDR,
925 .slave_id[SLAVE_ID_BAHAMA_QMEMBIST] = BAHAMA_SLAVE_ID_QMEMBIST_ADDR,
926 .bahama_setup = msm_bahama_setup_power,
927 .bahama_shutdown = msm_bahama_shutdown_power,
928 .bahama_core_config = msm_bahama_core_config,
929 .fm = &marimba_fm_pdata,
930};
931
932#endif
933
934#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
935static struct i2c_board_info bahama_devices[] = {
936{
937 I2C_BOARD_INFO("marimba", 0xc),
938 .platform_data = &marimba_pdata,
939},
940};
941#endif
942
943static struct msm_gpio qup_i2c_gpios_io[] = {
944 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
945 "qup_scl" },
946 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
947 "qup_sda" },
948 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
949 "qup_scl" },
950 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
951 "qup_sda" },
952};
953
954static struct msm_gpio qup_i2c_gpios_hw[] = {
955 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
956 "qup_scl" },
957 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
958 "qup_sda" },
959 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
960 "qup_scl" },
961 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
962 "qup_sda" },
963};
964
965static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
966{
967 int rc;
968
969 if (adap_id < 0 || adap_id > 1)
970 return;
971
972 /* Each adapter gets 2 lines from the table */
973 if (config_type)
974 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
975 else
976 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
977 if (rc < 0)
978 pr_err("QUP GPIO request/enable failed: %d\n", rc);
979}
980
981static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
982 .clk_freq = 100000,
983 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
984};
985
986static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
987 .clk_freq = 100000,
988 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
989};
990
991#ifdef CONFIG_ARCH_MSM7X27A
992#define MSM_PMEM_MDP_SIZE 0x1DD1000
993#define MSM_PMEM_ADSP_SIZE 0x1000000
994
995#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
996#define MSM_FB_SIZE 0x260000
997#else
998#define MSM_FB_SIZE 0x195000
999#endif
1000
1001#endif
1002
Taniya Dasda408822011-09-06 12:54:06 +05301003#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \
1004defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE)
1005
1006#ifndef CLEARPAD3000_ATTEN_GPIO
1007#define CLEARPAD3000_ATTEN_GPIO (48)
1008#endif
1009
1010#ifndef CLEARPAD3000_RESET_GPIO
1011#define CLEARPAD3000_RESET_GPIO (26)
1012#endif
1013
1014static int synaptics_touchpad_setup(void);
1015
1016static struct msm_gpio clearpad3000_cfg_data[] = {
1017 {GPIO_CFG(CLEARPAD3000_ATTEN_GPIO, 0, GPIO_CFG_INPUT,
1018 GPIO_CFG_NO_PULL, GPIO_CFG_6MA), "rmi4_attn"},
1019 {GPIO_CFG(CLEARPAD3000_RESET_GPIO, 0, GPIO_CFG_OUTPUT,
1020 GPIO_CFG_PULL_DOWN, GPIO_CFG_8MA), "rmi4_reset"},
1021};
1022
1023static struct rmi_XY_pair rmi_offset = {.x = 0, .y = 0};
1024static struct rmi_range rmi_clipx = {.min = 48, .max = 980};
1025static struct rmi_range rmi_clipy = {.min = 7, .max = 1647};
1026static struct rmi_f11_functiondata synaptics_f11_data = {
1027 .swap_axes = false,
1028 .flipX = false,
1029 .flipY = false,
1030 .offset = &rmi_offset,
1031 .button_height = 113,
1032 .clipX = &rmi_clipx,
1033 .clipY = &rmi_clipy,
1034};
1035
1036#define MAX_LEN 100
1037
1038static ssize_t clearpad3000_virtual_keys_register(struct kobject *kobj,
1039 struct kobj_attribute *attr, char *buf)
1040{
1041 char *virtual_keys = __stringify(EV_KEY) ":" __stringify(KEY_MENU) \
1042 ":60:830:120:60" ":" __stringify(EV_KEY) \
1043 ":" __stringify(KEY_HOME) ":180:830:120:60" \
1044 ":" __stringify(EV_KEY) ":" \
1045 __stringify(KEY_SEARCH) ":300:830:120:60" \
1046 ":" __stringify(EV_KEY) ":" \
1047 __stringify(KEY_BACK) ":420:830:120:60" "\n";
1048
1049 return snprintf(buf, strnlen(virtual_keys, MAX_LEN) + 1 , "%s",
1050 virtual_keys);
1051}
1052
1053static struct kobj_attribute clearpad3000_virtual_keys_attr = {
1054 .attr = {
1055 .name = "virtualkeys.sensor00fn11",
1056 .mode = S_IRUGO,
1057 },
1058 .show = &clearpad3000_virtual_keys_register,
1059};
1060
1061static struct attribute *virtual_key_properties_attrs[] = {
1062 &clearpad3000_virtual_keys_attr.attr,
1063 NULL
1064};
1065
1066static struct attribute_group virtual_key_properties_attr_group = {
1067 .attrs = virtual_key_properties_attrs,
1068};
1069
1070struct kobject *virtual_key_properties_kobj;
1071
1072static struct rmi_functiondata synaptics_functiondata[] = {
1073 {
1074 .function_index = RMI_F11_INDEX,
1075 .data = &synaptics_f11_data,
1076 },
1077};
1078
1079static struct rmi_functiondata_list synaptics_perfunctiondata = {
1080 .count = ARRAY_SIZE(synaptics_functiondata),
1081 .functiondata = synaptics_functiondata,
1082};
1083
1084static struct rmi_sensordata synaptics_sensordata = {
1085 .perfunctiondata = &synaptics_perfunctiondata,
1086 .rmi_sensor_setup = synaptics_touchpad_setup,
1087};
1088
1089static struct rmi_i2c_platformdata synaptics_platformdata = {
1090 .i2c_address = 0x2c,
1091 .irq_type = IORESOURCE_IRQ_LOWLEVEL,
1092 .sensordata = &synaptics_sensordata,
1093};
1094
1095static struct i2c_board_info synaptic_i2c_clearpad3k[] = {
1096 {
1097 I2C_BOARD_INFO("rmi4_ts", 0x2c),
1098 .platform_data = &synaptics_platformdata,
1099 },
1100};
1101
1102static int synaptics_touchpad_setup(void)
1103{
1104 int retval = 0;
1105
1106 virtual_key_properties_kobj =
1107 kobject_create_and_add("board_properties", NULL);
1108 if (virtual_key_properties_kobj)
1109 retval = sysfs_create_group(virtual_key_properties_kobj,
1110 &virtual_key_properties_attr_group);
1111 if (!virtual_key_properties_kobj || retval)
1112 pr_err("failed to create ft5202 board_properties\n");
1113
1114 retval = msm_gpios_request_enable(clearpad3000_cfg_data,
1115 sizeof(clearpad3000_cfg_data)/sizeof(struct msm_gpio));
1116 if (retval) {
1117 pr_err("%s:Failed to obtain touchpad GPIO %d. Code: %d.",
1118 __func__, CLEARPAD3000_ATTEN_GPIO, retval);
1119 retval = 0; /* ignore the err */
1120 }
1121 synaptics_platformdata.irq = gpio_to_irq(CLEARPAD3000_ATTEN_GPIO);
1122
1123 gpio_set_value(CLEARPAD3000_RESET_GPIO, 0);
1124 usleep(10000);
1125 gpio_set_value(CLEARPAD3000_RESET_GPIO, 1);
1126 usleep(50000);
1127
1128 return retval;
1129}
1130#endif
1131
1132
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301133static struct android_usb_platform_data android_usb_pdata = {
Pankaj Kumar6f841742011-10-10 15:52:14 +05301134 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301135};
1136
1137static struct platform_device android_usb_device = {
1138 .name = "android_usb",
1139 .id = -1,
1140 .dev = {
1141 .platform_data = &android_usb_pdata,
1142 },
1143};
1144
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301145#ifdef CONFIG_USB_EHCI_MSM_72K
1146static void msm_hsusb_vbus_power(unsigned phy_info, int on)
1147{
1148 int rc = 0;
1149 unsigned gpio;
1150
1151 gpio = GPIO_HOST_VBUS_EN;
1152
1153 rc = gpio_request(gpio, "i2c_host_vbus_en");
1154 if (rc < 0) {
1155 pr_err("failed to request %d GPIO\n", gpio);
1156 return;
1157 }
1158 gpio_direction_output(gpio, !!on);
1159 gpio_set_value_cansleep(gpio, !!on);
1160 gpio_free(gpio);
1161}
1162
1163static struct msm_usb_host_platform_data msm_usb_host_pdata = {
1164 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
1165};
1166
1167static void __init msm7627a_init_host(void)
1168{
1169 msm_add_host(0, &msm_usb_host_pdata);
1170}
1171#endif
1172
1173#ifdef CONFIG_USB_MSM_OTG_72K
1174static int hsusb_rpc_connect(int connect)
1175{
1176 if (connect)
1177 return msm_hsusb_rpc_connect();
1178 else
1179 return msm_hsusb_rpc_close();
1180}
1181
Pankaj Kumar27c02642011-09-22 15:55:55 +05301182static struct regulator *reg_hsusb;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301183static int msm_hsusb_ldo_init(int init)
1184{
Pankaj Kumar27c02642011-09-22 15:55:55 +05301185 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301186
Pankaj Kumar27c02642011-09-22 15:55:55 +05301187 if (init) {
1188 reg_hsusb = regulator_get(NULL, "usb");
1189 if (IS_ERR(reg_hsusb)) {
1190 rc = PTR_ERR(reg_hsusb);
1191 pr_err("%s: could not get regulator: %d\n",
1192 __func__, rc);
1193 goto out;
1194 }
1195
1196 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
1197 if (rc) {
1198 pr_err("%s: could not set voltage: %d\n",
1199 __func__, rc);
1200 goto reg_free;
1201 }
1202
1203 return 0;
1204 }
1205 /* else fall through */
1206reg_free:
1207 regulator_put(reg_hsusb);
1208out:
1209 reg_hsusb = NULL;
1210 return rc;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301211}
1212
1213static int msm_hsusb_ldo_enable(int enable)
1214{
1215 static int ldo_status;
1216
Pankaj Kumar27c02642011-09-22 15:55:55 +05301217 if (IS_ERR_OR_NULL(reg_hsusb))
1218 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301219
1220 if (ldo_status == enable)
1221 return 0;
1222
1223 ldo_status = enable;
1224
Pankaj Kumar27c02642011-09-22 15:55:55 +05301225 return enable ?
1226 regulator_enable(reg_hsusb) :
1227 regulator_disable(reg_hsusb);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301228}
1229
1230#ifndef CONFIG_USB_EHCI_MSM_72K
1231static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
1232{
1233 int ret = 0;
1234
1235 if (init)
1236 ret = msm_pm_app_rpc_init(callback);
1237 else
1238 msm_pm_app_rpc_deinit(callback);
1239
1240 return ret;
1241}
1242#endif
1243
1244static struct msm_otg_platform_data msm_otg_pdata = {
1245#ifndef CONFIG_USB_EHCI_MSM_72K
1246 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
1247#else
1248 .vbus_power = msm_hsusb_vbus_power,
1249#endif
1250 .rpc_connect = hsusb_rpc_connect,
1251 .core_clk = 1,
1252 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
1253 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
1254 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
1255 .se1_gating = SE1_GATING_DISABLE,
1256 .ldo_init = msm_hsusb_ldo_init,
1257 .ldo_enable = msm_hsusb_ldo_enable,
1258 .chg_init = hsusb_chg_init,
1259 .chg_connected = hsusb_chg_connected,
1260 .chg_vbus_draw = hsusb_chg_vbus_draw,
1261};
1262#endif
1263
1264static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
1265 .is_phy_status_timer_on = 1,
1266};
1267
1268#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
1269 || defined(CONFIG_MMC_MSM_SDC2_SUPPORT)\
1270 || defined(CONFIG_MMC_MSM_SDC3_SUPPORT)\
1271 || defined(CONFIG_MMC_MSM_SDC4_SUPPORT))
1272
1273static unsigned long vreg_sts, gpio_sts;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301274
1275struct sdcc_gpio {
1276 struct msm_gpio *cfg_data;
1277 uint32_t size;
1278 struct msm_gpio *sleep_cfg_data;
1279};
1280
1281/**
1282 * Due to insufficient drive strengths for SDC GPIO lines some old versioned
1283 * SD/MMC cards may cause data CRC errors. Hence, set optimal values
1284 * for SDC slots based on timing closure and marginality. SDC1 slot
1285 * require higher value since it should handle bad signal quality due
1286 * to size of T-flash adapters.
1287 */
1288static struct msm_gpio sdc1_cfg_data[] = {
1289 {GPIO_CFG(51, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1290 "sdc1_dat_3"},
1291 {GPIO_CFG(52, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1292 "sdc1_dat_2"},
1293 {GPIO_CFG(53, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1294 "sdc1_dat_1"},
1295 {GPIO_CFG(54, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1296 "sdc1_dat_0"},
1297 {GPIO_CFG(55, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_14MA),
1298 "sdc1_cmd"},
1299 {GPIO_CFG(56, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_14MA),
1300 "sdc1_clk"},
1301};
1302
1303static struct msm_gpio sdc2_cfg_data[] = {
1304 {GPIO_CFG(62, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1305 "sdc2_clk"},
1306 {GPIO_CFG(63, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1307 "sdc2_cmd"},
1308 {GPIO_CFG(64, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1309 "sdc2_dat_3"},
1310 {GPIO_CFG(65, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1311 "sdc2_dat_2"},
1312 {GPIO_CFG(66, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1313 "sdc2_dat_1"},
1314 {GPIO_CFG(67, 2, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1315 "sdc2_dat_0"},
1316};
1317
1318static struct msm_gpio sdc2_sleep_cfg_data[] = {
1319 {GPIO_CFG(62, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1320 "sdc2_clk"},
1321 {GPIO_CFG(63, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1322 "sdc2_cmd"},
1323 {GPIO_CFG(64, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1324 "sdc2_dat_3"},
1325 {GPIO_CFG(65, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1326 "sdc2_dat_2"},
1327 {GPIO_CFG(66, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1328 "sdc2_dat_1"},
1329 {GPIO_CFG(67, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1330 "sdc2_dat_0"},
1331};
1332static struct msm_gpio sdc3_cfg_data[] = {
1333 {GPIO_CFG(88, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1334 "sdc3_clk"},
1335 {GPIO_CFG(89, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1336 "sdc3_cmd"},
1337 {GPIO_CFG(90, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1338 "sdc3_dat_3"},
1339 {GPIO_CFG(91, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1340 "sdc3_dat_2"},
1341 {GPIO_CFG(92, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1342 "sdc3_dat_1"},
1343 {GPIO_CFG(93, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1344 "sdc3_dat_0"},
1345#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
1346 {GPIO_CFG(19, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1347 "sdc3_dat_7"},
1348 {GPIO_CFG(20, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1349 "sdc3_dat_6"},
1350 {GPIO_CFG(21, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1351 "sdc3_dat_5"},
1352 {GPIO_CFG(108, 3, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1353 "sdc3_dat_4"},
1354#endif
1355};
1356
1357static struct msm_gpio sdc4_cfg_data[] = {
1358 {GPIO_CFG(19, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1359 "sdc4_dat_3"},
1360 {GPIO_CFG(20, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1361 "sdc4_dat_2"},
1362 {GPIO_CFG(21, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1363 "sdc4_dat_1"},
1364 {GPIO_CFG(107, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1365 "sdc4_cmd"},
1366 {GPIO_CFG(108, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_10MA),
1367 "sdc4_dat_0"},
1368 {GPIO_CFG(109, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
1369 "sdc4_clk"},
1370};
1371
1372static struct sdcc_gpio sdcc_cfg_data[] = {
1373 {
1374 .cfg_data = sdc1_cfg_data,
1375 .size = ARRAY_SIZE(sdc1_cfg_data),
1376 },
1377 {
1378 .cfg_data = sdc2_cfg_data,
1379 .size = ARRAY_SIZE(sdc2_cfg_data),
1380 .sleep_cfg_data = sdc2_sleep_cfg_data,
1381 },
1382 {
1383 .cfg_data = sdc3_cfg_data,
1384 .size = ARRAY_SIZE(sdc3_cfg_data),
1385 },
1386 {
1387 .cfg_data = sdc4_cfg_data,
1388 .size = ARRAY_SIZE(sdc4_cfg_data),
1389 },
1390};
1391
Pankaj Kumar27c02642011-09-22 15:55:55 +05301392static struct regulator *sdcc_vreg_data[ARRAY_SIZE(sdcc_cfg_data)];
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301393static int msm_sdcc_setup_gpio(int dev_id, unsigned int enable)
1394{
1395 int rc = 0;
1396 struct sdcc_gpio *curr;
1397
1398 curr = &sdcc_cfg_data[dev_id - 1];
1399 if (!(test_bit(dev_id, &gpio_sts)^enable))
1400 return rc;
1401
1402 if (enable) {
1403 set_bit(dev_id, &gpio_sts);
1404 rc = msm_gpios_request_enable(curr->cfg_data, curr->size);
1405 if (rc)
1406 pr_err("%s: Failed to turn on GPIOs for slot %d\n",
1407 __func__, dev_id);
1408 } else {
1409 clear_bit(dev_id, &gpio_sts);
1410 if (curr->sleep_cfg_data) {
1411 rc = msm_gpios_enable(curr->sleep_cfg_data, curr->size);
1412 msm_gpios_free(curr->sleep_cfg_data, curr->size);
1413 return rc;
1414 }
1415 msm_gpios_disable_free(curr->cfg_data, curr->size);
1416 }
1417 return rc;
1418}
1419
1420static int msm_sdcc_setup_vreg(int dev_id, unsigned int enable)
1421{
1422 int rc = 0;
Pankaj Kumar27c02642011-09-22 15:55:55 +05301423 struct regulator *curr = sdcc_vreg_data[dev_id - 1];
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301424
Pankaj Kumar27c02642011-09-22 15:55:55 +05301425 if (test_bit(dev_id, &vreg_sts) == enable)
1426 return 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301427
Pankaj Kumar27c02642011-09-22 15:55:55 +05301428 if (!curr)
1429 return -ENODEV;
1430
1431 if (IS_ERR(curr))
1432 return PTR_ERR(curr);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301433
1434 if (enable) {
1435 set_bit(dev_id, &vreg_sts);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301436
Pankaj Kumar27c02642011-09-22 15:55:55 +05301437 rc = regulator_enable(curr);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301438 if (rc)
Pankaj Kumar27c02642011-09-22 15:55:55 +05301439 pr_err("%s: could not enable regulator: %d\n",
1440 __func__, rc);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301441 } else {
1442 clear_bit(dev_id, &vreg_sts);
Pankaj Kumar27c02642011-09-22 15:55:55 +05301443
1444 rc = regulator_disable(curr);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301445 if (rc)
Pankaj Kumar27c02642011-09-22 15:55:55 +05301446 pr_err("%s: could not disable regulator: %d\n",
1447 __func__, rc);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301448 }
1449 return rc;
1450}
1451
1452static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
1453{
1454 int rc = 0;
1455 struct platform_device *pdev;
1456
1457 pdev = container_of(dv, struct platform_device, dev);
1458
1459 rc = msm_sdcc_setup_gpio(pdev->id, !!vdd);
1460 if (rc)
1461 goto out;
1462
1463 rc = msm_sdcc_setup_vreg(pdev->id, !!vdd);
1464out:
1465 return rc;
1466}
1467
Sujit Reddy Thumma535c9e32011-10-28 09:45:33 +05301468#define GPIO_SDC1_HW_DET 42
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301469
1470#if defined(CONFIG_MMC_MSM_SDC1_SUPPORT) \
1471 && defined(CONFIG_MMC_MSM_CARD_HW_DETECTION)
1472static unsigned int msm7627a_sdcc_slot_status(struct device *dev)
1473{
1474 int status;
1475
1476 status = gpio_tlmm_config(GPIO_CFG(GPIO_SDC1_HW_DET, 2, GPIO_CFG_INPUT,
1477 GPIO_CFG_PULL_UP, GPIO_CFG_8MA), GPIO_CFG_ENABLE);
1478 if (status)
1479 pr_err("%s:Failed to configure tlmm for GPIO %d\n", __func__,
1480 GPIO_SDC1_HW_DET);
1481
1482 status = gpio_request(GPIO_SDC1_HW_DET, "SD_HW_Detect");
1483 if (status) {
1484 pr_err("%s:Failed to request GPIO %d\n", __func__,
1485 GPIO_SDC1_HW_DET);
1486 } else {
1487 status = gpio_direction_input(GPIO_SDC1_HW_DET);
1488 if (!status)
Sujit Reddy Thumma535c9e32011-10-28 09:45:33 +05301489 status = !gpio_get_value(GPIO_SDC1_HW_DET);
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301490 gpio_free(GPIO_SDC1_HW_DET);
1491 }
1492 return status;
1493}
1494#endif
1495
1496#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1497static struct mmc_platform_data sdc1_plat_data = {
1498 .ocr_mask = MMC_VDD_28_29,
1499 .translate_vdd = msm_sdcc_setup_power,
1500 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1501 .msmsdcc_fmin = 144000,
1502 .msmsdcc_fmid = 24576000,
1503 .msmsdcc_fmax = 49152000,
1504#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
1505 .status = msm7627a_sdcc_slot_status,
1506 .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET),
1507 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
1508#endif
1509};
1510#endif
1511
1512#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
1513static struct mmc_platform_data sdc2_plat_data = {
1514 /*
1515 * SDC2 supports only 1.8V, claim for 2.85V range is just
1516 * for allowing buggy cards who advertise 2.8V even though
1517 * they can operate at 1.8V supply.
1518 */
1519 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_165_195,
1520 .translate_vdd = msm_sdcc_setup_power,
1521 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1522#ifdef CONFIG_MMC_MSM_SDIO_SUPPORT
1523 .sdiowakeup_irq = MSM_GPIO_TO_INT(66),
1524#endif
1525 .msmsdcc_fmin = 144000,
1526 .msmsdcc_fmid = 24576000,
1527 .msmsdcc_fmax = 49152000,
1528#ifdef CONFIG_MMC_MSM_SDC2_DUMMY52_REQUIRED
1529 .dummy52_required = 1,
1530#endif
1531};
1532#endif
1533
1534#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1535static struct mmc_platform_data sdc3_plat_data = {
1536 .ocr_mask = MMC_VDD_28_29,
1537 .translate_vdd = msm_sdcc_setup_power,
1538#ifdef CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT
1539 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
1540#else
1541 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1542#endif
1543 .msmsdcc_fmin = 144000,
1544 .msmsdcc_fmid = 24576000,
1545 .msmsdcc_fmax = 49152000,
1546 .nonremovable = 1,
1547};
1548#endif
1549
1550#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1551 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
1552static struct mmc_platform_data sdc4_plat_data = {
1553 .ocr_mask = MMC_VDD_28_29,
1554 .translate_vdd = msm_sdcc_setup_power,
1555 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1556 .msmsdcc_fmin = 144000,
1557 .msmsdcc_fmid = 24576000,
1558 .msmsdcc_fmax = 49152000,
1559};
1560#endif
1561#endif
1562
1563#ifdef CONFIG_SERIAL_MSM_HS
1564static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
1565 .inject_rx_on_wakeup = 1,
1566 .rx_to_inject = 0xFD,
1567};
1568#endif
1569static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
1570 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
1571 .idle_supported = 1,
1572 .suspend_supported = 1,
1573 .idle_enabled = 1,
1574 .suspend_enabled = 1,
1575 .latency = 16000,
1576 .residency = 20000,
1577 },
1578 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
1579 .idle_supported = 1,
1580 .suspend_supported = 1,
1581 .idle_enabled = 1,
1582 .suspend_enabled = 1,
1583 .latency = 12000,
1584 .residency = 20000,
1585 },
1586 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
1587 .idle_supported = 1,
1588 .suspend_supported = 1,
1589 .idle_enabled = 0,
1590 .suspend_enabled = 1,
1591 .latency = 2000,
1592 .residency = 0,
1593 },
1594 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
1595 .idle_supported = 1,
1596 .suspend_supported = 1,
1597 .idle_enabled = 1,
1598 .suspend_enabled = 1,
1599 .latency = 2,
1600 .residency = 0,
1601 },
1602};
1603
1604static struct android_pmem_platform_data android_pmem_adsp_pdata = {
1605 .name = "pmem_adsp",
1606 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
1607 .cached = 1,
1608 .memory_type = MEMTYPE_EBI1,
1609};
1610
1611static struct platform_device android_pmem_adsp_device = {
1612 .name = "android_pmem",
1613 .id = 1,
1614 .dev = { .platform_data = &android_pmem_adsp_pdata },
1615};
1616
1617static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
1618static int __init pmem_mdp_size_setup(char *p)
1619{
1620 pmem_mdp_size = memparse(p, NULL);
1621 return 0;
1622}
1623
1624early_param("pmem_mdp_size", pmem_mdp_size_setup);
1625
1626static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
1627static int __init pmem_adsp_size_setup(char *p)
1628{
1629 pmem_adsp_size = memparse(p, NULL);
1630 return 0;
1631}
1632
1633early_param("pmem_adsp_size", pmem_adsp_size_setup);
1634
1635static unsigned fb_size = MSM_FB_SIZE;
1636static int __init fb_size_setup(char *p)
1637{
1638 fb_size = memparse(p, NULL);
1639 return 0;
1640}
1641
1642early_param("fb_size", fb_size_setup);
1643
Taniya Das0a5303a2011-08-23 18:47:48 +05301644static struct resource msm_fb_resources[] = {
1645 {
1646 .flags = IORESOURCE_DMA,
1647 }
1648};
1649
1650static int msm_fb_detect_panel(const char *name)
1651{
1652 int ret;
1653
1654 if (!strncmp(name, "mipi_video_truly_wvga", 21))
1655 ret = 0;
1656 else
1657 ret = -ENODEV;
1658
1659 return ret;
1660}
1661
1662static int mipi_truly_set_bl(int on)
1663{
1664 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, !!on);
1665
1666 return 1;
1667}
1668
1669static struct msm_fb_platform_data msm_fb_pdata = {
1670 .detect_client = msm_fb_detect_panel,
1671};
1672
1673static struct platform_device msm_fb_device = {
1674 .name = "msm_fb",
1675 .id = 0,
1676 .num_resources = ARRAY_SIZE(msm_fb_resources),
1677 .resource = msm_fb_resources,
1678 .dev = {
1679 .platform_data = &msm_fb_pdata,
1680 }
1681};
1682
1683static struct msm_panel_common_pdata mipi_truly_pdata = {
1684 .pmic_backlight = mipi_truly_set_bl,
1685};
1686
1687static struct platform_device mipi_dsi_truly_panel_device = {
1688 .name = "mipi_truly",
1689 .id = 0,
1690 .dev = {
1691 .platform_data = &mipi_truly_pdata,
1692 }
1693};
1694
Pankaj Kumar27c02642011-09-22 15:55:55 +05301695static int __init mmc_regulator_init(int sdcc_no, const char *supply, int uV)
1696{
1697 int rc;
1698
1699 BUG_ON(sdcc_no < 1 || sdcc_no > 4);
1700
1701 sdcc_no--;
1702
1703 sdcc_vreg_data[sdcc_no] = regulator_get(NULL, supply);
1704
1705 if (IS_ERR(sdcc_vreg_data[sdcc_no])) {
1706 rc = PTR_ERR(sdcc_vreg_data[sdcc_no]);
1707 pr_err("%s: could not get regulator \"%s\": %d\n",
1708 __func__, supply, rc);
1709 goto out;
1710 }
1711
1712 rc = regulator_set_voltage(sdcc_vreg_data[sdcc_no], uV, uV);
1713
1714 if (rc) {
1715 pr_err("%s: could not set voltage for \"%s\" to %d uV: %d\n",
1716 __func__, supply, uV, rc);
1717 goto reg_free;
1718 }
1719
1720 return rc;
1721
1722reg_free:
1723 regulator_put(sdcc_vreg_data[sdcc_no]);
1724out:
1725 sdcc_vreg_data[sdcc_no] = NULL;
1726 return rc;
1727}
1728
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301729static void __init msm7627a_init_mmc(void)
1730{
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301731 /* eMMC slot */
1732#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
Pankaj Kumar27c02642011-09-22 15:55:55 +05301733 if (mmc_regulator_init(3, "emmc", 3000000))
1734 return;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301735 msm_add_sdcc(3, &sdc3_plat_data);
1736#endif
1737 /* Micro-SD slot */
1738#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
Pankaj Kumar27c02642011-09-22 15:55:55 +05301739 if (mmc_regulator_init(1, "mmc", 2850000))
1740 return;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301741 msm_add_sdcc(1, &sdc1_plat_data);
1742#endif
1743 /* SDIO WLAN slot */
1744#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
Pankaj Kumar27c02642011-09-22 15:55:55 +05301745 if (mmc_regulator_init(2, "mmc", 2850000))
1746 return;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301747 msm_add_sdcc(2, &sdc2_plat_data);
1748#endif
1749 /* Not Used */
1750#if (defined(CONFIG_MMC_MSM_SDC4_SUPPORT)\
1751 && !defined(CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT))
Pankaj Kumar27c02642011-09-22 15:55:55 +05301752 if (mmc_regulator_init(4, "mmc", 2850000))
1753 return;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301754 msm_add_sdcc(4, &sdc4_plat_data);
1755#endif
1756}
1757
1758#define SND(desc, num) { .name = #desc, .id = num }
1759static struct snd_endpoint snd_endpoints_list[] = {
1760 SND(HANDSET, 0),
1761 SND(MONO_HEADSET, 2),
1762 SND(HEADSET, 3),
1763 SND(SPEAKER, 6),
1764 SND(TTY_HEADSET, 8),
1765 SND(TTY_VCO, 9),
1766 SND(TTY_HCO, 10),
1767 SND(BT, 12),
1768 SND(IN_S_SADC_OUT_HANDSET, 16),
1769 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
1770 SND(FM_DIGITAL_STEREO_HEADSET, 26),
1771 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
1772 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +05301773 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Phani Kumar Alladad6971252011-10-19 10:50:15 +05301774 SND(CURRENT, 0x7FFFFFFE),
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301775 SND(FM_ANALOG_STEREO_HEADSET, 35),
1776 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
1777};
1778#undef SND
1779
1780static struct msm_snd_endpoints msm_device_snd_endpoints = {
1781 .endpoints = snd_endpoints_list,
1782 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
1783};
1784
1785static struct platform_device msm_device_snd = {
1786 .name = "msm_snd",
1787 .id = -1,
1788 .dev = {
1789 .platform_data = &msm_device_snd_endpoints
1790 },
1791};
1792
1793#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1794 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1795 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1796 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1797 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1798 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1799#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1800 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1801 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1802 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1803 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1804 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1805#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1806 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1807 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1808 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1809 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1810 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1811#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
1812 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
1813 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
1814 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
1815 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
1816 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
1817#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
1818
1819static unsigned int dec_concurrency_table[] = {
1820 /* Audio LP */
1821 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
1822 0, 0, 0,
1823
1824 /* Concurrency 1 */
1825 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1826 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1827 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1828 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1829 (DEC4_FORMAT),
1830
1831 /* Concurrency 2 */
1832 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1833 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1834 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1835 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1836 (DEC4_FORMAT),
1837
1838 /* Concurrency 3 */
1839 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1840 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1841 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1842 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1843 (DEC4_FORMAT),
1844
1845 /* Concurrency 4 */
1846 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1847 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1848 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1849 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1850 (DEC4_FORMAT),
1851
1852 /* Concurrency 5 */
1853 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
1854 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1855 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1856 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1857 (DEC4_FORMAT),
1858
1859 /* Concurrency 6 */
1860 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1861 0, 0, 0, 0,
1862
1863 /* Concurrency 7 */
1864 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1865 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1866 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1867 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
1868 (DEC4_FORMAT),
1869};
1870
1871#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
1872 .module_queueid = queueid, .module_decid = decid, \
1873 .nr_codec_support = nr_codec}
1874
1875static struct msm_adspdec_info dec_info_list[] = {
1876 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
1877 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
1878 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
1879 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
1880 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
1881};
1882
1883static struct msm_adspdec_database msm_device_adspdec_database = {
1884 .num_dec = ARRAY_SIZE(dec_info_list),
1885 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
1886 ARRAY_SIZE(dec_info_list)),
1887 .dec_concurrency_table = dec_concurrency_table,
1888 .dec_info_list = dec_info_list,
1889};
1890
1891static struct platform_device msm_device_adspdec = {
1892 .name = "msm_adspdec",
1893 .id = -1,
1894 .dev = {
1895 .platform_data = &msm_device_adspdec_database
1896 },
1897};
1898
1899static struct android_pmem_platform_data android_pmem_audio_pdata = {
1900 .name = "pmem_audio",
1901 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
1902 .cached = 0,
1903 .memory_type = MEMTYPE_EBI1,
1904};
1905
1906static struct platform_device android_pmem_audio_device = {
1907 .name = "android_pmem",
1908 .id = 2,
1909 .dev = { .platform_data = &android_pmem_audio_pdata },
1910};
1911
1912static struct android_pmem_platform_data android_pmem_pdata = {
1913 .name = "pmem",
1914 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
1915 .cached = 1,
1916 .memory_type = MEMTYPE_EBI1,
1917};
1918static struct platform_device android_pmem_device = {
1919 .name = "android_pmem",
1920 .id = 0,
1921 .dev = { .platform_data = &android_pmem_pdata },
1922};
1923
1924static u32 msm_calculate_batt_capacity(u32 current_voltage);
1925
1926static struct msm_psy_batt_pdata msm_psy_batt_data = {
1927 .voltage_min_design = 2800,
1928 .voltage_max_design = 4300,
1929 .avail_chg_sources = AC_CHG | USB_CHG ,
1930 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
1931 .calculate_capacity = &msm_calculate_batt_capacity,
1932};
1933
1934static u32 msm_calculate_batt_capacity(u32 current_voltage)
1935{
1936 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
1937 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
1938
1939 return (current_voltage - low_voltage) * 100
1940 / (high_voltage - low_voltage);
1941}
1942
1943static struct platform_device msm_batt_device = {
1944 .name = "msm-battery",
1945 .id = -1,
1946 .dev.platform_data = &msm_psy_batt_data,
1947};
1948
Taniya Das7a22cdd2011-09-08 14:57:00 +05301949#ifdef CONFIG_MSM_CAMERA
1950static uint32_t camera_off_gpio_table[] = {
1951 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1952};
1953
1954static uint32_t camera_on_gpio_table[] = {
1955 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
1956};
1957
1958static void qrd1_camera_gpio_cfg(void)
1959{
1960
1961 int rc = 0;
1962
1963 rc = gpio_request(GPIO_CAM_5MP_SHDN_EN, "ov5640");
1964 if (rc < 0)
1965 pr_err("%s: gpio_request---GPIO_CAM_5MP_SHDN_EN failed!",
1966 __func__);
1967
1968
1969 rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_5MP_SHDN_EN, 0,
1970 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
1971 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
1972 if (rc < 0) {
1973 pr_err("%s: unable to enable Power Down gpio for main"
1974 "camera!\n", __func__);
1975 gpio_free(GPIO_CAM_5MP_SHDN_EN);
1976 }
1977
1978
1979 rc = gpio_request(GPIO_CAM_5MP_RESET, "ov5640");
1980 if (rc < 0) {
1981 pr_err("%s: gpio_request---GPIO_CAM_5MP_RESET failed!",
1982 __func__);
1983 gpio_free(GPIO_CAM_5MP_SHDN_EN);
1984 }
1985
1986
1987 rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_5MP_RESET, 0,
1988 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
1989 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
1990 if (rc < 0) {
1991 pr_err("%s: unable to enable reset gpio for main camera!\n",
1992 __func__);
1993 gpio_free(GPIO_CAM_5MP_RESET);
1994 }
1995
1996 rc = gpio_request(GPIO_CAM_3MP_PWDN, "ov7692");
1997 if (rc < 0)
1998 pr_err("%s: gpio_request---GPIO_CAM_3MP_PWDN failed!",
1999 __func__);
2000
2001 rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_3MP_PWDN, 0,
2002 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
2003 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
2004 if (rc < 0) {
2005 pr_err("%s: unable to enable Power Down gpio for front"
2006 "camera!\n", __func__);
2007 gpio_free(GPIO_CAM_3MP_PWDN);
2008 }
2009
2010 gpio_direction_output(GPIO_CAM_5MP_SHDN_EN, 1);
2011 gpio_direction_output(GPIO_CAM_5MP_RESET, 1);
2012 gpio_direction_output(GPIO_CAM_3MP_PWDN, 1);
2013}
2014
2015#endif
Pankaj Kumar27c02642011-09-22 15:55:55 +05302016static struct regulator_bulk_data regs_camera[] = {
2017 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
2018 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
2019 { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
2020};
2021
2022static void __init msm_camera_vreg_init(void)
Taniya Das7a22cdd2011-09-08 14:57:00 +05302023{
2024 int rc;
2025
Pankaj Kumar27c02642011-09-22 15:55:55 +05302026 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
2027 if (rc) {
2028 pr_err("%s: could not get regulators: %d\n", __func__, rc);
2029 return;
Taniya Das7a22cdd2011-09-08 14:57:00 +05302030 }
2031
Pankaj Kumar27c02642011-09-22 15:55:55 +05302032 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
2033 if (rc) {
2034 pr_err("%s: could not set voltages: %d\n", __func__, rc);
2035 return;
Taniya Das7a22cdd2011-09-08 14:57:00 +05302036 }
2037}
2038
Pankaj Kumar27c02642011-09-22 15:55:55 +05302039static void msm_camera_vreg_config(int vreg_en)
2040{
2041 int rc = vreg_en ?
2042 regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
2043 regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
2044
2045 if (rc)
2046 pr_err("%s: could not %sable regulators: %d\n",
2047 __func__, vreg_en ? "en" : "dis", rc);
2048}
Taniya Das7a22cdd2011-09-08 14:57:00 +05302049static int config_gpio_table(uint32_t *table, int len)
2050{
2051 int rc = 0, i = 0;
2052
2053 for (i = 0; i < len; i++) {
2054 rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
2055 if (rc) {
2056 pr_err("%s not able to get gpio\n", __func__);
2057 for (i--; i >= 0; i--)
2058 gpio_tlmm_config(camera_off_gpio_table[i],
2059 GPIO_CFG_ENABLE);
2060 break;
2061 }
2062 }
2063 return rc;
2064}
2065
2066static int config_camera_on_gpios_rear(void)
2067{
2068 int rc = 0;
2069
2070 msm_camera_vreg_config(1);
2071
2072 rc = config_gpio_table(camera_on_gpio_table,
2073 ARRAY_SIZE(camera_on_gpio_table));
2074 if (rc < 0) {
2075 pr_err("%s: CAMSENSOR gpio table request"
2076 "failed\n", __func__);
2077 return rc;
2078 }
2079
2080 return rc;
2081}
2082
2083static void config_camera_off_gpios_rear(void)
2084{
2085 msm_camera_vreg_config(0);
2086 config_gpio_table(camera_off_gpio_table,
2087 ARRAY_SIZE(camera_off_gpio_table));
2088}
2089
2090static int config_camera_on_gpios_front(void)
2091{
2092 int rc = 0;
2093
2094 msm_camera_vreg_config(1);
2095
2096 rc = config_gpio_table(camera_on_gpio_table,
2097 ARRAY_SIZE(camera_on_gpio_table));
2098 if (rc < 0) {
2099 pr_err("%s: CAMSENSOR gpio table request"
2100 "failed\n", __func__);
2101 return rc;
2102 }
2103
2104 return rc;
2105}
2106
2107static void config_camera_off_gpios_front(void)
2108{
2109 msm_camera_vreg_config(0);
2110
2111 config_gpio_table(camera_off_gpio_table,
2112 ARRAY_SIZE(camera_off_gpio_table));
2113}
2114
2115struct msm_camera_device_platform_data msm_camera_data_rear = {
2116 .camera_gpio_on = config_camera_on_gpios_rear,
2117 .camera_gpio_off = config_camera_off_gpios_rear,
2118 .ioext.csiphy = 0xA1000000,
2119 .ioext.csisz = 0x00100000,
2120 .ioext.csiirq = INT_CSI_IRQ_1,
2121 .ioclk.mclk_clk_rate = 24000000,
2122 .ioclk.vfe_clk_rate = 192000000,
2123 .ioext.appphy = MSM_CLK_CTL_PHYS,
2124 .ioext.appsz = MSM_CLK_CTL_SIZE,
2125};
2126
2127struct msm_camera_device_platform_data msm_camera_data_front = {
2128 .camera_gpio_on = config_camera_on_gpios_front,
2129 .camera_gpio_off = config_camera_off_gpios_front,
2130 .ioext.csiphy = 0xA0F00000,
2131 .ioext.csisz = 0x00100000,
2132 .ioext.csiirq = INT_CSI_IRQ_0,
2133 .ioclk.mclk_clk_rate = 24000000,
2134 .ioclk.vfe_clk_rate = 192000000,
2135 .ioext.appphy = MSM_CLK_CTL_PHYS,
2136 .ioext.appsz = MSM_CLK_CTL_SIZE,
2137};
2138
2139#ifdef CONFIG_OV5640
2140static struct msm_camera_sensor_platform_info ov5640_sensor_info = {
2141 .mount_angle = 90
2142};
2143
2144static struct msm_camera_sensor_flash_src msm_flash_src_ov5640 = {
2145 .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED,
2146 ._fsrc.led_src.led_name = "flashlight",
2147 ._fsrc.led_src.led_name_len = 10,
2148};
2149
2150static struct msm_camera_sensor_flash_data flash_ov5640 = {
2151 .flash_type = MSM_CAMERA_FLASH_LED,
2152 .flash_src = &msm_flash_src_ov5640,
2153};
2154
2155static struct msm_camera_sensor_info msm_camera_sensor_ov5640_data = {
2156 .sensor_name = "ov5640",
2157 .sensor_reset_enable = 1,
2158 .sensor_reset = GPIO_CAM_5MP_RESET,
2159 .sensor_pwd = GPIO_CAM_5MP_SHDN_EN,
2160 .vcm_pwd = 0,
2161 .vcm_enable = 0,
2162 .pdata = &msm_camera_data_rear,
2163 .flash_data = &flash_ov5640,
2164 .sensor_platform_info = &ov5640_sensor_info,
2165 .csi_if = 1,
2166};
2167
2168static struct platform_device msm_camera_sensor_ov5640 = {
2169 .name = "msm_camera_ov5640",
2170 .dev = {
2171 .platform_data = &msm_camera_sensor_ov5640_data,
2172 },
2173};
2174#endif
2175
2176#ifdef CONFIG_WEBCAM_OV7692_QRD
2177static struct msm_camera_sensor_platform_info ov7692_sensor_7627a_info = {
2178 .mount_angle = 90
2179};
2180
2181static struct msm_camera_sensor_flash_data flash_ov7692 = {
2182 .flash_type = MSM_CAMERA_FLASH_NONE,
2183};
2184
2185static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = {
2186 .sensor_name = "ov7692",
2187 .sensor_reset_enable = 0,
2188 .sensor_reset = 0,
2189 .sensor_pwd = GPIO_CAM_3MP_PWDN,
2190 .vcm_pwd = 0,
2191 .vcm_enable = 0,
2192 .pdata = &msm_camera_data_front,
2193 .flash_data = &flash_ov7692,
2194 .sensor_platform_info = &ov7692_sensor_7627a_info,
2195 .csi_if = 1,
2196};
2197
2198static struct platform_device msm_camera_sensor_ov7692 = {
2199 .name = "msm_camera_ov7692",
2200 .dev = {
2201 .platform_data = &msm_camera_sensor_ov7692_data,
2202 },
2203};
2204#endif
2205
2206static struct i2c_board_info i2c_camera_devices[] = {
2207 #ifdef CONFIG_OV5640
2208 {
2209 I2C_BOARD_INFO("ov5640", 0x78 >> 1),
2210 },
2211 #endif
2212 #ifdef CONFIG_WEBCAM_OV7692_QRD
2213 {
2214 I2C_BOARD_INFO("ov7692", 0x78),
2215 },
2216 #endif
2217};
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302218static struct platform_device *qrd1_devices[] __initdata = {
2219 &msm_device_dmov,
2220 &msm_device_smd,
2221 &msm_device_uart1,
2222 &msm_device_uart_dm1,
2223 &msm_gsbi0_qup_i2c_device,
2224 &msm_gsbi1_qup_i2c_device,
2225 &msm_device_otg,
2226 &msm_device_gadget_peripheral,
2227 &android_usb_device,
2228 &android_pmem_device,
2229 &android_pmem_adsp_device,
Taniya Das0a5303a2011-08-23 18:47:48 +05302230 &msm_fb_device,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302231 &android_pmem_audio_device,
2232 &msm_device_snd,
2233 &msm_device_adspdec,
2234 &msm_batt_device,
Taniya Das7a22cdd2011-09-08 14:57:00 +05302235#ifdef CONFIG_OV5640
2236 &msm_camera_sensor_ov5640,
2237#endif
2238#ifdef CONFIG_WEBCAM_OV7692_QRD
2239 &msm_camera_sensor_ov7692,
2240#endif
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302241 &msm_kgsl_3d0,
2242#ifdef CONFIG_BT
2243 &msm_bt_power_device,
2244#endif
Taniya Das0a5303a2011-08-23 18:47:48 +05302245 &mipi_dsi_truly_panel_device,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302246 &msm_wlan_ar6000_pm_device,
2247 &asoc_msm_pcm,
2248 &asoc_msm_dai0,
2249 &asoc_msm_dai1,
2250};
2251
2252static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
2253static int __init pmem_kernel_ebi1_size_setup(char *p)
2254{
2255 pmem_kernel_ebi1_size = memparse(p, NULL);
2256 return 0;
2257}
2258early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
2259
2260static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
2261static int __init pmem_audio_size_setup(char *p)
2262{
2263 pmem_audio_size = memparse(p, NULL);
2264 return 0;
2265}
2266early_param("pmem_audio_size", pmem_audio_size_setup);
2267
2268static void __init msm_msm7627a_allocate_memory_regions(void)
2269{
Taniya Das0a5303a2011-08-23 18:47:48 +05302270 void *addr;
2271 unsigned long size;
2272
2273 size = fb_size ? : MSM_FB_SIZE;
2274 addr = alloc_bootmem_align(size, 0x1000);
2275 msm_fb_resources[0].start = __pa(addr);
2276 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2277 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", size,
2278 addr, __pa(addr));
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302279}
2280
2281static struct memtype_reserve msm7627a_reserve_table[] __initdata = {
2282 [MEMTYPE_SMI] = {
2283 },
2284 [MEMTYPE_EBI0] = {
2285 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2286 },
2287 [MEMTYPE_EBI1] = {
2288 .flags = MEMTYPE_FLAGS_1M_ALIGN,
2289 },
2290};
2291
Taniya Das0a5303a2011-08-23 18:47:48 +05302292static struct msm_panel_common_pdata mdp_pdata = {
2293 .gpio = 97,
2294 .mdp_rev = MDP_REV_303,
2295};
2296
2297#define GPIO_LCDC_BRDG_PD 128
2298#define GPIO_LCDC_BRDG_RESET_N 129
2299#define GPIO_LCD_DSI_SEL 125
2300
2301static unsigned mipi_dsi_gpio[] = {
2302 GPIO_CFG(GPIO_LCDC_BRDG_RESET_N, 0, GPIO_CFG_OUTPUT,
2303 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_RESET_N */
2304 GPIO_CFG(GPIO_LCDC_BRDG_PD, 0, GPIO_CFG_OUTPUT,
2305 GPIO_CFG_NO_PULL, GPIO_CFG_2MA), /* LCDC_BRDG_PD */
2306};
2307
2308static unsigned lcd_dsi_sel_gpio[] = {
2309 GPIO_CFG(GPIO_LCD_DSI_SEL, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
2310 GPIO_CFG_2MA),
2311};
2312
2313enum {
2314 DSI_SINGLE_LANE = 1,
2315 DSI_TWO_LANES,
2316};
2317
2318static int msm_fb_get_lane_config(void)
2319{
2320 pr_info("DSI_TWO_LANES\n");
2321 return DSI_TWO_LANES;
2322}
2323
2324static int mipi_truly_sel_mode(int video_mode)
2325{
2326 int rc = 0;
2327
2328 rc = gpio_request(GPIO_LCD_DSI_SEL, "lcd_dsi_sel");
2329 if (rc < 0)
2330 goto gpio_error;
2331
2332 rc = gpio_tlmm_config(lcd_dsi_sel_gpio[0], GPIO_CFG_ENABLE);
2333 if (rc)
2334 goto gpio_error;
2335
2336 rc = gpio_direction_output(GPIO_LCD_DSI_SEL, 1);
2337 if (!rc) {
2338 gpio_set_value_cansleep(GPIO_LCD_DSI_SEL, video_mode);
2339 return rc;
2340 } else {
2341 goto gpio_error;
2342 }
2343
2344gpio_error:
2345 pr_err("mipi_truly_sel_mode failed\n");
2346 gpio_free(GPIO_LCD_DSI_SEL);
2347 return rc;
2348}
2349
2350static int msm_fb_dsi_client_qrd1_reset(void)
2351{
2352 int rc = 0;
2353
2354 rc = gpio_request(GPIO_LCDC_BRDG_RESET_N, "lcdc_brdg_reset_n");
2355 if (rc < 0) {
2356 pr_err("failed to request lcd brdg reset_n\n");
2357 return rc;
2358 }
2359
2360 rc = gpio_tlmm_config(mipi_dsi_gpio[0], GPIO_CFG_ENABLE);
2361 if (rc < 0) {
2362 pr_err("Failed to enable LCDC Bridge reset enable\n");
2363 return rc;
2364 }
2365
2366 rc = gpio_direction_output(GPIO_LCDC_BRDG_RESET_N, 1);
2367 if (rc < 0) {
2368 pr_err("Failed GPIO bridge pd\n");
2369 gpio_free(GPIO_LCDC_BRDG_RESET_N);
2370 return rc;
2371 }
2372
2373 mipi_truly_sel_mode(1);
2374
2375 return rc;
2376}
2377
2378static int msm_fb_dsi_client_reset(void)
2379{
2380 int rc = 0;
2381
2382 rc = msm_fb_dsi_client_qrd1_reset();
2383 return rc;
2384}
2385
2386static int dsi_gpio_initialized;
2387
2388static int mipi_dsi_panel_qrd1_power(int on)
2389{
2390 int rc = 0;
2391
2392 if (!dsi_gpio_initialized) {
2393 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
2394 if (rc < 0)
2395 return rc;
2396
Jeevan Shriram72e4cc62011-11-10 14:57:22 +05302397 rc = gpio_tlmm_config(GPIO_CFG(GPIO_BACKLIGHT_EN, 0,
2398 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
2399 GPIO_CFG_ENABLE);
2400 if (rc < 0) {
2401 pr_err("failed GPIO_BACKLIGHT_EN tlmm config\n");
2402 return rc;
2403 }
2404
Taniya Das0a5303a2011-08-23 18:47:48 +05302405 rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
2406 if (rc < 0) {
2407 pr_err("failed to enable backlight\n");
2408 gpio_free(GPIO_BACKLIGHT_EN);
2409 return rc;
2410 }
2411 dsi_gpio_initialized = 1;
2412 }
2413
2414 gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, !!on);
2415
2416 if (!on) {
2417 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
2418 msleep(20);
2419 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
2420 msleep(20);
2421 gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
2422
2423 }
2424
2425 return rc;
2426}
2427
2428static int mipi_dsi_panel_power(int on)
2429{
2430 int rc = 0;
2431
2432 rc = mipi_dsi_panel_qrd1_power(on);
2433 return rc;
2434}
2435
2436#define MDP_303_VSYNC_GPIO 97
2437
2438#ifdef CONFIG_FB_MSM_MDP303
2439static struct mipi_dsi_platform_data mipi_dsi_pdata = {
2440 .vsync_gpio = MDP_303_VSYNC_GPIO,
2441 .dsi_power_save = mipi_dsi_panel_power,
2442 .dsi_client_reset = msm_fb_dsi_client_reset,
2443 .get_lane_config = msm_fb_get_lane_config,
2444};
2445#endif
2446
2447static void __init msm_fb_add_devices(void)
2448{
2449 msm_fb_register_device("mdp", &mdp_pdata);
2450 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
2451}
2452
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302453static void __init size_pmem_devices(void)
2454{
2455#ifdef CONFIG_ANDROID_PMEM
2456 android_pmem_adsp_pdata.size = pmem_adsp_size;
2457 android_pmem_pdata.size = pmem_mdp_size;
2458 android_pmem_audio_pdata.size = pmem_audio_size;
2459#endif
2460}
2461
2462static void __init reserve_memory_for(struct android_pmem_platform_data *p)
2463{
2464 msm7627a_reserve_table[p->memory_type].size += p->size;
2465}
2466
2467static void __init reserve_pmem_memory(void)
2468{
2469#ifdef CONFIG_ANDROID_PMEM
2470 reserve_memory_for(&android_pmem_adsp_pdata);
2471 reserve_memory_for(&android_pmem_pdata);
2472 reserve_memory_for(&android_pmem_audio_pdata);
2473 msm7627a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
2474#endif
2475}
2476
2477static void __init msm7627a_calculate_reserve_sizes(void)
2478{
2479 size_pmem_devices();
2480 reserve_pmem_memory();
2481}
2482
2483static int msm7627a_paddr_to_memtype(unsigned int paddr)
2484{
2485 return MEMTYPE_EBI1;
2486}
2487
2488static struct reserve_info msm7627a_reserve_info __initdata = {
2489 .memtype_reserve_table = msm7627a_reserve_table,
2490 .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes,
2491 .paddr_to_memtype = msm7627a_paddr_to_memtype,
2492};
2493
2494static void __init msm7627a_reserve(void)
2495{
2496 reserve_info = &msm7627a_reserve_info;
2497 msm_reserve();
2498}
2499
2500static void __init msm_device_i2c_init(void)
2501{
2502 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
2503 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
2504}
2505
2506static struct msm_handset_platform_data hs_platform_data = {
2507 .hs_name = "7k_handset",
2508 .pwr_key_delay_ms = 500, /* 0 will disable end key */
2509};
2510
2511static struct platform_device hs_pdev = {
2512 .name = "msm-handset",
2513 .id = -1,
2514 .dev = {
2515 .platform_data = &hs_platform_data,
2516 },
2517};
2518
Pankaj Kumar3cec0582011-11-18 11:13:29 +05302519static struct platform_device msm_proccomm_regulator_dev = {
2520 .name = PROCCOMM_REGULATOR_DEV_NAME,
2521 .id = -1,
2522 .dev = {
2523 .platform_data = &msm7x27a_proccomm_regulator_data
2524 }
2525};
2526
2527static void __init msm7627a_init_regulators(void)
2528{
2529 int rc = platform_device_register(&msm_proccomm_regulator_dev);
2530 if (rc)
2531 pr_err("%s: could not register regulator device: %d\n",
2532 __func__, rc);
2533}
2534
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302535#define UART1DM_RX_GPIO 45
2536static void __init msm_qrd1_init(void)
2537{
2538 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +05302539 msm7627a_init_regulators();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302540 msm_device_i2c_init();
2541 msm7627a_init_mmc();
2542
Taniya Das7a22cdd2011-09-08 14:57:00 +05302543 qrd1_camera_gpio_cfg();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302544#ifdef CONFIG_SERIAL_MSM_HS
2545 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
2546 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
2547#endif
2548
2549#ifdef CONFIG_USB_MSM_OTG_72K
2550 msm_otg_pdata.swfi_latency = msm7627a_pm_data
2551 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
2552 msm_device_otg.dev.platform_data = &msm_otg_pdata;
2553#endif
2554 msm_device_gadget_peripheral.dev.platform_data =
Taniya Das7a22cdd2011-09-08 14:57:00 +05302555 &msm_gadget_pdata;
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302556 platform_add_devices(qrd1_devices,
Taniya Das7a22cdd2011-09-08 14:57:00 +05302557 ARRAY_SIZE(qrd1_devices));
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302558#ifdef CONFIG_USB_EHCI_MSM_72K
2559 msm7627a_init_host();
2560#endif
2561 msm_pm_set_platform_data(msm7627a_pm_data,
2562 ARRAY_SIZE(msm7627a_pm_data));
Murali Nalajalaa1827842011-11-13 14:12:39 +05302563 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_RESET_VECTOR,
2564 ioremap(0, PAGE_SIZE)));
2565
Taniya Das0a5303a2011-08-23 18:47:48 +05302566 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302567
2568#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
2569 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
Taniya Das7a22cdd2011-09-08 14:57:00 +05302570 bahama_devices,
2571 ARRAY_SIZE(bahama_devices));
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302572 bt_power_init();
2573#endif
Taniya Dasda408822011-09-06 12:54:06 +05302574
Pankaj Kumar27c02642011-09-22 15:55:55 +05302575 msm_camera_vreg_init();
Taniya Das7a22cdd2011-09-08 14:57:00 +05302576 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, i2c_camera_devices,
2577 ARRAY_SIZE(i2c_camera_devices));
2578
Taniya Dasda408822011-09-06 12:54:06 +05302579#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \
2580 defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE)
2581 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
2582 synaptic_i2c_clearpad3k,
2583 ARRAY_SIZE(synaptic_i2c_clearpad3k));
2584#endif
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302585 platform_device_register(&hs_pdev);
2586
2587#ifdef CONFIG_MSM_RPC_VIBRATOR
2588 msm_init_pmic_vibrator();
2589#endif
2590}
2591
2592static void __init qrd7627a_init_early(void)
2593{
2594 msm_msm7627a_allocate_memory_regions();
2595}
2596
2597MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
2598 .boot_params = PHYS_OFFSET + 0x100,
2599 .map_io = msm_common_io_init,
2600 .reserve = msm7627a_reserve,
2601 .init_irq = msm_init_irq,
2602 .init_machine = msm_qrd1_init,
2603 .timer = &msm_timer,
2604 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +05302605 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302606MACHINE_END