blob: 09bc34f065b04f8a9e0b6f695ae0e823202366ed [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 -07001021static struct msm_bus_vectors cam_init_vectors[] = {
1022 {
1023 .src = MSM_BUS_MASTER_VFE,
1024 .dst = MSM_BUS_SLAVE_EBI_CH0,
1025 .ab = 0,
1026 .ib = 0,
1027 },
1028 {
1029 .src = MSM_BUS_MASTER_VPE,
1030 .dst = MSM_BUS_SLAVE_EBI_CH0,
1031 .ab = 0,
1032 .ib = 0,
1033 },
1034 {
1035 .src = MSM_BUS_MASTER_JPEG_ENC,
1036 .dst = MSM_BUS_SLAVE_EBI_CH0,
1037 .ab = 0,
1038 .ib = 0,
1039 },
1040};
1041
1042static struct msm_bus_vectors cam_preview_vectors[] = {
1043 {
1044 .src = MSM_BUS_MASTER_VFE,
1045 .dst = MSM_BUS_SLAVE_EBI_CH0,
1046 .ab = 27648000,
1047 .ib = 110592000,
1048 },
1049 {
1050 .src = MSM_BUS_MASTER_VPE,
1051 .dst = MSM_BUS_SLAVE_EBI_CH0,
1052 .ab = 0,
1053 .ib = 0,
1054 },
1055 {
1056 .src = MSM_BUS_MASTER_JPEG_ENC,
1057 .dst = MSM_BUS_SLAVE_EBI_CH0,
1058 .ab = 0,
1059 .ib = 0,
1060 },
1061};
1062
1063static struct msm_bus_vectors cam_video_vectors[] = {
1064 {
1065 .src = MSM_BUS_MASTER_VFE,
1066 .dst = MSM_BUS_SLAVE_EBI_CH0,
1067 .ab = 140451840,
1068 .ib = 561807360,
1069 },
1070 {
1071 .src = MSM_BUS_MASTER_VPE,
1072 .dst = MSM_BUS_SLAVE_EBI_CH0,
1073 .ab = 206807040,
1074 .ib = 488816640,
1075 },
1076 {
1077 .src = MSM_BUS_MASTER_JPEG_ENC,
1078 .dst = MSM_BUS_SLAVE_EBI_CH0,
1079 .ab = 0,
1080 .ib = 0,
1081 },
1082};
1083
1084static struct msm_bus_vectors cam_snapshot_vectors[] = {
1085 {
1086 .src = MSM_BUS_MASTER_VFE,
1087 .dst = MSM_BUS_SLAVE_EBI_CH0,
1088 .ab = 274423680,
1089 .ib = 1097694720,
1090 },
1091 {
1092 .src = MSM_BUS_MASTER_VPE,
1093 .dst = MSM_BUS_SLAVE_EBI_CH0,
1094 .ab = 0,
1095 .ib = 0,
1096 },
1097 {
1098 .src = MSM_BUS_MASTER_JPEG_ENC,
1099 .dst = MSM_BUS_SLAVE_EBI_CH0,
1100 .ab = 540000000,
1101 .ib = 1350000000,
1102 },
1103};
1104
1105static struct msm_bus_vectors cam_zsl_vectors[] = {
1106 {
1107 .src = MSM_BUS_MASTER_VFE,
1108 .dst = MSM_BUS_SLAVE_EBI_CH0,
1109 .ab = 302071680,
1110 .ib = 1208286720,
1111 },
1112 {
1113 .src = MSM_BUS_MASTER_VPE,
1114 .dst = MSM_BUS_SLAVE_EBI_CH0,
1115 .ab = 0,
1116 .ib = 0,
1117 },
1118 {
1119 .src = MSM_BUS_MASTER_JPEG_ENC,
1120 .dst = MSM_BUS_SLAVE_EBI_CH0,
1121 .ab = 540000000,
1122 .ib = 1350000000,
1123 },
1124};
1125
1126static struct msm_bus_paths cam_bus_client_config[] = {
1127 {
1128 ARRAY_SIZE(cam_init_vectors),
1129 cam_init_vectors,
1130 },
1131 {
1132 ARRAY_SIZE(cam_preview_vectors),
1133 cam_preview_vectors,
1134 },
1135 {
1136 ARRAY_SIZE(cam_video_vectors),
1137 cam_video_vectors,
1138 },
1139 {
1140 ARRAY_SIZE(cam_snapshot_vectors),
1141 cam_snapshot_vectors,
1142 },
1143 {
1144 ARRAY_SIZE(cam_zsl_vectors),
1145 cam_zsl_vectors,
1146 },
1147};
1148
1149static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1150 cam_bus_client_config,
1151 ARRAY_SIZE(cam_bus_client_config),
1152 .name = "msm_camera",
1153};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001154
Nishant Pandit24153d82011-08-27 16:05:13 +05301155struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1156 {
1157 .ioclk.mclk_clk_rate = 24000000,
1158 .ioclk.vfe_clk_rate = 228570000,
1159 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001160 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301161 },
1162 {
1163 .ioclk.mclk_clk_rate = 24000000,
1164 .ioclk.vfe_clk_rate = 228570000,
1165 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001166 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301167 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001168};
1169
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001170#ifdef CONFIG_IMX074_ACT
1171static struct i2c_board_info imx074_actuator_i2c_info = {
1172 I2C_BOARD_INFO("imx074_act", 0x11),
1173};
1174
1175static struct msm_actuator_info imx074_actuator_info = {
1176 .board_info = &imx074_actuator_i2c_info,
1177 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1178 .vcm_pwd = 0,
1179 .vcm_enable = 1,
1180};
1181#endif
1182
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001183#ifdef CONFIG_IMX074
1184static struct msm_camera_sensor_flash_data flash_imx074 = {
1185 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301186#ifdef CONFIG_MSM_CAMERA_FLASH
1187 .flash_src = &msm_flash_src
1188#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001189};
1190
Nishant Pandit24153d82011-08-27 16:05:13 +05301191static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1192 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001193 .sensor_reset = 107,
1194 .sensor_pwd = 85,
1195 .vcm_pwd = 0,
1196 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301197};
1198
1199static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1200 .sensor_name = "imx074",
1201 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001202 .flash_data = &flash_imx074,
1203 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301204 .sensor_platform_info = &sensor_board_info_imx074,
1205 .gpio_conf = &gpio_conf,
1206 .csi_if = 1,
1207 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001208#ifdef CONFIG_IMX074_ACT
1209 .actuator_info = &imx074_actuator_info
1210#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001211};
1212
1213struct platform_device msm8960_camera_sensor_imx074 = {
1214 .name = "msm_camera_imx074",
1215 .dev = {
1216 .platform_data = &msm_camera_sensor_imx074_data,
1217 },
1218};
1219#endif
1220#ifdef CONFIG_OV2720
1221static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001222 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001223};
1224
Nishant Pandit24153d82011-08-27 16:05:13 +05301225static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1226 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001227 .sensor_reset = 76,
1228 .sensor_pwd = 85,
1229 .vcm_pwd = 0,
1230 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301231};
1232
1233static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1234 .sensor_name = "ov2720",
1235 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001236 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301237 .sensor_platform_info = &sensor_board_info_ov2720,
1238 .gpio_conf = &gpio_conf,
1239 .csi_if = 1,
1240 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001241};
1242
1243struct platform_device msm8960_camera_sensor_ov2720 = {
1244 .name = "msm_camera_ov2720",
1245 .dev = {
1246 .platform_data = &msm_camera_sensor_ov2720_data,
1247 },
1248};
1249#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001250
1251static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1252 .flash_type = MSM_CAMERA_FLASH_LED,
1253};
1254
Nishant Pandit24153d82011-08-27 16:05:13 +05301255static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1256 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001257 .sensor_reset = 107,
1258 .sensor_pwd = 85,
1259 .vcm_pwd = 0,
1260 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301261};
1262
1263static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1264 .sensor_name = "qs_mt9p017",
1265 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001266 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301267 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1268 .gpio_conf = &gpio_conf,
1269 .csi_if = 1,
1270 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001271};
1272
1273struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1274 .name = "msm_camera_qs_mt9p017",
1275 .dev = {
1276 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1277 },
1278};
1279
Kevin Chan8b0d2322011-09-10 21:06:31 -07001280static struct msm8960_privacy_light_cfg privacy_light_info = {
1281 .mpp = PM8921_MPP_PM_TO_SYS(12),
1282};
1283
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001284static void __init msm8960_init_cam(void)
1285{
1286 int i;
1287 struct platform_device *cam_dev[] = {
1288 &msm8960_camera_sensor_imx074,
1289 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001290 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001291 };
1292
Kevin Chan8b0d2322011-09-10 21:06:31 -07001293 if (machine_is_msm8960_liquid()) {
1294 struct msm_camera_sensor_info *s_info;
1295 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1296 s_info->sensor_platform_info->mount_angle = 180;
1297 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1298 s_info->sensor_platform_info->privacy_light = 1;
1299 s_info->sensor_platform_info->privacy_light_info =
1300 &privacy_light_info;
1301 }
1302
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1304 struct msm_camera_sensor_info *s_info;
1305 s_info = cam_dev[i]->dev.platform_data;
1306 msm_get_cam_resources(s_info);
1307 platform_device_register(cam_dev[i]);
1308 }
1309}
1310#endif
1311
1312#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001313#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001314#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001315#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001316#endif
1317
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001318
1319#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001320#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001322#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1323#else
1324#define MSM_FB_EXT_BUF_SIZE 0
1325#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326
kuogee hsieh3830eb92011-09-12 15:25:57 -07001327#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1328/* width x height x 3 bpp x 2 frame buffer */
1329#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1330#define MSM_FB_WRITEBACK_OFFSET \
1331 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1332#else
1333#define MSM_FB_WRITEBACK_SIZE 0
1334#define MSM_FB_WRITEBACK_OFFSET 0
1335#endif
1336
1337
1338/* Note: must be multiple of 4096 */
1339#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1340 MSM_FB_WRITEBACK_SIZE, 4096)
1341
1342static int writeback_offset(void)
1343{
1344 return MSM_FB_WRITEBACK_OFFSET;
1345}
1346
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001347
1348#define MDP_VSYNC_GPIO 0
1349
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001350#define PANEL_NAME_MAX_LEN 30
1351#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1352#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1353#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1354#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1355#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1356#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1357#define HDMI_PANEL_NAME "hdmi_msm"
1358#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001359
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360static struct resource msm_fb_resources[] = {
1361 {
1362 .flags = IORESOURCE_DMA,
1363 }
1364};
1365
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001366static int msm_fb_detect_panel(const char *name)
1367{
1368 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001369 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1370 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1371 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001372 return 0;
1373 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001374 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1375 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1376 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001377 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001378
1379#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1380 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1381 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1382 PANEL_NAME_MAX_LEN)))
1383 return 0;
1384
1385 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1386 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1387 PANEL_NAME_MAX_LEN)))
1388 return 0;
1389
1390 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1391 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1392 PANEL_NAME_MAX_LEN)))
1393 return 0;
1394
1395 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1396 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1397 PANEL_NAME_MAX_LEN)))
1398 return 0;
1399#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001400 }
1401
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001402 if (!strncmp(name, HDMI_PANEL_NAME,
1403 strnlen(HDMI_PANEL_NAME,
1404 PANEL_NAME_MAX_LEN)))
1405 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001406
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001407 if (!strncmp(name, TVOUT_PANEL_NAME,
1408 strnlen(TVOUT_PANEL_NAME,
1409 PANEL_NAME_MAX_LEN)))
1410 return 0;
1411
1412 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001413 return -ENODEV;
1414}
1415
1416static struct msm_fb_platform_data msm_fb_pdata = {
1417 .detect_client = msm_fb_detect_panel,
1418};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001419
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001420static struct platform_device msm_fb_device = {
1421 .name = "msm_fb",
1422 .id = 0,
1423 .num_resources = ARRAY_SIZE(msm_fb_resources),
1424 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001425 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001426};
1427
1428static bool dsi_power_on;
1429
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001430/**
1431 * LiQUID panel on/off
1432 *
1433 * @param on
1434 *
1435 * @return int
1436 */
1437static int mipi_dsi_liquid_panel_power(int on)
1438{
1439 static struct regulator *reg_l2, *reg_ext_3p3v;
1440 static int gpio21, gpio24, gpio43;
1441 int rc;
1442
1443 pr_info("%s: on=%d\n", __func__, on);
1444
1445 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1446 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1447 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1448
1449 if (!dsi_power_on) {
1450
1451 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1452 "dsi_vdda");
1453 if (IS_ERR(reg_l2)) {
1454 pr_err("could not get 8921_l2, rc = %ld\n",
1455 PTR_ERR(reg_l2));
1456 return -ENODEV;
1457 }
1458
1459 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1460 if (rc) {
1461 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1462 return -EINVAL;
1463 }
1464
1465 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1466 "vdd_lvds_3p3v");
1467 if (IS_ERR(reg_ext_3p3v)) {
1468 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1469 PTR_ERR(reg_ext_3p3v));
1470 return -ENODEV;
1471 }
1472
1473 rc = gpio_request(gpio21, "disp_pwr_en_n");
1474 if (rc) {
1475 pr_err("request gpio 21 failed, rc=%d\n", rc);
1476 return -ENODEV;
1477 }
1478
1479 rc = gpio_request(gpio43, "disp_rst_n");
1480 if (rc) {
1481 pr_err("request gpio 43 failed, rc=%d\n", rc);
1482 return -ENODEV;
1483 }
1484
1485 rc = gpio_request(gpio24, "disp_backlight_pwm");
1486 if (rc) {
1487 pr_err("request gpio 24 failed, rc=%d\n", rc);
1488 return -ENODEV;
1489 }
1490
1491 dsi_power_on = true;
1492 }
1493
1494 if (on) {
1495 rc = regulator_set_optimum_mode(reg_l2, 100000);
1496 if (rc < 0) {
1497 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1498 return -EINVAL;
1499 }
1500 rc = regulator_enable(reg_l2);
1501 if (rc) {
1502 pr_err("enable l2 failed, rc=%d\n", rc);
1503 return -ENODEV;
1504 }
1505
1506 rc = regulator_enable(reg_ext_3p3v);
1507 if (rc) {
1508 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1509 return -ENODEV;
1510 }
1511
1512 /* set reset pin before power enable */
1513 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1514
1515 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1516 msleep(20);
1517 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1518 msleep(20);
1519 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1520 msleep(20);
1521 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1522 msleep(20);
1523 } else {
1524 gpio_set_value_cansleep(gpio43, 0);
1525 gpio_set_value_cansleep(gpio21, 1);
1526
1527 rc = regulator_disable(reg_l2);
1528 if (rc) {
1529 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1530 return -ENODEV;
1531 }
1532 rc = regulator_disable(reg_ext_3p3v);
1533 if (rc) {
1534 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1535 return -ENODEV;
1536 }
1537 rc = regulator_set_optimum_mode(reg_l2, 100);
1538 if (rc < 0) {
1539 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1540 return -EINVAL;
1541 }
1542 }
1543
1544 return 0;
1545}
1546
1547static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001548{
1549 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001550 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001551 int rc;
1552
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001553 pr_info("%s: state : %d\n", __func__, on);
1554
1555 if (!dsi_power_on) {
1556
1557 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1558 "dsi_vdc");
1559 if (IS_ERR(reg_l8)) {
1560 pr_err("could not get 8921_l8, rc = %ld\n",
1561 PTR_ERR(reg_l8));
1562 return -ENODEV;
1563 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001564 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1565 "dsi_vddio");
1566 if (IS_ERR(reg_l23)) {
1567 pr_err("could not get 8921_l23, rc = %ld\n",
1568 PTR_ERR(reg_l23));
1569 return -ENODEV;
1570 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001571 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1572 "dsi_vdda");
1573 if (IS_ERR(reg_l2)) {
1574 pr_err("could not get 8921_l2, rc = %ld\n",
1575 PTR_ERR(reg_l2));
1576 return -ENODEV;
1577 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001578 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1579 if (rc) {
1580 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1581 return -EINVAL;
1582 }
1583 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1584 if (rc) {
1585 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1586 return -EINVAL;
1587 }
1588 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1589 if (rc) {
1590 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1591 return -EINVAL;
1592 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001593 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1594 rc = gpio_request(gpio43, "disp_rst_n");
1595 if (rc) {
1596 pr_err("request gpio 43 failed, rc=%d\n", rc);
1597 return -ENODEV;
1598 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001599 dsi_power_on = true;
1600 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001601 if (on) {
1602 rc = regulator_set_optimum_mode(reg_l8, 100000);
1603 if (rc < 0) {
1604 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1605 return -EINVAL;
1606 }
1607 rc = regulator_set_optimum_mode(reg_l23, 100000);
1608 if (rc < 0) {
1609 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1610 return -EINVAL;
1611 }
1612 rc = regulator_set_optimum_mode(reg_l2, 100000);
1613 if (rc < 0) {
1614 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1615 return -EINVAL;
1616 }
1617 rc = regulator_enable(reg_l8);
1618 if (rc) {
1619 pr_err("enable l8 failed, rc=%d\n", rc);
1620 return -ENODEV;
1621 }
1622 rc = regulator_enable(reg_l23);
1623 if (rc) {
1624 pr_err("enable l8 failed, rc=%d\n", rc);
1625 return -ENODEV;
1626 }
1627 rc = regulator_enable(reg_l2);
1628 if (rc) {
1629 pr_err("enable l2 failed, rc=%d\n", rc);
1630 return -ENODEV;
1631 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001632 gpio_set_value_cansleep(gpio43, 1);
1633 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001634 rc = regulator_disable(reg_l2);
1635 if (rc) {
1636 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1637 return -ENODEV;
1638 }
1639 rc = regulator_disable(reg_l8);
1640 if (rc) {
1641 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1642 return -ENODEV;
1643 }
1644 rc = regulator_disable(reg_l23);
1645 if (rc) {
1646 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1647 return -ENODEV;
1648 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001649 rc = regulator_set_optimum_mode(reg_l8, 100);
1650 if (rc < 0) {
1651 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1652 return -EINVAL;
1653 }
1654 rc = regulator_set_optimum_mode(reg_l23, 100);
1655 if (rc < 0) {
1656 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1657 return -EINVAL;
1658 }
1659 rc = regulator_set_optimum_mode(reg_l2, 100);
1660 if (rc < 0) {
1661 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1662 return -EINVAL;
1663 }
1664 gpio_set_value_cansleep(gpio43, 0);
1665 }
1666 return 0;
1667}
1668
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001669static int mipi_dsi_panel_power(int on)
1670{
1671 int ret;
1672
1673 pr_info("%s: on=%d\n", __func__, on);
1674
1675 if (machine_is_msm8960_liquid())
1676 ret = mipi_dsi_liquid_panel_power(on);
1677 else
1678 ret = mipi_dsi_cdp_panel_power(on);
1679
1680 return ret;
1681}
1682
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1684 .vsync_gpio = MDP_VSYNC_GPIO,
1685 .dsi_power_save = mipi_dsi_panel_power,
1686};
1687
1688#ifdef CONFIG_MSM_BUS_SCALING
1689
1690static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001691 {
1692 .src = MSM_BUS_MASTER_MDP_PORT0,
1693 .dst = MSM_BUS_SLAVE_EBI_CH0,
1694 .ab = 0,
1695 .ib = 0,
1696 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001697};
1698
1699static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700 {
1701 .src = MSM_BUS_MASTER_MDP_PORT0,
1702 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001703 .ab = 216000000 * 2,
1704 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001705 },
1706};
1707
1708static struct msm_bus_vectors mdp_vga_vectors[] = {
1709 /* VGA and less video */
1710 {
1711 .src = MSM_BUS_MASTER_MDP_PORT0,
1712 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001713 .ab = 216000000 * 2,
1714 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001715 },
1716};
1717
1718static struct msm_bus_vectors mdp_720p_vectors[] = {
1719 /* 720p and less video */
1720 {
1721 .src = MSM_BUS_MASTER_MDP_PORT0,
1722 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001723 .ab = 230400000 * 2,
1724 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001725 },
1726};
1727
1728static struct msm_bus_vectors mdp_1080p_vectors[] = {
1729 /* 1080p and less video */
1730 {
1731 .src = MSM_BUS_MASTER_MDP_PORT0,
1732 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001733 .ab = 334080000 * 2,
1734 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001735 },
1736};
1737
1738static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1739 {
1740 ARRAY_SIZE(mdp_init_vectors),
1741 mdp_init_vectors,
1742 },
1743 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001744 ARRAY_SIZE(mdp_ui_vectors),
1745 mdp_ui_vectors,
1746 },
1747 {
1748 ARRAY_SIZE(mdp_ui_vectors),
1749 mdp_ui_vectors,
1750 },
1751 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001752 ARRAY_SIZE(mdp_vga_vectors),
1753 mdp_vga_vectors,
1754 },
1755 {
1756 ARRAY_SIZE(mdp_720p_vectors),
1757 mdp_720p_vectors,
1758 },
1759 {
1760 ARRAY_SIZE(mdp_1080p_vectors),
1761 mdp_1080p_vectors,
1762 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001763};
1764
1765static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1766 mdp_bus_scale_usecases,
1767 ARRAY_SIZE(mdp_bus_scale_usecases),
1768 .name = "mdp",
1769};
1770
1771#endif
1772
1773int mdp_core_clk_rate_table[] = {
1774 85330000,
1775 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001776 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001777 200000000,
1778};
1779
1780static struct msm_panel_common_pdata mdp_pdata = {
1781 .gpio = MDP_VSYNC_GPIO,
1782 .mdp_core_clk_rate = 85330000,
1783 .mdp_core_clk_table = mdp_core_clk_rate_table,
1784 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1785#ifdef CONFIG_MSM_BUS_SCALING
1786 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1787#endif
1788 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001789 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001790};
1791
1792static struct platform_device mipi_dsi_renesas_panel_device = {
1793 .name = "mipi_renesas",
1794 .id = 0,
1795};
1796
1797static struct platform_device mipi_dsi_simulator_panel_device = {
1798 .name = "mipi_simulator",
1799 .id = 0,
1800};
1801
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001802#define LPM_CHANNEL0 0
1803static int toshiba_gpio[] = {LPM_CHANNEL0};
1804
1805static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1806 .gpio = toshiba_gpio,
1807};
1808
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001809static struct platform_device mipi_dsi_toshiba_panel_device = {
1810 .name = "mipi_toshiba",
1811 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001812 .dev = {
1813 .platform_data = &toshiba_pdata,
1814 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001815};
1816
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001817static int dsi2lvds_gpio[2] = {
1818 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1819 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1820 };
1821
1822static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1823 .gpio_num = dsi2lvds_gpio,
1824};
1825
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001826static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1827
1828/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1829 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1830 /* timing */
1831 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1832 0x0c, 0x03, 0x04, 0xa0},
1833 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1834 {0xff, 0x00, 0x06, 0x00}, /* strength */
1835 /* pll control */
1836 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1837 0x40, 0x07, 0x03,
1838 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1839};
1840
1841static struct mipi_dsi_panel_platform_data novatek_pdata = {
1842 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1843};
1844
1845static struct platform_device mipi_dsi_novatek_panel_device = {
1846 .name = "mipi_novatek",
1847 .id = 0,
1848 .dev = {
1849 .platform_data = &novatek_pdata,
1850 }
1851};
1852
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001853static struct platform_device mipi_dsi2lvds_bridge_device = {
1854 .name = "mipi_tc358764",
1855 .id = 0,
1856 .dev.platform_data = &mipi_dsi2lvds_pdata,
1857};
1858
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001859#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1860static struct resource hdmi_msm_resources[] = {
1861 {
1862 .name = "hdmi_msm_qfprom_addr",
1863 .start = 0x00700000,
1864 .end = 0x007060FF,
1865 .flags = IORESOURCE_MEM,
1866 },
1867 {
1868 .name = "hdmi_msm_hdmi_addr",
1869 .start = 0x04A00000,
1870 .end = 0x04A00FFF,
1871 .flags = IORESOURCE_MEM,
1872 },
1873 {
1874 .name = "hdmi_msm_irq",
1875 .start = HDMI_IRQ,
1876 .end = HDMI_IRQ,
1877 .flags = IORESOURCE_IRQ,
1878 },
1879};
1880
1881static int hdmi_enable_5v(int on);
1882static int hdmi_core_power(int on, int show);
1883static int hdmi_cec_power(int on);
1884
1885static struct msm_hdmi_platform_data hdmi_msm_data = {
1886 .irq = HDMI_IRQ,
1887 .enable_5v = hdmi_enable_5v,
1888 .core_power = hdmi_core_power,
1889 .cec_power = hdmi_cec_power,
1890};
1891
1892static struct platform_device hdmi_msm_device = {
1893 .name = "hdmi_msm",
1894 .id = 0,
1895 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1896 .resource = hdmi_msm_resources,
1897 .dev.platform_data = &hdmi_msm_data,
1898};
1899#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1900
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001901#ifdef CONFIG_MSM_BUS_SCALING
1902static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1903 {
1904 .src = MSM_BUS_MASTER_MDP_PORT0,
1905 .dst = MSM_BUS_SLAVE_EBI_CH0,
1906 .ab = 0,
1907 .ib = 0,
1908 },
1909};
1910static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1911 {
1912 .src = MSM_BUS_MASTER_MDP_PORT0,
1913 .dst = MSM_BUS_SLAVE_EBI_CH0,
1914 .ab = 566092800 * 2,
1915 .ib = 707616000 * 2,
1916 },
1917};
1918static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1919 {
1920 ARRAY_SIZE(dtv_bus_init_vectors),
1921 dtv_bus_init_vectors,
1922 },
1923 {
1924 ARRAY_SIZE(dtv_bus_def_vectors),
1925 dtv_bus_def_vectors,
1926 },
1927};
1928static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1929 dtv_bus_scale_usecases,
1930 ARRAY_SIZE(dtv_bus_scale_usecases),
1931 .name = "dtv",
1932};
1933
1934static struct lcdc_platform_data dtv_pdata = {
1935 .bus_scale_table = &dtv_bus_scale_pdata,
1936};
1937#endif
1938
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001939static void __init msm_fb_add_devices(void)
1940{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001941 struct platform_device *ptr = NULL;
1942
1943 if (machine_is_msm8960_liquid())
1944 ptr = &mipi_dsi2lvds_bridge_device;
1945 else
1946 ptr = &mipi_dsi_toshiba_panel_device;
1947 platform_add_devices(&ptr, 1);
1948
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001949 if (machine_is_msm8x60_rumi3()) {
1950 msm_fb_register_device("mdp", NULL);
1951 mipi_dsi_pdata.target_type = 1;
1952 } else
1953 msm_fb_register_device("mdp", &mdp_pdata);
1954 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001955#ifdef CONFIG_MSM_BUS_SCALING
1956 msm_fb_register_device("dtv", &dtv_pdata);
1957#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001958}
1959
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001960static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1961 .func = GPIOMUX_FUNC_GPIO,
1962 .drv = GPIOMUX_DRV_2MA,
1963 .pull = GPIOMUX_PULL_DOWN,
1964};
1965
1966static struct gpiomux_setting mdp_vsync_active_cfg = {
1967 .func = GPIOMUX_FUNC_1,
1968 .drv = GPIOMUX_DRV_2MA,
1969 .pull = GPIOMUX_PULL_DOWN,
1970};
1971
1972static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1973 {
1974 .gpio = MDP_VSYNC_GPIO,
1975 .settings = {
1976 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1977 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1978 },
1979 }
1980};
1981
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1983static struct gpiomux_setting hdmi_suspend_cfg = {
1984 .func = GPIOMUX_FUNC_GPIO,
1985 .drv = GPIOMUX_DRV_2MA,
1986 .pull = GPIOMUX_PULL_DOWN,
1987};
1988
1989static struct gpiomux_setting hdmi_active_1_cfg = {
1990 .func = GPIOMUX_FUNC_1,
1991 .drv = GPIOMUX_DRV_2MA,
1992 .pull = GPIOMUX_PULL_UP,
1993};
1994
1995static struct gpiomux_setting hdmi_active_2_cfg = {
1996 .func = GPIOMUX_FUNC_1,
1997 .drv = GPIOMUX_DRV_2MA,
1998 .pull = GPIOMUX_PULL_DOWN,
1999};
2000
2001static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2002 {
2003 .gpio = 99,
2004 .settings = {
2005 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2006 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2007 },
2008 },
2009 {
2010 .gpio = 100,
2011 .settings = {
2012 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2013 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2014 },
2015 },
2016 {
2017 .gpio = 101,
2018 .settings = {
2019 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2020 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2021 },
2022 },
2023 {
2024 .gpio = 102,
2025 .settings = {
2026 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2027 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2028 },
2029 },
2030};
2031
2032static int hdmi_enable_5v(int on)
2033{
2034 /* TBD: PM8921 regulator instead of 8901 */
2035 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2036 static int prev_on;
2037 int rc;
2038
2039 if (on == prev_on)
2040 return 0;
2041
2042 if (!reg_8921_hdmi_mvs)
2043 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2044 "hdmi_mvs");
2045
2046 if (on) {
2047 rc = regulator_enable(reg_8921_hdmi_mvs);
2048 if (rc) {
2049 pr_err("'%s' regulator enable failed, rc=%d\n",
2050 "8921_hdmi_mvs", rc);
2051 return rc;
2052 }
2053 pr_debug("%s(on): success\n", __func__);
2054 } else {
2055 rc = regulator_disable(reg_8921_hdmi_mvs);
2056 if (rc)
2057 pr_warning("'%s' regulator disable failed, rc=%d\n",
2058 "8921_hdmi_mvs", rc);
2059 pr_debug("%s(off): success\n", __func__);
2060 }
2061
2062 prev_on = on;
2063
2064 return 0;
2065}
2066
2067static int hdmi_core_power(int on, int show)
2068{
2069 static struct regulator *reg_8921_l23, *reg_8921_s4;
2070 static int prev_on;
2071 int rc;
2072
2073 if (on == prev_on)
2074 return 0;
2075
2076 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002077 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002078 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002079 if (IS_ERR(reg_8921_l23)) {
2080 pr_err("could not get reg_8921_l23, rc = %ld\n",
2081 PTR_ERR(reg_8921_l23));
2082 return -ENODEV;
2083 }
2084 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2085 if (rc) {
2086 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2087 return -EINVAL;
2088 }
2089 }
2090 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002091 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002092 if (IS_ERR(reg_8921_s4)) {
2093 pr_err("could not get reg_8921_s4, rc = %ld\n",
2094 PTR_ERR(reg_8921_s4));
2095 return -ENODEV;
2096 }
2097 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2098 if (rc) {
2099 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2100 return -EINVAL;
2101 }
2102 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002103
2104 if (on) {
2105 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2106 if (rc < 0) {
2107 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2108 return -EINVAL;
2109 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002110 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002111 if (rc) {
2112 pr_err("'%s' regulator enable failed, rc=%d\n",
2113 "hdmi_avdd", rc);
2114 return rc;
2115 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002116 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002117 if (rc) {
2118 pr_err("'%s' regulator enable failed, rc=%d\n",
2119 "hdmi_vcc", rc);
2120 return rc;
2121 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002122 rc = gpio_request(100, "HDMI_DDC_CLK");
2123 if (rc) {
2124 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2125 "HDMI_DDC_CLK", 100, rc);
2126 goto error1;
2127 }
2128 rc = gpio_request(101, "HDMI_DDC_DATA");
2129 if (rc) {
2130 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2131 "HDMI_DDC_DATA", 101, rc);
2132 goto error2;
2133 }
2134 rc = gpio_request(102, "HDMI_HPD");
2135 if (rc) {
2136 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2137 "HDMI_HPD", 102, rc);
2138 goto error3;
2139 }
2140 pr_debug("%s(on): success\n", __func__);
2141 } else {
2142 gpio_free(100);
2143 gpio_free(101);
2144 gpio_free(102);
2145
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002146 rc = regulator_disable(reg_8921_l23);
2147 if (rc) {
2148 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2149 return -ENODEV;
2150 }
2151 rc = regulator_disable(reg_8921_s4);
2152 if (rc) {
2153 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2154 return -ENODEV;
2155 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002156 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2157 if (rc < 0) {
2158 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2159 return -EINVAL;
2160 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002161 pr_debug("%s(off): success\n", __func__);
2162 }
2163
2164 prev_on = on;
2165
2166 return 0;
2167
2168error3:
2169 gpio_free(101);
2170error2:
2171 gpio_free(100);
2172error1:
2173 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002174 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002175 return rc;
2176}
2177
2178static int hdmi_cec_power(int on)
2179{
2180 static int prev_on;
2181 int rc;
2182
2183 if (on == prev_on)
2184 return 0;
2185
2186 if (on) {
2187 rc = gpio_request(99, "HDMI_CEC_VAR");
2188 if (rc) {
2189 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2190 "HDMI_CEC_VAR", 99, rc);
2191 goto error;
2192 }
2193 pr_debug("%s(on): success\n", __func__);
2194 } else {
2195 gpio_free(99);
2196 pr_debug("%s(off): success\n", __func__);
2197 }
2198
2199 prev_on = on;
2200
2201 return 0;
2202error:
2203 return rc;
2204}
2205#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2206
2207static void __init msm8960_allocate_memory_regions(void)
2208{
2209 void *addr;
2210 unsigned long size;
2211
2212 size = MSM_FB_SIZE;
2213 addr = alloc_bootmem_align(size, 0x1000);
2214 msm_fb_resources[0].start = __pa(addr);
2215 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2216 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2217 size, addr, __pa(addr));
2218
2219}
2220#ifdef CONFIG_WCD9310_CODEC
2221
2222#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2223
Patrick Lai3043fba2011-08-01 14:15:57 -07002224/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2225 * 4 micbiases are used to power various analog and digital
2226 * microphones operating at 1800 mV. Technically, all micbiases
2227 * can source from single cfilter since all microphones operate
2228 * at the same voltage level. The arrangement below is to make
2229 * sure all cfilters are exercised. LDO_H regulator ouput level
2230 * does not need to be as high as 2.85V. It is choosen for
2231 * microphone sensitivity purpose.
2232 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002233static struct tabla_pdata tabla_platform_data = {
2234 .slimbus_slave_device = {
2235 .name = "tabla-slave",
2236 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2237 },
2238 .irq = MSM_GPIO_TO_INT(62),
2239 .irq_base = TABLA_INTERRUPT_BASE,
2240 .num_irqs = NR_TABLA_IRQS,
2241 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002242 .micbias = {
2243 .ldoh_v = TABLA_LDOH_2P85_V,
2244 .cfilt1_mv = 1800,
2245 .cfilt2_mv = 1800,
2246 .cfilt3_mv = 1800,
2247 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2248 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2249 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2250 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2251 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002252};
2253
2254static struct slim_device msm_slim_tabla = {
2255 .name = "tabla-slim",
2256 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2257 .dev = {
2258 .platform_data = &tabla_platform_data,
2259 },
2260};
2261#endif
2262
2263static struct slim_boardinfo msm_slim_devices[] = {
2264#ifdef CONFIG_WCD9310_CODEC
2265 {
2266 .bus_num = 1,
2267 .slim_slave = &msm_slim_tabla,
2268 },
2269#endif
2270 /* add more slimbus slaves as needed */
2271};
2272
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002273#define MSM_WCNSS_PHYS 0x03000000
2274#define MSM_WCNSS_SIZE 0x280000
2275
2276static struct resource resources_wcnss_wlan[] = {
2277 {
2278 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2279 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2280 .name = "wcnss_wlanrx_irq",
2281 .flags = IORESOURCE_IRQ,
2282 },
2283 {
2284 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2285 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2286 .name = "wcnss_wlantx_irq",
2287 .flags = IORESOURCE_IRQ,
2288 },
2289 {
2290 .start = MSM_WCNSS_PHYS,
2291 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2292 .name = "wcnss_mmio",
2293 .flags = IORESOURCE_MEM,
2294 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002295 {
2296 .start = 84,
2297 .end = 88,
2298 .name = "wcnss_gpios_5wire",
2299 .flags = IORESOURCE_IO,
2300 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002301};
2302
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002303static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2304 .has_48mhz_xo = 1,
2305};
2306
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002307static struct platform_device msm_device_wcnss_wlan = {
2308 .name = "wcnss_wlan",
2309 .id = 0,
2310 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2311 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002312 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002313};
2314
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002315#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2316 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2317 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2318 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2319
2320#define QCE_SIZE 0x10000
2321#define QCE_0_BASE 0x18500000
2322
2323#define QCE_HW_KEY_SUPPORT 0
2324#define QCE_SHA_HMAC_SUPPORT 1
2325#define QCE_SHARE_CE_RESOURCE 1
2326#define QCE_CE_SHARED 0
2327
2328static struct resource qcrypto_resources[] = {
2329 [0] = {
2330 .start = QCE_0_BASE,
2331 .end = QCE_0_BASE + QCE_SIZE - 1,
2332 .flags = IORESOURCE_MEM,
2333 },
2334 [1] = {
2335 .name = "crypto_channels",
2336 .start = DMOV_CE_IN_CHAN,
2337 .end = DMOV_CE_OUT_CHAN,
2338 .flags = IORESOURCE_DMA,
2339 },
2340 [2] = {
2341 .name = "crypto_crci_in",
2342 .start = DMOV_CE_IN_CRCI,
2343 .end = DMOV_CE_IN_CRCI,
2344 .flags = IORESOURCE_DMA,
2345 },
2346 [3] = {
2347 .name = "crypto_crci_out",
2348 .start = DMOV_CE_OUT_CRCI,
2349 .end = DMOV_CE_OUT_CRCI,
2350 .flags = IORESOURCE_DMA,
2351 },
2352};
2353
2354static struct resource qcedev_resources[] = {
2355 [0] = {
2356 .start = QCE_0_BASE,
2357 .end = QCE_0_BASE + QCE_SIZE - 1,
2358 .flags = IORESOURCE_MEM,
2359 },
2360 [1] = {
2361 .name = "crypto_channels",
2362 .start = DMOV_CE_IN_CHAN,
2363 .end = DMOV_CE_OUT_CHAN,
2364 .flags = IORESOURCE_DMA,
2365 },
2366 [2] = {
2367 .name = "crypto_crci_in",
2368 .start = DMOV_CE_IN_CRCI,
2369 .end = DMOV_CE_IN_CRCI,
2370 .flags = IORESOURCE_DMA,
2371 },
2372 [3] = {
2373 .name = "crypto_crci_out",
2374 .start = DMOV_CE_OUT_CRCI,
2375 .end = DMOV_CE_OUT_CRCI,
2376 .flags = IORESOURCE_DMA,
2377 },
2378};
2379
2380#endif
2381
2382#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2383 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2384
2385static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2386 .ce_shared = QCE_CE_SHARED,
2387 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2388 .hw_key_support = QCE_HW_KEY_SUPPORT,
2389 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2390};
2391
2392static struct platform_device qcrypto_device = {
2393 .name = "qcrypto",
2394 .id = 0,
2395 .num_resources = ARRAY_SIZE(qcrypto_resources),
2396 .resource = qcrypto_resources,
2397 .dev = {
2398 .coherent_dma_mask = DMA_BIT_MASK(32),
2399 .platform_data = &qcrypto_ce_hw_suppport,
2400 },
2401};
2402#endif
2403
2404#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2405 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2406
2407static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2408 .ce_shared = QCE_CE_SHARED,
2409 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2410 .hw_key_support = QCE_HW_KEY_SUPPORT,
2411 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2412};
2413
2414static struct platform_device qcedev_device = {
2415 .name = "qce",
2416 .id = 0,
2417 .num_resources = ARRAY_SIZE(qcedev_resources),
2418 .resource = qcedev_resources,
2419 .dev = {
2420 .coherent_dma_mask = DMA_BIT_MASK(32),
2421 .platform_data = &qcedev_ce_hw_suppport,
2422 },
2423};
2424#endif
2425
2426
2427static int __init gpiomux_init(void)
2428{
2429 int rc;
2430
2431 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2432 if (rc) {
2433 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2434 return rc;
2435 }
2436
Nishant Pandit24153d82011-08-27 16:05:13 +05302437 msm_gpiomux_install(msm8960_cam_common_configs,
2438 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002439
2440 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002441 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002442
2443 msm_gpiomux_install(msm8960_gsbi_configs,
2444 ARRAY_SIZE(msm8960_gsbi_configs));
2445
2446 msm_gpiomux_install(msm8960_cyts_configs,
2447 ARRAY_SIZE(msm8960_cyts_configs));
2448
2449 msm_gpiomux_install(msm8960_slimbus_config,
2450 ARRAY_SIZE(msm8960_slimbus_config));
2451
2452 msm_gpiomux_install(msm8960_audio_codec_configs,
2453 ARRAY_SIZE(msm8960_audio_codec_configs));
2454
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002455 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2456 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2457
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002458#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2459 msm_gpiomux_install(msm8960_hdmi_configs,
2460 ARRAY_SIZE(msm8960_hdmi_configs));
2461#endif
2462
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002463 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2464 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2465
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002466 msm_gpiomux_install(wcnss_5wire_interface,
2467 ARRAY_SIZE(wcnss_5wire_interface));
2468
2469 return 0;
2470}
2471
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002472#define MSM_SHARED_RAM_PHYS 0x80000000
2473
2474static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2475 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2476 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2477 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2478 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2479 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2480 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2481 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2482 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2483 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2484 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2485 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2486 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002487 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2488 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2489 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2490 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2491 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2492 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2493 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2494 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2495 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2496 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2497 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2498 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2499 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2500 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002501 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002502 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2503 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2504 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002505 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2506 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002507};
2508
2509static struct pm8921_adc_properties pm8921_adc_data = {
2510 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2511 .bitresolution = 15,
2512 .bipolar = 0,
2513};
2514
2515static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2516 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002517 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002518 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002519 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002520};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002521
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002522static void __init msm8960_map_io(void)
2523{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002524 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002525 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002526
2527 if (socinfo_init() < 0)
2528 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002529}
2530
2531static void __init msm8960_init_irq(void)
2532{
2533 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002534
2535 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002536 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002537 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002538
2539 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002540 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002541
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002542 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2543 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002544
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002545 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2546 * as they are configured as level, which does not play nice with
2547 * handle_percpu_irq.
2548 */
2549 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2550 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002551 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002552 }
2553}
2554
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002555/* MSM8960 have 5 SDCC controllers */
2556enum sdcc_controllers {
2557 SDCC1,
2558 SDCC2,
2559 SDCC3,
2560 SDCC4,
2561 SDCC5,
2562 MAX_SDCC_CONTROLLER
2563};
2564
2565/* All SDCC controllers requires VDD/VCC voltage */
2566static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2567 /* SDCC1 : eMMC card connected */
2568 [SDCC1] = {
2569 .name = "sdc_vdd",
2570 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302571 .high_vol_level = 2950000,
2572 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302573 .always_on = 1,
2574 .lpm_sup = 1,
2575 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002576 .hpm_uA = 200000, /* 200mA */
2577 },
2578 /* SDCC3 : External card slot connected */
2579 [SDCC3] = {
2580 .name = "sdc_vdd",
2581 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302582 .high_vol_level = 2950000,
2583 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002584 .hpm_uA = 600000, /* 600mA */
2585 }
2586};
2587
2588/* Only slots having eMMC card will require VCCQ voltage */
2589static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2590 /* SDCC1 : eMMC card connected */
2591 [SDCC1] = {
2592 .name = "sdc_vccq",
2593 .set_voltage_sup = 1,
2594 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302595 .high_vol_level = 1800000,
2596 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002597 .hpm_uA = 200000, /* 200mA */
2598 }
2599};
2600
2601/* All SDCC controllers may require voting for VDD PAD voltage */
2602static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2603 /* SDCC3 : External card slot connected */
2604 [SDCC3] = {
2605 .name = "sdc_vddp",
2606 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302607 .high_vol_level = 2950000,
2608 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002609 .always_on = 1,
2610 .lpm_sup = 1,
2611 /* Max. Active current required is 16 mA */
2612 .hpm_uA = 16000,
2613 /*
2614 * Sleep current required is ~300 uA. But min. vote can be
2615 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2616 * during sleep.
2617 */
2618 .lpm_uA = 2000,
2619 }
2620};
2621
2622static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2623 /* SDCC1 : eMMC card connected */
2624 [SDCC1] = {
2625 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2626 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2627 },
2628 /* SDCC3 : External card slot connected */
2629 [SDCC3] = {
2630 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2631 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2632 }
2633};
2634
2635/* SDC1 pad data */
2636static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2637 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302638 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2639 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002640};
2641
2642static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2643 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2644 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2645 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2646};
2647
2648static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302649 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002650 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2651 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2652};
2653
2654static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302655 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002656 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2657 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2658};
2659
2660/* SDC3 pad data */
2661static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2662 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2663 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2664 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2665};
2666
2667static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2668 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2669 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2670 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2671};
2672
2673static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302674 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002675 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2676 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2677};
2678
2679static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302680 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302681 /*
2682 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2683 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2684 * which would result in false card detection interrupts.
2685 */
2686 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2687 /*
2688 * Keeping DATA lines status to PULL UP will make sure that
2689 * there is no current leak during sleep if external pull up
2690 * is connected to DATA lines.
2691 */
2692 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002693};
2694
2695struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2696 [SDCC1] = {
2697 .on = sdc1_pad_pull_on_cfg,
2698 .off = sdc1_pad_pull_off_cfg,
2699 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2700 },
2701 [SDCC3] = {
2702 .on = sdc3_pad_pull_on_cfg,
2703 .off = sdc3_pad_pull_off_cfg,
2704 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2705 },
2706};
2707
2708struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2709 [SDCC1] = {
2710 .on = sdc1_pad_drv_on_cfg,
2711 .off = sdc1_pad_drv_off_cfg,
2712 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2713 },
2714 [SDCC3] = {
2715 .on = sdc3_pad_drv_on_cfg,
2716 .off = sdc3_pad_drv_off_cfg,
2717 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2718 },
2719};
2720
2721struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2722 [SDCC1] = {
2723 .pull = &mmc_pad_pull_data[SDCC1],
2724 .drv = &mmc_pad_drv_data[SDCC1]
2725 },
2726 [SDCC3] = {
2727 .pull = &mmc_pad_pull_data[SDCC3],
2728 .drv = &mmc_pad_drv_data[SDCC3]
2729 },
2730};
2731
2732struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2733 [SDCC1] = {
2734 .pad_data = &mmc_pad_data[SDCC1],
2735 },
2736 [SDCC3] = {
2737 .pad_data = &mmc_pad_data[SDCC3],
2738 },
2739};
2740
2741static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302742 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002743};
2744
2745static unsigned int sdc3_sup_clk_rates[] = {
2746 400000, 24000000, 48000000, 96000000
2747};
2748
2749#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2750static struct mmc_platform_data msm8960_sdc1_data = {
2751 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2752#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2753 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2754#else
2755 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2756#endif
2757 .sup_clk_table = sdc1_sup_clk_rates,
2758 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302759 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002760 .nonremovable = 1,
2761 .sdcc_v4_sup = true,
2762 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302763 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002764};
2765#endif
2766
2767#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2768static struct mmc_platform_data msm8960_sdc3_data = {
2769 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2770 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2771 .sup_clk_table = sdc3_sup_clk_rates,
2772 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302773 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302774#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002775 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302776#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002777 .sdcc_v4_sup = true,
2778 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2779 .pin_data = &mmc_slot_pin_data[SDCC3],
2780#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2781 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2782 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2783 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2784#endif
2785 .xpc_cap = 1,
2786 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2787 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302788 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002789};
2790#endif
2791
2792static void __init msm8960_init_mmc(void)
2793{
2794#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2795 /* SDC1 : eMMC card connected */
2796 msm_add_sdcc(1, &msm8960_sdc1_data);
2797#endif
2798#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2799 /* SDC3: External card slot */
2800 msm_add_sdcc(3, &msm8960_sdc3_data);
2801#endif
2802}
2803
2804static void __init msm8960_init_buses(void)
2805{
2806#ifdef CONFIG_MSM_BUS_SCALING
2807 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2808 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2809 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2810 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2811 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2812 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2813 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2814 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2815 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2816 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
Gagan Macdc1dc142011-09-16 15:13:35 -06002817 msm_bus_rpm_set_mt_mask();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002818#endif
2819}
2820
2821static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2822 .max_clock_speed = 15060000,
2823};
2824
2825#ifdef CONFIG_USB_MSM_OTG_72K
2826static struct msm_otg_platform_data msm_otg_pdata;
2827#else
2828#define USB_5V_EN 42
2829static void msm_hsusb_vbus_power(bool on)
2830{
2831 int rc;
2832 static bool vbus_is_on;
2833 static struct regulator *mvs_otg_switch;
2834 struct pm_gpio param = {
2835 .direction = PM_GPIO_DIR_OUT,
2836 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2837 .output_value = 1,
2838 .pull = PM_GPIO_PULL_NO,
2839 .vin_sel = PM_GPIO_VIN_S4,
2840 .out_strength = PM_GPIO_STRENGTH_MED,
2841 .function = PM_GPIO_FUNC_NORMAL,
2842 };
2843
2844 if (vbus_is_on == on)
2845 return;
2846
2847 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002848 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2849 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002850 if (IS_ERR(mvs_otg_switch)) {
2851 pr_err("Unable to get mvs_otg_switch\n");
2852 return;
2853 }
2854
2855 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2856 "usb_5v_en");
2857 if (rc < 0) {
2858 pr_err("failed to request usb_5v_en gpio\n");
2859 goto put_mvs_otg;
2860 }
2861
2862 if (regulator_enable(mvs_otg_switch)) {
2863 pr_err("unable to enable mvs_otg_switch\n");
2864 goto free_usb_5v_en;
2865 }
2866
2867 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2868 &param);
2869 if (rc < 0) {
2870 pr_err("failed to configure usb_5v_en gpio\n");
2871 goto disable_mvs_otg;
2872 }
2873 vbus_is_on = true;
2874 return;
2875 }
2876disable_mvs_otg:
2877 regulator_disable(mvs_otg_switch);
2878free_usb_5v_en:
2879 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2880put_mvs_otg:
2881 regulator_put(mvs_otg_switch);
2882 vbus_is_on = false;
2883}
2884
2885static struct msm_otg_platform_data msm_otg_pdata = {
2886 .mode = USB_OTG,
2887 .otg_control = OTG_PMIC_CONTROL,
2888 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2889 .pclk_src_name = "dfab_usb_hs_clk",
2890 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2891 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302892 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002893};
2894#endif
2895
2896#define PID_MAGIC_ID 0x71432909
2897#define SERIAL_NUM_MAGIC_ID 0x61945374
2898#define SERIAL_NUMBER_LENGTH 127
2899#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2900
2901struct magic_num_struct {
2902 uint32_t pid;
2903 uint32_t serial_num;
2904};
2905
2906struct dload_struct {
2907 uint32_t reserved1;
2908 uint32_t reserved2;
2909 uint32_t reserved3;
2910 uint16_t reserved4;
2911 uint16_t pid;
2912 char serial_number[SERIAL_NUMBER_LENGTH];
2913 uint16_t reserved5;
2914 struct magic_num_struct magic_struct;
2915};
2916
2917static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2918{
2919 struct dload_struct __iomem *dload = 0;
2920
2921 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2922 if (!dload) {
2923 pr_err("%s: cannot remap I/O memory region: %08x\n",
2924 __func__, DLOAD_USB_BASE_ADD);
2925 return -ENXIO;
2926 }
2927
2928 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2929 __func__, dload, pid, snum);
2930 /* update pid */
2931 dload->magic_struct.pid = PID_MAGIC_ID;
2932 dload->pid = pid;
2933
2934 /* update serial number */
2935 dload->magic_struct.serial_num = 0;
2936 if (!snum) {
2937 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2938 goto out;
2939 }
2940
2941 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2942 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2943 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2944out:
2945 iounmap(dload);
2946 return 0;
2947}
2948
2949static struct android_usb_platform_data android_usb_pdata = {
2950 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2951};
2952
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002953static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002954 .name = "android_usb",
2955 .id = -1,
2956 .dev = {
2957 .platform_data = &android_usb_pdata,
2958 },
2959};
2960
2961static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2962 0x03, 0x0f,
2963};
2964
2965static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2966 0x00, 0x24, 0x54, 0x10,
2967 0x09, 0x03, 0x01,
2968 0x10, 0x54, 0x30, 0x0C,
2969 0x24, 0x30, 0x0f,
2970};
2971
2972static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2973 0x00, 0x24, 0x54, 0x10,
2974 0x09, 0x07, 0x01, 0x0B,
2975 0x10, 0x54, 0x30, 0x0C,
2976 0x24, 0x30, 0x0f,
2977};
2978
2979static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2980 [0] = {
2981 .mode = MSM_SPM_MODE_CLOCK_GATING,
2982 .notify_rpm = false,
2983 .cmd = spm_wfi_cmd_sequence,
2984 },
2985 [1] = {
2986 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2987 .notify_rpm = false,
2988 .cmd = spm_power_collapse_without_rpm,
2989 },
2990 [2] = {
2991 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2992 .notify_rpm = true,
2993 .cmd = spm_power_collapse_with_rpm,
2994 },
2995};
2996
2997static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2998 [0] = {
2999 .reg_base_addr = MSM_SAW0_BASE,
3000 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3001 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3002 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3003#if defined(CONFIG_MSM_AVS_HW)
3004 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3005 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3006#endif
3007 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3008 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3009 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3010 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3011 .vctl_timeout_us = 50,
3012 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3013 .modes = msm_spm_seq_list,
3014 },
3015 [1] = {
3016 .reg_base_addr = MSM_SAW1_BASE,
3017 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3018 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3019 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3020#if defined(CONFIG_MSM_AVS_HW)
3021 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3022 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3023#endif
3024 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3025 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3026 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3027 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3028 .vctl_timeout_us = 50,
3029 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3030 .modes = msm_spm_seq_list,
3031 },
3032};
3033
3034static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3035 0x00, 0x20, 0x03, 0x20,
3036 0x00, 0x0f,
3037};
3038
3039static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3040 0x00, 0x20, 0x34, 0x64,
3041 0x48, 0x07, 0x48, 0x20,
3042 0x50, 0x64, 0x04, 0x34,
3043 0x50, 0x0f,
3044};
3045static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3046 0x00, 0x10, 0x34, 0x64,
3047 0x48, 0x07, 0x48, 0x10,
3048 0x50, 0x64, 0x04, 0x34,
3049 0x50, 0x0F,
3050};
3051
3052static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3053 [0] = {
3054 .mode = MSM_SPM_L2_MODE_RETENTION,
3055 .notify_rpm = false,
3056 .cmd = l2_spm_wfi_cmd_sequence,
3057 },
3058 [1] = {
3059 .mode = MSM_SPM_L2_MODE_GDHS,
3060 .notify_rpm = true,
3061 .cmd = l2_spm_gdhs_cmd_sequence,
3062 },
3063 [2] = {
3064 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3065 .notify_rpm = true,
3066 .cmd = l2_spm_power_off_cmd_sequence,
3067 },
3068};
3069
3070
3071static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3072 [0] = {
3073 .reg_base_addr = MSM_SAW_L2_BASE,
3074 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3075 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3076 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3077 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3078 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3079 .modes = msm_spm_l2_seq_list,
3080 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3081 },
3082};
3083
3084#define CYTTSP_TS_GPIO_IRQ 11
3085#define CYTTSP_TS_SLEEP_GPIO 50
3086#define CYTTSP_TS_RESOUT_N_GPIO 52
3087
3088/*virtual key support */
3089static ssize_t tma340_vkeys_show(struct kobject *kobj,
3090 struct kobj_attribute *attr, char *buf)
3091{
3092 return snprintf(buf, 200,
3093 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3094 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3095 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3096 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3097 "\n");
3098}
3099
3100static struct kobj_attribute tma340_vkeys_attr = {
3101 .attr = {
3102 .mode = S_IRUGO,
3103 },
3104 .show = &tma340_vkeys_show,
3105};
3106
3107static struct attribute *tma340_properties_attrs[] = {
3108 &tma340_vkeys_attr.attr,
3109 NULL
3110};
3111
3112static struct attribute_group tma340_properties_attr_group = {
3113 .attrs = tma340_properties_attrs,
3114};
3115
3116
3117static int cyttsp_platform_init(struct i2c_client *client)
3118{
3119 int rc = 0;
3120 static struct kobject *tma340_properties_kobj;
3121
3122 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3123 tma340_properties_kobj = kobject_create_and_add("board_properties",
3124 NULL);
3125 if (tma340_properties_kobj)
3126 rc = sysfs_create_group(tma340_properties_kobj,
3127 &tma340_properties_attr_group);
3128 if (!tma340_properties_kobj || rc)
3129 pr_err("%s: failed to create board_properties\n",
3130 __func__);
3131
3132 return 0;
3133}
3134
3135static struct cyttsp_regulator regulator_data[] = {
3136 {
3137 .name = "vdd",
3138 .min_uV = CY_TMA300_VTG_MIN_UV,
3139 .max_uV = CY_TMA300_VTG_MAX_UV,
3140 .load_uA = CY_TMA300_CURR_24HZ_UA,
3141 },
3142 /* TODO: Remove after runtime PM is enabled in I2C driver */
3143 {
3144 .name = "vcc_i2c",
3145 .min_uV = CY_I2C_VTG_MIN_UV,
3146 .max_uV = CY_I2C_VTG_MAX_UV,
3147 .load_uA = CY_I2C_CURR_UA,
3148 },
3149};
3150
3151static struct cyttsp_platform_data cyttsp_pdata = {
3152 .panel_maxx = 634,
3153 .panel_maxy = 1166,
3154 .disp_maxx = 616,
3155 .disp_maxy = 1023,
3156 .disp_minx = 0,
3157 .disp_miny = 16,
3158 .flags = 0x01,
3159 .gen = CY_GEN3, /* or */
3160 .use_st = CY_USE_ST,
3161 .use_mt = CY_USE_MT,
3162 .use_hndshk = CY_SEND_HNDSHK,
3163 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303164 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003165 .use_gestures = CY_USE_GESTURES,
3166 .fw_fname = "cyttsp_8960_cdp.hex",
3167 /* activate up to 4 groups
3168 * and set active distance
3169 */
3170 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3171 CY_GEST_GRP3 | CY_GEST_GRP4 |
3172 CY_ACT_DIST,
3173 /* change act_intrvl to customize the Active power state
3174 * scanning/processing refresh interval for Operating mode
3175 */
3176 .act_intrvl = CY_ACT_INTRVL_DFLT,
3177 /* change tch_tmout to customize the touch timeout for the
3178 * Active power state for Operating mode
3179 */
3180 .tch_tmout = CY_TCH_TMOUT_DFLT,
3181 /* change lp_intrvl to customize the Low Power power state
3182 * scanning/processing refresh interval for Operating mode
3183 */
3184 .lp_intrvl = CY_LP_INTRVL_DFLT,
3185 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3186 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3187 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3188 .regulator_info = regulator_data,
3189 .num_regulators = ARRAY_SIZE(regulator_data),
3190 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303191 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003192};
3193
3194static struct i2c_board_info cyttsp_info[] __initdata = {
3195 {
3196 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3197 .platform_data = &cyttsp_pdata,
3198#ifndef CY_USE_TIMER
3199 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3200#endif /* CY_USE_TIMER */
3201 },
3202};
3203
Mohan Pallaka50837382011-09-07 11:00:57 +05303204/* configuration data */
3205static const u8 mxt_config_data[] = {
3206 /* T6 Object */
3207 0, 0, 0, 0, 0, 0,
3208 /* T38 Object */
3209 11, 0, 0, 6, 9, 11, 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, 0, 0, 0, 0, 0, 0,
3213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3215 0, 0, 0, 0,
3216 /* T7 Object */
3217 10, 10, 50,
3218 /* T8 Object */
3219 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3220 /* T9 Object */
3221 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3222 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3223 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3224 0, 5, 45, 46,
3225 /* T15 Object */
3226 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3227 0,
3228 /* T22 Object */
3229 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3230 0, 0, 255, 255, 255, 255, 0,
3231 /* T24 Object */
3232 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3233 0, 0, 0, 0, 0, 0, 0, 0, 0,
3234 /* T25 Object */
3235 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3236 0, 0, 0, 0,
3237 /* T27 Object */
3238 0, 0, 0, 0, 0, 0, 0,
3239 /* T28 Object */
3240 0, 0, 0, 8, 8, 8,
3241 /* T40 Object */
3242 0, 0, 0, 0, 0,
3243 /* T41 Object */
3244 0, 0, 0, 0, 0, 0,
3245 /* T43 Object */
3246 0, 0, 0, 0, 0, 0,
3247};
3248
3249#define MXT_TS_GPIO_IRQ 11
3250#define MXT_TS_LDO_EN_GPIO 50
3251#define MXT_TS_RESET_GPIO 52
3252
3253static void mxt_init_hw_liquid(void)
3254{
3255 int rc;
3256
3257 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3258 if (rc) {
3259 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3260 __func__, MXT_TS_GPIO_IRQ);
3261 return;
3262 }
3263
3264 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3265 if (rc) {
3266 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3267 __func__, MXT_TS_GPIO_IRQ);
3268 goto err_irq_gpio_req;
3269 }
3270
3271 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3272 if (rc) {
3273 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3274 __func__, MXT_TS_LDO_EN_GPIO);
3275 goto err_irq_gpio_req;
3276 }
3277
3278 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3279 if (rc) {
3280 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3281 __func__, MXT_TS_LDO_EN_GPIO);
3282 goto err_ldo_gpio_req;
3283 }
3284
3285 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3286 if (rc) {
3287 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3288 __func__, MXT_TS_RESET_GPIO);
3289 goto err_ldo_gpio_set_dir;
3290 }
3291
3292 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3293 if (rc) {
3294 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3295 __func__, MXT_TS_RESET_GPIO);
3296 goto err_reset_gpio_req;
3297 }
3298
3299 return;
3300
3301err_reset_gpio_req:
3302 gpio_free(MXT_TS_RESET_GPIO);
3303err_ldo_gpio_set_dir:
3304 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3305err_ldo_gpio_req:
3306 gpio_free(MXT_TS_LDO_EN_GPIO);
3307err_irq_gpio_req:
3308 gpio_free(MXT_TS_GPIO_IRQ);
3309}
3310
3311static struct mxt_platform_data mxt_platform_data = {
3312 .config = mxt_config_data,
3313 .config_length = ARRAY_SIZE(mxt_config_data),
3314 .x_line = 26,
3315 .y_line = 42,
3316 .x_size = 767,
3317 .y_size = 1365,
3318 .blen = 32,
3319 .threshold = 40,
3320 .voltage = 3300000, /* 3.3V */
3321 .orient = MXT_ROTATED_90,
3322 .irqflags = IRQF_TRIGGER_FALLING,
3323};
3324
3325static struct i2c_board_info mxt_device_info[] __initdata = {
3326 {
3327 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3328 .platform_data = &mxt_platform_data,
3329 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3330 },
3331};
3332
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003333static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3334{
3335}
3336
3337static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3338 .clk_freq = 100000,
3339 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003340 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3341};
3342
3343static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3344 .clk_freq = 100000,
3345 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003346 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3347};
3348
3349static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3350 .clk_freq = 100000,
3351 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003352 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3353};
3354
3355static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3356 .clk_freq = 100000,
3357 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003358 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3359};
3360
3361static struct msm_rpm_platform_data msm_rpm_data = {
3362 .reg_base_addrs = {
3363 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3364 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3365 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3366 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3367 },
3368
3369 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3370 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3371 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3372 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3373 .msm_apps_ipc_rpm_val = 4,
3374};
3375
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003376static struct ks8851_pdata spi_eth_pdata = {
3377 .irq_gpio = KS8851_IRQ_GPIO,
3378 .rst_gpio = KS8851_RST_GPIO,
3379};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003380
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003381static struct spi_board_info spi_board_info[] __initdata = {
3382 {
3383 .modalias = "ks8851",
3384 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3385 .max_speed_hz = 19200000,
3386 .bus_num = 0,
3387 .chip_select = 0,
3388 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003389 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003390 },
3391};
3392
3393static struct platform_device msm_device_saw_core0 = {
3394 .name = "saw-regulator",
3395 .id = 0,
3396 .dev = {
3397 .platform_data = &msm_saw_regulator_pdata_s5,
3398 },
3399};
3400
3401static struct platform_device msm_device_saw_core1 = {
3402 .name = "saw-regulator",
3403 .id = 1,
3404 .dev = {
3405 .platform_data = &msm_saw_regulator_pdata_s6,
3406 },
3407};
3408
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003409static struct tsens_platform_data msm_tsens_pdata = {
3410 .slope = 910,
3411 .tsens_factor = 1000,
3412 .hw_type = MSM_8960,
3413 .tsens_num_sensor = 5,
3414};
3415
3416static struct platform_device msm_tsens_device = {
3417 .name = "tsens8960-tm",
3418 .id = -1,
3419 .dev = {
3420 .platform_data = &msm_tsens_pdata,
3421 },
3422};
3423
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003424#ifdef CONFIG_MSM_FAKE_BATTERY
3425static struct platform_device fish_battery_device = {
3426 .name = "fish_battery",
3427};
3428#endif
3429
David Collins26f05562011-06-20 09:56:28 -07003430static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003431 .name = GPIO_REGULATOR_DEV_NAME,
3432 .id = PM8921_MPP_PM_TO_SYS(7),
3433 .dev = {
3434 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3435 },
3436};
3437
David Collins26f05562011-06-20 09:56:28 -07003438static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003439 .name = GPIO_REGULATOR_DEV_NAME,
3440 .id = 91,
3441 .dev = {
3442 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3443 },
3444};
3445
David Collinsb10be1d2011-09-02 10:29:31 -07003446static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3447 .name = GPIO_REGULATOR_DEV_NAME,
3448 .id = PM8921_GPIO_PM_TO_SYS(17),
3449 .dev = {
3450 .platform_data =
3451 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3452 },
3453};
3454
David Collins26f05562011-06-20 09:56:28 -07003455static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3456 .name = "rpm-regulator",
3457 .id = -1,
3458 .dev = {
3459 .platform_data = &msm_rpm_regulator_pdata,
3460 },
3461};
3462
David Collins4c31a872011-08-31 10:07:10 -07003463static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3464 .phys_addr_base = 0x0010C000,
3465 .reg_offsets = {
3466 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3467 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3468 },
3469 .phys_size = SZ_8K,
3470 .log_len = 4096, /* log's buffer length in bytes */
3471 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3472};
3473
3474static struct platform_device msm_rpm_log_device = {
3475 .name = "msm_rpm_log",
3476 .id = -1,
3477 .dev = {
3478 .platform_data = &msm_rpm_log_pdata,
3479 },
3480};
3481
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003482static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003483 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003484 &msm_device_smd,
3485 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303486 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003487 &msm_device_saw_core0,
3488 &msm_device_saw_core1,
3489 &msm8960_device_ext_5v_vreg,
3490 &msm8960_device_ext_l2_vreg,
3491 &msm8960_device_ssbi_pm8921,
3492 &msm8960_device_qup_spi_gsbi1,
3493 &msm8960_device_qup_i2c_gsbi3,
3494 &msm8960_device_qup_i2c_gsbi4,
3495 &msm8960_device_qup_i2c_gsbi10,
3496#ifndef CONFIG_MSM_DSPS
3497 &msm8960_device_qup_i2c_gsbi12,
3498#endif
3499 &msm_slim_ctrl,
3500 &msm_device_wcnss_wlan,
3501#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3502 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3503 &qcrypto_device,
3504#endif
3505
3506#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3507 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3508 &qcedev_device,
3509#endif
3510#ifdef CONFIG_MSM_ROTATOR
3511 &msm_rotator_device,
3512#endif
3513 &msm_device_sps,
3514#ifdef CONFIG_MSM_FAKE_BATTERY
3515 &fish_battery_device,
3516#endif
3517#ifdef CONFIG_ANDROID_PMEM
3518 &android_pmem_device,
3519 &android_pmem_adsp_device,
3520 &android_pmem_audio_device,
3521#endif
3522 &msm_fb_device,
3523 &msm_device_vidc,
3524 &msm_device_bam_dmux,
3525 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003526
3527#ifdef CONFIG_HW_RANDOM_MSM
3528 &msm_device_rng,
3529#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003530 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003531#ifdef CONFIG_ION_MSM
3532 &ion_dev,
3533#endif
David Collins4c31a872011-08-31 10:07:10 -07003534 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003535#ifdef CONFIG_MSM_QDSS
3536 &msm_etb_device,
3537 &msm_tpiu_device,
3538 &msm_funnel_device,
3539 &msm_ptm_device,
3540#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003541 &msm_device_dspcrashd_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003542};
3543
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003544static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003545 &msm8960_device_otg,
3546 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003547 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303548 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003549 &android_usb_device,
3550 &msm_device_vidc,
3551 &mipi_dsi_simulator_panel_device,
3552 &msm_bus_apps_fabric,
3553 &msm_bus_sys_fabric,
3554 &msm_bus_mm_fabric,
3555 &msm_bus_sys_fpb,
3556 &msm_bus_cpss_fpb,
3557 &msm_pcm,
3558 &msm_pcm_routing,
3559 &msm_cpudai0,
3560 &msm_cpudai1,
3561 &msm_cpudai_hdmi_rx,
3562 &msm_cpudai_bt_rx,
3563 &msm_cpudai_bt_tx,
3564 &msm_cpudai_fm_rx,
3565 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003566 &msm_cpudai_auxpcm_rx,
3567 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003568 &msm_cpu_fe,
3569 &msm_stub_codec,
3570 &msm_voice,
3571 &msm_voip,
3572 &msm_lpa_pcm,
3573
3574#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3575 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3576 &qcrypto_device,
3577#endif
3578
3579#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3580 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3581 &qcedev_device,
3582#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003583};
3584
3585static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003586 &msm_kgsl_3d0,
3587 &msm_kgsl_2d0,
3588 &msm_kgsl_2d1,
3589 &mipi_dsi_renesas_panel_device,
3590#ifdef CONFIG_MSM_GEMINI
3591 &msm8960_gemini_device,
3592#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003593};
3594
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003595static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003596 &msm8960_device_otg,
3597 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003598 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303599 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003600 &android_usb_device,
3601 &msm_pcm,
3602 &msm_pcm_routing,
3603 &msm_cpudai0,
3604 &msm_cpudai1,
3605 &msm_cpudai_hdmi_rx,
3606 &msm_cpudai_bt_rx,
3607 &msm_cpudai_bt_tx,
3608 &msm_cpudai_fm_rx,
3609 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003610 &msm_cpudai_auxpcm_rx,
3611 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003612 &msm_cpu_fe,
3613 &msm_stub_codec,
3614 &msm_kgsl_3d0,
3615#ifdef CONFIG_MSM_KGSL_2D
3616 &msm_kgsl_2d0,
3617 &msm_kgsl_2d1,
3618#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003619 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003620#ifdef CONFIG_MSM_GEMINI
3621 &msm8960_gemini_device,
3622#endif
3623 &msm_voice,
3624 &msm_voip,
3625 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303626 &msm_cpudai_afe_01_rx,
3627 &msm_cpudai_afe_01_tx,
3628 &msm_cpudai_afe_02_rx,
3629 &msm_cpudai_afe_02_tx,
3630 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003631#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3632 &hdmi_msm_device,
3633#endif
3634 &msm_pcm_hostless,
3635 &msm_bus_apps_fabric,
3636 &msm_bus_sys_fabric,
3637 &msm_bus_mm_fabric,
3638 &msm_bus_sys_fpb,
3639 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003640 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003641};
3642
3643static void __init msm8960_i2c_init(void)
3644{
3645 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3646 &msm8960_i2c_qup_gsbi4_pdata;
3647
3648 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3649 &msm8960_i2c_qup_gsbi3_pdata;
3650
3651 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3652 &msm8960_i2c_qup_gsbi10_pdata;
3653
3654 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3655 &msm8960_i2c_qup_gsbi12_pdata;
3656}
3657
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003658static void __init msm8960_gfx_init(void)
3659{
3660 uint32_t soc_platform_version = socinfo_get_platform_version();
3661 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3662 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3663 msm_kgsl_3d0.dev.platform_data;
3664 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3665 320000000;
3666 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3667 266667000;
3668 }
3669}
3670
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003671static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3672 .irq_base = PM8921_IRQ_BASE,
3673 .devirq = MSM_GPIO_TO_INT(104),
3674 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3675};
3676
3677static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3678 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3679};
3680
3681static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3682 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3683};
3684
3685static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3686 .rtc_write_enable = false,
3687};
3688
3689static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3690 .pull_up = 1,
3691 .kpd_trigger_delay_us = 970,
3692 .wakeup = 1,
3693};
3694
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303695/* Rotate lock key is not available so use F1 */
3696#define KEY_ROTATE_LOCK KEY_F1
3697
3698static const unsigned int keymap_liquid[] = {
3699 KEY(0, 0, KEY_VOLUMEUP),
3700 KEY(0, 1, KEY_VOLUMEDOWN),
3701 KEY(1, 3, KEY_ROTATE_LOCK),
3702 KEY(1, 4, KEY_HOME),
3703};
3704
3705static struct matrix_keymap_data keymap_data_liquid = {
3706 .keymap_size = ARRAY_SIZE(keymap_liquid),
3707 .keymap = keymap_liquid,
3708};
3709
3710static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3711 .input_name = "keypad_8960_liquid",
3712 .input_phys_device = "keypad_8960/input0",
3713 .num_rows = 2,
3714 .num_cols = 5,
3715 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3716 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3717 .debounce_ms = 15,
3718 .scan_delay_ms = 32,
3719 .row_hold_ns = 91500,
3720 .wakeup = 1,
3721 .keymap_data = &keymap_data_liquid,
3722};
3723
3724
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003725static const unsigned int keymap[] = {
3726 KEY(0, 0, KEY_VOLUMEUP),
3727 KEY(0, 1, KEY_VOLUMEDOWN),
3728 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3729 KEY(0, 3, KEY_CAMERA_FOCUS),
3730};
3731
3732static struct matrix_keymap_data keymap_data = {
3733 .keymap_size = ARRAY_SIZE(keymap),
3734 .keymap = keymap,
3735};
3736
3737static struct pm8xxx_keypad_platform_data keypad_data = {
3738 .input_name = "keypad_8960",
3739 .input_phys_device = "keypad_8960/input0",
3740 .num_rows = 1,
3741 .num_cols = 5,
3742 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3743 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3744 .debounce_ms = 15,
3745 .scan_delay_ms = 32,
3746 .row_hold_ns = 91500,
3747 .wakeup = 1,
3748 .keymap_data = &keymap_data,
3749};
3750
3751static const unsigned int keymap_sim[] = {
3752 KEY(0, 0, KEY_7),
3753 KEY(0, 1, KEY_DOWN),
3754 KEY(0, 2, KEY_UP),
3755 KEY(0, 3, KEY_RIGHT),
3756 KEY(0, 4, KEY_ENTER),
3757 KEY(0, 5, KEY_L),
3758 KEY(0, 6, KEY_BACK),
3759 KEY(0, 7, KEY_M),
3760
3761 KEY(1, 0, KEY_LEFT),
3762 KEY(1, 1, KEY_SEND),
3763 KEY(1, 2, KEY_1),
3764 KEY(1, 3, KEY_4),
3765 KEY(1, 4, KEY_CLEAR),
3766 KEY(1, 5, KEY_MSDOS),
3767 KEY(1, 6, KEY_SPACE),
3768 KEY(1, 7, KEY_COMMA),
3769
3770 KEY(2, 0, KEY_6),
3771 KEY(2, 1, KEY_5),
3772 KEY(2, 2, KEY_8),
3773 KEY(2, 3, KEY_3),
3774 KEY(2, 4, KEY_NUMERIC_STAR),
3775 KEY(2, 5, KEY_UP),
3776 KEY(2, 6, KEY_DOWN),
3777 KEY(2, 7, KEY_LEFTSHIFT),
3778
3779 KEY(3, 0, KEY_9),
3780 KEY(3, 1, KEY_NUMERIC_POUND),
3781 KEY(3, 2, KEY_0),
3782 KEY(3, 3, KEY_2),
3783 KEY(3, 4, KEY_SLEEP),
3784 KEY(3, 5, KEY_F1),
3785 KEY(3, 6, KEY_F2),
3786 KEY(3, 7, KEY_F3),
3787
3788 KEY(4, 0, KEY_BACK),
3789 KEY(4, 1, KEY_HOME),
3790 KEY(4, 2, KEY_MENU),
3791 KEY(4, 3, KEY_VOLUMEUP),
3792 KEY(4, 4, KEY_VOLUMEDOWN),
3793 KEY(4, 5, KEY_F4),
3794 KEY(4, 6, KEY_F5),
3795 KEY(4, 7, KEY_F6),
3796
3797 KEY(5, 0, KEY_R),
3798 KEY(5, 1, KEY_T),
3799 KEY(5, 2, KEY_Y),
3800 KEY(5, 3, KEY_LEFTALT),
3801 KEY(5, 4, KEY_KPENTER),
3802 KEY(5, 5, KEY_Q),
3803 KEY(5, 6, KEY_W),
3804 KEY(5, 7, KEY_E),
3805
3806 KEY(6, 0, KEY_F),
3807 KEY(6, 1, KEY_G),
3808 KEY(6, 2, KEY_H),
3809 KEY(6, 3, KEY_CAPSLOCK),
3810 KEY(6, 4, KEY_PAGEUP),
3811 KEY(6, 5, KEY_A),
3812 KEY(6, 6, KEY_S),
3813 KEY(6, 7, KEY_D),
3814
3815 KEY(7, 0, KEY_V),
3816 KEY(7, 1, KEY_B),
3817 KEY(7, 2, KEY_N),
3818 KEY(7, 3, KEY_MENU),
3819 KEY(7, 4, KEY_PAGEDOWN),
3820 KEY(7, 5, KEY_Z),
3821 KEY(7, 6, KEY_X),
3822 KEY(7, 7, KEY_C),
3823
3824 KEY(8, 0, KEY_P),
3825 KEY(8, 1, KEY_J),
3826 KEY(8, 2, KEY_K),
3827 KEY(8, 3, KEY_INSERT),
3828 KEY(8, 4, KEY_LINEFEED),
3829 KEY(8, 5, KEY_U),
3830 KEY(8, 6, KEY_I),
3831 KEY(8, 7, KEY_O),
3832
3833 KEY(9, 0, KEY_4),
3834 KEY(9, 1, KEY_5),
3835 KEY(9, 2, KEY_6),
3836 KEY(9, 3, KEY_7),
3837 KEY(9, 4, KEY_8),
3838 KEY(9, 5, KEY_1),
3839 KEY(9, 6, KEY_2),
3840 KEY(9, 7, KEY_3),
3841
3842 KEY(10, 0, KEY_F7),
3843 KEY(10, 1, KEY_F8),
3844 KEY(10, 2, KEY_F9),
3845 KEY(10, 3, KEY_F10),
3846 KEY(10, 4, KEY_FN),
3847 KEY(10, 5, KEY_9),
3848 KEY(10, 6, KEY_0),
3849 KEY(10, 7, KEY_DOT),
3850
3851 KEY(11, 0, KEY_LEFTCTRL),
3852 KEY(11, 1, KEY_F11),
3853 KEY(11, 2, KEY_ENTER),
3854 KEY(11, 3, KEY_SEARCH),
3855 KEY(11, 4, KEY_DELETE),
3856 KEY(11, 5, KEY_RIGHT),
3857 KEY(11, 6, KEY_LEFT),
3858 KEY(11, 7, KEY_RIGHTSHIFT),
3859 KEY(0, 0, KEY_VOLUMEUP),
3860 KEY(0, 1, KEY_VOLUMEDOWN),
3861 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3862 KEY(0, 3, KEY_CAMERA_FOCUS),
3863};
3864
3865static struct matrix_keymap_data keymap_data_sim = {
3866 .keymap_size = ARRAY_SIZE(keymap_sim),
3867 .keymap = keymap_sim,
3868};
3869
3870static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3871 .input_name = "keypad_8960",
3872 .input_phys_device = "keypad_8960/input0",
3873 .num_rows = 12,
3874 .num_cols = 8,
3875 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3876 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3877 .debounce_ms = 15,
3878 .scan_delay_ms = 32,
3879 .row_hold_ns = 91500,
3880 .wakeup = 1,
3881 .keymap_data = &keymap_data_sim,
3882};
3883
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003884static int pm8921_therm_mitigation[] = {
3885 1100,
3886 700,
3887 600,
3888 325,
3889};
3890
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003891static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003892 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003893 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003894 .max_voltage = 4200,
3895 .min_voltage = 3200,
3896 .resume_voltage = 4100,
3897 .term_current = 100,
3898 .cool_temp = 10,
3899 .warm_temp = 40,
3900 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003901 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003902 .cool_bat_chg_current = 350,
3903 .warm_bat_chg_current = 350,
3904 .cool_bat_voltage = 4100,
3905 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003906 .thermal_mitigation = pm8921_therm_mitigation,
3907 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003908};
3909
3910static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3911 .priority = 0,
3912};
3913
3914static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3915 .r_sense = 10,
3916 .i_test = 2500,
3917 .v_failure = 3000,
3918 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003919};
3920
Jay Chokshide4cefb2011-08-04 18:10:44 -07003921#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3922
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003923static struct led_info pm8921_led_info[] = {
3924 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003925 .name = "led:usb",
3926 .default_trigger = "usb-online",
Jay Chokshide4cefb2011-08-04 18:10:44 -07003927 },
3928 [1] = {
3929 .name = "led:ac",
3930 .default_trigger = "ac-online",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003931 },
3932};
3933
Jay Chokshi8994e392011-09-14 18:20:39 -07003934static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003935 .num_leds = ARRAY_SIZE(pm8921_led_info),
3936 .leds = pm8921_led_info,
3937};
3938
Jay Chokshi8994e392011-09-14 18:20:39 -07003939static struct pm8xxx_led_config pm8921_led_configs[] = {
3940 [0] = {
3941 .id = PM8XXX_ID_LED_0,
3942 .mode = PM8XXX_LED_MODE_MANUAL,
3943 .max_current = PM8921_LC_LED_MAX_CURRENT,
3944 },
3945 [1] = {
3946 .id = PM8XXX_ID_LED_1,
3947 .mode = PM8XXX_LED_MODE_MANUAL,
3948 .max_current = PM8921_LC_LED_MAX_CURRENT,
3949 },
3950};
3951
3952static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
3953 .led_core = &pm8921_led_core_pdata,
3954 .configs = pm8921_led_configs,
3955 .num_configs = ARRAY_SIZE(pm8921_led_configs),
3956};
3957
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003958static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3959 .irq_pdata = &pm8xxx_irq_pdata,
3960 .gpio_pdata = &pm8xxx_gpio_pdata,
3961 .mpp_pdata = &pm8xxx_mpp_pdata,
3962 .rtc_pdata = &pm8xxx_rtc_pdata,
3963 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3964 .keypad_pdata = &keypad_data,
3965 .misc_pdata = &pm8xxx_misc_pdata,
3966 .regulator_pdatas = msm_pm8921_regulator_pdata,
3967 .charger_pdata = &pm8921_chg_pdata,
3968 .bms_pdata = &pm8921_bms_pdata,
3969 .adc_pdata = &pm8921_adc_pdata,
3970 .leds_pdata = &pm8xxx_leds_pdata,
3971};
3972
3973static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3974 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3975 .slave = {
3976 .name = "pm8921-core",
3977 .platform_data = &pm8921_platform_data,
3978 },
3979};
3980
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003981#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
3982static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003983{
3984 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003985
3986 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3987 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003988 pr_err("FPGA CS gpio_request failed: %d\n", ret);
3989 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003990 }
3991
3992 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003993
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003994 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003995fail:
3996 return ret;
3997}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003998#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003999static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004000{
4001 return 0;
4002}
4003#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004004
4005static struct msm_cpuidle_state msm_cstates[] __initdata = {
4006 {0, 0, "C0", "WFI",
4007 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4008
4009 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4010 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4011
4012 {0, 2, "C2", "POWER_COLLAPSE",
4013 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4014
4015 {1, 0, "C0", "WFI",
4016 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4017
4018 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4019 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4020};
4021
4022static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4023 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4024 .idle_supported = 1,
4025 .suspend_supported = 1,
4026 .idle_enabled = 0,
4027 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004028 },
4029
4030 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4031 .idle_supported = 1,
4032 .suspend_supported = 1,
4033 .idle_enabled = 0,
4034 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004035 },
4036
4037 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4038 .idle_supported = 1,
4039 .suspend_supported = 1,
4040 .idle_enabled = 1,
4041 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004042 },
4043
4044 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4045 .idle_supported = 0,
4046 .suspend_supported = 1,
4047 .idle_enabled = 0,
4048 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004049 },
4050
4051 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4052 .idle_supported = 1,
4053 .suspend_supported = 1,
4054 .idle_enabled = 0,
4055 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004056 },
4057
4058 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4059 .idle_supported = 1,
4060 .suspend_supported = 0,
4061 .idle_enabled = 1,
4062 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004063 },
4064};
4065
4066static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4067 {
4068 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4069 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4070 true,
4071 1, 8000, 100000, 1,
4072 },
4073
4074 {
4075 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4076 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4077 true,
4078 1500, 5000, 60100000, 3000,
4079 },
4080
4081 {
4082 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4083 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4084 false,
4085 1800, 5000, 60350000, 3500,
4086 },
4087
4088 {
4089 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4090 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4091 false,
4092 2800, 2500, 65350000, 4800,
4093 },
4094
4095 {
4096 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4097 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4098 false,
4099 3800, 4500, 67850000, 5500,
4100 },
4101
4102 {
4103 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4104 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4105 false,
4106 4800, 2000, 71850000, 6800,
4107 },
4108
4109 {
4110 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4111 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4112 false,
4113 6800, 500, 75850000, 8800,
4114 },
4115
4116 {
4117 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4118 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4119 false,
4120 7800, 0, 76350000, 9800,
4121 },
4122};
4123
4124#ifdef CONFIG_I2C
4125#define I2C_SURF 1
4126#define I2C_FFA (1 << 1)
4127#define I2C_RUMI (1 << 2)
4128#define I2C_SIM (1 << 3)
4129#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004130#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004131
4132struct i2c_registry {
4133 u8 machs;
4134 int bus;
4135 struct i2c_board_info *info;
4136 int len;
4137};
4138
4139#ifdef CONFIG_MSM_CAMERA
4140static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4141#ifdef CONFIG_IMX074
4142 {
4143 I2C_BOARD_INFO("imx074", 0x1A),
4144 },
4145#endif
4146#ifdef CONFIG_OV2720
4147 {
4148 I2C_BOARD_INFO("ov2720", 0x6C),
4149 },
4150#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004151 {
4152 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4153 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304154#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4155 {
4156 I2C_BOARD_INFO("sc628a", 0x6E),
4157 },
4158#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004159};
4160#endif
4161
4162/* Sensors DSPS platform data */
4163#ifdef CONFIG_MSM_DSPS
4164#define DSPS_PIL_GENERIC_NAME "dsps"
4165#endif /* CONFIG_MSM_DSPS */
4166
4167static void __init msm8960_init_dsps(void)
4168{
4169#ifdef CONFIG_MSM_DSPS
4170 struct msm_dsps_platform_data *pdata =
4171 msm_dsps_device.dev.platform_data;
4172 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4173 pdata->gpios = NULL;
4174 pdata->gpios_num = 0;
4175
4176 platform_device_register(&msm_dsps_device);
4177#endif /* CONFIG_MSM_DSPS */
4178}
4179
Amir Samuelov5137e392011-09-21 17:31:25 +03004180#ifdef CONFIG_ISL9519_CHARGER
4181static struct isl_platform_data isl_data __initdata = {
4182 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4183 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4184 .max_system_voltage = 4200,
4185 .min_system_voltage = 3200,
4186 .chgcurrent = 1000, /* 1900, */
4187 .term_current = 400, /* Need fine tuning */
4188 .input_current = 2048,
4189};
4190
4191static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4192 {
4193 I2C_BOARD_INFO("isl9519q", 0x9),
4194 .irq = 0, /* Not required when notify-by-pmic */
4195 .platform_data = &isl_data,
4196 },
4197};
4198#endif /* CONFIG_ISL9519_CHARGER */
4199
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004200static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4201#ifdef CONFIG_MSM_CAMERA
4202 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004203 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004204 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4205 msm_camera_boardinfo,
4206 ARRAY_SIZE(msm_camera_boardinfo),
4207 },
4208#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004209#ifdef CONFIG_ISL9519_CHARGER
4210 {
4211 I2C_LIQUID,
4212 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4213 isl_charger_i2c_info,
4214 ARRAY_SIZE(isl_charger_i2c_info),
4215 },
4216#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004217 {
4218 I2C_SURF | I2C_FFA | I2C_FLUID,
4219 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4220 cyttsp_info,
4221 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004222 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304223 {
4224 I2C_LIQUID,
4225 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4226 mxt_device_info,
4227 ARRAY_SIZE(mxt_device_info),
4228 },
4229
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004230};
4231#endif /* CONFIG_I2C */
4232
4233static void __init register_i2c_devices(void)
4234{
4235#ifdef CONFIG_I2C
4236 u8 mach_mask = 0;
4237 int i;
4238
4239 /* Build the matching 'supported_machs' bitmask */
4240 if (machine_is_msm8960_cdp())
4241 mach_mask = I2C_SURF;
4242 else if (machine_is_msm8960_rumi3())
4243 mach_mask = I2C_RUMI;
4244 else if (machine_is_msm8960_sim())
4245 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004246 else if (machine_is_msm8960_fluid())
4247 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004248 else if (machine_is_msm8960_liquid())
4249 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004250 else if (machine_is_msm8960_mtp())
4251 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004252 else
4253 pr_err("unmatched machine ID in register_i2c_devices\n");
4254
4255 /* Run the array and install devices as appropriate */
4256 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4257 if (msm8960_i2c_devices[i].machs & mach_mask)
4258 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4259 msm8960_i2c_devices[i].info,
4260 msm8960_i2c_devices[i].len);
4261 }
4262#endif
4263}
4264
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004265static void __init msm8960_sim_init(void)
4266{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004267 BUG_ON(msm_rpm_init(&msm_rpm_data));
4268 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4269 ARRAY_SIZE(msm_rpmrs_levels)));
4270 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004271 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004272 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004273 msm8960_device_ssbi_pm8921.dev.platform_data =
4274 &msm8960_ssbi_pm8921_pdata;
4275 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004276
4277 /* Simulator supports a QWERTY keypad */
4278 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4279
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004280 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4281 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4282 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004283 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004284 msm8960_i2c_init();
4285 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4286 msm_spm_l2_init(msm_spm_l2_data);
4287 msm8960_init_buses();
4288 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4289 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004290 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004291 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004292
4293 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4294 &msm8960_qup_spi_gsbi1_pdata;
4295 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4296
4297 msm8960_init_mmc();
4298 msm_fb_add_devices();
4299 slim_register_board_info(msm_slim_devices,
4300 ARRAY_SIZE(msm_slim_devices));
4301 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4302 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4303 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4304 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004305}
4306
4307static void __init msm8960_rumi3_init(void)
4308{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004309 BUG_ON(msm_rpm_init(&msm_rpm_data));
4310 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4311 ARRAY_SIZE(msm_rpmrs_levels)));
4312 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004313 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004314 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004315 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004316 msm8960_device_ssbi_pm8921.dev.platform_data =
4317 &msm8960_ssbi_pm8921_pdata;
4318 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4319 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4320 &msm8960_qup_spi_gsbi1_pdata;
4321 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4322 msm8960_i2c_init();
4323 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4324 msm_spm_l2_init(msm_spm_l2_data);
4325 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4326 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004327 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004328 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004329 register_i2c_devices();
4330 msm_fb_add_devices();
4331 slim_register_board_info(msm_slim_devices,
4332 ARRAY_SIZE(msm_slim_devices));
4333 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4334 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4335 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4336 msm_pm_data);
4337}
4338
4339static void __init msm8960_cdp_init(void)
4340{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004341 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4342 pr_err("meminfo_init() failed!\n");
4343
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004344 BUG_ON(msm_rpm_init(&msm_rpm_data));
4345 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4346 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004347
4348 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004349 regulator_suppress_info_printing();
4350 if (msm_xo_init())
4351 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004352 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004353 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004354 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4355 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4356 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004357 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004358 if (machine_is_msm8960_cdp())
4359 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304360 if (machine_is_msm8960_liquid())
4361 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004362 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4363 &msm8960_qup_spi_gsbi1_pdata;
4364 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4365 msm8960_device_ssbi_pm8921.dev.platform_data =
4366 &msm8960_ssbi_pm8921_pdata;
4367 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4368 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004369 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004370 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4371 msm_spm_l2_init(msm_spm_l2_data);
4372 msm8960_init_buses();
4373 platform_add_devices(msm_footswitch_devices,
4374 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004375 if (machine_is_msm8960_liquid())
4376 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004377 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4378 pm8921_gpio_mpp_init();
4379 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4380 msm8960_init_cam();
4381 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004382 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304383 if (machine_is_msm8960_liquid())
4384 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004385 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004386 msm_fb_add_devices();
4387 slim_register_board_info(msm_slim_devices,
4388 ARRAY_SIZE(msm_slim_devices));
4389 msm8960_init_dsps();
4390 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4391 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4392 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4393 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004394 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004395}
4396
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004397MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4398 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004399 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004400 .init_irq = msm8960_init_irq,
4401 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004402 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004403 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004404MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004405
4406MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4407 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004408 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004409 .init_irq = msm8960_init_irq,
4410 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004411 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004412 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004413MACHINE_END
4414
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004415MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4416 .map_io = msm8960_map_io,
4417 .reserve = msm8960_reserve,
4418 .init_irq = msm8960_init_irq,
4419 .timer = &msm_timer,
4420 .init_machine = msm8960_cdp_init,
4421 .init_early = msm8960_allocate_memory_regions,
4422MACHINE_END
4423
4424MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4425 .map_io = msm8960_map_io,
4426 .reserve = msm8960_reserve,
4427 .init_irq = msm8960_init_irq,
4428 .timer = &msm_timer,
4429 .init_machine = msm8960_cdp_init,
4430 .init_early = msm8960_allocate_memory_regions,
4431MACHINE_END
4432
4433MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4434 .map_io = msm8960_map_io,
4435 .reserve = msm8960_reserve,
4436 .init_irq = msm8960_init_irq,
4437 .timer = &msm_timer,
4438 .init_machine = msm8960_cdp_init,
4439 .init_early = msm8960_allocate_memory_regions,
4440MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004441
4442MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4443 .map_io = msm8960_map_io,
4444 .reserve = msm8960_reserve,
4445 .init_irq = msm8960_init_irq,
4446 .timer = &msm_timer,
4447 .init_machine = msm8960_cdp_init,
4448 .init_early = msm8960_allocate_memory_regions,
4449MACHINE_END