blob: 7b2c7785482c4d6c43002b5322a174541940993e [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>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -070024#include <linux/mfd/pm8xxx/pm8921-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080042
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070045#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048
49#include <mach/board.h>
50#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <mach/msm_spi.h>
52#ifdef CONFIG_USB_MSM_OTG_72K
53#include <mach/msm_hsusb.h>
54#else
55#include <linux/usb/msm_hsusb.h>
56#endif
57#include <linux/usb/android.h>
58#include <mach/usbdiag.h>
59#include <mach/socinfo.h>
60#include <mach/rpm.h>
61#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070062#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#include <mach/msm_bus_board.h>
64#include <mach/msm_memtypes.h>
65#include <mach/dma.h>
66#include <mach/msm_dsps.h>
67#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070068#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#ifdef CONFIG_WCD9310_CODEC
71#include <linux/slimbus/slimbus.h>
72#include <linux/mfd/wcd9310/core.h>
73#include <linux/mfd/wcd9310/pdata.h>
74#endif
75
Laura Abbottd6183792011-08-19 13:42:24 -070076#include <linux/ion.h>
77#include <mach/ion.h>
78
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080080#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "spm.h"
83#include "board-msm8960.h"
84#include "pm.h"
85#include "cpuidle.h"
86#include "rpm_resources.h"
87#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070088#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070089#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070090#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091
92static struct platform_device msm_fm_platform_init = {
93 .name = "iris_fm",
94 .id = -1,
95};
96
97struct pm8xxx_gpio_init {
98 unsigned gpio;
99 struct pm_gpio config;
100};
101
102struct pm8xxx_mpp_init {
103 unsigned mpp;
104 struct pm8xxx_mpp_config_data config;
105};
106
107#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
108 _func, _inv, _disable) \
109{ \
110 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
111 .config = { \
112 .direction = _dir, \
113 .output_buffer = _buf, \
114 .output_value = _val, \
115 .pull = _pull, \
116 .vin_sel = _vin, \
117 .out_strength = _out_strength, \
118 .function = _func, \
119 .inv_int_pol = _inv, \
120 .disable_pin = _disable, \
121 } \
122}
123
124#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
125{ \
126 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
127 .config = { \
128 .type = PM8XXX_MPP_TYPE_##_type, \
129 .level = _level, \
130 .control = PM8XXX_MPP_##_control, \
131 } \
132}
133
134#define PM8XXX_GPIO_DISABLE(_gpio) \
135 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
136 0, 0, 0, 1)
137
138#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
139 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
140 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
141 PM_GPIO_STRENGTH_HIGH, \
142 PM_GPIO_FUNC_NORMAL, 0, 0)
143
144#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
145 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
146 _pull, PM_GPIO_VIN_S4, \
147 PM_GPIO_STRENGTH_NO, \
148 PM_GPIO_FUNC_NORMAL, 0, 0)
149
150#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
151 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
152 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
153 PM_GPIO_STRENGTH_HIGH, \
154 _func, 0, 0)
155
156/* Initial PM8921 GPIO configurations */
157static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
158 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
159 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
160 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300161 /* External regulator shared by display and touchscreen on LiQUID */
162 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
163 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700165 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700167 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700168};
169
170/* Initial PM8921 MPP configurations */
171static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
172 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
173 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700174 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
175 DOUT_CTRL_LOW),
176};
177
178static void __init pm8921_gpio_mpp_init(void)
179{
180 int i, rc;
181
182 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
183 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
184 &pm8921_gpios[i].config);
185 if (rc) {
186 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
187 break;
188 }
189 }
190
191 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
192 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
193 &pm8921_mpps[i].config);
194 if (rc) {
195 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
196 break;
197 }
198 }
199}
200
201#define FPGA_CS_GPIO 14
202#define KS8851_RST_GPIO 89
203#define KS8851_IRQ_GPIO 90
204
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700205#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
206enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700207 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700208 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
209 /* CAM Expander */
210 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
211 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
212 GPIO_CAM_GP_AFBUSY,
213 GPIO_CAM_GP_STROBE_CE,
214 GPIO_CAM_GP_CAM1MP_XCLR,
215 GPIO_CAM_GP_CAMIF_RESET_N,
216 GPIO_CAM_GP_XMT_FLASH_INT,
217 GPIO_CAM_GP_LED_EN1,
218 GPIO_CAM_GP_LED_EN2,
219
220};
221#endif
222
Harini Jayaraman608d0462011-08-09 19:10:03 -0600223/* The SPI configurations apply to GSBI 1*/
224static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700225 .func = GPIOMUX_FUNC_1,
226 .drv = GPIOMUX_DRV_8MA,
227 .pull = GPIOMUX_PULL_NONE,
228};
229
Harini Jayaraman608d0462011-08-09 19:10:03 -0600230static struct gpiomux_setting spi_suspended_config = {
231 .func = GPIOMUX_FUNC_GPIO,
232 .drv = GPIOMUX_DRV_2MA,
233 .pull = GPIOMUX_PULL_DOWN,
234};
235
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236static struct gpiomux_setting gsbi3 = {
237 .func = GPIOMUX_FUNC_1,
238 .drv = GPIOMUX_DRV_8MA,
239 .pull = GPIOMUX_PULL_NONE,
240};
241
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242static struct gpiomux_setting gsbi5 = {
243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_8MA,
245 .pull = GPIOMUX_PULL_NONE,
246};
247
248static struct gpiomux_setting gsbi10 = {
249 .func = GPIOMUX_FUNC_2,
250 .drv = GPIOMUX_DRV_8MA,
251 .pull = GPIOMUX_PULL_NONE,
252};
253
254static struct gpiomux_setting gsbi12 = {
255 .func = GPIOMUX_FUNC_1,
256 .drv = GPIOMUX_DRV_8MA,
257 .pull = GPIOMUX_PULL_NONE,
258};
259
260static struct gpiomux_setting cdc_mclk = {
261 .func = GPIOMUX_FUNC_1,
262 .drv = GPIOMUX_DRV_8MA,
263 .pull = GPIOMUX_PULL_NONE,
264};
265
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700266static struct gpiomux_setting audio_auxpcm[] = {
267 /* Suspended state */
268 {
269 .func = GPIOMUX_FUNC_GPIO,
270 .drv = GPIOMUX_DRV_2MA,
271 .pull = GPIOMUX_PULL_NONE,
272 },
273 /* Active state */
274 {
275 .func = GPIOMUX_FUNC_1,
276 .drv = GPIOMUX_DRV_2MA,
277 .pull = GPIOMUX_PULL_NONE,
278 },
279};
280
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700281#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282static struct gpiomux_setting gpio_eth_config = {
283 .pull = GPIOMUX_PULL_NONE,
284 .drv = GPIOMUX_DRV_8MA,
285 .func = GPIOMUX_FUNC_GPIO,
286};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700287#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288
289static struct gpiomux_setting slimbus = {
290 .func = GPIOMUX_FUNC_1,
291 .drv = GPIOMUX_DRV_8MA,
292 .pull = GPIOMUX_PULL_KEEPER,
293};
294
295struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700296#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700297 {
298 .gpio = KS8851_IRQ_GPIO,
299 .settings = {
300 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
301 }
302 },
303 {
304 .gpio = KS8851_RST_GPIO,
305 .settings = {
306 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
307 }
308 },
309 {
310 .gpio = FPGA_CS_GPIO,
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
313 }
314 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700315#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316};
317
318static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
319 {
320 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
321 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600322 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
323 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324 },
325 },
326 {
327 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
328 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600329 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
330 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331 },
332 },
333 {
334 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
335 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600336 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
337 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700338 },
339 },
340 {
341 .gpio = 9, /* GSBI1 QUP SPI_CLK */
342 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600343 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
344 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 },
346 },
347 {
348 .gpio = 16, /* GSBI3 I2C QUP SDA */
349 .settings = {
350 [GPIOMUX_SUSPENDED] = &gsbi3,
351 },
352 },
353 {
354 .gpio = 17, /* GSBI3 I2C QUP SCL */
355 .settings = {
356 [GPIOMUX_SUSPENDED] = &gsbi3,
357 },
358 },
359 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700360 .gpio = 22, /* GSBI5 UART2 */
361 .settings = {
362 [GPIOMUX_SUSPENDED] = &gsbi5,
363 },
364 },
365 {
366 .gpio = 23, /* GSBI5 UART2 */
367 .settings = {
368 [GPIOMUX_SUSPENDED] = &gsbi5,
369 },
370 },
371 {
372 .gpio = 24, /* GSBI5 UART2 */
373 .settings = {
374 [GPIOMUX_SUSPENDED] = &gsbi5,
375 },
376 },
377 {
378 .gpio = 25, /* GSBI5 UART2 */
379 .settings = {
380 [GPIOMUX_SUSPENDED] = &gsbi5,
381 },
382 },
383 {
384 .gpio = 44, /* GSBI12 I2C QUP SDA */
385 .settings = {
386 [GPIOMUX_SUSPENDED] = &gsbi12,
387 },
388 },
389 {
390 .gpio = 45, /* GSBI12 I2C QUP SCL */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi12,
393 },
394 },
395 {
396 .gpio = 73, /* GSBI10 I2C QUP SDA */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi10,
399 },
400 },
401 {
402 .gpio = 74, /* GSBI10 I2C QUP SCL */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi10,
405 },
406 },
407};
408
409static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
410 {
411 .gpio = 60, /* slimbus data */
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &slimbus,
414 },
415 },
416 {
417 .gpio = 61, /* slimbus clk */
418 .settings = {
419 [GPIOMUX_SUSPENDED] = &slimbus,
420 },
421 },
422};
423
424static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
425 {
426 .gpio = 59,
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &cdc_mclk,
429 },
430 },
431};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700432
433static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
434 {
435 .gpio = 63,
436 .settings = {
437 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
438 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
439 },
440 },
441 {
442 .gpio = 64,
443 .settings = {
444 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
445 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
446 },
447 },
448 {
449 .gpio = 65,
450 .settings = {
451 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
452 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
453 },
454 },
455 {
456 .gpio = 66,
457 .settings = {
458 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
459 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
460 },
461 },
462};
463
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700464static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
465 .func = GPIOMUX_FUNC_GPIO,
466 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700467 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700468};
469
470static struct gpiomux_setting wcnss_5wire_active_cfg = {
471 .func = GPIOMUX_FUNC_1,
472 .drv = GPIOMUX_DRV_6MA,
473 .pull = GPIOMUX_PULL_DOWN,
474};
475
476static struct msm_gpiomux_config wcnss_5wire_interface[] = {
477 {
478 .gpio = 84,
479 .settings = {
480 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
481 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
482 },
483 },
484 {
485 .gpio = 85,
486 .settings = {
487 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
488 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
489 },
490 },
491 {
492 .gpio = 86,
493 .settings = {
494 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
495 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
496 },
497 },
498 {
499 .gpio = 87,
500 .settings = {
501 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
502 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
503 },
504 },
505 {
506 .gpio = 88,
507 .settings = {
508 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
509 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
510 },
511 },
512};
Nishant Pandit24153d82011-08-27 16:05:13 +0530513static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530514 {
515 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
516 .drv = GPIOMUX_DRV_2MA,
517 .pull = GPIOMUX_PULL_DOWN,
518 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700519
Nishant Pandit474f2252011-07-23 23:17:56 +0530520 {
521 .func = GPIOMUX_FUNC_1, /*active 1*/
522 .drv = GPIOMUX_DRV_2MA,
523 .pull = GPIOMUX_PULL_NONE,
524 },
525
526 {
527 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
528 .drv = GPIOMUX_DRV_2MA,
529 .pull = GPIOMUX_PULL_NONE,
530 },
531
532 {
533 .func = GPIOMUX_FUNC_1, /*active 3*/
534 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700535 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530536 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530537
538 {
539 .func = GPIOMUX_FUNC_5, /*active 4*/
540 .drv = GPIOMUX_DRV_8MA,
541 .pull = GPIOMUX_PULL_UP,
542 },
543
544 {
545 .func = GPIOMUX_FUNC_6, /*active 5*/
546 .drv = GPIOMUX_DRV_8MA,
547 .pull = GPIOMUX_PULL_UP,
548 },
549
550 {
551 .func = GPIOMUX_FUNC_2, /*active 6*/
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_UP,
554 },
555
556 {
557 .func = GPIOMUX_FUNC_3, /*active 7*/
558 .drv = GPIOMUX_DRV_8MA,
559 .pull = GPIOMUX_PULL_UP,
560 },
561
Kevin Chan4c58d292011-09-13 11:03:25 -0700562 {
563 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
564 .drv = GPIOMUX_DRV_2MA,
565 .pull = GPIOMUX_PULL_KEEPER,
566 },
567
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568};
569
Nishant Pandit24153d82011-08-27 16:05:13 +0530570static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700571 {
572 .gpio = 2,
573 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530574 [GPIOMUX_ACTIVE] = &cam_settings[2],
575 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576 },
577 },
578 {
579 .gpio = 3,
580 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530581 [GPIOMUX_ACTIVE] = &cam_settings[1],
582 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700583 },
584 },
585 {
586 .gpio = 4,
587 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530588 [GPIOMUX_ACTIVE] = &cam_settings[1],
589 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700590 },
591 },
592 {
593 .gpio = 5,
594 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530595 [GPIOMUX_ACTIVE] = &cam_settings[1],
596 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597 },
598 },
599 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530600 .gpio = 76,
601 .settings = {
602 [GPIOMUX_ACTIVE] = &cam_settings[2],
603 [GPIOMUX_SUSPENDED] = &cam_settings[0],
604 },
605 },
606 {
607 .gpio = 107,
608 .settings = {
609 [GPIOMUX_ACTIVE] = &cam_settings[2],
610 [GPIOMUX_SUSPENDED] = &cam_settings[0],
611 },
612 },
613};
614
615static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
616 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700617 .gpio = 18,
618 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530619 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700620 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700621 },
622 },
623 {
624 .gpio = 19,
625 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530626 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700627 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700628 },
629 },
630 {
631 .gpio = 20,
632 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530633 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700634 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700635 },
636 },
637 {
638 .gpio = 21,
639 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530640 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700641 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700642 },
643 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700644};
645
646static struct gpiomux_setting cyts_resout_sus_cfg = {
647 .func = GPIOMUX_FUNC_GPIO,
648 .drv = GPIOMUX_DRV_6MA,
649 .pull = GPIOMUX_PULL_UP,
650};
651
652static struct gpiomux_setting cyts_resout_act_cfg = {
653 .func = GPIOMUX_FUNC_GPIO,
654 .drv = GPIOMUX_DRV_6MA,
655 .pull = GPIOMUX_PULL_UP,
656};
657
658static struct gpiomux_setting cyts_sleep_sus_cfg = {
659 .func = GPIOMUX_FUNC_GPIO,
660 .drv = GPIOMUX_DRV_6MA,
661 .pull = GPIOMUX_PULL_DOWN,
662};
663
664static struct gpiomux_setting cyts_sleep_act_cfg = {
665 .func = GPIOMUX_FUNC_GPIO,
666 .drv = GPIOMUX_DRV_6MA,
667 .pull = GPIOMUX_PULL_DOWN,
668};
669
670static struct gpiomux_setting cyts_int_act_cfg = {
671 .func = GPIOMUX_FUNC_GPIO,
672 .drv = GPIOMUX_DRV_8MA,
673 .pull = GPIOMUX_PULL_UP,
674};
675
676static struct gpiomux_setting cyts_int_sus_cfg = {
677 .func = GPIOMUX_FUNC_GPIO,
678 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530679 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700680};
681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700682static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
683 { /* TS INTERRUPT */
684 .gpio = 11,
685 .settings = {
686 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
687 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
688 },
689 },
690 { /* TS SLEEP */
691 .gpio = 50,
692 .settings = {
693 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
694 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
695 },
696 },
697 { /* TS RESOUT */
698 .gpio = 52,
699 .settings = {
700 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
701 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
702 },
703 },
704};
705
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700706#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
707enum {
708 SX150X_CAM,
709};
710
Nishant Pandit474f2252011-07-23 23:17:56 +0530711static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700712 [SX150X_CAM] = {
713 .gpio_base = GPIO_CAM_EXPANDER_BASE,
714 .oscio_is_gpo = false,
715 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530716 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700717 .io_open_drain_ena = 0x0,
718 .irq_summary = -1,
719 },
720};
Nishant Pandit474f2252011-07-23 23:17:56 +0530721
722#endif
723
724#ifdef CONFIG_I2C
725
726#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
727#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300728#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530729
730#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
731
732static struct i2c_board_info cam_expander_i2c_info[] = {
733 {
734 I2C_BOARD_INFO("sx1508q", 0x22),
735 .platform_data = &sx150x_data[SX150X_CAM]
736 },
737};
738
739static struct msm_cam_expander_info cam_expander_info[] = {
740 {
741 cam_expander_i2c_info,
742 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
743 },
744};
745#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700746#endif
747
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700748#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
749#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700750#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700751#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
752
Laura Abbottd6183792011-08-19 13:42:24 -0700753#define MSM_ION_EBI_SIZE SZ_8M
754
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700755#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
756static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
757static int __init pmem_kernel_ebi1_size_setup(char *p)
758{
759 pmem_kernel_ebi1_size = memparse(p, NULL);
760 return 0;
761}
762early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
763#endif
764
765#ifdef CONFIG_ANDROID_PMEM
766static unsigned pmem_size = MSM_PMEM_SIZE;
767static int __init pmem_size_setup(char *p)
768{
769 pmem_size = memparse(p, NULL);
770 return 0;
771}
772early_param("pmem_size", pmem_size_setup);
773
774static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
775
776static int __init pmem_adsp_size_setup(char *p)
777{
778 pmem_adsp_size = memparse(p, NULL);
779 return 0;
780}
781early_param("pmem_adsp_size", pmem_adsp_size_setup);
782
783static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
784
785static int __init pmem_audio_size_setup(char *p)
786{
787 pmem_audio_size = memparse(p, NULL);
788 return 0;
789}
790early_param("pmem_audio_size", pmem_audio_size_setup);
791#endif
792
793#ifdef CONFIG_ANDROID_PMEM
794static struct android_pmem_platform_data android_pmem_pdata = {
795 .name = "pmem",
796 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
797 .cached = 1,
798 .memory_type = MEMTYPE_EBI1,
799};
800
801static struct platform_device android_pmem_device = {
802 .name = "android_pmem",
803 .id = 0,
804 .dev = {.platform_data = &android_pmem_pdata},
805};
806
807static struct android_pmem_platform_data android_pmem_adsp_pdata = {
808 .name = "pmem_adsp",
809 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
810 .cached = 0,
811 .memory_type = MEMTYPE_EBI1,
812};
813static struct platform_device android_pmem_adsp_device = {
814 .name = "android_pmem",
815 .id = 2,
816 .dev = { .platform_data = &android_pmem_adsp_pdata },
817};
818
819static struct android_pmem_platform_data android_pmem_audio_pdata = {
820 .name = "pmem_audio",
821 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
822 .cached = 0,
823 .memory_type = MEMTYPE_EBI1,
824};
825
826static struct platform_device android_pmem_audio_device = {
827 .name = "android_pmem",
828 .id = 4,
829 .dev = { .platform_data = &android_pmem_audio_pdata },
830};
831#endif
832
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700833#define DSP_RAM_BASE_8960 0x8da00000
834#define DSP_RAM_SIZE_8960 0x1800000
835static int dspcrashd_pdata_8960 = 0xDEADDEAD;
836
837static struct resource resources_dspcrashd_8960[] = {
838 {
839 .name = "msm_dspcrashd",
840 .start = DSP_RAM_BASE_8960,
841 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
842 .flags = IORESOURCE_DMA,
843 },
844};
845
846struct platform_device msm_device_dspcrashd_8960 = {
847 .name = "msm_dspcrashd",
848 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
849 .resource = resources_dspcrashd_8960,
850 .dev = { .platform_data = &dspcrashd_pdata_8960 },
851};
852
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700853static struct memtype_reserve msm8960_reserve_table[] __initdata = {
854 [MEMTYPE_SMI] = {
855 },
856 [MEMTYPE_EBI0] = {
857 .flags = MEMTYPE_FLAGS_1M_ALIGN,
858 },
859 [MEMTYPE_EBI1] = {
860 .flags = MEMTYPE_FLAGS_1M_ALIGN,
861 },
862};
863
864static void __init size_pmem_devices(void)
865{
866#ifdef CONFIG_ANDROID_PMEM
867 android_pmem_adsp_pdata.size = pmem_adsp_size;
868 android_pmem_pdata.size = pmem_size;
869 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
870#endif
871}
872
873static void __init reserve_memory_for(struct android_pmem_platform_data *p)
874{
875 msm8960_reserve_table[p->memory_type].size += p->size;
876}
877
878static void __init reserve_pmem_memory(void)
879{
880#ifdef CONFIG_ANDROID_PMEM
881 reserve_memory_for(&android_pmem_adsp_pdata);
882 reserve_memory_for(&android_pmem_pdata);
883 reserve_memory_for(&android_pmem_audio_pdata);
884 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
885#endif
886}
887
Larry Basselb4126da2011-07-18 14:31:33 -0700888static int msm8960_paddr_to_memtype(unsigned int paddr)
889{
890 return MEMTYPE_EBI1;
891}
892
Laura Abbottd6183792011-08-19 13:42:24 -0700893#ifdef CONFIG_ION_MSM
894struct ion_platform_data ion_pdata = {
895 .nr = 3,
896 .heaps = {
897 {
898 .id = ION_HEAP_SYSTEM_ID,
899 .type = ION_HEAP_TYPE_SYSTEM,
900 .name = ION_KMALLOC_HEAP_NAME,
901 },
902 {
903 .id = ION_HEAP_SYSTEM_CONTIG_ID,
904 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
905 .name = ION_VMALLOC_HEAP_NAME,
906 },
907 {
908 .id = ION_HEAP_EBI_ID,
909 .type = ION_HEAP_TYPE_CARVEOUT,
910 .name = ION_EBI1_HEAP_NAME,
911 .size = MSM_ION_EBI_SIZE,
912 .memory_type = ION_EBI_TYPE,
913 },
914 }
915};
916
917struct platform_device ion_dev = {
918 .name = "ion-msm",
919 .id = 1,
920 .dev = { .platform_data = &ion_pdata },
921};
922#endif
923
924static void reserve_ion_memory(void)
925{
926#ifdef CONFIG_ION_MSM
927 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
928#endif
929}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700930static void __init msm8960_calculate_reserve_sizes(void)
931{
932 size_pmem_devices();
933 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700934 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700935}
936
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700937static struct reserve_info msm8960_reserve_info __initdata = {
938 .memtype_reserve_table = msm8960_reserve_table,
939 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
940 .paddr_to_memtype = msm8960_paddr_to_memtype,
941};
942
Larry Basselb4126da2011-07-18 14:31:33 -0700943static int msm8960_memory_bank_size(void)
944{
945 return 1<<29;
946}
947
948static void __init locate_unstable_memory(void)
949{
950 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
951 unsigned long bank_size;
952 unsigned long low, high;
953
954 bank_size = msm8960_memory_bank_size();
955 low = meminfo.bank[0].start;
956 high = mb->start + mb->size;
957 low &= ~(bank_size - 1);
958
959 if (high - low <= bank_size)
960 return;
961 msm8960_reserve_info.low_unstable_address = low + bank_size;
962 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
963 msm8960_reserve_info.bank_size = bank_size;
964 pr_info("low unstable address %lx max size %lx bank size %lx\n",
965 msm8960_reserve_info.low_unstable_address,
966 msm8960_reserve_info.max_unstable_size,
967 msm8960_reserve_info.bank_size);
968}
969
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970static void __init msm8960_reserve(void)
971{
972 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700973 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700974 msm_reserve();
975}
976
Larry Bassela4414b12011-08-04 11:11:02 -0700977static int msm8960_change_memory_power(u64 start, u64 size,
978 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700979{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700980 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700981}
982
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700983#ifdef CONFIG_MSM_CAMERA
984
Nishant Pandit24153d82011-08-27 16:05:13 +0530985static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700986 5, /*CAMIF_MCLK*/
987 20, /*CAMIF_I2C_DATA*/
988 21, /*CAMIF_I2C_CLK*/
989};
990
Nishant Pandit24153d82011-08-27 16:05:13 +0530991static struct msm_camera_gpio_conf gpio_conf = {
992 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
993 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
994 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
995 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
996};
997
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700998#define VFE_CAMIF_TIMER1_GPIO 2
999#define VFE_CAMIF_TIMER2_GPIO 3
1000#define VFE_CAMIF_TIMER3_GPIO_INT 4
1001struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1002 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1003 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1004 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1005 .flash_recharge_duration = 50000,
1006 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1007};
1008
Nishant Pandit474f2252011-07-23 23:17:56 +05301009#ifdef CONFIG_MSM_CAMERA_FLASH
1010static struct msm_camera_sensor_flash_src msm_flash_src = {
1011 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1012 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1013 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1014#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1015 defined(CONFIG_GPIO_SX150X_MODULE))
1016 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1017#endif
1018};
1019#endif
1020
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001021#ifdef CONFIG_MSM_BUS_SCALING
1022
1023static struct msm_bus_vectors cam_init_vectors[] = {
1024 {
1025 .src = MSM_BUS_MASTER_VFE,
1026 .dst = MSM_BUS_SLAVE_EBI_CH0,
1027 .ab = 0,
1028 .ib = 0,
1029 },
1030 {
1031 .src = MSM_BUS_MASTER_VPE,
1032 .dst = MSM_BUS_SLAVE_EBI_CH0,
1033 .ab = 0,
1034 .ib = 0,
1035 },
1036 {
1037 .src = MSM_BUS_MASTER_JPEG_ENC,
1038 .dst = MSM_BUS_SLAVE_EBI_CH0,
1039 .ab = 0,
1040 .ib = 0,
1041 },
1042};
1043
1044static struct msm_bus_vectors cam_preview_vectors[] = {
1045 {
1046 .src = MSM_BUS_MASTER_VFE,
1047 .dst = MSM_BUS_SLAVE_EBI_CH0,
1048 .ab = 27648000,
1049 .ib = 110592000,
1050 },
1051 {
1052 .src = MSM_BUS_MASTER_VPE,
1053 .dst = MSM_BUS_SLAVE_EBI_CH0,
1054 .ab = 0,
1055 .ib = 0,
1056 },
1057 {
1058 .src = MSM_BUS_MASTER_JPEG_ENC,
1059 .dst = MSM_BUS_SLAVE_EBI_CH0,
1060 .ab = 0,
1061 .ib = 0,
1062 },
1063};
1064
1065static struct msm_bus_vectors cam_video_vectors[] = {
1066 {
1067 .src = MSM_BUS_MASTER_VFE,
1068 .dst = MSM_BUS_SLAVE_EBI_CH0,
1069 .ab = 140451840,
1070 .ib = 561807360,
1071 },
1072 {
1073 .src = MSM_BUS_MASTER_VPE,
1074 .dst = MSM_BUS_SLAVE_EBI_CH0,
1075 .ab = 206807040,
1076 .ib = 488816640,
1077 },
1078 {
1079 .src = MSM_BUS_MASTER_JPEG_ENC,
1080 .dst = MSM_BUS_SLAVE_EBI_CH0,
1081 .ab = 0,
1082 .ib = 0,
1083 },
1084};
1085
1086static struct msm_bus_vectors cam_snapshot_vectors[] = {
1087 {
1088 .src = MSM_BUS_MASTER_VFE,
1089 .dst = MSM_BUS_SLAVE_EBI_CH0,
1090 .ab = 274423680,
1091 .ib = 1097694720,
1092 },
1093 {
1094 .src = MSM_BUS_MASTER_VPE,
1095 .dst = MSM_BUS_SLAVE_EBI_CH0,
1096 .ab = 0,
1097 .ib = 0,
1098 },
1099 {
1100 .src = MSM_BUS_MASTER_JPEG_ENC,
1101 .dst = MSM_BUS_SLAVE_EBI_CH0,
1102 .ab = 540000000,
1103 .ib = 1350000000,
1104 },
1105};
1106
1107static struct msm_bus_vectors cam_zsl_vectors[] = {
1108 {
1109 .src = MSM_BUS_MASTER_VFE,
1110 .dst = MSM_BUS_SLAVE_EBI_CH0,
1111 .ab = 302071680,
1112 .ib = 1208286720,
1113 },
1114 {
1115 .src = MSM_BUS_MASTER_VPE,
1116 .dst = MSM_BUS_SLAVE_EBI_CH0,
1117 .ab = 0,
1118 .ib = 0,
1119 },
1120 {
1121 .src = MSM_BUS_MASTER_JPEG_ENC,
1122 .dst = MSM_BUS_SLAVE_EBI_CH0,
1123 .ab = 540000000,
1124 .ib = 1350000000,
1125 },
1126};
1127
1128static struct msm_bus_paths cam_bus_client_config[] = {
1129 {
1130 ARRAY_SIZE(cam_init_vectors),
1131 cam_init_vectors,
1132 },
1133 {
1134 ARRAY_SIZE(cam_preview_vectors),
1135 cam_preview_vectors,
1136 },
1137 {
1138 ARRAY_SIZE(cam_video_vectors),
1139 cam_video_vectors,
1140 },
1141 {
1142 ARRAY_SIZE(cam_snapshot_vectors),
1143 cam_snapshot_vectors,
1144 },
1145 {
1146 ARRAY_SIZE(cam_zsl_vectors),
1147 cam_zsl_vectors,
1148 },
1149};
1150
1151static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1152 cam_bus_client_config,
1153 ARRAY_SIZE(cam_bus_client_config),
1154 .name = "msm_camera",
1155};
1156#endif
1157
Nishant Pandit24153d82011-08-27 16:05:13 +05301158struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1159 {
1160 .ioclk.mclk_clk_rate = 24000000,
1161 .ioclk.vfe_clk_rate = 228570000,
1162 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001163#ifdef CONFIG_MSM_BUS_SCALING
1164 .cam_bus_scale_table = &cam_bus_client_pdata,
1165#endif
Nishant Pandit24153d82011-08-27 16:05:13 +05301166 },
1167 {
1168 .ioclk.mclk_clk_rate = 24000000,
1169 .ioclk.vfe_clk_rate = 228570000,
1170 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001171#ifdef CONFIG_MSM_BUS_SCALING
1172 .cam_bus_scale_table = &cam_bus_client_pdata,
1173#endif
Nishant Pandit24153d82011-08-27 16:05:13 +05301174 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001175};
1176
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001177#ifdef CONFIG_IMX074_ACT
1178static struct i2c_board_info imx074_actuator_i2c_info = {
1179 I2C_BOARD_INFO("imx074_act", 0x11),
1180};
1181
1182static struct msm_actuator_info imx074_actuator_info = {
1183 .board_info = &imx074_actuator_i2c_info,
1184 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1185 .vcm_pwd = 0,
1186 .vcm_enable = 1,
1187};
1188#endif
1189
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001190#ifdef CONFIG_IMX074
1191static struct msm_camera_sensor_flash_data flash_imx074 = {
1192 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301193#ifdef CONFIG_MSM_CAMERA_FLASH
1194 .flash_src = &msm_flash_src
1195#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001196};
1197
Nishant Pandit24153d82011-08-27 16:05:13 +05301198static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1199 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001200 .sensor_reset = 107,
1201 .sensor_pwd = 85,
1202 .vcm_pwd = 0,
1203 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301204};
1205
1206static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1207 .sensor_name = "imx074",
1208 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001209 .flash_data = &flash_imx074,
1210 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301211 .sensor_platform_info = &sensor_board_info_imx074,
1212 .gpio_conf = &gpio_conf,
1213 .csi_if = 1,
1214 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001215#ifdef CONFIG_IMX074_ACT
1216 .actuator_info = &imx074_actuator_info
1217#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001218};
1219
1220struct platform_device msm8960_camera_sensor_imx074 = {
1221 .name = "msm_camera_imx074",
1222 .dev = {
1223 .platform_data = &msm_camera_sensor_imx074_data,
1224 },
1225};
1226#endif
1227#ifdef CONFIG_OV2720
1228static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001229 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001230};
1231
Nishant Pandit24153d82011-08-27 16:05:13 +05301232static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1233 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001234 .sensor_reset = 76,
1235 .sensor_pwd = 85,
1236 .vcm_pwd = 0,
1237 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301238};
1239
1240static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1241 .sensor_name = "ov2720",
1242 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001243 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301244 .sensor_platform_info = &sensor_board_info_ov2720,
1245 .gpio_conf = &gpio_conf,
1246 .csi_if = 1,
1247 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001248};
1249
1250struct platform_device msm8960_camera_sensor_ov2720 = {
1251 .name = "msm_camera_ov2720",
1252 .dev = {
1253 .platform_data = &msm_camera_sensor_ov2720_data,
1254 },
1255};
1256#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001257
1258static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1259 .flash_type = MSM_CAMERA_FLASH_LED,
1260};
1261
Nishant Pandit24153d82011-08-27 16:05:13 +05301262static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1263 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001264 .sensor_reset = 107,
1265 .sensor_pwd = 85,
1266 .vcm_pwd = 0,
1267 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301268};
1269
1270static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1271 .sensor_name = "qs_mt9p017",
1272 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001273 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301274 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1275 .gpio_conf = &gpio_conf,
1276 .csi_if = 1,
1277 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001278};
1279
1280struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1281 .name = "msm_camera_qs_mt9p017",
1282 .dev = {
1283 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1284 },
1285};
1286
Kevin Chan8b0d2322011-09-10 21:06:31 -07001287static struct msm8960_privacy_light_cfg privacy_light_info = {
1288 .mpp = PM8921_MPP_PM_TO_SYS(12),
1289};
1290
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001291static void __init msm8960_init_cam(void)
1292{
1293 int i;
1294 struct platform_device *cam_dev[] = {
1295 &msm8960_camera_sensor_imx074,
1296 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001297 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001298 };
1299
Kevin Chan8b0d2322011-09-10 21:06:31 -07001300 if (machine_is_msm8960_liquid()) {
1301 struct msm_camera_sensor_info *s_info;
1302 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1303 s_info->sensor_platform_info->mount_angle = 180;
1304 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1305 s_info->sensor_platform_info->privacy_light = 1;
1306 s_info->sensor_platform_info->privacy_light_info =
1307 &privacy_light_info;
1308 }
1309
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001310 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1311 struct msm_camera_sensor_info *s_info;
1312 s_info = cam_dev[i]->dev.platform_data;
1313 msm_get_cam_resources(s_info);
1314 platform_device_register(cam_dev[i]);
1315 }
1316}
1317#endif
1318
1319#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001320#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001322#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001323#endif
1324
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001325
1326#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001327#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001328#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001329#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1330#else
1331#define MSM_FB_EXT_BUF_SIZE 0
1332#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001333
kuogee hsieh3830eb92011-09-12 15:25:57 -07001334#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1335/* width x height x 3 bpp x 2 frame buffer */
1336#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1337#define MSM_FB_WRITEBACK_OFFSET \
1338 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1339#else
1340#define MSM_FB_WRITEBACK_SIZE 0
1341#define MSM_FB_WRITEBACK_OFFSET 0
1342#endif
1343
1344
1345/* Note: must be multiple of 4096 */
1346#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1347 MSM_FB_WRITEBACK_SIZE, 4096)
1348
1349static int writeback_offset(void)
1350{
1351 return MSM_FB_WRITEBACK_OFFSET;
1352}
1353
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001354
1355#define MDP_VSYNC_GPIO 0
1356
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001357#define PANEL_NAME_MAX_LEN 30
1358#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1359#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1360#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1361#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1362#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1363#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1364#define HDMI_PANEL_NAME "hdmi_msm"
1365#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001366
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001367static struct resource msm_fb_resources[] = {
1368 {
1369 .flags = IORESOURCE_DMA,
1370 }
1371};
1372
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001373static int msm_fb_detect_panel(const char *name)
1374{
1375 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001376 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1377 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1378 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001379 return 0;
1380 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001381 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1382 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1383 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001384 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001385
1386#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1387 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1388 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1389 PANEL_NAME_MAX_LEN)))
1390 return 0;
1391
1392 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1393 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1394 PANEL_NAME_MAX_LEN)))
1395 return 0;
1396
1397 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1398 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1399 PANEL_NAME_MAX_LEN)))
1400 return 0;
1401
1402 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1403 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1404 PANEL_NAME_MAX_LEN)))
1405 return 0;
1406#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001407 }
1408
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001409 if (!strncmp(name, HDMI_PANEL_NAME,
1410 strnlen(HDMI_PANEL_NAME,
1411 PANEL_NAME_MAX_LEN)))
1412 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001413
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001414 if (!strncmp(name, TVOUT_PANEL_NAME,
1415 strnlen(TVOUT_PANEL_NAME,
1416 PANEL_NAME_MAX_LEN)))
1417 return 0;
1418
1419 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001420 return -ENODEV;
1421}
1422
1423static struct msm_fb_platform_data msm_fb_pdata = {
1424 .detect_client = msm_fb_detect_panel,
1425};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001426
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001427static struct platform_device msm_fb_device = {
1428 .name = "msm_fb",
1429 .id = 0,
1430 .num_resources = ARRAY_SIZE(msm_fb_resources),
1431 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001432 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001433};
1434
1435static bool dsi_power_on;
1436
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001437/**
1438 * LiQUID panel on/off
1439 *
1440 * @param on
1441 *
1442 * @return int
1443 */
1444static int mipi_dsi_liquid_panel_power(int on)
1445{
1446 static struct regulator *reg_l2, *reg_ext_3p3v;
1447 static int gpio21, gpio24, gpio43;
1448 int rc;
1449
1450 pr_info("%s: on=%d\n", __func__, on);
1451
1452 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1453 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1454 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1455
1456 if (!dsi_power_on) {
1457
1458 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1459 "dsi_vdda");
1460 if (IS_ERR(reg_l2)) {
1461 pr_err("could not get 8921_l2, rc = %ld\n",
1462 PTR_ERR(reg_l2));
1463 return -ENODEV;
1464 }
1465
1466 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1467 if (rc) {
1468 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1469 return -EINVAL;
1470 }
1471
1472 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1473 "vdd_lvds_3p3v");
1474 if (IS_ERR(reg_ext_3p3v)) {
1475 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1476 PTR_ERR(reg_ext_3p3v));
1477 return -ENODEV;
1478 }
1479
1480 rc = gpio_request(gpio21, "disp_pwr_en_n");
1481 if (rc) {
1482 pr_err("request gpio 21 failed, rc=%d\n", rc);
1483 return -ENODEV;
1484 }
1485
1486 rc = gpio_request(gpio43, "disp_rst_n");
1487 if (rc) {
1488 pr_err("request gpio 43 failed, rc=%d\n", rc);
1489 return -ENODEV;
1490 }
1491
1492 rc = gpio_request(gpio24, "disp_backlight_pwm");
1493 if (rc) {
1494 pr_err("request gpio 24 failed, rc=%d\n", rc);
1495 return -ENODEV;
1496 }
1497
1498 dsi_power_on = true;
1499 }
1500
1501 if (on) {
1502 rc = regulator_set_optimum_mode(reg_l2, 100000);
1503 if (rc < 0) {
1504 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1505 return -EINVAL;
1506 }
1507 rc = regulator_enable(reg_l2);
1508 if (rc) {
1509 pr_err("enable l2 failed, rc=%d\n", rc);
1510 return -ENODEV;
1511 }
1512
1513 rc = regulator_enable(reg_ext_3p3v);
1514 if (rc) {
1515 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1516 return -ENODEV;
1517 }
1518
1519 /* set reset pin before power enable */
1520 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1521
1522 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1523 msleep(20);
1524 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1525 msleep(20);
1526 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1527 msleep(20);
1528 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1529 msleep(20);
1530 } else {
1531 gpio_set_value_cansleep(gpio43, 0);
1532 gpio_set_value_cansleep(gpio21, 1);
1533
1534 rc = regulator_disable(reg_l2);
1535 if (rc) {
1536 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1537 return -ENODEV;
1538 }
1539 rc = regulator_disable(reg_ext_3p3v);
1540 if (rc) {
1541 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1542 return -ENODEV;
1543 }
1544 rc = regulator_set_optimum_mode(reg_l2, 100);
1545 if (rc < 0) {
1546 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1547 return -EINVAL;
1548 }
1549 }
1550
1551 return 0;
1552}
1553
1554static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001555{
1556 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001557 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558 int rc;
1559
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001560 pr_info("%s: state : %d\n", __func__, on);
1561
1562 if (!dsi_power_on) {
1563
1564 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1565 "dsi_vdc");
1566 if (IS_ERR(reg_l8)) {
1567 pr_err("could not get 8921_l8, rc = %ld\n",
1568 PTR_ERR(reg_l8));
1569 return -ENODEV;
1570 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001571 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1572 "dsi_vddio");
1573 if (IS_ERR(reg_l23)) {
1574 pr_err("could not get 8921_l23, rc = %ld\n",
1575 PTR_ERR(reg_l23));
1576 return -ENODEV;
1577 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001578 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1579 "dsi_vdda");
1580 if (IS_ERR(reg_l2)) {
1581 pr_err("could not get 8921_l2, rc = %ld\n",
1582 PTR_ERR(reg_l2));
1583 return -ENODEV;
1584 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001585 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1586 if (rc) {
1587 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1588 return -EINVAL;
1589 }
1590 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1591 if (rc) {
1592 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1593 return -EINVAL;
1594 }
1595 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1596 if (rc) {
1597 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1598 return -EINVAL;
1599 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001600 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1601 rc = gpio_request(gpio43, "disp_rst_n");
1602 if (rc) {
1603 pr_err("request gpio 43 failed, rc=%d\n", rc);
1604 return -ENODEV;
1605 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001606 dsi_power_on = true;
1607 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001608 if (on) {
1609 rc = regulator_set_optimum_mode(reg_l8, 100000);
1610 if (rc < 0) {
1611 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1612 return -EINVAL;
1613 }
1614 rc = regulator_set_optimum_mode(reg_l23, 100000);
1615 if (rc < 0) {
1616 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1617 return -EINVAL;
1618 }
1619 rc = regulator_set_optimum_mode(reg_l2, 100000);
1620 if (rc < 0) {
1621 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1622 return -EINVAL;
1623 }
1624 rc = regulator_enable(reg_l8);
1625 if (rc) {
1626 pr_err("enable l8 failed, rc=%d\n", rc);
1627 return -ENODEV;
1628 }
1629 rc = regulator_enable(reg_l23);
1630 if (rc) {
1631 pr_err("enable l8 failed, rc=%d\n", rc);
1632 return -ENODEV;
1633 }
1634 rc = regulator_enable(reg_l2);
1635 if (rc) {
1636 pr_err("enable l2 failed, rc=%d\n", rc);
1637 return -ENODEV;
1638 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001639 gpio_set_value_cansleep(gpio43, 1);
1640 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001641 rc = regulator_disable(reg_l2);
1642 if (rc) {
1643 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1644 return -ENODEV;
1645 }
1646 rc = regulator_disable(reg_l8);
1647 if (rc) {
1648 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1649 return -ENODEV;
1650 }
1651 rc = regulator_disable(reg_l23);
1652 if (rc) {
1653 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1654 return -ENODEV;
1655 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001656 rc = regulator_set_optimum_mode(reg_l8, 100);
1657 if (rc < 0) {
1658 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1659 return -EINVAL;
1660 }
1661 rc = regulator_set_optimum_mode(reg_l23, 100);
1662 if (rc < 0) {
1663 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1664 return -EINVAL;
1665 }
1666 rc = regulator_set_optimum_mode(reg_l2, 100);
1667 if (rc < 0) {
1668 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1669 return -EINVAL;
1670 }
1671 gpio_set_value_cansleep(gpio43, 0);
1672 }
1673 return 0;
1674}
1675
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001676static int mipi_dsi_panel_power(int on)
1677{
1678 int ret;
1679
1680 pr_info("%s: on=%d\n", __func__, on);
1681
1682 if (machine_is_msm8960_liquid())
1683 ret = mipi_dsi_liquid_panel_power(on);
1684 else
1685 ret = mipi_dsi_cdp_panel_power(on);
1686
1687 return ret;
1688}
1689
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001690static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1691 .vsync_gpio = MDP_VSYNC_GPIO,
1692 .dsi_power_save = mipi_dsi_panel_power,
1693};
1694
1695#ifdef CONFIG_MSM_BUS_SCALING
1696
1697static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698 {
1699 .src = MSM_BUS_MASTER_MDP_PORT0,
1700 .dst = MSM_BUS_SLAVE_EBI_CH0,
1701 .ab = 0,
1702 .ib = 0,
1703 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001704};
1705
1706static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001707 {
1708 .src = MSM_BUS_MASTER_MDP_PORT0,
1709 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001710 .ab = 216000000 * 2,
1711 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001712 },
1713};
1714
1715static struct msm_bus_vectors mdp_vga_vectors[] = {
1716 /* VGA and less video */
1717 {
1718 .src = MSM_BUS_MASTER_MDP_PORT0,
1719 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001720 .ab = 216000000 * 2,
1721 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001722 },
1723};
1724
1725static struct msm_bus_vectors mdp_720p_vectors[] = {
1726 /* 720p and less video */
1727 {
1728 .src = MSM_BUS_MASTER_MDP_PORT0,
1729 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001730 .ab = 230400000 * 2,
1731 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001732 },
1733};
1734
1735static struct msm_bus_vectors mdp_1080p_vectors[] = {
1736 /* 1080p and less video */
1737 {
1738 .src = MSM_BUS_MASTER_MDP_PORT0,
1739 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001740 .ab = 334080000 * 2,
1741 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001742 },
1743};
1744
1745static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1746 {
1747 ARRAY_SIZE(mdp_init_vectors),
1748 mdp_init_vectors,
1749 },
1750 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001751 ARRAY_SIZE(mdp_ui_vectors),
1752 mdp_ui_vectors,
1753 },
1754 {
1755 ARRAY_SIZE(mdp_ui_vectors),
1756 mdp_ui_vectors,
1757 },
1758 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001759 ARRAY_SIZE(mdp_vga_vectors),
1760 mdp_vga_vectors,
1761 },
1762 {
1763 ARRAY_SIZE(mdp_720p_vectors),
1764 mdp_720p_vectors,
1765 },
1766 {
1767 ARRAY_SIZE(mdp_1080p_vectors),
1768 mdp_1080p_vectors,
1769 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001770};
1771
1772static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1773 mdp_bus_scale_usecases,
1774 ARRAY_SIZE(mdp_bus_scale_usecases),
1775 .name = "mdp",
1776};
1777
1778#endif
1779
1780int mdp_core_clk_rate_table[] = {
1781 85330000,
1782 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001783 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001784 200000000,
1785};
1786
1787static struct msm_panel_common_pdata mdp_pdata = {
1788 .gpio = MDP_VSYNC_GPIO,
1789 .mdp_core_clk_rate = 85330000,
1790 .mdp_core_clk_table = mdp_core_clk_rate_table,
1791 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1792#ifdef CONFIG_MSM_BUS_SCALING
1793 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1794#endif
1795 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001796 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001797};
1798
1799static struct platform_device mipi_dsi_renesas_panel_device = {
1800 .name = "mipi_renesas",
1801 .id = 0,
1802};
1803
1804static struct platform_device mipi_dsi_simulator_panel_device = {
1805 .name = "mipi_simulator",
1806 .id = 0,
1807};
1808
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001809#define LPM_CHANNEL0 0
1810static int toshiba_gpio[] = {LPM_CHANNEL0};
1811
1812static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1813 .gpio = toshiba_gpio,
1814};
1815
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001816static struct platform_device mipi_dsi_toshiba_panel_device = {
1817 .name = "mipi_toshiba",
1818 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001819 .dev = {
1820 .platform_data = &toshiba_pdata,
1821 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001822};
1823
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001824static int dsi2lvds_gpio[2] = {
1825 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1826 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1827 };
1828
1829static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1830 .gpio_num = dsi2lvds_gpio,
1831};
1832
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001833static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1834
1835/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1836 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1837 /* timing */
1838 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1839 0x0c, 0x03, 0x04, 0xa0},
1840 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1841 {0xff, 0x00, 0x06, 0x00}, /* strength */
1842 /* pll control */
1843 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1844 0x40, 0x07, 0x03,
1845 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1846};
1847
1848static struct mipi_dsi_panel_platform_data novatek_pdata = {
1849 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1850};
1851
1852static struct platform_device mipi_dsi_novatek_panel_device = {
1853 .name = "mipi_novatek",
1854 .id = 0,
1855 .dev = {
1856 .platform_data = &novatek_pdata,
1857 }
1858};
1859
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001860static struct platform_device mipi_dsi2lvds_bridge_device = {
1861 .name = "mipi_tc358764",
1862 .id = 0,
1863 .dev.platform_data = &mipi_dsi2lvds_pdata,
1864};
1865
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001866#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1867static struct resource hdmi_msm_resources[] = {
1868 {
1869 .name = "hdmi_msm_qfprom_addr",
1870 .start = 0x00700000,
1871 .end = 0x007060FF,
1872 .flags = IORESOURCE_MEM,
1873 },
1874 {
1875 .name = "hdmi_msm_hdmi_addr",
1876 .start = 0x04A00000,
1877 .end = 0x04A00FFF,
1878 .flags = IORESOURCE_MEM,
1879 },
1880 {
1881 .name = "hdmi_msm_irq",
1882 .start = HDMI_IRQ,
1883 .end = HDMI_IRQ,
1884 .flags = IORESOURCE_IRQ,
1885 },
1886};
1887
1888static int hdmi_enable_5v(int on);
1889static int hdmi_core_power(int on, int show);
1890static int hdmi_cec_power(int on);
1891
1892static struct msm_hdmi_platform_data hdmi_msm_data = {
1893 .irq = HDMI_IRQ,
1894 .enable_5v = hdmi_enable_5v,
1895 .core_power = hdmi_core_power,
1896 .cec_power = hdmi_cec_power,
1897};
1898
1899static struct platform_device hdmi_msm_device = {
1900 .name = "hdmi_msm",
1901 .id = 0,
1902 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1903 .resource = hdmi_msm_resources,
1904 .dev.platform_data = &hdmi_msm_data,
1905};
1906#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1907
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001908#ifdef CONFIG_MSM_BUS_SCALING
1909static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1910 {
1911 .src = MSM_BUS_MASTER_MDP_PORT0,
1912 .dst = MSM_BUS_SLAVE_EBI_CH0,
1913 .ab = 0,
1914 .ib = 0,
1915 },
1916};
1917static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1918 {
1919 .src = MSM_BUS_MASTER_MDP_PORT0,
1920 .dst = MSM_BUS_SLAVE_EBI_CH0,
1921 .ab = 566092800 * 2,
1922 .ib = 707616000 * 2,
1923 },
1924};
1925static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1926 {
1927 ARRAY_SIZE(dtv_bus_init_vectors),
1928 dtv_bus_init_vectors,
1929 },
1930 {
1931 ARRAY_SIZE(dtv_bus_def_vectors),
1932 dtv_bus_def_vectors,
1933 },
1934};
1935static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1936 dtv_bus_scale_usecases,
1937 ARRAY_SIZE(dtv_bus_scale_usecases),
1938 .name = "dtv",
1939};
1940
1941static struct lcdc_platform_data dtv_pdata = {
1942 .bus_scale_table = &dtv_bus_scale_pdata,
1943};
1944#endif
1945
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001946static void __init msm_fb_add_devices(void)
1947{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001948 struct platform_device *ptr = NULL;
1949
1950 if (machine_is_msm8960_liquid())
1951 ptr = &mipi_dsi2lvds_bridge_device;
1952 else
1953 ptr = &mipi_dsi_toshiba_panel_device;
1954 platform_add_devices(&ptr, 1);
1955
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001956 if (machine_is_msm8x60_rumi3()) {
1957 msm_fb_register_device("mdp", NULL);
1958 mipi_dsi_pdata.target_type = 1;
1959 } else
1960 msm_fb_register_device("mdp", &mdp_pdata);
1961 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001962#ifdef CONFIG_MSM_BUS_SCALING
1963 msm_fb_register_device("dtv", &dtv_pdata);
1964#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001965}
1966
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001967static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1968 .func = GPIOMUX_FUNC_GPIO,
1969 .drv = GPIOMUX_DRV_2MA,
1970 .pull = GPIOMUX_PULL_DOWN,
1971};
1972
1973static struct gpiomux_setting mdp_vsync_active_cfg = {
1974 .func = GPIOMUX_FUNC_1,
1975 .drv = GPIOMUX_DRV_2MA,
1976 .pull = GPIOMUX_PULL_DOWN,
1977};
1978
1979static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1980 {
1981 .gpio = MDP_VSYNC_GPIO,
1982 .settings = {
1983 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1984 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1985 },
1986 }
1987};
1988
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001989#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1990static struct gpiomux_setting hdmi_suspend_cfg = {
1991 .func = GPIOMUX_FUNC_GPIO,
1992 .drv = GPIOMUX_DRV_2MA,
1993 .pull = GPIOMUX_PULL_DOWN,
1994};
1995
1996static struct gpiomux_setting hdmi_active_1_cfg = {
1997 .func = GPIOMUX_FUNC_1,
1998 .drv = GPIOMUX_DRV_2MA,
1999 .pull = GPIOMUX_PULL_UP,
2000};
2001
2002static struct gpiomux_setting hdmi_active_2_cfg = {
2003 .func = GPIOMUX_FUNC_1,
2004 .drv = GPIOMUX_DRV_2MA,
2005 .pull = GPIOMUX_PULL_DOWN,
2006};
2007
2008static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2009 {
2010 .gpio = 99,
2011 .settings = {
2012 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2013 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2014 },
2015 },
2016 {
2017 .gpio = 100,
2018 .settings = {
2019 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2020 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2021 },
2022 },
2023 {
2024 .gpio = 101,
2025 .settings = {
2026 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2027 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2028 },
2029 },
2030 {
2031 .gpio = 102,
2032 .settings = {
2033 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2034 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2035 },
2036 },
2037};
2038
2039static int hdmi_enable_5v(int on)
2040{
2041 /* TBD: PM8921 regulator instead of 8901 */
2042 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2043 static int prev_on;
2044 int rc;
2045
2046 if (on == prev_on)
2047 return 0;
2048
2049 if (!reg_8921_hdmi_mvs)
2050 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2051 "hdmi_mvs");
2052
2053 if (on) {
2054 rc = regulator_enable(reg_8921_hdmi_mvs);
2055 if (rc) {
2056 pr_err("'%s' regulator enable failed, rc=%d\n",
2057 "8921_hdmi_mvs", rc);
2058 return rc;
2059 }
2060 pr_debug("%s(on): success\n", __func__);
2061 } else {
2062 rc = regulator_disable(reg_8921_hdmi_mvs);
2063 if (rc)
2064 pr_warning("'%s' regulator disable failed, rc=%d\n",
2065 "8921_hdmi_mvs", rc);
2066 pr_debug("%s(off): success\n", __func__);
2067 }
2068
2069 prev_on = on;
2070
2071 return 0;
2072}
2073
2074static int hdmi_core_power(int on, int show)
2075{
2076 static struct regulator *reg_8921_l23, *reg_8921_s4;
2077 static int prev_on;
2078 int rc;
2079
2080 if (on == prev_on)
2081 return 0;
2082
2083 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002084 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002085 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002086 if (IS_ERR(reg_8921_l23)) {
2087 pr_err("could not get reg_8921_l23, rc = %ld\n",
2088 PTR_ERR(reg_8921_l23));
2089 return -ENODEV;
2090 }
2091 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2092 if (rc) {
2093 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2094 return -EINVAL;
2095 }
2096 }
2097 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002098 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002099 if (IS_ERR(reg_8921_s4)) {
2100 pr_err("could not get reg_8921_s4, rc = %ld\n",
2101 PTR_ERR(reg_8921_s4));
2102 return -ENODEV;
2103 }
2104 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2105 if (rc) {
2106 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2107 return -EINVAL;
2108 }
2109 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002110
2111 if (on) {
2112 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2113 if (rc < 0) {
2114 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2115 return -EINVAL;
2116 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002117 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002118 if (rc) {
2119 pr_err("'%s' regulator enable failed, rc=%d\n",
2120 "hdmi_avdd", rc);
2121 return rc;
2122 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002123 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002124 if (rc) {
2125 pr_err("'%s' regulator enable failed, rc=%d\n",
2126 "hdmi_vcc", rc);
2127 return rc;
2128 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002129 rc = gpio_request(100, "HDMI_DDC_CLK");
2130 if (rc) {
2131 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2132 "HDMI_DDC_CLK", 100, rc);
2133 goto error1;
2134 }
2135 rc = gpio_request(101, "HDMI_DDC_DATA");
2136 if (rc) {
2137 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2138 "HDMI_DDC_DATA", 101, rc);
2139 goto error2;
2140 }
2141 rc = gpio_request(102, "HDMI_HPD");
2142 if (rc) {
2143 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2144 "HDMI_HPD", 102, rc);
2145 goto error3;
2146 }
2147 pr_debug("%s(on): success\n", __func__);
2148 } else {
2149 gpio_free(100);
2150 gpio_free(101);
2151 gpio_free(102);
2152
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002153 rc = regulator_disable(reg_8921_l23);
2154 if (rc) {
2155 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2156 return -ENODEV;
2157 }
2158 rc = regulator_disable(reg_8921_s4);
2159 if (rc) {
2160 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2161 return -ENODEV;
2162 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002163 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2164 if (rc < 0) {
2165 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2166 return -EINVAL;
2167 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002168 pr_debug("%s(off): success\n", __func__);
2169 }
2170
2171 prev_on = on;
2172
2173 return 0;
2174
2175error3:
2176 gpio_free(101);
2177error2:
2178 gpio_free(100);
2179error1:
2180 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002181 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002182 return rc;
2183}
2184
2185static int hdmi_cec_power(int on)
2186{
2187 static int prev_on;
2188 int rc;
2189
2190 if (on == prev_on)
2191 return 0;
2192
2193 if (on) {
2194 rc = gpio_request(99, "HDMI_CEC_VAR");
2195 if (rc) {
2196 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2197 "HDMI_CEC_VAR", 99, rc);
2198 goto error;
2199 }
2200 pr_debug("%s(on): success\n", __func__);
2201 } else {
2202 gpio_free(99);
2203 pr_debug("%s(off): success\n", __func__);
2204 }
2205
2206 prev_on = on;
2207
2208 return 0;
2209error:
2210 return rc;
2211}
2212#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2213
2214static void __init msm8960_allocate_memory_regions(void)
2215{
2216 void *addr;
2217 unsigned long size;
2218
2219 size = MSM_FB_SIZE;
2220 addr = alloc_bootmem_align(size, 0x1000);
2221 msm_fb_resources[0].start = __pa(addr);
2222 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2223 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2224 size, addr, __pa(addr));
2225
2226}
2227#ifdef CONFIG_WCD9310_CODEC
2228
2229#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2230
Patrick Lai3043fba2011-08-01 14:15:57 -07002231/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2232 * 4 micbiases are used to power various analog and digital
2233 * microphones operating at 1800 mV. Technically, all micbiases
2234 * can source from single cfilter since all microphones operate
2235 * at the same voltage level. The arrangement below is to make
2236 * sure all cfilters are exercised. LDO_H regulator ouput level
2237 * does not need to be as high as 2.85V. It is choosen for
2238 * microphone sensitivity purpose.
2239 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002240static struct tabla_pdata tabla_platform_data = {
2241 .slimbus_slave_device = {
2242 .name = "tabla-slave",
2243 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2244 },
2245 .irq = MSM_GPIO_TO_INT(62),
2246 .irq_base = TABLA_INTERRUPT_BASE,
2247 .num_irqs = NR_TABLA_IRQS,
2248 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002249 .micbias = {
2250 .ldoh_v = TABLA_LDOH_2P85_V,
2251 .cfilt1_mv = 1800,
2252 .cfilt2_mv = 1800,
2253 .cfilt3_mv = 1800,
2254 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2255 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2256 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2257 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2258 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002259};
2260
2261static struct slim_device msm_slim_tabla = {
2262 .name = "tabla-slim",
2263 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2264 .dev = {
2265 .platform_data = &tabla_platform_data,
2266 },
2267};
2268#endif
2269
2270static struct slim_boardinfo msm_slim_devices[] = {
2271#ifdef CONFIG_WCD9310_CODEC
2272 {
2273 .bus_num = 1,
2274 .slim_slave = &msm_slim_tabla,
2275 },
2276#endif
2277 /* add more slimbus slaves as needed */
2278};
2279
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002280#define MSM_WCNSS_PHYS 0x03000000
2281#define MSM_WCNSS_SIZE 0x280000
2282
2283static struct resource resources_wcnss_wlan[] = {
2284 {
2285 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2286 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2287 .name = "wcnss_wlanrx_irq",
2288 .flags = IORESOURCE_IRQ,
2289 },
2290 {
2291 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2292 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2293 .name = "wcnss_wlantx_irq",
2294 .flags = IORESOURCE_IRQ,
2295 },
2296 {
2297 .start = MSM_WCNSS_PHYS,
2298 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2299 .name = "wcnss_mmio",
2300 .flags = IORESOURCE_MEM,
2301 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002302 {
2303 .start = 84,
2304 .end = 88,
2305 .name = "wcnss_gpios_5wire",
2306 .flags = IORESOURCE_IO,
2307 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002308};
2309
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002310static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2311 .has_48mhz_xo = 1,
2312};
2313
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002314static struct platform_device msm_device_wcnss_wlan = {
2315 .name = "wcnss_wlan",
2316 .id = 0,
2317 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2318 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002319 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002320};
2321
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002322#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2323 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2324 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2325 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2326
2327#define QCE_SIZE 0x10000
2328#define QCE_0_BASE 0x18500000
2329
2330#define QCE_HW_KEY_SUPPORT 0
2331#define QCE_SHA_HMAC_SUPPORT 1
2332#define QCE_SHARE_CE_RESOURCE 1
2333#define QCE_CE_SHARED 0
2334
2335static struct resource qcrypto_resources[] = {
2336 [0] = {
2337 .start = QCE_0_BASE,
2338 .end = QCE_0_BASE + QCE_SIZE - 1,
2339 .flags = IORESOURCE_MEM,
2340 },
2341 [1] = {
2342 .name = "crypto_channels",
2343 .start = DMOV_CE_IN_CHAN,
2344 .end = DMOV_CE_OUT_CHAN,
2345 .flags = IORESOURCE_DMA,
2346 },
2347 [2] = {
2348 .name = "crypto_crci_in",
2349 .start = DMOV_CE_IN_CRCI,
2350 .end = DMOV_CE_IN_CRCI,
2351 .flags = IORESOURCE_DMA,
2352 },
2353 [3] = {
2354 .name = "crypto_crci_out",
2355 .start = DMOV_CE_OUT_CRCI,
2356 .end = DMOV_CE_OUT_CRCI,
2357 .flags = IORESOURCE_DMA,
2358 },
2359};
2360
2361static struct resource qcedev_resources[] = {
2362 [0] = {
2363 .start = QCE_0_BASE,
2364 .end = QCE_0_BASE + QCE_SIZE - 1,
2365 .flags = IORESOURCE_MEM,
2366 },
2367 [1] = {
2368 .name = "crypto_channels",
2369 .start = DMOV_CE_IN_CHAN,
2370 .end = DMOV_CE_OUT_CHAN,
2371 .flags = IORESOURCE_DMA,
2372 },
2373 [2] = {
2374 .name = "crypto_crci_in",
2375 .start = DMOV_CE_IN_CRCI,
2376 .end = DMOV_CE_IN_CRCI,
2377 .flags = IORESOURCE_DMA,
2378 },
2379 [3] = {
2380 .name = "crypto_crci_out",
2381 .start = DMOV_CE_OUT_CRCI,
2382 .end = DMOV_CE_OUT_CRCI,
2383 .flags = IORESOURCE_DMA,
2384 },
2385};
2386
2387#endif
2388
2389#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2390 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2391
2392static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2393 .ce_shared = QCE_CE_SHARED,
2394 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2395 .hw_key_support = QCE_HW_KEY_SUPPORT,
2396 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2397};
2398
2399static struct platform_device qcrypto_device = {
2400 .name = "qcrypto",
2401 .id = 0,
2402 .num_resources = ARRAY_SIZE(qcrypto_resources),
2403 .resource = qcrypto_resources,
2404 .dev = {
2405 .coherent_dma_mask = DMA_BIT_MASK(32),
2406 .platform_data = &qcrypto_ce_hw_suppport,
2407 },
2408};
2409#endif
2410
2411#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2412 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2413
2414static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2415 .ce_shared = QCE_CE_SHARED,
2416 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2417 .hw_key_support = QCE_HW_KEY_SUPPORT,
2418 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2419};
2420
2421static struct platform_device qcedev_device = {
2422 .name = "qce",
2423 .id = 0,
2424 .num_resources = ARRAY_SIZE(qcedev_resources),
2425 .resource = qcedev_resources,
2426 .dev = {
2427 .coherent_dma_mask = DMA_BIT_MASK(32),
2428 .platform_data = &qcedev_ce_hw_suppport,
2429 },
2430};
2431#endif
2432
2433
2434static int __init gpiomux_init(void)
2435{
2436 int rc;
2437
2438 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2439 if (rc) {
2440 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2441 return rc;
2442 }
2443
Nishant Pandit24153d82011-08-27 16:05:13 +05302444 msm_gpiomux_install(msm8960_cam_common_configs,
2445 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002446
2447 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002448 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002449
2450 msm_gpiomux_install(msm8960_gsbi_configs,
2451 ARRAY_SIZE(msm8960_gsbi_configs));
2452
2453 msm_gpiomux_install(msm8960_cyts_configs,
2454 ARRAY_SIZE(msm8960_cyts_configs));
2455
2456 msm_gpiomux_install(msm8960_slimbus_config,
2457 ARRAY_SIZE(msm8960_slimbus_config));
2458
2459 msm_gpiomux_install(msm8960_audio_codec_configs,
2460 ARRAY_SIZE(msm8960_audio_codec_configs));
2461
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002462 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2463 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2464
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002465#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2466 msm_gpiomux_install(msm8960_hdmi_configs,
2467 ARRAY_SIZE(msm8960_hdmi_configs));
2468#endif
2469
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002470 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2471 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2472
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002473 msm_gpiomux_install(wcnss_5wire_interface,
2474 ARRAY_SIZE(wcnss_5wire_interface));
2475
2476 return 0;
2477}
2478
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002479#define MSM_SHARED_RAM_PHYS 0x80000000
2480
2481static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2482 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2483 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2484 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2485 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2486 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2487 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2488 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2489 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2490 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2491 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2492 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2493 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002494 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2495 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2496 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2497 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2498 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2499 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2500 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2501 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2502 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2503 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2504 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2505 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2506 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2507 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002508 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002509 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2510 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2511 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002512 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2513 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002514};
2515
2516static struct pm8921_adc_properties pm8921_adc_data = {
2517 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2518 .bitresolution = 15,
2519 .bipolar = 0,
2520};
2521
2522static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2523 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002524 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002525 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002526 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002527};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002528
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002529static void __init msm8960_map_io(void)
2530{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002531 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002532 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002533
2534 if (socinfo_init() < 0)
2535 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002536}
2537
2538static void __init msm8960_init_irq(void)
2539{
2540 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002541
2542 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002543 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002544 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002545
2546 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002547 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002548
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002549 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2550 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002551
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002552 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2553 * as they are configured as level, which does not play nice with
2554 * handle_percpu_irq.
2555 */
2556 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2557 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002558 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002559 }
2560}
2561
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002562/* MSM8960 have 5 SDCC controllers */
2563enum sdcc_controllers {
2564 SDCC1,
2565 SDCC2,
2566 SDCC3,
2567 SDCC4,
2568 SDCC5,
2569 MAX_SDCC_CONTROLLER
2570};
2571
2572/* All SDCC controllers requires VDD/VCC voltage */
2573static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2574 /* SDCC1 : eMMC card connected */
2575 [SDCC1] = {
2576 .name = "sdc_vdd",
2577 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302578 .high_vol_level = 2950000,
2579 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302580 .always_on = 1,
2581 .lpm_sup = 1,
2582 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002583 .hpm_uA = 200000, /* 200mA */
2584 },
2585 /* SDCC3 : External card slot connected */
2586 [SDCC3] = {
2587 .name = "sdc_vdd",
2588 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302589 .high_vol_level = 2950000,
2590 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002591 .hpm_uA = 600000, /* 600mA */
2592 }
2593};
2594
2595/* Only slots having eMMC card will require VCCQ voltage */
2596static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2597 /* SDCC1 : eMMC card connected */
2598 [SDCC1] = {
2599 .name = "sdc_vccq",
2600 .set_voltage_sup = 1,
2601 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302602 .high_vol_level = 1800000,
2603 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002604 .hpm_uA = 200000, /* 200mA */
2605 }
2606};
2607
2608/* All SDCC controllers may require voting for VDD PAD voltage */
2609static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2610 /* SDCC3 : External card slot connected */
2611 [SDCC3] = {
2612 .name = "sdc_vddp",
2613 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302614 .high_vol_level = 2950000,
2615 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002616 .always_on = 1,
2617 .lpm_sup = 1,
2618 /* Max. Active current required is 16 mA */
2619 .hpm_uA = 16000,
2620 /*
2621 * Sleep current required is ~300 uA. But min. vote can be
2622 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2623 * during sleep.
2624 */
2625 .lpm_uA = 2000,
2626 }
2627};
2628
2629static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2630 /* SDCC1 : eMMC card connected */
2631 [SDCC1] = {
2632 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2633 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2634 },
2635 /* SDCC3 : External card slot connected */
2636 [SDCC3] = {
2637 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2638 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2639 }
2640};
2641
2642/* SDC1 pad data */
2643static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2644 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302645 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2646 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002647};
2648
2649static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2650 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2651 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2652 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2653};
2654
2655static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302656 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002657 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2658 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2659};
2660
2661static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302662 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002663 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2664 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2665};
2666
2667/* SDC3 pad data */
2668static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2669 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2670 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2671 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2672};
2673
2674static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2675 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2676 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2677 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2678};
2679
2680static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302681 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002682 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2683 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2684};
2685
2686static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302687 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002688 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2689 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2690};
2691
2692struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2693 [SDCC1] = {
2694 .on = sdc1_pad_pull_on_cfg,
2695 .off = sdc1_pad_pull_off_cfg,
2696 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2697 },
2698 [SDCC3] = {
2699 .on = sdc3_pad_pull_on_cfg,
2700 .off = sdc3_pad_pull_off_cfg,
2701 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2702 },
2703};
2704
2705struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2706 [SDCC1] = {
2707 .on = sdc1_pad_drv_on_cfg,
2708 .off = sdc1_pad_drv_off_cfg,
2709 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2710 },
2711 [SDCC3] = {
2712 .on = sdc3_pad_drv_on_cfg,
2713 .off = sdc3_pad_drv_off_cfg,
2714 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2715 },
2716};
2717
2718struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2719 [SDCC1] = {
2720 .pull = &mmc_pad_pull_data[SDCC1],
2721 .drv = &mmc_pad_drv_data[SDCC1]
2722 },
2723 [SDCC3] = {
2724 .pull = &mmc_pad_pull_data[SDCC3],
2725 .drv = &mmc_pad_drv_data[SDCC3]
2726 },
2727};
2728
2729struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2730 [SDCC1] = {
2731 .pad_data = &mmc_pad_data[SDCC1],
2732 },
2733 [SDCC3] = {
2734 .pad_data = &mmc_pad_data[SDCC3],
2735 },
2736};
2737
2738static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302739 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740};
2741
2742static unsigned int sdc3_sup_clk_rates[] = {
2743 400000, 24000000, 48000000, 96000000
2744};
2745
2746#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2747static struct mmc_platform_data msm8960_sdc1_data = {
2748 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2749#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2750 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2751#else
2752 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2753#endif
2754 .sup_clk_table = sdc1_sup_clk_rates,
2755 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302756 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002757 .nonremovable = 1,
2758 .sdcc_v4_sup = true,
2759 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302760 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002761};
2762#endif
2763
2764#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2765static struct mmc_platform_data msm8960_sdc3_data = {
2766 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2767 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2768 .sup_clk_table = sdc3_sup_clk_rates,
2769 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302770 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302771#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002772 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302773#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002774 .sdcc_v4_sup = true,
2775 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2776 .pin_data = &mmc_slot_pin_data[SDCC3],
2777#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2778 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2779 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2780 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2781#endif
2782 .xpc_cap = 1,
2783 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2784 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302785 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002786};
2787#endif
2788
2789static void __init msm8960_init_mmc(void)
2790{
2791#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2792 /* SDC1 : eMMC card connected */
2793 msm_add_sdcc(1, &msm8960_sdc1_data);
2794#endif
2795#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2796 /* SDC3: External card slot */
2797 msm_add_sdcc(3, &msm8960_sdc3_data);
2798#endif
2799}
2800
2801static void __init msm8960_init_buses(void)
2802{
2803#ifdef CONFIG_MSM_BUS_SCALING
2804 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2805 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2806 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2807 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2808 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2809 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2810 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2811 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2812 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2813 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
Gagan Macdc1dc142011-09-16 15:13:35 -06002814 msm_bus_rpm_set_mt_mask();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002815#endif
2816}
2817
2818static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2819 .max_clock_speed = 15060000,
2820};
2821
2822#ifdef CONFIG_USB_MSM_OTG_72K
2823static struct msm_otg_platform_data msm_otg_pdata;
2824#else
2825#define USB_5V_EN 42
2826static void msm_hsusb_vbus_power(bool on)
2827{
2828 int rc;
2829 static bool vbus_is_on;
2830 static struct regulator *mvs_otg_switch;
2831 struct pm_gpio param = {
2832 .direction = PM_GPIO_DIR_OUT,
2833 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2834 .output_value = 1,
2835 .pull = PM_GPIO_PULL_NO,
2836 .vin_sel = PM_GPIO_VIN_S4,
2837 .out_strength = PM_GPIO_STRENGTH_MED,
2838 .function = PM_GPIO_FUNC_NORMAL,
2839 };
2840
2841 if (vbus_is_on == on)
2842 return;
2843
2844 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002845 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2846 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002847 if (IS_ERR(mvs_otg_switch)) {
2848 pr_err("Unable to get mvs_otg_switch\n");
2849 return;
2850 }
2851
2852 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2853 "usb_5v_en");
2854 if (rc < 0) {
2855 pr_err("failed to request usb_5v_en gpio\n");
2856 goto put_mvs_otg;
2857 }
2858
2859 if (regulator_enable(mvs_otg_switch)) {
2860 pr_err("unable to enable mvs_otg_switch\n");
2861 goto free_usb_5v_en;
2862 }
2863
2864 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2865 &param);
2866 if (rc < 0) {
2867 pr_err("failed to configure usb_5v_en gpio\n");
2868 goto disable_mvs_otg;
2869 }
2870 vbus_is_on = true;
2871 return;
2872 }
2873disable_mvs_otg:
2874 regulator_disable(mvs_otg_switch);
2875free_usb_5v_en:
2876 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2877put_mvs_otg:
2878 regulator_put(mvs_otg_switch);
2879 vbus_is_on = false;
2880}
2881
2882static struct msm_otg_platform_data msm_otg_pdata = {
2883 .mode = USB_OTG,
2884 .otg_control = OTG_PMIC_CONTROL,
2885 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2886 .pclk_src_name = "dfab_usb_hs_clk",
2887 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2888 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302889 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002890};
2891#endif
2892
2893#define PID_MAGIC_ID 0x71432909
2894#define SERIAL_NUM_MAGIC_ID 0x61945374
2895#define SERIAL_NUMBER_LENGTH 127
2896#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2897
2898struct magic_num_struct {
2899 uint32_t pid;
2900 uint32_t serial_num;
2901};
2902
2903struct dload_struct {
2904 uint32_t reserved1;
2905 uint32_t reserved2;
2906 uint32_t reserved3;
2907 uint16_t reserved4;
2908 uint16_t pid;
2909 char serial_number[SERIAL_NUMBER_LENGTH];
2910 uint16_t reserved5;
2911 struct magic_num_struct magic_struct;
2912};
2913
2914static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2915{
2916 struct dload_struct __iomem *dload = 0;
2917
2918 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2919 if (!dload) {
2920 pr_err("%s: cannot remap I/O memory region: %08x\n",
2921 __func__, DLOAD_USB_BASE_ADD);
2922 return -ENXIO;
2923 }
2924
2925 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2926 __func__, dload, pid, snum);
2927 /* update pid */
2928 dload->magic_struct.pid = PID_MAGIC_ID;
2929 dload->pid = pid;
2930
2931 /* update serial number */
2932 dload->magic_struct.serial_num = 0;
2933 if (!snum) {
2934 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2935 goto out;
2936 }
2937
2938 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2939 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2940 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2941out:
2942 iounmap(dload);
2943 return 0;
2944}
2945
2946static struct android_usb_platform_data android_usb_pdata = {
2947 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2948};
2949
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002950static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002951 .name = "android_usb",
2952 .id = -1,
2953 .dev = {
2954 .platform_data = &android_usb_pdata,
2955 },
2956};
2957
2958static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2959 0x03, 0x0f,
2960};
2961
2962static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2963 0x00, 0x24, 0x54, 0x10,
2964 0x09, 0x03, 0x01,
2965 0x10, 0x54, 0x30, 0x0C,
2966 0x24, 0x30, 0x0f,
2967};
2968
2969static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2970 0x00, 0x24, 0x54, 0x10,
2971 0x09, 0x07, 0x01, 0x0B,
2972 0x10, 0x54, 0x30, 0x0C,
2973 0x24, 0x30, 0x0f,
2974};
2975
2976static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2977 [0] = {
2978 .mode = MSM_SPM_MODE_CLOCK_GATING,
2979 .notify_rpm = false,
2980 .cmd = spm_wfi_cmd_sequence,
2981 },
2982 [1] = {
2983 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2984 .notify_rpm = false,
2985 .cmd = spm_power_collapse_without_rpm,
2986 },
2987 [2] = {
2988 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2989 .notify_rpm = true,
2990 .cmd = spm_power_collapse_with_rpm,
2991 },
2992};
2993
2994static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2995 [0] = {
2996 .reg_base_addr = MSM_SAW0_BASE,
2997 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2998 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2999 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3000#if defined(CONFIG_MSM_AVS_HW)
3001 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3002 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3003#endif
3004 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3005 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3006 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3007 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3008 .vctl_timeout_us = 50,
3009 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3010 .modes = msm_spm_seq_list,
3011 },
3012 [1] = {
3013 .reg_base_addr = MSM_SAW1_BASE,
3014 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3015 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3016 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3017#if defined(CONFIG_MSM_AVS_HW)
3018 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3019 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3020#endif
3021 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3022 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3023 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3024 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3025 .vctl_timeout_us = 50,
3026 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3027 .modes = msm_spm_seq_list,
3028 },
3029};
3030
3031static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3032 0x00, 0x20, 0x03, 0x20,
3033 0x00, 0x0f,
3034};
3035
3036static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3037 0x00, 0x20, 0x34, 0x64,
3038 0x48, 0x07, 0x48, 0x20,
3039 0x50, 0x64, 0x04, 0x34,
3040 0x50, 0x0f,
3041};
3042static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3043 0x00, 0x10, 0x34, 0x64,
3044 0x48, 0x07, 0x48, 0x10,
3045 0x50, 0x64, 0x04, 0x34,
3046 0x50, 0x0F,
3047};
3048
3049static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3050 [0] = {
3051 .mode = MSM_SPM_L2_MODE_RETENTION,
3052 .notify_rpm = false,
3053 .cmd = l2_spm_wfi_cmd_sequence,
3054 },
3055 [1] = {
3056 .mode = MSM_SPM_L2_MODE_GDHS,
3057 .notify_rpm = true,
3058 .cmd = l2_spm_gdhs_cmd_sequence,
3059 },
3060 [2] = {
3061 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3062 .notify_rpm = true,
3063 .cmd = l2_spm_power_off_cmd_sequence,
3064 },
3065};
3066
3067
3068static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3069 [0] = {
3070 .reg_base_addr = MSM_SAW_L2_BASE,
3071 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3072 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3073 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3074 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3075 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3076 .modes = msm_spm_l2_seq_list,
3077 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3078 },
3079};
3080
3081#define CYTTSP_TS_GPIO_IRQ 11
3082#define CYTTSP_TS_SLEEP_GPIO 50
3083#define CYTTSP_TS_RESOUT_N_GPIO 52
3084
3085/*virtual key support */
3086static ssize_t tma340_vkeys_show(struct kobject *kobj,
3087 struct kobj_attribute *attr, char *buf)
3088{
3089 return snprintf(buf, 200,
3090 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3091 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3092 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3093 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3094 "\n");
3095}
3096
3097static struct kobj_attribute tma340_vkeys_attr = {
3098 .attr = {
3099 .mode = S_IRUGO,
3100 },
3101 .show = &tma340_vkeys_show,
3102};
3103
3104static struct attribute *tma340_properties_attrs[] = {
3105 &tma340_vkeys_attr.attr,
3106 NULL
3107};
3108
3109static struct attribute_group tma340_properties_attr_group = {
3110 .attrs = tma340_properties_attrs,
3111};
3112
3113
3114static int cyttsp_platform_init(struct i2c_client *client)
3115{
3116 int rc = 0;
3117 static struct kobject *tma340_properties_kobj;
3118
3119 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3120 tma340_properties_kobj = kobject_create_and_add("board_properties",
3121 NULL);
3122 if (tma340_properties_kobj)
3123 rc = sysfs_create_group(tma340_properties_kobj,
3124 &tma340_properties_attr_group);
3125 if (!tma340_properties_kobj || rc)
3126 pr_err("%s: failed to create board_properties\n",
3127 __func__);
3128
3129 return 0;
3130}
3131
3132static struct cyttsp_regulator regulator_data[] = {
3133 {
3134 .name = "vdd",
3135 .min_uV = CY_TMA300_VTG_MIN_UV,
3136 .max_uV = CY_TMA300_VTG_MAX_UV,
3137 .load_uA = CY_TMA300_CURR_24HZ_UA,
3138 },
3139 /* TODO: Remove after runtime PM is enabled in I2C driver */
3140 {
3141 .name = "vcc_i2c",
3142 .min_uV = CY_I2C_VTG_MIN_UV,
3143 .max_uV = CY_I2C_VTG_MAX_UV,
3144 .load_uA = CY_I2C_CURR_UA,
3145 },
3146};
3147
3148static struct cyttsp_platform_data cyttsp_pdata = {
3149 .panel_maxx = 634,
3150 .panel_maxy = 1166,
3151 .disp_maxx = 616,
3152 .disp_maxy = 1023,
3153 .disp_minx = 0,
3154 .disp_miny = 16,
3155 .flags = 0x01,
3156 .gen = CY_GEN3, /* or */
3157 .use_st = CY_USE_ST,
3158 .use_mt = CY_USE_MT,
3159 .use_hndshk = CY_SEND_HNDSHK,
3160 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303161 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003162 .use_gestures = CY_USE_GESTURES,
3163 .fw_fname = "cyttsp_8960_cdp.hex",
3164 /* activate up to 4 groups
3165 * and set active distance
3166 */
3167 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3168 CY_GEST_GRP3 | CY_GEST_GRP4 |
3169 CY_ACT_DIST,
3170 /* change act_intrvl to customize the Active power state
3171 * scanning/processing refresh interval for Operating mode
3172 */
3173 .act_intrvl = CY_ACT_INTRVL_DFLT,
3174 /* change tch_tmout to customize the touch timeout for the
3175 * Active power state for Operating mode
3176 */
3177 .tch_tmout = CY_TCH_TMOUT_DFLT,
3178 /* change lp_intrvl to customize the Low Power power state
3179 * scanning/processing refresh interval for Operating mode
3180 */
3181 .lp_intrvl = CY_LP_INTRVL_DFLT,
3182 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3183 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3184 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3185 .regulator_info = regulator_data,
3186 .num_regulators = ARRAY_SIZE(regulator_data),
3187 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303188 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003189};
3190
3191static struct i2c_board_info cyttsp_info[] __initdata = {
3192 {
3193 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3194 .platform_data = &cyttsp_pdata,
3195#ifndef CY_USE_TIMER
3196 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3197#endif /* CY_USE_TIMER */
3198 },
3199};
3200
Mohan Pallaka50837382011-09-07 11:00:57 +05303201/* configuration data */
3202static const u8 mxt_config_data[] = {
3203 /* T6 Object */
3204 0, 0, 0, 0, 0, 0,
3205 /* T38 Object */
3206 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
3207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3208 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3212 0, 0, 0, 0,
3213 /* T7 Object */
3214 10, 10, 50,
3215 /* T8 Object */
3216 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3217 /* T9 Object */
3218 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3219 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3220 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3221 0, 5, 45, 46,
3222 /* T15 Object */
3223 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3224 0,
3225 /* T22 Object */
3226 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3227 0, 0, 255, 255, 255, 255, 0,
3228 /* T24 Object */
3229 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3230 0, 0, 0, 0, 0, 0, 0, 0, 0,
3231 /* T25 Object */
3232 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3233 0, 0, 0, 0,
3234 /* T27 Object */
3235 0, 0, 0, 0, 0, 0, 0,
3236 /* T28 Object */
3237 0, 0, 0, 8, 8, 8,
3238 /* T40 Object */
3239 0, 0, 0, 0, 0,
3240 /* T41 Object */
3241 0, 0, 0, 0, 0, 0,
3242 /* T43 Object */
3243 0, 0, 0, 0, 0, 0,
3244};
3245
3246#define MXT_TS_GPIO_IRQ 11
3247#define MXT_TS_LDO_EN_GPIO 50
3248#define MXT_TS_RESET_GPIO 52
3249
3250static void mxt_init_hw_liquid(void)
3251{
3252 int rc;
3253
3254 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3255 if (rc) {
3256 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3257 __func__, MXT_TS_GPIO_IRQ);
3258 return;
3259 }
3260
3261 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3262 if (rc) {
3263 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3264 __func__, MXT_TS_GPIO_IRQ);
3265 goto err_irq_gpio_req;
3266 }
3267
3268 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3269 if (rc) {
3270 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3271 __func__, MXT_TS_LDO_EN_GPIO);
3272 goto err_irq_gpio_req;
3273 }
3274
3275 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3276 if (rc) {
3277 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3278 __func__, MXT_TS_LDO_EN_GPIO);
3279 goto err_ldo_gpio_req;
3280 }
3281
3282 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3283 if (rc) {
3284 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3285 __func__, MXT_TS_RESET_GPIO);
3286 goto err_ldo_gpio_set_dir;
3287 }
3288
3289 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3290 if (rc) {
3291 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3292 __func__, MXT_TS_RESET_GPIO);
3293 goto err_reset_gpio_req;
3294 }
3295
3296 return;
3297
3298err_reset_gpio_req:
3299 gpio_free(MXT_TS_RESET_GPIO);
3300err_ldo_gpio_set_dir:
3301 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3302err_ldo_gpio_req:
3303 gpio_free(MXT_TS_LDO_EN_GPIO);
3304err_irq_gpio_req:
3305 gpio_free(MXT_TS_GPIO_IRQ);
3306}
3307
3308static struct mxt_platform_data mxt_platform_data = {
3309 .config = mxt_config_data,
3310 .config_length = ARRAY_SIZE(mxt_config_data),
3311 .x_line = 26,
3312 .y_line = 42,
3313 .x_size = 767,
3314 .y_size = 1365,
3315 .blen = 32,
3316 .threshold = 40,
3317 .voltage = 3300000, /* 3.3V */
3318 .orient = MXT_ROTATED_90,
3319 .irqflags = IRQF_TRIGGER_FALLING,
3320};
3321
3322static struct i2c_board_info mxt_device_info[] __initdata = {
3323 {
3324 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3325 .platform_data = &mxt_platform_data,
3326 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3327 },
3328};
3329
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003330static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3331{
3332}
3333
3334static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3335 .clk_freq = 100000,
3336 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003337 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3338};
3339
3340static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3341 .clk_freq = 100000,
3342 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003343 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3344};
3345
3346static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3347 .clk_freq = 100000,
3348 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003349 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3350};
3351
3352static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3353 .clk_freq = 100000,
3354 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003355 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3356};
3357
3358static struct msm_rpm_platform_data msm_rpm_data = {
3359 .reg_base_addrs = {
3360 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3361 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3362 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3363 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3364 },
3365
3366 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3367 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3368 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3369 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3370 .msm_apps_ipc_rpm_val = 4,
3371};
3372
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003373static struct ks8851_pdata spi_eth_pdata = {
3374 .irq_gpio = KS8851_IRQ_GPIO,
3375 .rst_gpio = KS8851_RST_GPIO,
3376};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003377
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003378static struct spi_board_info spi_board_info[] __initdata = {
3379 {
3380 .modalias = "ks8851",
3381 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3382 .max_speed_hz = 19200000,
3383 .bus_num = 0,
3384 .chip_select = 0,
3385 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003386 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003387 },
3388};
3389
3390static struct platform_device msm_device_saw_core0 = {
3391 .name = "saw-regulator",
3392 .id = 0,
3393 .dev = {
3394 .platform_data = &msm_saw_regulator_pdata_s5,
3395 },
3396};
3397
3398static struct platform_device msm_device_saw_core1 = {
3399 .name = "saw-regulator",
3400 .id = 1,
3401 .dev = {
3402 .platform_data = &msm_saw_regulator_pdata_s6,
3403 },
3404};
3405
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003406static struct tsens_platform_data msm_tsens_pdata = {
3407 .slope = 910,
3408 .tsens_factor = 1000,
3409 .hw_type = MSM_8960,
3410 .tsens_num_sensor = 5,
3411};
3412
3413static struct platform_device msm_tsens_device = {
3414 .name = "tsens8960-tm",
3415 .id = -1,
3416 .dev = {
3417 .platform_data = &msm_tsens_pdata,
3418 },
3419};
3420
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003421#ifdef CONFIG_MSM_FAKE_BATTERY
3422static struct platform_device fish_battery_device = {
3423 .name = "fish_battery",
3424};
3425#endif
3426
David Collins26f05562011-06-20 09:56:28 -07003427static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003428 .name = GPIO_REGULATOR_DEV_NAME,
3429 .id = PM8921_MPP_PM_TO_SYS(7),
3430 .dev = {
3431 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3432 },
3433};
3434
David Collins26f05562011-06-20 09:56:28 -07003435static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003436 .name = GPIO_REGULATOR_DEV_NAME,
3437 .id = 91,
3438 .dev = {
3439 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3440 },
3441};
3442
David Collinsb10be1d2011-09-02 10:29:31 -07003443static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3444 .name = GPIO_REGULATOR_DEV_NAME,
3445 .id = PM8921_GPIO_PM_TO_SYS(17),
3446 .dev = {
3447 .platform_data =
3448 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3449 },
3450};
3451
David Collins26f05562011-06-20 09:56:28 -07003452static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3453 .name = "rpm-regulator",
3454 .id = -1,
3455 .dev = {
3456 .platform_data = &msm_rpm_regulator_pdata,
3457 },
3458};
3459
David Collins4c31a872011-08-31 10:07:10 -07003460static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3461 .phys_addr_base = 0x0010C000,
3462 .reg_offsets = {
3463 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3464 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3465 },
3466 .phys_size = SZ_8K,
3467 .log_len = 4096, /* log's buffer length in bytes */
3468 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3469};
3470
3471static struct platform_device msm_rpm_log_device = {
3472 .name = "msm_rpm_log",
3473 .id = -1,
3474 .dev = {
3475 .platform_data = &msm_rpm_log_pdata,
3476 },
3477};
3478
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003479static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003480 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003481 &msm_device_smd,
3482 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303483 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003484 &msm_device_saw_core0,
3485 &msm_device_saw_core1,
3486 &msm8960_device_ext_5v_vreg,
3487 &msm8960_device_ext_l2_vreg,
3488 &msm8960_device_ssbi_pm8921,
3489 &msm8960_device_qup_spi_gsbi1,
3490 &msm8960_device_qup_i2c_gsbi3,
3491 &msm8960_device_qup_i2c_gsbi4,
3492 &msm8960_device_qup_i2c_gsbi10,
3493#ifndef CONFIG_MSM_DSPS
3494 &msm8960_device_qup_i2c_gsbi12,
3495#endif
3496 &msm_slim_ctrl,
3497 &msm_device_wcnss_wlan,
3498#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3499 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3500 &qcrypto_device,
3501#endif
3502
3503#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3504 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3505 &qcedev_device,
3506#endif
3507#ifdef CONFIG_MSM_ROTATOR
3508 &msm_rotator_device,
3509#endif
3510 &msm_device_sps,
3511#ifdef CONFIG_MSM_FAKE_BATTERY
3512 &fish_battery_device,
3513#endif
3514#ifdef CONFIG_ANDROID_PMEM
3515 &android_pmem_device,
3516 &android_pmem_adsp_device,
3517 &android_pmem_audio_device,
3518#endif
3519 &msm_fb_device,
3520 &msm_device_vidc,
3521 &msm_device_bam_dmux,
3522 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003523
3524#ifdef CONFIG_HW_RANDOM_MSM
3525 &msm_device_rng,
3526#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003527 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003528#ifdef CONFIG_ION_MSM
3529 &ion_dev,
3530#endif
David Collins4c31a872011-08-31 10:07:10 -07003531 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003532#ifdef CONFIG_MSM_QDSS
3533 &msm_etb_device,
3534 &msm_tpiu_device,
3535 &msm_funnel_device,
3536 &msm_ptm_device,
3537#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003538 &msm_device_dspcrashd_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003539};
3540
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003541static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003542 &msm8960_device_otg,
3543 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003544 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303545 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003546 &android_usb_device,
3547 &msm_device_vidc,
3548 &mipi_dsi_simulator_panel_device,
3549 &msm_bus_apps_fabric,
3550 &msm_bus_sys_fabric,
3551 &msm_bus_mm_fabric,
3552 &msm_bus_sys_fpb,
3553 &msm_bus_cpss_fpb,
3554 &msm_pcm,
3555 &msm_pcm_routing,
3556 &msm_cpudai0,
3557 &msm_cpudai1,
3558 &msm_cpudai_hdmi_rx,
3559 &msm_cpudai_bt_rx,
3560 &msm_cpudai_bt_tx,
3561 &msm_cpudai_fm_rx,
3562 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003563 &msm_cpudai_auxpcm_rx,
3564 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003565 &msm_cpu_fe,
3566 &msm_stub_codec,
3567 &msm_voice,
3568 &msm_voip,
3569 &msm_lpa_pcm,
3570
3571#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3572 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3573 &qcrypto_device,
3574#endif
3575
3576#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3577 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3578 &qcedev_device,
3579#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003580};
3581
3582static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003583 &msm_kgsl_3d0,
3584 &msm_kgsl_2d0,
3585 &msm_kgsl_2d1,
3586 &mipi_dsi_renesas_panel_device,
3587#ifdef CONFIG_MSM_GEMINI
3588 &msm8960_gemini_device,
3589#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003590};
3591
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003592static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003593 &msm8960_device_otg,
3594 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003595 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303596 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003597 &android_usb_device,
3598 &msm_pcm,
3599 &msm_pcm_routing,
3600 &msm_cpudai0,
3601 &msm_cpudai1,
3602 &msm_cpudai_hdmi_rx,
3603 &msm_cpudai_bt_rx,
3604 &msm_cpudai_bt_tx,
3605 &msm_cpudai_fm_rx,
3606 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003607 &msm_cpudai_auxpcm_rx,
3608 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003609 &msm_cpu_fe,
3610 &msm_stub_codec,
3611 &msm_kgsl_3d0,
3612#ifdef CONFIG_MSM_KGSL_2D
3613 &msm_kgsl_2d0,
3614 &msm_kgsl_2d1,
3615#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003616 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003617#ifdef CONFIG_MSM_GEMINI
3618 &msm8960_gemini_device,
3619#endif
3620 &msm_voice,
3621 &msm_voip,
3622 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303623 &msm_cpudai_afe_01_rx,
3624 &msm_cpudai_afe_01_tx,
3625 &msm_cpudai_afe_02_rx,
3626 &msm_cpudai_afe_02_tx,
3627 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003628#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3629 &hdmi_msm_device,
3630#endif
3631 &msm_pcm_hostless,
3632 &msm_bus_apps_fabric,
3633 &msm_bus_sys_fabric,
3634 &msm_bus_mm_fabric,
3635 &msm_bus_sys_fpb,
3636 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003637 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003638};
3639
3640static void __init msm8960_i2c_init(void)
3641{
3642 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3643 &msm8960_i2c_qup_gsbi4_pdata;
3644
3645 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3646 &msm8960_i2c_qup_gsbi3_pdata;
3647
3648 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3649 &msm8960_i2c_qup_gsbi10_pdata;
3650
3651 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3652 &msm8960_i2c_qup_gsbi12_pdata;
3653}
3654
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003655static void __init msm8960_gfx_init(void)
3656{
3657 uint32_t soc_platform_version = socinfo_get_platform_version();
3658 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3659 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3660 msm_kgsl_3d0.dev.platform_data;
3661 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3662 320000000;
3663 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3664 266667000;
3665 }
3666}
3667
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003668static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3669 .irq_base = PM8921_IRQ_BASE,
3670 .devirq = MSM_GPIO_TO_INT(104),
3671 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3672};
3673
3674static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3675 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3676};
3677
3678static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3679 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3680};
3681
3682static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3683 .rtc_write_enable = false,
3684};
3685
3686static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3687 .pull_up = 1,
3688 .kpd_trigger_delay_us = 970,
3689 .wakeup = 1,
3690};
3691
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303692/* Rotate lock key is not available so use F1 */
3693#define KEY_ROTATE_LOCK KEY_F1
3694
3695static const unsigned int keymap_liquid[] = {
3696 KEY(0, 0, KEY_VOLUMEUP),
3697 KEY(0, 1, KEY_VOLUMEDOWN),
3698 KEY(1, 3, KEY_ROTATE_LOCK),
3699 KEY(1, 4, KEY_HOME),
3700};
3701
3702static struct matrix_keymap_data keymap_data_liquid = {
3703 .keymap_size = ARRAY_SIZE(keymap_liquid),
3704 .keymap = keymap_liquid,
3705};
3706
3707static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3708 .input_name = "keypad_8960_liquid",
3709 .input_phys_device = "keypad_8960/input0",
3710 .num_rows = 2,
3711 .num_cols = 5,
3712 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3713 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3714 .debounce_ms = 15,
3715 .scan_delay_ms = 32,
3716 .row_hold_ns = 91500,
3717 .wakeup = 1,
3718 .keymap_data = &keymap_data_liquid,
3719};
3720
3721
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003722static const unsigned int keymap[] = {
3723 KEY(0, 0, KEY_VOLUMEUP),
3724 KEY(0, 1, KEY_VOLUMEDOWN),
3725 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3726 KEY(0, 3, KEY_CAMERA_FOCUS),
3727};
3728
3729static struct matrix_keymap_data keymap_data = {
3730 .keymap_size = ARRAY_SIZE(keymap),
3731 .keymap = keymap,
3732};
3733
3734static struct pm8xxx_keypad_platform_data keypad_data = {
3735 .input_name = "keypad_8960",
3736 .input_phys_device = "keypad_8960/input0",
3737 .num_rows = 1,
3738 .num_cols = 5,
3739 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3740 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3741 .debounce_ms = 15,
3742 .scan_delay_ms = 32,
3743 .row_hold_ns = 91500,
3744 .wakeup = 1,
3745 .keymap_data = &keymap_data,
3746};
3747
3748static const unsigned int keymap_sim[] = {
3749 KEY(0, 0, KEY_7),
3750 KEY(0, 1, KEY_DOWN),
3751 KEY(0, 2, KEY_UP),
3752 KEY(0, 3, KEY_RIGHT),
3753 KEY(0, 4, KEY_ENTER),
3754 KEY(0, 5, KEY_L),
3755 KEY(0, 6, KEY_BACK),
3756 KEY(0, 7, KEY_M),
3757
3758 KEY(1, 0, KEY_LEFT),
3759 KEY(1, 1, KEY_SEND),
3760 KEY(1, 2, KEY_1),
3761 KEY(1, 3, KEY_4),
3762 KEY(1, 4, KEY_CLEAR),
3763 KEY(1, 5, KEY_MSDOS),
3764 KEY(1, 6, KEY_SPACE),
3765 KEY(1, 7, KEY_COMMA),
3766
3767 KEY(2, 0, KEY_6),
3768 KEY(2, 1, KEY_5),
3769 KEY(2, 2, KEY_8),
3770 KEY(2, 3, KEY_3),
3771 KEY(2, 4, KEY_NUMERIC_STAR),
3772 KEY(2, 5, KEY_UP),
3773 KEY(2, 6, KEY_DOWN),
3774 KEY(2, 7, KEY_LEFTSHIFT),
3775
3776 KEY(3, 0, KEY_9),
3777 KEY(3, 1, KEY_NUMERIC_POUND),
3778 KEY(3, 2, KEY_0),
3779 KEY(3, 3, KEY_2),
3780 KEY(3, 4, KEY_SLEEP),
3781 KEY(3, 5, KEY_F1),
3782 KEY(3, 6, KEY_F2),
3783 KEY(3, 7, KEY_F3),
3784
3785 KEY(4, 0, KEY_BACK),
3786 KEY(4, 1, KEY_HOME),
3787 KEY(4, 2, KEY_MENU),
3788 KEY(4, 3, KEY_VOLUMEUP),
3789 KEY(4, 4, KEY_VOLUMEDOWN),
3790 KEY(4, 5, KEY_F4),
3791 KEY(4, 6, KEY_F5),
3792 KEY(4, 7, KEY_F6),
3793
3794 KEY(5, 0, KEY_R),
3795 KEY(5, 1, KEY_T),
3796 KEY(5, 2, KEY_Y),
3797 KEY(5, 3, KEY_LEFTALT),
3798 KEY(5, 4, KEY_KPENTER),
3799 KEY(5, 5, KEY_Q),
3800 KEY(5, 6, KEY_W),
3801 KEY(5, 7, KEY_E),
3802
3803 KEY(6, 0, KEY_F),
3804 KEY(6, 1, KEY_G),
3805 KEY(6, 2, KEY_H),
3806 KEY(6, 3, KEY_CAPSLOCK),
3807 KEY(6, 4, KEY_PAGEUP),
3808 KEY(6, 5, KEY_A),
3809 KEY(6, 6, KEY_S),
3810 KEY(6, 7, KEY_D),
3811
3812 KEY(7, 0, KEY_V),
3813 KEY(7, 1, KEY_B),
3814 KEY(7, 2, KEY_N),
3815 KEY(7, 3, KEY_MENU),
3816 KEY(7, 4, KEY_PAGEDOWN),
3817 KEY(7, 5, KEY_Z),
3818 KEY(7, 6, KEY_X),
3819 KEY(7, 7, KEY_C),
3820
3821 KEY(8, 0, KEY_P),
3822 KEY(8, 1, KEY_J),
3823 KEY(8, 2, KEY_K),
3824 KEY(8, 3, KEY_INSERT),
3825 KEY(8, 4, KEY_LINEFEED),
3826 KEY(8, 5, KEY_U),
3827 KEY(8, 6, KEY_I),
3828 KEY(8, 7, KEY_O),
3829
3830 KEY(9, 0, KEY_4),
3831 KEY(9, 1, KEY_5),
3832 KEY(9, 2, KEY_6),
3833 KEY(9, 3, KEY_7),
3834 KEY(9, 4, KEY_8),
3835 KEY(9, 5, KEY_1),
3836 KEY(9, 6, KEY_2),
3837 KEY(9, 7, KEY_3),
3838
3839 KEY(10, 0, KEY_F7),
3840 KEY(10, 1, KEY_F8),
3841 KEY(10, 2, KEY_F9),
3842 KEY(10, 3, KEY_F10),
3843 KEY(10, 4, KEY_FN),
3844 KEY(10, 5, KEY_9),
3845 KEY(10, 6, KEY_0),
3846 KEY(10, 7, KEY_DOT),
3847
3848 KEY(11, 0, KEY_LEFTCTRL),
3849 KEY(11, 1, KEY_F11),
3850 KEY(11, 2, KEY_ENTER),
3851 KEY(11, 3, KEY_SEARCH),
3852 KEY(11, 4, KEY_DELETE),
3853 KEY(11, 5, KEY_RIGHT),
3854 KEY(11, 6, KEY_LEFT),
3855 KEY(11, 7, KEY_RIGHTSHIFT),
3856 KEY(0, 0, KEY_VOLUMEUP),
3857 KEY(0, 1, KEY_VOLUMEDOWN),
3858 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3859 KEY(0, 3, KEY_CAMERA_FOCUS),
3860};
3861
3862static struct matrix_keymap_data keymap_data_sim = {
3863 .keymap_size = ARRAY_SIZE(keymap_sim),
3864 .keymap = keymap_sim,
3865};
3866
3867static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3868 .input_name = "keypad_8960",
3869 .input_phys_device = "keypad_8960/input0",
3870 .num_rows = 12,
3871 .num_cols = 8,
3872 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3873 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3874 .debounce_ms = 15,
3875 .scan_delay_ms = 32,
3876 .row_hold_ns = 91500,
3877 .wakeup = 1,
3878 .keymap_data = &keymap_data_sim,
3879};
3880
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003881static int pm8921_therm_mitigation[] = {
3882 1100,
3883 700,
3884 600,
3885 325,
3886};
3887
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003888static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003889 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003890 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003891 .max_voltage = 4200,
3892 .min_voltage = 3200,
3893 .resume_voltage = 4100,
3894 .term_current = 100,
3895 .cool_temp = 10,
3896 .warm_temp = 40,
3897 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003898 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003899 .cool_bat_chg_current = 350,
3900 .warm_bat_chg_current = 350,
3901 .cool_bat_voltage = 4100,
3902 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003903 .thermal_mitigation = pm8921_therm_mitigation,
3904 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003905};
3906
3907static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3908 .priority = 0,
3909};
3910
3911static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3912 .r_sense = 10,
3913 .i_test = 2500,
3914 .v_failure = 3000,
3915 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003916};
3917
Jay Chokshide4cefb2011-08-04 18:10:44 -07003918#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3919
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003920static struct led_info pm8921_led_info[] = {
3921 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003922 .name = "led:usb",
3923 .default_trigger = "usb-online",
Jay Chokshide4cefb2011-08-04 18:10:44 -07003924 },
3925 [1] = {
3926 .name = "led:ac",
3927 .default_trigger = "ac-online",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003928 },
3929};
3930
Jay Chokshi8994e392011-09-14 18:20:39 -07003931static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003932 .num_leds = ARRAY_SIZE(pm8921_led_info),
3933 .leds = pm8921_led_info,
3934};
3935
Jay Chokshi8994e392011-09-14 18:20:39 -07003936static struct pm8xxx_led_config pm8921_led_configs[] = {
3937 [0] = {
3938 .id = PM8XXX_ID_LED_0,
3939 .mode = PM8XXX_LED_MODE_MANUAL,
3940 .max_current = PM8921_LC_LED_MAX_CURRENT,
3941 },
3942 [1] = {
3943 .id = PM8XXX_ID_LED_1,
3944 .mode = PM8XXX_LED_MODE_MANUAL,
3945 .max_current = PM8921_LC_LED_MAX_CURRENT,
3946 },
3947};
3948
3949static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
3950 .led_core = &pm8921_led_core_pdata,
3951 .configs = pm8921_led_configs,
3952 .num_configs = ARRAY_SIZE(pm8921_led_configs),
3953};
3954
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003955static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3956 .irq_pdata = &pm8xxx_irq_pdata,
3957 .gpio_pdata = &pm8xxx_gpio_pdata,
3958 .mpp_pdata = &pm8xxx_mpp_pdata,
3959 .rtc_pdata = &pm8xxx_rtc_pdata,
3960 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3961 .keypad_pdata = &keypad_data,
3962 .misc_pdata = &pm8xxx_misc_pdata,
3963 .regulator_pdatas = msm_pm8921_regulator_pdata,
3964 .charger_pdata = &pm8921_chg_pdata,
3965 .bms_pdata = &pm8921_bms_pdata,
3966 .adc_pdata = &pm8921_adc_pdata,
3967 .leds_pdata = &pm8xxx_leds_pdata,
3968};
3969
3970static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3971 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3972 .slave = {
3973 .name = "pm8921-core",
3974 .platform_data = &pm8921_platform_data,
3975 },
3976};
3977
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003978#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
3979static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003980{
3981 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003982
3983 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3984 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003985 pr_err("FPGA CS gpio_request failed: %d\n", ret);
3986 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003987 }
3988
3989 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003990
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003991 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003992fail:
3993 return ret;
3994}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003995#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003996static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003997{
3998 return 0;
3999}
4000#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004001
4002static struct msm_cpuidle_state msm_cstates[] __initdata = {
4003 {0, 0, "C0", "WFI",
4004 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4005
4006 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4007 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4008
4009 {0, 2, "C2", "POWER_COLLAPSE",
4010 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4011
4012 {1, 0, "C0", "WFI",
4013 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4014
4015 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4016 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4017};
4018
4019static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4020 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4021 .idle_supported = 1,
4022 .suspend_supported = 1,
4023 .idle_enabled = 0,
4024 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004025 },
4026
4027 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4028 .idle_supported = 1,
4029 .suspend_supported = 1,
4030 .idle_enabled = 0,
4031 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004032 },
4033
4034 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4035 .idle_supported = 1,
4036 .suspend_supported = 1,
4037 .idle_enabled = 1,
4038 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004039 },
4040
4041 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4042 .idle_supported = 0,
4043 .suspend_supported = 1,
4044 .idle_enabled = 0,
4045 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004046 },
4047
4048 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4049 .idle_supported = 1,
4050 .suspend_supported = 1,
4051 .idle_enabled = 0,
4052 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004053 },
4054
4055 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4056 .idle_supported = 1,
4057 .suspend_supported = 0,
4058 .idle_enabled = 1,
4059 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004060 },
4061};
4062
4063static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4064 {
4065 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4066 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4067 true,
4068 1, 8000, 100000, 1,
4069 },
4070
4071 {
4072 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4073 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4074 true,
4075 1500, 5000, 60100000, 3000,
4076 },
4077
4078 {
4079 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4080 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4081 false,
4082 1800, 5000, 60350000, 3500,
4083 },
4084
4085 {
4086 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4087 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4088 false,
4089 2800, 2500, 65350000, 4800,
4090 },
4091
4092 {
4093 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4094 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4095 false,
4096 3800, 4500, 67850000, 5500,
4097 },
4098
4099 {
4100 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4101 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4102 false,
4103 4800, 2000, 71850000, 6800,
4104 },
4105
4106 {
4107 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4108 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4109 false,
4110 6800, 500, 75850000, 8800,
4111 },
4112
4113 {
4114 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4115 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4116 false,
4117 7800, 0, 76350000, 9800,
4118 },
4119};
4120
4121#ifdef CONFIG_I2C
4122#define I2C_SURF 1
4123#define I2C_FFA (1 << 1)
4124#define I2C_RUMI (1 << 2)
4125#define I2C_SIM (1 << 3)
4126#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004127#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004128
4129struct i2c_registry {
4130 u8 machs;
4131 int bus;
4132 struct i2c_board_info *info;
4133 int len;
4134};
4135
4136#ifdef CONFIG_MSM_CAMERA
4137static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4138#ifdef CONFIG_IMX074
4139 {
4140 I2C_BOARD_INFO("imx074", 0x1A),
4141 },
4142#endif
4143#ifdef CONFIG_OV2720
4144 {
4145 I2C_BOARD_INFO("ov2720", 0x6C),
4146 },
4147#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004148 {
4149 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4150 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304151#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4152 {
4153 I2C_BOARD_INFO("sc628a", 0x6E),
4154 },
4155#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004156};
4157#endif
4158
4159/* Sensors DSPS platform data */
4160#ifdef CONFIG_MSM_DSPS
4161#define DSPS_PIL_GENERIC_NAME "dsps"
4162#endif /* CONFIG_MSM_DSPS */
4163
4164static void __init msm8960_init_dsps(void)
4165{
4166#ifdef CONFIG_MSM_DSPS
4167 struct msm_dsps_platform_data *pdata =
4168 msm_dsps_device.dev.platform_data;
4169 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4170 pdata->gpios = NULL;
4171 pdata->gpios_num = 0;
4172
4173 platform_device_register(&msm_dsps_device);
4174#endif /* CONFIG_MSM_DSPS */
4175}
4176
Amir Samuelov5137e392011-09-21 17:31:25 +03004177#ifdef CONFIG_ISL9519_CHARGER
4178static struct isl_platform_data isl_data __initdata = {
4179 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4180 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4181 .max_system_voltage = 4200,
4182 .min_system_voltage = 3200,
4183 .chgcurrent = 1000, /* 1900, */
4184 .term_current = 400, /* Need fine tuning */
4185 .input_current = 2048,
4186};
4187
4188static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4189 {
4190 I2C_BOARD_INFO("isl9519q", 0x9),
4191 .irq = 0, /* Not required when notify-by-pmic */
4192 .platform_data = &isl_data,
4193 },
4194};
4195#endif /* CONFIG_ISL9519_CHARGER */
4196
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004197static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4198#ifdef CONFIG_MSM_CAMERA
4199 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004200 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004201 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4202 msm_camera_boardinfo,
4203 ARRAY_SIZE(msm_camera_boardinfo),
4204 },
4205#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004206#ifdef CONFIG_ISL9519_CHARGER
4207 {
4208 I2C_LIQUID,
4209 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4210 isl_charger_i2c_info,
4211 ARRAY_SIZE(isl_charger_i2c_info),
4212 },
4213#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004214 {
4215 I2C_SURF | I2C_FFA | I2C_FLUID,
4216 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4217 cyttsp_info,
4218 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004219 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304220 {
4221 I2C_LIQUID,
4222 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4223 mxt_device_info,
4224 ARRAY_SIZE(mxt_device_info),
4225 },
4226
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004227};
4228#endif /* CONFIG_I2C */
4229
4230static void __init register_i2c_devices(void)
4231{
4232#ifdef CONFIG_I2C
4233 u8 mach_mask = 0;
4234 int i;
4235
4236 /* Build the matching 'supported_machs' bitmask */
4237 if (machine_is_msm8960_cdp())
4238 mach_mask = I2C_SURF;
4239 else if (machine_is_msm8960_rumi3())
4240 mach_mask = I2C_RUMI;
4241 else if (machine_is_msm8960_sim())
4242 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004243 else if (machine_is_msm8960_fluid())
4244 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004245 else if (machine_is_msm8960_liquid())
4246 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004247 else if (machine_is_msm8960_mtp())
4248 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004249 else
4250 pr_err("unmatched machine ID in register_i2c_devices\n");
4251
4252 /* Run the array and install devices as appropriate */
4253 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4254 if (msm8960_i2c_devices[i].machs & mach_mask)
4255 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4256 msm8960_i2c_devices[i].info,
4257 msm8960_i2c_devices[i].len);
4258 }
4259#endif
4260}
4261
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004262static void __init msm8960_sim_init(void)
4263{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004264 BUG_ON(msm_rpm_init(&msm_rpm_data));
4265 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4266 ARRAY_SIZE(msm_rpmrs_levels)));
4267 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004268 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004269 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004270 msm8960_device_ssbi_pm8921.dev.platform_data =
4271 &msm8960_ssbi_pm8921_pdata;
4272 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004273
4274 /* Simulator supports a QWERTY keypad */
4275 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4276
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004277 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4278 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4279 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004280 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004281 msm8960_i2c_init();
4282 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4283 msm_spm_l2_init(msm_spm_l2_data);
4284 msm8960_init_buses();
4285 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4286 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004287 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004288 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004289
4290 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4291 &msm8960_qup_spi_gsbi1_pdata;
4292 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4293
4294 msm8960_init_mmc();
4295 msm_fb_add_devices();
4296 slim_register_board_info(msm_slim_devices,
4297 ARRAY_SIZE(msm_slim_devices));
4298 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4299 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4300 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4301 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004302}
4303
4304static void __init msm8960_rumi3_init(void)
4305{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004306 BUG_ON(msm_rpm_init(&msm_rpm_data));
4307 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4308 ARRAY_SIZE(msm_rpmrs_levels)));
4309 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004310 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004311 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004312 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004313 msm8960_device_ssbi_pm8921.dev.platform_data =
4314 &msm8960_ssbi_pm8921_pdata;
4315 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4316 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4317 &msm8960_qup_spi_gsbi1_pdata;
4318 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4319 msm8960_i2c_init();
4320 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4321 msm_spm_l2_init(msm_spm_l2_data);
4322 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4323 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004324 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004325 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004326 register_i2c_devices();
4327 msm_fb_add_devices();
4328 slim_register_board_info(msm_slim_devices,
4329 ARRAY_SIZE(msm_slim_devices));
4330 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4331 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4332 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4333 msm_pm_data);
4334}
4335
4336static void __init msm8960_cdp_init(void)
4337{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004338 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4339 pr_err("meminfo_init() failed!\n");
4340
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004341 BUG_ON(msm_rpm_init(&msm_rpm_data));
4342 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4343 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004344
4345 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004346 regulator_suppress_info_printing();
4347 if (msm_xo_init())
4348 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004349 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004350 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004351 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4352 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4353 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004354 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004355 if (machine_is_msm8960_cdp())
4356 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304357 if (machine_is_msm8960_liquid())
4358 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004359 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4360 &msm8960_qup_spi_gsbi1_pdata;
4361 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4362 msm8960_device_ssbi_pm8921.dev.platform_data =
4363 &msm8960_ssbi_pm8921_pdata;
4364 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4365 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004366 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004367 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4368 msm_spm_l2_init(msm_spm_l2_data);
4369 msm8960_init_buses();
4370 platform_add_devices(msm_footswitch_devices,
4371 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004372 if (machine_is_msm8960_liquid())
4373 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004374 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4375 pm8921_gpio_mpp_init();
4376 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4377 msm8960_init_cam();
4378 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004379 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304380 if (machine_is_msm8960_liquid())
4381 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004382 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004383 msm_fb_add_devices();
4384 slim_register_board_info(msm_slim_devices,
4385 ARRAY_SIZE(msm_slim_devices));
4386 msm8960_init_dsps();
4387 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4388 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4389 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4390 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004391 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004392}
4393
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004394MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4395 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004396 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004397 .init_irq = msm8960_init_irq,
4398 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004399 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004400 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004401MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004402
4403MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4404 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004405 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004406 .init_irq = msm8960_init_irq,
4407 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004408 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004409 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004410MACHINE_END
4411
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004412MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4413 .map_io = msm8960_map_io,
4414 .reserve = msm8960_reserve,
4415 .init_irq = msm8960_init_irq,
4416 .timer = &msm_timer,
4417 .init_machine = msm8960_cdp_init,
4418 .init_early = msm8960_allocate_memory_regions,
4419MACHINE_END
4420
4421MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4422 .map_io = msm8960_map_io,
4423 .reserve = msm8960_reserve,
4424 .init_irq = msm8960_init_irq,
4425 .timer = &msm_timer,
4426 .init_machine = msm8960_cdp_init,
4427 .init_early = msm8960_allocate_memory_regions,
4428MACHINE_END
4429
4430MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4431 .map_io = msm8960_map_io,
4432 .reserve = msm8960_reserve,
4433 .init_irq = msm8960_init_irq,
4434 .timer = &msm_timer,
4435 .init_machine = msm8960_cdp_init,
4436 .init_early = msm8960_allocate_memory_regions,
4437MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004438
4439MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4440 .map_io = msm8960_map_io,
4441 .reserve = msm8960_reserve,
4442 .init_irq = msm8960_init_irq,
4443 .timer = &msm_timer,
4444 .init_machine = msm8960_cdp_init,
4445 .init_early = msm8960_allocate_memory_regions,
4446MACHINE_END