blob: 172d1f463b5d7e1a0cf13d2db7176808ff30bbe9 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* 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 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019#include <linux/gpio.h>
20#include <linux/msm_ssbi.h>
21#include <linux/regulator/gpio-regulator.h>
22#include <linux/mfd/pm8xxx/pm8921.h>
23#include <linux/regulator/consumer.h>
24#include <linux/spi/spi.h>
25#include <linux/slimbus/slimbus.h>
26#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060027#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#ifdef CONFIG_ANDROID_PMEM
29#include <linux/android_pmem.h>
30#endif
31#include <linux/cyttsp.h>
32#include <linux/dma-mapping.h>
33#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070034#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <linux/leds.h>
36#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053037#include <linux/i2c/atmel_mxt_ts.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080038
39#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070041#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080042#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070043#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080044
45#include <mach/board.h>
46#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <mach/msm_spi.h>
48#ifdef CONFIG_USB_MSM_OTG_72K
49#include <mach/msm_hsusb.h>
50#else
51#include <linux/usb/msm_hsusb.h>
52#endif
53#include <linux/usb/android.h>
54#include <mach/usbdiag.h>
55#include <mach/socinfo.h>
56#include <mach/rpm.h>
57#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070058#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070059#include <mach/msm_bus_board.h>
60#include <mach/msm_memtypes.h>
61#include <mach/dma.h>
62#include <mach/msm_dsps.h>
63#include <mach/msm_xo.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080064
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065#ifdef CONFIG_WCD9310_CODEC
66#include <linux/slimbus/slimbus.h>
67#include <linux/mfd/wcd9310/core.h>
68#include <linux/mfd/wcd9310/pdata.h>
69#endif
70
Laura Abbottd6183792011-08-19 13:42:24 -070071#include <linux/ion.h>
72#include <mach/ion.h>
73
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080075#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#include "spm.h"
78#include "board-msm8960.h"
79#include "pm.h"
80#include "cpuidle.h"
81#include "rpm_resources.h"
82#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070083#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070084#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070085#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070086
87static struct platform_device msm_fm_platform_init = {
88 .name = "iris_fm",
89 .id = -1,
90};
91
92struct pm8xxx_gpio_init {
93 unsigned gpio;
94 struct pm_gpio config;
95};
96
97struct pm8xxx_mpp_init {
98 unsigned mpp;
99 struct pm8xxx_mpp_config_data config;
100};
101
102#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
103 _func, _inv, _disable) \
104{ \
105 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
106 .config = { \
107 .direction = _dir, \
108 .output_buffer = _buf, \
109 .output_value = _val, \
110 .pull = _pull, \
111 .vin_sel = _vin, \
112 .out_strength = _out_strength, \
113 .function = _func, \
114 .inv_int_pol = _inv, \
115 .disable_pin = _disable, \
116 } \
117}
118
119#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
120{ \
121 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
122 .config = { \
123 .type = PM8XXX_MPP_TYPE_##_type, \
124 .level = _level, \
125 .control = PM8XXX_MPP_##_control, \
126 } \
127}
128
129#define PM8XXX_GPIO_DISABLE(_gpio) \
130 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
131 0, 0, 0, 1)
132
133#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
134 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
135 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
136 PM_GPIO_STRENGTH_HIGH, \
137 PM_GPIO_FUNC_NORMAL, 0, 0)
138
139#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
140 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
141 _pull, PM_GPIO_VIN_S4, \
142 PM_GPIO_STRENGTH_NO, \
143 PM_GPIO_FUNC_NORMAL, 0, 0)
144
145#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
146 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
147 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
148 PM_GPIO_STRENGTH_HIGH, \
149 _func, 0, 0)
150
151/* Initial PM8921 GPIO configurations */
152static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
153 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
154 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
155 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300156 /* External regulator shared by display and touchscreen on LiQUID */
157 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
158 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700159 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700160 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700161 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
162 PM8XXX_GPIO_OUTPUT(43, 0), /* DISP_RESET_N */
163};
164
165/* Initial PM8921 MPP configurations */
166static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
167 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
168 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
169 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6,
170 DOUT_CTRL_LOW),
171 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
172 DOUT_CTRL_LOW),
173};
174
175static void __init pm8921_gpio_mpp_init(void)
176{
177 int i, rc;
178
179 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
180 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
181 &pm8921_gpios[i].config);
182 if (rc) {
183 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
184 break;
185 }
186 }
187
188 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
189 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
190 &pm8921_mpps[i].config);
191 if (rc) {
192 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
193 break;
194 }
195 }
196}
197
198#define FPGA_CS_GPIO 14
199#define KS8851_RST_GPIO 89
200#define KS8851_IRQ_GPIO 90
201
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700202#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
203enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700204 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700205 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
206 /* CAM Expander */
207 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
208 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
209 GPIO_CAM_GP_AFBUSY,
210 GPIO_CAM_GP_STROBE_CE,
211 GPIO_CAM_GP_CAM1MP_XCLR,
212 GPIO_CAM_GP_CAMIF_RESET_N,
213 GPIO_CAM_GP_XMT_FLASH_INT,
214 GPIO_CAM_GP_LED_EN1,
215 GPIO_CAM_GP_LED_EN2,
216
217};
218#endif
219
Harini Jayaraman608d0462011-08-09 19:10:03 -0600220/* The SPI configurations apply to GSBI 1*/
221static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700222 .func = GPIOMUX_FUNC_1,
223 .drv = GPIOMUX_DRV_8MA,
224 .pull = GPIOMUX_PULL_NONE,
225};
226
Harini Jayaraman608d0462011-08-09 19:10:03 -0600227static struct gpiomux_setting spi_suspended_config = {
228 .func = GPIOMUX_FUNC_GPIO,
229 .drv = GPIOMUX_DRV_2MA,
230 .pull = GPIOMUX_PULL_DOWN,
231};
232
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700233static struct gpiomux_setting gsbi3 = {
234 .func = GPIOMUX_FUNC_1,
235 .drv = GPIOMUX_DRV_8MA,
236 .pull = GPIOMUX_PULL_NONE,
237};
238
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700239static struct gpiomux_setting gsbi5 = {
240 .func = GPIOMUX_FUNC_1,
241 .drv = GPIOMUX_DRV_8MA,
242 .pull = GPIOMUX_PULL_NONE,
243};
244
245static struct gpiomux_setting gsbi10 = {
246 .func = GPIOMUX_FUNC_2,
247 .drv = GPIOMUX_DRV_8MA,
248 .pull = GPIOMUX_PULL_NONE,
249};
250
251static struct gpiomux_setting gsbi12 = {
252 .func = GPIOMUX_FUNC_1,
253 .drv = GPIOMUX_DRV_8MA,
254 .pull = GPIOMUX_PULL_NONE,
255};
256
257static struct gpiomux_setting cdc_mclk = {
258 .func = GPIOMUX_FUNC_1,
259 .drv = GPIOMUX_DRV_8MA,
260 .pull = GPIOMUX_PULL_NONE,
261};
262
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700263#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264static struct gpiomux_setting gpio_eth_config = {
265 .pull = GPIOMUX_PULL_NONE,
266 .drv = GPIOMUX_DRV_8MA,
267 .func = GPIOMUX_FUNC_GPIO,
268};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700269#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700270
271static struct gpiomux_setting slimbus = {
272 .func = GPIOMUX_FUNC_1,
273 .drv = GPIOMUX_DRV_8MA,
274 .pull = GPIOMUX_PULL_KEEPER,
275};
276
277struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700278#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279 {
280 .gpio = KS8851_IRQ_GPIO,
281 .settings = {
282 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
283 }
284 },
285 {
286 .gpio = KS8851_RST_GPIO,
287 .settings = {
288 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
289 }
290 },
291 {
292 .gpio = FPGA_CS_GPIO,
293 .settings = {
294 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
295 }
296 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700297#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700298};
299
300static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
301 {
302 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
303 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600304 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
305 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306 },
307 },
308 {
309 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
310 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600311 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
312 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313 },
314 },
315 {
316 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
317 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600318 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
319 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320 },
321 },
322 {
323 .gpio = 9, /* GSBI1 QUP SPI_CLK */
324 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600325 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
326 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700327 },
328 },
329 {
330 .gpio = 16, /* GSBI3 I2C QUP SDA */
331 .settings = {
332 [GPIOMUX_SUSPENDED] = &gsbi3,
333 },
334 },
335 {
336 .gpio = 17, /* GSBI3 I2C QUP SCL */
337 .settings = {
338 [GPIOMUX_SUSPENDED] = &gsbi3,
339 },
340 },
341 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700342 .gpio = 22, /* GSBI5 UART2 */
343 .settings = {
344 [GPIOMUX_SUSPENDED] = &gsbi5,
345 },
346 },
347 {
348 .gpio = 23, /* GSBI5 UART2 */
349 .settings = {
350 [GPIOMUX_SUSPENDED] = &gsbi5,
351 },
352 },
353 {
354 .gpio = 24, /* GSBI5 UART2 */
355 .settings = {
356 [GPIOMUX_SUSPENDED] = &gsbi5,
357 },
358 },
359 {
360 .gpio = 25, /* GSBI5 UART2 */
361 .settings = {
362 [GPIOMUX_SUSPENDED] = &gsbi5,
363 },
364 },
365 {
366 .gpio = 44, /* GSBI12 I2C QUP SDA */
367 .settings = {
368 [GPIOMUX_SUSPENDED] = &gsbi12,
369 },
370 },
371 {
372 .gpio = 45, /* GSBI12 I2C QUP SCL */
373 .settings = {
374 [GPIOMUX_SUSPENDED] = &gsbi12,
375 },
376 },
377 {
378 .gpio = 73, /* GSBI10 I2C QUP SDA */
379 .settings = {
380 [GPIOMUX_SUSPENDED] = &gsbi10,
381 },
382 },
383 {
384 .gpio = 74, /* GSBI10 I2C QUP SCL */
385 .settings = {
386 [GPIOMUX_SUSPENDED] = &gsbi10,
387 },
388 },
389};
390
391static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
392 {
393 .gpio = 60, /* slimbus data */
394 .settings = {
395 [GPIOMUX_SUSPENDED] = &slimbus,
396 },
397 },
398 {
399 .gpio = 61, /* slimbus clk */
400 .settings = {
401 [GPIOMUX_SUSPENDED] = &slimbus,
402 },
403 },
404};
405
406static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
407 {
408 .gpio = 59,
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &cdc_mclk,
411 },
412 },
413};
414static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
415 .func = GPIOMUX_FUNC_GPIO,
416 .drv = GPIOMUX_DRV_2MA,
417 .pull = GPIOMUX_PULL_NONE,
418};
419
420static struct gpiomux_setting wcnss_5wire_active_cfg = {
421 .func = GPIOMUX_FUNC_1,
422 .drv = GPIOMUX_DRV_6MA,
423 .pull = GPIOMUX_PULL_DOWN,
424};
425
426static struct msm_gpiomux_config wcnss_5wire_interface[] = {
427 {
428 .gpio = 84,
429 .settings = {
430 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
431 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
432 },
433 },
434 {
435 .gpio = 85,
436 .settings = {
437 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
438 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
439 },
440 },
441 {
442 .gpio = 86,
443 .settings = {
444 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
445 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
446 },
447 },
448 {
449 .gpio = 87,
450 .settings = {
451 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
452 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
453 },
454 },
455 {
456 .gpio = 88,
457 .settings = {
458 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
459 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
460 },
461 },
462};
Nishant Pandit24153d82011-08-27 16:05:13 +0530463static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530464 {
465 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
466 .drv = GPIOMUX_DRV_2MA,
467 .pull = GPIOMUX_PULL_DOWN,
468 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700469
Nishant Pandit474f2252011-07-23 23:17:56 +0530470 {
471 .func = GPIOMUX_FUNC_1, /*active 1*/
472 .drv = GPIOMUX_DRV_2MA,
473 .pull = GPIOMUX_PULL_NONE,
474 },
475
476 {
477 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
478 .drv = GPIOMUX_DRV_2MA,
479 .pull = GPIOMUX_PULL_NONE,
480 },
481
482 {
483 .func = GPIOMUX_FUNC_1, /*active 3*/
484 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700485 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530486 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530487
488 {
489 .func = GPIOMUX_FUNC_5, /*active 4*/
490 .drv = GPIOMUX_DRV_8MA,
491 .pull = GPIOMUX_PULL_UP,
492 },
493
494 {
495 .func = GPIOMUX_FUNC_6, /*active 5*/
496 .drv = GPIOMUX_DRV_8MA,
497 .pull = GPIOMUX_PULL_UP,
498 },
499
500 {
501 .func = GPIOMUX_FUNC_2, /*active 6*/
502 .drv = GPIOMUX_DRV_2MA,
503 .pull = GPIOMUX_PULL_UP,
504 },
505
506 {
507 .func = GPIOMUX_FUNC_3, /*active 7*/
508 .drv = GPIOMUX_DRV_8MA,
509 .pull = GPIOMUX_PULL_UP,
510 },
511
Kevin Chan4c58d292011-09-13 11:03:25 -0700512 {
513 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
514 .drv = GPIOMUX_DRV_2MA,
515 .pull = GPIOMUX_PULL_KEEPER,
516 },
517
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700518};
519
Nishant Pandit24153d82011-08-27 16:05:13 +0530520static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700521 {
522 .gpio = 2,
523 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530524 [GPIOMUX_ACTIVE] = &cam_settings[2],
525 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700526 },
527 },
528 {
529 .gpio = 3,
530 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530531 [GPIOMUX_ACTIVE] = &cam_settings[1],
532 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533 },
534 },
535 {
536 .gpio = 4,
537 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530538 [GPIOMUX_ACTIVE] = &cam_settings[1],
539 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700540 },
541 },
542 {
543 .gpio = 5,
544 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530545 [GPIOMUX_ACTIVE] = &cam_settings[1],
546 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700547 },
548 },
549 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530550 .gpio = 76,
551 .settings = {
552 [GPIOMUX_ACTIVE] = &cam_settings[2],
553 [GPIOMUX_SUSPENDED] = &cam_settings[0],
554 },
555 },
556 {
557 .gpio = 107,
558 .settings = {
559 [GPIOMUX_ACTIVE] = &cam_settings[2],
560 [GPIOMUX_SUSPENDED] = &cam_settings[0],
561 },
562 },
563};
564
565static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
566 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700567 .gpio = 18,
568 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530569 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700570 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700571 },
572 },
573 {
574 .gpio = 19,
575 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530576 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700577 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700578 },
579 },
580 {
581 .gpio = 20,
582 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530583 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700584 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700585 },
586 },
587 {
588 .gpio = 21,
589 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530590 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700591 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700592 },
593 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700594};
595
596static struct gpiomux_setting cyts_resout_sus_cfg = {
597 .func = GPIOMUX_FUNC_GPIO,
598 .drv = GPIOMUX_DRV_6MA,
599 .pull = GPIOMUX_PULL_UP,
600};
601
602static struct gpiomux_setting cyts_resout_act_cfg = {
603 .func = GPIOMUX_FUNC_GPIO,
604 .drv = GPIOMUX_DRV_6MA,
605 .pull = GPIOMUX_PULL_UP,
606};
607
608static struct gpiomux_setting cyts_sleep_sus_cfg = {
609 .func = GPIOMUX_FUNC_GPIO,
610 .drv = GPIOMUX_DRV_6MA,
611 .pull = GPIOMUX_PULL_DOWN,
612};
613
614static struct gpiomux_setting cyts_sleep_act_cfg = {
615 .func = GPIOMUX_FUNC_GPIO,
616 .drv = GPIOMUX_DRV_6MA,
617 .pull = GPIOMUX_PULL_DOWN,
618};
619
620static struct gpiomux_setting cyts_int_act_cfg = {
621 .func = GPIOMUX_FUNC_GPIO,
622 .drv = GPIOMUX_DRV_8MA,
623 .pull = GPIOMUX_PULL_UP,
624};
625
626static struct gpiomux_setting cyts_int_sus_cfg = {
627 .func = GPIOMUX_FUNC_GPIO,
628 .drv = GPIOMUX_DRV_2MA,
629 .pull = GPIOMUX_PULL_UP,
630};
631
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700632static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
633 { /* TS INTERRUPT */
634 .gpio = 11,
635 .settings = {
636 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
637 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
638 },
639 },
640 { /* TS SLEEP */
641 .gpio = 50,
642 .settings = {
643 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
644 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
645 },
646 },
647 { /* TS RESOUT */
648 .gpio = 52,
649 .settings = {
650 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
651 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
652 },
653 },
654};
655
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700656#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
657enum {
658 SX150X_CAM,
659};
660
Nishant Pandit474f2252011-07-23 23:17:56 +0530661static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700662 [SX150X_CAM] = {
663 .gpio_base = GPIO_CAM_EXPANDER_BASE,
664 .oscio_is_gpo = false,
665 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530666 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700667 .io_open_drain_ena = 0x0,
668 .irq_summary = -1,
669 },
670};
Nishant Pandit474f2252011-07-23 23:17:56 +0530671
672#endif
673
674#ifdef CONFIG_I2C
675
676#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
677#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
678
679#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
680
681static struct i2c_board_info cam_expander_i2c_info[] = {
682 {
683 I2C_BOARD_INFO("sx1508q", 0x22),
684 .platform_data = &sx150x_data[SX150X_CAM]
685 },
686};
687
688static struct msm_cam_expander_info cam_expander_info[] = {
689 {
690 cam_expander_i2c_info,
691 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
692 },
693};
694#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700695#endif
696
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700697#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
698#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700699#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700700#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
701
Laura Abbottd6183792011-08-19 13:42:24 -0700702#define MSM_ION_EBI_SIZE SZ_8M
703
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700704#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
705static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
706static int __init pmem_kernel_ebi1_size_setup(char *p)
707{
708 pmem_kernel_ebi1_size = memparse(p, NULL);
709 return 0;
710}
711early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
712#endif
713
714#ifdef CONFIG_ANDROID_PMEM
715static unsigned pmem_size = MSM_PMEM_SIZE;
716static int __init pmem_size_setup(char *p)
717{
718 pmem_size = memparse(p, NULL);
719 return 0;
720}
721early_param("pmem_size", pmem_size_setup);
722
723static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
724
725static int __init pmem_adsp_size_setup(char *p)
726{
727 pmem_adsp_size = memparse(p, NULL);
728 return 0;
729}
730early_param("pmem_adsp_size", pmem_adsp_size_setup);
731
732static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
733
734static int __init pmem_audio_size_setup(char *p)
735{
736 pmem_audio_size = memparse(p, NULL);
737 return 0;
738}
739early_param("pmem_audio_size", pmem_audio_size_setup);
740#endif
741
742#ifdef CONFIG_ANDROID_PMEM
743static struct android_pmem_platform_data android_pmem_pdata = {
744 .name = "pmem",
745 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
746 .cached = 1,
747 .memory_type = MEMTYPE_EBI1,
748};
749
750static struct platform_device android_pmem_device = {
751 .name = "android_pmem",
752 .id = 0,
753 .dev = {.platform_data = &android_pmem_pdata},
754};
755
756static struct android_pmem_platform_data android_pmem_adsp_pdata = {
757 .name = "pmem_adsp",
758 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
759 .cached = 0,
760 .memory_type = MEMTYPE_EBI1,
761};
762static struct platform_device android_pmem_adsp_device = {
763 .name = "android_pmem",
764 .id = 2,
765 .dev = { .platform_data = &android_pmem_adsp_pdata },
766};
767
768static struct android_pmem_platform_data android_pmem_audio_pdata = {
769 .name = "pmem_audio",
770 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
771 .cached = 0,
772 .memory_type = MEMTYPE_EBI1,
773};
774
775static struct platform_device android_pmem_audio_device = {
776 .name = "android_pmem",
777 .id = 4,
778 .dev = { .platform_data = &android_pmem_audio_pdata },
779};
780#endif
781
782static struct memtype_reserve msm8960_reserve_table[] __initdata = {
783 [MEMTYPE_SMI] = {
784 },
785 [MEMTYPE_EBI0] = {
786 .flags = MEMTYPE_FLAGS_1M_ALIGN,
787 },
788 [MEMTYPE_EBI1] = {
789 .flags = MEMTYPE_FLAGS_1M_ALIGN,
790 },
791};
792
793static void __init size_pmem_devices(void)
794{
795#ifdef CONFIG_ANDROID_PMEM
796 android_pmem_adsp_pdata.size = pmem_adsp_size;
797 android_pmem_pdata.size = pmem_size;
798 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
799#endif
800}
801
802static void __init reserve_memory_for(struct android_pmem_platform_data *p)
803{
804 msm8960_reserve_table[p->memory_type].size += p->size;
805}
806
807static void __init reserve_pmem_memory(void)
808{
809#ifdef CONFIG_ANDROID_PMEM
810 reserve_memory_for(&android_pmem_adsp_pdata);
811 reserve_memory_for(&android_pmem_pdata);
812 reserve_memory_for(&android_pmem_audio_pdata);
813 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
814#endif
815}
816
Larry Basselb4126da2011-07-18 14:31:33 -0700817static int msm8960_paddr_to_memtype(unsigned int paddr)
818{
819 return MEMTYPE_EBI1;
820}
821
Laura Abbottd6183792011-08-19 13:42:24 -0700822#ifdef CONFIG_ION_MSM
823struct ion_platform_data ion_pdata = {
824 .nr = 3,
825 .heaps = {
826 {
827 .id = ION_HEAP_SYSTEM_ID,
828 .type = ION_HEAP_TYPE_SYSTEM,
829 .name = ION_KMALLOC_HEAP_NAME,
830 },
831 {
832 .id = ION_HEAP_SYSTEM_CONTIG_ID,
833 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
834 .name = ION_VMALLOC_HEAP_NAME,
835 },
836 {
837 .id = ION_HEAP_EBI_ID,
838 .type = ION_HEAP_TYPE_CARVEOUT,
839 .name = ION_EBI1_HEAP_NAME,
840 .size = MSM_ION_EBI_SIZE,
841 .memory_type = ION_EBI_TYPE,
842 },
843 }
844};
845
846struct platform_device ion_dev = {
847 .name = "ion-msm",
848 .id = 1,
849 .dev = { .platform_data = &ion_pdata },
850};
851#endif
852
853static void reserve_ion_memory(void)
854{
855#ifdef CONFIG_ION_MSM
856 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
857#endif
858}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700859static void __init msm8960_calculate_reserve_sizes(void)
860{
861 size_pmem_devices();
862 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700863 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864}
865
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700866static struct reserve_info msm8960_reserve_info __initdata = {
867 .memtype_reserve_table = msm8960_reserve_table,
868 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
869 .paddr_to_memtype = msm8960_paddr_to_memtype,
870};
871
Larry Basselb4126da2011-07-18 14:31:33 -0700872static int msm8960_memory_bank_size(void)
873{
874 return 1<<29;
875}
876
877static void __init locate_unstable_memory(void)
878{
879 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
880 unsigned long bank_size;
881 unsigned long low, high;
882
883 bank_size = msm8960_memory_bank_size();
884 low = meminfo.bank[0].start;
885 high = mb->start + mb->size;
886 low &= ~(bank_size - 1);
887
888 if (high - low <= bank_size)
889 return;
890 msm8960_reserve_info.low_unstable_address = low + bank_size;
891 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
892 msm8960_reserve_info.bank_size = bank_size;
893 pr_info("low unstable address %lx max size %lx bank size %lx\n",
894 msm8960_reserve_info.low_unstable_address,
895 msm8960_reserve_info.max_unstable_size,
896 msm8960_reserve_info.bank_size);
897}
898
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700899static void __init msm8960_reserve(void)
900{
901 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700902 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903 msm_reserve();
904}
905
Larry Bassela4414b12011-08-04 11:11:02 -0700906static int msm8960_change_memory_power(u64 start, u64 size,
907 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700908{
Larry Bassela4414b12011-08-04 11:11:02 -0700909 return size;
Larry Bassela7eadea2011-07-14 10:46:00 -0700910}
911
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700912#ifdef CONFIG_MSM_CAMERA
913
Nishant Pandit24153d82011-08-27 16:05:13 +0530914static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700915 5, /*CAMIF_MCLK*/
916 20, /*CAMIF_I2C_DATA*/
917 21, /*CAMIF_I2C_CLK*/
918};
919
Nishant Pandit24153d82011-08-27 16:05:13 +0530920static struct msm_camera_gpio_conf gpio_conf = {
921 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
922 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
923 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
924 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
925};
926
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700927#define VFE_CAMIF_TIMER1_GPIO 2
928#define VFE_CAMIF_TIMER2_GPIO 3
929#define VFE_CAMIF_TIMER3_GPIO_INT 4
930struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
931 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
932 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
933 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
934 .flash_recharge_duration = 50000,
935 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
936};
937
Nishant Pandit474f2252011-07-23 23:17:56 +0530938#ifdef CONFIG_MSM_CAMERA_FLASH
939static struct msm_camera_sensor_flash_src msm_flash_src = {
940 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
941 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
942 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
943#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
944 defined(CONFIG_GPIO_SX150X_MODULE))
945 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
946#endif
947};
948#endif
949
Nishant Pandit24153d82011-08-27 16:05:13 +0530950struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
951 {
952 .ioclk.mclk_clk_rate = 24000000,
953 .ioclk.vfe_clk_rate = 228570000,
954 .csid_core = 0,
955 },
956 {
957 .ioclk.mclk_clk_rate = 24000000,
958 .ioclk.vfe_clk_rate = 228570000,
959 .csid_core = 1,
960 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700961};
962
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -0700963#ifdef CONFIG_IMX074_ACT
964static struct i2c_board_info imx074_actuator_i2c_info = {
965 I2C_BOARD_INFO("imx074_act", 0x11),
966};
967
968static struct msm_actuator_info imx074_actuator_info = {
969 .board_info = &imx074_actuator_i2c_info,
970 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
971 .vcm_pwd = 0,
972 .vcm_enable = 1,
973};
974#endif
975
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700976#ifdef CONFIG_IMX074
977static struct msm_camera_sensor_flash_data flash_imx074 = {
978 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530979#ifdef CONFIG_MSM_CAMERA_FLASH
980 .flash_src = &msm_flash_src
981#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700982};
983
Nishant Pandit24153d82011-08-27 16:05:13 +0530984static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
985 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700986 .sensor_reset = 107,
987 .sensor_pwd = 85,
988 .vcm_pwd = 0,
989 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +0530990};
991
992static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
993 .sensor_name = "imx074",
994 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700995 .flash_data = &flash_imx074,
996 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +0530997 .sensor_platform_info = &sensor_board_info_imx074,
998 .gpio_conf = &gpio_conf,
999 .csi_if = 1,
1000 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001001#ifdef CONFIG_IMX074_ACT
1002 .actuator_info = &imx074_actuator_info
1003#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004};
1005
1006struct platform_device msm8960_camera_sensor_imx074 = {
1007 .name = "msm_camera_imx074",
1008 .dev = {
1009 .platform_data = &msm_camera_sensor_imx074_data,
1010 },
1011};
1012#endif
1013#ifdef CONFIG_OV2720
1014static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001015 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001016};
1017
Nishant Pandit24153d82011-08-27 16:05:13 +05301018static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1019 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001020 .sensor_reset = 76,
1021 .sensor_pwd = 85,
1022 .vcm_pwd = 0,
1023 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301024};
1025
1026static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1027 .sensor_name = "ov2720",
1028 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001029 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301030 .sensor_platform_info = &sensor_board_info_ov2720,
1031 .gpio_conf = &gpio_conf,
1032 .csi_if = 1,
1033 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001034};
1035
1036struct platform_device msm8960_camera_sensor_ov2720 = {
1037 .name = "msm_camera_ov2720",
1038 .dev = {
1039 .platform_data = &msm_camera_sensor_ov2720_data,
1040 },
1041};
1042#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001043
1044static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1045 .flash_type = MSM_CAMERA_FLASH_LED,
1046};
1047
Nishant Pandit24153d82011-08-27 16:05:13 +05301048static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1049 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001050 .sensor_reset = 107,
1051 .sensor_pwd = 85,
1052 .vcm_pwd = 0,
1053 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301054};
1055
1056static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1057 .sensor_name = "qs_mt9p017",
1058 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001059 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301060 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1061 .gpio_conf = &gpio_conf,
1062 .csi_if = 1,
1063 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001064};
1065
1066struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1067 .name = "msm_camera_qs_mt9p017",
1068 .dev = {
1069 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1070 },
1071};
1072
Kevin Chan8b0d2322011-09-10 21:06:31 -07001073static struct msm8960_privacy_light_cfg privacy_light_info = {
1074 .mpp = PM8921_MPP_PM_TO_SYS(12),
1075};
1076
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001077static void __init msm8960_init_cam(void)
1078{
1079 int i;
1080 struct platform_device *cam_dev[] = {
1081 &msm8960_camera_sensor_imx074,
1082 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001083 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001084 };
1085
Kevin Chan8b0d2322011-09-10 21:06:31 -07001086 if (machine_is_msm8960_liquid()) {
1087 struct msm_camera_sensor_info *s_info;
1088 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1089 s_info->sensor_platform_info->mount_angle = 180;
1090 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1091 s_info->sensor_platform_info->privacy_light = 1;
1092 s_info->sensor_platform_info->privacy_light_info =
1093 &privacy_light_info;
1094 }
1095
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001096 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1097 struct msm_camera_sensor_info *s_info;
1098 s_info = cam_dev[i]->dev.platform_data;
1099 msm_get_cam_resources(s_info);
1100 platform_device_register(cam_dev[i]);
1101 }
1102}
1103#endif
1104
1105#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001106/* prim = 1366 x 768 x 3(bpp) x 3(pages) */
1107#define MSM_FB_PRIM_BUF_SIZE roundup(1366 * 768 * 3 * 3, 0x10000)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001108#else
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001109/* prim = 1366 x 768 x 3(bpp) x 2(pages) */
1110#define MSM_FB_PRIM_BUF_SIZE roundup(1366 * 768 * 3 * 2, 0x10000)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001111#endif
1112
1113#ifdef CONFIG_FB_MSM_MIPI_DSI
Nagamalleswararao Ganji0b8dbd02011-08-18 20:46:59 -07001114#define MIPI_DSI_WRITEBACK_SIZE (1024 * 600 * 3 * 2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001115#else
1116#define MIPI_DSI_WRITEBACK_SIZE 0
1117#endif
1118
1119#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1120/* hdmi = 1920 x 1088 x 2(bpp) x 1(page) */
1121#define MSM_FB_EXT_BUF_SIZE 0x3FC000
1122#elif defined(CONFIG_FB_MSM_TVOUT)
1123/* tvout = 720 x 576 x 2(bpp) x 2(pages) */
1124#define MSM_FB_EXT_BUF_SIZE 0x195000
1125#else /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1126#define MSM_FB_EXT_BUF_SIZE 0
1127#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1128
1129#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE +\
1130 MIPI_DSI_WRITEBACK_SIZE, 4096)
1131
1132#define MDP_VSYNC_GPIO 0
1133
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001134#define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga"
1135#define TOSHIBA_PANEL_NAME_LEN 24
1136#define CHIMEI_PANEL_NAME "mipi_chimei_wxga"
1137#define CHIMEI_PANEL_NAME_LEN 16
1138
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001139static struct resource msm_fb_resources[] = {
1140 {
1141 .flags = IORESOURCE_DMA,
1142 }
1143};
1144
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001145#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1146static int msm_fb_detect_panel(const char *name)
1147{
1148 if (machine_is_msm8960_liquid()) {
1149 if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN))
1150 return 0;
1151 } else {
1152 if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN))
1153 return 0;
1154 }
1155
1156 pr_warning("%s: not supported '%s'", __func__, name);
1157
1158 return -ENODEV;
1159}
1160
1161static struct msm_fb_platform_data msm_fb_pdata = {
1162 .detect_client = msm_fb_detect_panel,
1163};
1164#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
1165
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001166static struct platform_device msm_fb_device = {
1167 .name = "msm_fb",
1168 .id = 0,
1169 .num_resources = ARRAY_SIZE(msm_fb_resources),
1170 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001171#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1172 .dev.platform_data = &msm_fb_pdata,
1173#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001174};
1175
1176static bool dsi_power_on;
1177
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001178/**
1179 * LiQUID panel on/off
1180 *
1181 * @param on
1182 *
1183 * @return int
1184 */
1185static int mipi_dsi_liquid_panel_power(int on)
1186{
1187 static struct regulator *reg_l2, *reg_ext_3p3v;
1188 static int gpio21, gpio24, gpio43;
1189 int rc;
1190
1191 pr_info("%s: on=%d\n", __func__, on);
1192
1193 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1194 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1195 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1196
1197 if (!dsi_power_on) {
1198
1199 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1200 "dsi_vdda");
1201 if (IS_ERR(reg_l2)) {
1202 pr_err("could not get 8921_l2, rc = %ld\n",
1203 PTR_ERR(reg_l2));
1204 return -ENODEV;
1205 }
1206
1207 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1208 if (rc) {
1209 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1210 return -EINVAL;
1211 }
1212
1213 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1214 "vdd_lvds_3p3v");
1215 if (IS_ERR(reg_ext_3p3v)) {
1216 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1217 PTR_ERR(reg_ext_3p3v));
1218 return -ENODEV;
1219 }
1220
1221 rc = gpio_request(gpio21, "disp_pwr_en_n");
1222 if (rc) {
1223 pr_err("request gpio 21 failed, rc=%d\n", rc);
1224 return -ENODEV;
1225 }
1226
1227 rc = gpio_request(gpio43, "disp_rst_n");
1228 if (rc) {
1229 pr_err("request gpio 43 failed, rc=%d\n", rc);
1230 return -ENODEV;
1231 }
1232
1233 rc = gpio_request(gpio24, "disp_backlight_pwm");
1234 if (rc) {
1235 pr_err("request gpio 24 failed, rc=%d\n", rc);
1236 return -ENODEV;
1237 }
1238
1239 dsi_power_on = true;
1240 }
1241
1242 if (on) {
1243 rc = regulator_set_optimum_mode(reg_l2, 100000);
1244 if (rc < 0) {
1245 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1246 return -EINVAL;
1247 }
1248 rc = regulator_enable(reg_l2);
1249 if (rc) {
1250 pr_err("enable l2 failed, rc=%d\n", rc);
1251 return -ENODEV;
1252 }
1253
1254 rc = regulator_enable(reg_ext_3p3v);
1255 if (rc) {
1256 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1257 return -ENODEV;
1258 }
1259
1260 /* set reset pin before power enable */
1261 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1262
1263 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1264 msleep(20);
1265 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1266 msleep(20);
1267 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1268 msleep(20);
1269 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1270 msleep(20);
1271 } else {
1272 gpio_set_value_cansleep(gpio43, 0);
1273 gpio_set_value_cansleep(gpio21, 1);
1274
1275 rc = regulator_disable(reg_l2);
1276 if (rc) {
1277 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1278 return -ENODEV;
1279 }
1280 rc = regulator_disable(reg_ext_3p3v);
1281 if (rc) {
1282 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1283 return -ENODEV;
1284 }
1285 rc = regulator_set_optimum_mode(reg_l2, 100);
1286 if (rc < 0) {
1287 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1288 return -EINVAL;
1289 }
1290 }
1291
1292 return 0;
1293}
1294
1295static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001296{
1297 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001298 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001299 int rc;
1300
1301 struct pm_gpio gpio43_param = {
1302 .direction = PM_GPIO_DIR_OUT,
1303 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1304 .output_value = 0,
1305 .pull = PM_GPIO_PULL_NO,
1306 .vin_sel = 2,
1307 .out_strength = PM_GPIO_STRENGTH_HIGH,
1308 .function = PM_GPIO_FUNC_PAIRED,
1309 .inv_int_pol = 0,
1310 .disable_pin = 0,
1311 };
1312
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001313 pr_info("%s: state : %d\n", __func__, on);
1314
1315 if (!dsi_power_on) {
1316
1317 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1318 "dsi_vdc");
1319 if (IS_ERR(reg_l8)) {
1320 pr_err("could not get 8921_l8, rc = %ld\n",
1321 PTR_ERR(reg_l8));
1322 return -ENODEV;
1323 }
1324
1325 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1326 "dsi_vddio");
1327 if (IS_ERR(reg_l23)) {
1328 pr_err("could not get 8921_l23, rc = %ld\n",
1329 PTR_ERR(reg_l23));
1330 return -ENODEV;
1331 }
1332
1333 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1334 "dsi_vdda");
1335 if (IS_ERR(reg_l2)) {
1336 pr_err("could not get 8921_l2, rc = %ld\n",
1337 PTR_ERR(reg_l2));
1338 return -ENODEV;
1339 }
1340
1341 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1342 if (rc) {
1343 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1344 return -EINVAL;
1345 }
1346 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1347 if (rc) {
1348 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1349 return -EINVAL;
1350 }
1351 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1352 if (rc) {
1353 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1354 return -EINVAL;
1355 }
1356
1357 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1358 rc = gpio_request(gpio43, "disp_rst_n");
1359 if (rc) {
1360 pr_err("request gpio 43 failed, rc=%d\n", rc);
1361 return -ENODEV;
1362 }
1363
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364 dsi_power_on = true;
1365 }
1366
1367 if (on) {
1368 rc = regulator_set_optimum_mode(reg_l8, 100000);
1369 if (rc < 0) {
1370 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1371 return -EINVAL;
1372 }
1373 rc = regulator_set_optimum_mode(reg_l23, 100000);
1374 if (rc < 0) {
1375 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1376 return -EINVAL;
1377 }
1378 rc = regulator_set_optimum_mode(reg_l2, 100000);
1379 if (rc < 0) {
1380 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1381 return -EINVAL;
1382 }
1383 rc = regulator_enable(reg_l8);
1384 if (rc) {
1385 pr_err("enable l8 failed, rc=%d\n", rc);
1386 return -ENODEV;
1387 }
1388 rc = regulator_enable(reg_l23);
1389 if (rc) {
1390 pr_err("enable l8 failed, rc=%d\n", rc);
1391 return -ENODEV;
1392 }
1393 rc = regulator_enable(reg_l2);
1394 if (rc) {
1395 pr_err("enable l2 failed, rc=%d\n", rc);
1396 return -ENODEV;
1397 }
1398
1399 gpio43_param.pull = PM_GPIO_PULL_NO;
1400 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1401 if (rc) {
1402 pr_err("gpio_config 43 failed (1), rc=%d\n", rc);
1403 return -EINVAL;
1404 }
1405 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1406 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1407 if (rc) {
1408 pr_err("gpio_config 43 failed (2), rc=%d\n", rc);
1409 return -EINVAL;
1410 }
1411 gpio43_param.pull = PM_GPIO_PULL_NO;
1412 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1413 if (rc) {
1414 pr_err("gpio_config 43 failed (3), rc=%d\n", rc);
1415 return -EINVAL;
1416 }
1417 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1418 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1419 if (rc) {
1420 pr_err("gpio_config 43 failed (4), rc=%d\n", rc);
1421 return -EINVAL;
1422 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001423 gpio_set_value_cansleep(gpio43, 1);
1424 } else {
1425 rc = regulator_set_optimum_mode(reg_l8, 100);
1426 if (rc < 0) {
1427 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1428 return -EINVAL;
1429 }
1430 rc = regulator_set_optimum_mode(reg_l23, 100);
1431 if (rc < 0) {
1432 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1433 return -EINVAL;
1434 }
1435 rc = regulator_set_optimum_mode(reg_l2, 100);
1436 if (rc < 0) {
1437 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1438 return -EINVAL;
1439 }
1440 gpio_set_value_cansleep(gpio43, 0);
1441 }
1442 return 0;
1443}
1444
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001445static int mipi_dsi_panel_power(int on)
1446{
1447 int ret;
1448
1449 pr_info("%s: on=%d\n", __func__, on);
1450
1451 if (machine_is_msm8960_liquid())
1452 ret = mipi_dsi_liquid_panel_power(on);
1453 else
1454 ret = mipi_dsi_cdp_panel_power(on);
1455
1456 return ret;
1457}
1458
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001459static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1460 .vsync_gpio = MDP_VSYNC_GPIO,
1461 .dsi_power_save = mipi_dsi_panel_power,
1462};
1463
1464#ifdef CONFIG_MSM_BUS_SCALING
1465
1466static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001467 {
1468 .src = MSM_BUS_MASTER_MDP_PORT0,
1469 .dst = MSM_BUS_SLAVE_EBI_CH0,
1470 .ab = 0,
1471 .ib = 0,
1472 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001473};
1474
1475static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001476 {
1477 .src = MSM_BUS_MASTER_MDP_PORT0,
1478 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001479 .ab = 216000000 * 2,
1480 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001481 },
1482};
1483
1484static struct msm_bus_vectors mdp_vga_vectors[] = {
1485 /* VGA and less video */
1486 {
1487 .src = MSM_BUS_MASTER_MDP_PORT0,
1488 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001489 .ab = 216000000 * 2,
1490 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001491 },
1492};
1493
1494static struct msm_bus_vectors mdp_720p_vectors[] = {
1495 /* 720p and less video */
1496 {
1497 .src = MSM_BUS_MASTER_MDP_PORT0,
1498 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001499 .ab = 230400000 * 2,
1500 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001501 },
1502};
1503
1504static struct msm_bus_vectors mdp_1080p_vectors[] = {
1505 /* 1080p and less video */
1506 {
1507 .src = MSM_BUS_MASTER_MDP_PORT0,
1508 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001509 .ab = 334080000 * 2,
1510 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001511 },
1512};
1513
1514static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1515 {
1516 ARRAY_SIZE(mdp_init_vectors),
1517 mdp_init_vectors,
1518 },
1519 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001520 ARRAY_SIZE(mdp_ui_vectors),
1521 mdp_ui_vectors,
1522 },
1523 {
1524 ARRAY_SIZE(mdp_ui_vectors),
1525 mdp_ui_vectors,
1526 },
1527 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001528 ARRAY_SIZE(mdp_vga_vectors),
1529 mdp_vga_vectors,
1530 },
1531 {
1532 ARRAY_SIZE(mdp_720p_vectors),
1533 mdp_720p_vectors,
1534 },
1535 {
1536 ARRAY_SIZE(mdp_1080p_vectors),
1537 mdp_1080p_vectors,
1538 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001539};
1540
1541static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1542 mdp_bus_scale_usecases,
1543 ARRAY_SIZE(mdp_bus_scale_usecases),
1544 .name = "mdp",
1545};
1546
1547#endif
1548
1549int mdp_core_clk_rate_table[] = {
1550 85330000,
1551 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001552 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001553 200000000,
1554};
1555
1556static struct msm_panel_common_pdata mdp_pdata = {
1557 .gpio = MDP_VSYNC_GPIO,
1558 .mdp_core_clk_rate = 85330000,
1559 .mdp_core_clk_table = mdp_core_clk_rate_table,
1560 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1561#ifdef CONFIG_MSM_BUS_SCALING
1562 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1563#endif
1564 .mdp_rev = MDP_REV_42,
1565};
1566
1567static struct platform_device mipi_dsi_renesas_panel_device = {
1568 .name = "mipi_renesas",
1569 .id = 0,
1570};
1571
1572static struct platform_device mipi_dsi_simulator_panel_device = {
1573 .name = "mipi_simulator",
1574 .id = 0,
1575};
1576
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001577#define LPM_CHANNEL0 0
1578static int toshiba_gpio[] = {LPM_CHANNEL0};
1579
1580static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1581 .gpio = toshiba_gpio,
1582};
1583
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001584static struct platform_device mipi_dsi_toshiba_panel_device = {
1585 .name = "mipi_toshiba",
1586 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001587 .dev = {
1588 .platform_data = &toshiba_pdata,
1589 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001590};
1591
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001592static int dsi2lvds_gpio[2] = {
1593 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1594 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1595 };
1596
1597static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1598 .gpio_num = dsi2lvds_gpio,
1599};
1600
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001601static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1602
1603/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1604 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1605 /* timing */
1606 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1607 0x0c, 0x03, 0x04, 0xa0},
1608 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1609 {0xff, 0x00, 0x06, 0x00}, /* strength */
1610 /* pll control */
1611 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1612 0x40, 0x07, 0x03,
1613 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1614};
1615
1616static struct mipi_dsi_panel_platform_data novatek_pdata = {
1617 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1618};
1619
1620static struct platform_device mipi_dsi_novatek_panel_device = {
1621 .name = "mipi_novatek",
1622 .id = 0,
1623 .dev = {
1624 .platform_data = &novatek_pdata,
1625 }
1626};
1627
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001628static struct platform_device mipi_dsi2lvds_bridge_device = {
1629 .name = "mipi_tc358764",
1630 .id = 0,
1631 .dev.platform_data = &mipi_dsi2lvds_pdata,
1632};
1633
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001634#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1635static struct resource hdmi_msm_resources[] = {
1636 {
1637 .name = "hdmi_msm_qfprom_addr",
1638 .start = 0x00700000,
1639 .end = 0x007060FF,
1640 .flags = IORESOURCE_MEM,
1641 },
1642 {
1643 .name = "hdmi_msm_hdmi_addr",
1644 .start = 0x04A00000,
1645 .end = 0x04A00FFF,
1646 .flags = IORESOURCE_MEM,
1647 },
1648 {
1649 .name = "hdmi_msm_irq",
1650 .start = HDMI_IRQ,
1651 .end = HDMI_IRQ,
1652 .flags = IORESOURCE_IRQ,
1653 },
1654};
1655
1656static int hdmi_enable_5v(int on);
1657static int hdmi_core_power(int on, int show);
1658static int hdmi_cec_power(int on);
1659
1660static struct msm_hdmi_platform_data hdmi_msm_data = {
1661 .irq = HDMI_IRQ,
1662 .enable_5v = hdmi_enable_5v,
1663 .core_power = hdmi_core_power,
1664 .cec_power = hdmi_cec_power,
1665};
1666
1667static struct platform_device hdmi_msm_device = {
1668 .name = "hdmi_msm",
1669 .id = 0,
1670 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1671 .resource = hdmi_msm_resources,
1672 .dev.platform_data = &hdmi_msm_data,
1673};
1674#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1675
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001676#ifdef CONFIG_MSM_BUS_SCALING
1677static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1678 {
1679 .src = MSM_BUS_MASTER_MDP_PORT0,
1680 .dst = MSM_BUS_SLAVE_EBI_CH0,
1681 .ab = 0,
1682 .ib = 0,
1683 },
1684};
1685static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1686 {
1687 .src = MSM_BUS_MASTER_MDP_PORT0,
1688 .dst = MSM_BUS_SLAVE_EBI_CH0,
1689 .ab = 566092800 * 2,
1690 .ib = 707616000 * 2,
1691 },
1692};
1693static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1694 {
1695 ARRAY_SIZE(dtv_bus_init_vectors),
1696 dtv_bus_init_vectors,
1697 },
1698 {
1699 ARRAY_SIZE(dtv_bus_def_vectors),
1700 dtv_bus_def_vectors,
1701 },
1702};
1703static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1704 dtv_bus_scale_usecases,
1705 ARRAY_SIZE(dtv_bus_scale_usecases),
1706 .name = "dtv",
1707};
1708
1709static struct lcdc_platform_data dtv_pdata = {
1710 .bus_scale_table = &dtv_bus_scale_pdata,
1711};
1712#endif
1713
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001714static void __init msm_fb_add_devices(void)
1715{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001716 struct platform_device *ptr = NULL;
1717
1718 if (machine_is_msm8960_liquid())
1719 ptr = &mipi_dsi2lvds_bridge_device;
1720 else
1721 ptr = &mipi_dsi_toshiba_panel_device;
1722 platform_add_devices(&ptr, 1);
1723
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001724 if (machine_is_msm8x60_rumi3()) {
1725 msm_fb_register_device("mdp", NULL);
1726 mipi_dsi_pdata.target_type = 1;
1727 } else
1728 msm_fb_register_device("mdp", &mdp_pdata);
1729 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001730#ifdef CONFIG_MSM_BUS_SCALING
1731 msm_fb_register_device("dtv", &dtv_pdata);
1732#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001733}
1734
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001735static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1736 .func = GPIOMUX_FUNC_GPIO,
1737 .drv = GPIOMUX_DRV_2MA,
1738 .pull = GPIOMUX_PULL_DOWN,
1739};
1740
1741static struct gpiomux_setting mdp_vsync_active_cfg = {
1742 .func = GPIOMUX_FUNC_1,
1743 .drv = GPIOMUX_DRV_2MA,
1744 .pull = GPIOMUX_PULL_DOWN,
1745};
1746
1747static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1748 {
1749 .gpio = MDP_VSYNC_GPIO,
1750 .settings = {
1751 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1752 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1753 },
1754 }
1755};
1756
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001757#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1758static struct gpiomux_setting hdmi_suspend_cfg = {
1759 .func = GPIOMUX_FUNC_GPIO,
1760 .drv = GPIOMUX_DRV_2MA,
1761 .pull = GPIOMUX_PULL_DOWN,
1762};
1763
1764static struct gpiomux_setting hdmi_active_1_cfg = {
1765 .func = GPIOMUX_FUNC_1,
1766 .drv = GPIOMUX_DRV_2MA,
1767 .pull = GPIOMUX_PULL_UP,
1768};
1769
1770static struct gpiomux_setting hdmi_active_2_cfg = {
1771 .func = GPIOMUX_FUNC_1,
1772 .drv = GPIOMUX_DRV_2MA,
1773 .pull = GPIOMUX_PULL_DOWN,
1774};
1775
1776static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1777 {
1778 .gpio = 99,
1779 .settings = {
1780 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1781 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1782 },
1783 },
1784 {
1785 .gpio = 100,
1786 .settings = {
1787 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1788 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1789 },
1790 },
1791 {
1792 .gpio = 101,
1793 .settings = {
1794 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1795 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1796 },
1797 },
1798 {
1799 .gpio = 102,
1800 .settings = {
1801 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1802 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1803 },
1804 },
1805};
1806
1807static int hdmi_enable_5v(int on)
1808{
1809 /* TBD: PM8921 regulator instead of 8901 */
1810 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1811 static int prev_on;
1812 int rc;
1813
1814 if (on == prev_on)
1815 return 0;
1816
1817 if (!reg_8921_hdmi_mvs)
1818 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1819 "hdmi_mvs");
1820
1821 if (on) {
1822 rc = regulator_enable(reg_8921_hdmi_mvs);
1823 if (rc) {
1824 pr_err("'%s' regulator enable failed, rc=%d\n",
1825 "8921_hdmi_mvs", rc);
1826 return rc;
1827 }
1828 pr_debug("%s(on): success\n", __func__);
1829 } else {
1830 rc = regulator_disable(reg_8921_hdmi_mvs);
1831 if (rc)
1832 pr_warning("'%s' regulator disable failed, rc=%d\n",
1833 "8921_hdmi_mvs", rc);
1834 pr_debug("%s(off): success\n", __func__);
1835 }
1836
1837 prev_on = on;
1838
1839 return 0;
1840}
1841
1842static int hdmi_core_power(int on, int show)
1843{
1844 static struct regulator *reg_8921_l23, *reg_8921_s4;
1845 static int prev_on;
1846 int rc;
1847
1848 if (on == prev_on)
1849 return 0;
1850
1851 /* TBD: PM8921 regulator instead of 8901 */
1852 if (!reg_8921_l23)
1853 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
1854
1855 if (!reg_8921_s4)
1856 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
1857
1858 if (on) {
1859 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1860 if (rc < 0) {
1861 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1862 return -EINVAL;
1863 }
1864
1865 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1866 if (!rc)
1867 rc = regulator_enable(reg_8921_l23);
1868 if (rc) {
1869 pr_err("'%s' regulator enable failed, rc=%d\n",
1870 "hdmi_avdd", rc);
1871 return rc;
1872 }
1873 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1874 if (!rc)
1875 rc = regulator_enable(reg_8921_s4);
1876 if (rc) {
1877 pr_err("'%s' regulator enable failed, rc=%d\n",
1878 "hdmi_vcc", rc);
1879 return rc;
1880 }
1881
1882 rc = gpio_request(100, "HDMI_DDC_CLK");
1883 if (rc) {
1884 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1885 "HDMI_DDC_CLK", 100, rc);
1886 goto error1;
1887 }
1888 rc = gpio_request(101, "HDMI_DDC_DATA");
1889 if (rc) {
1890 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1891 "HDMI_DDC_DATA", 101, rc);
1892 goto error2;
1893 }
1894 rc = gpio_request(102, "HDMI_HPD");
1895 if (rc) {
1896 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1897 "HDMI_HPD", 102, rc);
1898 goto error3;
1899 }
1900 pr_debug("%s(on): success\n", __func__);
1901 } else {
1902 gpio_free(100);
1903 gpio_free(101);
1904 gpio_free(102);
1905
1906 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1907 if (rc < 0) {
1908 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1909 return -EINVAL;
1910 }
1911
1912 pr_debug("%s(off): success\n", __func__);
1913 }
1914
1915 prev_on = on;
1916
1917 return 0;
1918
1919error3:
1920 gpio_free(101);
1921error2:
1922 gpio_free(100);
1923error1:
1924 regulator_disable(reg_8921_l23);
1925 return rc;
1926}
1927
1928static int hdmi_cec_power(int on)
1929{
1930 static int prev_on;
1931 int rc;
1932
1933 if (on == prev_on)
1934 return 0;
1935
1936 if (on) {
1937 rc = gpio_request(99, "HDMI_CEC_VAR");
1938 if (rc) {
1939 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1940 "HDMI_CEC_VAR", 99, rc);
1941 goto error;
1942 }
1943 pr_debug("%s(on): success\n", __func__);
1944 } else {
1945 gpio_free(99);
1946 pr_debug("%s(off): success\n", __func__);
1947 }
1948
1949 prev_on = on;
1950
1951 return 0;
1952error:
1953 return rc;
1954}
1955#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1956
1957static void __init msm8960_allocate_memory_regions(void)
1958{
1959 void *addr;
1960 unsigned long size;
1961
1962 size = MSM_FB_SIZE;
1963 addr = alloc_bootmem_align(size, 0x1000);
1964 msm_fb_resources[0].start = __pa(addr);
1965 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1966 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1967 size, addr, __pa(addr));
1968
1969}
1970#ifdef CONFIG_WCD9310_CODEC
1971
1972#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1973
Patrick Lai3043fba2011-08-01 14:15:57 -07001974/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
1975 * 4 micbiases are used to power various analog and digital
1976 * microphones operating at 1800 mV. Technically, all micbiases
1977 * can source from single cfilter since all microphones operate
1978 * at the same voltage level. The arrangement below is to make
1979 * sure all cfilters are exercised. LDO_H regulator ouput level
1980 * does not need to be as high as 2.85V. It is choosen for
1981 * microphone sensitivity purpose.
1982 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001983static struct tabla_pdata tabla_platform_data = {
1984 .slimbus_slave_device = {
1985 .name = "tabla-slave",
1986 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1987 },
1988 .irq = MSM_GPIO_TO_INT(62),
1989 .irq_base = TABLA_INTERRUPT_BASE,
1990 .num_irqs = NR_TABLA_IRQS,
1991 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07001992 .micbias = {
1993 .ldoh_v = TABLA_LDOH_2P85_V,
1994 .cfilt1_mv = 1800,
1995 .cfilt2_mv = 1800,
1996 .cfilt3_mv = 1800,
1997 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1998 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1999 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2000 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2001 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002002};
2003
2004static struct slim_device msm_slim_tabla = {
2005 .name = "tabla-slim",
2006 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2007 .dev = {
2008 .platform_data = &tabla_platform_data,
2009 },
2010};
2011#endif
2012
2013static struct slim_boardinfo msm_slim_devices[] = {
2014#ifdef CONFIG_WCD9310_CODEC
2015 {
2016 .bus_num = 1,
2017 .slim_slave = &msm_slim_tabla,
2018 },
2019#endif
2020 /* add more slimbus slaves as needed */
2021};
2022
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002023#define MSM_WCNSS_PHYS 0x03000000
2024#define MSM_WCNSS_SIZE 0x280000
2025
2026static struct resource resources_wcnss_wlan[] = {
2027 {
2028 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2029 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2030 .name = "wcnss_wlanrx_irq",
2031 .flags = IORESOURCE_IRQ,
2032 },
2033 {
2034 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2035 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2036 .name = "wcnss_wlantx_irq",
2037 .flags = IORESOURCE_IRQ,
2038 },
2039 {
2040 .start = MSM_WCNSS_PHYS,
2041 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2042 .name = "wcnss_mmio",
2043 .flags = IORESOURCE_MEM,
2044 },
2045};
2046
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002047static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2048 .has_48mhz_xo = 1,
2049};
2050
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002051static struct platform_device msm_device_wcnss_wlan = {
2052 .name = "wcnss_wlan",
2053 .id = 0,
2054 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2055 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002056 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002057};
2058
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002059#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2060 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2061 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2062 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2063
2064#define QCE_SIZE 0x10000
2065#define QCE_0_BASE 0x18500000
2066
2067#define QCE_HW_KEY_SUPPORT 0
2068#define QCE_SHA_HMAC_SUPPORT 1
2069#define QCE_SHARE_CE_RESOURCE 1
2070#define QCE_CE_SHARED 0
2071
2072static struct resource qcrypto_resources[] = {
2073 [0] = {
2074 .start = QCE_0_BASE,
2075 .end = QCE_0_BASE + QCE_SIZE - 1,
2076 .flags = IORESOURCE_MEM,
2077 },
2078 [1] = {
2079 .name = "crypto_channels",
2080 .start = DMOV_CE_IN_CHAN,
2081 .end = DMOV_CE_OUT_CHAN,
2082 .flags = IORESOURCE_DMA,
2083 },
2084 [2] = {
2085 .name = "crypto_crci_in",
2086 .start = DMOV_CE_IN_CRCI,
2087 .end = DMOV_CE_IN_CRCI,
2088 .flags = IORESOURCE_DMA,
2089 },
2090 [3] = {
2091 .name = "crypto_crci_out",
2092 .start = DMOV_CE_OUT_CRCI,
2093 .end = DMOV_CE_OUT_CRCI,
2094 .flags = IORESOURCE_DMA,
2095 },
2096};
2097
2098static struct resource qcedev_resources[] = {
2099 [0] = {
2100 .start = QCE_0_BASE,
2101 .end = QCE_0_BASE + QCE_SIZE - 1,
2102 .flags = IORESOURCE_MEM,
2103 },
2104 [1] = {
2105 .name = "crypto_channels",
2106 .start = DMOV_CE_IN_CHAN,
2107 .end = DMOV_CE_OUT_CHAN,
2108 .flags = IORESOURCE_DMA,
2109 },
2110 [2] = {
2111 .name = "crypto_crci_in",
2112 .start = DMOV_CE_IN_CRCI,
2113 .end = DMOV_CE_IN_CRCI,
2114 .flags = IORESOURCE_DMA,
2115 },
2116 [3] = {
2117 .name = "crypto_crci_out",
2118 .start = DMOV_CE_OUT_CRCI,
2119 .end = DMOV_CE_OUT_CRCI,
2120 .flags = IORESOURCE_DMA,
2121 },
2122};
2123
2124#endif
2125
2126#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2127 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2128
2129static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2130 .ce_shared = QCE_CE_SHARED,
2131 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2132 .hw_key_support = QCE_HW_KEY_SUPPORT,
2133 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2134};
2135
2136static struct platform_device qcrypto_device = {
2137 .name = "qcrypto",
2138 .id = 0,
2139 .num_resources = ARRAY_SIZE(qcrypto_resources),
2140 .resource = qcrypto_resources,
2141 .dev = {
2142 .coherent_dma_mask = DMA_BIT_MASK(32),
2143 .platform_data = &qcrypto_ce_hw_suppport,
2144 },
2145};
2146#endif
2147
2148#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2149 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2150
2151static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2152 .ce_shared = QCE_CE_SHARED,
2153 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2154 .hw_key_support = QCE_HW_KEY_SUPPORT,
2155 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2156};
2157
2158static struct platform_device qcedev_device = {
2159 .name = "qce",
2160 .id = 0,
2161 .num_resources = ARRAY_SIZE(qcedev_resources),
2162 .resource = qcedev_resources,
2163 .dev = {
2164 .coherent_dma_mask = DMA_BIT_MASK(32),
2165 .platform_data = &qcedev_ce_hw_suppport,
2166 },
2167};
2168#endif
2169
2170
2171static int __init gpiomux_init(void)
2172{
2173 int rc;
2174
2175 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2176 if (rc) {
2177 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2178 return rc;
2179 }
2180
Nishant Pandit24153d82011-08-27 16:05:13 +05302181 msm_gpiomux_install(msm8960_cam_common_configs,
2182 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002183
2184 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002185 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002186
2187 msm_gpiomux_install(msm8960_gsbi_configs,
2188 ARRAY_SIZE(msm8960_gsbi_configs));
2189
2190 msm_gpiomux_install(msm8960_cyts_configs,
2191 ARRAY_SIZE(msm8960_cyts_configs));
2192
2193 msm_gpiomux_install(msm8960_slimbus_config,
2194 ARRAY_SIZE(msm8960_slimbus_config));
2195
2196 msm_gpiomux_install(msm8960_audio_codec_configs,
2197 ARRAY_SIZE(msm8960_audio_codec_configs));
2198
2199#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2200 msm_gpiomux_install(msm8960_hdmi_configs,
2201 ARRAY_SIZE(msm8960_hdmi_configs));
2202#endif
2203
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002204 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2205 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2206
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002207 msm_gpiomux_install(wcnss_5wire_interface,
2208 ARRAY_SIZE(wcnss_5wire_interface));
2209
2210 return 0;
2211}
2212
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002213#define MSM_SHARED_RAM_PHYS 0x80000000
2214
2215static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2216 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2217 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2218 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2219 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2220 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2221 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2222 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2223 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2224 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2225 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2226 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2227 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2228 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
2229 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2230 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
2231 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2232 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2233 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2234 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2235 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2236 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2237 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2238 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2239 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2240 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2241 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2242 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2243 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2244 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2245 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2246};
2247
2248static struct pm8921_adc_properties pm8921_adc_data = {
2249 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2250 .bitresolution = 15,
2251 .bipolar = 0,
2252};
2253
2254static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2255 .adc_channel = pm8921_adc_channels_data,
2256 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
2257 .adc_prop = &pm8921_adc_data,
2258};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002259
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002260static void __init msm8960_map_io(void)
2261{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002262 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002263 msm_map_msm8960_io();
2264}
2265
2266static void __init msm8960_init_irq(void)
2267{
2268 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002269
2270 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002271 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002272 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002273
2274 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002275 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002276
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002277 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2278 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002279
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002280 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2281 * as they are configured as level, which does not play nice with
2282 * handle_percpu_irq.
2283 */
2284 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2285 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002286 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002287 }
2288}
2289
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002290/* MSM8960 have 5 SDCC controllers */
2291enum sdcc_controllers {
2292 SDCC1,
2293 SDCC2,
2294 SDCC3,
2295 SDCC4,
2296 SDCC5,
2297 MAX_SDCC_CONTROLLER
2298};
2299
2300/* All SDCC controllers requires VDD/VCC voltage */
2301static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2302 /* SDCC1 : eMMC card connected */
2303 [SDCC1] = {
2304 .name = "sdc_vdd",
2305 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302306 .high_vol_level = 2950000,
2307 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302308 .always_on = 1,
2309 .lpm_sup = 1,
2310 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002311 .hpm_uA = 200000, /* 200mA */
2312 },
2313 /* SDCC3 : External card slot connected */
2314 [SDCC3] = {
2315 .name = "sdc_vdd",
2316 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302317 .high_vol_level = 2950000,
2318 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002319 .hpm_uA = 600000, /* 600mA */
2320 }
2321};
2322
2323/* Only slots having eMMC card will require VCCQ voltage */
2324static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2325 /* SDCC1 : eMMC card connected */
2326 [SDCC1] = {
2327 .name = "sdc_vccq",
2328 .set_voltage_sup = 1,
2329 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302330 .high_vol_level = 1800000,
2331 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002332 .hpm_uA = 200000, /* 200mA */
2333 }
2334};
2335
2336/* All SDCC controllers may require voting for VDD PAD voltage */
2337static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2338 /* SDCC3 : External card slot connected */
2339 [SDCC3] = {
2340 .name = "sdc_vddp",
2341 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302342 .high_vol_level = 2950000,
2343 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002344 .always_on = 1,
2345 .lpm_sup = 1,
2346 /* Max. Active current required is 16 mA */
2347 .hpm_uA = 16000,
2348 /*
2349 * Sleep current required is ~300 uA. But min. vote can be
2350 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2351 * during sleep.
2352 */
2353 .lpm_uA = 2000,
2354 }
2355};
2356
2357static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2358 /* SDCC1 : eMMC card connected */
2359 [SDCC1] = {
2360 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2361 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2362 },
2363 /* SDCC3 : External card slot connected */
2364 [SDCC3] = {
2365 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2366 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2367 }
2368};
2369
2370/* SDC1 pad data */
2371static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2372 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302373 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2374 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002375};
2376
2377static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2378 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2379 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2380 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2381};
2382
2383static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302384 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002385 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2386 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2387};
2388
2389static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302390 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002391 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2392 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2393};
2394
2395/* SDC3 pad data */
2396static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2397 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2398 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2399 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2400};
2401
2402static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2403 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2404 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2405 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2406};
2407
2408static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302409 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002410 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2411 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2412};
2413
2414static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302415 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002416 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2417 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2418};
2419
2420struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2421 [SDCC1] = {
2422 .on = sdc1_pad_pull_on_cfg,
2423 .off = sdc1_pad_pull_off_cfg,
2424 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2425 },
2426 [SDCC3] = {
2427 .on = sdc3_pad_pull_on_cfg,
2428 .off = sdc3_pad_pull_off_cfg,
2429 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2430 },
2431};
2432
2433struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2434 [SDCC1] = {
2435 .on = sdc1_pad_drv_on_cfg,
2436 .off = sdc1_pad_drv_off_cfg,
2437 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2438 },
2439 [SDCC3] = {
2440 .on = sdc3_pad_drv_on_cfg,
2441 .off = sdc3_pad_drv_off_cfg,
2442 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2443 },
2444};
2445
2446struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2447 [SDCC1] = {
2448 .pull = &mmc_pad_pull_data[SDCC1],
2449 .drv = &mmc_pad_drv_data[SDCC1]
2450 },
2451 [SDCC3] = {
2452 .pull = &mmc_pad_pull_data[SDCC3],
2453 .drv = &mmc_pad_drv_data[SDCC3]
2454 },
2455};
2456
2457struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2458 [SDCC1] = {
2459 .pad_data = &mmc_pad_data[SDCC1],
2460 },
2461 [SDCC3] = {
2462 .pad_data = &mmc_pad_data[SDCC3],
2463 },
2464};
2465
2466static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302467 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002468};
2469
2470static unsigned int sdc3_sup_clk_rates[] = {
2471 400000, 24000000, 48000000, 96000000
2472};
2473
2474#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2475static struct mmc_platform_data msm8960_sdc1_data = {
2476 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2477#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2478 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2479#else
2480 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2481#endif
2482 .sup_clk_table = sdc1_sup_clk_rates,
2483 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2484 .nonremovable = 1,
2485 .sdcc_v4_sup = true,
2486 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302487 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002488};
2489#endif
2490
2491#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2492static struct mmc_platform_data msm8960_sdc3_data = {
2493 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2494 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2495 .sup_clk_table = sdc3_sup_clk_rates,
2496 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
2497 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
2498 .sdcc_v4_sup = true,
2499 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2500 .pin_data = &mmc_slot_pin_data[SDCC3],
2501#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2502 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2503 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2504 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2505#endif
2506 .xpc_cap = 1,
2507 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2508 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302509 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002510};
2511#endif
2512
2513static void __init msm8960_init_mmc(void)
2514{
2515#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2516 /* SDC1 : eMMC card connected */
2517 msm_add_sdcc(1, &msm8960_sdc1_data);
2518#endif
2519#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2520 /* SDC3: External card slot */
2521 msm_add_sdcc(3, &msm8960_sdc3_data);
2522#endif
2523}
2524
2525static void __init msm8960_init_buses(void)
2526{
2527#ifdef CONFIG_MSM_BUS_SCALING
2528 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2529 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2530 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2531 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2532 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2533 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2534 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2535 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2536 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2537 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2538#endif
2539}
2540
2541static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2542 .max_clock_speed = 15060000,
2543};
2544
2545#ifdef CONFIG_USB_MSM_OTG_72K
2546static struct msm_otg_platform_data msm_otg_pdata;
2547#else
2548#define USB_5V_EN 42
2549static void msm_hsusb_vbus_power(bool on)
2550{
2551 int rc;
2552 static bool vbus_is_on;
2553 static struct regulator *mvs_otg_switch;
2554 struct pm_gpio param = {
2555 .direction = PM_GPIO_DIR_OUT,
2556 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2557 .output_value = 1,
2558 .pull = PM_GPIO_PULL_NO,
2559 .vin_sel = PM_GPIO_VIN_S4,
2560 .out_strength = PM_GPIO_STRENGTH_MED,
2561 .function = PM_GPIO_FUNC_NORMAL,
2562 };
2563
2564 if (vbus_is_on == on)
2565 return;
2566
2567 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002568 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2569 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002570 if (IS_ERR(mvs_otg_switch)) {
2571 pr_err("Unable to get mvs_otg_switch\n");
2572 return;
2573 }
2574
2575 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2576 "usb_5v_en");
2577 if (rc < 0) {
2578 pr_err("failed to request usb_5v_en gpio\n");
2579 goto put_mvs_otg;
2580 }
2581
2582 if (regulator_enable(mvs_otg_switch)) {
2583 pr_err("unable to enable mvs_otg_switch\n");
2584 goto free_usb_5v_en;
2585 }
2586
2587 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2588 &param);
2589 if (rc < 0) {
2590 pr_err("failed to configure usb_5v_en gpio\n");
2591 goto disable_mvs_otg;
2592 }
2593 vbus_is_on = true;
2594 return;
2595 }
2596disable_mvs_otg:
2597 regulator_disable(mvs_otg_switch);
2598free_usb_5v_en:
2599 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2600put_mvs_otg:
2601 regulator_put(mvs_otg_switch);
2602 vbus_is_on = false;
2603}
2604
2605static struct msm_otg_platform_data msm_otg_pdata = {
2606 .mode = USB_OTG,
2607 .otg_control = OTG_PMIC_CONTROL,
2608 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2609 .pclk_src_name = "dfab_usb_hs_clk",
2610 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2611 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302612 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002613};
2614#endif
2615
2616#define PID_MAGIC_ID 0x71432909
2617#define SERIAL_NUM_MAGIC_ID 0x61945374
2618#define SERIAL_NUMBER_LENGTH 127
2619#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2620
2621struct magic_num_struct {
2622 uint32_t pid;
2623 uint32_t serial_num;
2624};
2625
2626struct dload_struct {
2627 uint32_t reserved1;
2628 uint32_t reserved2;
2629 uint32_t reserved3;
2630 uint16_t reserved4;
2631 uint16_t pid;
2632 char serial_number[SERIAL_NUMBER_LENGTH];
2633 uint16_t reserved5;
2634 struct magic_num_struct magic_struct;
2635};
2636
2637static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2638{
2639 struct dload_struct __iomem *dload = 0;
2640
2641 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2642 if (!dload) {
2643 pr_err("%s: cannot remap I/O memory region: %08x\n",
2644 __func__, DLOAD_USB_BASE_ADD);
2645 return -ENXIO;
2646 }
2647
2648 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2649 __func__, dload, pid, snum);
2650 /* update pid */
2651 dload->magic_struct.pid = PID_MAGIC_ID;
2652 dload->pid = pid;
2653
2654 /* update serial number */
2655 dload->magic_struct.serial_num = 0;
2656 if (!snum) {
2657 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2658 goto out;
2659 }
2660
2661 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2662 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2663 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2664out:
2665 iounmap(dload);
2666 return 0;
2667}
2668
2669static struct android_usb_platform_data android_usb_pdata = {
2670 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2671};
2672
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002673static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002674 .name = "android_usb",
2675 .id = -1,
2676 .dev = {
2677 .platform_data = &android_usb_pdata,
2678 },
2679};
2680
2681static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2682 0x03, 0x0f,
2683};
2684
2685static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2686 0x00, 0x24, 0x54, 0x10,
2687 0x09, 0x03, 0x01,
2688 0x10, 0x54, 0x30, 0x0C,
2689 0x24, 0x30, 0x0f,
2690};
2691
2692static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2693 0x00, 0x24, 0x54, 0x10,
2694 0x09, 0x07, 0x01, 0x0B,
2695 0x10, 0x54, 0x30, 0x0C,
2696 0x24, 0x30, 0x0f,
2697};
2698
2699static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2700 [0] = {
2701 .mode = MSM_SPM_MODE_CLOCK_GATING,
2702 .notify_rpm = false,
2703 .cmd = spm_wfi_cmd_sequence,
2704 },
2705 [1] = {
2706 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2707 .notify_rpm = false,
2708 .cmd = spm_power_collapse_without_rpm,
2709 },
2710 [2] = {
2711 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2712 .notify_rpm = true,
2713 .cmd = spm_power_collapse_with_rpm,
2714 },
2715};
2716
2717static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2718 [0] = {
2719 .reg_base_addr = MSM_SAW0_BASE,
2720 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2721 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2722 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2723#if defined(CONFIG_MSM_AVS_HW)
2724 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2725 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2726#endif
2727 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2728 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2729 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2730 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2731 .vctl_timeout_us = 50,
2732 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2733 .modes = msm_spm_seq_list,
2734 },
2735 [1] = {
2736 .reg_base_addr = MSM_SAW1_BASE,
2737 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2738 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2739 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2740#if defined(CONFIG_MSM_AVS_HW)
2741 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2742 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2743#endif
2744 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2745 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2746 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2747 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2748 .vctl_timeout_us = 50,
2749 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2750 .modes = msm_spm_seq_list,
2751 },
2752};
2753
2754static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2755 0x00, 0x20, 0x03, 0x20,
2756 0x00, 0x0f,
2757};
2758
2759static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2760 0x00, 0x20, 0x34, 0x64,
2761 0x48, 0x07, 0x48, 0x20,
2762 0x50, 0x64, 0x04, 0x34,
2763 0x50, 0x0f,
2764};
2765static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2766 0x00, 0x10, 0x34, 0x64,
2767 0x48, 0x07, 0x48, 0x10,
2768 0x50, 0x64, 0x04, 0x34,
2769 0x50, 0x0F,
2770};
2771
2772static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2773 [0] = {
2774 .mode = MSM_SPM_L2_MODE_RETENTION,
2775 .notify_rpm = false,
2776 .cmd = l2_spm_wfi_cmd_sequence,
2777 },
2778 [1] = {
2779 .mode = MSM_SPM_L2_MODE_GDHS,
2780 .notify_rpm = true,
2781 .cmd = l2_spm_gdhs_cmd_sequence,
2782 },
2783 [2] = {
2784 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2785 .notify_rpm = true,
2786 .cmd = l2_spm_power_off_cmd_sequence,
2787 },
2788};
2789
2790
2791static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2792 [0] = {
2793 .reg_base_addr = MSM_SAW_L2_BASE,
2794 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2795 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2796 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2797 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2798 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2799 .modes = msm_spm_l2_seq_list,
2800 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2801 },
2802};
2803
2804#define CYTTSP_TS_GPIO_IRQ 11
2805#define CYTTSP_TS_SLEEP_GPIO 50
2806#define CYTTSP_TS_RESOUT_N_GPIO 52
2807
2808/*virtual key support */
2809static ssize_t tma340_vkeys_show(struct kobject *kobj,
2810 struct kobj_attribute *attr, char *buf)
2811{
2812 return snprintf(buf, 200,
2813 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2814 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2815 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2816 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2817 "\n");
2818}
2819
2820static struct kobj_attribute tma340_vkeys_attr = {
2821 .attr = {
2822 .mode = S_IRUGO,
2823 },
2824 .show = &tma340_vkeys_show,
2825};
2826
2827static struct attribute *tma340_properties_attrs[] = {
2828 &tma340_vkeys_attr.attr,
2829 NULL
2830};
2831
2832static struct attribute_group tma340_properties_attr_group = {
2833 .attrs = tma340_properties_attrs,
2834};
2835
2836
2837static int cyttsp_platform_init(struct i2c_client *client)
2838{
2839 int rc = 0;
2840 static struct kobject *tma340_properties_kobj;
2841
2842 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2843 tma340_properties_kobj = kobject_create_and_add("board_properties",
2844 NULL);
2845 if (tma340_properties_kobj)
2846 rc = sysfs_create_group(tma340_properties_kobj,
2847 &tma340_properties_attr_group);
2848 if (!tma340_properties_kobj || rc)
2849 pr_err("%s: failed to create board_properties\n",
2850 __func__);
2851
2852 return 0;
2853}
2854
2855static struct cyttsp_regulator regulator_data[] = {
2856 {
2857 .name = "vdd",
2858 .min_uV = CY_TMA300_VTG_MIN_UV,
2859 .max_uV = CY_TMA300_VTG_MAX_UV,
2860 .load_uA = CY_TMA300_CURR_24HZ_UA,
2861 },
2862 /* TODO: Remove after runtime PM is enabled in I2C driver */
2863 {
2864 .name = "vcc_i2c",
2865 .min_uV = CY_I2C_VTG_MIN_UV,
2866 .max_uV = CY_I2C_VTG_MAX_UV,
2867 .load_uA = CY_I2C_CURR_UA,
2868 },
2869};
2870
2871static struct cyttsp_platform_data cyttsp_pdata = {
2872 .panel_maxx = 634,
2873 .panel_maxy = 1166,
2874 .disp_maxx = 616,
2875 .disp_maxy = 1023,
2876 .disp_minx = 0,
2877 .disp_miny = 16,
2878 .flags = 0x01,
2879 .gen = CY_GEN3, /* or */
2880 .use_st = CY_USE_ST,
2881 .use_mt = CY_USE_MT,
2882 .use_hndshk = CY_SEND_HNDSHK,
2883 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302884 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002885 .use_gestures = CY_USE_GESTURES,
2886 .fw_fname = "cyttsp_8960_cdp.hex",
2887 /* activate up to 4 groups
2888 * and set active distance
2889 */
2890 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2891 CY_GEST_GRP3 | CY_GEST_GRP4 |
2892 CY_ACT_DIST,
2893 /* change act_intrvl to customize the Active power state
2894 * scanning/processing refresh interval for Operating mode
2895 */
2896 .act_intrvl = CY_ACT_INTRVL_DFLT,
2897 /* change tch_tmout to customize the touch timeout for the
2898 * Active power state for Operating mode
2899 */
2900 .tch_tmout = CY_TCH_TMOUT_DFLT,
2901 /* change lp_intrvl to customize the Low Power power state
2902 * scanning/processing refresh interval for Operating mode
2903 */
2904 .lp_intrvl = CY_LP_INTRVL_DFLT,
2905 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2906 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2907 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2908 .regulator_info = regulator_data,
2909 .num_regulators = ARRAY_SIZE(regulator_data),
2910 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302911 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002912};
2913
2914static struct i2c_board_info cyttsp_info[] __initdata = {
2915 {
2916 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2917 .platform_data = &cyttsp_pdata,
2918#ifndef CY_USE_TIMER
2919 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2920#endif /* CY_USE_TIMER */
2921 },
2922};
2923
Mohan Pallaka50837382011-09-07 11:00:57 +05302924/* configuration data */
2925static const u8 mxt_config_data[] = {
2926 /* T6 Object */
2927 0, 0, 0, 0, 0, 0,
2928 /* T38 Object */
2929 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
2930 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2931 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2932 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2933 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2934 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2935 0, 0, 0, 0,
2936 /* T7 Object */
2937 10, 10, 50,
2938 /* T8 Object */
2939 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2940 /* T9 Object */
2941 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
2942 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
2943 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
2944 0, 5, 45, 46,
2945 /* T15 Object */
2946 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2947 0,
2948 /* T22 Object */
2949 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2950 0, 0, 255, 255, 255, 255, 0,
2951 /* T24 Object */
2952 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2953 0, 0, 0, 0, 0, 0, 0, 0, 0,
2954 /* T25 Object */
2955 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2956 0, 0, 0, 0,
2957 /* T27 Object */
2958 0, 0, 0, 0, 0, 0, 0,
2959 /* T28 Object */
2960 0, 0, 0, 8, 8, 8,
2961 /* T40 Object */
2962 0, 0, 0, 0, 0,
2963 /* T41 Object */
2964 0, 0, 0, 0, 0, 0,
2965 /* T43 Object */
2966 0, 0, 0, 0, 0, 0,
2967};
2968
2969#define MXT_TS_GPIO_IRQ 11
2970#define MXT_TS_LDO_EN_GPIO 50
2971#define MXT_TS_RESET_GPIO 52
2972
2973static void mxt_init_hw_liquid(void)
2974{
2975 int rc;
2976
2977 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
2978 if (rc) {
2979 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
2980 __func__, MXT_TS_GPIO_IRQ);
2981 return;
2982 }
2983
2984 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
2985 if (rc) {
2986 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
2987 __func__, MXT_TS_GPIO_IRQ);
2988 goto err_irq_gpio_req;
2989 }
2990
2991 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2992 if (rc) {
2993 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
2994 __func__, MXT_TS_LDO_EN_GPIO);
2995 goto err_irq_gpio_req;
2996 }
2997
2998 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2999 if (rc) {
3000 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3001 __func__, MXT_TS_LDO_EN_GPIO);
3002 goto err_ldo_gpio_req;
3003 }
3004
3005 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3006 if (rc) {
3007 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3008 __func__, MXT_TS_RESET_GPIO);
3009 goto err_ldo_gpio_set_dir;
3010 }
3011
3012 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3013 if (rc) {
3014 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3015 __func__, MXT_TS_RESET_GPIO);
3016 goto err_reset_gpio_req;
3017 }
3018
3019 return;
3020
3021err_reset_gpio_req:
3022 gpio_free(MXT_TS_RESET_GPIO);
3023err_ldo_gpio_set_dir:
3024 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3025err_ldo_gpio_req:
3026 gpio_free(MXT_TS_LDO_EN_GPIO);
3027err_irq_gpio_req:
3028 gpio_free(MXT_TS_GPIO_IRQ);
3029}
3030
3031static struct mxt_platform_data mxt_platform_data = {
3032 .config = mxt_config_data,
3033 .config_length = ARRAY_SIZE(mxt_config_data),
3034 .x_line = 26,
3035 .y_line = 42,
3036 .x_size = 767,
3037 .y_size = 1365,
3038 .blen = 32,
3039 .threshold = 40,
3040 .voltage = 3300000, /* 3.3V */
3041 .orient = MXT_ROTATED_90,
3042 .irqflags = IRQF_TRIGGER_FALLING,
3043};
3044
3045static struct i2c_board_info mxt_device_info[] __initdata = {
3046 {
3047 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3048 .platform_data = &mxt_platform_data,
3049 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3050 },
3051};
3052
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003053static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3054{
3055}
3056
3057static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3058 .clk_freq = 100000,
3059 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003060 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3061};
3062
3063static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3064 .clk_freq = 100000,
3065 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003066 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3067};
3068
3069static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3070 .clk_freq = 100000,
3071 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003072 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3073};
3074
3075static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3076 .clk_freq = 100000,
3077 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003078 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3079};
3080
3081static struct msm_rpm_platform_data msm_rpm_data = {
3082 .reg_base_addrs = {
3083 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3084 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3085 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3086 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3087 },
3088
3089 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3090 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3091 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3092 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3093 .msm_apps_ipc_rpm_val = 4,
3094};
3095
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003096static struct platform_device msm_rpm_device = {
3097 .name = "msm_rpm",
3098 .id = -1,
3099};
3100
3101
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003102static struct spi_board_info spi_board_info[] __initdata = {
3103 {
3104 .modalias = "ks8851",
3105 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3106 .max_speed_hz = 19200000,
3107 .bus_num = 0,
3108 .chip_select = 0,
3109 .mode = SPI_MODE_0,
3110 },
3111};
3112
3113static struct platform_device msm_device_saw_core0 = {
3114 .name = "saw-regulator",
3115 .id = 0,
3116 .dev = {
3117 .platform_data = &msm_saw_regulator_pdata_s5,
3118 },
3119};
3120
3121static struct platform_device msm_device_saw_core1 = {
3122 .name = "saw-regulator",
3123 .id = 1,
3124 .dev = {
3125 .platform_data = &msm_saw_regulator_pdata_s6,
3126 },
3127};
3128
3129#ifdef CONFIG_MSM_FAKE_BATTERY
3130static struct platform_device fish_battery_device = {
3131 .name = "fish_battery",
3132};
3133#endif
3134
David Collins26f05562011-06-20 09:56:28 -07003135static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003136 .name = GPIO_REGULATOR_DEV_NAME,
3137 .id = PM8921_MPP_PM_TO_SYS(7),
3138 .dev = {
3139 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3140 },
3141};
3142
David Collins26f05562011-06-20 09:56:28 -07003143static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003144 .name = GPIO_REGULATOR_DEV_NAME,
3145 .id = 91,
3146 .dev = {
3147 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3148 },
3149};
3150
David Collinsb10be1d2011-09-02 10:29:31 -07003151static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3152 .name = GPIO_REGULATOR_DEV_NAME,
3153 .id = PM8921_GPIO_PM_TO_SYS(17),
3154 .dev = {
3155 .platform_data =
3156 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3157 },
3158};
3159
David Collins26f05562011-06-20 09:56:28 -07003160static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3161 .name = "rpm-regulator",
3162 .id = -1,
3163 .dev = {
3164 .platform_data = &msm_rpm_regulator_pdata,
3165 },
3166};
3167
David Collins4c31a872011-08-31 10:07:10 -07003168static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3169 .phys_addr_base = 0x0010C000,
3170 .reg_offsets = {
3171 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3172 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3173 },
3174 .phys_size = SZ_8K,
3175 .log_len = 4096, /* log's buffer length in bytes */
3176 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3177};
3178
3179static struct platform_device msm_rpm_log_device = {
3180 .name = "msm_rpm_log",
3181 .id = -1,
3182 .dev = {
3183 .platform_data = &msm_rpm_log_pdata,
3184 },
3185};
3186
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003187static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003188 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003189 &msm_device_smd,
3190 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303191 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003192 &msm_device_saw_core0,
3193 &msm_device_saw_core1,
3194 &msm8960_device_ext_5v_vreg,
3195 &msm8960_device_ext_l2_vreg,
3196 &msm8960_device_ssbi_pm8921,
3197 &msm8960_device_qup_spi_gsbi1,
3198 &msm8960_device_qup_i2c_gsbi3,
3199 &msm8960_device_qup_i2c_gsbi4,
3200 &msm8960_device_qup_i2c_gsbi10,
3201#ifndef CONFIG_MSM_DSPS
3202 &msm8960_device_qup_i2c_gsbi12,
3203#endif
3204 &msm_slim_ctrl,
3205 &msm_device_wcnss_wlan,
3206#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3207 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3208 &qcrypto_device,
3209#endif
3210
3211#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3212 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3213 &qcedev_device,
3214#endif
3215#ifdef CONFIG_MSM_ROTATOR
3216 &msm_rotator_device,
3217#endif
3218 &msm_device_sps,
3219#ifdef CONFIG_MSM_FAKE_BATTERY
3220 &fish_battery_device,
3221#endif
3222#ifdef CONFIG_ANDROID_PMEM
3223 &android_pmem_device,
3224 &android_pmem_adsp_device,
3225 &android_pmem_audio_device,
3226#endif
3227 &msm_fb_device,
3228 &msm_device_vidc,
3229 &msm_device_bam_dmux,
3230 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003231
3232#ifdef CONFIG_HW_RANDOM_MSM
3233 &msm_device_rng,
3234#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003235 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003236#ifdef CONFIG_ION_MSM
3237 &ion_dev,
3238#endif
David Collins4c31a872011-08-31 10:07:10 -07003239 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003240#ifdef CONFIG_MSM_QDSS
3241 &msm_etb_device,
3242 &msm_tpiu_device,
3243 &msm_funnel_device,
3244 &msm_ptm_device,
3245#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003246};
3247
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003248static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003249 &msm8960_device_otg,
3250 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003251 &msm_device_hsusb_host,
3252 &android_usb_device,
3253 &msm_device_vidc,
3254 &mipi_dsi_simulator_panel_device,
3255 &msm_bus_apps_fabric,
3256 &msm_bus_sys_fabric,
3257 &msm_bus_mm_fabric,
3258 &msm_bus_sys_fpb,
3259 &msm_bus_cpss_fpb,
3260 &msm_pcm,
3261 &msm_pcm_routing,
3262 &msm_cpudai0,
3263 &msm_cpudai1,
3264 &msm_cpudai_hdmi_rx,
3265 &msm_cpudai_bt_rx,
3266 &msm_cpudai_bt_tx,
3267 &msm_cpudai_fm_rx,
3268 &msm_cpudai_fm_tx,
3269 &msm_cpu_fe,
3270 &msm_stub_codec,
3271 &msm_voice,
3272 &msm_voip,
3273 &msm_lpa_pcm,
3274
3275#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3276 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3277 &qcrypto_device,
3278#endif
3279
3280#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3281 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3282 &qcedev_device,
3283#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003284};
3285
3286static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003287 &msm_kgsl_3d0,
3288 &msm_kgsl_2d0,
3289 &msm_kgsl_2d1,
3290 &mipi_dsi_renesas_panel_device,
3291#ifdef CONFIG_MSM_GEMINI
3292 &msm8960_gemini_device,
3293#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003294};
3295
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003296static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003297 &msm8960_device_otg,
3298 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003299 &msm_device_hsusb_host,
3300 &android_usb_device,
3301 &msm_pcm,
3302 &msm_pcm_routing,
3303 &msm_cpudai0,
3304 &msm_cpudai1,
3305 &msm_cpudai_hdmi_rx,
3306 &msm_cpudai_bt_rx,
3307 &msm_cpudai_bt_tx,
3308 &msm_cpudai_fm_rx,
3309 &msm_cpudai_fm_tx,
3310 &msm_cpu_fe,
3311 &msm_stub_codec,
3312 &msm_kgsl_3d0,
3313#ifdef CONFIG_MSM_KGSL_2D
3314 &msm_kgsl_2d0,
3315 &msm_kgsl_2d1,
3316#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003317 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003318#ifdef CONFIG_MSM_GEMINI
3319 &msm8960_gemini_device,
3320#endif
3321 &msm_voice,
3322 &msm_voip,
3323 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303324 &msm_cpudai_afe_01_rx,
3325 &msm_cpudai_afe_01_tx,
3326 &msm_cpudai_afe_02_rx,
3327 &msm_cpudai_afe_02_tx,
3328 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003329#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3330 &hdmi_msm_device,
3331#endif
3332 &msm_pcm_hostless,
3333 &msm_bus_apps_fabric,
3334 &msm_bus_sys_fabric,
3335 &msm_bus_mm_fabric,
3336 &msm_bus_sys_fpb,
3337 &msm_bus_cpss_fpb,
3338};
3339
3340static void __init msm8960_i2c_init(void)
3341{
3342 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3343 &msm8960_i2c_qup_gsbi4_pdata;
3344
3345 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3346 &msm8960_i2c_qup_gsbi3_pdata;
3347
3348 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3349 &msm8960_i2c_qup_gsbi10_pdata;
3350
3351 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3352 &msm8960_i2c_qup_gsbi12_pdata;
3353}
3354
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003355static void __init msm8960_gfx_init(void)
3356{
3357 uint32_t soc_platform_version = socinfo_get_platform_version();
3358 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3359 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3360 msm_kgsl_3d0.dev.platform_data;
3361 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3362 320000000;
3363 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3364 266667000;
3365 }
3366}
3367
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003368static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3369 .irq_base = PM8921_IRQ_BASE,
3370 .devirq = MSM_GPIO_TO_INT(104),
3371 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3372};
3373
3374static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3375 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3376};
3377
3378static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3379 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3380};
3381
3382static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3383 .rtc_write_enable = false,
3384};
3385
3386static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3387 .pull_up = 1,
3388 .kpd_trigger_delay_us = 970,
3389 .wakeup = 1,
3390};
3391
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303392/* Rotate lock key is not available so use F1 */
3393#define KEY_ROTATE_LOCK KEY_F1
3394
3395static const unsigned int keymap_liquid[] = {
3396 KEY(0, 0, KEY_VOLUMEUP),
3397 KEY(0, 1, KEY_VOLUMEDOWN),
3398 KEY(1, 3, KEY_ROTATE_LOCK),
3399 KEY(1, 4, KEY_HOME),
3400};
3401
3402static struct matrix_keymap_data keymap_data_liquid = {
3403 .keymap_size = ARRAY_SIZE(keymap_liquid),
3404 .keymap = keymap_liquid,
3405};
3406
3407static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3408 .input_name = "keypad_8960_liquid",
3409 .input_phys_device = "keypad_8960/input0",
3410 .num_rows = 2,
3411 .num_cols = 5,
3412 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3413 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3414 .debounce_ms = 15,
3415 .scan_delay_ms = 32,
3416 .row_hold_ns = 91500,
3417 .wakeup = 1,
3418 .keymap_data = &keymap_data_liquid,
3419};
3420
3421
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003422static const unsigned int keymap[] = {
3423 KEY(0, 0, KEY_VOLUMEUP),
3424 KEY(0, 1, KEY_VOLUMEDOWN),
3425 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3426 KEY(0, 3, KEY_CAMERA_FOCUS),
3427};
3428
3429static struct matrix_keymap_data keymap_data = {
3430 .keymap_size = ARRAY_SIZE(keymap),
3431 .keymap = keymap,
3432};
3433
3434static struct pm8xxx_keypad_platform_data keypad_data = {
3435 .input_name = "keypad_8960",
3436 .input_phys_device = "keypad_8960/input0",
3437 .num_rows = 1,
3438 .num_cols = 5,
3439 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3440 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3441 .debounce_ms = 15,
3442 .scan_delay_ms = 32,
3443 .row_hold_ns = 91500,
3444 .wakeup = 1,
3445 .keymap_data = &keymap_data,
3446};
3447
3448static const unsigned int keymap_sim[] = {
3449 KEY(0, 0, KEY_7),
3450 KEY(0, 1, KEY_DOWN),
3451 KEY(0, 2, KEY_UP),
3452 KEY(0, 3, KEY_RIGHT),
3453 KEY(0, 4, KEY_ENTER),
3454 KEY(0, 5, KEY_L),
3455 KEY(0, 6, KEY_BACK),
3456 KEY(0, 7, KEY_M),
3457
3458 KEY(1, 0, KEY_LEFT),
3459 KEY(1, 1, KEY_SEND),
3460 KEY(1, 2, KEY_1),
3461 KEY(1, 3, KEY_4),
3462 KEY(1, 4, KEY_CLEAR),
3463 KEY(1, 5, KEY_MSDOS),
3464 KEY(1, 6, KEY_SPACE),
3465 KEY(1, 7, KEY_COMMA),
3466
3467 KEY(2, 0, KEY_6),
3468 KEY(2, 1, KEY_5),
3469 KEY(2, 2, KEY_8),
3470 KEY(2, 3, KEY_3),
3471 KEY(2, 4, KEY_NUMERIC_STAR),
3472 KEY(2, 5, KEY_UP),
3473 KEY(2, 6, KEY_DOWN),
3474 KEY(2, 7, KEY_LEFTSHIFT),
3475
3476 KEY(3, 0, KEY_9),
3477 KEY(3, 1, KEY_NUMERIC_POUND),
3478 KEY(3, 2, KEY_0),
3479 KEY(3, 3, KEY_2),
3480 KEY(3, 4, KEY_SLEEP),
3481 KEY(3, 5, KEY_F1),
3482 KEY(3, 6, KEY_F2),
3483 KEY(3, 7, KEY_F3),
3484
3485 KEY(4, 0, KEY_BACK),
3486 KEY(4, 1, KEY_HOME),
3487 KEY(4, 2, KEY_MENU),
3488 KEY(4, 3, KEY_VOLUMEUP),
3489 KEY(4, 4, KEY_VOLUMEDOWN),
3490 KEY(4, 5, KEY_F4),
3491 KEY(4, 6, KEY_F5),
3492 KEY(4, 7, KEY_F6),
3493
3494 KEY(5, 0, KEY_R),
3495 KEY(5, 1, KEY_T),
3496 KEY(5, 2, KEY_Y),
3497 KEY(5, 3, KEY_LEFTALT),
3498 KEY(5, 4, KEY_KPENTER),
3499 KEY(5, 5, KEY_Q),
3500 KEY(5, 6, KEY_W),
3501 KEY(5, 7, KEY_E),
3502
3503 KEY(6, 0, KEY_F),
3504 KEY(6, 1, KEY_G),
3505 KEY(6, 2, KEY_H),
3506 KEY(6, 3, KEY_CAPSLOCK),
3507 KEY(6, 4, KEY_PAGEUP),
3508 KEY(6, 5, KEY_A),
3509 KEY(6, 6, KEY_S),
3510 KEY(6, 7, KEY_D),
3511
3512 KEY(7, 0, KEY_V),
3513 KEY(7, 1, KEY_B),
3514 KEY(7, 2, KEY_N),
3515 KEY(7, 3, KEY_MENU),
3516 KEY(7, 4, KEY_PAGEDOWN),
3517 KEY(7, 5, KEY_Z),
3518 KEY(7, 6, KEY_X),
3519 KEY(7, 7, KEY_C),
3520
3521 KEY(8, 0, KEY_P),
3522 KEY(8, 1, KEY_J),
3523 KEY(8, 2, KEY_K),
3524 KEY(8, 3, KEY_INSERT),
3525 KEY(8, 4, KEY_LINEFEED),
3526 KEY(8, 5, KEY_U),
3527 KEY(8, 6, KEY_I),
3528 KEY(8, 7, KEY_O),
3529
3530 KEY(9, 0, KEY_4),
3531 KEY(9, 1, KEY_5),
3532 KEY(9, 2, KEY_6),
3533 KEY(9, 3, KEY_7),
3534 KEY(9, 4, KEY_8),
3535 KEY(9, 5, KEY_1),
3536 KEY(9, 6, KEY_2),
3537 KEY(9, 7, KEY_3),
3538
3539 KEY(10, 0, KEY_F7),
3540 KEY(10, 1, KEY_F8),
3541 KEY(10, 2, KEY_F9),
3542 KEY(10, 3, KEY_F10),
3543 KEY(10, 4, KEY_FN),
3544 KEY(10, 5, KEY_9),
3545 KEY(10, 6, KEY_0),
3546 KEY(10, 7, KEY_DOT),
3547
3548 KEY(11, 0, KEY_LEFTCTRL),
3549 KEY(11, 1, KEY_F11),
3550 KEY(11, 2, KEY_ENTER),
3551 KEY(11, 3, KEY_SEARCH),
3552 KEY(11, 4, KEY_DELETE),
3553 KEY(11, 5, KEY_RIGHT),
3554 KEY(11, 6, KEY_LEFT),
3555 KEY(11, 7, KEY_RIGHTSHIFT),
3556 KEY(0, 0, KEY_VOLUMEUP),
3557 KEY(0, 1, KEY_VOLUMEDOWN),
3558 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3559 KEY(0, 3, KEY_CAMERA_FOCUS),
3560};
3561
3562static struct matrix_keymap_data keymap_data_sim = {
3563 .keymap_size = ARRAY_SIZE(keymap_sim),
3564 .keymap = keymap_sim,
3565};
3566
3567static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3568 .input_name = "keypad_8960",
3569 .input_phys_device = "keypad_8960/input0",
3570 .num_rows = 12,
3571 .num_cols = 8,
3572 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3573 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3574 .debounce_ms = 15,
3575 .scan_delay_ms = 32,
3576 .row_hold_ns = 91500,
3577 .wakeup = 1,
3578 .keymap_data = &keymap_data_sim,
3579};
3580
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003581static int pm8921_therm_mitigation[] = {
3582 1100,
3583 700,
3584 600,
3585 325,
3586};
3587
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003588static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003589 .safety_time = 180,
3590 .update_time = 1,
3591 .max_voltage = 4200,
3592 .min_voltage = 3200,
3593 .resume_voltage = 4100,
3594 .term_current = 100,
3595 .cool_temp = 10,
3596 .warm_temp = 40,
3597 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003598 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003599 .cool_bat_chg_current = 350,
3600 .warm_bat_chg_current = 350,
3601 .cool_bat_voltage = 4100,
3602 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003603 .thermal_mitigation = pm8921_therm_mitigation,
3604 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003605};
3606
3607static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3608 .priority = 0,
3609};
3610
3611static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3612 .r_sense = 10,
3613 .i_test = 2500,
3614 .v_failure = 3000,
3615 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003616};
3617
Jay Chokshide4cefb2011-08-04 18:10:44 -07003618#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3619
3620/**
3621 * 'flag' stores three values; led id, led mode, and max current of led.
3622 * The bit packing format is as follow,
3623 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3624 * led_id (1 nibble)
3625 */
3626#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3627 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3628 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3629 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3630 PM8XXX_LED_MAX_CURRENT_MASK))
3631
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003632static struct led_info pm8921_led_info[] = {
3633 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003634 .name = "led:usb",
3635 .default_trigger = "usb-online",
3636 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3637 PM8XXX_LED_MODE_MANUAL,
3638 PM8921_LC_LED_MAX_CURRENT),
3639 },
3640 [1] = {
3641 .name = "led:ac",
3642 .default_trigger = "ac-online",
3643 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3644 PM8XXX_LED_MODE_MANUAL,
3645 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003646 },
3647};
3648
3649static struct led_platform_data pm8xxx_leds_pdata = {
3650 .num_leds = ARRAY_SIZE(pm8921_led_info),
3651 .leds = pm8921_led_info,
3652};
3653
3654static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3655 .irq_pdata = &pm8xxx_irq_pdata,
3656 .gpio_pdata = &pm8xxx_gpio_pdata,
3657 .mpp_pdata = &pm8xxx_mpp_pdata,
3658 .rtc_pdata = &pm8xxx_rtc_pdata,
3659 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3660 .keypad_pdata = &keypad_data,
3661 .misc_pdata = &pm8xxx_misc_pdata,
3662 .regulator_pdatas = msm_pm8921_regulator_pdata,
3663 .charger_pdata = &pm8921_chg_pdata,
3664 .bms_pdata = &pm8921_bms_pdata,
3665 .adc_pdata = &pm8921_adc_pdata,
3666 .leds_pdata = &pm8xxx_leds_pdata,
3667};
3668
3669static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3670 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3671 .slave = {
3672 .name = "pm8921-core",
3673 .platform_data = &pm8921_platform_data,
3674 },
3675};
3676
3677static void msm8960_wcnss_init(void)
3678{
3679 int i, ret, j;
3680
3681 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3682 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3683 "wcnss_5_wire");
3684 if (ret) {
3685 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3686 wcnss_5wire_interface[i].gpio, ret);
3687 goto fail;
3688 }
3689 }
3690
3691 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3692
3693 return;
3694
3695fail:
3696 for (j = 0; j < i; j++)
3697 gpio_free(wcnss_5wire_interface[j].gpio);
3698}
3699
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003700#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003701static int ethernet_init(void)
3702{
3703 int ret;
3704 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3705 if (ret) {
3706 pr_err("ks8851 gpio_request failed: %d\n", ret);
3707 goto fail;
3708 }
3709
3710 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3711 if (ret) {
3712 pr_err("ks8851 gpio_request failed: %d\n", ret);
3713 goto fail_rst;
3714 }
3715
3716 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3717 if (ret) {
3718 pr_err("ks8851 gpio_request failed: %d\n", ret);
3719 goto fail_cs;
3720 }
3721
3722 gpio_direction_output(FPGA_CS_GPIO, 1);
3723 gpio_direction_output(KS8851_RST_GPIO, 1);
3724 return 0;
3725fail_cs:
3726 gpio_free(KS8851_RST_GPIO);
3727fail_rst:
3728 gpio_free(KS8851_IRQ_GPIO);
3729fail:
3730 return ret;
3731}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003732#else
3733static int ethernet_init(void)
3734{
3735 return 0;
3736}
3737#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003738
3739static struct msm_cpuidle_state msm_cstates[] __initdata = {
3740 {0, 0, "C0", "WFI",
3741 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3742
3743 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3744 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3745
3746 {0, 2, "C2", "POWER_COLLAPSE",
3747 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3748
3749 {1, 0, "C0", "WFI",
3750 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3751
3752 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3753 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3754};
3755
3756static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3757 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3758 .idle_supported = 1,
3759 .suspend_supported = 1,
3760 .idle_enabled = 0,
3761 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003762 },
3763
3764 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3765 .idle_supported = 1,
3766 .suspend_supported = 1,
3767 .idle_enabled = 0,
3768 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003769 },
3770
3771 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3772 .idle_supported = 1,
3773 .suspend_supported = 1,
3774 .idle_enabled = 1,
3775 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003776 },
3777
3778 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3779 .idle_supported = 0,
3780 .suspend_supported = 1,
3781 .idle_enabled = 0,
3782 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003783 },
3784
3785 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3786 .idle_supported = 1,
3787 .suspend_supported = 1,
3788 .idle_enabled = 0,
3789 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003790 },
3791
3792 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3793 .idle_supported = 1,
3794 .suspend_supported = 0,
3795 .idle_enabled = 1,
3796 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003797 },
3798};
3799
3800static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3801 {
3802 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3803 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3804 true,
3805 1, 8000, 100000, 1,
3806 },
3807
3808 {
3809 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3810 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3811 true,
3812 1500, 5000, 60100000, 3000,
3813 },
3814
3815 {
3816 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3817 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3818 false,
3819 1800, 5000, 60350000, 3500,
3820 },
3821
3822 {
3823 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3824 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3825 false,
3826 2800, 2500, 65350000, 4800,
3827 },
3828
3829 {
3830 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3831 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3832 false,
3833 3800, 4500, 67850000, 5500,
3834 },
3835
3836 {
3837 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3838 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3839 false,
3840 4800, 2000, 71850000, 6800,
3841 },
3842
3843 {
3844 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3845 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3846 false,
3847 6800, 500, 75850000, 8800,
3848 },
3849
3850 {
3851 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3852 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3853 false,
3854 7800, 0, 76350000, 9800,
3855 },
3856};
3857
3858#ifdef CONFIG_I2C
3859#define I2C_SURF 1
3860#define I2C_FFA (1 << 1)
3861#define I2C_RUMI (1 << 2)
3862#define I2C_SIM (1 << 3)
3863#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003864#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003865
3866struct i2c_registry {
3867 u8 machs;
3868 int bus;
3869 struct i2c_board_info *info;
3870 int len;
3871};
3872
3873#ifdef CONFIG_MSM_CAMERA
3874static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3875#ifdef CONFIG_IMX074
3876 {
3877 I2C_BOARD_INFO("imx074", 0x1A),
3878 },
3879#endif
3880#ifdef CONFIG_OV2720
3881 {
3882 I2C_BOARD_INFO("ov2720", 0x6C),
3883 },
3884#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003885 {
3886 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3887 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303888#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3889 {
3890 I2C_BOARD_INFO("sc628a", 0x6E),
3891 },
3892#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003893};
3894#endif
3895
3896/* Sensors DSPS platform data */
3897#ifdef CONFIG_MSM_DSPS
3898#define DSPS_PIL_GENERIC_NAME "dsps"
3899#endif /* CONFIG_MSM_DSPS */
3900
3901static void __init msm8960_init_dsps(void)
3902{
3903#ifdef CONFIG_MSM_DSPS
3904 struct msm_dsps_platform_data *pdata =
3905 msm_dsps_device.dev.platform_data;
3906 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3907 pdata->gpios = NULL;
3908 pdata->gpios_num = 0;
3909
3910 platform_device_register(&msm_dsps_device);
3911#endif /* CONFIG_MSM_DSPS */
3912}
3913
3914static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3915#ifdef CONFIG_MSM_CAMERA
3916 {
Amir Samuelov05f87802011-08-27 18:30:12 +03003917 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003918 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3919 msm_camera_boardinfo,
3920 ARRAY_SIZE(msm_camera_boardinfo),
3921 },
3922#endif
3923 {
3924 I2C_SURF | I2C_FFA | I2C_FLUID,
3925 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3926 cyttsp_info,
3927 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003928 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303929 {
3930 I2C_LIQUID,
3931 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3932 mxt_device_info,
3933 ARRAY_SIZE(mxt_device_info),
3934 },
3935
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003936};
3937#endif /* CONFIG_I2C */
3938
3939static void __init register_i2c_devices(void)
3940{
3941#ifdef CONFIG_I2C
3942 u8 mach_mask = 0;
3943 int i;
3944
3945 /* Build the matching 'supported_machs' bitmask */
3946 if (machine_is_msm8960_cdp())
3947 mach_mask = I2C_SURF;
3948 else if (machine_is_msm8960_rumi3())
3949 mach_mask = I2C_RUMI;
3950 else if (machine_is_msm8960_sim())
3951 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003952 else if (machine_is_msm8960_fluid())
3953 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03003954 else if (machine_is_msm8960_liquid())
3955 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003956 else if (machine_is_msm8960_mtp())
3957 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003958 else
3959 pr_err("unmatched machine ID in register_i2c_devices\n");
3960
3961 /* Run the array and install devices as appropriate */
3962 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3963 if (msm8960_i2c_devices[i].machs & mach_mask)
3964 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3965 msm8960_i2c_devices[i].info,
3966 msm8960_i2c_devices[i].len);
3967 }
3968#endif
3969}
3970
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003971static void __init msm8960_sim_init(void)
3972{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003973 if (socinfo_init() < 0)
3974 pr_err("socinfo_init() failed!\n");
3975
3976 BUG_ON(msm_rpm_init(&msm_rpm_data));
3977 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3978 ARRAY_SIZE(msm_rpmrs_levels)));
3979 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003980 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003981 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003982 msm8960_device_ssbi_pm8921.dev.platform_data =
3983 &msm8960_ssbi_pm8921_pdata;
3984 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003985
3986 /* Simulator supports a QWERTY keypad */
3987 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
3988
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003989 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3990 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3991 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003992 gpiomux_init();
3993 ethernet_init();
3994 msm8960_i2c_init();
3995 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3996 msm_spm_l2_init(msm_spm_l2_data);
3997 msm8960_init_buses();
3998 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3999 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004000 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004001 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004002
4003 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4004 &msm8960_qup_spi_gsbi1_pdata;
4005 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4006
4007 msm8960_init_mmc();
4008 msm_fb_add_devices();
4009 slim_register_board_info(msm_slim_devices,
4010 ARRAY_SIZE(msm_slim_devices));
4011 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4012 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4013 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4014 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004015}
4016
4017static void __init msm8960_rumi3_init(void)
4018{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004019 if (socinfo_init() < 0)
4020 pr_err("socinfo_init() failed!\n");
4021
4022 BUG_ON(msm_rpm_init(&msm_rpm_data));
4023 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4024 ARRAY_SIZE(msm_rpmrs_levels)));
4025 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004026 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004027 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004028 gpiomux_init();
4029 ethernet_init();
4030 msm8960_device_ssbi_pm8921.dev.platform_data =
4031 &msm8960_ssbi_pm8921_pdata;
4032 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4033 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4034 &msm8960_qup_spi_gsbi1_pdata;
4035 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4036 msm8960_i2c_init();
4037 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4038 msm_spm_l2_init(msm_spm_l2_data);
4039 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4040 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004041 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004042 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004043 register_i2c_devices();
4044 msm_fb_add_devices();
4045 slim_register_board_info(msm_slim_devices,
4046 ARRAY_SIZE(msm_slim_devices));
4047 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4048 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4049 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4050 msm_pm_data);
4051}
4052
4053static void __init msm8960_cdp_init(void)
4054{
4055 if (socinfo_init() < 0)
4056 pr_err("socinfo_init() failed!\n");
4057
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004058 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4059 pr_err("meminfo_init() failed!\n");
4060
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004061 BUG_ON(msm_rpm_init(&msm_rpm_data));
4062 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4063 ARRAY_SIZE(msm_rpmrs_levels)));
4064 regulator_suppress_info_printing();
4065 if (msm_xo_init())
4066 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004067 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004068 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004069 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4070 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4071 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004072 gpiomux_init();
4073 ethernet_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304074 if (machine_is_msm8960_liquid())
4075 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004076 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4077 &msm8960_qup_spi_gsbi1_pdata;
4078 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4079 msm8960_device_ssbi_pm8921.dev.platform_data =
4080 &msm8960_ssbi_pm8921_pdata;
4081 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4082 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004083 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004084 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4085 msm_spm_l2_init(msm_spm_l2_data);
4086 msm8960_init_buses();
4087 platform_add_devices(msm_footswitch_devices,
4088 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004089 if (machine_is_msm8960_liquid())
4090 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004091 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4092 pm8921_gpio_mpp_init();
4093 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4094 msm8960_init_cam();
4095 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004096 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304097 if (machine_is_msm8960_liquid())
4098 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004099 register_i2c_devices();
4100 msm8960_wcnss_init();
4101 msm_fb_add_devices();
4102 slim_register_board_info(msm_slim_devices,
4103 ARRAY_SIZE(msm_slim_devices));
4104 msm8960_init_dsps();
4105 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4106 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4107 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4108 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004109 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004110}
4111
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004112MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4113 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004114 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004115 .init_irq = msm8960_init_irq,
4116 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004117 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004118 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004119MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004120
4121MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4122 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004123 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004124 .init_irq = msm8960_init_irq,
4125 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004126 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004127 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004128MACHINE_END
4129
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004130MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4131 .map_io = msm8960_map_io,
4132 .reserve = msm8960_reserve,
4133 .init_irq = msm8960_init_irq,
4134 .timer = &msm_timer,
4135 .init_machine = msm8960_cdp_init,
4136 .init_early = msm8960_allocate_memory_regions,
4137MACHINE_END
4138
4139MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4140 .map_io = msm8960_map_io,
4141 .reserve = msm8960_reserve,
4142 .init_irq = msm8960_init_irq,
4143 .timer = &msm_timer,
4144 .init_machine = msm8960_cdp_init,
4145 .init_early = msm8960_allocate_memory_regions,
4146MACHINE_END
4147
4148MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4149 .map_io = msm8960_map_io,
4150 .reserve = msm8960_reserve,
4151 .init_irq = msm8960_init_irq,
4152 .timer = &msm_timer,
4153 .init_machine = msm8960_cdp_init,
4154 .init_early = msm8960_allocate_memory_regions,
4155MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004156
4157MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4158 .map_io = msm8960_map_io,
4159 .reserve = msm8960_reserve,
4160 .init_irq = msm8960_init_irq,
4161 .timer = &msm_timer,
4162 .init_machine = msm8960_cdp_init,
4163 .init_early = msm8960_allocate_memory_regions,
4164MACHINE_END