blob: 26de3e6938d71f273a13725daabca655d9119e0a [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"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060091#include "pm-boot.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092
93static struct platform_device msm_fm_platform_init = {
94 .name = "iris_fm",
95 .id = -1,
96};
97
98struct pm8xxx_gpio_init {
99 unsigned gpio;
100 struct pm_gpio config;
101};
102
103struct pm8xxx_mpp_init {
104 unsigned mpp;
105 struct pm8xxx_mpp_config_data config;
106};
107
108#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
109 _func, _inv, _disable) \
110{ \
111 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
112 .config = { \
113 .direction = _dir, \
114 .output_buffer = _buf, \
115 .output_value = _val, \
116 .pull = _pull, \
117 .vin_sel = _vin, \
118 .out_strength = _out_strength, \
119 .function = _func, \
120 .inv_int_pol = _inv, \
121 .disable_pin = _disable, \
122 } \
123}
124
125#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
126{ \
127 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
128 .config = { \
129 .type = PM8XXX_MPP_TYPE_##_type, \
130 .level = _level, \
131 .control = PM8XXX_MPP_##_control, \
132 } \
133}
134
135#define PM8XXX_GPIO_DISABLE(_gpio) \
136 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
137 0, 0, 0, 1)
138
139#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
140 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
141 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
142 PM_GPIO_STRENGTH_HIGH, \
143 PM_GPIO_FUNC_NORMAL, 0, 0)
144
145#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
146 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
147 _pull, PM_GPIO_VIN_S4, \
148 PM_GPIO_STRENGTH_NO, \
149 PM_GPIO_FUNC_NORMAL, 0, 0)
150
151#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
152 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
153 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
154 PM_GPIO_STRENGTH_HIGH, \
155 _func, 0, 0)
156
157/* Initial PM8921 GPIO configurations */
158static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
159 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
160 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
161 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300162 /* External regulator shared by display and touchscreen on LiQUID */
163 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
164 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700166 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700167 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700168 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700169};
170
171/* Initial PM8921 MPP configurations */
172static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
173 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
174 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
176 DOUT_CTRL_LOW),
177};
178
179static void __init pm8921_gpio_mpp_init(void)
180{
181 int i, rc;
182
183 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
184 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
185 &pm8921_gpios[i].config);
186 if (rc) {
187 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
188 break;
189 }
190 }
191
192 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
193 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
194 &pm8921_mpps[i].config);
195 if (rc) {
196 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
197 break;
198 }
199 }
200}
201
202#define FPGA_CS_GPIO 14
203#define KS8851_RST_GPIO 89
204#define KS8851_IRQ_GPIO 90
205
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700206#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
207enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700208 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700209 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
210 /* CAM Expander */
211 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
212 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
213 GPIO_CAM_GP_AFBUSY,
214 GPIO_CAM_GP_STROBE_CE,
215 GPIO_CAM_GP_CAM1MP_XCLR,
216 GPIO_CAM_GP_CAMIF_RESET_N,
217 GPIO_CAM_GP_XMT_FLASH_INT,
218 GPIO_CAM_GP_LED_EN1,
219 GPIO_CAM_GP_LED_EN2,
220
221};
222#endif
223
Harini Jayaraman608d0462011-08-09 19:10:03 -0600224/* The SPI configurations apply to GSBI 1*/
225static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700226 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700227 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228 .pull = GPIOMUX_PULL_NONE,
229};
230
Harini Jayaraman608d0462011-08-09 19:10:03 -0600231static struct gpiomux_setting spi_suspended_config = {
232 .func = GPIOMUX_FUNC_GPIO,
233 .drv = GPIOMUX_DRV_2MA,
234 .pull = GPIOMUX_PULL_DOWN,
235};
236
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530237static struct gpiomux_setting gsbi3_suspended_cfg = {
238 .func = GPIOMUX_FUNC_1,
239 .drv = GPIOMUX_DRV_2MA,
240 .pull = GPIOMUX_PULL_KEEPER,
241};
242
243static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700244 .func = GPIOMUX_FUNC_1,
245 .drv = GPIOMUX_DRV_8MA,
246 .pull = GPIOMUX_PULL_NONE,
247};
248
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700249static struct gpiomux_setting gsbi5 = {
250 .func = GPIOMUX_FUNC_1,
251 .drv = GPIOMUX_DRV_8MA,
252 .pull = GPIOMUX_PULL_NONE,
253};
254
255static struct gpiomux_setting gsbi10 = {
256 .func = GPIOMUX_FUNC_2,
257 .drv = GPIOMUX_DRV_8MA,
258 .pull = GPIOMUX_PULL_NONE,
259};
260
261static struct gpiomux_setting gsbi12 = {
262 .func = GPIOMUX_FUNC_1,
263 .drv = GPIOMUX_DRV_8MA,
264 .pull = GPIOMUX_PULL_NONE,
265};
266
267static struct gpiomux_setting cdc_mclk = {
268 .func = GPIOMUX_FUNC_1,
269 .drv = GPIOMUX_DRV_8MA,
270 .pull = GPIOMUX_PULL_NONE,
271};
272
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700273static struct gpiomux_setting audio_auxpcm[] = {
274 /* Suspended state */
275 {
276 .func = GPIOMUX_FUNC_GPIO,
277 .drv = GPIOMUX_DRV_2MA,
278 .pull = GPIOMUX_PULL_NONE,
279 },
280 /* Active state */
281 {
282 .func = GPIOMUX_FUNC_1,
283 .drv = GPIOMUX_DRV_2MA,
284 .pull = GPIOMUX_PULL_NONE,
285 },
286};
287
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700288#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700289static struct gpiomux_setting gpio_eth_config = {
290 .pull = GPIOMUX_PULL_NONE,
291 .drv = GPIOMUX_DRV_8MA,
292 .func = GPIOMUX_FUNC_GPIO,
293};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700294#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295
296static struct gpiomux_setting slimbus = {
297 .func = GPIOMUX_FUNC_1,
298 .drv = GPIOMUX_DRV_8MA,
299 .pull = GPIOMUX_PULL_KEEPER,
300};
301
302struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700303#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700304 {
305 .gpio = KS8851_IRQ_GPIO,
306 .settings = {
307 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
308 }
309 },
310 {
311 .gpio = KS8851_RST_GPIO,
312 .settings = {
313 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
314 }
315 },
316 {
317 .gpio = FPGA_CS_GPIO,
318 .settings = {
319 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
320 }
321 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700322#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323};
324
325static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
326 {
327 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
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 = 7, /* GSBI1 QUP SPI_DATA_MISO */
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 = 8, /* GSBI1 QUP SPI_CS_N */
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 = 9, /* GSBI1 QUP SPI_CLK */
349 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600350 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
351 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352 },
353 },
354 {
355 .gpio = 16, /* GSBI3 I2C QUP SDA */
356 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530357 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
358 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 },
360 },
361 {
362 .gpio = 17, /* GSBI3 I2C QUP SCL */
363 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530364 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
365 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700366 },
367 },
368 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700369 .gpio = 22, /* GSBI5 UART2 */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &gsbi5,
372 },
373 },
374 {
375 .gpio = 23, /* GSBI5 UART2 */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &gsbi5,
378 },
379 },
380 {
381 .gpio = 24, /* GSBI5 UART2 */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &gsbi5,
384 },
385 },
386 {
387 .gpio = 25, /* GSBI5 UART2 */
388 .settings = {
389 [GPIOMUX_SUSPENDED] = &gsbi5,
390 },
391 },
392 {
393 .gpio = 44, /* GSBI12 I2C QUP SDA */
394 .settings = {
395 [GPIOMUX_SUSPENDED] = &gsbi12,
396 },
397 },
398 {
399 .gpio = 45, /* GSBI12 I2C QUP SCL */
400 .settings = {
401 [GPIOMUX_SUSPENDED] = &gsbi12,
402 },
403 },
404 {
405 .gpio = 73, /* GSBI10 I2C QUP SDA */
406 .settings = {
407 [GPIOMUX_SUSPENDED] = &gsbi10,
408 },
409 },
410 {
411 .gpio = 74, /* GSBI10 I2C QUP SCL */
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &gsbi10,
414 },
415 },
416};
417
418static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
419 {
420 .gpio = 60, /* slimbus data */
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &slimbus,
423 },
424 },
425 {
426 .gpio = 61, /* slimbus clk */
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &slimbus,
429 },
430 },
431};
432
433static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
434 {
435 .gpio = 59,
436 .settings = {
437 [GPIOMUX_SUSPENDED] = &cdc_mclk,
438 },
439 },
440};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700441
442static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
443 {
444 .gpio = 63,
445 .settings = {
446 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
447 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
448 },
449 },
450 {
451 .gpio = 64,
452 .settings = {
453 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
454 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
455 },
456 },
457 {
458 .gpio = 65,
459 .settings = {
460 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
461 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
462 },
463 },
464 {
465 .gpio = 66,
466 .settings = {
467 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
468 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
469 },
470 },
471};
472
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700473static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
474 .func = GPIOMUX_FUNC_GPIO,
475 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700476 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700477};
478
479static struct gpiomux_setting wcnss_5wire_active_cfg = {
480 .func = GPIOMUX_FUNC_1,
481 .drv = GPIOMUX_DRV_6MA,
482 .pull = GPIOMUX_PULL_DOWN,
483};
484
485static struct msm_gpiomux_config wcnss_5wire_interface[] = {
486 {
487 .gpio = 84,
488 .settings = {
489 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
490 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
491 },
492 },
493 {
494 .gpio = 85,
495 .settings = {
496 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
497 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
498 },
499 },
500 {
501 .gpio = 86,
502 .settings = {
503 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
504 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
505 },
506 },
507 {
508 .gpio = 87,
509 .settings = {
510 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
511 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
512 },
513 },
514 {
515 .gpio = 88,
516 .settings = {
517 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
518 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
519 },
520 },
521};
Nishant Pandit24153d82011-08-27 16:05:13 +0530522static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530523 {
524 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
525 .drv = GPIOMUX_DRV_2MA,
526 .pull = GPIOMUX_PULL_DOWN,
527 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700528
Nishant Pandit474f2252011-07-23 23:17:56 +0530529 {
530 .func = GPIOMUX_FUNC_1, /*active 1*/
531 .drv = GPIOMUX_DRV_2MA,
532 .pull = GPIOMUX_PULL_NONE,
533 },
534
535 {
536 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
537 .drv = GPIOMUX_DRV_2MA,
538 .pull = GPIOMUX_PULL_NONE,
539 },
540
541 {
542 .func = GPIOMUX_FUNC_1, /*active 3*/
543 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700544 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530545 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530546
547 {
548 .func = GPIOMUX_FUNC_5, /*active 4*/
549 .drv = GPIOMUX_DRV_8MA,
550 .pull = GPIOMUX_PULL_UP,
551 },
552
553 {
554 .func = GPIOMUX_FUNC_6, /*active 5*/
555 .drv = GPIOMUX_DRV_8MA,
556 .pull = GPIOMUX_PULL_UP,
557 },
558
559 {
560 .func = GPIOMUX_FUNC_2, /*active 6*/
561 .drv = GPIOMUX_DRV_2MA,
562 .pull = GPIOMUX_PULL_UP,
563 },
564
565 {
566 .func = GPIOMUX_FUNC_3, /*active 7*/
567 .drv = GPIOMUX_DRV_8MA,
568 .pull = GPIOMUX_PULL_UP,
569 },
570
Kevin Chan4c58d292011-09-13 11:03:25 -0700571 {
572 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
573 .drv = GPIOMUX_DRV_2MA,
574 .pull = GPIOMUX_PULL_KEEPER,
575 },
576
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700577};
578
Nishant Pandit24153d82011-08-27 16:05:13 +0530579static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700580 {
581 .gpio = 2,
582 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530583 [GPIOMUX_ACTIVE] = &cam_settings[2],
584 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700585 },
586 },
587 {
588 .gpio = 3,
589 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530590 [GPIOMUX_ACTIVE] = &cam_settings[1],
591 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700592 },
593 },
594 {
595 .gpio = 4,
596 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530597 [GPIOMUX_ACTIVE] = &cam_settings[1],
598 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700599 },
600 },
601 {
602 .gpio = 5,
603 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530604 [GPIOMUX_ACTIVE] = &cam_settings[1],
605 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 },
607 },
608 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530609 .gpio = 76,
610 .settings = {
611 [GPIOMUX_ACTIVE] = &cam_settings[2],
612 [GPIOMUX_SUSPENDED] = &cam_settings[0],
613 },
614 },
615 {
616 .gpio = 107,
617 .settings = {
618 [GPIOMUX_ACTIVE] = &cam_settings[2],
619 [GPIOMUX_SUSPENDED] = &cam_settings[0],
620 },
621 },
622};
623
624static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
625 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700626 .gpio = 18,
627 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530628 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700629 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700630 },
631 },
632 {
633 .gpio = 19,
634 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530635 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700636 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700637 },
638 },
639 {
640 .gpio = 20,
641 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530642 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700643 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700644 },
645 },
646 {
647 .gpio = 21,
648 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530649 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700650 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700651 },
652 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700653};
654
655static struct gpiomux_setting cyts_resout_sus_cfg = {
656 .func = GPIOMUX_FUNC_GPIO,
657 .drv = GPIOMUX_DRV_6MA,
658 .pull = GPIOMUX_PULL_UP,
659};
660
661static struct gpiomux_setting cyts_resout_act_cfg = {
662 .func = GPIOMUX_FUNC_GPIO,
663 .drv = GPIOMUX_DRV_6MA,
664 .pull = GPIOMUX_PULL_UP,
665};
666
667static struct gpiomux_setting cyts_sleep_sus_cfg = {
668 .func = GPIOMUX_FUNC_GPIO,
669 .drv = GPIOMUX_DRV_6MA,
670 .pull = GPIOMUX_PULL_DOWN,
671};
672
673static struct gpiomux_setting cyts_sleep_act_cfg = {
674 .func = GPIOMUX_FUNC_GPIO,
675 .drv = GPIOMUX_DRV_6MA,
676 .pull = GPIOMUX_PULL_DOWN,
677};
678
679static struct gpiomux_setting cyts_int_act_cfg = {
680 .func = GPIOMUX_FUNC_GPIO,
681 .drv = GPIOMUX_DRV_8MA,
682 .pull = GPIOMUX_PULL_UP,
683};
684
685static struct gpiomux_setting cyts_int_sus_cfg = {
686 .func = GPIOMUX_FUNC_GPIO,
687 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530688 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700689};
690
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700691static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
692 { /* TS INTERRUPT */
693 .gpio = 11,
694 .settings = {
695 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
696 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
697 },
698 },
699 { /* TS SLEEP */
700 .gpio = 50,
701 .settings = {
702 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
703 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
704 },
705 },
706 { /* TS RESOUT */
707 .gpio = 52,
708 .settings = {
709 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
710 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
711 },
712 },
713};
714
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530715#ifdef CONFIG_USB_EHCI_MSM_HSIC
716static struct gpiomux_setting hsic_act_cfg = {
717 .func = GPIOMUX_FUNC_1,
718 .drv = GPIOMUX_DRV_12MA,
719 .pull = GPIOMUX_PULL_NONE,
720};
721
722static struct gpiomux_setting hsic_sus_cfg = {
723 .func = GPIOMUX_FUNC_GPIO,
724 .drv = GPIOMUX_DRV_2MA,
725 .pull = GPIOMUX_PULL_DOWN,
726};
727
728static struct msm_gpiomux_config msm8960_hsic_configs[] = {
729 {
730 .gpio = 150, /*HSIC_STROBE */
731 .settings = {
732 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
733 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
734 },
735 },
736 {
737 .gpio = 151, /* HSIC_DATA */
738 .settings = {
739 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
740 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
741 },
742 },
743};
744#endif
745
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700746#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
747enum {
748 SX150X_CAM,
749};
750
Nishant Pandit474f2252011-07-23 23:17:56 +0530751static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700752 [SX150X_CAM] = {
753 .gpio_base = GPIO_CAM_EXPANDER_BASE,
754 .oscio_is_gpo = false,
755 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530756 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700757 .io_open_drain_ena = 0x0,
758 .irq_summary = -1,
759 },
760};
Nishant Pandit474f2252011-07-23 23:17:56 +0530761
762#endif
763
764#ifdef CONFIG_I2C
765
766#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
767#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300768#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530769
770#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
771
772static struct i2c_board_info cam_expander_i2c_info[] = {
773 {
774 I2C_BOARD_INFO("sx1508q", 0x22),
775 .platform_data = &sx150x_data[SX150X_CAM]
776 },
777};
778
779static struct msm_cam_expander_info cam_expander_info[] = {
780 {
781 cam_expander_i2c_info,
782 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
783 },
784};
785#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700786#endif
787
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700788#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
789#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700790#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700791#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
792#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
793#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700794#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700795#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700796
797
798#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
799#define MSM_ION_EBI_SIZE MSM_PMEM_SIZE
800#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
801#define MSM_ION_HEAP_NUM 4
802#else
803#define MSM_ION_HEAP_NUM 2
804#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700805
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700806#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
807static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
808static int __init pmem_kernel_ebi1_size_setup(char *p)
809{
810 pmem_kernel_ebi1_size = memparse(p, NULL);
811 return 0;
812}
813early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
814#endif
815
816#ifdef CONFIG_ANDROID_PMEM
817static unsigned pmem_size = MSM_PMEM_SIZE;
818static int __init pmem_size_setup(char *p)
819{
820 pmem_size = memparse(p, NULL);
821 return 0;
822}
823early_param("pmem_size", pmem_size_setup);
824
825static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
826
827static int __init pmem_adsp_size_setup(char *p)
828{
829 pmem_adsp_size = memparse(p, NULL);
830 return 0;
831}
832early_param("pmem_adsp_size", pmem_adsp_size_setup);
833
834static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
835
836static int __init pmem_audio_size_setup(char *p)
837{
838 pmem_audio_size = memparse(p, NULL);
839 return 0;
840}
841early_param("pmem_audio_size", pmem_audio_size_setup);
842#endif
843
844#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700845#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846static struct android_pmem_platform_data android_pmem_pdata = {
847 .name = "pmem",
848 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
849 .cached = 1,
850 .memory_type = MEMTYPE_EBI1,
851};
852
853static struct platform_device android_pmem_device = {
854 .name = "android_pmem",
855 .id = 0,
856 .dev = {.platform_data = &android_pmem_pdata},
857};
858
859static struct android_pmem_platform_data android_pmem_adsp_pdata = {
860 .name = "pmem_adsp",
861 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
862 .cached = 0,
863 .memory_type = MEMTYPE_EBI1,
864};
865static struct platform_device android_pmem_adsp_device = {
866 .name = "android_pmem",
867 .id = 2,
868 .dev = { .platform_data = &android_pmem_adsp_pdata },
869};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700870#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700871
872static struct android_pmem_platform_data android_pmem_audio_pdata = {
873 .name = "pmem_audio",
874 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
875 .cached = 0,
876 .memory_type = MEMTYPE_EBI1,
877};
878
879static struct platform_device android_pmem_audio_device = {
880 .name = "android_pmem",
881 .id = 4,
882 .dev = { .platform_data = &android_pmem_audio_pdata },
883};
884#endif
885
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700886#define DSP_RAM_BASE_8960 0x8da00000
887#define DSP_RAM_SIZE_8960 0x1800000
888static int dspcrashd_pdata_8960 = 0xDEADDEAD;
889
890static struct resource resources_dspcrashd_8960[] = {
891 {
892 .name = "msm_dspcrashd",
893 .start = DSP_RAM_BASE_8960,
894 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
895 .flags = IORESOURCE_DMA,
896 },
897};
898
899struct platform_device msm_device_dspcrashd_8960 = {
900 .name = "msm_dspcrashd",
901 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
902 .resource = resources_dspcrashd_8960,
903 .dev = { .platform_data = &dspcrashd_pdata_8960 },
904};
905
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700906static struct memtype_reserve msm8960_reserve_table[] __initdata = {
907 [MEMTYPE_SMI] = {
908 },
909 [MEMTYPE_EBI0] = {
910 .flags = MEMTYPE_FLAGS_1M_ALIGN,
911 },
912 [MEMTYPE_EBI1] = {
913 .flags = MEMTYPE_FLAGS_1M_ALIGN,
914 },
915};
916
917static void __init size_pmem_devices(void)
918{
919#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700920#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700921 android_pmem_adsp_pdata.size = pmem_adsp_size;
922 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700923#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700924 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
925#endif
926}
927
928static void __init reserve_memory_for(struct android_pmem_platform_data *p)
929{
930 msm8960_reserve_table[p->memory_type].size += p->size;
931}
932
933static void __init reserve_pmem_memory(void)
934{
935#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700936#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700937 reserve_memory_for(&android_pmem_adsp_pdata);
938 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700939#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700940 reserve_memory_for(&android_pmem_audio_pdata);
941 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
942#endif
943}
944
Larry Basselb4126da2011-07-18 14:31:33 -0700945static int msm8960_paddr_to_memtype(unsigned int paddr)
946{
947 return MEMTYPE_EBI1;
948}
949
Laura Abbottd6183792011-08-19 13:42:24 -0700950#ifdef CONFIG_ION_MSM
951struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700952 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700953 .heaps = {
954 {
955 .id = ION_HEAP_SYSTEM_ID,
956 .type = ION_HEAP_TYPE_SYSTEM,
957 .name = ION_KMALLOC_HEAP_NAME,
958 },
959 {
960 .id = ION_HEAP_SYSTEM_CONTIG_ID,
961 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
962 .name = ION_VMALLOC_HEAP_NAME,
963 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700964#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700965 {
966 .id = ION_HEAP_EBI_ID,
967 .type = ION_HEAP_TYPE_CARVEOUT,
968 .name = ION_EBI1_HEAP_NAME,
969 .size = MSM_ION_EBI_SIZE,
970 .memory_type = ION_EBI_TYPE,
971 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700972 {
973 .id = ION_HEAP_ADSP_ID,
974 .type = ION_HEAP_TYPE_CARVEOUT,
975 .name = ION_ADSP_HEAP_NAME,
976 .size = MSM_ION_ADSP_SIZE,
977 .memory_type = ION_EBI_TYPE,
978 },
979#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700980 }
981};
982
983struct platform_device ion_dev = {
984 .name = "ion-msm",
985 .id = 1,
986 .dev = { .platform_data = &ion_pdata },
987};
988#endif
989
990static void reserve_ion_memory(void)
991{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700992#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -0700993 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700994 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700995#endif
996}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700997static void __init msm8960_calculate_reserve_sizes(void)
998{
999 size_pmem_devices();
1000 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001001 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001002}
1003
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001004static struct reserve_info msm8960_reserve_info __initdata = {
1005 .memtype_reserve_table = msm8960_reserve_table,
1006 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1007 .paddr_to_memtype = msm8960_paddr_to_memtype,
1008};
1009
Larry Basselb4126da2011-07-18 14:31:33 -07001010static int msm8960_memory_bank_size(void)
1011{
1012 return 1<<29;
1013}
1014
1015static void __init locate_unstable_memory(void)
1016{
1017 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1018 unsigned long bank_size;
1019 unsigned long low, high;
1020
1021 bank_size = msm8960_memory_bank_size();
1022 low = meminfo.bank[0].start;
1023 high = mb->start + mb->size;
1024 low &= ~(bank_size - 1);
1025
1026 if (high - low <= bank_size)
1027 return;
1028 msm8960_reserve_info.low_unstable_address = low + bank_size;
1029 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
1030 msm8960_reserve_info.bank_size = bank_size;
1031 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1032 msm8960_reserve_info.low_unstable_address,
1033 msm8960_reserve_info.max_unstable_size,
1034 msm8960_reserve_info.bank_size);
1035}
1036
Larry Basselb830e182011-10-14 10:46:55 -07001037static void __init place_movable_zone(void)
1038{
1039 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1040 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1041 pr_info("movable zone start %lx size %lx\n",
1042 movable_reserved_start, movable_reserved_size);
1043}
1044
1045static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001046{
1047 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001048 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001049 place_movable_zone();
1050}
1051
1052static void __init msm8960_reserve(void)
1053{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001054 msm_reserve();
1055}
1056
Larry Bassela4414b12011-08-04 11:11:02 -07001057static int msm8960_change_memory_power(u64 start, u64 size,
1058 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001059{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001060 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001061}
1062
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001063#ifdef CONFIG_MSM_CAMERA
1064
Nishant Pandit24153d82011-08-27 16:05:13 +05301065static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001066 5, /*CAMIF_MCLK*/
1067 20, /*CAMIF_I2C_DATA*/
1068 21, /*CAMIF_I2C_CLK*/
1069};
1070
Nishant Pandit24153d82011-08-27 16:05:13 +05301071static struct msm_camera_gpio_conf gpio_conf = {
1072 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1073 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1074 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1075 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1076};
1077
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001078#define VFE_CAMIF_TIMER1_GPIO 2
1079#define VFE_CAMIF_TIMER2_GPIO 3
1080#define VFE_CAMIF_TIMER3_GPIO_INT 4
1081struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1082 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1083 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1084 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1085 .flash_recharge_duration = 50000,
1086 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1087};
1088
Nishant Pandit474f2252011-07-23 23:17:56 +05301089#ifdef CONFIG_MSM_CAMERA_FLASH
1090static struct msm_camera_sensor_flash_src msm_flash_src = {
1091 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1092 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1093 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1094#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1095 defined(CONFIG_GPIO_SX150X_MODULE))
1096 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1097#endif
1098};
1099#endif
1100
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001101static struct msm_bus_vectors cam_init_vectors[] = {
1102 {
1103 .src = MSM_BUS_MASTER_VFE,
1104 .dst = MSM_BUS_SLAVE_EBI_CH0,
1105 .ab = 0,
1106 .ib = 0,
1107 },
1108 {
1109 .src = MSM_BUS_MASTER_VPE,
1110 .dst = MSM_BUS_SLAVE_EBI_CH0,
1111 .ab = 0,
1112 .ib = 0,
1113 },
1114 {
1115 .src = MSM_BUS_MASTER_JPEG_ENC,
1116 .dst = MSM_BUS_SLAVE_EBI_CH0,
1117 .ab = 0,
1118 .ib = 0,
1119 },
1120};
1121
1122static struct msm_bus_vectors cam_preview_vectors[] = {
1123 {
1124 .src = MSM_BUS_MASTER_VFE,
1125 .dst = MSM_BUS_SLAVE_EBI_CH0,
1126 .ab = 27648000,
1127 .ib = 110592000,
1128 },
1129 {
1130 .src = MSM_BUS_MASTER_VPE,
1131 .dst = MSM_BUS_SLAVE_EBI_CH0,
1132 .ab = 0,
1133 .ib = 0,
1134 },
1135 {
1136 .src = MSM_BUS_MASTER_JPEG_ENC,
1137 .dst = MSM_BUS_SLAVE_EBI_CH0,
1138 .ab = 0,
1139 .ib = 0,
1140 },
1141};
1142
1143static struct msm_bus_vectors cam_video_vectors[] = {
1144 {
1145 .src = MSM_BUS_MASTER_VFE,
1146 .dst = MSM_BUS_SLAVE_EBI_CH0,
1147 .ab = 140451840,
1148 .ib = 561807360,
1149 },
1150 {
1151 .src = MSM_BUS_MASTER_VPE,
1152 .dst = MSM_BUS_SLAVE_EBI_CH0,
1153 .ab = 206807040,
1154 .ib = 488816640,
1155 },
1156 {
1157 .src = MSM_BUS_MASTER_JPEG_ENC,
1158 .dst = MSM_BUS_SLAVE_EBI_CH0,
1159 .ab = 0,
1160 .ib = 0,
1161 },
1162};
1163
1164static struct msm_bus_vectors cam_snapshot_vectors[] = {
1165 {
1166 .src = MSM_BUS_MASTER_VFE,
1167 .dst = MSM_BUS_SLAVE_EBI_CH0,
1168 .ab = 274423680,
1169 .ib = 1097694720,
1170 },
1171 {
1172 .src = MSM_BUS_MASTER_VPE,
1173 .dst = MSM_BUS_SLAVE_EBI_CH0,
1174 .ab = 0,
1175 .ib = 0,
1176 },
1177 {
1178 .src = MSM_BUS_MASTER_JPEG_ENC,
1179 .dst = MSM_BUS_SLAVE_EBI_CH0,
1180 .ab = 540000000,
1181 .ib = 1350000000,
1182 },
1183};
1184
1185static struct msm_bus_vectors cam_zsl_vectors[] = {
1186 {
1187 .src = MSM_BUS_MASTER_VFE,
1188 .dst = MSM_BUS_SLAVE_EBI_CH0,
1189 .ab = 302071680,
1190 .ib = 1208286720,
1191 },
1192 {
1193 .src = MSM_BUS_MASTER_VPE,
1194 .dst = MSM_BUS_SLAVE_EBI_CH0,
1195 .ab = 0,
1196 .ib = 0,
1197 },
1198 {
1199 .src = MSM_BUS_MASTER_JPEG_ENC,
1200 .dst = MSM_BUS_SLAVE_EBI_CH0,
1201 .ab = 540000000,
1202 .ib = 1350000000,
1203 },
1204};
1205
1206static struct msm_bus_paths cam_bus_client_config[] = {
1207 {
1208 ARRAY_SIZE(cam_init_vectors),
1209 cam_init_vectors,
1210 },
1211 {
1212 ARRAY_SIZE(cam_preview_vectors),
1213 cam_preview_vectors,
1214 },
1215 {
1216 ARRAY_SIZE(cam_video_vectors),
1217 cam_video_vectors,
1218 },
1219 {
1220 ARRAY_SIZE(cam_snapshot_vectors),
1221 cam_snapshot_vectors,
1222 },
1223 {
1224 ARRAY_SIZE(cam_zsl_vectors),
1225 cam_zsl_vectors,
1226 },
1227};
1228
1229static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1230 cam_bus_client_config,
1231 ARRAY_SIZE(cam_bus_client_config),
1232 .name = "msm_camera",
1233};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001234
Nishant Pandit24153d82011-08-27 16:05:13 +05301235struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1236 {
1237 .ioclk.mclk_clk_rate = 24000000,
1238 .ioclk.vfe_clk_rate = 228570000,
1239 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001240 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301241 },
1242 {
1243 .ioclk.mclk_clk_rate = 24000000,
1244 .ioclk.vfe_clk_rate = 228570000,
1245 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001246 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301247 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001248};
1249
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001250#ifdef CONFIG_IMX074_ACT
1251static struct i2c_board_info imx074_actuator_i2c_info = {
1252 I2C_BOARD_INFO("imx074_act", 0x11),
1253};
1254
1255static struct msm_actuator_info imx074_actuator_info = {
1256 .board_info = &imx074_actuator_i2c_info,
1257 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1258 .vcm_pwd = 0,
1259 .vcm_enable = 1,
1260};
1261#endif
1262
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001263#ifdef CONFIG_IMX074
1264static struct msm_camera_sensor_flash_data flash_imx074 = {
1265 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301266#ifdef CONFIG_MSM_CAMERA_FLASH
1267 .flash_src = &msm_flash_src
1268#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001269};
1270
Nishant Pandit24153d82011-08-27 16:05:13 +05301271static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1272 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001273 .sensor_reset = 107,
1274 .sensor_pwd = 85,
1275 .vcm_pwd = 0,
1276 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301277};
1278
1279static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1280 .sensor_name = "imx074",
1281 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282 .flash_data = &flash_imx074,
1283 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301284 .sensor_platform_info = &sensor_board_info_imx074,
1285 .gpio_conf = &gpio_conf,
1286 .csi_if = 1,
1287 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001288#ifdef CONFIG_IMX074_ACT
1289 .actuator_info = &imx074_actuator_info
1290#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001291};
1292
1293struct platform_device msm8960_camera_sensor_imx074 = {
1294 .name = "msm_camera_imx074",
1295 .dev = {
1296 .platform_data = &msm_camera_sensor_imx074_data,
1297 },
1298};
1299#endif
1300#ifdef CONFIG_OV2720
1301static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001302 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303};
1304
Nishant Pandit24153d82011-08-27 16:05:13 +05301305static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1306 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001307 .sensor_reset = 76,
1308 .sensor_pwd = 85,
1309 .vcm_pwd = 0,
1310 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301311};
1312
1313static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1314 .sensor_name = "ov2720",
1315 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001316 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301317 .sensor_platform_info = &sensor_board_info_ov2720,
1318 .gpio_conf = &gpio_conf,
1319 .csi_if = 1,
1320 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321};
1322
1323struct platform_device msm8960_camera_sensor_ov2720 = {
1324 .name = "msm_camera_ov2720",
1325 .dev = {
1326 .platform_data = &msm_camera_sensor_ov2720_data,
1327 },
1328};
1329#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001330
1331static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1332 .flash_type = MSM_CAMERA_FLASH_LED,
1333};
1334
Nishant Pandit24153d82011-08-27 16:05:13 +05301335static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1336 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001337 .sensor_reset = 107,
1338 .sensor_pwd = 85,
1339 .vcm_pwd = 0,
1340 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301341};
1342
1343static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1344 .sensor_name = "qs_mt9p017",
1345 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001346 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301347 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1348 .gpio_conf = &gpio_conf,
1349 .csi_if = 1,
1350 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001351};
1352
1353struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1354 .name = "msm_camera_qs_mt9p017",
1355 .dev = {
1356 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1357 },
1358};
1359
Kevin Chan8b0d2322011-09-10 21:06:31 -07001360static struct msm8960_privacy_light_cfg privacy_light_info = {
1361 .mpp = PM8921_MPP_PM_TO_SYS(12),
1362};
1363
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364static void __init msm8960_init_cam(void)
1365{
1366 int i;
1367 struct platform_device *cam_dev[] = {
1368 &msm8960_camera_sensor_imx074,
1369 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001370 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001371 };
1372
Kevin Chan8b0d2322011-09-10 21:06:31 -07001373 if (machine_is_msm8960_liquid()) {
1374 struct msm_camera_sensor_info *s_info;
1375 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1376 s_info->sensor_platform_info->mount_angle = 180;
1377 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1378 s_info->sensor_platform_info->privacy_light = 1;
1379 s_info->sensor_platform_info->privacy_light_info =
1380 &privacy_light_info;
1381 }
1382
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001383 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1384 struct msm_camera_sensor_info *s_info;
1385 s_info = cam_dev[i]->dev.platform_data;
1386 msm_get_cam_resources(s_info);
1387 platform_device_register(cam_dev[i]);
1388 }
1389}
1390#endif
1391
1392#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001393#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001394#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001395#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001396#endif
1397
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001398
1399#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001400#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001401#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001402#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1403#else
1404#define MSM_FB_EXT_BUF_SIZE 0
1405#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001406
kuogee hsieh3830eb92011-09-12 15:25:57 -07001407#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1408/* width x height x 3 bpp x 2 frame buffer */
1409#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1410#define MSM_FB_WRITEBACK_OFFSET \
1411 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1412#else
1413#define MSM_FB_WRITEBACK_SIZE 0
1414#define MSM_FB_WRITEBACK_OFFSET 0
1415#endif
1416
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001417#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1418/* 4 bpp x 2 page HDMI case */
1419#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1420#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001421/* Note: must be multiple of 4096 */
1422#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1423 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001424#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001425
1426static int writeback_offset(void)
1427{
1428 return MSM_FB_WRITEBACK_OFFSET;
1429}
1430
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001431
1432#define MDP_VSYNC_GPIO 0
1433
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001434#define PANEL_NAME_MAX_LEN 30
1435#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1436#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1437#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1438#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1439#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1440#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1441#define HDMI_PANEL_NAME "hdmi_msm"
1442#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001443
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001444static struct resource msm_fb_resources[] = {
1445 {
1446 .flags = IORESOURCE_DMA,
1447 }
1448};
1449
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001450static int msm_fb_detect_panel(const char *name)
1451{
1452 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001453 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1454 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1455 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001456 return 0;
1457 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001458 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1459 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1460 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001461 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001462
1463#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1464 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1465 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1466 PANEL_NAME_MAX_LEN)))
1467 return 0;
1468
1469 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1470 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1471 PANEL_NAME_MAX_LEN)))
1472 return 0;
1473
1474 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1475 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1476 PANEL_NAME_MAX_LEN)))
1477 return 0;
1478
1479 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1480 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1481 PANEL_NAME_MAX_LEN)))
1482 return 0;
1483#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001484 }
1485
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001486 if (!strncmp(name, HDMI_PANEL_NAME,
1487 strnlen(HDMI_PANEL_NAME,
1488 PANEL_NAME_MAX_LEN)))
1489 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001490
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001491 if (!strncmp(name, TVOUT_PANEL_NAME,
1492 strnlen(TVOUT_PANEL_NAME,
1493 PANEL_NAME_MAX_LEN)))
1494 return 0;
1495
1496 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001497 return -ENODEV;
1498}
1499
1500static struct msm_fb_platform_data msm_fb_pdata = {
1501 .detect_client = msm_fb_detect_panel,
1502};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001503
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001504static struct platform_device msm_fb_device = {
1505 .name = "msm_fb",
1506 .id = 0,
1507 .num_resources = ARRAY_SIZE(msm_fb_resources),
1508 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001509 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001510};
1511
1512static bool dsi_power_on;
1513
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001514/**
1515 * LiQUID panel on/off
1516 *
1517 * @param on
1518 *
1519 * @return int
1520 */
1521static int mipi_dsi_liquid_panel_power(int on)
1522{
1523 static struct regulator *reg_l2, *reg_ext_3p3v;
1524 static int gpio21, gpio24, gpio43;
1525 int rc;
1526
1527 pr_info("%s: on=%d\n", __func__, on);
1528
1529 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1530 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1531 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1532
1533 if (!dsi_power_on) {
1534
1535 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1536 "dsi_vdda");
1537 if (IS_ERR(reg_l2)) {
1538 pr_err("could not get 8921_l2, rc = %ld\n",
1539 PTR_ERR(reg_l2));
1540 return -ENODEV;
1541 }
1542
1543 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1544 if (rc) {
1545 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1546 return -EINVAL;
1547 }
1548
1549 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1550 "vdd_lvds_3p3v");
1551 if (IS_ERR(reg_ext_3p3v)) {
1552 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1553 PTR_ERR(reg_ext_3p3v));
1554 return -ENODEV;
1555 }
1556
1557 rc = gpio_request(gpio21, "disp_pwr_en_n");
1558 if (rc) {
1559 pr_err("request gpio 21 failed, rc=%d\n", rc);
1560 return -ENODEV;
1561 }
1562
1563 rc = gpio_request(gpio43, "disp_rst_n");
1564 if (rc) {
1565 pr_err("request gpio 43 failed, rc=%d\n", rc);
1566 return -ENODEV;
1567 }
1568
1569 rc = gpio_request(gpio24, "disp_backlight_pwm");
1570 if (rc) {
1571 pr_err("request gpio 24 failed, rc=%d\n", rc);
1572 return -ENODEV;
1573 }
1574
1575 dsi_power_on = true;
1576 }
1577
1578 if (on) {
1579 rc = regulator_set_optimum_mode(reg_l2, 100000);
1580 if (rc < 0) {
1581 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1582 return -EINVAL;
1583 }
1584 rc = regulator_enable(reg_l2);
1585 if (rc) {
1586 pr_err("enable l2 failed, rc=%d\n", rc);
1587 return -ENODEV;
1588 }
1589
1590 rc = regulator_enable(reg_ext_3p3v);
1591 if (rc) {
1592 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1593 return -ENODEV;
1594 }
1595
1596 /* set reset pin before power enable */
1597 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1598
1599 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1600 msleep(20);
1601 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1602 msleep(20);
1603 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1604 msleep(20);
1605 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1606 msleep(20);
1607 } else {
1608 gpio_set_value_cansleep(gpio43, 0);
1609 gpio_set_value_cansleep(gpio21, 1);
1610
1611 rc = regulator_disable(reg_l2);
1612 if (rc) {
1613 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1614 return -ENODEV;
1615 }
1616 rc = regulator_disable(reg_ext_3p3v);
1617 if (rc) {
1618 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1619 return -ENODEV;
1620 }
1621 rc = regulator_set_optimum_mode(reg_l2, 100);
1622 if (rc < 0) {
1623 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1624 return -EINVAL;
1625 }
1626 }
1627
1628 return 0;
1629}
1630
1631static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001632{
1633 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001634 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001635 int rc;
1636
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001637 pr_info("%s: state : %d\n", __func__, on);
1638
1639 if (!dsi_power_on) {
1640
1641 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1642 "dsi_vdc");
1643 if (IS_ERR(reg_l8)) {
1644 pr_err("could not get 8921_l8, rc = %ld\n",
1645 PTR_ERR(reg_l8));
1646 return -ENODEV;
1647 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001648 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1649 "dsi_vddio");
1650 if (IS_ERR(reg_l23)) {
1651 pr_err("could not get 8921_l23, rc = %ld\n",
1652 PTR_ERR(reg_l23));
1653 return -ENODEV;
1654 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001655 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1656 "dsi_vdda");
1657 if (IS_ERR(reg_l2)) {
1658 pr_err("could not get 8921_l2, rc = %ld\n",
1659 PTR_ERR(reg_l2));
1660 return -ENODEV;
1661 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001662 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1663 if (rc) {
1664 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1665 return -EINVAL;
1666 }
1667 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1668 if (rc) {
1669 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1670 return -EINVAL;
1671 }
1672 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1673 if (rc) {
1674 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1675 return -EINVAL;
1676 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001677 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1678 rc = gpio_request(gpio43, "disp_rst_n");
1679 if (rc) {
1680 pr_err("request gpio 43 failed, rc=%d\n", rc);
1681 return -ENODEV;
1682 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001683 dsi_power_on = true;
1684 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001685 if (on) {
1686 rc = regulator_set_optimum_mode(reg_l8, 100000);
1687 if (rc < 0) {
1688 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1689 return -EINVAL;
1690 }
1691 rc = regulator_set_optimum_mode(reg_l23, 100000);
1692 if (rc < 0) {
1693 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1694 return -EINVAL;
1695 }
1696 rc = regulator_set_optimum_mode(reg_l2, 100000);
1697 if (rc < 0) {
1698 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1699 return -EINVAL;
1700 }
1701 rc = regulator_enable(reg_l8);
1702 if (rc) {
1703 pr_err("enable l8 failed, rc=%d\n", rc);
1704 return -ENODEV;
1705 }
1706 rc = regulator_enable(reg_l23);
1707 if (rc) {
1708 pr_err("enable l8 failed, rc=%d\n", rc);
1709 return -ENODEV;
1710 }
1711 rc = regulator_enable(reg_l2);
1712 if (rc) {
1713 pr_err("enable l2 failed, rc=%d\n", rc);
1714 return -ENODEV;
1715 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716 gpio_set_value_cansleep(gpio43, 1);
1717 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001718 rc = regulator_disable(reg_l2);
1719 if (rc) {
1720 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1721 return -ENODEV;
1722 }
1723 rc = regulator_disable(reg_l8);
1724 if (rc) {
1725 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1726 return -ENODEV;
1727 }
1728 rc = regulator_disable(reg_l23);
1729 if (rc) {
1730 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1731 return -ENODEV;
1732 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001733 rc = regulator_set_optimum_mode(reg_l8, 100);
1734 if (rc < 0) {
1735 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1736 return -EINVAL;
1737 }
1738 rc = regulator_set_optimum_mode(reg_l23, 100);
1739 if (rc < 0) {
1740 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1741 return -EINVAL;
1742 }
1743 rc = regulator_set_optimum_mode(reg_l2, 100);
1744 if (rc < 0) {
1745 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1746 return -EINVAL;
1747 }
1748 gpio_set_value_cansleep(gpio43, 0);
1749 }
1750 return 0;
1751}
1752
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001753static int mipi_dsi_panel_power(int on)
1754{
1755 int ret;
1756
1757 pr_info("%s: on=%d\n", __func__, on);
1758
1759 if (machine_is_msm8960_liquid())
1760 ret = mipi_dsi_liquid_panel_power(on);
1761 else
1762 ret = mipi_dsi_cdp_panel_power(on);
1763
1764 return ret;
1765}
1766
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001767static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1768 .vsync_gpio = MDP_VSYNC_GPIO,
1769 .dsi_power_save = mipi_dsi_panel_power,
1770};
1771
1772#ifdef CONFIG_MSM_BUS_SCALING
1773
1774static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001775 {
1776 .src = MSM_BUS_MASTER_MDP_PORT0,
1777 .dst = MSM_BUS_SLAVE_EBI_CH0,
1778 .ab = 0,
1779 .ib = 0,
1780 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001781};
1782
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001783#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1784static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1785 /* If HDMI is used as primary */
1786 {
1787 .src = MSM_BUS_MASTER_MDP_PORT0,
1788 .dst = MSM_BUS_SLAVE_EBI_CH0,
1789 .ab = 2000000000,
1790 .ib = 2000000000,
1791 },
1792};
1793static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1794 {
1795 ARRAY_SIZE(mdp_init_vectors),
1796 mdp_init_vectors,
1797 },
1798 {
1799 ARRAY_SIZE(hdmi_as_primary_vectors),
1800 hdmi_as_primary_vectors,
1801 },
1802 {
1803 ARRAY_SIZE(hdmi_as_primary_vectors),
1804 hdmi_as_primary_vectors,
1805 },
1806 {
1807 ARRAY_SIZE(hdmi_as_primary_vectors),
1808 hdmi_as_primary_vectors,
1809 },
1810 {
1811 ARRAY_SIZE(hdmi_as_primary_vectors),
1812 hdmi_as_primary_vectors,
1813 },
1814 {
1815 ARRAY_SIZE(hdmi_as_primary_vectors),
1816 hdmi_as_primary_vectors,
1817 },
1818};
1819#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001820static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001821 {
1822 .src = MSM_BUS_MASTER_MDP_PORT0,
1823 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001824 .ab = 216000000 * 2,
1825 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001826 },
1827};
1828
1829static struct msm_bus_vectors mdp_vga_vectors[] = {
1830 /* VGA and less video */
1831 {
1832 .src = MSM_BUS_MASTER_MDP_PORT0,
1833 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001834 .ab = 216000000 * 2,
1835 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001836 },
1837};
1838
1839static struct msm_bus_vectors mdp_720p_vectors[] = {
1840 /* 720p and less video */
1841 {
1842 .src = MSM_BUS_MASTER_MDP_PORT0,
1843 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001844 .ab = 230400000 * 2,
1845 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001846 },
1847};
1848
1849static struct msm_bus_vectors mdp_1080p_vectors[] = {
1850 /* 1080p and less video */
1851 {
1852 .src = MSM_BUS_MASTER_MDP_PORT0,
1853 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001854 .ab = 334080000 * 2,
1855 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001856 },
1857};
1858
1859static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1860 {
1861 ARRAY_SIZE(mdp_init_vectors),
1862 mdp_init_vectors,
1863 },
1864 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001865 ARRAY_SIZE(mdp_ui_vectors),
1866 mdp_ui_vectors,
1867 },
1868 {
1869 ARRAY_SIZE(mdp_ui_vectors),
1870 mdp_ui_vectors,
1871 },
1872 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001873 ARRAY_SIZE(mdp_vga_vectors),
1874 mdp_vga_vectors,
1875 },
1876 {
1877 ARRAY_SIZE(mdp_720p_vectors),
1878 mdp_720p_vectors,
1879 },
1880 {
1881 ARRAY_SIZE(mdp_1080p_vectors),
1882 mdp_1080p_vectors,
1883 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001884};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001885#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001886
1887static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1888 mdp_bus_scale_usecases,
1889 ARRAY_SIZE(mdp_bus_scale_usecases),
1890 .name = "mdp",
1891};
1892
1893#endif
1894
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001895#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1896int mdp_core_clk_rate_table[] = {
1897 200000000,
1898 200000000,
1899 200000000,
1900 200000000,
1901};
1902#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903int mdp_core_clk_rate_table[] = {
1904 85330000,
1905 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001906 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907 200000000,
1908};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001909#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001910
1911static struct msm_panel_common_pdata mdp_pdata = {
1912 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001913#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1914 .mdp_core_clk_rate = 200000000,
1915#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001916 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001917#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001918 .mdp_core_clk_table = mdp_core_clk_rate_table,
1919 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1920#ifdef CONFIG_MSM_BUS_SCALING
1921 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1922#endif
1923 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001924 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001925};
1926
1927static struct platform_device mipi_dsi_renesas_panel_device = {
1928 .name = "mipi_renesas",
1929 .id = 0,
1930};
1931
1932static struct platform_device mipi_dsi_simulator_panel_device = {
1933 .name = "mipi_simulator",
1934 .id = 0,
1935};
1936
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001937#define LPM_CHANNEL0 0
1938static int toshiba_gpio[] = {LPM_CHANNEL0};
1939
1940static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1941 .gpio = toshiba_gpio,
1942};
1943
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001944static struct platform_device mipi_dsi_toshiba_panel_device = {
1945 .name = "mipi_toshiba",
1946 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001947 .dev = {
1948 .platform_data = &toshiba_pdata,
1949 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950};
1951
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001952static int dsi2lvds_gpio[2] = {
1953 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1954 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1955 };
1956
1957static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1958 .gpio_num = dsi2lvds_gpio,
1959};
1960
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001961static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1962
1963/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1964 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1965 /* timing */
1966 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1967 0x0c, 0x03, 0x04, 0xa0},
1968 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1969 {0xff, 0x00, 0x06, 0x00}, /* strength */
1970 /* pll control */
1971 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1972 0x40, 0x07, 0x03,
1973 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1974};
1975
1976static struct mipi_dsi_panel_platform_data novatek_pdata = {
1977 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1978};
1979
1980static struct platform_device mipi_dsi_novatek_panel_device = {
1981 .name = "mipi_novatek",
1982 .id = 0,
1983 .dev = {
1984 .platform_data = &novatek_pdata,
1985 }
1986};
1987
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001988static struct platform_device mipi_dsi2lvds_bridge_device = {
1989 .name = "mipi_tc358764",
1990 .id = 0,
1991 .dev.platform_data = &mipi_dsi2lvds_pdata,
1992};
1993
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001994#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1995static struct resource hdmi_msm_resources[] = {
1996 {
1997 .name = "hdmi_msm_qfprom_addr",
1998 .start = 0x00700000,
1999 .end = 0x007060FF,
2000 .flags = IORESOURCE_MEM,
2001 },
2002 {
2003 .name = "hdmi_msm_hdmi_addr",
2004 .start = 0x04A00000,
2005 .end = 0x04A00FFF,
2006 .flags = IORESOURCE_MEM,
2007 },
2008 {
2009 .name = "hdmi_msm_irq",
2010 .start = HDMI_IRQ,
2011 .end = HDMI_IRQ,
2012 .flags = IORESOURCE_IRQ,
2013 },
2014};
2015
2016static int hdmi_enable_5v(int on);
2017static int hdmi_core_power(int on, int show);
2018static int hdmi_cec_power(int on);
2019
2020static struct msm_hdmi_platform_data hdmi_msm_data = {
2021 .irq = HDMI_IRQ,
2022 .enable_5v = hdmi_enable_5v,
2023 .core_power = hdmi_core_power,
2024 .cec_power = hdmi_cec_power,
2025};
2026
2027static struct platform_device hdmi_msm_device = {
2028 .name = "hdmi_msm",
2029 .id = 0,
2030 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2031 .resource = hdmi_msm_resources,
2032 .dev.platform_data = &hdmi_msm_data,
2033};
2034#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2035
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002036#ifdef CONFIG_MSM_BUS_SCALING
2037static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2038 {
2039 .src = MSM_BUS_MASTER_MDP_PORT0,
2040 .dst = MSM_BUS_SLAVE_EBI_CH0,
2041 .ab = 0,
2042 .ib = 0,
2043 },
2044};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002045
2046#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2047static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2048 {
2049 .src = MSM_BUS_MASTER_MDP_PORT0,
2050 .dst = MSM_BUS_SLAVE_EBI_CH0,
2051 .ab = 2000000000,
2052 .ib = 2000000000,
2053 },
2054};
2055#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002056static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2057 {
2058 .src = MSM_BUS_MASTER_MDP_PORT0,
2059 .dst = MSM_BUS_SLAVE_EBI_CH0,
2060 .ab = 566092800 * 2,
2061 .ib = 707616000 * 2,
2062 },
2063};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002064#endif
2065
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002066static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2067 {
2068 ARRAY_SIZE(dtv_bus_init_vectors),
2069 dtv_bus_init_vectors,
2070 },
2071 {
2072 ARRAY_SIZE(dtv_bus_def_vectors),
2073 dtv_bus_def_vectors,
2074 },
2075};
2076static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2077 dtv_bus_scale_usecases,
2078 ARRAY_SIZE(dtv_bus_scale_usecases),
2079 .name = "dtv",
2080};
2081
2082static struct lcdc_platform_data dtv_pdata = {
2083 .bus_scale_table = &dtv_bus_scale_pdata,
2084};
2085#endif
2086
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002087static void __init msm_fb_add_devices(void)
2088{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002089 struct platform_device *ptr = NULL;
2090
2091 if (machine_is_msm8960_liquid())
2092 ptr = &mipi_dsi2lvds_bridge_device;
2093 else
2094 ptr = &mipi_dsi_toshiba_panel_device;
2095 platform_add_devices(&ptr, 1);
2096
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002097 if (machine_is_msm8x60_rumi3()) {
2098 msm_fb_register_device("mdp", NULL);
2099 mipi_dsi_pdata.target_type = 1;
2100 } else
2101 msm_fb_register_device("mdp", &mdp_pdata);
2102 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002103#ifdef CONFIG_MSM_BUS_SCALING
2104 msm_fb_register_device("dtv", &dtv_pdata);
2105#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002106}
2107
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002108static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2109 .func = GPIOMUX_FUNC_GPIO,
2110 .drv = GPIOMUX_DRV_2MA,
2111 .pull = GPIOMUX_PULL_DOWN,
2112};
2113
2114static struct gpiomux_setting mdp_vsync_active_cfg = {
2115 .func = GPIOMUX_FUNC_1,
2116 .drv = GPIOMUX_DRV_2MA,
2117 .pull = GPIOMUX_PULL_DOWN,
2118};
2119
2120static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2121 {
2122 .gpio = MDP_VSYNC_GPIO,
2123 .settings = {
2124 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2125 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2126 },
2127 }
2128};
2129
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002130#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2131static struct gpiomux_setting hdmi_suspend_cfg = {
2132 .func = GPIOMUX_FUNC_GPIO,
2133 .drv = GPIOMUX_DRV_2MA,
2134 .pull = GPIOMUX_PULL_DOWN,
2135};
2136
2137static struct gpiomux_setting hdmi_active_1_cfg = {
2138 .func = GPIOMUX_FUNC_1,
2139 .drv = GPIOMUX_DRV_2MA,
2140 .pull = GPIOMUX_PULL_UP,
2141};
2142
2143static struct gpiomux_setting hdmi_active_2_cfg = {
2144 .func = GPIOMUX_FUNC_1,
2145 .drv = GPIOMUX_DRV_2MA,
2146 .pull = GPIOMUX_PULL_DOWN,
2147};
2148
2149static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2150 {
2151 .gpio = 99,
2152 .settings = {
2153 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2154 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2155 },
2156 },
2157 {
2158 .gpio = 100,
2159 .settings = {
2160 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2161 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2162 },
2163 },
2164 {
2165 .gpio = 101,
2166 .settings = {
2167 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2168 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2169 },
2170 },
2171 {
2172 .gpio = 102,
2173 .settings = {
2174 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2175 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2176 },
2177 },
2178};
2179
2180static int hdmi_enable_5v(int on)
2181{
2182 /* TBD: PM8921 regulator instead of 8901 */
2183 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2184 static int prev_on;
2185 int rc;
2186
2187 if (on == prev_on)
2188 return 0;
2189
2190 if (!reg_8921_hdmi_mvs)
2191 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2192 "hdmi_mvs");
2193
2194 if (on) {
2195 rc = regulator_enable(reg_8921_hdmi_mvs);
2196 if (rc) {
2197 pr_err("'%s' regulator enable failed, rc=%d\n",
2198 "8921_hdmi_mvs", rc);
2199 return rc;
2200 }
2201 pr_debug("%s(on): success\n", __func__);
2202 } else {
2203 rc = regulator_disable(reg_8921_hdmi_mvs);
2204 if (rc)
2205 pr_warning("'%s' regulator disable failed, rc=%d\n",
2206 "8921_hdmi_mvs", rc);
2207 pr_debug("%s(off): success\n", __func__);
2208 }
2209
2210 prev_on = on;
2211
2212 return 0;
2213}
2214
2215static int hdmi_core_power(int on, int show)
2216{
2217 static struct regulator *reg_8921_l23, *reg_8921_s4;
2218 static int prev_on;
2219 int rc;
2220
2221 if (on == prev_on)
2222 return 0;
2223
2224 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002225 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002226 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002227 if (IS_ERR(reg_8921_l23)) {
2228 pr_err("could not get reg_8921_l23, rc = %ld\n",
2229 PTR_ERR(reg_8921_l23));
2230 return -ENODEV;
2231 }
2232 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2233 if (rc) {
2234 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2235 return -EINVAL;
2236 }
2237 }
2238 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002239 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002240 if (IS_ERR(reg_8921_s4)) {
2241 pr_err("could not get reg_8921_s4, rc = %ld\n",
2242 PTR_ERR(reg_8921_s4));
2243 return -ENODEV;
2244 }
2245 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2246 if (rc) {
2247 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2248 return -EINVAL;
2249 }
2250 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002251
2252 if (on) {
2253 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2254 if (rc < 0) {
2255 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2256 return -EINVAL;
2257 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002258 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002259 if (rc) {
2260 pr_err("'%s' regulator enable failed, rc=%d\n",
2261 "hdmi_avdd", rc);
2262 return rc;
2263 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002264 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002265 if (rc) {
2266 pr_err("'%s' regulator enable failed, rc=%d\n",
2267 "hdmi_vcc", rc);
2268 return rc;
2269 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002270 rc = gpio_request(100, "HDMI_DDC_CLK");
2271 if (rc) {
2272 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2273 "HDMI_DDC_CLK", 100, rc);
2274 goto error1;
2275 }
2276 rc = gpio_request(101, "HDMI_DDC_DATA");
2277 if (rc) {
2278 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2279 "HDMI_DDC_DATA", 101, rc);
2280 goto error2;
2281 }
2282 rc = gpio_request(102, "HDMI_HPD");
2283 if (rc) {
2284 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2285 "HDMI_HPD", 102, rc);
2286 goto error3;
2287 }
2288 pr_debug("%s(on): success\n", __func__);
2289 } else {
2290 gpio_free(100);
2291 gpio_free(101);
2292 gpio_free(102);
2293
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002294 rc = regulator_disable(reg_8921_l23);
2295 if (rc) {
2296 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2297 return -ENODEV;
2298 }
2299 rc = regulator_disable(reg_8921_s4);
2300 if (rc) {
2301 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2302 return -ENODEV;
2303 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002304 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2305 if (rc < 0) {
2306 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2307 return -EINVAL;
2308 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309 pr_debug("%s(off): success\n", __func__);
2310 }
2311
2312 prev_on = on;
2313
2314 return 0;
2315
2316error3:
2317 gpio_free(101);
2318error2:
2319 gpio_free(100);
2320error1:
2321 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002322 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002323 return rc;
2324}
2325
2326static int hdmi_cec_power(int on)
2327{
2328 static int prev_on;
2329 int rc;
2330
2331 if (on == prev_on)
2332 return 0;
2333
2334 if (on) {
2335 rc = gpio_request(99, "HDMI_CEC_VAR");
2336 if (rc) {
2337 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2338 "HDMI_CEC_VAR", 99, rc);
2339 goto error;
2340 }
2341 pr_debug("%s(on): success\n", __func__);
2342 } else {
2343 gpio_free(99);
2344 pr_debug("%s(off): success\n", __func__);
2345 }
2346
2347 prev_on = on;
2348
2349 return 0;
2350error:
2351 return rc;
2352}
2353#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2354
2355static void __init msm8960_allocate_memory_regions(void)
2356{
2357 void *addr;
2358 unsigned long size;
2359
2360 size = MSM_FB_SIZE;
2361 addr = alloc_bootmem_align(size, 0x1000);
2362 msm_fb_resources[0].start = __pa(addr);
2363 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2364 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2365 size, addr, __pa(addr));
2366
2367}
2368#ifdef CONFIG_WCD9310_CODEC
2369
2370#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2371
Patrick Lai3043fba2011-08-01 14:15:57 -07002372/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2373 * 4 micbiases are used to power various analog and digital
2374 * microphones operating at 1800 mV. Technically, all micbiases
2375 * can source from single cfilter since all microphones operate
2376 * at the same voltage level. The arrangement below is to make
2377 * sure all cfilters are exercised. LDO_H regulator ouput level
2378 * does not need to be as high as 2.85V. It is choosen for
2379 * microphone sensitivity purpose.
2380 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002381static struct tabla_pdata tabla_platform_data = {
2382 .slimbus_slave_device = {
2383 .name = "tabla-slave",
2384 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2385 },
2386 .irq = MSM_GPIO_TO_INT(62),
2387 .irq_base = TABLA_INTERRUPT_BASE,
2388 .num_irqs = NR_TABLA_IRQS,
2389 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002390 .micbias = {
2391 .ldoh_v = TABLA_LDOH_2P85_V,
2392 .cfilt1_mv = 1800,
2393 .cfilt2_mv = 1800,
2394 .cfilt3_mv = 1800,
2395 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2396 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2397 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2398 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2399 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002400};
2401
2402static struct slim_device msm_slim_tabla = {
2403 .name = "tabla-slim",
2404 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2405 .dev = {
2406 .platform_data = &tabla_platform_data,
2407 },
2408};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302409
2410static struct tabla_pdata tabla20_platform_data = {
2411 .slimbus_slave_device = {
2412 .name = "tabla-slave",
2413 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2414 },
2415 .irq = MSM_GPIO_TO_INT(62),
2416 .irq_base = TABLA_INTERRUPT_BASE,
2417 .num_irqs = NR_TABLA_IRQS,
2418 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2419 .micbias = {
2420 .ldoh_v = TABLA_LDOH_2P85_V,
2421 .cfilt1_mv = 1800,
2422 .cfilt2_mv = 1800,
2423 .cfilt3_mv = 1800,
2424 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2425 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2426 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2427 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2428 }
2429};
2430
2431static struct slim_device msm_slim_tabla20 = {
2432 .name = "tabla2x-slim",
2433 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2434 .dev = {
2435 .platform_data = &tabla20_platform_data,
2436 },
2437};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002438#endif
2439
2440static struct slim_boardinfo msm_slim_devices[] = {
2441#ifdef CONFIG_WCD9310_CODEC
2442 {
2443 .bus_num = 1,
2444 .slim_slave = &msm_slim_tabla,
2445 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302446 {
2447 .bus_num = 1,
2448 .slim_slave = &msm_slim_tabla20,
2449 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002450#endif
2451 /* add more slimbus slaves as needed */
2452};
2453
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002454#define MSM_WCNSS_PHYS 0x03000000
2455#define MSM_WCNSS_SIZE 0x280000
2456
2457static struct resource resources_wcnss_wlan[] = {
2458 {
2459 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2460 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2461 .name = "wcnss_wlanrx_irq",
2462 .flags = IORESOURCE_IRQ,
2463 },
2464 {
2465 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2466 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2467 .name = "wcnss_wlantx_irq",
2468 .flags = IORESOURCE_IRQ,
2469 },
2470 {
2471 .start = MSM_WCNSS_PHYS,
2472 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2473 .name = "wcnss_mmio",
2474 .flags = IORESOURCE_MEM,
2475 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002476 {
2477 .start = 84,
2478 .end = 88,
2479 .name = "wcnss_gpios_5wire",
2480 .flags = IORESOURCE_IO,
2481 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002482};
2483
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002484static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2485 .has_48mhz_xo = 1,
2486};
2487
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002488static struct platform_device msm_device_wcnss_wlan = {
2489 .name = "wcnss_wlan",
2490 .id = 0,
2491 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2492 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002493 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002494};
2495
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002496#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2497 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2498 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2499 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2500
2501#define QCE_SIZE 0x10000
2502#define QCE_0_BASE 0x18500000
2503
2504#define QCE_HW_KEY_SUPPORT 0
2505#define QCE_SHA_HMAC_SUPPORT 1
2506#define QCE_SHARE_CE_RESOURCE 1
2507#define QCE_CE_SHARED 0
2508
2509static struct resource qcrypto_resources[] = {
2510 [0] = {
2511 .start = QCE_0_BASE,
2512 .end = QCE_0_BASE + QCE_SIZE - 1,
2513 .flags = IORESOURCE_MEM,
2514 },
2515 [1] = {
2516 .name = "crypto_channels",
2517 .start = DMOV_CE_IN_CHAN,
2518 .end = DMOV_CE_OUT_CHAN,
2519 .flags = IORESOURCE_DMA,
2520 },
2521 [2] = {
2522 .name = "crypto_crci_in",
2523 .start = DMOV_CE_IN_CRCI,
2524 .end = DMOV_CE_IN_CRCI,
2525 .flags = IORESOURCE_DMA,
2526 },
2527 [3] = {
2528 .name = "crypto_crci_out",
2529 .start = DMOV_CE_OUT_CRCI,
2530 .end = DMOV_CE_OUT_CRCI,
2531 .flags = IORESOURCE_DMA,
2532 },
2533};
2534
2535static struct resource qcedev_resources[] = {
2536 [0] = {
2537 .start = QCE_0_BASE,
2538 .end = QCE_0_BASE + QCE_SIZE - 1,
2539 .flags = IORESOURCE_MEM,
2540 },
2541 [1] = {
2542 .name = "crypto_channels",
2543 .start = DMOV_CE_IN_CHAN,
2544 .end = DMOV_CE_OUT_CHAN,
2545 .flags = IORESOURCE_DMA,
2546 },
2547 [2] = {
2548 .name = "crypto_crci_in",
2549 .start = DMOV_CE_IN_CRCI,
2550 .end = DMOV_CE_IN_CRCI,
2551 .flags = IORESOURCE_DMA,
2552 },
2553 [3] = {
2554 .name = "crypto_crci_out",
2555 .start = DMOV_CE_OUT_CRCI,
2556 .end = DMOV_CE_OUT_CRCI,
2557 .flags = IORESOURCE_DMA,
2558 },
2559};
2560
2561#endif
2562
2563#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2564 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2565
2566static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2567 .ce_shared = QCE_CE_SHARED,
2568 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2569 .hw_key_support = QCE_HW_KEY_SUPPORT,
2570 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2571};
2572
2573static struct platform_device qcrypto_device = {
2574 .name = "qcrypto",
2575 .id = 0,
2576 .num_resources = ARRAY_SIZE(qcrypto_resources),
2577 .resource = qcrypto_resources,
2578 .dev = {
2579 .coherent_dma_mask = DMA_BIT_MASK(32),
2580 .platform_data = &qcrypto_ce_hw_suppport,
2581 },
2582};
2583#endif
2584
2585#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2586 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2587
2588static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2589 .ce_shared = QCE_CE_SHARED,
2590 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2591 .hw_key_support = QCE_HW_KEY_SUPPORT,
2592 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2593};
2594
2595static struct platform_device qcedev_device = {
2596 .name = "qce",
2597 .id = 0,
2598 .num_resources = ARRAY_SIZE(qcedev_resources),
2599 .resource = qcedev_resources,
2600 .dev = {
2601 .coherent_dma_mask = DMA_BIT_MASK(32),
2602 .platform_data = &qcedev_ce_hw_suppport,
2603 },
2604};
2605#endif
2606
2607
2608static int __init gpiomux_init(void)
2609{
2610 int rc;
2611
2612 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2613 if (rc) {
2614 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2615 return rc;
2616 }
2617
Nishant Pandit24153d82011-08-27 16:05:13 +05302618 msm_gpiomux_install(msm8960_cam_common_configs,
2619 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002620
2621 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002622 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002623
2624 msm_gpiomux_install(msm8960_gsbi_configs,
2625 ARRAY_SIZE(msm8960_gsbi_configs));
2626
2627 msm_gpiomux_install(msm8960_cyts_configs,
2628 ARRAY_SIZE(msm8960_cyts_configs));
2629
2630 msm_gpiomux_install(msm8960_slimbus_config,
2631 ARRAY_SIZE(msm8960_slimbus_config));
2632
2633 msm_gpiomux_install(msm8960_audio_codec_configs,
2634 ARRAY_SIZE(msm8960_audio_codec_configs));
2635
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002636 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2637 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2638
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002639#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2640 msm_gpiomux_install(msm8960_hdmi_configs,
2641 ARRAY_SIZE(msm8960_hdmi_configs));
2642#endif
2643
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002644 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2645 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2646
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002647 msm_gpiomux_install(wcnss_5wire_interface,
2648 ARRAY_SIZE(wcnss_5wire_interface));
2649
2650 return 0;
2651}
2652
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002653#define MSM_SHARED_RAM_PHYS 0x80000000
2654
2655static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2656 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2657 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2658 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2659 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2660 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2661 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2662 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2663 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2664 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2665 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2666 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2667 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002668 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2669 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2670 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2671 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2672 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2673 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2674 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2675 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2676 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2677 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2678 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2679 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2680 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2681 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002682 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002683 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2684 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2685 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002686 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2687 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002688};
2689
2690static struct pm8921_adc_properties pm8921_adc_data = {
2691 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2692 .bitresolution = 15,
2693 .bipolar = 0,
2694};
2695
2696static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2697 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002698 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002699 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002700 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002701};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002702
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002703static void __init msm8960_map_io(void)
2704{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002705 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002706 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002707
2708 if (socinfo_init() < 0)
2709 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002710}
2711
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002712#ifdef CONFIG_ARCH_MSM8930
2713static void __init msm8930_map_io(void)
2714{
2715 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2716 msm_map_msm8930_io();
2717
2718 if (socinfo_init() < 0)
2719 pr_err("socinfo_init() failed!\n");
2720}
2721#endif
2722
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002723static void __init msm8960_init_irq(void)
2724{
2725 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002726
2727 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002728 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002729 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002730
2731 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002732 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002733
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002734 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2735 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002736
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002737 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2738 * as they are configured as level, which does not play nice with
2739 * handle_percpu_irq.
2740 */
2741 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2742 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002743 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002744 }
2745}
2746
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002747/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002748enum sdcc_controllers {
2749 SDCC1,
2750 SDCC2,
2751 SDCC3,
2752 SDCC4,
2753 SDCC5,
2754 MAX_SDCC_CONTROLLER
2755};
2756
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002757/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002758static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2759 /* SDCC1 : eMMC card connected */
2760 [SDCC1] = {
2761 .name = "sdc_vdd",
2762 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302763 .high_vol_level = 2950000,
2764 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302765 .always_on = 1,
2766 .lpm_sup = 1,
2767 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002768 .hpm_uA = 200000, /* 200mA */
2769 },
2770 /* SDCC3 : External card slot connected */
2771 [SDCC3] = {
2772 .name = "sdc_vdd",
2773 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302774 .high_vol_level = 2950000,
2775 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776 .hpm_uA = 600000, /* 600mA */
2777 }
2778};
2779
2780/* Only slots having eMMC card will require VCCQ voltage */
2781static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2782 /* SDCC1 : eMMC card connected */
2783 [SDCC1] = {
2784 .name = "sdc_vccq",
2785 .set_voltage_sup = 1,
2786 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302787 .high_vol_level = 1800000,
2788 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002789 .hpm_uA = 200000, /* 200mA */
2790 }
2791};
2792
2793/* All SDCC controllers may require voting for VDD PAD voltage */
2794static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2795 /* SDCC3 : External card slot connected */
2796 [SDCC3] = {
2797 .name = "sdc_vddp",
2798 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302799 .high_vol_level = 2950000,
2800 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002801 .always_on = 1,
2802 .lpm_sup = 1,
2803 /* Max. Active current required is 16 mA */
2804 .hpm_uA = 16000,
2805 /*
2806 * Sleep current required is ~300 uA. But min. vote can be
2807 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2808 * during sleep.
2809 */
2810 .lpm_uA = 2000,
2811 }
2812};
2813
2814static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2815 /* SDCC1 : eMMC card connected */
2816 [SDCC1] = {
2817 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2818 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2819 },
2820 /* SDCC3 : External card slot connected */
2821 [SDCC3] = {
2822 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2823 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2824 }
2825};
2826
2827/* SDC1 pad data */
2828static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2829 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302830 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2831 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002832};
2833
2834static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2835 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2836 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2837 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2838};
2839
2840static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302841 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002842 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2843 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2844};
2845
2846static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302847 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002848 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2849 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2850};
2851
2852/* SDC3 pad data */
2853static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2854 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2855 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2856 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2857};
2858
2859static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2860 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2861 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2862 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2863};
2864
2865static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302866 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002867 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2868 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2869};
2870
2871static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302872 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302873 /*
2874 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2875 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2876 * which would result in false card detection interrupts.
2877 */
2878 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2879 /*
2880 * Keeping DATA lines status to PULL UP will make sure that
2881 * there is no current leak during sleep if external pull up
2882 * is connected to DATA lines.
2883 */
2884 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002885};
2886
2887struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2888 [SDCC1] = {
2889 .on = sdc1_pad_pull_on_cfg,
2890 .off = sdc1_pad_pull_off_cfg,
2891 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2892 },
2893 [SDCC3] = {
2894 .on = sdc3_pad_pull_on_cfg,
2895 .off = sdc3_pad_pull_off_cfg,
2896 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2897 },
2898};
2899
2900struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2901 [SDCC1] = {
2902 .on = sdc1_pad_drv_on_cfg,
2903 .off = sdc1_pad_drv_off_cfg,
2904 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2905 },
2906 [SDCC3] = {
2907 .on = sdc3_pad_drv_on_cfg,
2908 .off = sdc3_pad_drv_off_cfg,
2909 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2910 },
2911};
2912
2913struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2914 [SDCC1] = {
2915 .pull = &mmc_pad_pull_data[SDCC1],
2916 .drv = &mmc_pad_drv_data[SDCC1]
2917 },
2918 [SDCC3] = {
2919 .pull = &mmc_pad_pull_data[SDCC3],
2920 .drv = &mmc_pad_drv_data[SDCC3]
2921 },
2922};
2923
2924struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2925 [SDCC1] = {
2926 .pad_data = &mmc_pad_data[SDCC1],
2927 },
2928 [SDCC3] = {
2929 .pad_data = &mmc_pad_data[SDCC3],
2930 },
2931};
2932
2933static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302934 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002935};
2936
2937static unsigned int sdc3_sup_clk_rates[] = {
2938 400000, 24000000, 48000000, 96000000
2939};
2940
2941#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2942static struct mmc_platform_data msm8960_sdc1_data = {
2943 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2944#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2945 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2946#else
2947 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2948#endif
2949 .sup_clk_table = sdc1_sup_clk_rates,
2950 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302951 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002952 .nonremovable = 1,
2953 .sdcc_v4_sup = true,
2954 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302955 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002956};
2957#endif
2958
2959#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2960static struct mmc_platform_data msm8960_sdc3_data = {
2961 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2962 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2963 .sup_clk_table = sdc3_sup_clk_rates,
2964 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302965 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302966#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002967 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302968#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002969 .sdcc_v4_sup = true,
2970 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2971 .pin_data = &mmc_slot_pin_data[SDCC3],
2972#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2973 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2974 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2975 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2976#endif
2977 .xpc_cap = 1,
2978 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2979 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302980 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002981};
2982#endif
2983
2984static void __init msm8960_init_mmc(void)
2985{
2986#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2987 /* SDC1 : eMMC card connected */
2988 msm_add_sdcc(1, &msm8960_sdc1_data);
2989#endif
2990#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2991 /* SDC3: External card slot */
2992 msm_add_sdcc(3, &msm8960_sdc3_data);
2993#endif
2994}
2995
2996static void __init msm8960_init_buses(void)
2997{
2998#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06002999 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003000 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3001 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3002 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3003 msm_bus_apps_fabric.dev.platform_data =
3004 &msm_bus_8960_apps_fabric_pdata;
3005 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3006 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3007 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3008 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003009#endif
3010}
3011
3012static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3013 .max_clock_speed = 15060000,
3014};
3015
3016#ifdef CONFIG_USB_MSM_OTG_72K
3017static struct msm_otg_platform_data msm_otg_pdata;
3018#else
3019#define USB_5V_EN 42
3020static void msm_hsusb_vbus_power(bool on)
3021{
3022 int rc;
3023 static bool vbus_is_on;
3024 static struct regulator *mvs_otg_switch;
3025 struct pm_gpio param = {
3026 .direction = PM_GPIO_DIR_OUT,
3027 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3028 .output_value = 1,
3029 .pull = PM_GPIO_PULL_NO,
3030 .vin_sel = PM_GPIO_VIN_S4,
3031 .out_strength = PM_GPIO_STRENGTH_MED,
3032 .function = PM_GPIO_FUNC_NORMAL,
3033 };
3034
3035 if (vbus_is_on == on)
3036 return;
3037
3038 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003039 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3040 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003041 if (IS_ERR(mvs_otg_switch)) {
3042 pr_err("Unable to get mvs_otg_switch\n");
3043 return;
3044 }
3045
3046 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3047 "usb_5v_en");
3048 if (rc < 0) {
3049 pr_err("failed to request usb_5v_en gpio\n");
3050 goto put_mvs_otg;
3051 }
3052
3053 if (regulator_enable(mvs_otg_switch)) {
3054 pr_err("unable to enable mvs_otg_switch\n");
3055 goto free_usb_5v_en;
3056 }
3057
3058 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3059 &param);
3060 if (rc < 0) {
3061 pr_err("failed to configure usb_5v_en gpio\n");
3062 goto disable_mvs_otg;
3063 }
3064 vbus_is_on = true;
3065 return;
3066 }
3067disable_mvs_otg:
3068 regulator_disable(mvs_otg_switch);
3069free_usb_5v_en:
3070 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
3071put_mvs_otg:
3072 regulator_put(mvs_otg_switch);
3073 vbus_is_on = false;
3074}
3075
3076static struct msm_otg_platform_data msm_otg_pdata = {
3077 .mode = USB_OTG,
3078 .otg_control = OTG_PMIC_CONTROL,
3079 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3080 .pclk_src_name = "dfab_usb_hs_clk",
3081 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3082 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303083 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003084};
3085#endif
3086
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303087#ifdef CONFIG_USB_EHCI_MSM_HSIC
3088static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3089 .strobe = 150,
3090 .data = 151,
3091};
3092#else
3093static struct msm_hsic_host_platform_data msm_hsic_pdata;
3094#endif
3095
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003096#define PID_MAGIC_ID 0x71432909
3097#define SERIAL_NUM_MAGIC_ID 0x61945374
3098#define SERIAL_NUMBER_LENGTH 127
3099#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3100
3101struct magic_num_struct {
3102 uint32_t pid;
3103 uint32_t serial_num;
3104};
3105
3106struct dload_struct {
3107 uint32_t reserved1;
3108 uint32_t reserved2;
3109 uint32_t reserved3;
3110 uint16_t reserved4;
3111 uint16_t pid;
3112 char serial_number[SERIAL_NUMBER_LENGTH];
3113 uint16_t reserved5;
3114 struct magic_num_struct magic_struct;
3115};
3116
3117static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3118{
3119 struct dload_struct __iomem *dload = 0;
3120
3121 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3122 if (!dload) {
3123 pr_err("%s: cannot remap I/O memory region: %08x\n",
3124 __func__, DLOAD_USB_BASE_ADD);
3125 return -ENXIO;
3126 }
3127
3128 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3129 __func__, dload, pid, snum);
3130 /* update pid */
3131 dload->magic_struct.pid = PID_MAGIC_ID;
3132 dload->pid = pid;
3133
3134 /* update serial number */
3135 dload->magic_struct.serial_num = 0;
3136 if (!snum) {
3137 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3138 goto out;
3139 }
3140
3141 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003142 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003143out:
3144 iounmap(dload);
3145 return 0;
3146}
3147
3148static struct android_usb_platform_data android_usb_pdata = {
3149 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3150};
3151
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003152static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003153 .name = "android_usb",
3154 .id = -1,
3155 .dev = {
3156 .platform_data = &android_usb_pdata,
3157 },
3158};
3159
3160static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3161 0x03, 0x0f,
3162};
3163
3164static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3165 0x00, 0x24, 0x54, 0x10,
3166 0x09, 0x03, 0x01,
3167 0x10, 0x54, 0x30, 0x0C,
3168 0x24, 0x30, 0x0f,
3169};
3170
3171static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3172 0x00, 0x24, 0x54, 0x10,
3173 0x09, 0x07, 0x01, 0x0B,
3174 0x10, 0x54, 0x30, 0x0C,
3175 0x24, 0x30, 0x0f,
3176};
3177
3178static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3179 [0] = {
3180 .mode = MSM_SPM_MODE_CLOCK_GATING,
3181 .notify_rpm = false,
3182 .cmd = spm_wfi_cmd_sequence,
3183 },
3184 [1] = {
3185 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3186 .notify_rpm = false,
3187 .cmd = spm_power_collapse_without_rpm,
3188 },
3189 [2] = {
3190 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3191 .notify_rpm = true,
3192 .cmd = spm_power_collapse_with_rpm,
3193 },
3194};
3195
3196static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3197 [0] = {
3198 .reg_base_addr = MSM_SAW0_BASE,
3199 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3200 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3201 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3202#if defined(CONFIG_MSM_AVS_HW)
3203 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3204 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3205#endif
3206 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3207 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3208 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3209 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3210 .vctl_timeout_us = 50,
3211 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3212 .modes = msm_spm_seq_list,
3213 },
3214 [1] = {
3215 .reg_base_addr = MSM_SAW1_BASE,
3216 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3217 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3218 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3219#if defined(CONFIG_MSM_AVS_HW)
3220 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3221 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3222#endif
3223 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3224 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3225 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3226 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3227 .vctl_timeout_us = 50,
3228 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3229 .modes = msm_spm_seq_list,
3230 },
3231};
3232
3233static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3234 0x00, 0x20, 0x03, 0x20,
3235 0x00, 0x0f,
3236};
3237
3238static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3239 0x00, 0x20, 0x34, 0x64,
3240 0x48, 0x07, 0x48, 0x20,
3241 0x50, 0x64, 0x04, 0x34,
3242 0x50, 0x0f,
3243};
3244static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3245 0x00, 0x10, 0x34, 0x64,
3246 0x48, 0x07, 0x48, 0x10,
3247 0x50, 0x64, 0x04, 0x34,
3248 0x50, 0x0F,
3249};
3250
3251static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3252 [0] = {
3253 .mode = MSM_SPM_L2_MODE_RETENTION,
3254 .notify_rpm = false,
3255 .cmd = l2_spm_wfi_cmd_sequence,
3256 },
3257 [1] = {
3258 .mode = MSM_SPM_L2_MODE_GDHS,
3259 .notify_rpm = true,
3260 .cmd = l2_spm_gdhs_cmd_sequence,
3261 },
3262 [2] = {
3263 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3264 .notify_rpm = true,
3265 .cmd = l2_spm_power_off_cmd_sequence,
3266 },
3267};
3268
3269
3270static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3271 [0] = {
3272 .reg_base_addr = MSM_SAW_L2_BASE,
3273 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3274 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3275 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3276 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3277 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3278 .modes = msm_spm_l2_seq_list,
3279 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3280 },
3281};
3282
3283#define CYTTSP_TS_GPIO_IRQ 11
3284#define CYTTSP_TS_SLEEP_GPIO 50
3285#define CYTTSP_TS_RESOUT_N_GPIO 52
3286
3287/*virtual key support */
3288static ssize_t tma340_vkeys_show(struct kobject *kobj,
3289 struct kobj_attribute *attr, char *buf)
3290{
3291 return snprintf(buf, 200,
3292 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3293 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3294 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3295 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3296 "\n");
3297}
3298
3299static struct kobj_attribute tma340_vkeys_attr = {
3300 .attr = {
3301 .mode = S_IRUGO,
3302 },
3303 .show = &tma340_vkeys_show,
3304};
3305
3306static struct attribute *tma340_properties_attrs[] = {
3307 &tma340_vkeys_attr.attr,
3308 NULL
3309};
3310
3311static struct attribute_group tma340_properties_attr_group = {
3312 .attrs = tma340_properties_attrs,
3313};
3314
3315
3316static int cyttsp_platform_init(struct i2c_client *client)
3317{
3318 int rc = 0;
3319 static struct kobject *tma340_properties_kobj;
3320
3321 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3322 tma340_properties_kobj = kobject_create_and_add("board_properties",
3323 NULL);
3324 if (tma340_properties_kobj)
3325 rc = sysfs_create_group(tma340_properties_kobj,
3326 &tma340_properties_attr_group);
3327 if (!tma340_properties_kobj || rc)
3328 pr_err("%s: failed to create board_properties\n",
3329 __func__);
3330
3331 return 0;
3332}
3333
3334static struct cyttsp_regulator regulator_data[] = {
3335 {
3336 .name = "vdd",
3337 .min_uV = CY_TMA300_VTG_MIN_UV,
3338 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303339 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3340 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003341 },
3342 /* TODO: Remove after runtime PM is enabled in I2C driver */
3343 {
3344 .name = "vcc_i2c",
3345 .min_uV = CY_I2C_VTG_MIN_UV,
3346 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303347 .hpm_load_uA = CY_I2C_CURR_UA,
3348 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003349 },
3350};
3351
3352static struct cyttsp_platform_data cyttsp_pdata = {
3353 .panel_maxx = 634,
3354 .panel_maxy = 1166,
3355 .disp_maxx = 616,
3356 .disp_maxy = 1023,
3357 .disp_minx = 0,
3358 .disp_miny = 16,
3359 .flags = 0x01,
3360 .gen = CY_GEN3, /* or */
3361 .use_st = CY_USE_ST,
3362 .use_mt = CY_USE_MT,
3363 .use_hndshk = CY_SEND_HNDSHK,
3364 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303365 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003366 .use_gestures = CY_USE_GESTURES,
3367 .fw_fname = "cyttsp_8960_cdp.hex",
3368 /* activate up to 4 groups
3369 * and set active distance
3370 */
3371 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3372 CY_GEST_GRP3 | CY_GEST_GRP4 |
3373 CY_ACT_DIST,
3374 /* change act_intrvl to customize the Active power state
3375 * scanning/processing refresh interval for Operating mode
3376 */
3377 .act_intrvl = CY_ACT_INTRVL_DFLT,
3378 /* change tch_tmout to customize the touch timeout for the
3379 * Active power state for Operating mode
3380 */
3381 .tch_tmout = CY_TCH_TMOUT_DFLT,
3382 /* change lp_intrvl to customize the Low Power power state
3383 * scanning/processing refresh interval for Operating mode
3384 */
3385 .lp_intrvl = CY_LP_INTRVL_DFLT,
3386 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3387 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3388 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3389 .regulator_info = regulator_data,
3390 .num_regulators = ARRAY_SIZE(regulator_data),
3391 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303392 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003393};
3394
3395static struct i2c_board_info cyttsp_info[] __initdata = {
3396 {
3397 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3398 .platform_data = &cyttsp_pdata,
3399#ifndef CY_USE_TIMER
3400 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3401#endif /* CY_USE_TIMER */
3402 },
3403};
3404
Mohan Pallaka50837382011-09-07 11:00:57 +05303405/* configuration data */
3406static const u8 mxt_config_data[] = {
3407 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003408 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303409 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003410 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3411 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3412 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3413 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3414 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3415 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3416 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303417 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003418 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303419 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003420 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303421 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003422 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3423 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3424 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3425 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303426 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003427 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3428 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303429 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003430 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3431 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303432 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003433 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3434 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303435 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003436 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3437 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303438 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003439 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303440 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003441 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303442 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003443 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303444 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003445 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303446 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003447 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303448};
3449
3450#define MXT_TS_GPIO_IRQ 11
3451#define MXT_TS_LDO_EN_GPIO 50
3452#define MXT_TS_RESET_GPIO 52
3453
3454static void mxt_init_hw_liquid(void)
3455{
3456 int rc;
3457
3458 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3459 if (rc) {
3460 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3461 __func__, MXT_TS_GPIO_IRQ);
3462 return;
3463 }
3464
3465 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3466 if (rc) {
3467 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3468 __func__, MXT_TS_GPIO_IRQ);
3469 goto err_irq_gpio_req;
3470 }
3471
3472 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3473 if (rc) {
3474 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3475 __func__, MXT_TS_LDO_EN_GPIO);
3476 goto err_irq_gpio_req;
3477 }
3478
3479 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3480 if (rc) {
3481 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3482 __func__, MXT_TS_LDO_EN_GPIO);
3483 goto err_ldo_gpio_req;
3484 }
3485
3486 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3487 if (rc) {
3488 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3489 __func__, MXT_TS_RESET_GPIO);
3490 goto err_ldo_gpio_set_dir;
3491 }
3492
3493 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3494 if (rc) {
3495 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3496 __func__, MXT_TS_RESET_GPIO);
3497 goto err_reset_gpio_req;
3498 }
3499
3500 return;
3501
3502err_reset_gpio_req:
3503 gpio_free(MXT_TS_RESET_GPIO);
3504err_ldo_gpio_set_dir:
3505 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3506err_ldo_gpio_req:
3507 gpio_free(MXT_TS_LDO_EN_GPIO);
3508err_irq_gpio_req:
3509 gpio_free(MXT_TS_GPIO_IRQ);
3510}
3511
3512static struct mxt_platform_data mxt_platform_data = {
3513 .config = mxt_config_data,
3514 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003515 .x_size = 1365,
3516 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303517 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003518 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303519};
3520
3521static struct i2c_board_info mxt_device_info[] __initdata = {
3522 {
3523 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3524 .platform_data = &mxt_platform_data,
3525 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3526 },
3527};
3528
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003529static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3530{
3531}
3532
3533static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3534 .clk_freq = 100000,
3535 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003536 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3537};
3538
3539static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3540 .clk_freq = 100000,
3541 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003542 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3543};
3544
3545static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3546 .clk_freq = 100000,
3547 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003548 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3549};
3550
3551static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3552 .clk_freq = 100000,
3553 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003554 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3555};
3556
3557static struct msm_rpm_platform_data msm_rpm_data = {
3558 .reg_base_addrs = {
3559 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3560 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3561 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3562 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3563 },
3564
3565 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3566 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3567 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3568 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3569 .msm_apps_ipc_rpm_val = 4,
3570};
3571
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003572static struct ks8851_pdata spi_eth_pdata = {
3573 .irq_gpio = KS8851_IRQ_GPIO,
3574 .rst_gpio = KS8851_RST_GPIO,
3575};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003576
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003577static struct spi_board_info spi_board_info[] __initdata = {
3578 {
3579 .modalias = "ks8851",
3580 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3581 .max_speed_hz = 19200000,
3582 .bus_num = 0,
3583 .chip_select = 0,
3584 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003585 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003586 },
3587};
3588
3589static struct platform_device msm_device_saw_core0 = {
3590 .name = "saw-regulator",
3591 .id = 0,
3592 .dev = {
3593 .platform_data = &msm_saw_regulator_pdata_s5,
3594 },
3595};
3596
3597static struct platform_device msm_device_saw_core1 = {
3598 .name = "saw-regulator",
3599 .id = 1,
3600 .dev = {
3601 .platform_data = &msm_saw_regulator_pdata_s6,
3602 },
3603};
3604
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003605static struct tsens_platform_data msm_tsens_pdata = {
3606 .slope = 910,
3607 .tsens_factor = 1000,
3608 .hw_type = MSM_8960,
3609 .tsens_num_sensor = 5,
3610};
3611
3612static struct platform_device msm_tsens_device = {
3613 .name = "tsens8960-tm",
3614 .id = -1,
3615 .dev = {
3616 .platform_data = &msm_tsens_pdata,
3617 },
3618};
3619
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003620#ifdef CONFIG_MSM_FAKE_BATTERY
3621static struct platform_device fish_battery_device = {
3622 .name = "fish_battery",
3623};
3624#endif
3625
David Collins26f05562011-06-20 09:56:28 -07003626static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003627 .name = GPIO_REGULATOR_DEV_NAME,
3628 .id = PM8921_MPP_PM_TO_SYS(7),
3629 .dev = {
3630 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3631 },
3632};
3633
David Collins26f05562011-06-20 09:56:28 -07003634static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003635 .name = GPIO_REGULATOR_DEV_NAME,
3636 .id = 91,
3637 .dev = {
3638 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3639 },
3640};
3641
David Collinsb10be1d2011-09-02 10:29:31 -07003642static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3643 .name = GPIO_REGULATOR_DEV_NAME,
3644 .id = PM8921_GPIO_PM_TO_SYS(17),
3645 .dev = {
3646 .platform_data =
3647 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3648 },
3649};
3650
David Collins26f05562011-06-20 09:56:28 -07003651static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3652 .name = "rpm-regulator",
3653 .id = -1,
3654 .dev = {
3655 .platform_data = &msm_rpm_regulator_pdata,
3656 },
3657};
3658
David Collins4c31a872011-08-31 10:07:10 -07003659static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3660 .phys_addr_base = 0x0010C000,
3661 .reg_offsets = {
3662 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3663 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3664 },
3665 .phys_size = SZ_8K,
3666 .log_len = 4096, /* log's buffer length in bytes */
3667 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3668};
3669
3670static struct platform_device msm_rpm_log_device = {
3671 .name = "msm_rpm_log",
3672 .id = -1,
3673 .dev = {
3674 .platform_data = &msm_rpm_log_pdata,
3675 },
3676};
3677
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003678static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003679 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003680 &msm_device_smd,
3681 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303682 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003683 &msm_device_saw_core0,
3684 &msm_device_saw_core1,
3685 &msm8960_device_ext_5v_vreg,
3686 &msm8960_device_ext_l2_vreg,
3687 &msm8960_device_ssbi_pm8921,
3688 &msm8960_device_qup_spi_gsbi1,
3689 &msm8960_device_qup_i2c_gsbi3,
3690 &msm8960_device_qup_i2c_gsbi4,
3691 &msm8960_device_qup_i2c_gsbi10,
3692#ifndef CONFIG_MSM_DSPS
3693 &msm8960_device_qup_i2c_gsbi12,
3694#endif
3695 &msm_slim_ctrl,
3696 &msm_device_wcnss_wlan,
3697#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3698 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3699 &qcrypto_device,
3700#endif
3701
3702#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3703 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3704 &qcedev_device,
3705#endif
3706#ifdef CONFIG_MSM_ROTATOR
3707 &msm_rotator_device,
3708#endif
3709 &msm_device_sps,
3710#ifdef CONFIG_MSM_FAKE_BATTERY
3711 &fish_battery_device,
3712#endif
3713#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003714#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003715 &android_pmem_device,
3716 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003717#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003718 &android_pmem_audio_device,
3719#endif
3720 &msm_fb_device,
3721 &msm_device_vidc,
3722 &msm_device_bam_dmux,
3723 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003724
3725#ifdef CONFIG_HW_RANDOM_MSM
3726 &msm_device_rng,
3727#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003728 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003729#ifdef CONFIG_ION_MSM
3730 &ion_dev,
3731#endif
David Collins4c31a872011-08-31 10:07:10 -07003732 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003733#ifdef CONFIG_MSM_QDSS
3734 &msm_etb_device,
3735 &msm_tpiu_device,
3736 &msm_funnel_device,
3737 &msm_ptm_device,
3738#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003739 &msm_device_dspcrashd_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003740};
3741
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003742static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003743 &msm8960_device_otg,
3744 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003745 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303746 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003747 &android_usb_device,
3748 &msm_device_vidc,
3749 &mipi_dsi_simulator_panel_device,
3750 &msm_bus_apps_fabric,
3751 &msm_bus_sys_fabric,
3752 &msm_bus_mm_fabric,
3753 &msm_bus_sys_fpb,
3754 &msm_bus_cpss_fpb,
3755 &msm_pcm,
3756 &msm_pcm_routing,
3757 &msm_cpudai0,
3758 &msm_cpudai1,
3759 &msm_cpudai_hdmi_rx,
3760 &msm_cpudai_bt_rx,
3761 &msm_cpudai_bt_tx,
3762 &msm_cpudai_fm_rx,
3763 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003764 &msm_cpudai_auxpcm_rx,
3765 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003766 &msm_cpu_fe,
3767 &msm_stub_codec,
3768 &msm_voice,
3769 &msm_voip,
3770 &msm_lpa_pcm,
3771
3772#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3773 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3774 &qcrypto_device,
3775#endif
3776
3777#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3778 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3779 &qcedev_device,
3780#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003781};
3782
3783static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003784 &msm_kgsl_3d0,
3785 &msm_kgsl_2d0,
3786 &msm_kgsl_2d1,
3787 &mipi_dsi_renesas_panel_device,
3788#ifdef CONFIG_MSM_GEMINI
3789 &msm8960_gemini_device,
3790#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003791};
3792
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003793static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003794 &msm8960_device_otg,
3795 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003796 &msm_device_hsusb_host,
3797 &android_usb_device,
3798 &msm_pcm,
3799 &msm_pcm_routing,
3800 &msm_cpudai0,
3801 &msm_cpudai1,
3802 &msm_cpudai_hdmi_rx,
3803 &msm_cpudai_bt_rx,
3804 &msm_cpudai_bt_tx,
3805 &msm_cpudai_fm_rx,
3806 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003807 &msm_cpudai_auxpcm_rx,
3808 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003809 &msm_cpu_fe,
3810 &msm_stub_codec,
3811 &msm_kgsl_3d0,
3812#ifdef CONFIG_MSM_KGSL_2D
3813 &msm_kgsl_2d0,
3814 &msm_kgsl_2d1,
3815#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003816 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003817#ifdef CONFIG_MSM_GEMINI
3818 &msm8960_gemini_device,
3819#endif
3820 &msm_voice,
3821 &msm_voip,
3822 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303823 &msm_cpudai_afe_01_rx,
3824 &msm_cpudai_afe_01_tx,
3825 &msm_cpudai_afe_02_rx,
3826 &msm_cpudai_afe_02_tx,
3827 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003828#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3829 &hdmi_msm_device,
3830#endif
3831 &msm_pcm_hostless,
3832 &msm_bus_apps_fabric,
3833 &msm_bus_sys_fabric,
3834 &msm_bus_mm_fabric,
3835 &msm_bus_sys_fpb,
3836 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003837 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003838};
3839
3840static void __init msm8960_i2c_init(void)
3841{
3842 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3843 &msm8960_i2c_qup_gsbi4_pdata;
3844
3845 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3846 &msm8960_i2c_qup_gsbi3_pdata;
3847
3848 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3849 &msm8960_i2c_qup_gsbi10_pdata;
3850
3851 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3852 &msm8960_i2c_qup_gsbi12_pdata;
3853}
3854
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003855static void __init msm8960_gfx_init(void)
3856{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003857 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003858 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3859 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3860 msm_kgsl_3d0.dev.platform_data;
3861 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3862 320000000;
3863 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3864 266667000;
3865 }
3866}
3867
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003868static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3869 .irq_base = PM8921_IRQ_BASE,
3870 .devirq = MSM_GPIO_TO_INT(104),
3871 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3872};
3873
3874static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3875 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3876};
3877
3878static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3879 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3880};
3881
3882static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3883 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303884 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003885};
3886
3887static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3888 .pull_up = 1,
3889 .kpd_trigger_delay_us = 970,
3890 .wakeup = 1,
3891};
3892
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303893/* Rotate lock key is not available so use F1 */
3894#define KEY_ROTATE_LOCK KEY_F1
3895
3896static const unsigned int keymap_liquid[] = {
3897 KEY(0, 0, KEY_VOLUMEUP),
3898 KEY(0, 1, KEY_VOLUMEDOWN),
3899 KEY(1, 3, KEY_ROTATE_LOCK),
3900 KEY(1, 4, KEY_HOME),
3901};
3902
3903static struct matrix_keymap_data keymap_data_liquid = {
3904 .keymap_size = ARRAY_SIZE(keymap_liquid),
3905 .keymap = keymap_liquid,
3906};
3907
3908static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3909 .input_name = "keypad_8960_liquid",
3910 .input_phys_device = "keypad_8960/input0",
3911 .num_rows = 2,
3912 .num_cols = 5,
3913 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3914 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3915 .debounce_ms = 15,
3916 .scan_delay_ms = 32,
3917 .row_hold_ns = 91500,
3918 .wakeup = 1,
3919 .keymap_data = &keymap_data_liquid,
3920};
3921
3922
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003923static const unsigned int keymap[] = {
3924 KEY(0, 0, KEY_VOLUMEUP),
3925 KEY(0, 1, KEY_VOLUMEDOWN),
3926 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3927 KEY(0, 3, KEY_CAMERA_FOCUS),
3928};
3929
3930static struct matrix_keymap_data keymap_data = {
3931 .keymap_size = ARRAY_SIZE(keymap),
3932 .keymap = keymap,
3933};
3934
3935static struct pm8xxx_keypad_platform_data keypad_data = {
3936 .input_name = "keypad_8960",
3937 .input_phys_device = "keypad_8960/input0",
3938 .num_rows = 1,
3939 .num_cols = 5,
3940 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3941 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3942 .debounce_ms = 15,
3943 .scan_delay_ms = 32,
3944 .row_hold_ns = 91500,
3945 .wakeup = 1,
3946 .keymap_data = &keymap_data,
3947};
3948
3949static const unsigned int keymap_sim[] = {
3950 KEY(0, 0, KEY_7),
3951 KEY(0, 1, KEY_DOWN),
3952 KEY(0, 2, KEY_UP),
3953 KEY(0, 3, KEY_RIGHT),
3954 KEY(0, 4, KEY_ENTER),
3955 KEY(0, 5, KEY_L),
3956 KEY(0, 6, KEY_BACK),
3957 KEY(0, 7, KEY_M),
3958
3959 KEY(1, 0, KEY_LEFT),
3960 KEY(1, 1, KEY_SEND),
3961 KEY(1, 2, KEY_1),
3962 KEY(1, 3, KEY_4),
3963 KEY(1, 4, KEY_CLEAR),
3964 KEY(1, 5, KEY_MSDOS),
3965 KEY(1, 6, KEY_SPACE),
3966 KEY(1, 7, KEY_COMMA),
3967
3968 KEY(2, 0, KEY_6),
3969 KEY(2, 1, KEY_5),
3970 KEY(2, 2, KEY_8),
3971 KEY(2, 3, KEY_3),
3972 KEY(2, 4, KEY_NUMERIC_STAR),
3973 KEY(2, 5, KEY_UP),
3974 KEY(2, 6, KEY_DOWN),
3975 KEY(2, 7, KEY_LEFTSHIFT),
3976
3977 KEY(3, 0, KEY_9),
3978 KEY(3, 1, KEY_NUMERIC_POUND),
3979 KEY(3, 2, KEY_0),
3980 KEY(3, 3, KEY_2),
3981 KEY(3, 4, KEY_SLEEP),
3982 KEY(3, 5, KEY_F1),
3983 KEY(3, 6, KEY_F2),
3984 KEY(3, 7, KEY_F3),
3985
3986 KEY(4, 0, KEY_BACK),
3987 KEY(4, 1, KEY_HOME),
3988 KEY(4, 2, KEY_MENU),
3989 KEY(4, 3, KEY_VOLUMEUP),
3990 KEY(4, 4, KEY_VOLUMEDOWN),
3991 KEY(4, 5, KEY_F4),
3992 KEY(4, 6, KEY_F5),
3993 KEY(4, 7, KEY_F6),
3994
3995 KEY(5, 0, KEY_R),
3996 KEY(5, 1, KEY_T),
3997 KEY(5, 2, KEY_Y),
3998 KEY(5, 3, KEY_LEFTALT),
3999 KEY(5, 4, KEY_KPENTER),
4000 KEY(5, 5, KEY_Q),
4001 KEY(5, 6, KEY_W),
4002 KEY(5, 7, KEY_E),
4003
4004 KEY(6, 0, KEY_F),
4005 KEY(6, 1, KEY_G),
4006 KEY(6, 2, KEY_H),
4007 KEY(6, 3, KEY_CAPSLOCK),
4008 KEY(6, 4, KEY_PAGEUP),
4009 KEY(6, 5, KEY_A),
4010 KEY(6, 6, KEY_S),
4011 KEY(6, 7, KEY_D),
4012
4013 KEY(7, 0, KEY_V),
4014 KEY(7, 1, KEY_B),
4015 KEY(7, 2, KEY_N),
4016 KEY(7, 3, KEY_MENU),
4017 KEY(7, 4, KEY_PAGEDOWN),
4018 KEY(7, 5, KEY_Z),
4019 KEY(7, 6, KEY_X),
4020 KEY(7, 7, KEY_C),
4021
4022 KEY(8, 0, KEY_P),
4023 KEY(8, 1, KEY_J),
4024 KEY(8, 2, KEY_K),
4025 KEY(8, 3, KEY_INSERT),
4026 KEY(8, 4, KEY_LINEFEED),
4027 KEY(8, 5, KEY_U),
4028 KEY(8, 6, KEY_I),
4029 KEY(8, 7, KEY_O),
4030
4031 KEY(9, 0, KEY_4),
4032 KEY(9, 1, KEY_5),
4033 KEY(9, 2, KEY_6),
4034 KEY(9, 3, KEY_7),
4035 KEY(9, 4, KEY_8),
4036 KEY(9, 5, KEY_1),
4037 KEY(9, 6, KEY_2),
4038 KEY(9, 7, KEY_3),
4039
4040 KEY(10, 0, KEY_F7),
4041 KEY(10, 1, KEY_F8),
4042 KEY(10, 2, KEY_F9),
4043 KEY(10, 3, KEY_F10),
4044 KEY(10, 4, KEY_FN),
4045 KEY(10, 5, KEY_9),
4046 KEY(10, 6, KEY_0),
4047 KEY(10, 7, KEY_DOT),
4048
4049 KEY(11, 0, KEY_LEFTCTRL),
4050 KEY(11, 1, KEY_F11),
4051 KEY(11, 2, KEY_ENTER),
4052 KEY(11, 3, KEY_SEARCH),
4053 KEY(11, 4, KEY_DELETE),
4054 KEY(11, 5, KEY_RIGHT),
4055 KEY(11, 6, KEY_LEFT),
4056 KEY(11, 7, KEY_RIGHTSHIFT),
4057 KEY(0, 0, KEY_VOLUMEUP),
4058 KEY(0, 1, KEY_VOLUMEDOWN),
4059 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4060 KEY(0, 3, KEY_CAMERA_FOCUS),
4061};
4062
4063static struct matrix_keymap_data keymap_data_sim = {
4064 .keymap_size = ARRAY_SIZE(keymap_sim),
4065 .keymap = keymap_sim,
4066};
4067
4068static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4069 .input_name = "keypad_8960",
4070 .input_phys_device = "keypad_8960/input0",
4071 .num_rows = 12,
4072 .num_cols = 8,
4073 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4074 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4075 .debounce_ms = 15,
4076 .scan_delay_ms = 32,
4077 .row_hold_ns = 91500,
4078 .wakeup = 1,
4079 .keymap_data = &keymap_data_sim,
4080};
4081
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004082static int pm8921_therm_mitigation[] = {
4083 1100,
4084 700,
4085 600,
4086 325,
4087};
4088
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004089static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004090 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004091 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004092 .max_voltage = 4200,
4093 .min_voltage = 3200,
4094 .resume_voltage = 4100,
4095 .term_current = 100,
4096 .cool_temp = 10,
4097 .warm_temp = 40,
4098 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004099 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004100 .cool_bat_chg_current = 350,
4101 .warm_bat_chg_current = 350,
4102 .cool_bat_voltage = 4100,
4103 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004104 .thermal_mitigation = pm8921_therm_mitigation,
4105 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004106};
4107
4108static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4109 .priority = 0,
4110};
4111
4112static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4113 .r_sense = 10,
4114 .i_test = 2500,
4115 .v_failure = 3000,
4116 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004117};
4118
Jay Chokshide4cefb2011-08-04 18:10:44 -07004119#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004120#define PM8XXX_LED_PWM_PERIOD 1000
4121#define PM8XXX_LED_PWM_DUTY_MS 20
4122/**
4123 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4124 * driven using PWM feature.
4125 */
4126#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004127
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004128static struct led_info pm8921_led_info[] = {
4129 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004130 .name = "led:battery_charging",
4131 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004132 },
4133 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004134 .name = "led:battery_full",
4135 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004136 },
4137};
4138
Jay Chokshi8994e392011-09-14 18:20:39 -07004139static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004140 .num_leds = ARRAY_SIZE(pm8921_led_info),
4141 .leds = pm8921_led_info,
4142};
4143
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004144static int pm8921_led0_pwm_duty_pcts[56] = {
4145 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4146 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4147 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4148 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4149 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4150 14, 10, 6, 4, 1
4151};
4152
4153static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4154 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4155 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4156 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4157 .start_idx = 0,
4158};
4159
Jay Chokshi8994e392011-09-14 18:20:39 -07004160static struct pm8xxx_led_config pm8921_led_configs[] = {
4161 [0] = {
4162 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004163 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004164 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004165 .pwm_channel = 5,
4166 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4167 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004168 },
4169 [1] = {
4170 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004171 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004172 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004173 .pwm_channel = 4,
4174 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004175 },
4176};
4177
4178static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4179 .led_core = &pm8921_led_core_pdata,
4180 .configs = pm8921_led_configs,
4181 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4182};
4183
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004184static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4185 .irq_pdata = &pm8xxx_irq_pdata,
4186 .gpio_pdata = &pm8xxx_gpio_pdata,
4187 .mpp_pdata = &pm8xxx_mpp_pdata,
4188 .rtc_pdata = &pm8xxx_rtc_pdata,
4189 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4190 .keypad_pdata = &keypad_data,
4191 .misc_pdata = &pm8xxx_misc_pdata,
4192 .regulator_pdatas = msm_pm8921_regulator_pdata,
4193 .charger_pdata = &pm8921_chg_pdata,
4194 .bms_pdata = &pm8921_bms_pdata,
4195 .adc_pdata = &pm8921_adc_pdata,
4196 .leds_pdata = &pm8xxx_leds_pdata,
4197};
4198
4199static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4200 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4201 .slave = {
4202 .name = "pm8921-core",
4203 .platform_data = &pm8921_platform_data,
4204 },
4205};
4206
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004207#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
4208static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004209{
4210 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004211
4212 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
4213 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004214 pr_err("FPGA CS gpio_request failed: %d\n", ret);
4215 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004216 }
4217
4218 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004219
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004220 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004221fail:
4222 return ret;
4223}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004224#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004225static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004226{
4227 return 0;
4228}
4229#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004230
4231static struct msm_cpuidle_state msm_cstates[] __initdata = {
4232 {0, 0, "C0", "WFI",
4233 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4234
4235 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4236 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4237
4238 {0, 2, "C2", "POWER_COLLAPSE",
4239 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4240
4241 {1, 0, "C0", "WFI",
4242 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4243
4244 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4245 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4246};
4247
4248static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4249 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4250 .idle_supported = 1,
4251 .suspend_supported = 1,
4252 .idle_enabled = 0,
4253 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004254 },
4255
4256 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4257 .idle_supported = 1,
4258 .suspend_supported = 1,
4259 .idle_enabled = 0,
4260 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004261 },
4262
4263 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4264 .idle_supported = 1,
4265 .suspend_supported = 1,
4266 .idle_enabled = 1,
4267 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004268 },
4269
4270 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4271 .idle_supported = 0,
4272 .suspend_supported = 1,
4273 .idle_enabled = 0,
4274 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004275 },
4276
4277 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4278 .idle_supported = 1,
4279 .suspend_supported = 1,
4280 .idle_enabled = 0,
4281 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004282 },
4283
4284 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4285 .idle_supported = 1,
4286 .suspend_supported = 0,
4287 .idle_enabled = 1,
4288 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004289 },
4290};
4291
4292static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4293 {
4294 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4295 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4296 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004297 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004298 },
4299
4300 {
4301 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4302 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4303 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004304 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004305 },
4306
4307 {
4308 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4309 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4310 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004311 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004312 },
4313
4314 {
4315 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4316 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4317 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004318 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004319 },
4320
4321 {
4322 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4323 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4324 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004325 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004326 },
4327
4328 {
4329 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4330 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4331 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004332 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004333 },
4334
4335 {
4336 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4337 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4338 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004339 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004340 },
4341
4342 {
4343 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4344 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4345 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004346 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004347 },
4348};
4349
4350#ifdef CONFIG_I2C
4351#define I2C_SURF 1
4352#define I2C_FFA (1 << 1)
4353#define I2C_RUMI (1 << 2)
4354#define I2C_SIM (1 << 3)
4355#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004356#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004357
4358struct i2c_registry {
4359 u8 machs;
4360 int bus;
4361 struct i2c_board_info *info;
4362 int len;
4363};
4364
4365#ifdef CONFIG_MSM_CAMERA
4366static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4367#ifdef CONFIG_IMX074
4368 {
4369 I2C_BOARD_INFO("imx074", 0x1A),
4370 },
4371#endif
4372#ifdef CONFIG_OV2720
4373 {
4374 I2C_BOARD_INFO("ov2720", 0x6C),
4375 },
4376#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004377 {
4378 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4379 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304380#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4381 {
4382 I2C_BOARD_INFO("sc628a", 0x6E),
4383 },
4384#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004385};
4386#endif
4387
4388/* Sensors DSPS platform data */
4389#ifdef CONFIG_MSM_DSPS
4390#define DSPS_PIL_GENERIC_NAME "dsps"
4391#endif /* CONFIG_MSM_DSPS */
4392
4393static void __init msm8960_init_dsps(void)
4394{
4395#ifdef CONFIG_MSM_DSPS
4396 struct msm_dsps_platform_data *pdata =
4397 msm_dsps_device.dev.platform_data;
4398 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4399 pdata->gpios = NULL;
4400 pdata->gpios_num = 0;
4401
4402 platform_device_register(&msm_dsps_device);
4403#endif /* CONFIG_MSM_DSPS */
4404}
4405
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004406static void __init msm8960_init_hsic(void)
4407{
4408#ifdef CONFIG_USB_EHCI_MSM_HSIC
4409 uint32_t version = socinfo_get_version();
4410
4411 pr_info("%s: version:%d mtp:%d\n", __func__,
4412 SOCINFO_VERSION_MAJOR(version),
4413 machine_is_msm8960_mtp());
4414
4415 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4416 machine_is_msm8960_mtp() ||
4417 machine_is_msm8960_fluid())
4418 return;
4419
4420 msm_gpiomux_install(msm8960_hsic_configs,
4421 ARRAY_SIZE(msm8960_hsic_configs));
4422
4423 platform_device_register(&msm_device_hsic_host);
4424#endif
4425}
4426
4427
Amir Samuelov5137e392011-09-21 17:31:25 +03004428#ifdef CONFIG_ISL9519_CHARGER
4429static struct isl_platform_data isl_data __initdata = {
4430 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4431 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4432 .max_system_voltage = 4200,
4433 .min_system_voltage = 3200,
4434 .chgcurrent = 1000, /* 1900, */
4435 .term_current = 400, /* Need fine tuning */
4436 .input_current = 2048,
4437};
4438
4439static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4440 {
4441 I2C_BOARD_INFO("isl9519q", 0x9),
4442 .irq = 0, /* Not required when notify-by-pmic */
4443 .platform_data = &isl_data,
4444 },
4445};
4446#endif /* CONFIG_ISL9519_CHARGER */
4447
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004448static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4449#ifdef CONFIG_MSM_CAMERA
4450 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004451 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004452 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4453 msm_camera_boardinfo,
4454 ARRAY_SIZE(msm_camera_boardinfo),
4455 },
4456#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004457#ifdef CONFIG_ISL9519_CHARGER
4458 {
4459 I2C_LIQUID,
4460 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4461 isl_charger_i2c_info,
4462 ARRAY_SIZE(isl_charger_i2c_info),
4463 },
4464#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004465 {
4466 I2C_SURF | I2C_FFA | I2C_FLUID,
4467 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4468 cyttsp_info,
4469 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004470 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304471 {
4472 I2C_LIQUID,
4473 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4474 mxt_device_info,
4475 ARRAY_SIZE(mxt_device_info),
4476 },
4477
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004478};
4479#endif /* CONFIG_I2C */
4480
4481static void __init register_i2c_devices(void)
4482{
4483#ifdef CONFIG_I2C
4484 u8 mach_mask = 0;
4485 int i;
4486
4487 /* Build the matching 'supported_machs' bitmask */
4488 if (machine_is_msm8960_cdp())
4489 mach_mask = I2C_SURF;
4490 else if (machine_is_msm8960_rumi3())
4491 mach_mask = I2C_RUMI;
4492 else if (machine_is_msm8960_sim())
4493 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004494 else if (machine_is_msm8960_fluid())
4495 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004496 else if (machine_is_msm8960_liquid())
4497 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004498 else if (machine_is_msm8960_mtp())
4499 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004500 else
4501 pr_err("unmatched machine ID in register_i2c_devices\n");
4502
4503 /* Run the array and install devices as appropriate */
4504 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4505 if (msm8960_i2c_devices[i].machs & mach_mask)
4506 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4507 msm8960_i2c_devices[i].info,
4508 msm8960_i2c_devices[i].len);
4509 }
4510#endif
4511}
4512
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004513static void __init msm8960_sim_init(void)
4514{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004515 BUG_ON(msm_rpm_init(&msm_rpm_data));
4516 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4517 ARRAY_SIZE(msm_rpmrs_levels)));
4518 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004519 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004520 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004521 msm8960_device_ssbi_pm8921.dev.platform_data =
4522 &msm8960_ssbi_pm8921_pdata;
4523 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004524
4525 /* Simulator supports a QWERTY keypad */
4526 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4527
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004528 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4529 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4530 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004531 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004532 msm8960_i2c_init();
4533 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4534 msm_spm_l2_init(msm_spm_l2_data);
4535 msm8960_init_buses();
4536 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4537 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004538 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004539 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004540
4541 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4542 &msm8960_qup_spi_gsbi1_pdata;
4543 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4544
4545 msm8960_init_mmc();
4546 msm_fb_add_devices();
4547 slim_register_board_info(msm_slim_devices,
4548 ARRAY_SIZE(msm_slim_devices));
4549 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4550 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4551 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4552 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004553 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004554}
4555
4556static void __init msm8960_rumi3_init(void)
4557{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004558 BUG_ON(msm_rpm_init(&msm_rpm_data));
4559 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4560 ARRAY_SIZE(msm_rpmrs_levels)));
4561 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004562 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004563 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004564 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004565 msm8960_device_ssbi_pm8921.dev.platform_data =
4566 &msm8960_ssbi_pm8921_pdata;
4567 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4568 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4569 &msm8960_qup_spi_gsbi1_pdata;
4570 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4571 msm8960_i2c_init();
4572 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4573 msm_spm_l2_init(msm_spm_l2_data);
4574 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4575 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004576 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004577 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004578 register_i2c_devices();
4579 msm_fb_add_devices();
4580 slim_register_board_info(msm_slim_devices,
4581 ARRAY_SIZE(msm_slim_devices));
4582 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4583 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4584 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4585 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004586 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004587}
4588
4589static void __init msm8960_cdp_init(void)
4590{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004591 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4592 pr_err("meminfo_init() failed!\n");
4593
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004594 BUG_ON(msm_rpm_init(&msm_rpm_data));
4595 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4596 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004597
4598 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004599 regulator_suppress_info_printing();
4600 if (msm_xo_init())
4601 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004602 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004603 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004604 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4605 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4606 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304607 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004608 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004609 if (machine_is_msm8960_cdp())
4610 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304611 if (machine_is_msm8960_liquid())
4612 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004613 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4614 &msm8960_qup_spi_gsbi1_pdata;
4615 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4616 msm8960_device_ssbi_pm8921.dev.platform_data =
4617 &msm8960_ssbi_pm8921_pdata;
4618 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4619 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004620 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004621 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4622 msm_spm_l2_init(msm_spm_l2_data);
4623 msm8960_init_buses();
4624 platform_add_devices(msm_footswitch_devices,
4625 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004626 if (machine_is_msm8960_liquid())
4627 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004628 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4629 pm8921_gpio_mpp_init();
4630 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004631 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004632 msm8960_init_cam();
4633 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004634 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304635 if (machine_is_msm8960_liquid())
4636 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004637 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004638 msm_fb_add_devices();
4639 slim_register_board_info(msm_slim_devices,
4640 ARRAY_SIZE(msm_slim_devices));
4641 msm8960_init_dsps();
4642 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4643 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4644 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4645 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004646 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004647 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004648}
4649
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004650MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4651 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004652 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004653 .init_irq = msm8960_init_irq,
4654 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004655 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004656 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004657 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004658MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004659
4660MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4661 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004662 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004663 .init_irq = msm8960_init_irq,
4664 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004665 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004666 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004667 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004668MACHINE_END
4669
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004670MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4671 .map_io = msm8960_map_io,
4672 .reserve = msm8960_reserve,
4673 .init_irq = msm8960_init_irq,
4674 .timer = &msm_timer,
4675 .init_machine = msm8960_cdp_init,
4676 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004677 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004678MACHINE_END
4679
4680MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4681 .map_io = msm8960_map_io,
4682 .reserve = msm8960_reserve,
4683 .init_irq = msm8960_init_irq,
4684 .timer = &msm_timer,
4685 .init_machine = msm8960_cdp_init,
4686 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004687 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004688MACHINE_END
4689
4690MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4691 .map_io = msm8960_map_io,
4692 .reserve = msm8960_reserve,
4693 .init_irq = msm8960_init_irq,
4694 .timer = &msm_timer,
4695 .init_machine = msm8960_cdp_init,
4696 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004697 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004698MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004699
4700MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4701 .map_io = msm8960_map_io,
4702 .reserve = msm8960_reserve,
4703 .init_irq = msm8960_init_irq,
4704 .timer = &msm_timer,
4705 .init_machine = msm8960_cdp_init,
4706 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004707 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004708MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004709
4710#ifdef CONFIG_ARCH_MSM8930
4711MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4712 .map_io = msm8930_map_io,
4713 .reserve = msm8960_reserve,
4714 .init_irq = msm8960_init_irq,
4715 .timer = &msm_timer,
4716 .init_machine = msm8960_cdp_init,
4717 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004718 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004719MACHINE_END
4720
4721MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4722 .map_io = msm8930_map_io,
4723 .reserve = msm8960_reserve,
4724 .init_irq = msm8960_init_irq,
4725 .timer = &msm_timer,
4726 .init_machine = msm8960_cdp_init,
4727 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004728 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004729MACHINE_END
4730
4731MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4732 .map_io = msm8930_map_io,
4733 .reserve = msm8960_reserve,
4734 .init_irq = msm8960_init_irq,
4735 .timer = &msm_timer,
4736 .init_machine = msm8960_cdp_init,
4737 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004738 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004739MACHINE_END
4740#endif