blob: ae85affdb4ac071e1eb736c1ac117e18466a46c2 [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
833static struct memtype_reserve msm8960_reserve_table[] __initdata = {
834 [MEMTYPE_SMI] = {
835 },
836 [MEMTYPE_EBI0] = {
837 .flags = MEMTYPE_FLAGS_1M_ALIGN,
838 },
839 [MEMTYPE_EBI1] = {
840 .flags = MEMTYPE_FLAGS_1M_ALIGN,
841 },
842};
843
844static void __init size_pmem_devices(void)
845{
846#ifdef CONFIG_ANDROID_PMEM
847 android_pmem_adsp_pdata.size = pmem_adsp_size;
848 android_pmem_pdata.size = pmem_size;
849 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
850#endif
851}
852
853static void __init reserve_memory_for(struct android_pmem_platform_data *p)
854{
855 msm8960_reserve_table[p->memory_type].size += p->size;
856}
857
858static void __init reserve_pmem_memory(void)
859{
860#ifdef CONFIG_ANDROID_PMEM
861 reserve_memory_for(&android_pmem_adsp_pdata);
862 reserve_memory_for(&android_pmem_pdata);
863 reserve_memory_for(&android_pmem_audio_pdata);
864 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
865#endif
866}
867
Larry Basselb4126da2011-07-18 14:31:33 -0700868static int msm8960_paddr_to_memtype(unsigned int paddr)
869{
870 return MEMTYPE_EBI1;
871}
872
Laura Abbottd6183792011-08-19 13:42:24 -0700873#ifdef CONFIG_ION_MSM
874struct ion_platform_data ion_pdata = {
875 .nr = 3,
876 .heaps = {
877 {
878 .id = ION_HEAP_SYSTEM_ID,
879 .type = ION_HEAP_TYPE_SYSTEM,
880 .name = ION_KMALLOC_HEAP_NAME,
881 },
882 {
883 .id = ION_HEAP_SYSTEM_CONTIG_ID,
884 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
885 .name = ION_VMALLOC_HEAP_NAME,
886 },
887 {
888 .id = ION_HEAP_EBI_ID,
889 .type = ION_HEAP_TYPE_CARVEOUT,
890 .name = ION_EBI1_HEAP_NAME,
891 .size = MSM_ION_EBI_SIZE,
892 .memory_type = ION_EBI_TYPE,
893 },
894 }
895};
896
897struct platform_device ion_dev = {
898 .name = "ion-msm",
899 .id = 1,
900 .dev = { .platform_data = &ion_pdata },
901};
902#endif
903
904static void reserve_ion_memory(void)
905{
906#ifdef CONFIG_ION_MSM
907 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
908#endif
909}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700910static void __init msm8960_calculate_reserve_sizes(void)
911{
912 size_pmem_devices();
913 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700914 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700915}
916
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700917static struct reserve_info msm8960_reserve_info __initdata = {
918 .memtype_reserve_table = msm8960_reserve_table,
919 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
920 .paddr_to_memtype = msm8960_paddr_to_memtype,
921};
922
Larry Basselb4126da2011-07-18 14:31:33 -0700923static int msm8960_memory_bank_size(void)
924{
925 return 1<<29;
926}
927
928static void __init locate_unstable_memory(void)
929{
930 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
931 unsigned long bank_size;
932 unsigned long low, high;
933
934 bank_size = msm8960_memory_bank_size();
935 low = meminfo.bank[0].start;
936 high = mb->start + mb->size;
937 low &= ~(bank_size - 1);
938
939 if (high - low <= bank_size)
940 return;
941 msm8960_reserve_info.low_unstable_address = low + bank_size;
942 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
943 msm8960_reserve_info.bank_size = bank_size;
944 pr_info("low unstable address %lx max size %lx bank size %lx\n",
945 msm8960_reserve_info.low_unstable_address,
946 msm8960_reserve_info.max_unstable_size,
947 msm8960_reserve_info.bank_size);
948}
949
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700950static void __init msm8960_reserve(void)
951{
952 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700953 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700954 msm_reserve();
955}
956
Larry Bassela4414b12011-08-04 11:11:02 -0700957static int msm8960_change_memory_power(u64 start, u64 size,
958 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700959{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700960 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700961}
962
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700963#ifdef CONFIG_MSM_CAMERA
964
Nishant Pandit24153d82011-08-27 16:05:13 +0530965static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700966 5, /*CAMIF_MCLK*/
967 20, /*CAMIF_I2C_DATA*/
968 21, /*CAMIF_I2C_CLK*/
969};
970
Nishant Pandit24153d82011-08-27 16:05:13 +0530971static struct msm_camera_gpio_conf gpio_conf = {
972 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
973 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
974 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
975 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
976};
977
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700978#define VFE_CAMIF_TIMER1_GPIO 2
979#define VFE_CAMIF_TIMER2_GPIO 3
980#define VFE_CAMIF_TIMER3_GPIO_INT 4
981struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
982 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
983 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
984 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
985 .flash_recharge_duration = 50000,
986 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
987};
988
Nishant Pandit474f2252011-07-23 23:17:56 +0530989#ifdef CONFIG_MSM_CAMERA_FLASH
990static struct msm_camera_sensor_flash_src msm_flash_src = {
991 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
992 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
993 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
994#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
995 defined(CONFIG_GPIO_SX150X_MODULE))
996 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
997#endif
998};
999#endif
1000
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001001#ifdef CONFIG_MSM_BUS_SCALING
1002
1003static struct msm_bus_vectors cam_init_vectors[] = {
1004 {
1005 .src = MSM_BUS_MASTER_VFE,
1006 .dst = MSM_BUS_SLAVE_EBI_CH0,
1007 .ab = 0,
1008 .ib = 0,
1009 },
1010 {
1011 .src = MSM_BUS_MASTER_VPE,
1012 .dst = MSM_BUS_SLAVE_EBI_CH0,
1013 .ab = 0,
1014 .ib = 0,
1015 },
1016 {
1017 .src = MSM_BUS_MASTER_JPEG_ENC,
1018 .dst = MSM_BUS_SLAVE_EBI_CH0,
1019 .ab = 0,
1020 .ib = 0,
1021 },
1022};
1023
1024static struct msm_bus_vectors cam_preview_vectors[] = {
1025 {
1026 .src = MSM_BUS_MASTER_VFE,
1027 .dst = MSM_BUS_SLAVE_EBI_CH0,
1028 .ab = 27648000,
1029 .ib = 110592000,
1030 },
1031 {
1032 .src = MSM_BUS_MASTER_VPE,
1033 .dst = MSM_BUS_SLAVE_EBI_CH0,
1034 .ab = 0,
1035 .ib = 0,
1036 },
1037 {
1038 .src = MSM_BUS_MASTER_JPEG_ENC,
1039 .dst = MSM_BUS_SLAVE_EBI_CH0,
1040 .ab = 0,
1041 .ib = 0,
1042 },
1043};
1044
1045static struct msm_bus_vectors cam_video_vectors[] = {
1046 {
1047 .src = MSM_BUS_MASTER_VFE,
1048 .dst = MSM_BUS_SLAVE_EBI_CH0,
1049 .ab = 140451840,
1050 .ib = 561807360,
1051 },
1052 {
1053 .src = MSM_BUS_MASTER_VPE,
1054 .dst = MSM_BUS_SLAVE_EBI_CH0,
1055 .ab = 206807040,
1056 .ib = 488816640,
1057 },
1058 {
1059 .src = MSM_BUS_MASTER_JPEG_ENC,
1060 .dst = MSM_BUS_SLAVE_EBI_CH0,
1061 .ab = 0,
1062 .ib = 0,
1063 },
1064};
1065
1066static struct msm_bus_vectors cam_snapshot_vectors[] = {
1067 {
1068 .src = MSM_BUS_MASTER_VFE,
1069 .dst = MSM_BUS_SLAVE_EBI_CH0,
1070 .ab = 274423680,
1071 .ib = 1097694720,
1072 },
1073 {
1074 .src = MSM_BUS_MASTER_VPE,
1075 .dst = MSM_BUS_SLAVE_EBI_CH0,
1076 .ab = 0,
1077 .ib = 0,
1078 },
1079 {
1080 .src = MSM_BUS_MASTER_JPEG_ENC,
1081 .dst = MSM_BUS_SLAVE_EBI_CH0,
1082 .ab = 540000000,
1083 .ib = 1350000000,
1084 },
1085};
1086
1087static struct msm_bus_vectors cam_zsl_vectors[] = {
1088 {
1089 .src = MSM_BUS_MASTER_VFE,
1090 .dst = MSM_BUS_SLAVE_EBI_CH0,
1091 .ab = 302071680,
1092 .ib = 1208286720,
1093 },
1094 {
1095 .src = MSM_BUS_MASTER_VPE,
1096 .dst = MSM_BUS_SLAVE_EBI_CH0,
1097 .ab = 0,
1098 .ib = 0,
1099 },
1100 {
1101 .src = MSM_BUS_MASTER_JPEG_ENC,
1102 .dst = MSM_BUS_SLAVE_EBI_CH0,
1103 .ab = 540000000,
1104 .ib = 1350000000,
1105 },
1106};
1107
1108static struct msm_bus_paths cam_bus_client_config[] = {
1109 {
1110 ARRAY_SIZE(cam_init_vectors),
1111 cam_init_vectors,
1112 },
1113 {
1114 ARRAY_SIZE(cam_preview_vectors),
1115 cam_preview_vectors,
1116 },
1117 {
1118 ARRAY_SIZE(cam_video_vectors),
1119 cam_video_vectors,
1120 },
1121 {
1122 ARRAY_SIZE(cam_snapshot_vectors),
1123 cam_snapshot_vectors,
1124 },
1125 {
1126 ARRAY_SIZE(cam_zsl_vectors),
1127 cam_zsl_vectors,
1128 },
1129};
1130
1131static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1132 cam_bus_client_config,
1133 ARRAY_SIZE(cam_bus_client_config),
1134 .name = "msm_camera",
1135};
1136#endif
1137
Nishant Pandit24153d82011-08-27 16:05:13 +05301138struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1139 {
1140 .ioclk.mclk_clk_rate = 24000000,
1141 .ioclk.vfe_clk_rate = 228570000,
1142 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001143#ifdef CONFIG_MSM_BUS_SCALING
1144 .cam_bus_scale_table = &cam_bus_client_pdata,
1145#endif
Nishant Pandit24153d82011-08-27 16:05:13 +05301146 },
1147 {
1148 .ioclk.mclk_clk_rate = 24000000,
1149 .ioclk.vfe_clk_rate = 228570000,
1150 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001151#ifdef CONFIG_MSM_BUS_SCALING
1152 .cam_bus_scale_table = &cam_bus_client_pdata,
1153#endif
Nishant Pandit24153d82011-08-27 16:05:13 +05301154 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001155};
1156
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001157#ifdef CONFIG_IMX074_ACT
1158static struct i2c_board_info imx074_actuator_i2c_info = {
1159 I2C_BOARD_INFO("imx074_act", 0x11),
1160};
1161
1162static struct msm_actuator_info imx074_actuator_info = {
1163 .board_info = &imx074_actuator_i2c_info,
1164 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1165 .vcm_pwd = 0,
1166 .vcm_enable = 1,
1167};
1168#endif
1169
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001170#ifdef CONFIG_IMX074
1171static struct msm_camera_sensor_flash_data flash_imx074 = {
1172 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301173#ifdef CONFIG_MSM_CAMERA_FLASH
1174 .flash_src = &msm_flash_src
1175#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001176};
1177
Nishant Pandit24153d82011-08-27 16:05:13 +05301178static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1179 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001180 .sensor_reset = 107,
1181 .sensor_pwd = 85,
1182 .vcm_pwd = 0,
1183 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301184};
1185
1186static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1187 .sensor_name = "imx074",
1188 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001189 .flash_data = &flash_imx074,
1190 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301191 .sensor_platform_info = &sensor_board_info_imx074,
1192 .gpio_conf = &gpio_conf,
1193 .csi_if = 1,
1194 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001195#ifdef CONFIG_IMX074_ACT
1196 .actuator_info = &imx074_actuator_info
1197#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001198};
1199
1200struct platform_device msm8960_camera_sensor_imx074 = {
1201 .name = "msm_camera_imx074",
1202 .dev = {
1203 .platform_data = &msm_camera_sensor_imx074_data,
1204 },
1205};
1206#endif
1207#ifdef CONFIG_OV2720
1208static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001209 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001210};
1211
Nishant Pandit24153d82011-08-27 16:05:13 +05301212static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1213 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001214 .sensor_reset = 76,
1215 .sensor_pwd = 85,
1216 .vcm_pwd = 0,
1217 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301218};
1219
1220static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1221 .sensor_name = "ov2720",
1222 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001223 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301224 .sensor_platform_info = &sensor_board_info_ov2720,
1225 .gpio_conf = &gpio_conf,
1226 .csi_if = 1,
1227 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001228};
1229
1230struct platform_device msm8960_camera_sensor_ov2720 = {
1231 .name = "msm_camera_ov2720",
1232 .dev = {
1233 .platform_data = &msm_camera_sensor_ov2720_data,
1234 },
1235};
1236#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001237
1238static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1239 .flash_type = MSM_CAMERA_FLASH_LED,
1240};
1241
Nishant Pandit24153d82011-08-27 16:05:13 +05301242static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1243 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001244 .sensor_reset = 107,
1245 .sensor_pwd = 85,
1246 .vcm_pwd = 0,
1247 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301248};
1249
1250static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1251 .sensor_name = "qs_mt9p017",
1252 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001253 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301254 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1255 .gpio_conf = &gpio_conf,
1256 .csi_if = 1,
1257 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001258};
1259
1260struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1261 .name = "msm_camera_qs_mt9p017",
1262 .dev = {
1263 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1264 },
1265};
1266
Kevin Chan8b0d2322011-09-10 21:06:31 -07001267static struct msm8960_privacy_light_cfg privacy_light_info = {
1268 .mpp = PM8921_MPP_PM_TO_SYS(12),
1269};
1270
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001271static void __init msm8960_init_cam(void)
1272{
1273 int i;
1274 struct platform_device *cam_dev[] = {
1275 &msm8960_camera_sensor_imx074,
1276 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001277 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001278 };
1279
Kevin Chan8b0d2322011-09-10 21:06:31 -07001280 if (machine_is_msm8960_liquid()) {
1281 struct msm_camera_sensor_info *s_info;
1282 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1283 s_info->sensor_platform_info->mount_angle = 180;
1284 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1285 s_info->sensor_platform_info->privacy_light = 1;
1286 s_info->sensor_platform_info->privacy_light_info =
1287 &privacy_light_info;
1288 }
1289
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001290 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1291 struct msm_camera_sensor_info *s_info;
1292 s_info = cam_dev[i]->dev.platform_data;
1293 msm_get_cam_resources(s_info);
1294 platform_device_register(cam_dev[i]);
1295 }
1296}
1297#endif
1298
1299#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001300#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001301#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001302#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303#endif
1304
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001305
1306#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001307#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001308#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001309#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1310#else
1311#define MSM_FB_EXT_BUF_SIZE 0
1312#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001313
kuogee hsieh3830eb92011-09-12 15:25:57 -07001314#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1315/* width x height x 3 bpp x 2 frame buffer */
1316#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1317#define MSM_FB_WRITEBACK_OFFSET \
1318 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1319#else
1320#define MSM_FB_WRITEBACK_SIZE 0
1321#define MSM_FB_WRITEBACK_OFFSET 0
1322#endif
1323
1324
1325/* Note: must be multiple of 4096 */
1326#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1327 MSM_FB_WRITEBACK_SIZE, 4096)
1328
1329static int writeback_offset(void)
1330{
1331 return MSM_FB_WRITEBACK_OFFSET;
1332}
1333
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001334
1335#define MDP_VSYNC_GPIO 0
1336
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001337#define PANEL_NAME_MAX_LEN 30
1338#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1339#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1340#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1341#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1342#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1343#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1344#define HDMI_PANEL_NAME "hdmi_msm"
1345#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001346
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001347static struct resource msm_fb_resources[] = {
1348 {
1349 .flags = IORESOURCE_DMA,
1350 }
1351};
1352
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001353static int msm_fb_detect_panel(const char *name)
1354{
1355 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001356 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1357 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1358 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001359 return 0;
1360 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001361 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1362 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1363 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001364 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001365
1366#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1367 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1368 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1369 PANEL_NAME_MAX_LEN)))
1370 return 0;
1371
1372 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1373 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1374 PANEL_NAME_MAX_LEN)))
1375 return 0;
1376
1377 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1378 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1379 PANEL_NAME_MAX_LEN)))
1380 return 0;
1381
1382 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1383 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1384 PANEL_NAME_MAX_LEN)))
1385 return 0;
1386#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001387 }
1388
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001389 if (!strncmp(name, HDMI_PANEL_NAME,
1390 strnlen(HDMI_PANEL_NAME,
1391 PANEL_NAME_MAX_LEN)))
1392 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001393
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001394 if (!strncmp(name, TVOUT_PANEL_NAME,
1395 strnlen(TVOUT_PANEL_NAME,
1396 PANEL_NAME_MAX_LEN)))
1397 return 0;
1398
1399 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001400 return -ENODEV;
1401}
1402
1403static struct msm_fb_platform_data msm_fb_pdata = {
1404 .detect_client = msm_fb_detect_panel,
1405};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001406
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001407static struct platform_device msm_fb_device = {
1408 .name = "msm_fb",
1409 .id = 0,
1410 .num_resources = ARRAY_SIZE(msm_fb_resources),
1411 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001412 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001413};
1414
1415static bool dsi_power_on;
1416
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001417/**
1418 * LiQUID panel on/off
1419 *
1420 * @param on
1421 *
1422 * @return int
1423 */
1424static int mipi_dsi_liquid_panel_power(int on)
1425{
1426 static struct regulator *reg_l2, *reg_ext_3p3v;
1427 static int gpio21, gpio24, gpio43;
1428 int rc;
1429
1430 pr_info("%s: on=%d\n", __func__, on);
1431
1432 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1433 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1434 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1435
1436 if (!dsi_power_on) {
1437
1438 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1439 "dsi_vdda");
1440 if (IS_ERR(reg_l2)) {
1441 pr_err("could not get 8921_l2, rc = %ld\n",
1442 PTR_ERR(reg_l2));
1443 return -ENODEV;
1444 }
1445
1446 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1447 if (rc) {
1448 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1449 return -EINVAL;
1450 }
1451
1452 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1453 "vdd_lvds_3p3v");
1454 if (IS_ERR(reg_ext_3p3v)) {
1455 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1456 PTR_ERR(reg_ext_3p3v));
1457 return -ENODEV;
1458 }
1459
1460 rc = gpio_request(gpio21, "disp_pwr_en_n");
1461 if (rc) {
1462 pr_err("request gpio 21 failed, rc=%d\n", rc);
1463 return -ENODEV;
1464 }
1465
1466 rc = gpio_request(gpio43, "disp_rst_n");
1467 if (rc) {
1468 pr_err("request gpio 43 failed, rc=%d\n", rc);
1469 return -ENODEV;
1470 }
1471
1472 rc = gpio_request(gpio24, "disp_backlight_pwm");
1473 if (rc) {
1474 pr_err("request gpio 24 failed, rc=%d\n", rc);
1475 return -ENODEV;
1476 }
1477
1478 dsi_power_on = true;
1479 }
1480
1481 if (on) {
1482 rc = regulator_set_optimum_mode(reg_l2, 100000);
1483 if (rc < 0) {
1484 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1485 return -EINVAL;
1486 }
1487 rc = regulator_enable(reg_l2);
1488 if (rc) {
1489 pr_err("enable l2 failed, rc=%d\n", rc);
1490 return -ENODEV;
1491 }
1492
1493 rc = regulator_enable(reg_ext_3p3v);
1494 if (rc) {
1495 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1496 return -ENODEV;
1497 }
1498
1499 /* set reset pin before power enable */
1500 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1501
1502 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1503 msleep(20);
1504 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1505 msleep(20);
1506 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1507 msleep(20);
1508 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1509 msleep(20);
1510 } else {
1511 gpio_set_value_cansleep(gpio43, 0);
1512 gpio_set_value_cansleep(gpio21, 1);
1513
1514 rc = regulator_disable(reg_l2);
1515 if (rc) {
1516 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1517 return -ENODEV;
1518 }
1519 rc = regulator_disable(reg_ext_3p3v);
1520 if (rc) {
1521 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1522 return -ENODEV;
1523 }
1524 rc = regulator_set_optimum_mode(reg_l2, 100);
1525 if (rc < 0) {
1526 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1527 return -EINVAL;
1528 }
1529 }
1530
1531 return 0;
1532}
1533
1534static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001535{
1536 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001537 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001538 int rc;
1539
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001540 pr_info("%s: state : %d\n", __func__, on);
1541
1542 if (!dsi_power_on) {
1543
1544 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1545 "dsi_vdc");
1546 if (IS_ERR(reg_l8)) {
1547 pr_err("could not get 8921_l8, rc = %ld\n",
1548 PTR_ERR(reg_l8));
1549 return -ENODEV;
1550 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001551 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1552 "dsi_vddio");
1553 if (IS_ERR(reg_l23)) {
1554 pr_err("could not get 8921_l23, rc = %ld\n",
1555 PTR_ERR(reg_l23));
1556 return -ENODEV;
1557 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1559 "dsi_vdda");
1560 if (IS_ERR(reg_l2)) {
1561 pr_err("could not get 8921_l2, rc = %ld\n",
1562 PTR_ERR(reg_l2));
1563 return -ENODEV;
1564 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001565 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1566 if (rc) {
1567 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1568 return -EINVAL;
1569 }
1570 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1571 if (rc) {
1572 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1573 return -EINVAL;
1574 }
1575 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1576 if (rc) {
1577 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1578 return -EINVAL;
1579 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001580 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1581 rc = gpio_request(gpio43, "disp_rst_n");
1582 if (rc) {
1583 pr_err("request gpio 43 failed, rc=%d\n", rc);
1584 return -ENODEV;
1585 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001586 dsi_power_on = true;
1587 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001588 if (on) {
1589 rc = regulator_set_optimum_mode(reg_l8, 100000);
1590 if (rc < 0) {
1591 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1592 return -EINVAL;
1593 }
1594 rc = regulator_set_optimum_mode(reg_l23, 100000);
1595 if (rc < 0) {
1596 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1597 return -EINVAL;
1598 }
1599 rc = regulator_set_optimum_mode(reg_l2, 100000);
1600 if (rc < 0) {
1601 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1602 return -EINVAL;
1603 }
1604 rc = regulator_enable(reg_l8);
1605 if (rc) {
1606 pr_err("enable l8 failed, rc=%d\n", rc);
1607 return -ENODEV;
1608 }
1609 rc = regulator_enable(reg_l23);
1610 if (rc) {
1611 pr_err("enable l8 failed, rc=%d\n", rc);
1612 return -ENODEV;
1613 }
1614 rc = regulator_enable(reg_l2);
1615 if (rc) {
1616 pr_err("enable l2 failed, rc=%d\n", rc);
1617 return -ENODEV;
1618 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001619 gpio_set_value_cansleep(gpio43, 1);
1620 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001621 rc = regulator_disable(reg_l2);
1622 if (rc) {
1623 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1624 return -ENODEV;
1625 }
1626 rc = regulator_disable(reg_l8);
1627 if (rc) {
1628 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1629 return -ENODEV;
1630 }
1631 rc = regulator_disable(reg_l23);
1632 if (rc) {
1633 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1634 return -ENODEV;
1635 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001636 rc = regulator_set_optimum_mode(reg_l8, 100);
1637 if (rc < 0) {
1638 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1639 return -EINVAL;
1640 }
1641 rc = regulator_set_optimum_mode(reg_l23, 100);
1642 if (rc < 0) {
1643 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1644 return -EINVAL;
1645 }
1646 rc = regulator_set_optimum_mode(reg_l2, 100);
1647 if (rc < 0) {
1648 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1649 return -EINVAL;
1650 }
1651 gpio_set_value_cansleep(gpio43, 0);
1652 }
1653 return 0;
1654}
1655
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001656static int mipi_dsi_panel_power(int on)
1657{
1658 int ret;
1659
1660 pr_info("%s: on=%d\n", __func__, on);
1661
1662 if (machine_is_msm8960_liquid())
1663 ret = mipi_dsi_liquid_panel_power(on);
1664 else
1665 ret = mipi_dsi_cdp_panel_power(on);
1666
1667 return ret;
1668}
1669
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001670static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1671 .vsync_gpio = MDP_VSYNC_GPIO,
1672 .dsi_power_save = mipi_dsi_panel_power,
1673};
1674
1675#ifdef CONFIG_MSM_BUS_SCALING
1676
1677static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001678 {
1679 .src = MSM_BUS_MASTER_MDP_PORT0,
1680 .dst = MSM_BUS_SLAVE_EBI_CH0,
1681 .ab = 0,
1682 .ib = 0,
1683 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001684};
1685
1686static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687 {
1688 .src = MSM_BUS_MASTER_MDP_PORT0,
1689 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001690 .ab = 216000000 * 2,
1691 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001692 },
1693};
1694
1695static struct msm_bus_vectors mdp_vga_vectors[] = {
1696 /* VGA and less video */
1697 {
1698 .src = MSM_BUS_MASTER_MDP_PORT0,
1699 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001700 .ab = 216000000 * 2,
1701 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001702 },
1703};
1704
1705static struct msm_bus_vectors mdp_720p_vectors[] = {
1706 /* 720p and less video */
1707 {
1708 .src = MSM_BUS_MASTER_MDP_PORT0,
1709 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001710 .ab = 230400000 * 2,
1711 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001712 },
1713};
1714
1715static struct msm_bus_vectors mdp_1080p_vectors[] = {
1716 /* 1080p and less video */
1717 {
1718 .src = MSM_BUS_MASTER_MDP_PORT0,
1719 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001720 .ab = 334080000 * 2,
1721 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001722 },
1723};
1724
1725static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1726 {
1727 ARRAY_SIZE(mdp_init_vectors),
1728 mdp_init_vectors,
1729 },
1730 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001731 ARRAY_SIZE(mdp_ui_vectors),
1732 mdp_ui_vectors,
1733 },
1734 {
1735 ARRAY_SIZE(mdp_ui_vectors),
1736 mdp_ui_vectors,
1737 },
1738 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001739 ARRAY_SIZE(mdp_vga_vectors),
1740 mdp_vga_vectors,
1741 },
1742 {
1743 ARRAY_SIZE(mdp_720p_vectors),
1744 mdp_720p_vectors,
1745 },
1746 {
1747 ARRAY_SIZE(mdp_1080p_vectors),
1748 mdp_1080p_vectors,
1749 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001750};
1751
1752static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1753 mdp_bus_scale_usecases,
1754 ARRAY_SIZE(mdp_bus_scale_usecases),
1755 .name = "mdp",
1756};
1757
1758#endif
1759
1760int mdp_core_clk_rate_table[] = {
1761 85330000,
1762 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001763 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764 200000000,
1765};
1766
1767static struct msm_panel_common_pdata mdp_pdata = {
1768 .gpio = MDP_VSYNC_GPIO,
1769 .mdp_core_clk_rate = 85330000,
1770 .mdp_core_clk_table = mdp_core_clk_rate_table,
1771 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1772#ifdef CONFIG_MSM_BUS_SCALING
1773 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1774#endif
1775 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001776 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001777};
1778
1779static struct platform_device mipi_dsi_renesas_panel_device = {
1780 .name = "mipi_renesas",
1781 .id = 0,
1782};
1783
1784static struct platform_device mipi_dsi_simulator_panel_device = {
1785 .name = "mipi_simulator",
1786 .id = 0,
1787};
1788
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001789#define LPM_CHANNEL0 0
1790static int toshiba_gpio[] = {LPM_CHANNEL0};
1791
1792static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1793 .gpio = toshiba_gpio,
1794};
1795
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001796static struct platform_device mipi_dsi_toshiba_panel_device = {
1797 .name = "mipi_toshiba",
1798 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001799 .dev = {
1800 .platform_data = &toshiba_pdata,
1801 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001802};
1803
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001804static int dsi2lvds_gpio[2] = {
1805 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1806 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1807 };
1808
1809static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1810 .gpio_num = dsi2lvds_gpio,
1811};
1812
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001813static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1814
1815/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1816 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1817 /* timing */
1818 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1819 0x0c, 0x03, 0x04, 0xa0},
1820 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1821 {0xff, 0x00, 0x06, 0x00}, /* strength */
1822 /* pll control */
1823 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1824 0x40, 0x07, 0x03,
1825 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1826};
1827
1828static struct mipi_dsi_panel_platform_data novatek_pdata = {
1829 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1830};
1831
1832static struct platform_device mipi_dsi_novatek_panel_device = {
1833 .name = "mipi_novatek",
1834 .id = 0,
1835 .dev = {
1836 .platform_data = &novatek_pdata,
1837 }
1838};
1839
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001840static struct platform_device mipi_dsi2lvds_bridge_device = {
1841 .name = "mipi_tc358764",
1842 .id = 0,
1843 .dev.platform_data = &mipi_dsi2lvds_pdata,
1844};
1845
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001846#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1847static struct resource hdmi_msm_resources[] = {
1848 {
1849 .name = "hdmi_msm_qfprom_addr",
1850 .start = 0x00700000,
1851 .end = 0x007060FF,
1852 .flags = IORESOURCE_MEM,
1853 },
1854 {
1855 .name = "hdmi_msm_hdmi_addr",
1856 .start = 0x04A00000,
1857 .end = 0x04A00FFF,
1858 .flags = IORESOURCE_MEM,
1859 },
1860 {
1861 .name = "hdmi_msm_irq",
1862 .start = HDMI_IRQ,
1863 .end = HDMI_IRQ,
1864 .flags = IORESOURCE_IRQ,
1865 },
1866};
1867
1868static int hdmi_enable_5v(int on);
1869static int hdmi_core_power(int on, int show);
1870static int hdmi_cec_power(int on);
1871
1872static struct msm_hdmi_platform_data hdmi_msm_data = {
1873 .irq = HDMI_IRQ,
1874 .enable_5v = hdmi_enable_5v,
1875 .core_power = hdmi_core_power,
1876 .cec_power = hdmi_cec_power,
1877};
1878
1879static struct platform_device hdmi_msm_device = {
1880 .name = "hdmi_msm",
1881 .id = 0,
1882 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1883 .resource = hdmi_msm_resources,
1884 .dev.platform_data = &hdmi_msm_data,
1885};
1886#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1887
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001888#ifdef CONFIG_MSM_BUS_SCALING
1889static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1890 {
1891 .src = MSM_BUS_MASTER_MDP_PORT0,
1892 .dst = MSM_BUS_SLAVE_EBI_CH0,
1893 .ab = 0,
1894 .ib = 0,
1895 },
1896};
1897static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1898 {
1899 .src = MSM_BUS_MASTER_MDP_PORT0,
1900 .dst = MSM_BUS_SLAVE_EBI_CH0,
1901 .ab = 566092800 * 2,
1902 .ib = 707616000 * 2,
1903 },
1904};
1905static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1906 {
1907 ARRAY_SIZE(dtv_bus_init_vectors),
1908 dtv_bus_init_vectors,
1909 },
1910 {
1911 ARRAY_SIZE(dtv_bus_def_vectors),
1912 dtv_bus_def_vectors,
1913 },
1914};
1915static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1916 dtv_bus_scale_usecases,
1917 ARRAY_SIZE(dtv_bus_scale_usecases),
1918 .name = "dtv",
1919};
1920
1921static struct lcdc_platform_data dtv_pdata = {
1922 .bus_scale_table = &dtv_bus_scale_pdata,
1923};
1924#endif
1925
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001926static void __init msm_fb_add_devices(void)
1927{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001928 struct platform_device *ptr = NULL;
1929
1930 if (machine_is_msm8960_liquid())
1931 ptr = &mipi_dsi2lvds_bridge_device;
1932 else
1933 ptr = &mipi_dsi_toshiba_panel_device;
1934 platform_add_devices(&ptr, 1);
1935
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001936 if (machine_is_msm8x60_rumi3()) {
1937 msm_fb_register_device("mdp", NULL);
1938 mipi_dsi_pdata.target_type = 1;
1939 } else
1940 msm_fb_register_device("mdp", &mdp_pdata);
1941 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001942#ifdef CONFIG_MSM_BUS_SCALING
1943 msm_fb_register_device("dtv", &dtv_pdata);
1944#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001945}
1946
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001947static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1948 .func = GPIOMUX_FUNC_GPIO,
1949 .drv = GPIOMUX_DRV_2MA,
1950 .pull = GPIOMUX_PULL_DOWN,
1951};
1952
1953static struct gpiomux_setting mdp_vsync_active_cfg = {
1954 .func = GPIOMUX_FUNC_1,
1955 .drv = GPIOMUX_DRV_2MA,
1956 .pull = GPIOMUX_PULL_DOWN,
1957};
1958
1959static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1960 {
1961 .gpio = MDP_VSYNC_GPIO,
1962 .settings = {
1963 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1964 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1965 },
1966 }
1967};
1968
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001969#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1970static struct gpiomux_setting hdmi_suspend_cfg = {
1971 .func = GPIOMUX_FUNC_GPIO,
1972 .drv = GPIOMUX_DRV_2MA,
1973 .pull = GPIOMUX_PULL_DOWN,
1974};
1975
1976static struct gpiomux_setting hdmi_active_1_cfg = {
1977 .func = GPIOMUX_FUNC_1,
1978 .drv = GPIOMUX_DRV_2MA,
1979 .pull = GPIOMUX_PULL_UP,
1980};
1981
1982static struct gpiomux_setting hdmi_active_2_cfg = {
1983 .func = GPIOMUX_FUNC_1,
1984 .drv = GPIOMUX_DRV_2MA,
1985 .pull = GPIOMUX_PULL_DOWN,
1986};
1987
1988static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1989 {
1990 .gpio = 99,
1991 .settings = {
1992 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1993 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1994 },
1995 },
1996 {
1997 .gpio = 100,
1998 .settings = {
1999 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2000 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2001 },
2002 },
2003 {
2004 .gpio = 101,
2005 .settings = {
2006 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2007 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2008 },
2009 },
2010 {
2011 .gpio = 102,
2012 .settings = {
2013 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2014 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2015 },
2016 },
2017};
2018
2019static int hdmi_enable_5v(int on)
2020{
2021 /* TBD: PM8921 regulator instead of 8901 */
2022 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2023 static int prev_on;
2024 int rc;
2025
2026 if (on == prev_on)
2027 return 0;
2028
2029 if (!reg_8921_hdmi_mvs)
2030 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2031 "hdmi_mvs");
2032
2033 if (on) {
2034 rc = regulator_enable(reg_8921_hdmi_mvs);
2035 if (rc) {
2036 pr_err("'%s' regulator enable failed, rc=%d\n",
2037 "8921_hdmi_mvs", rc);
2038 return rc;
2039 }
2040 pr_debug("%s(on): success\n", __func__);
2041 } else {
2042 rc = regulator_disable(reg_8921_hdmi_mvs);
2043 if (rc)
2044 pr_warning("'%s' regulator disable failed, rc=%d\n",
2045 "8921_hdmi_mvs", rc);
2046 pr_debug("%s(off): success\n", __func__);
2047 }
2048
2049 prev_on = on;
2050
2051 return 0;
2052}
2053
2054static int hdmi_core_power(int on, int show)
2055{
2056 static struct regulator *reg_8921_l23, *reg_8921_s4;
2057 static int prev_on;
2058 int rc;
2059
2060 if (on == prev_on)
2061 return 0;
2062
2063 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002064 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002065 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002066 if (IS_ERR(reg_8921_l23)) {
2067 pr_err("could not get reg_8921_l23, rc = %ld\n",
2068 PTR_ERR(reg_8921_l23));
2069 return -ENODEV;
2070 }
2071 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2072 if (rc) {
2073 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2074 return -EINVAL;
2075 }
2076 }
2077 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002078 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002079 if (IS_ERR(reg_8921_s4)) {
2080 pr_err("could not get reg_8921_s4, rc = %ld\n",
2081 PTR_ERR(reg_8921_s4));
2082 return -ENODEV;
2083 }
2084 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2085 if (rc) {
2086 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2087 return -EINVAL;
2088 }
2089 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002090
2091 if (on) {
2092 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2093 if (rc < 0) {
2094 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2095 return -EINVAL;
2096 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002097 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002098 if (rc) {
2099 pr_err("'%s' regulator enable failed, rc=%d\n",
2100 "hdmi_avdd", rc);
2101 return rc;
2102 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002103 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002104 if (rc) {
2105 pr_err("'%s' regulator enable failed, rc=%d\n",
2106 "hdmi_vcc", rc);
2107 return rc;
2108 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002109 rc = gpio_request(100, "HDMI_DDC_CLK");
2110 if (rc) {
2111 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2112 "HDMI_DDC_CLK", 100, rc);
2113 goto error1;
2114 }
2115 rc = gpio_request(101, "HDMI_DDC_DATA");
2116 if (rc) {
2117 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2118 "HDMI_DDC_DATA", 101, rc);
2119 goto error2;
2120 }
2121 rc = gpio_request(102, "HDMI_HPD");
2122 if (rc) {
2123 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2124 "HDMI_HPD", 102, rc);
2125 goto error3;
2126 }
2127 pr_debug("%s(on): success\n", __func__);
2128 } else {
2129 gpio_free(100);
2130 gpio_free(101);
2131 gpio_free(102);
2132
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002133 rc = regulator_disable(reg_8921_l23);
2134 if (rc) {
2135 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2136 return -ENODEV;
2137 }
2138 rc = regulator_disable(reg_8921_s4);
2139 if (rc) {
2140 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2141 return -ENODEV;
2142 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002143 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2144 if (rc < 0) {
2145 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2146 return -EINVAL;
2147 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002148 pr_debug("%s(off): success\n", __func__);
2149 }
2150
2151 prev_on = on;
2152
2153 return 0;
2154
2155error3:
2156 gpio_free(101);
2157error2:
2158 gpio_free(100);
2159error1:
2160 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002161 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002162 return rc;
2163}
2164
2165static int hdmi_cec_power(int on)
2166{
2167 static int prev_on;
2168 int rc;
2169
2170 if (on == prev_on)
2171 return 0;
2172
2173 if (on) {
2174 rc = gpio_request(99, "HDMI_CEC_VAR");
2175 if (rc) {
2176 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2177 "HDMI_CEC_VAR", 99, rc);
2178 goto error;
2179 }
2180 pr_debug("%s(on): success\n", __func__);
2181 } else {
2182 gpio_free(99);
2183 pr_debug("%s(off): success\n", __func__);
2184 }
2185
2186 prev_on = on;
2187
2188 return 0;
2189error:
2190 return rc;
2191}
2192#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2193
2194static void __init msm8960_allocate_memory_regions(void)
2195{
2196 void *addr;
2197 unsigned long size;
2198
2199 size = MSM_FB_SIZE;
2200 addr = alloc_bootmem_align(size, 0x1000);
2201 msm_fb_resources[0].start = __pa(addr);
2202 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2203 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2204 size, addr, __pa(addr));
2205
2206}
2207#ifdef CONFIG_WCD9310_CODEC
2208
2209#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2210
Patrick Lai3043fba2011-08-01 14:15:57 -07002211/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2212 * 4 micbiases are used to power various analog and digital
2213 * microphones operating at 1800 mV. Technically, all micbiases
2214 * can source from single cfilter since all microphones operate
2215 * at the same voltage level. The arrangement below is to make
2216 * sure all cfilters are exercised. LDO_H regulator ouput level
2217 * does not need to be as high as 2.85V. It is choosen for
2218 * microphone sensitivity purpose.
2219 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002220static struct tabla_pdata tabla_platform_data = {
2221 .slimbus_slave_device = {
2222 .name = "tabla-slave",
2223 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2224 },
2225 .irq = MSM_GPIO_TO_INT(62),
2226 .irq_base = TABLA_INTERRUPT_BASE,
2227 .num_irqs = NR_TABLA_IRQS,
2228 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002229 .micbias = {
2230 .ldoh_v = TABLA_LDOH_2P85_V,
2231 .cfilt1_mv = 1800,
2232 .cfilt2_mv = 1800,
2233 .cfilt3_mv = 1800,
2234 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2235 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2236 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2237 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2238 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002239};
2240
2241static struct slim_device msm_slim_tabla = {
2242 .name = "tabla-slim",
2243 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2244 .dev = {
2245 .platform_data = &tabla_platform_data,
2246 },
2247};
2248#endif
2249
2250static struct slim_boardinfo msm_slim_devices[] = {
2251#ifdef CONFIG_WCD9310_CODEC
2252 {
2253 .bus_num = 1,
2254 .slim_slave = &msm_slim_tabla,
2255 },
2256#endif
2257 /* add more slimbus slaves as needed */
2258};
2259
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002260#define MSM_WCNSS_PHYS 0x03000000
2261#define MSM_WCNSS_SIZE 0x280000
2262
2263static struct resource resources_wcnss_wlan[] = {
2264 {
2265 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2266 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2267 .name = "wcnss_wlanrx_irq",
2268 .flags = IORESOURCE_IRQ,
2269 },
2270 {
2271 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2272 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2273 .name = "wcnss_wlantx_irq",
2274 .flags = IORESOURCE_IRQ,
2275 },
2276 {
2277 .start = MSM_WCNSS_PHYS,
2278 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2279 .name = "wcnss_mmio",
2280 .flags = IORESOURCE_MEM,
2281 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002282 {
2283 .start = 84,
2284 .end = 88,
2285 .name = "wcnss_gpios_5wire",
2286 .flags = IORESOURCE_IO,
2287 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002288};
2289
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002290static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2291 .has_48mhz_xo = 1,
2292};
2293
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002294static struct platform_device msm_device_wcnss_wlan = {
2295 .name = "wcnss_wlan",
2296 .id = 0,
2297 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2298 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002299 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002300};
2301
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002302#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2303 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2304 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2305 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2306
2307#define QCE_SIZE 0x10000
2308#define QCE_0_BASE 0x18500000
2309
2310#define QCE_HW_KEY_SUPPORT 0
2311#define QCE_SHA_HMAC_SUPPORT 1
2312#define QCE_SHARE_CE_RESOURCE 1
2313#define QCE_CE_SHARED 0
2314
2315static struct resource qcrypto_resources[] = {
2316 [0] = {
2317 .start = QCE_0_BASE,
2318 .end = QCE_0_BASE + QCE_SIZE - 1,
2319 .flags = IORESOURCE_MEM,
2320 },
2321 [1] = {
2322 .name = "crypto_channels",
2323 .start = DMOV_CE_IN_CHAN,
2324 .end = DMOV_CE_OUT_CHAN,
2325 .flags = IORESOURCE_DMA,
2326 },
2327 [2] = {
2328 .name = "crypto_crci_in",
2329 .start = DMOV_CE_IN_CRCI,
2330 .end = DMOV_CE_IN_CRCI,
2331 .flags = IORESOURCE_DMA,
2332 },
2333 [3] = {
2334 .name = "crypto_crci_out",
2335 .start = DMOV_CE_OUT_CRCI,
2336 .end = DMOV_CE_OUT_CRCI,
2337 .flags = IORESOURCE_DMA,
2338 },
2339};
2340
2341static struct resource qcedev_resources[] = {
2342 [0] = {
2343 .start = QCE_0_BASE,
2344 .end = QCE_0_BASE + QCE_SIZE - 1,
2345 .flags = IORESOURCE_MEM,
2346 },
2347 [1] = {
2348 .name = "crypto_channels",
2349 .start = DMOV_CE_IN_CHAN,
2350 .end = DMOV_CE_OUT_CHAN,
2351 .flags = IORESOURCE_DMA,
2352 },
2353 [2] = {
2354 .name = "crypto_crci_in",
2355 .start = DMOV_CE_IN_CRCI,
2356 .end = DMOV_CE_IN_CRCI,
2357 .flags = IORESOURCE_DMA,
2358 },
2359 [3] = {
2360 .name = "crypto_crci_out",
2361 .start = DMOV_CE_OUT_CRCI,
2362 .end = DMOV_CE_OUT_CRCI,
2363 .flags = IORESOURCE_DMA,
2364 },
2365};
2366
2367#endif
2368
2369#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2370 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2371
2372static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2373 .ce_shared = QCE_CE_SHARED,
2374 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2375 .hw_key_support = QCE_HW_KEY_SUPPORT,
2376 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2377};
2378
2379static struct platform_device qcrypto_device = {
2380 .name = "qcrypto",
2381 .id = 0,
2382 .num_resources = ARRAY_SIZE(qcrypto_resources),
2383 .resource = qcrypto_resources,
2384 .dev = {
2385 .coherent_dma_mask = DMA_BIT_MASK(32),
2386 .platform_data = &qcrypto_ce_hw_suppport,
2387 },
2388};
2389#endif
2390
2391#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2392 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2393
2394static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2395 .ce_shared = QCE_CE_SHARED,
2396 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2397 .hw_key_support = QCE_HW_KEY_SUPPORT,
2398 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2399};
2400
2401static struct platform_device qcedev_device = {
2402 .name = "qce",
2403 .id = 0,
2404 .num_resources = ARRAY_SIZE(qcedev_resources),
2405 .resource = qcedev_resources,
2406 .dev = {
2407 .coherent_dma_mask = DMA_BIT_MASK(32),
2408 .platform_data = &qcedev_ce_hw_suppport,
2409 },
2410};
2411#endif
2412
2413
2414static int __init gpiomux_init(void)
2415{
2416 int rc;
2417
2418 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2419 if (rc) {
2420 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2421 return rc;
2422 }
2423
Nishant Pandit24153d82011-08-27 16:05:13 +05302424 msm_gpiomux_install(msm8960_cam_common_configs,
2425 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002426
2427 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002428 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002429
2430 msm_gpiomux_install(msm8960_gsbi_configs,
2431 ARRAY_SIZE(msm8960_gsbi_configs));
2432
2433 msm_gpiomux_install(msm8960_cyts_configs,
2434 ARRAY_SIZE(msm8960_cyts_configs));
2435
2436 msm_gpiomux_install(msm8960_slimbus_config,
2437 ARRAY_SIZE(msm8960_slimbus_config));
2438
2439 msm_gpiomux_install(msm8960_audio_codec_configs,
2440 ARRAY_SIZE(msm8960_audio_codec_configs));
2441
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002442 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2443 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2444
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002445#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2446 msm_gpiomux_install(msm8960_hdmi_configs,
2447 ARRAY_SIZE(msm8960_hdmi_configs));
2448#endif
2449
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002450 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2451 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2452
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002453 msm_gpiomux_install(wcnss_5wire_interface,
2454 ARRAY_SIZE(wcnss_5wire_interface));
2455
2456 return 0;
2457}
2458
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002459#define MSM_SHARED_RAM_PHYS 0x80000000
2460
2461static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2462 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2463 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2464 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2465 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2466 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2467 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2468 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2469 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2470 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2471 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2472 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2473 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002474 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2475 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2476 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2477 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2478 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2479 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2480 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2481 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2482 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2483 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2484 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2485 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2486 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2487 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002488 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002489 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2490 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2491 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002492 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2493 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002494};
2495
2496static struct pm8921_adc_properties pm8921_adc_data = {
2497 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2498 .bitresolution = 15,
2499 .bipolar = 0,
2500};
2501
2502static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2503 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002504 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002505 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002506 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002507};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002508
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002509static void __init msm8960_map_io(void)
2510{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002511 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002512 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002513
2514 if (socinfo_init() < 0)
2515 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002516}
2517
2518static void __init msm8960_init_irq(void)
2519{
2520 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002521
2522 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002523 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002524 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002525
2526 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002527 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002528
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002529 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2530 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002531
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002532 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2533 * as they are configured as level, which does not play nice with
2534 * handle_percpu_irq.
2535 */
2536 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2537 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002538 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002539 }
2540}
2541
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002542/* MSM8960 have 5 SDCC controllers */
2543enum sdcc_controllers {
2544 SDCC1,
2545 SDCC2,
2546 SDCC3,
2547 SDCC4,
2548 SDCC5,
2549 MAX_SDCC_CONTROLLER
2550};
2551
2552/* All SDCC controllers requires VDD/VCC voltage */
2553static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2554 /* SDCC1 : eMMC card connected */
2555 [SDCC1] = {
2556 .name = "sdc_vdd",
2557 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302558 .high_vol_level = 2950000,
2559 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302560 .always_on = 1,
2561 .lpm_sup = 1,
2562 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002563 .hpm_uA = 200000, /* 200mA */
2564 },
2565 /* SDCC3 : External card slot connected */
2566 [SDCC3] = {
2567 .name = "sdc_vdd",
2568 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302569 .high_vol_level = 2950000,
2570 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002571 .hpm_uA = 600000, /* 600mA */
2572 }
2573};
2574
2575/* Only slots having eMMC card will require VCCQ voltage */
2576static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2577 /* SDCC1 : eMMC card connected */
2578 [SDCC1] = {
2579 .name = "sdc_vccq",
2580 .set_voltage_sup = 1,
2581 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302582 .high_vol_level = 1800000,
2583 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002584 .hpm_uA = 200000, /* 200mA */
2585 }
2586};
2587
2588/* All SDCC controllers may require voting for VDD PAD voltage */
2589static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2590 /* SDCC3 : External card slot connected */
2591 [SDCC3] = {
2592 .name = "sdc_vddp",
2593 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302594 .high_vol_level = 2950000,
2595 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002596 .always_on = 1,
2597 .lpm_sup = 1,
2598 /* Max. Active current required is 16 mA */
2599 .hpm_uA = 16000,
2600 /*
2601 * Sleep current required is ~300 uA. But min. vote can be
2602 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2603 * during sleep.
2604 */
2605 .lpm_uA = 2000,
2606 }
2607};
2608
2609static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2610 /* SDCC1 : eMMC card connected */
2611 [SDCC1] = {
2612 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2613 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2614 },
2615 /* SDCC3 : External card slot connected */
2616 [SDCC3] = {
2617 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2618 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2619 }
2620};
2621
2622/* SDC1 pad data */
2623static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2624 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302625 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2626 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002627};
2628
2629static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2630 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2631 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2632 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2633};
2634
2635static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302636 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002637 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2638 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2639};
2640
2641static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302642 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002643 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2644 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2645};
2646
2647/* SDC3 pad data */
2648static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2649 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2650 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2651 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2652};
2653
2654static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2655 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2656 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2657 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2658};
2659
2660static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302661 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002662 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2663 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2664};
2665
2666static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302667 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002668 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2669 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2670};
2671
2672struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2673 [SDCC1] = {
2674 .on = sdc1_pad_pull_on_cfg,
2675 .off = sdc1_pad_pull_off_cfg,
2676 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2677 },
2678 [SDCC3] = {
2679 .on = sdc3_pad_pull_on_cfg,
2680 .off = sdc3_pad_pull_off_cfg,
2681 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2682 },
2683};
2684
2685struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2686 [SDCC1] = {
2687 .on = sdc1_pad_drv_on_cfg,
2688 .off = sdc1_pad_drv_off_cfg,
2689 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2690 },
2691 [SDCC3] = {
2692 .on = sdc3_pad_drv_on_cfg,
2693 .off = sdc3_pad_drv_off_cfg,
2694 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2695 },
2696};
2697
2698struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2699 [SDCC1] = {
2700 .pull = &mmc_pad_pull_data[SDCC1],
2701 .drv = &mmc_pad_drv_data[SDCC1]
2702 },
2703 [SDCC3] = {
2704 .pull = &mmc_pad_pull_data[SDCC3],
2705 .drv = &mmc_pad_drv_data[SDCC3]
2706 },
2707};
2708
2709struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2710 [SDCC1] = {
2711 .pad_data = &mmc_pad_data[SDCC1],
2712 },
2713 [SDCC3] = {
2714 .pad_data = &mmc_pad_data[SDCC3],
2715 },
2716};
2717
2718static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302719 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002720};
2721
2722static unsigned int sdc3_sup_clk_rates[] = {
2723 400000, 24000000, 48000000, 96000000
2724};
2725
2726#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2727static struct mmc_platform_data msm8960_sdc1_data = {
2728 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2729#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2730 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2731#else
2732 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2733#endif
2734 .sup_clk_table = sdc1_sup_clk_rates,
2735 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302736 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002737 .nonremovable = 1,
2738 .sdcc_v4_sup = true,
2739 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302740 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002741};
2742#endif
2743
2744#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2745static struct mmc_platform_data msm8960_sdc3_data = {
2746 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2747 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2748 .sup_clk_table = sdc3_sup_clk_rates,
2749 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302750 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302751#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002752 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302753#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002754 .sdcc_v4_sup = true,
2755 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2756 .pin_data = &mmc_slot_pin_data[SDCC3],
2757#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2758 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2759 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2760 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2761#endif
2762 .xpc_cap = 1,
2763 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2764 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302765 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002766};
2767#endif
2768
2769static void __init msm8960_init_mmc(void)
2770{
2771#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2772 /* SDC1 : eMMC card connected */
2773 msm_add_sdcc(1, &msm8960_sdc1_data);
2774#endif
2775#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2776 /* SDC3: External card slot */
2777 msm_add_sdcc(3, &msm8960_sdc3_data);
2778#endif
2779}
2780
2781static void __init msm8960_init_buses(void)
2782{
2783#ifdef CONFIG_MSM_BUS_SCALING
2784 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2785 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2786 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2787 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2788 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2789 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2790 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2791 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2792 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2793 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
Gagan Macdc1dc142011-09-16 15:13:35 -06002794 msm_bus_rpm_set_mt_mask();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002795#endif
2796}
2797
2798static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2799 .max_clock_speed = 15060000,
2800};
2801
2802#ifdef CONFIG_USB_MSM_OTG_72K
2803static struct msm_otg_platform_data msm_otg_pdata;
2804#else
2805#define USB_5V_EN 42
2806static void msm_hsusb_vbus_power(bool on)
2807{
2808 int rc;
2809 static bool vbus_is_on;
2810 static struct regulator *mvs_otg_switch;
2811 struct pm_gpio param = {
2812 .direction = PM_GPIO_DIR_OUT,
2813 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2814 .output_value = 1,
2815 .pull = PM_GPIO_PULL_NO,
2816 .vin_sel = PM_GPIO_VIN_S4,
2817 .out_strength = PM_GPIO_STRENGTH_MED,
2818 .function = PM_GPIO_FUNC_NORMAL,
2819 };
2820
2821 if (vbus_is_on == on)
2822 return;
2823
2824 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002825 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2826 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002827 if (IS_ERR(mvs_otg_switch)) {
2828 pr_err("Unable to get mvs_otg_switch\n");
2829 return;
2830 }
2831
2832 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2833 "usb_5v_en");
2834 if (rc < 0) {
2835 pr_err("failed to request usb_5v_en gpio\n");
2836 goto put_mvs_otg;
2837 }
2838
2839 if (regulator_enable(mvs_otg_switch)) {
2840 pr_err("unable to enable mvs_otg_switch\n");
2841 goto free_usb_5v_en;
2842 }
2843
2844 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2845 &param);
2846 if (rc < 0) {
2847 pr_err("failed to configure usb_5v_en gpio\n");
2848 goto disable_mvs_otg;
2849 }
2850 vbus_is_on = true;
2851 return;
2852 }
2853disable_mvs_otg:
2854 regulator_disable(mvs_otg_switch);
2855free_usb_5v_en:
2856 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2857put_mvs_otg:
2858 regulator_put(mvs_otg_switch);
2859 vbus_is_on = false;
2860}
2861
2862static struct msm_otg_platform_data msm_otg_pdata = {
2863 .mode = USB_OTG,
2864 .otg_control = OTG_PMIC_CONTROL,
2865 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2866 .pclk_src_name = "dfab_usb_hs_clk",
2867 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2868 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302869 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002870};
2871#endif
2872
2873#define PID_MAGIC_ID 0x71432909
2874#define SERIAL_NUM_MAGIC_ID 0x61945374
2875#define SERIAL_NUMBER_LENGTH 127
2876#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2877
2878struct magic_num_struct {
2879 uint32_t pid;
2880 uint32_t serial_num;
2881};
2882
2883struct dload_struct {
2884 uint32_t reserved1;
2885 uint32_t reserved2;
2886 uint32_t reserved3;
2887 uint16_t reserved4;
2888 uint16_t pid;
2889 char serial_number[SERIAL_NUMBER_LENGTH];
2890 uint16_t reserved5;
2891 struct magic_num_struct magic_struct;
2892};
2893
2894static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2895{
2896 struct dload_struct __iomem *dload = 0;
2897
2898 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2899 if (!dload) {
2900 pr_err("%s: cannot remap I/O memory region: %08x\n",
2901 __func__, DLOAD_USB_BASE_ADD);
2902 return -ENXIO;
2903 }
2904
2905 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2906 __func__, dload, pid, snum);
2907 /* update pid */
2908 dload->magic_struct.pid = PID_MAGIC_ID;
2909 dload->pid = pid;
2910
2911 /* update serial number */
2912 dload->magic_struct.serial_num = 0;
2913 if (!snum) {
2914 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2915 goto out;
2916 }
2917
2918 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2919 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2920 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2921out:
2922 iounmap(dload);
2923 return 0;
2924}
2925
2926static struct android_usb_platform_data android_usb_pdata = {
2927 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2928};
2929
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002930static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002931 .name = "android_usb",
2932 .id = -1,
2933 .dev = {
2934 .platform_data = &android_usb_pdata,
2935 },
2936};
2937
2938static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2939 0x03, 0x0f,
2940};
2941
2942static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2943 0x00, 0x24, 0x54, 0x10,
2944 0x09, 0x03, 0x01,
2945 0x10, 0x54, 0x30, 0x0C,
2946 0x24, 0x30, 0x0f,
2947};
2948
2949static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2950 0x00, 0x24, 0x54, 0x10,
2951 0x09, 0x07, 0x01, 0x0B,
2952 0x10, 0x54, 0x30, 0x0C,
2953 0x24, 0x30, 0x0f,
2954};
2955
2956static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2957 [0] = {
2958 .mode = MSM_SPM_MODE_CLOCK_GATING,
2959 .notify_rpm = false,
2960 .cmd = spm_wfi_cmd_sequence,
2961 },
2962 [1] = {
2963 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2964 .notify_rpm = false,
2965 .cmd = spm_power_collapse_without_rpm,
2966 },
2967 [2] = {
2968 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2969 .notify_rpm = true,
2970 .cmd = spm_power_collapse_with_rpm,
2971 },
2972};
2973
2974static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2975 [0] = {
2976 .reg_base_addr = MSM_SAW0_BASE,
2977 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2978 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2979 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2980#if defined(CONFIG_MSM_AVS_HW)
2981 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2982 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2983#endif
2984 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2985 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2986 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2987 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2988 .vctl_timeout_us = 50,
2989 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2990 .modes = msm_spm_seq_list,
2991 },
2992 [1] = {
2993 .reg_base_addr = MSM_SAW1_BASE,
2994 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2995 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2996 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2997#if defined(CONFIG_MSM_AVS_HW)
2998 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2999 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3000#endif
3001 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3002 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3003 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3004 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3005 .vctl_timeout_us = 50,
3006 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3007 .modes = msm_spm_seq_list,
3008 },
3009};
3010
3011static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3012 0x00, 0x20, 0x03, 0x20,
3013 0x00, 0x0f,
3014};
3015
3016static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3017 0x00, 0x20, 0x34, 0x64,
3018 0x48, 0x07, 0x48, 0x20,
3019 0x50, 0x64, 0x04, 0x34,
3020 0x50, 0x0f,
3021};
3022static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3023 0x00, 0x10, 0x34, 0x64,
3024 0x48, 0x07, 0x48, 0x10,
3025 0x50, 0x64, 0x04, 0x34,
3026 0x50, 0x0F,
3027};
3028
3029static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3030 [0] = {
3031 .mode = MSM_SPM_L2_MODE_RETENTION,
3032 .notify_rpm = false,
3033 .cmd = l2_spm_wfi_cmd_sequence,
3034 },
3035 [1] = {
3036 .mode = MSM_SPM_L2_MODE_GDHS,
3037 .notify_rpm = true,
3038 .cmd = l2_spm_gdhs_cmd_sequence,
3039 },
3040 [2] = {
3041 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3042 .notify_rpm = true,
3043 .cmd = l2_spm_power_off_cmd_sequence,
3044 },
3045};
3046
3047
3048static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3049 [0] = {
3050 .reg_base_addr = MSM_SAW_L2_BASE,
3051 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3052 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3053 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3054 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3055 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3056 .modes = msm_spm_l2_seq_list,
3057 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3058 },
3059};
3060
3061#define CYTTSP_TS_GPIO_IRQ 11
3062#define CYTTSP_TS_SLEEP_GPIO 50
3063#define CYTTSP_TS_RESOUT_N_GPIO 52
3064
3065/*virtual key support */
3066static ssize_t tma340_vkeys_show(struct kobject *kobj,
3067 struct kobj_attribute *attr, char *buf)
3068{
3069 return snprintf(buf, 200,
3070 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3071 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3072 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3073 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3074 "\n");
3075}
3076
3077static struct kobj_attribute tma340_vkeys_attr = {
3078 .attr = {
3079 .mode = S_IRUGO,
3080 },
3081 .show = &tma340_vkeys_show,
3082};
3083
3084static struct attribute *tma340_properties_attrs[] = {
3085 &tma340_vkeys_attr.attr,
3086 NULL
3087};
3088
3089static struct attribute_group tma340_properties_attr_group = {
3090 .attrs = tma340_properties_attrs,
3091};
3092
3093
3094static int cyttsp_platform_init(struct i2c_client *client)
3095{
3096 int rc = 0;
3097 static struct kobject *tma340_properties_kobj;
3098
3099 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3100 tma340_properties_kobj = kobject_create_and_add("board_properties",
3101 NULL);
3102 if (tma340_properties_kobj)
3103 rc = sysfs_create_group(tma340_properties_kobj,
3104 &tma340_properties_attr_group);
3105 if (!tma340_properties_kobj || rc)
3106 pr_err("%s: failed to create board_properties\n",
3107 __func__);
3108
3109 return 0;
3110}
3111
3112static struct cyttsp_regulator regulator_data[] = {
3113 {
3114 .name = "vdd",
3115 .min_uV = CY_TMA300_VTG_MIN_UV,
3116 .max_uV = CY_TMA300_VTG_MAX_UV,
3117 .load_uA = CY_TMA300_CURR_24HZ_UA,
3118 },
3119 /* TODO: Remove after runtime PM is enabled in I2C driver */
3120 {
3121 .name = "vcc_i2c",
3122 .min_uV = CY_I2C_VTG_MIN_UV,
3123 .max_uV = CY_I2C_VTG_MAX_UV,
3124 .load_uA = CY_I2C_CURR_UA,
3125 },
3126};
3127
3128static struct cyttsp_platform_data cyttsp_pdata = {
3129 .panel_maxx = 634,
3130 .panel_maxy = 1166,
3131 .disp_maxx = 616,
3132 .disp_maxy = 1023,
3133 .disp_minx = 0,
3134 .disp_miny = 16,
3135 .flags = 0x01,
3136 .gen = CY_GEN3, /* or */
3137 .use_st = CY_USE_ST,
3138 .use_mt = CY_USE_MT,
3139 .use_hndshk = CY_SEND_HNDSHK,
3140 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303141 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003142 .use_gestures = CY_USE_GESTURES,
3143 .fw_fname = "cyttsp_8960_cdp.hex",
3144 /* activate up to 4 groups
3145 * and set active distance
3146 */
3147 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3148 CY_GEST_GRP3 | CY_GEST_GRP4 |
3149 CY_ACT_DIST,
3150 /* change act_intrvl to customize the Active power state
3151 * scanning/processing refresh interval for Operating mode
3152 */
3153 .act_intrvl = CY_ACT_INTRVL_DFLT,
3154 /* change tch_tmout to customize the touch timeout for the
3155 * Active power state for Operating mode
3156 */
3157 .tch_tmout = CY_TCH_TMOUT_DFLT,
3158 /* change lp_intrvl to customize the Low Power power state
3159 * scanning/processing refresh interval for Operating mode
3160 */
3161 .lp_intrvl = CY_LP_INTRVL_DFLT,
3162 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3163 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3164 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3165 .regulator_info = regulator_data,
3166 .num_regulators = ARRAY_SIZE(regulator_data),
3167 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303168 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003169};
3170
3171static struct i2c_board_info cyttsp_info[] __initdata = {
3172 {
3173 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3174 .platform_data = &cyttsp_pdata,
3175#ifndef CY_USE_TIMER
3176 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3177#endif /* CY_USE_TIMER */
3178 },
3179};
3180
Mohan Pallaka50837382011-09-07 11:00:57 +05303181/* configuration data */
3182static const u8 mxt_config_data[] = {
3183 /* T6 Object */
3184 0, 0, 0, 0, 0, 0,
3185 /* T38 Object */
3186 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
3187 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3188 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3189 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3190 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3191 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3192 0, 0, 0, 0,
3193 /* T7 Object */
3194 10, 10, 50,
3195 /* T8 Object */
3196 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3197 /* T9 Object */
3198 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3199 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3200 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3201 0, 5, 45, 46,
3202 /* T15 Object */
3203 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3204 0,
3205 /* T22 Object */
3206 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3207 0, 0, 255, 255, 255, 255, 0,
3208 /* T24 Object */
3209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3210 0, 0, 0, 0, 0, 0, 0, 0, 0,
3211 /* T25 Object */
3212 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3213 0, 0, 0, 0,
3214 /* T27 Object */
3215 0, 0, 0, 0, 0, 0, 0,
3216 /* T28 Object */
3217 0, 0, 0, 8, 8, 8,
3218 /* T40 Object */
3219 0, 0, 0, 0, 0,
3220 /* T41 Object */
3221 0, 0, 0, 0, 0, 0,
3222 /* T43 Object */
3223 0, 0, 0, 0, 0, 0,
3224};
3225
3226#define MXT_TS_GPIO_IRQ 11
3227#define MXT_TS_LDO_EN_GPIO 50
3228#define MXT_TS_RESET_GPIO 52
3229
3230static void mxt_init_hw_liquid(void)
3231{
3232 int rc;
3233
3234 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3235 if (rc) {
3236 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3237 __func__, MXT_TS_GPIO_IRQ);
3238 return;
3239 }
3240
3241 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3242 if (rc) {
3243 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3244 __func__, MXT_TS_GPIO_IRQ);
3245 goto err_irq_gpio_req;
3246 }
3247
3248 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3249 if (rc) {
3250 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3251 __func__, MXT_TS_LDO_EN_GPIO);
3252 goto err_irq_gpio_req;
3253 }
3254
3255 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3256 if (rc) {
3257 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3258 __func__, MXT_TS_LDO_EN_GPIO);
3259 goto err_ldo_gpio_req;
3260 }
3261
3262 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3263 if (rc) {
3264 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3265 __func__, MXT_TS_RESET_GPIO);
3266 goto err_ldo_gpio_set_dir;
3267 }
3268
3269 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3270 if (rc) {
3271 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3272 __func__, MXT_TS_RESET_GPIO);
3273 goto err_reset_gpio_req;
3274 }
3275
3276 return;
3277
3278err_reset_gpio_req:
3279 gpio_free(MXT_TS_RESET_GPIO);
3280err_ldo_gpio_set_dir:
3281 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3282err_ldo_gpio_req:
3283 gpio_free(MXT_TS_LDO_EN_GPIO);
3284err_irq_gpio_req:
3285 gpio_free(MXT_TS_GPIO_IRQ);
3286}
3287
3288static struct mxt_platform_data mxt_platform_data = {
3289 .config = mxt_config_data,
3290 .config_length = ARRAY_SIZE(mxt_config_data),
3291 .x_line = 26,
3292 .y_line = 42,
3293 .x_size = 767,
3294 .y_size = 1365,
3295 .blen = 32,
3296 .threshold = 40,
3297 .voltage = 3300000, /* 3.3V */
3298 .orient = MXT_ROTATED_90,
3299 .irqflags = IRQF_TRIGGER_FALLING,
3300};
3301
3302static struct i2c_board_info mxt_device_info[] __initdata = {
3303 {
3304 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3305 .platform_data = &mxt_platform_data,
3306 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3307 },
3308};
3309
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003310static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3311{
3312}
3313
3314static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3315 .clk_freq = 100000,
3316 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003317 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3318};
3319
3320static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3321 .clk_freq = 100000,
3322 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003323 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3324};
3325
3326static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3327 .clk_freq = 100000,
3328 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003329 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3330};
3331
3332static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3333 .clk_freq = 100000,
3334 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003335 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3336};
3337
3338static struct msm_rpm_platform_data msm_rpm_data = {
3339 .reg_base_addrs = {
3340 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3341 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3342 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3343 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3344 },
3345
3346 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3347 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3348 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3349 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3350 .msm_apps_ipc_rpm_val = 4,
3351};
3352
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003353static struct ks8851_pdata spi_eth_pdata = {
3354 .irq_gpio = KS8851_IRQ_GPIO,
3355 .rst_gpio = KS8851_RST_GPIO,
3356};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003357
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003358static struct spi_board_info spi_board_info[] __initdata = {
3359 {
3360 .modalias = "ks8851",
3361 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3362 .max_speed_hz = 19200000,
3363 .bus_num = 0,
3364 .chip_select = 0,
3365 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003366 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003367 },
3368};
3369
3370static struct platform_device msm_device_saw_core0 = {
3371 .name = "saw-regulator",
3372 .id = 0,
3373 .dev = {
3374 .platform_data = &msm_saw_regulator_pdata_s5,
3375 },
3376};
3377
3378static struct platform_device msm_device_saw_core1 = {
3379 .name = "saw-regulator",
3380 .id = 1,
3381 .dev = {
3382 .platform_data = &msm_saw_regulator_pdata_s6,
3383 },
3384};
3385
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003386static struct tsens_platform_data msm_tsens_pdata = {
3387 .slope = 910,
3388 .tsens_factor = 1000,
3389 .hw_type = MSM_8960,
3390 .tsens_num_sensor = 5,
3391};
3392
3393static struct platform_device msm_tsens_device = {
3394 .name = "tsens8960-tm",
3395 .id = -1,
3396 .dev = {
3397 .platform_data = &msm_tsens_pdata,
3398 },
3399};
3400
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003401#ifdef CONFIG_MSM_FAKE_BATTERY
3402static struct platform_device fish_battery_device = {
3403 .name = "fish_battery",
3404};
3405#endif
3406
David Collins26f05562011-06-20 09:56:28 -07003407static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003408 .name = GPIO_REGULATOR_DEV_NAME,
3409 .id = PM8921_MPP_PM_TO_SYS(7),
3410 .dev = {
3411 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3412 },
3413};
3414
David Collins26f05562011-06-20 09:56:28 -07003415static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003416 .name = GPIO_REGULATOR_DEV_NAME,
3417 .id = 91,
3418 .dev = {
3419 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3420 },
3421};
3422
David Collinsb10be1d2011-09-02 10:29:31 -07003423static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3424 .name = GPIO_REGULATOR_DEV_NAME,
3425 .id = PM8921_GPIO_PM_TO_SYS(17),
3426 .dev = {
3427 .platform_data =
3428 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3429 },
3430};
3431
David Collins26f05562011-06-20 09:56:28 -07003432static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3433 .name = "rpm-regulator",
3434 .id = -1,
3435 .dev = {
3436 .platform_data = &msm_rpm_regulator_pdata,
3437 },
3438};
3439
David Collins4c31a872011-08-31 10:07:10 -07003440static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3441 .phys_addr_base = 0x0010C000,
3442 .reg_offsets = {
3443 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3444 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3445 },
3446 .phys_size = SZ_8K,
3447 .log_len = 4096, /* log's buffer length in bytes */
3448 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3449};
3450
3451static struct platform_device msm_rpm_log_device = {
3452 .name = "msm_rpm_log",
3453 .id = -1,
3454 .dev = {
3455 .platform_data = &msm_rpm_log_pdata,
3456 },
3457};
3458
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003459static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003460 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003461 &msm_device_smd,
3462 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303463 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003464 &msm_device_saw_core0,
3465 &msm_device_saw_core1,
3466 &msm8960_device_ext_5v_vreg,
3467 &msm8960_device_ext_l2_vreg,
3468 &msm8960_device_ssbi_pm8921,
3469 &msm8960_device_qup_spi_gsbi1,
3470 &msm8960_device_qup_i2c_gsbi3,
3471 &msm8960_device_qup_i2c_gsbi4,
3472 &msm8960_device_qup_i2c_gsbi10,
3473#ifndef CONFIG_MSM_DSPS
3474 &msm8960_device_qup_i2c_gsbi12,
3475#endif
3476 &msm_slim_ctrl,
3477 &msm_device_wcnss_wlan,
3478#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3479 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3480 &qcrypto_device,
3481#endif
3482
3483#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3484 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3485 &qcedev_device,
3486#endif
3487#ifdef CONFIG_MSM_ROTATOR
3488 &msm_rotator_device,
3489#endif
3490 &msm_device_sps,
3491#ifdef CONFIG_MSM_FAKE_BATTERY
3492 &fish_battery_device,
3493#endif
3494#ifdef CONFIG_ANDROID_PMEM
3495 &android_pmem_device,
3496 &android_pmem_adsp_device,
3497 &android_pmem_audio_device,
3498#endif
3499 &msm_fb_device,
3500 &msm_device_vidc,
3501 &msm_device_bam_dmux,
3502 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003503
3504#ifdef CONFIG_HW_RANDOM_MSM
3505 &msm_device_rng,
3506#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003507 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003508#ifdef CONFIG_ION_MSM
3509 &ion_dev,
3510#endif
David Collins4c31a872011-08-31 10:07:10 -07003511 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003512#ifdef CONFIG_MSM_QDSS
3513 &msm_etb_device,
3514 &msm_tpiu_device,
3515 &msm_funnel_device,
3516 &msm_ptm_device,
3517#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003518};
3519
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003520static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003521 &msm8960_device_otg,
3522 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003523 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303524 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003525 &android_usb_device,
3526 &msm_device_vidc,
3527 &mipi_dsi_simulator_panel_device,
3528 &msm_bus_apps_fabric,
3529 &msm_bus_sys_fabric,
3530 &msm_bus_mm_fabric,
3531 &msm_bus_sys_fpb,
3532 &msm_bus_cpss_fpb,
3533 &msm_pcm,
3534 &msm_pcm_routing,
3535 &msm_cpudai0,
3536 &msm_cpudai1,
3537 &msm_cpudai_hdmi_rx,
3538 &msm_cpudai_bt_rx,
3539 &msm_cpudai_bt_tx,
3540 &msm_cpudai_fm_rx,
3541 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003542 &msm_cpudai_auxpcm_rx,
3543 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003544 &msm_cpu_fe,
3545 &msm_stub_codec,
3546 &msm_voice,
3547 &msm_voip,
3548 &msm_lpa_pcm,
3549
3550#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3551 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3552 &qcrypto_device,
3553#endif
3554
3555#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3556 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3557 &qcedev_device,
3558#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003559};
3560
3561static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003562 &msm_kgsl_3d0,
3563 &msm_kgsl_2d0,
3564 &msm_kgsl_2d1,
3565 &mipi_dsi_renesas_panel_device,
3566#ifdef CONFIG_MSM_GEMINI
3567 &msm8960_gemini_device,
3568#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003569};
3570
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003571static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003572 &msm8960_device_otg,
3573 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003574 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303575 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003576 &android_usb_device,
3577 &msm_pcm,
3578 &msm_pcm_routing,
3579 &msm_cpudai0,
3580 &msm_cpudai1,
3581 &msm_cpudai_hdmi_rx,
3582 &msm_cpudai_bt_rx,
3583 &msm_cpudai_bt_tx,
3584 &msm_cpudai_fm_rx,
3585 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003586 &msm_cpudai_auxpcm_rx,
3587 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003588 &msm_cpu_fe,
3589 &msm_stub_codec,
3590 &msm_kgsl_3d0,
3591#ifdef CONFIG_MSM_KGSL_2D
3592 &msm_kgsl_2d0,
3593 &msm_kgsl_2d1,
3594#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003595 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003596#ifdef CONFIG_MSM_GEMINI
3597 &msm8960_gemini_device,
3598#endif
3599 &msm_voice,
3600 &msm_voip,
3601 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303602 &msm_cpudai_afe_01_rx,
3603 &msm_cpudai_afe_01_tx,
3604 &msm_cpudai_afe_02_rx,
3605 &msm_cpudai_afe_02_tx,
3606 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003607#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3608 &hdmi_msm_device,
3609#endif
3610 &msm_pcm_hostless,
3611 &msm_bus_apps_fabric,
3612 &msm_bus_sys_fabric,
3613 &msm_bus_mm_fabric,
3614 &msm_bus_sys_fpb,
3615 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003616 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003617};
3618
3619static void __init msm8960_i2c_init(void)
3620{
3621 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3622 &msm8960_i2c_qup_gsbi4_pdata;
3623
3624 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3625 &msm8960_i2c_qup_gsbi3_pdata;
3626
3627 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3628 &msm8960_i2c_qup_gsbi10_pdata;
3629
3630 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3631 &msm8960_i2c_qup_gsbi12_pdata;
3632}
3633
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003634static void __init msm8960_gfx_init(void)
3635{
3636 uint32_t soc_platform_version = socinfo_get_platform_version();
3637 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3638 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3639 msm_kgsl_3d0.dev.platform_data;
3640 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3641 320000000;
3642 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3643 266667000;
3644 }
3645}
3646
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003647static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3648 .irq_base = PM8921_IRQ_BASE,
3649 .devirq = MSM_GPIO_TO_INT(104),
3650 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3651};
3652
3653static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3654 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3655};
3656
3657static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3658 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3659};
3660
3661static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3662 .rtc_write_enable = false,
3663};
3664
3665static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3666 .pull_up = 1,
3667 .kpd_trigger_delay_us = 970,
3668 .wakeup = 1,
3669};
3670
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303671/* Rotate lock key is not available so use F1 */
3672#define KEY_ROTATE_LOCK KEY_F1
3673
3674static const unsigned int keymap_liquid[] = {
3675 KEY(0, 0, KEY_VOLUMEUP),
3676 KEY(0, 1, KEY_VOLUMEDOWN),
3677 KEY(1, 3, KEY_ROTATE_LOCK),
3678 KEY(1, 4, KEY_HOME),
3679};
3680
3681static struct matrix_keymap_data keymap_data_liquid = {
3682 .keymap_size = ARRAY_SIZE(keymap_liquid),
3683 .keymap = keymap_liquid,
3684};
3685
3686static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3687 .input_name = "keypad_8960_liquid",
3688 .input_phys_device = "keypad_8960/input0",
3689 .num_rows = 2,
3690 .num_cols = 5,
3691 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3692 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3693 .debounce_ms = 15,
3694 .scan_delay_ms = 32,
3695 .row_hold_ns = 91500,
3696 .wakeup = 1,
3697 .keymap_data = &keymap_data_liquid,
3698};
3699
3700
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003701static const unsigned int keymap[] = {
3702 KEY(0, 0, KEY_VOLUMEUP),
3703 KEY(0, 1, KEY_VOLUMEDOWN),
3704 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3705 KEY(0, 3, KEY_CAMERA_FOCUS),
3706};
3707
3708static struct matrix_keymap_data keymap_data = {
3709 .keymap_size = ARRAY_SIZE(keymap),
3710 .keymap = keymap,
3711};
3712
3713static struct pm8xxx_keypad_platform_data keypad_data = {
3714 .input_name = "keypad_8960",
3715 .input_phys_device = "keypad_8960/input0",
3716 .num_rows = 1,
3717 .num_cols = 5,
3718 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3719 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3720 .debounce_ms = 15,
3721 .scan_delay_ms = 32,
3722 .row_hold_ns = 91500,
3723 .wakeup = 1,
3724 .keymap_data = &keymap_data,
3725};
3726
3727static const unsigned int keymap_sim[] = {
3728 KEY(0, 0, KEY_7),
3729 KEY(0, 1, KEY_DOWN),
3730 KEY(0, 2, KEY_UP),
3731 KEY(0, 3, KEY_RIGHT),
3732 KEY(0, 4, KEY_ENTER),
3733 KEY(0, 5, KEY_L),
3734 KEY(0, 6, KEY_BACK),
3735 KEY(0, 7, KEY_M),
3736
3737 KEY(1, 0, KEY_LEFT),
3738 KEY(1, 1, KEY_SEND),
3739 KEY(1, 2, KEY_1),
3740 KEY(1, 3, KEY_4),
3741 KEY(1, 4, KEY_CLEAR),
3742 KEY(1, 5, KEY_MSDOS),
3743 KEY(1, 6, KEY_SPACE),
3744 KEY(1, 7, KEY_COMMA),
3745
3746 KEY(2, 0, KEY_6),
3747 KEY(2, 1, KEY_5),
3748 KEY(2, 2, KEY_8),
3749 KEY(2, 3, KEY_3),
3750 KEY(2, 4, KEY_NUMERIC_STAR),
3751 KEY(2, 5, KEY_UP),
3752 KEY(2, 6, KEY_DOWN),
3753 KEY(2, 7, KEY_LEFTSHIFT),
3754
3755 KEY(3, 0, KEY_9),
3756 KEY(3, 1, KEY_NUMERIC_POUND),
3757 KEY(3, 2, KEY_0),
3758 KEY(3, 3, KEY_2),
3759 KEY(3, 4, KEY_SLEEP),
3760 KEY(3, 5, KEY_F1),
3761 KEY(3, 6, KEY_F2),
3762 KEY(3, 7, KEY_F3),
3763
3764 KEY(4, 0, KEY_BACK),
3765 KEY(4, 1, KEY_HOME),
3766 KEY(4, 2, KEY_MENU),
3767 KEY(4, 3, KEY_VOLUMEUP),
3768 KEY(4, 4, KEY_VOLUMEDOWN),
3769 KEY(4, 5, KEY_F4),
3770 KEY(4, 6, KEY_F5),
3771 KEY(4, 7, KEY_F6),
3772
3773 KEY(5, 0, KEY_R),
3774 KEY(5, 1, KEY_T),
3775 KEY(5, 2, KEY_Y),
3776 KEY(5, 3, KEY_LEFTALT),
3777 KEY(5, 4, KEY_KPENTER),
3778 KEY(5, 5, KEY_Q),
3779 KEY(5, 6, KEY_W),
3780 KEY(5, 7, KEY_E),
3781
3782 KEY(6, 0, KEY_F),
3783 KEY(6, 1, KEY_G),
3784 KEY(6, 2, KEY_H),
3785 KEY(6, 3, KEY_CAPSLOCK),
3786 KEY(6, 4, KEY_PAGEUP),
3787 KEY(6, 5, KEY_A),
3788 KEY(6, 6, KEY_S),
3789 KEY(6, 7, KEY_D),
3790
3791 KEY(7, 0, KEY_V),
3792 KEY(7, 1, KEY_B),
3793 KEY(7, 2, KEY_N),
3794 KEY(7, 3, KEY_MENU),
3795 KEY(7, 4, KEY_PAGEDOWN),
3796 KEY(7, 5, KEY_Z),
3797 KEY(7, 6, KEY_X),
3798 KEY(7, 7, KEY_C),
3799
3800 KEY(8, 0, KEY_P),
3801 KEY(8, 1, KEY_J),
3802 KEY(8, 2, KEY_K),
3803 KEY(8, 3, KEY_INSERT),
3804 KEY(8, 4, KEY_LINEFEED),
3805 KEY(8, 5, KEY_U),
3806 KEY(8, 6, KEY_I),
3807 KEY(8, 7, KEY_O),
3808
3809 KEY(9, 0, KEY_4),
3810 KEY(9, 1, KEY_5),
3811 KEY(9, 2, KEY_6),
3812 KEY(9, 3, KEY_7),
3813 KEY(9, 4, KEY_8),
3814 KEY(9, 5, KEY_1),
3815 KEY(9, 6, KEY_2),
3816 KEY(9, 7, KEY_3),
3817
3818 KEY(10, 0, KEY_F7),
3819 KEY(10, 1, KEY_F8),
3820 KEY(10, 2, KEY_F9),
3821 KEY(10, 3, KEY_F10),
3822 KEY(10, 4, KEY_FN),
3823 KEY(10, 5, KEY_9),
3824 KEY(10, 6, KEY_0),
3825 KEY(10, 7, KEY_DOT),
3826
3827 KEY(11, 0, KEY_LEFTCTRL),
3828 KEY(11, 1, KEY_F11),
3829 KEY(11, 2, KEY_ENTER),
3830 KEY(11, 3, KEY_SEARCH),
3831 KEY(11, 4, KEY_DELETE),
3832 KEY(11, 5, KEY_RIGHT),
3833 KEY(11, 6, KEY_LEFT),
3834 KEY(11, 7, KEY_RIGHTSHIFT),
3835 KEY(0, 0, KEY_VOLUMEUP),
3836 KEY(0, 1, KEY_VOLUMEDOWN),
3837 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3838 KEY(0, 3, KEY_CAMERA_FOCUS),
3839};
3840
3841static struct matrix_keymap_data keymap_data_sim = {
3842 .keymap_size = ARRAY_SIZE(keymap_sim),
3843 .keymap = keymap_sim,
3844};
3845
3846static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3847 .input_name = "keypad_8960",
3848 .input_phys_device = "keypad_8960/input0",
3849 .num_rows = 12,
3850 .num_cols = 8,
3851 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3852 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3853 .debounce_ms = 15,
3854 .scan_delay_ms = 32,
3855 .row_hold_ns = 91500,
3856 .wakeup = 1,
3857 .keymap_data = &keymap_data_sim,
3858};
3859
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003860static int pm8921_therm_mitigation[] = {
3861 1100,
3862 700,
3863 600,
3864 325,
3865};
3866
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003867static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003868 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003869 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003870 .max_voltage = 4200,
3871 .min_voltage = 3200,
3872 .resume_voltage = 4100,
3873 .term_current = 100,
3874 .cool_temp = 10,
3875 .warm_temp = 40,
3876 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003877 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003878 .cool_bat_chg_current = 350,
3879 .warm_bat_chg_current = 350,
3880 .cool_bat_voltage = 4100,
3881 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003882 .thermal_mitigation = pm8921_therm_mitigation,
3883 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003884};
3885
3886static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3887 .priority = 0,
3888};
3889
3890static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3891 .r_sense = 10,
3892 .i_test = 2500,
3893 .v_failure = 3000,
3894 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003895};
3896
Jay Chokshide4cefb2011-08-04 18:10:44 -07003897#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3898
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003899static struct led_info pm8921_led_info[] = {
3900 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003901 .name = "led:usb",
3902 .default_trigger = "usb-online",
Jay Chokshide4cefb2011-08-04 18:10:44 -07003903 },
3904 [1] = {
3905 .name = "led:ac",
3906 .default_trigger = "ac-online",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003907 },
3908};
3909
Jay Chokshi8994e392011-09-14 18:20:39 -07003910static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003911 .num_leds = ARRAY_SIZE(pm8921_led_info),
3912 .leds = pm8921_led_info,
3913};
3914
Jay Chokshi8994e392011-09-14 18:20:39 -07003915static struct pm8xxx_led_config pm8921_led_configs[] = {
3916 [0] = {
3917 .id = PM8XXX_ID_LED_0,
3918 .mode = PM8XXX_LED_MODE_MANUAL,
3919 .max_current = PM8921_LC_LED_MAX_CURRENT,
3920 },
3921 [1] = {
3922 .id = PM8XXX_ID_LED_1,
3923 .mode = PM8XXX_LED_MODE_MANUAL,
3924 .max_current = PM8921_LC_LED_MAX_CURRENT,
3925 },
3926};
3927
3928static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
3929 .led_core = &pm8921_led_core_pdata,
3930 .configs = pm8921_led_configs,
3931 .num_configs = ARRAY_SIZE(pm8921_led_configs),
3932};
3933
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003934static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3935 .irq_pdata = &pm8xxx_irq_pdata,
3936 .gpio_pdata = &pm8xxx_gpio_pdata,
3937 .mpp_pdata = &pm8xxx_mpp_pdata,
3938 .rtc_pdata = &pm8xxx_rtc_pdata,
3939 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3940 .keypad_pdata = &keypad_data,
3941 .misc_pdata = &pm8xxx_misc_pdata,
3942 .regulator_pdatas = msm_pm8921_regulator_pdata,
3943 .charger_pdata = &pm8921_chg_pdata,
3944 .bms_pdata = &pm8921_bms_pdata,
3945 .adc_pdata = &pm8921_adc_pdata,
3946 .leds_pdata = &pm8xxx_leds_pdata,
3947};
3948
3949static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3950 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3951 .slave = {
3952 .name = "pm8921-core",
3953 .platform_data = &pm8921_platform_data,
3954 },
3955};
3956
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003957#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
3958static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003959{
3960 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003961
3962 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3963 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003964 pr_err("FPGA CS gpio_request failed: %d\n", ret);
3965 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003966 }
3967
3968 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003969
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003970 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003971fail:
3972 return ret;
3973}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003974#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003975static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003976{
3977 return 0;
3978}
3979#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003980
3981static struct msm_cpuidle_state msm_cstates[] __initdata = {
3982 {0, 0, "C0", "WFI",
3983 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3984
3985 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3986 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3987
3988 {0, 2, "C2", "POWER_COLLAPSE",
3989 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3990
3991 {1, 0, "C0", "WFI",
3992 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3993
3994 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3995 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3996};
3997
3998static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3999 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4000 .idle_supported = 1,
4001 .suspend_supported = 1,
4002 .idle_enabled = 0,
4003 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004004 },
4005
4006 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4007 .idle_supported = 1,
4008 .suspend_supported = 1,
4009 .idle_enabled = 0,
4010 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004011 },
4012
4013 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4014 .idle_supported = 1,
4015 .suspend_supported = 1,
4016 .idle_enabled = 1,
4017 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004018 },
4019
4020 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4021 .idle_supported = 0,
4022 .suspend_supported = 1,
4023 .idle_enabled = 0,
4024 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004025 },
4026
4027 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4028 .idle_supported = 1,
4029 .suspend_supported = 1,
4030 .idle_enabled = 0,
4031 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004032 },
4033
4034 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4035 .idle_supported = 1,
4036 .suspend_supported = 0,
4037 .idle_enabled = 1,
4038 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004039 },
4040};
4041
4042static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4043 {
4044 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4045 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4046 true,
4047 1, 8000, 100000, 1,
4048 },
4049
4050 {
4051 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4052 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4053 true,
4054 1500, 5000, 60100000, 3000,
4055 },
4056
4057 {
4058 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4059 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4060 false,
4061 1800, 5000, 60350000, 3500,
4062 },
4063
4064 {
4065 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4066 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4067 false,
4068 2800, 2500, 65350000, 4800,
4069 },
4070
4071 {
4072 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4073 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4074 false,
4075 3800, 4500, 67850000, 5500,
4076 },
4077
4078 {
4079 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4080 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4081 false,
4082 4800, 2000, 71850000, 6800,
4083 },
4084
4085 {
4086 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4087 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4088 false,
4089 6800, 500, 75850000, 8800,
4090 },
4091
4092 {
4093 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4094 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4095 false,
4096 7800, 0, 76350000, 9800,
4097 },
4098};
4099
4100#ifdef CONFIG_I2C
4101#define I2C_SURF 1
4102#define I2C_FFA (1 << 1)
4103#define I2C_RUMI (1 << 2)
4104#define I2C_SIM (1 << 3)
4105#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004106#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004107
4108struct i2c_registry {
4109 u8 machs;
4110 int bus;
4111 struct i2c_board_info *info;
4112 int len;
4113};
4114
4115#ifdef CONFIG_MSM_CAMERA
4116static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4117#ifdef CONFIG_IMX074
4118 {
4119 I2C_BOARD_INFO("imx074", 0x1A),
4120 },
4121#endif
4122#ifdef CONFIG_OV2720
4123 {
4124 I2C_BOARD_INFO("ov2720", 0x6C),
4125 },
4126#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004127 {
4128 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4129 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304130#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4131 {
4132 I2C_BOARD_INFO("sc628a", 0x6E),
4133 },
4134#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004135};
4136#endif
4137
4138/* Sensors DSPS platform data */
4139#ifdef CONFIG_MSM_DSPS
4140#define DSPS_PIL_GENERIC_NAME "dsps"
4141#endif /* CONFIG_MSM_DSPS */
4142
4143static void __init msm8960_init_dsps(void)
4144{
4145#ifdef CONFIG_MSM_DSPS
4146 struct msm_dsps_platform_data *pdata =
4147 msm_dsps_device.dev.platform_data;
4148 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4149 pdata->gpios = NULL;
4150 pdata->gpios_num = 0;
4151
4152 platform_device_register(&msm_dsps_device);
4153#endif /* CONFIG_MSM_DSPS */
4154}
4155
Amir Samuelov5137e392011-09-21 17:31:25 +03004156#ifdef CONFIG_ISL9519_CHARGER
4157static struct isl_platform_data isl_data __initdata = {
4158 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4159 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4160 .max_system_voltage = 4200,
4161 .min_system_voltage = 3200,
4162 .chgcurrent = 1000, /* 1900, */
4163 .term_current = 400, /* Need fine tuning */
4164 .input_current = 2048,
4165};
4166
4167static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4168 {
4169 I2C_BOARD_INFO("isl9519q", 0x9),
4170 .irq = 0, /* Not required when notify-by-pmic */
4171 .platform_data = &isl_data,
4172 },
4173};
4174#endif /* CONFIG_ISL9519_CHARGER */
4175
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004176static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4177#ifdef CONFIG_MSM_CAMERA
4178 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004179 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004180 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4181 msm_camera_boardinfo,
4182 ARRAY_SIZE(msm_camera_boardinfo),
4183 },
4184#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004185#ifdef CONFIG_ISL9519_CHARGER
4186 {
4187 I2C_LIQUID,
4188 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4189 isl_charger_i2c_info,
4190 ARRAY_SIZE(isl_charger_i2c_info),
4191 },
4192#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004193 {
4194 I2C_SURF | I2C_FFA | I2C_FLUID,
4195 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4196 cyttsp_info,
4197 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004198 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304199 {
4200 I2C_LIQUID,
4201 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4202 mxt_device_info,
4203 ARRAY_SIZE(mxt_device_info),
4204 },
4205
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004206};
4207#endif /* CONFIG_I2C */
4208
4209static void __init register_i2c_devices(void)
4210{
4211#ifdef CONFIG_I2C
4212 u8 mach_mask = 0;
4213 int i;
4214
4215 /* Build the matching 'supported_machs' bitmask */
4216 if (machine_is_msm8960_cdp())
4217 mach_mask = I2C_SURF;
4218 else if (machine_is_msm8960_rumi3())
4219 mach_mask = I2C_RUMI;
4220 else if (machine_is_msm8960_sim())
4221 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004222 else if (machine_is_msm8960_fluid())
4223 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004224 else if (machine_is_msm8960_liquid())
4225 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004226 else if (machine_is_msm8960_mtp())
4227 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004228 else
4229 pr_err("unmatched machine ID in register_i2c_devices\n");
4230
4231 /* Run the array and install devices as appropriate */
4232 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4233 if (msm8960_i2c_devices[i].machs & mach_mask)
4234 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4235 msm8960_i2c_devices[i].info,
4236 msm8960_i2c_devices[i].len);
4237 }
4238#endif
4239}
4240
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004241static void __init msm8960_sim_init(void)
4242{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004243 BUG_ON(msm_rpm_init(&msm_rpm_data));
4244 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4245 ARRAY_SIZE(msm_rpmrs_levels)));
4246 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004247 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004248 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004249 msm8960_device_ssbi_pm8921.dev.platform_data =
4250 &msm8960_ssbi_pm8921_pdata;
4251 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004252
4253 /* Simulator supports a QWERTY keypad */
4254 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4255
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004256 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4257 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4258 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004259 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004260 msm8960_i2c_init();
4261 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4262 msm_spm_l2_init(msm_spm_l2_data);
4263 msm8960_init_buses();
4264 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4265 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004266 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004267 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004268
4269 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4270 &msm8960_qup_spi_gsbi1_pdata;
4271 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4272
4273 msm8960_init_mmc();
4274 msm_fb_add_devices();
4275 slim_register_board_info(msm_slim_devices,
4276 ARRAY_SIZE(msm_slim_devices));
4277 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4278 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4279 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4280 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004281}
4282
4283static void __init msm8960_rumi3_init(void)
4284{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004285 BUG_ON(msm_rpm_init(&msm_rpm_data));
4286 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4287 ARRAY_SIZE(msm_rpmrs_levels)));
4288 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004289 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004290 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004291 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004292 msm8960_device_ssbi_pm8921.dev.platform_data =
4293 &msm8960_ssbi_pm8921_pdata;
4294 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4295 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4296 &msm8960_qup_spi_gsbi1_pdata;
4297 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4298 msm8960_i2c_init();
4299 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4300 msm_spm_l2_init(msm_spm_l2_data);
4301 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4302 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004303 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004304 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004305 register_i2c_devices();
4306 msm_fb_add_devices();
4307 slim_register_board_info(msm_slim_devices,
4308 ARRAY_SIZE(msm_slim_devices));
4309 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4310 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4311 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4312 msm_pm_data);
4313}
4314
4315static void __init msm8960_cdp_init(void)
4316{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004317 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4318 pr_err("meminfo_init() failed!\n");
4319
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004320 BUG_ON(msm_rpm_init(&msm_rpm_data));
4321 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4322 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004323
4324 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004325 regulator_suppress_info_printing();
4326 if (msm_xo_init())
4327 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004328 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004329 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004330 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4331 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4332 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004333 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004334 if (machine_is_msm8960_cdp())
4335 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304336 if (machine_is_msm8960_liquid())
4337 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004338 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4339 &msm8960_qup_spi_gsbi1_pdata;
4340 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4341 msm8960_device_ssbi_pm8921.dev.platform_data =
4342 &msm8960_ssbi_pm8921_pdata;
4343 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4344 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004345 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004346 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4347 msm_spm_l2_init(msm_spm_l2_data);
4348 msm8960_init_buses();
4349 platform_add_devices(msm_footswitch_devices,
4350 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004351 if (machine_is_msm8960_liquid())
4352 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004353 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4354 pm8921_gpio_mpp_init();
4355 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4356 msm8960_init_cam();
4357 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004358 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304359 if (machine_is_msm8960_liquid())
4360 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004361 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004362 msm_fb_add_devices();
4363 slim_register_board_info(msm_slim_devices,
4364 ARRAY_SIZE(msm_slim_devices));
4365 msm8960_init_dsps();
4366 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4367 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4368 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4369 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004370 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004371}
4372
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004373MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4374 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004375 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004376 .init_irq = msm8960_init_irq,
4377 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004378 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004379 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004380MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004381
4382MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4383 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004384 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004385 .init_irq = msm8960_init_irq,
4386 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004387 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004388 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004389MACHINE_END
4390
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004391MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4392 .map_io = msm8960_map_io,
4393 .reserve = msm8960_reserve,
4394 .init_irq = msm8960_init_irq,
4395 .timer = &msm_timer,
4396 .init_machine = msm8960_cdp_init,
4397 .init_early = msm8960_allocate_memory_regions,
4398MACHINE_END
4399
4400MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4401 .map_io = msm8960_map_io,
4402 .reserve = msm8960_reserve,
4403 .init_irq = msm8960_init_irq,
4404 .timer = &msm_timer,
4405 .init_machine = msm8960_cdp_init,
4406 .init_early = msm8960_allocate_memory_regions,
4407MACHINE_END
4408
4409MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4410 .map_io = msm8960_map_io,
4411 .reserve = msm8960_reserve,
4412 .init_irq = msm8960_init_irq,
4413 .timer = &msm_timer,
4414 .init_machine = msm8960_cdp_init,
4415 .init_early = msm8960_allocate_memory_regions,
4416MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004417
4418MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4419 .map_io = msm8960_map_io,
4420 .reserve = msm8960_reserve,
4421 .init_irq = msm8960_init_irq,
4422 .timer = &msm_timer,
4423 .init_machine = msm8960_cdp_init,
4424 .init_early = msm8960_allocate_memory_regions,
4425MACHINE_END