blob: 397fc2500a9e8ae203c64deafd05d4bab4220161 [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
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001037static void __init msm8960_reserve(void)
1038{
1039 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001040 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001041 msm_reserve();
1042}
1043
Larry Bassela4414b12011-08-04 11:11:02 -07001044static int msm8960_change_memory_power(u64 start, u64 size,
1045 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001046{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001047 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001048}
1049
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001050#ifdef CONFIG_MSM_CAMERA
1051
Nishant Pandit24153d82011-08-27 16:05:13 +05301052static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001053 5, /*CAMIF_MCLK*/
1054 20, /*CAMIF_I2C_DATA*/
1055 21, /*CAMIF_I2C_CLK*/
1056};
1057
Nishant Pandit24153d82011-08-27 16:05:13 +05301058static struct msm_camera_gpio_conf gpio_conf = {
1059 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1060 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1061 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1062 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1063};
1064
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001065#define VFE_CAMIF_TIMER1_GPIO 2
1066#define VFE_CAMIF_TIMER2_GPIO 3
1067#define VFE_CAMIF_TIMER3_GPIO_INT 4
1068struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1069 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1070 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1071 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1072 .flash_recharge_duration = 50000,
1073 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1074};
1075
Nishant Pandit474f2252011-07-23 23:17:56 +05301076#ifdef CONFIG_MSM_CAMERA_FLASH
1077static struct msm_camera_sensor_flash_src msm_flash_src = {
1078 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1079 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1080 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1081#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1082 defined(CONFIG_GPIO_SX150X_MODULE))
1083 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1084#endif
1085};
1086#endif
1087
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001088static struct msm_bus_vectors cam_init_vectors[] = {
1089 {
1090 .src = MSM_BUS_MASTER_VFE,
1091 .dst = MSM_BUS_SLAVE_EBI_CH0,
1092 .ab = 0,
1093 .ib = 0,
1094 },
1095 {
1096 .src = MSM_BUS_MASTER_VPE,
1097 .dst = MSM_BUS_SLAVE_EBI_CH0,
1098 .ab = 0,
1099 .ib = 0,
1100 },
1101 {
1102 .src = MSM_BUS_MASTER_JPEG_ENC,
1103 .dst = MSM_BUS_SLAVE_EBI_CH0,
1104 .ab = 0,
1105 .ib = 0,
1106 },
1107};
1108
1109static struct msm_bus_vectors cam_preview_vectors[] = {
1110 {
1111 .src = MSM_BUS_MASTER_VFE,
1112 .dst = MSM_BUS_SLAVE_EBI_CH0,
1113 .ab = 27648000,
1114 .ib = 110592000,
1115 },
1116 {
1117 .src = MSM_BUS_MASTER_VPE,
1118 .dst = MSM_BUS_SLAVE_EBI_CH0,
1119 .ab = 0,
1120 .ib = 0,
1121 },
1122 {
1123 .src = MSM_BUS_MASTER_JPEG_ENC,
1124 .dst = MSM_BUS_SLAVE_EBI_CH0,
1125 .ab = 0,
1126 .ib = 0,
1127 },
1128};
1129
1130static struct msm_bus_vectors cam_video_vectors[] = {
1131 {
1132 .src = MSM_BUS_MASTER_VFE,
1133 .dst = MSM_BUS_SLAVE_EBI_CH0,
1134 .ab = 140451840,
1135 .ib = 561807360,
1136 },
1137 {
1138 .src = MSM_BUS_MASTER_VPE,
1139 .dst = MSM_BUS_SLAVE_EBI_CH0,
1140 .ab = 206807040,
1141 .ib = 488816640,
1142 },
1143 {
1144 .src = MSM_BUS_MASTER_JPEG_ENC,
1145 .dst = MSM_BUS_SLAVE_EBI_CH0,
1146 .ab = 0,
1147 .ib = 0,
1148 },
1149};
1150
1151static struct msm_bus_vectors cam_snapshot_vectors[] = {
1152 {
1153 .src = MSM_BUS_MASTER_VFE,
1154 .dst = MSM_BUS_SLAVE_EBI_CH0,
1155 .ab = 274423680,
1156 .ib = 1097694720,
1157 },
1158 {
1159 .src = MSM_BUS_MASTER_VPE,
1160 .dst = MSM_BUS_SLAVE_EBI_CH0,
1161 .ab = 0,
1162 .ib = 0,
1163 },
1164 {
1165 .src = MSM_BUS_MASTER_JPEG_ENC,
1166 .dst = MSM_BUS_SLAVE_EBI_CH0,
1167 .ab = 540000000,
1168 .ib = 1350000000,
1169 },
1170};
1171
1172static struct msm_bus_vectors cam_zsl_vectors[] = {
1173 {
1174 .src = MSM_BUS_MASTER_VFE,
1175 .dst = MSM_BUS_SLAVE_EBI_CH0,
1176 .ab = 302071680,
1177 .ib = 1208286720,
1178 },
1179 {
1180 .src = MSM_BUS_MASTER_VPE,
1181 .dst = MSM_BUS_SLAVE_EBI_CH0,
1182 .ab = 0,
1183 .ib = 0,
1184 },
1185 {
1186 .src = MSM_BUS_MASTER_JPEG_ENC,
1187 .dst = MSM_BUS_SLAVE_EBI_CH0,
1188 .ab = 540000000,
1189 .ib = 1350000000,
1190 },
1191};
1192
1193static struct msm_bus_paths cam_bus_client_config[] = {
1194 {
1195 ARRAY_SIZE(cam_init_vectors),
1196 cam_init_vectors,
1197 },
1198 {
1199 ARRAY_SIZE(cam_preview_vectors),
1200 cam_preview_vectors,
1201 },
1202 {
1203 ARRAY_SIZE(cam_video_vectors),
1204 cam_video_vectors,
1205 },
1206 {
1207 ARRAY_SIZE(cam_snapshot_vectors),
1208 cam_snapshot_vectors,
1209 },
1210 {
1211 ARRAY_SIZE(cam_zsl_vectors),
1212 cam_zsl_vectors,
1213 },
1214};
1215
1216static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1217 cam_bus_client_config,
1218 ARRAY_SIZE(cam_bus_client_config),
1219 .name = "msm_camera",
1220};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001221
Nishant Pandit24153d82011-08-27 16:05:13 +05301222struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1223 {
1224 .ioclk.mclk_clk_rate = 24000000,
1225 .ioclk.vfe_clk_rate = 228570000,
1226 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001227 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301228 },
1229 {
1230 .ioclk.mclk_clk_rate = 24000000,
1231 .ioclk.vfe_clk_rate = 228570000,
1232 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001233 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301234 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001235};
1236
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001237#ifdef CONFIG_IMX074_ACT
1238static struct i2c_board_info imx074_actuator_i2c_info = {
1239 I2C_BOARD_INFO("imx074_act", 0x11),
1240};
1241
1242static struct msm_actuator_info imx074_actuator_info = {
1243 .board_info = &imx074_actuator_i2c_info,
1244 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1245 .vcm_pwd = 0,
1246 .vcm_enable = 1,
1247};
1248#endif
1249
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001250#ifdef CONFIG_IMX074
1251static struct msm_camera_sensor_flash_data flash_imx074 = {
1252 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301253#ifdef CONFIG_MSM_CAMERA_FLASH
1254 .flash_src = &msm_flash_src
1255#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001256};
1257
Nishant Pandit24153d82011-08-27 16:05:13 +05301258static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1259 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001260 .sensor_reset = 107,
1261 .sensor_pwd = 85,
1262 .vcm_pwd = 0,
1263 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301264};
1265
1266static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1267 .sensor_name = "imx074",
1268 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001269 .flash_data = &flash_imx074,
1270 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301271 .sensor_platform_info = &sensor_board_info_imx074,
1272 .gpio_conf = &gpio_conf,
1273 .csi_if = 1,
1274 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001275#ifdef CONFIG_IMX074_ACT
1276 .actuator_info = &imx074_actuator_info
1277#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001278};
1279
1280struct platform_device msm8960_camera_sensor_imx074 = {
1281 .name = "msm_camera_imx074",
1282 .dev = {
1283 .platform_data = &msm_camera_sensor_imx074_data,
1284 },
1285};
1286#endif
1287#ifdef CONFIG_OV2720
1288static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001289 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001290};
1291
Nishant Pandit24153d82011-08-27 16:05:13 +05301292static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1293 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001294 .sensor_reset = 76,
1295 .sensor_pwd = 85,
1296 .vcm_pwd = 0,
1297 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301298};
1299
1300static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1301 .sensor_name = "ov2720",
1302 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301304 .sensor_platform_info = &sensor_board_info_ov2720,
1305 .gpio_conf = &gpio_conf,
1306 .csi_if = 1,
1307 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001308};
1309
1310struct platform_device msm8960_camera_sensor_ov2720 = {
1311 .name = "msm_camera_ov2720",
1312 .dev = {
1313 .platform_data = &msm_camera_sensor_ov2720_data,
1314 },
1315};
1316#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001317
1318static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1319 .flash_type = MSM_CAMERA_FLASH_LED,
1320};
1321
Nishant Pandit24153d82011-08-27 16:05:13 +05301322static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1323 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001324 .sensor_reset = 107,
1325 .sensor_pwd = 85,
1326 .vcm_pwd = 0,
1327 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301328};
1329
1330static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1331 .sensor_name = "qs_mt9p017",
1332 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001333 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301334 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1335 .gpio_conf = &gpio_conf,
1336 .csi_if = 1,
1337 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001338};
1339
1340struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1341 .name = "msm_camera_qs_mt9p017",
1342 .dev = {
1343 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1344 },
1345};
1346
Kevin Chan8b0d2322011-09-10 21:06:31 -07001347static struct msm8960_privacy_light_cfg privacy_light_info = {
1348 .mpp = PM8921_MPP_PM_TO_SYS(12),
1349};
1350
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001351static void __init msm8960_init_cam(void)
1352{
1353 int i;
1354 struct platform_device *cam_dev[] = {
1355 &msm8960_camera_sensor_imx074,
1356 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001357 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001358 };
1359
Kevin Chan8b0d2322011-09-10 21:06:31 -07001360 if (machine_is_msm8960_liquid()) {
1361 struct msm_camera_sensor_info *s_info;
1362 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1363 s_info->sensor_platform_info->mount_angle = 180;
1364 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1365 s_info->sensor_platform_info->privacy_light = 1;
1366 s_info->sensor_platform_info->privacy_light_info =
1367 &privacy_light_info;
1368 }
1369
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001370 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1371 struct msm_camera_sensor_info *s_info;
1372 s_info = cam_dev[i]->dev.platform_data;
1373 msm_get_cam_resources(s_info);
1374 platform_device_register(cam_dev[i]);
1375 }
1376}
1377#endif
1378
1379#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001380#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001381#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001382#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001383#endif
1384
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001385
1386#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001387#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001388#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001389#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1390#else
1391#define MSM_FB_EXT_BUF_SIZE 0
1392#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001393
kuogee hsieh3830eb92011-09-12 15:25:57 -07001394#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1395/* width x height x 3 bpp x 2 frame buffer */
1396#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1397#define MSM_FB_WRITEBACK_OFFSET \
1398 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1399#else
1400#define MSM_FB_WRITEBACK_SIZE 0
1401#define MSM_FB_WRITEBACK_OFFSET 0
1402#endif
1403
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001404#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1405/* 4 bpp x 2 page HDMI case */
1406#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1407#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001408/* Note: must be multiple of 4096 */
1409#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1410 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001411#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001412
1413static int writeback_offset(void)
1414{
1415 return MSM_FB_WRITEBACK_OFFSET;
1416}
1417
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001418
1419#define MDP_VSYNC_GPIO 0
1420
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001421#define PANEL_NAME_MAX_LEN 30
1422#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1423#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1424#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1425#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1426#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1427#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1428#define HDMI_PANEL_NAME "hdmi_msm"
1429#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001430
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001431static struct resource msm_fb_resources[] = {
1432 {
1433 .flags = IORESOURCE_DMA,
1434 }
1435};
1436
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001437static int msm_fb_detect_panel(const char *name)
1438{
1439 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001440 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1441 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1442 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001443 return 0;
1444 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001445 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1446 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1447 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001448 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001449
1450#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1451 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1452 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1453 PANEL_NAME_MAX_LEN)))
1454 return 0;
1455
1456 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1457 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1458 PANEL_NAME_MAX_LEN)))
1459 return 0;
1460
1461 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1462 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1463 PANEL_NAME_MAX_LEN)))
1464 return 0;
1465
1466 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1467 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1468 PANEL_NAME_MAX_LEN)))
1469 return 0;
1470#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001471 }
1472
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001473 if (!strncmp(name, HDMI_PANEL_NAME,
1474 strnlen(HDMI_PANEL_NAME,
1475 PANEL_NAME_MAX_LEN)))
1476 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001477
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001478 if (!strncmp(name, TVOUT_PANEL_NAME,
1479 strnlen(TVOUT_PANEL_NAME,
1480 PANEL_NAME_MAX_LEN)))
1481 return 0;
1482
1483 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001484 return -ENODEV;
1485}
1486
1487static struct msm_fb_platform_data msm_fb_pdata = {
1488 .detect_client = msm_fb_detect_panel,
1489};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001490
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001491static struct platform_device msm_fb_device = {
1492 .name = "msm_fb",
1493 .id = 0,
1494 .num_resources = ARRAY_SIZE(msm_fb_resources),
1495 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001496 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001497};
1498
1499static bool dsi_power_on;
1500
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001501/**
1502 * LiQUID panel on/off
1503 *
1504 * @param on
1505 *
1506 * @return int
1507 */
1508static int mipi_dsi_liquid_panel_power(int on)
1509{
1510 static struct regulator *reg_l2, *reg_ext_3p3v;
1511 static int gpio21, gpio24, gpio43;
1512 int rc;
1513
1514 pr_info("%s: on=%d\n", __func__, on);
1515
1516 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1517 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1518 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1519
1520 if (!dsi_power_on) {
1521
1522 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1523 "dsi_vdda");
1524 if (IS_ERR(reg_l2)) {
1525 pr_err("could not get 8921_l2, rc = %ld\n",
1526 PTR_ERR(reg_l2));
1527 return -ENODEV;
1528 }
1529
1530 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1531 if (rc) {
1532 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1533 return -EINVAL;
1534 }
1535
1536 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1537 "vdd_lvds_3p3v");
1538 if (IS_ERR(reg_ext_3p3v)) {
1539 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1540 PTR_ERR(reg_ext_3p3v));
1541 return -ENODEV;
1542 }
1543
1544 rc = gpio_request(gpio21, "disp_pwr_en_n");
1545 if (rc) {
1546 pr_err("request gpio 21 failed, rc=%d\n", rc);
1547 return -ENODEV;
1548 }
1549
1550 rc = gpio_request(gpio43, "disp_rst_n");
1551 if (rc) {
1552 pr_err("request gpio 43 failed, rc=%d\n", rc);
1553 return -ENODEV;
1554 }
1555
1556 rc = gpio_request(gpio24, "disp_backlight_pwm");
1557 if (rc) {
1558 pr_err("request gpio 24 failed, rc=%d\n", rc);
1559 return -ENODEV;
1560 }
1561
1562 dsi_power_on = true;
1563 }
1564
1565 if (on) {
1566 rc = regulator_set_optimum_mode(reg_l2, 100000);
1567 if (rc < 0) {
1568 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1569 return -EINVAL;
1570 }
1571 rc = regulator_enable(reg_l2);
1572 if (rc) {
1573 pr_err("enable l2 failed, rc=%d\n", rc);
1574 return -ENODEV;
1575 }
1576
1577 rc = regulator_enable(reg_ext_3p3v);
1578 if (rc) {
1579 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1580 return -ENODEV;
1581 }
1582
1583 /* set reset pin before power enable */
1584 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1585
1586 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1587 msleep(20);
1588 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1589 msleep(20);
1590 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1591 msleep(20);
1592 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1593 msleep(20);
1594 } else {
1595 gpio_set_value_cansleep(gpio43, 0);
1596 gpio_set_value_cansleep(gpio21, 1);
1597
1598 rc = regulator_disable(reg_l2);
1599 if (rc) {
1600 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1601 return -ENODEV;
1602 }
1603 rc = regulator_disable(reg_ext_3p3v);
1604 if (rc) {
1605 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1606 return -ENODEV;
1607 }
1608 rc = regulator_set_optimum_mode(reg_l2, 100);
1609 if (rc < 0) {
1610 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1611 return -EINVAL;
1612 }
1613 }
1614
1615 return 0;
1616}
1617
1618static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001619{
1620 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001621 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001622 int rc;
1623
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001624 pr_info("%s: state : %d\n", __func__, on);
1625
1626 if (!dsi_power_on) {
1627
1628 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1629 "dsi_vdc");
1630 if (IS_ERR(reg_l8)) {
1631 pr_err("could not get 8921_l8, rc = %ld\n",
1632 PTR_ERR(reg_l8));
1633 return -ENODEV;
1634 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001635 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1636 "dsi_vddio");
1637 if (IS_ERR(reg_l23)) {
1638 pr_err("could not get 8921_l23, rc = %ld\n",
1639 PTR_ERR(reg_l23));
1640 return -ENODEV;
1641 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001642 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1643 "dsi_vdda");
1644 if (IS_ERR(reg_l2)) {
1645 pr_err("could not get 8921_l2, rc = %ld\n",
1646 PTR_ERR(reg_l2));
1647 return -ENODEV;
1648 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001649 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1650 if (rc) {
1651 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1652 return -EINVAL;
1653 }
1654 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1655 if (rc) {
1656 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1657 return -EINVAL;
1658 }
1659 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1660 if (rc) {
1661 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1662 return -EINVAL;
1663 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001664 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1665 rc = gpio_request(gpio43, "disp_rst_n");
1666 if (rc) {
1667 pr_err("request gpio 43 failed, rc=%d\n", rc);
1668 return -ENODEV;
1669 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001670 dsi_power_on = true;
1671 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001672 if (on) {
1673 rc = regulator_set_optimum_mode(reg_l8, 100000);
1674 if (rc < 0) {
1675 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1676 return -EINVAL;
1677 }
1678 rc = regulator_set_optimum_mode(reg_l23, 100000);
1679 if (rc < 0) {
1680 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1681 return -EINVAL;
1682 }
1683 rc = regulator_set_optimum_mode(reg_l2, 100000);
1684 if (rc < 0) {
1685 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1686 return -EINVAL;
1687 }
1688 rc = regulator_enable(reg_l8);
1689 if (rc) {
1690 pr_err("enable l8 failed, rc=%d\n", rc);
1691 return -ENODEV;
1692 }
1693 rc = regulator_enable(reg_l23);
1694 if (rc) {
1695 pr_err("enable l8 failed, rc=%d\n", rc);
1696 return -ENODEV;
1697 }
1698 rc = regulator_enable(reg_l2);
1699 if (rc) {
1700 pr_err("enable l2 failed, rc=%d\n", rc);
1701 return -ENODEV;
1702 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001703 gpio_set_value_cansleep(gpio43, 1);
1704 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001705 rc = regulator_disable(reg_l2);
1706 if (rc) {
1707 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1708 return -ENODEV;
1709 }
1710 rc = regulator_disable(reg_l8);
1711 if (rc) {
1712 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1713 return -ENODEV;
1714 }
1715 rc = regulator_disable(reg_l23);
1716 if (rc) {
1717 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1718 return -ENODEV;
1719 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001720 rc = regulator_set_optimum_mode(reg_l8, 100);
1721 if (rc < 0) {
1722 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1723 return -EINVAL;
1724 }
1725 rc = regulator_set_optimum_mode(reg_l23, 100);
1726 if (rc < 0) {
1727 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1728 return -EINVAL;
1729 }
1730 rc = regulator_set_optimum_mode(reg_l2, 100);
1731 if (rc < 0) {
1732 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1733 return -EINVAL;
1734 }
1735 gpio_set_value_cansleep(gpio43, 0);
1736 }
1737 return 0;
1738}
1739
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001740static int mipi_dsi_panel_power(int on)
1741{
1742 int ret;
1743
1744 pr_info("%s: on=%d\n", __func__, on);
1745
1746 if (machine_is_msm8960_liquid())
1747 ret = mipi_dsi_liquid_panel_power(on);
1748 else
1749 ret = mipi_dsi_cdp_panel_power(on);
1750
1751 return ret;
1752}
1753
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001754static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1755 .vsync_gpio = MDP_VSYNC_GPIO,
1756 .dsi_power_save = mipi_dsi_panel_power,
1757};
1758
1759#ifdef CONFIG_MSM_BUS_SCALING
1760
1761static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001762 {
1763 .src = MSM_BUS_MASTER_MDP_PORT0,
1764 .dst = MSM_BUS_SLAVE_EBI_CH0,
1765 .ab = 0,
1766 .ib = 0,
1767 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001768};
1769
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001770#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1771static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1772 /* If HDMI is used as primary */
1773 {
1774 .src = MSM_BUS_MASTER_MDP_PORT0,
1775 .dst = MSM_BUS_SLAVE_EBI_CH0,
1776 .ab = 2000000000,
1777 .ib = 2000000000,
1778 },
1779};
1780static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1781 {
1782 ARRAY_SIZE(mdp_init_vectors),
1783 mdp_init_vectors,
1784 },
1785 {
1786 ARRAY_SIZE(hdmi_as_primary_vectors),
1787 hdmi_as_primary_vectors,
1788 },
1789 {
1790 ARRAY_SIZE(hdmi_as_primary_vectors),
1791 hdmi_as_primary_vectors,
1792 },
1793 {
1794 ARRAY_SIZE(hdmi_as_primary_vectors),
1795 hdmi_as_primary_vectors,
1796 },
1797 {
1798 ARRAY_SIZE(hdmi_as_primary_vectors),
1799 hdmi_as_primary_vectors,
1800 },
1801 {
1802 ARRAY_SIZE(hdmi_as_primary_vectors),
1803 hdmi_as_primary_vectors,
1804 },
1805};
1806#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001807static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001808 {
1809 .src = MSM_BUS_MASTER_MDP_PORT0,
1810 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001811 .ab = 216000000 * 2,
1812 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001813 },
1814};
1815
1816static struct msm_bus_vectors mdp_vga_vectors[] = {
1817 /* VGA and less video */
1818 {
1819 .src = MSM_BUS_MASTER_MDP_PORT0,
1820 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001821 .ab = 216000000 * 2,
1822 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001823 },
1824};
1825
1826static struct msm_bus_vectors mdp_720p_vectors[] = {
1827 /* 720p and less video */
1828 {
1829 .src = MSM_BUS_MASTER_MDP_PORT0,
1830 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001831 .ab = 230400000 * 2,
1832 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001833 },
1834};
1835
1836static struct msm_bus_vectors mdp_1080p_vectors[] = {
1837 /* 1080p and less video */
1838 {
1839 .src = MSM_BUS_MASTER_MDP_PORT0,
1840 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001841 .ab = 334080000 * 2,
1842 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001843 },
1844};
1845
1846static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1847 {
1848 ARRAY_SIZE(mdp_init_vectors),
1849 mdp_init_vectors,
1850 },
1851 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001852 ARRAY_SIZE(mdp_ui_vectors),
1853 mdp_ui_vectors,
1854 },
1855 {
1856 ARRAY_SIZE(mdp_ui_vectors),
1857 mdp_ui_vectors,
1858 },
1859 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001860 ARRAY_SIZE(mdp_vga_vectors),
1861 mdp_vga_vectors,
1862 },
1863 {
1864 ARRAY_SIZE(mdp_720p_vectors),
1865 mdp_720p_vectors,
1866 },
1867 {
1868 ARRAY_SIZE(mdp_1080p_vectors),
1869 mdp_1080p_vectors,
1870 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001871};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001872#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001873
1874static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1875 mdp_bus_scale_usecases,
1876 ARRAY_SIZE(mdp_bus_scale_usecases),
1877 .name = "mdp",
1878};
1879
1880#endif
1881
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001882#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1883int mdp_core_clk_rate_table[] = {
1884 200000000,
1885 200000000,
1886 200000000,
1887 200000000,
1888};
1889#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001890int mdp_core_clk_rate_table[] = {
1891 85330000,
1892 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001893 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001894 200000000,
1895};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001896#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001897
1898static struct msm_panel_common_pdata mdp_pdata = {
1899 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001900#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1901 .mdp_core_clk_rate = 200000000,
1902#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001904#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001905 .mdp_core_clk_table = mdp_core_clk_rate_table,
1906 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1907#ifdef CONFIG_MSM_BUS_SCALING
1908 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1909#endif
1910 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001911 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001912};
1913
1914static struct platform_device mipi_dsi_renesas_panel_device = {
1915 .name = "mipi_renesas",
1916 .id = 0,
1917};
1918
1919static struct platform_device mipi_dsi_simulator_panel_device = {
1920 .name = "mipi_simulator",
1921 .id = 0,
1922};
1923
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001924#define LPM_CHANNEL0 0
1925static int toshiba_gpio[] = {LPM_CHANNEL0};
1926
1927static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1928 .gpio = toshiba_gpio,
1929};
1930
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001931static struct platform_device mipi_dsi_toshiba_panel_device = {
1932 .name = "mipi_toshiba",
1933 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001934 .dev = {
1935 .platform_data = &toshiba_pdata,
1936 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001937};
1938
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001939static int dsi2lvds_gpio[2] = {
1940 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1941 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1942 };
1943
1944static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1945 .gpio_num = dsi2lvds_gpio,
1946};
1947
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001948static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1949
1950/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1951 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1952 /* timing */
1953 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1954 0x0c, 0x03, 0x04, 0xa0},
1955 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1956 {0xff, 0x00, 0x06, 0x00}, /* strength */
1957 /* pll control */
1958 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1959 0x40, 0x07, 0x03,
1960 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1961};
1962
1963static struct mipi_dsi_panel_platform_data novatek_pdata = {
1964 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1965};
1966
1967static struct platform_device mipi_dsi_novatek_panel_device = {
1968 .name = "mipi_novatek",
1969 .id = 0,
1970 .dev = {
1971 .platform_data = &novatek_pdata,
1972 }
1973};
1974
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001975static struct platform_device mipi_dsi2lvds_bridge_device = {
1976 .name = "mipi_tc358764",
1977 .id = 0,
1978 .dev.platform_data = &mipi_dsi2lvds_pdata,
1979};
1980
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001981#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1982static struct resource hdmi_msm_resources[] = {
1983 {
1984 .name = "hdmi_msm_qfprom_addr",
1985 .start = 0x00700000,
1986 .end = 0x007060FF,
1987 .flags = IORESOURCE_MEM,
1988 },
1989 {
1990 .name = "hdmi_msm_hdmi_addr",
1991 .start = 0x04A00000,
1992 .end = 0x04A00FFF,
1993 .flags = IORESOURCE_MEM,
1994 },
1995 {
1996 .name = "hdmi_msm_irq",
1997 .start = HDMI_IRQ,
1998 .end = HDMI_IRQ,
1999 .flags = IORESOURCE_IRQ,
2000 },
2001};
2002
2003static int hdmi_enable_5v(int on);
2004static int hdmi_core_power(int on, int show);
2005static int hdmi_cec_power(int on);
2006
2007static struct msm_hdmi_platform_data hdmi_msm_data = {
2008 .irq = HDMI_IRQ,
2009 .enable_5v = hdmi_enable_5v,
2010 .core_power = hdmi_core_power,
2011 .cec_power = hdmi_cec_power,
2012};
2013
2014static struct platform_device hdmi_msm_device = {
2015 .name = "hdmi_msm",
2016 .id = 0,
2017 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2018 .resource = hdmi_msm_resources,
2019 .dev.platform_data = &hdmi_msm_data,
2020};
2021#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2022
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002023#ifdef CONFIG_MSM_BUS_SCALING
2024static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2025 {
2026 .src = MSM_BUS_MASTER_MDP_PORT0,
2027 .dst = MSM_BUS_SLAVE_EBI_CH0,
2028 .ab = 0,
2029 .ib = 0,
2030 },
2031};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002032
2033#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2034static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2035 {
2036 .src = MSM_BUS_MASTER_MDP_PORT0,
2037 .dst = MSM_BUS_SLAVE_EBI_CH0,
2038 .ab = 2000000000,
2039 .ib = 2000000000,
2040 },
2041};
2042#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002043static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2044 {
2045 .src = MSM_BUS_MASTER_MDP_PORT0,
2046 .dst = MSM_BUS_SLAVE_EBI_CH0,
2047 .ab = 566092800 * 2,
2048 .ib = 707616000 * 2,
2049 },
2050};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002051#endif
2052
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002053static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2054 {
2055 ARRAY_SIZE(dtv_bus_init_vectors),
2056 dtv_bus_init_vectors,
2057 },
2058 {
2059 ARRAY_SIZE(dtv_bus_def_vectors),
2060 dtv_bus_def_vectors,
2061 },
2062};
2063static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2064 dtv_bus_scale_usecases,
2065 ARRAY_SIZE(dtv_bus_scale_usecases),
2066 .name = "dtv",
2067};
2068
2069static struct lcdc_platform_data dtv_pdata = {
2070 .bus_scale_table = &dtv_bus_scale_pdata,
2071};
2072#endif
2073
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002074static void __init msm_fb_add_devices(void)
2075{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002076 struct platform_device *ptr = NULL;
2077
2078 if (machine_is_msm8960_liquid())
2079 ptr = &mipi_dsi2lvds_bridge_device;
2080 else
2081 ptr = &mipi_dsi_toshiba_panel_device;
2082 platform_add_devices(&ptr, 1);
2083
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002084 if (machine_is_msm8x60_rumi3()) {
2085 msm_fb_register_device("mdp", NULL);
2086 mipi_dsi_pdata.target_type = 1;
2087 } else
2088 msm_fb_register_device("mdp", &mdp_pdata);
2089 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002090#ifdef CONFIG_MSM_BUS_SCALING
2091 msm_fb_register_device("dtv", &dtv_pdata);
2092#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002093}
2094
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002095static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2096 .func = GPIOMUX_FUNC_GPIO,
2097 .drv = GPIOMUX_DRV_2MA,
2098 .pull = GPIOMUX_PULL_DOWN,
2099};
2100
2101static struct gpiomux_setting mdp_vsync_active_cfg = {
2102 .func = GPIOMUX_FUNC_1,
2103 .drv = GPIOMUX_DRV_2MA,
2104 .pull = GPIOMUX_PULL_DOWN,
2105};
2106
2107static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2108 {
2109 .gpio = MDP_VSYNC_GPIO,
2110 .settings = {
2111 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2112 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2113 },
2114 }
2115};
2116
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002117#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2118static struct gpiomux_setting hdmi_suspend_cfg = {
2119 .func = GPIOMUX_FUNC_GPIO,
2120 .drv = GPIOMUX_DRV_2MA,
2121 .pull = GPIOMUX_PULL_DOWN,
2122};
2123
2124static struct gpiomux_setting hdmi_active_1_cfg = {
2125 .func = GPIOMUX_FUNC_1,
2126 .drv = GPIOMUX_DRV_2MA,
2127 .pull = GPIOMUX_PULL_UP,
2128};
2129
2130static struct gpiomux_setting hdmi_active_2_cfg = {
2131 .func = GPIOMUX_FUNC_1,
2132 .drv = GPIOMUX_DRV_2MA,
2133 .pull = GPIOMUX_PULL_DOWN,
2134};
2135
2136static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2137 {
2138 .gpio = 99,
2139 .settings = {
2140 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2141 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2142 },
2143 },
2144 {
2145 .gpio = 100,
2146 .settings = {
2147 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2148 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2149 },
2150 },
2151 {
2152 .gpio = 101,
2153 .settings = {
2154 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2155 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2156 },
2157 },
2158 {
2159 .gpio = 102,
2160 .settings = {
2161 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2162 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2163 },
2164 },
2165};
2166
2167static int hdmi_enable_5v(int on)
2168{
2169 /* TBD: PM8921 regulator instead of 8901 */
2170 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2171 static int prev_on;
2172 int rc;
2173
2174 if (on == prev_on)
2175 return 0;
2176
2177 if (!reg_8921_hdmi_mvs)
2178 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2179 "hdmi_mvs");
2180
2181 if (on) {
2182 rc = regulator_enable(reg_8921_hdmi_mvs);
2183 if (rc) {
2184 pr_err("'%s' regulator enable failed, rc=%d\n",
2185 "8921_hdmi_mvs", rc);
2186 return rc;
2187 }
2188 pr_debug("%s(on): success\n", __func__);
2189 } else {
2190 rc = regulator_disable(reg_8921_hdmi_mvs);
2191 if (rc)
2192 pr_warning("'%s' regulator disable failed, rc=%d\n",
2193 "8921_hdmi_mvs", rc);
2194 pr_debug("%s(off): success\n", __func__);
2195 }
2196
2197 prev_on = on;
2198
2199 return 0;
2200}
2201
2202static int hdmi_core_power(int on, int show)
2203{
2204 static struct regulator *reg_8921_l23, *reg_8921_s4;
2205 static int prev_on;
2206 int rc;
2207
2208 if (on == prev_on)
2209 return 0;
2210
2211 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002212 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002213 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002214 if (IS_ERR(reg_8921_l23)) {
2215 pr_err("could not get reg_8921_l23, rc = %ld\n",
2216 PTR_ERR(reg_8921_l23));
2217 return -ENODEV;
2218 }
2219 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2220 if (rc) {
2221 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2222 return -EINVAL;
2223 }
2224 }
2225 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002226 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002227 if (IS_ERR(reg_8921_s4)) {
2228 pr_err("could not get reg_8921_s4, rc = %ld\n",
2229 PTR_ERR(reg_8921_s4));
2230 return -ENODEV;
2231 }
2232 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2233 if (rc) {
2234 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2235 return -EINVAL;
2236 }
2237 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002238
2239 if (on) {
2240 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2241 if (rc < 0) {
2242 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2243 return -EINVAL;
2244 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002245 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002246 if (rc) {
2247 pr_err("'%s' regulator enable failed, rc=%d\n",
2248 "hdmi_avdd", rc);
2249 return rc;
2250 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002251 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002252 if (rc) {
2253 pr_err("'%s' regulator enable failed, rc=%d\n",
2254 "hdmi_vcc", rc);
2255 return rc;
2256 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002257 rc = gpio_request(100, "HDMI_DDC_CLK");
2258 if (rc) {
2259 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2260 "HDMI_DDC_CLK", 100, rc);
2261 goto error1;
2262 }
2263 rc = gpio_request(101, "HDMI_DDC_DATA");
2264 if (rc) {
2265 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2266 "HDMI_DDC_DATA", 101, rc);
2267 goto error2;
2268 }
2269 rc = gpio_request(102, "HDMI_HPD");
2270 if (rc) {
2271 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2272 "HDMI_HPD", 102, rc);
2273 goto error3;
2274 }
2275 pr_debug("%s(on): success\n", __func__);
2276 } else {
2277 gpio_free(100);
2278 gpio_free(101);
2279 gpio_free(102);
2280
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002281 rc = regulator_disable(reg_8921_l23);
2282 if (rc) {
2283 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2284 return -ENODEV;
2285 }
2286 rc = regulator_disable(reg_8921_s4);
2287 if (rc) {
2288 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2289 return -ENODEV;
2290 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002291 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2292 if (rc < 0) {
2293 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2294 return -EINVAL;
2295 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002296 pr_debug("%s(off): success\n", __func__);
2297 }
2298
2299 prev_on = on;
2300
2301 return 0;
2302
2303error3:
2304 gpio_free(101);
2305error2:
2306 gpio_free(100);
2307error1:
2308 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002309 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002310 return rc;
2311}
2312
2313static int hdmi_cec_power(int on)
2314{
2315 static int prev_on;
2316 int rc;
2317
2318 if (on == prev_on)
2319 return 0;
2320
2321 if (on) {
2322 rc = gpio_request(99, "HDMI_CEC_VAR");
2323 if (rc) {
2324 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2325 "HDMI_CEC_VAR", 99, rc);
2326 goto error;
2327 }
2328 pr_debug("%s(on): success\n", __func__);
2329 } else {
2330 gpio_free(99);
2331 pr_debug("%s(off): success\n", __func__);
2332 }
2333
2334 prev_on = on;
2335
2336 return 0;
2337error:
2338 return rc;
2339}
2340#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2341
2342static void __init msm8960_allocate_memory_regions(void)
2343{
2344 void *addr;
2345 unsigned long size;
2346
2347 size = MSM_FB_SIZE;
2348 addr = alloc_bootmem_align(size, 0x1000);
2349 msm_fb_resources[0].start = __pa(addr);
2350 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2351 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2352 size, addr, __pa(addr));
2353
2354}
2355#ifdef CONFIG_WCD9310_CODEC
2356
2357#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2358
Patrick Lai3043fba2011-08-01 14:15:57 -07002359/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2360 * 4 micbiases are used to power various analog and digital
2361 * microphones operating at 1800 mV. Technically, all micbiases
2362 * can source from single cfilter since all microphones operate
2363 * at the same voltage level. The arrangement below is to make
2364 * sure all cfilters are exercised. LDO_H regulator ouput level
2365 * does not need to be as high as 2.85V. It is choosen for
2366 * microphone sensitivity purpose.
2367 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002368static struct tabla_pdata tabla_platform_data = {
2369 .slimbus_slave_device = {
2370 .name = "tabla-slave",
2371 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2372 },
2373 .irq = MSM_GPIO_TO_INT(62),
2374 .irq_base = TABLA_INTERRUPT_BASE,
2375 .num_irqs = NR_TABLA_IRQS,
2376 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002377 .micbias = {
2378 .ldoh_v = TABLA_LDOH_2P85_V,
2379 .cfilt1_mv = 1800,
2380 .cfilt2_mv = 1800,
2381 .cfilt3_mv = 1800,
2382 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2383 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2384 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2385 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2386 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002387};
2388
2389static struct slim_device msm_slim_tabla = {
2390 .name = "tabla-slim",
2391 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2392 .dev = {
2393 .platform_data = &tabla_platform_data,
2394 },
2395};
2396#endif
2397
2398static struct slim_boardinfo msm_slim_devices[] = {
2399#ifdef CONFIG_WCD9310_CODEC
2400 {
2401 .bus_num = 1,
2402 .slim_slave = &msm_slim_tabla,
2403 },
2404#endif
2405 /* add more slimbus slaves as needed */
2406};
2407
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002408#define MSM_WCNSS_PHYS 0x03000000
2409#define MSM_WCNSS_SIZE 0x280000
2410
2411static struct resource resources_wcnss_wlan[] = {
2412 {
2413 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2414 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2415 .name = "wcnss_wlanrx_irq",
2416 .flags = IORESOURCE_IRQ,
2417 },
2418 {
2419 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2420 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2421 .name = "wcnss_wlantx_irq",
2422 .flags = IORESOURCE_IRQ,
2423 },
2424 {
2425 .start = MSM_WCNSS_PHYS,
2426 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2427 .name = "wcnss_mmio",
2428 .flags = IORESOURCE_MEM,
2429 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002430 {
2431 .start = 84,
2432 .end = 88,
2433 .name = "wcnss_gpios_5wire",
2434 .flags = IORESOURCE_IO,
2435 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002436};
2437
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002438static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2439 .has_48mhz_xo = 1,
2440};
2441
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002442static struct platform_device msm_device_wcnss_wlan = {
2443 .name = "wcnss_wlan",
2444 .id = 0,
2445 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2446 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002447 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002448};
2449
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002450#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2451 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2452 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2453 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2454
2455#define QCE_SIZE 0x10000
2456#define QCE_0_BASE 0x18500000
2457
2458#define QCE_HW_KEY_SUPPORT 0
2459#define QCE_SHA_HMAC_SUPPORT 1
2460#define QCE_SHARE_CE_RESOURCE 1
2461#define QCE_CE_SHARED 0
2462
2463static struct resource qcrypto_resources[] = {
2464 [0] = {
2465 .start = QCE_0_BASE,
2466 .end = QCE_0_BASE + QCE_SIZE - 1,
2467 .flags = IORESOURCE_MEM,
2468 },
2469 [1] = {
2470 .name = "crypto_channels",
2471 .start = DMOV_CE_IN_CHAN,
2472 .end = DMOV_CE_OUT_CHAN,
2473 .flags = IORESOURCE_DMA,
2474 },
2475 [2] = {
2476 .name = "crypto_crci_in",
2477 .start = DMOV_CE_IN_CRCI,
2478 .end = DMOV_CE_IN_CRCI,
2479 .flags = IORESOURCE_DMA,
2480 },
2481 [3] = {
2482 .name = "crypto_crci_out",
2483 .start = DMOV_CE_OUT_CRCI,
2484 .end = DMOV_CE_OUT_CRCI,
2485 .flags = IORESOURCE_DMA,
2486 },
2487};
2488
2489static struct resource qcedev_resources[] = {
2490 [0] = {
2491 .start = QCE_0_BASE,
2492 .end = QCE_0_BASE + QCE_SIZE - 1,
2493 .flags = IORESOURCE_MEM,
2494 },
2495 [1] = {
2496 .name = "crypto_channels",
2497 .start = DMOV_CE_IN_CHAN,
2498 .end = DMOV_CE_OUT_CHAN,
2499 .flags = IORESOURCE_DMA,
2500 },
2501 [2] = {
2502 .name = "crypto_crci_in",
2503 .start = DMOV_CE_IN_CRCI,
2504 .end = DMOV_CE_IN_CRCI,
2505 .flags = IORESOURCE_DMA,
2506 },
2507 [3] = {
2508 .name = "crypto_crci_out",
2509 .start = DMOV_CE_OUT_CRCI,
2510 .end = DMOV_CE_OUT_CRCI,
2511 .flags = IORESOURCE_DMA,
2512 },
2513};
2514
2515#endif
2516
2517#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2518 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2519
2520static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2521 .ce_shared = QCE_CE_SHARED,
2522 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2523 .hw_key_support = QCE_HW_KEY_SUPPORT,
2524 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2525};
2526
2527static struct platform_device qcrypto_device = {
2528 .name = "qcrypto",
2529 .id = 0,
2530 .num_resources = ARRAY_SIZE(qcrypto_resources),
2531 .resource = qcrypto_resources,
2532 .dev = {
2533 .coherent_dma_mask = DMA_BIT_MASK(32),
2534 .platform_data = &qcrypto_ce_hw_suppport,
2535 },
2536};
2537#endif
2538
2539#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2540 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2541
2542static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2543 .ce_shared = QCE_CE_SHARED,
2544 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2545 .hw_key_support = QCE_HW_KEY_SUPPORT,
2546 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2547};
2548
2549static struct platform_device qcedev_device = {
2550 .name = "qce",
2551 .id = 0,
2552 .num_resources = ARRAY_SIZE(qcedev_resources),
2553 .resource = qcedev_resources,
2554 .dev = {
2555 .coherent_dma_mask = DMA_BIT_MASK(32),
2556 .platform_data = &qcedev_ce_hw_suppport,
2557 },
2558};
2559#endif
2560
2561
2562static int __init gpiomux_init(void)
2563{
2564 int rc;
2565
2566 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2567 if (rc) {
2568 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2569 return rc;
2570 }
2571
Nishant Pandit24153d82011-08-27 16:05:13 +05302572 msm_gpiomux_install(msm8960_cam_common_configs,
2573 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002574
2575 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002576 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002577
2578 msm_gpiomux_install(msm8960_gsbi_configs,
2579 ARRAY_SIZE(msm8960_gsbi_configs));
2580
2581 msm_gpiomux_install(msm8960_cyts_configs,
2582 ARRAY_SIZE(msm8960_cyts_configs));
2583
2584 msm_gpiomux_install(msm8960_slimbus_config,
2585 ARRAY_SIZE(msm8960_slimbus_config));
2586
2587 msm_gpiomux_install(msm8960_audio_codec_configs,
2588 ARRAY_SIZE(msm8960_audio_codec_configs));
2589
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002590 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2591 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2592
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002593#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2594 msm_gpiomux_install(msm8960_hdmi_configs,
2595 ARRAY_SIZE(msm8960_hdmi_configs));
2596#endif
2597
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002598 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2599 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2600
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002601 msm_gpiomux_install(wcnss_5wire_interface,
2602 ARRAY_SIZE(wcnss_5wire_interface));
2603
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302604#ifdef CONFIG_USB_EHCI_MSM_HSIC
2605 msm_gpiomux_install(msm8960_hsic_configs,
2606 ARRAY_SIZE(msm8960_hsic_configs));
2607#endif
2608
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002609 return 0;
2610}
2611
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002612#define MSM_SHARED_RAM_PHYS 0x80000000
2613
2614static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2615 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2616 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2617 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2618 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2619 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2620 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2621 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2622 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2623 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2624 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2625 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2626 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002627 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2628 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2629 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2630 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2631 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2632 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2633 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2634 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2635 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2636 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2637 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2638 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2639 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2640 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002641 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002642 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2643 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2644 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002645 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2646 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002647};
2648
2649static struct pm8921_adc_properties pm8921_adc_data = {
2650 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2651 .bitresolution = 15,
2652 .bipolar = 0,
2653};
2654
2655static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2656 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002657 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002658 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002659 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002660};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002661
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002662static void __init msm8960_map_io(void)
2663{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002664 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002665 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002666
2667 if (socinfo_init() < 0)
2668 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002669}
2670
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002671#ifdef CONFIG_ARCH_MSM8930
2672static void __init msm8930_map_io(void)
2673{
2674 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2675 msm_map_msm8930_io();
2676
2677 if (socinfo_init() < 0)
2678 pr_err("socinfo_init() failed!\n");
2679}
2680#endif
2681
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002682static void __init msm8960_init_irq(void)
2683{
2684 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002685
2686 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002687 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002688 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002689
2690 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002692
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002693 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2694 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002695
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002696 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2697 * as they are configured as level, which does not play nice with
2698 * handle_percpu_irq.
2699 */
2700 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2701 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002702 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002703 }
2704}
2705
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002706/* MSM8960 have 5 SDCC controllers */
2707enum sdcc_controllers {
2708 SDCC1,
2709 SDCC2,
2710 SDCC3,
2711 SDCC4,
2712 SDCC5,
2713 MAX_SDCC_CONTROLLER
2714};
2715
2716/* All SDCC controllers requires VDD/VCC voltage */
2717static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2718 /* SDCC1 : eMMC card connected */
2719 [SDCC1] = {
2720 .name = "sdc_vdd",
2721 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302722 .high_vol_level = 2950000,
2723 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302724 .always_on = 1,
2725 .lpm_sup = 1,
2726 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002727 .hpm_uA = 200000, /* 200mA */
2728 },
2729 /* SDCC3 : External card slot connected */
2730 [SDCC3] = {
2731 .name = "sdc_vdd",
2732 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302733 .high_vol_level = 2950000,
2734 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002735 .hpm_uA = 600000, /* 600mA */
2736 }
2737};
2738
2739/* Only slots having eMMC card will require VCCQ voltage */
2740static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2741 /* SDCC1 : eMMC card connected */
2742 [SDCC1] = {
2743 .name = "sdc_vccq",
2744 .set_voltage_sup = 1,
2745 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302746 .high_vol_level = 1800000,
2747 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002748 .hpm_uA = 200000, /* 200mA */
2749 }
2750};
2751
2752/* All SDCC controllers may require voting for VDD PAD voltage */
2753static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2754 /* SDCC3 : External card slot connected */
2755 [SDCC3] = {
2756 .name = "sdc_vddp",
2757 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302758 .high_vol_level = 2950000,
2759 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002760 .always_on = 1,
2761 .lpm_sup = 1,
2762 /* Max. Active current required is 16 mA */
2763 .hpm_uA = 16000,
2764 /*
2765 * Sleep current required is ~300 uA. But min. vote can be
2766 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2767 * during sleep.
2768 */
2769 .lpm_uA = 2000,
2770 }
2771};
2772
2773static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2774 /* SDCC1 : eMMC card connected */
2775 [SDCC1] = {
2776 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2777 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2778 },
2779 /* SDCC3 : External card slot connected */
2780 [SDCC3] = {
2781 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2782 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2783 }
2784};
2785
2786/* SDC1 pad data */
2787static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2788 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302789 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2790 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002791};
2792
2793static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2794 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2795 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2796 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2797};
2798
2799static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302800 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002801 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2802 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2803};
2804
2805static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302806 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002807 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2808 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2809};
2810
2811/* SDC3 pad data */
2812static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2813 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2814 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2815 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2816};
2817
2818static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2819 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2820 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2821 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2822};
2823
2824static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302825 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002826 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2827 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2828};
2829
2830static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302831 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302832 /*
2833 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2834 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2835 * which would result in false card detection interrupts.
2836 */
2837 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2838 /*
2839 * Keeping DATA lines status to PULL UP will make sure that
2840 * there is no current leak during sleep if external pull up
2841 * is connected to DATA lines.
2842 */
2843 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002844};
2845
2846struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2847 [SDCC1] = {
2848 .on = sdc1_pad_pull_on_cfg,
2849 .off = sdc1_pad_pull_off_cfg,
2850 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2851 },
2852 [SDCC3] = {
2853 .on = sdc3_pad_pull_on_cfg,
2854 .off = sdc3_pad_pull_off_cfg,
2855 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2856 },
2857};
2858
2859struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2860 [SDCC1] = {
2861 .on = sdc1_pad_drv_on_cfg,
2862 .off = sdc1_pad_drv_off_cfg,
2863 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2864 },
2865 [SDCC3] = {
2866 .on = sdc3_pad_drv_on_cfg,
2867 .off = sdc3_pad_drv_off_cfg,
2868 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2869 },
2870};
2871
2872struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2873 [SDCC1] = {
2874 .pull = &mmc_pad_pull_data[SDCC1],
2875 .drv = &mmc_pad_drv_data[SDCC1]
2876 },
2877 [SDCC3] = {
2878 .pull = &mmc_pad_pull_data[SDCC3],
2879 .drv = &mmc_pad_drv_data[SDCC3]
2880 },
2881};
2882
2883struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2884 [SDCC1] = {
2885 .pad_data = &mmc_pad_data[SDCC1],
2886 },
2887 [SDCC3] = {
2888 .pad_data = &mmc_pad_data[SDCC3],
2889 },
2890};
2891
2892static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302893 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002894};
2895
2896static unsigned int sdc3_sup_clk_rates[] = {
2897 400000, 24000000, 48000000, 96000000
2898};
2899
2900#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2901static struct mmc_platform_data msm8960_sdc1_data = {
2902 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2903#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2904 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2905#else
2906 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2907#endif
2908 .sup_clk_table = sdc1_sup_clk_rates,
2909 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302910 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002911 .nonremovable = 1,
2912 .sdcc_v4_sup = true,
2913 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302914 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002915};
2916#endif
2917
2918#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2919static struct mmc_platform_data msm8960_sdc3_data = {
2920 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2921 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2922 .sup_clk_table = sdc3_sup_clk_rates,
2923 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302924 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302925#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002926 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302927#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002928 .sdcc_v4_sup = true,
2929 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2930 .pin_data = &mmc_slot_pin_data[SDCC3],
2931#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2932 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2933 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2934 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2935#endif
2936 .xpc_cap = 1,
2937 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2938 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302939 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002940};
2941#endif
2942
2943static void __init msm8960_init_mmc(void)
2944{
2945#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2946 /* SDC1 : eMMC card connected */
2947 msm_add_sdcc(1, &msm8960_sdc1_data);
2948#endif
2949#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2950 /* SDC3: External card slot */
2951 msm_add_sdcc(3, &msm8960_sdc3_data);
2952#endif
2953}
2954
2955static void __init msm8960_init_buses(void)
2956{
2957#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06002958 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06002959 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
2960 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
2961 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
2962 msm_bus_apps_fabric.dev.platform_data =
2963 &msm_bus_8960_apps_fabric_pdata;
2964 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
2965 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
2966 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
2967 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002968#endif
2969}
2970
2971static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2972 .max_clock_speed = 15060000,
2973};
2974
2975#ifdef CONFIG_USB_MSM_OTG_72K
2976static struct msm_otg_platform_data msm_otg_pdata;
2977#else
2978#define USB_5V_EN 42
2979static void msm_hsusb_vbus_power(bool on)
2980{
2981 int rc;
2982 static bool vbus_is_on;
2983 static struct regulator *mvs_otg_switch;
2984 struct pm_gpio param = {
2985 .direction = PM_GPIO_DIR_OUT,
2986 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2987 .output_value = 1,
2988 .pull = PM_GPIO_PULL_NO,
2989 .vin_sel = PM_GPIO_VIN_S4,
2990 .out_strength = PM_GPIO_STRENGTH_MED,
2991 .function = PM_GPIO_FUNC_NORMAL,
2992 };
2993
2994 if (vbus_is_on == on)
2995 return;
2996
2997 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002998 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2999 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003000 if (IS_ERR(mvs_otg_switch)) {
3001 pr_err("Unable to get mvs_otg_switch\n");
3002 return;
3003 }
3004
3005 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3006 "usb_5v_en");
3007 if (rc < 0) {
3008 pr_err("failed to request usb_5v_en gpio\n");
3009 goto put_mvs_otg;
3010 }
3011
3012 if (regulator_enable(mvs_otg_switch)) {
3013 pr_err("unable to enable mvs_otg_switch\n");
3014 goto free_usb_5v_en;
3015 }
3016
3017 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3018 &param);
3019 if (rc < 0) {
3020 pr_err("failed to configure usb_5v_en gpio\n");
3021 goto disable_mvs_otg;
3022 }
3023 vbus_is_on = true;
3024 return;
3025 }
3026disable_mvs_otg:
3027 regulator_disable(mvs_otg_switch);
3028free_usb_5v_en:
3029 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
3030put_mvs_otg:
3031 regulator_put(mvs_otg_switch);
3032 vbus_is_on = false;
3033}
3034
3035static struct msm_otg_platform_data msm_otg_pdata = {
3036 .mode = USB_OTG,
3037 .otg_control = OTG_PMIC_CONTROL,
3038 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3039 .pclk_src_name = "dfab_usb_hs_clk",
3040 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3041 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303042 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003043};
3044#endif
3045
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303046#ifdef CONFIG_USB_EHCI_MSM_HSIC
3047static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3048 .strobe = 150,
3049 .data = 151,
3050};
3051#else
3052static struct msm_hsic_host_platform_data msm_hsic_pdata;
3053#endif
3054
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003055#define PID_MAGIC_ID 0x71432909
3056#define SERIAL_NUM_MAGIC_ID 0x61945374
3057#define SERIAL_NUMBER_LENGTH 127
3058#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3059
3060struct magic_num_struct {
3061 uint32_t pid;
3062 uint32_t serial_num;
3063};
3064
3065struct dload_struct {
3066 uint32_t reserved1;
3067 uint32_t reserved2;
3068 uint32_t reserved3;
3069 uint16_t reserved4;
3070 uint16_t pid;
3071 char serial_number[SERIAL_NUMBER_LENGTH];
3072 uint16_t reserved5;
3073 struct magic_num_struct magic_struct;
3074};
3075
3076static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3077{
3078 struct dload_struct __iomem *dload = 0;
3079
3080 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3081 if (!dload) {
3082 pr_err("%s: cannot remap I/O memory region: %08x\n",
3083 __func__, DLOAD_USB_BASE_ADD);
3084 return -ENXIO;
3085 }
3086
3087 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3088 __func__, dload, pid, snum);
3089 /* update pid */
3090 dload->magic_struct.pid = PID_MAGIC_ID;
3091 dload->pid = pid;
3092
3093 /* update serial number */
3094 dload->magic_struct.serial_num = 0;
3095 if (!snum) {
3096 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3097 goto out;
3098 }
3099
3100 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
3101 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
3102 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
3103out:
3104 iounmap(dload);
3105 return 0;
3106}
3107
3108static struct android_usb_platform_data android_usb_pdata = {
3109 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3110};
3111
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003112static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003113 .name = "android_usb",
3114 .id = -1,
3115 .dev = {
3116 .platform_data = &android_usb_pdata,
3117 },
3118};
3119
3120static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3121 0x03, 0x0f,
3122};
3123
3124static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3125 0x00, 0x24, 0x54, 0x10,
3126 0x09, 0x03, 0x01,
3127 0x10, 0x54, 0x30, 0x0C,
3128 0x24, 0x30, 0x0f,
3129};
3130
3131static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3132 0x00, 0x24, 0x54, 0x10,
3133 0x09, 0x07, 0x01, 0x0B,
3134 0x10, 0x54, 0x30, 0x0C,
3135 0x24, 0x30, 0x0f,
3136};
3137
3138static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3139 [0] = {
3140 .mode = MSM_SPM_MODE_CLOCK_GATING,
3141 .notify_rpm = false,
3142 .cmd = spm_wfi_cmd_sequence,
3143 },
3144 [1] = {
3145 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3146 .notify_rpm = false,
3147 .cmd = spm_power_collapse_without_rpm,
3148 },
3149 [2] = {
3150 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3151 .notify_rpm = true,
3152 .cmd = spm_power_collapse_with_rpm,
3153 },
3154};
3155
3156static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3157 [0] = {
3158 .reg_base_addr = MSM_SAW0_BASE,
3159 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3160 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3161 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3162#if defined(CONFIG_MSM_AVS_HW)
3163 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3164 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3165#endif
3166 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3167 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3168 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3169 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3170 .vctl_timeout_us = 50,
3171 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3172 .modes = msm_spm_seq_list,
3173 },
3174 [1] = {
3175 .reg_base_addr = MSM_SAW1_BASE,
3176 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3177 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3178 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3179#if defined(CONFIG_MSM_AVS_HW)
3180 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3181 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3182#endif
3183 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3184 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3185 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3186 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3187 .vctl_timeout_us = 50,
3188 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3189 .modes = msm_spm_seq_list,
3190 },
3191};
3192
3193static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3194 0x00, 0x20, 0x03, 0x20,
3195 0x00, 0x0f,
3196};
3197
3198static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3199 0x00, 0x20, 0x34, 0x64,
3200 0x48, 0x07, 0x48, 0x20,
3201 0x50, 0x64, 0x04, 0x34,
3202 0x50, 0x0f,
3203};
3204static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3205 0x00, 0x10, 0x34, 0x64,
3206 0x48, 0x07, 0x48, 0x10,
3207 0x50, 0x64, 0x04, 0x34,
3208 0x50, 0x0F,
3209};
3210
3211static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3212 [0] = {
3213 .mode = MSM_SPM_L2_MODE_RETENTION,
3214 .notify_rpm = false,
3215 .cmd = l2_spm_wfi_cmd_sequence,
3216 },
3217 [1] = {
3218 .mode = MSM_SPM_L2_MODE_GDHS,
3219 .notify_rpm = true,
3220 .cmd = l2_spm_gdhs_cmd_sequence,
3221 },
3222 [2] = {
3223 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3224 .notify_rpm = true,
3225 .cmd = l2_spm_power_off_cmd_sequence,
3226 },
3227};
3228
3229
3230static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3231 [0] = {
3232 .reg_base_addr = MSM_SAW_L2_BASE,
3233 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3234 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3235 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3236 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3237 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3238 .modes = msm_spm_l2_seq_list,
3239 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3240 },
3241};
3242
3243#define CYTTSP_TS_GPIO_IRQ 11
3244#define CYTTSP_TS_SLEEP_GPIO 50
3245#define CYTTSP_TS_RESOUT_N_GPIO 52
3246
3247/*virtual key support */
3248static ssize_t tma340_vkeys_show(struct kobject *kobj,
3249 struct kobj_attribute *attr, char *buf)
3250{
3251 return snprintf(buf, 200,
3252 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3253 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3254 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3255 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3256 "\n");
3257}
3258
3259static struct kobj_attribute tma340_vkeys_attr = {
3260 .attr = {
3261 .mode = S_IRUGO,
3262 },
3263 .show = &tma340_vkeys_show,
3264};
3265
3266static struct attribute *tma340_properties_attrs[] = {
3267 &tma340_vkeys_attr.attr,
3268 NULL
3269};
3270
3271static struct attribute_group tma340_properties_attr_group = {
3272 .attrs = tma340_properties_attrs,
3273};
3274
3275
3276static int cyttsp_platform_init(struct i2c_client *client)
3277{
3278 int rc = 0;
3279 static struct kobject *tma340_properties_kobj;
3280
3281 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3282 tma340_properties_kobj = kobject_create_and_add("board_properties",
3283 NULL);
3284 if (tma340_properties_kobj)
3285 rc = sysfs_create_group(tma340_properties_kobj,
3286 &tma340_properties_attr_group);
3287 if (!tma340_properties_kobj || rc)
3288 pr_err("%s: failed to create board_properties\n",
3289 __func__);
3290
3291 return 0;
3292}
3293
3294static struct cyttsp_regulator regulator_data[] = {
3295 {
3296 .name = "vdd",
3297 .min_uV = CY_TMA300_VTG_MIN_UV,
3298 .max_uV = CY_TMA300_VTG_MAX_UV,
3299 .load_uA = CY_TMA300_CURR_24HZ_UA,
3300 },
3301 /* TODO: Remove after runtime PM is enabled in I2C driver */
3302 {
3303 .name = "vcc_i2c",
3304 .min_uV = CY_I2C_VTG_MIN_UV,
3305 .max_uV = CY_I2C_VTG_MAX_UV,
3306 .load_uA = CY_I2C_CURR_UA,
3307 },
3308};
3309
3310static struct cyttsp_platform_data cyttsp_pdata = {
3311 .panel_maxx = 634,
3312 .panel_maxy = 1166,
3313 .disp_maxx = 616,
3314 .disp_maxy = 1023,
3315 .disp_minx = 0,
3316 .disp_miny = 16,
3317 .flags = 0x01,
3318 .gen = CY_GEN3, /* or */
3319 .use_st = CY_USE_ST,
3320 .use_mt = CY_USE_MT,
3321 .use_hndshk = CY_SEND_HNDSHK,
3322 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303323 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003324 .use_gestures = CY_USE_GESTURES,
3325 .fw_fname = "cyttsp_8960_cdp.hex",
3326 /* activate up to 4 groups
3327 * and set active distance
3328 */
3329 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3330 CY_GEST_GRP3 | CY_GEST_GRP4 |
3331 CY_ACT_DIST,
3332 /* change act_intrvl to customize the Active power state
3333 * scanning/processing refresh interval for Operating mode
3334 */
3335 .act_intrvl = CY_ACT_INTRVL_DFLT,
3336 /* change tch_tmout to customize the touch timeout for the
3337 * Active power state for Operating mode
3338 */
3339 .tch_tmout = CY_TCH_TMOUT_DFLT,
3340 /* change lp_intrvl to customize the Low Power power state
3341 * scanning/processing refresh interval for Operating mode
3342 */
3343 .lp_intrvl = CY_LP_INTRVL_DFLT,
3344 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3345 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3346 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3347 .regulator_info = regulator_data,
3348 .num_regulators = ARRAY_SIZE(regulator_data),
3349 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303350 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003351};
3352
3353static struct i2c_board_info cyttsp_info[] __initdata = {
3354 {
3355 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3356 .platform_data = &cyttsp_pdata,
3357#ifndef CY_USE_TIMER
3358 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3359#endif /* CY_USE_TIMER */
3360 },
3361};
3362
Mohan Pallaka50837382011-09-07 11:00:57 +05303363/* configuration data */
3364static const u8 mxt_config_data[] = {
3365 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003366 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303367 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003368 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3372 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3373 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3374 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303375 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003376 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303377 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003378 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303379 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003380 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3381 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3382 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3383 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303384 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003385 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3386 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303387 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003388 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3389 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303390 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003391 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3392 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303393 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003394 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3395 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303396 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003397 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303398 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003399 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303400 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003401 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303402 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003403 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303404 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003405 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303406};
3407
3408#define MXT_TS_GPIO_IRQ 11
3409#define MXT_TS_LDO_EN_GPIO 50
3410#define MXT_TS_RESET_GPIO 52
3411
3412static void mxt_init_hw_liquid(void)
3413{
3414 int rc;
3415
3416 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3417 if (rc) {
3418 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3419 __func__, MXT_TS_GPIO_IRQ);
3420 return;
3421 }
3422
3423 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3424 if (rc) {
3425 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3426 __func__, MXT_TS_GPIO_IRQ);
3427 goto err_irq_gpio_req;
3428 }
3429
3430 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3431 if (rc) {
3432 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3433 __func__, MXT_TS_LDO_EN_GPIO);
3434 goto err_irq_gpio_req;
3435 }
3436
3437 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3438 if (rc) {
3439 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3440 __func__, MXT_TS_LDO_EN_GPIO);
3441 goto err_ldo_gpio_req;
3442 }
3443
3444 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3445 if (rc) {
3446 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3447 __func__, MXT_TS_RESET_GPIO);
3448 goto err_ldo_gpio_set_dir;
3449 }
3450
3451 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3452 if (rc) {
3453 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3454 __func__, MXT_TS_RESET_GPIO);
3455 goto err_reset_gpio_req;
3456 }
3457
3458 return;
3459
3460err_reset_gpio_req:
3461 gpio_free(MXT_TS_RESET_GPIO);
3462err_ldo_gpio_set_dir:
3463 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3464err_ldo_gpio_req:
3465 gpio_free(MXT_TS_LDO_EN_GPIO);
3466err_irq_gpio_req:
3467 gpio_free(MXT_TS_GPIO_IRQ);
3468}
3469
3470static struct mxt_platform_data mxt_platform_data = {
3471 .config = mxt_config_data,
3472 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003473 .x_size = 1365,
3474 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303475 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003476 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303477};
3478
3479static struct i2c_board_info mxt_device_info[] __initdata = {
3480 {
3481 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3482 .platform_data = &mxt_platform_data,
3483 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3484 },
3485};
3486
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003487static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3488{
3489}
3490
3491static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3492 .clk_freq = 100000,
3493 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003494 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3495};
3496
3497static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3498 .clk_freq = 100000,
3499 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003500 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3501};
3502
3503static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3504 .clk_freq = 100000,
3505 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003506 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3507};
3508
3509static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3510 .clk_freq = 100000,
3511 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003512 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3513};
3514
3515static struct msm_rpm_platform_data msm_rpm_data = {
3516 .reg_base_addrs = {
3517 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3518 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3519 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3520 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3521 },
3522
3523 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3524 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3525 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3526 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3527 .msm_apps_ipc_rpm_val = 4,
3528};
3529
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003530static struct ks8851_pdata spi_eth_pdata = {
3531 .irq_gpio = KS8851_IRQ_GPIO,
3532 .rst_gpio = KS8851_RST_GPIO,
3533};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003534
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003535static struct spi_board_info spi_board_info[] __initdata = {
3536 {
3537 .modalias = "ks8851",
3538 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3539 .max_speed_hz = 19200000,
3540 .bus_num = 0,
3541 .chip_select = 0,
3542 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003543 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003544 },
3545};
3546
3547static struct platform_device msm_device_saw_core0 = {
3548 .name = "saw-regulator",
3549 .id = 0,
3550 .dev = {
3551 .platform_data = &msm_saw_regulator_pdata_s5,
3552 },
3553};
3554
3555static struct platform_device msm_device_saw_core1 = {
3556 .name = "saw-regulator",
3557 .id = 1,
3558 .dev = {
3559 .platform_data = &msm_saw_regulator_pdata_s6,
3560 },
3561};
3562
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003563static struct tsens_platform_data msm_tsens_pdata = {
3564 .slope = 910,
3565 .tsens_factor = 1000,
3566 .hw_type = MSM_8960,
3567 .tsens_num_sensor = 5,
3568};
3569
3570static struct platform_device msm_tsens_device = {
3571 .name = "tsens8960-tm",
3572 .id = -1,
3573 .dev = {
3574 .platform_data = &msm_tsens_pdata,
3575 },
3576};
3577
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003578#ifdef CONFIG_MSM_FAKE_BATTERY
3579static struct platform_device fish_battery_device = {
3580 .name = "fish_battery",
3581};
3582#endif
3583
David Collins26f05562011-06-20 09:56:28 -07003584static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003585 .name = GPIO_REGULATOR_DEV_NAME,
3586 .id = PM8921_MPP_PM_TO_SYS(7),
3587 .dev = {
3588 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3589 },
3590};
3591
David Collins26f05562011-06-20 09:56:28 -07003592static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003593 .name = GPIO_REGULATOR_DEV_NAME,
3594 .id = 91,
3595 .dev = {
3596 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3597 },
3598};
3599
David Collinsb10be1d2011-09-02 10:29:31 -07003600static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3601 .name = GPIO_REGULATOR_DEV_NAME,
3602 .id = PM8921_GPIO_PM_TO_SYS(17),
3603 .dev = {
3604 .platform_data =
3605 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3606 },
3607};
3608
David Collins26f05562011-06-20 09:56:28 -07003609static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3610 .name = "rpm-regulator",
3611 .id = -1,
3612 .dev = {
3613 .platform_data = &msm_rpm_regulator_pdata,
3614 },
3615};
3616
David Collins4c31a872011-08-31 10:07:10 -07003617static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3618 .phys_addr_base = 0x0010C000,
3619 .reg_offsets = {
3620 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3621 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3622 },
3623 .phys_size = SZ_8K,
3624 .log_len = 4096, /* log's buffer length in bytes */
3625 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3626};
3627
3628static struct platform_device msm_rpm_log_device = {
3629 .name = "msm_rpm_log",
3630 .id = -1,
3631 .dev = {
3632 .platform_data = &msm_rpm_log_pdata,
3633 },
3634};
3635
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003636static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003637 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003638 &msm_device_smd,
3639 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303640 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003641 &msm_device_saw_core0,
3642 &msm_device_saw_core1,
3643 &msm8960_device_ext_5v_vreg,
3644 &msm8960_device_ext_l2_vreg,
3645 &msm8960_device_ssbi_pm8921,
3646 &msm8960_device_qup_spi_gsbi1,
3647 &msm8960_device_qup_i2c_gsbi3,
3648 &msm8960_device_qup_i2c_gsbi4,
3649 &msm8960_device_qup_i2c_gsbi10,
3650#ifndef CONFIG_MSM_DSPS
3651 &msm8960_device_qup_i2c_gsbi12,
3652#endif
3653 &msm_slim_ctrl,
3654 &msm_device_wcnss_wlan,
3655#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3656 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3657 &qcrypto_device,
3658#endif
3659
3660#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3661 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3662 &qcedev_device,
3663#endif
3664#ifdef CONFIG_MSM_ROTATOR
3665 &msm_rotator_device,
3666#endif
3667 &msm_device_sps,
3668#ifdef CONFIG_MSM_FAKE_BATTERY
3669 &fish_battery_device,
3670#endif
3671#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003672#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003673 &android_pmem_device,
3674 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003675#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003676 &android_pmem_audio_device,
3677#endif
3678 &msm_fb_device,
3679 &msm_device_vidc,
3680 &msm_device_bam_dmux,
3681 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003682
3683#ifdef CONFIG_HW_RANDOM_MSM
3684 &msm_device_rng,
3685#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003686 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003687#ifdef CONFIG_ION_MSM
3688 &ion_dev,
3689#endif
David Collins4c31a872011-08-31 10:07:10 -07003690 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003691#ifdef CONFIG_MSM_QDSS
3692 &msm_etb_device,
3693 &msm_tpiu_device,
3694 &msm_funnel_device,
3695 &msm_ptm_device,
3696#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003697 &msm_device_dspcrashd_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003698};
3699
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003700static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003701 &msm8960_device_otg,
3702 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003703 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303704 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003705 &android_usb_device,
3706 &msm_device_vidc,
3707 &mipi_dsi_simulator_panel_device,
3708 &msm_bus_apps_fabric,
3709 &msm_bus_sys_fabric,
3710 &msm_bus_mm_fabric,
3711 &msm_bus_sys_fpb,
3712 &msm_bus_cpss_fpb,
3713 &msm_pcm,
3714 &msm_pcm_routing,
3715 &msm_cpudai0,
3716 &msm_cpudai1,
3717 &msm_cpudai_hdmi_rx,
3718 &msm_cpudai_bt_rx,
3719 &msm_cpudai_bt_tx,
3720 &msm_cpudai_fm_rx,
3721 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003722 &msm_cpudai_auxpcm_rx,
3723 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003724 &msm_cpu_fe,
3725 &msm_stub_codec,
3726 &msm_voice,
3727 &msm_voip,
3728 &msm_lpa_pcm,
3729
3730#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3731 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3732 &qcrypto_device,
3733#endif
3734
3735#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3736 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3737 &qcedev_device,
3738#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003739};
3740
3741static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003742 &msm_kgsl_3d0,
3743 &msm_kgsl_2d0,
3744 &msm_kgsl_2d1,
3745 &mipi_dsi_renesas_panel_device,
3746#ifdef CONFIG_MSM_GEMINI
3747 &msm8960_gemini_device,
3748#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003749};
3750
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003751static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003752 &msm8960_device_otg,
3753 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003754 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303755 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003756 &android_usb_device,
3757 &msm_pcm,
3758 &msm_pcm_routing,
3759 &msm_cpudai0,
3760 &msm_cpudai1,
3761 &msm_cpudai_hdmi_rx,
3762 &msm_cpudai_bt_rx,
3763 &msm_cpudai_bt_tx,
3764 &msm_cpudai_fm_rx,
3765 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003766 &msm_cpudai_auxpcm_rx,
3767 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003768 &msm_cpu_fe,
3769 &msm_stub_codec,
3770 &msm_kgsl_3d0,
3771#ifdef CONFIG_MSM_KGSL_2D
3772 &msm_kgsl_2d0,
3773 &msm_kgsl_2d1,
3774#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003775 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003776#ifdef CONFIG_MSM_GEMINI
3777 &msm8960_gemini_device,
3778#endif
3779 &msm_voice,
3780 &msm_voip,
3781 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303782 &msm_cpudai_afe_01_rx,
3783 &msm_cpudai_afe_01_tx,
3784 &msm_cpudai_afe_02_rx,
3785 &msm_cpudai_afe_02_tx,
3786 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003787#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3788 &hdmi_msm_device,
3789#endif
3790 &msm_pcm_hostless,
3791 &msm_bus_apps_fabric,
3792 &msm_bus_sys_fabric,
3793 &msm_bus_mm_fabric,
3794 &msm_bus_sys_fpb,
3795 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003796 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003797};
3798
3799static void __init msm8960_i2c_init(void)
3800{
3801 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3802 &msm8960_i2c_qup_gsbi4_pdata;
3803
3804 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3805 &msm8960_i2c_qup_gsbi3_pdata;
3806
3807 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3808 &msm8960_i2c_qup_gsbi10_pdata;
3809
3810 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3811 &msm8960_i2c_qup_gsbi12_pdata;
3812}
3813
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003814static void __init msm8960_gfx_init(void)
3815{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003816 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003817 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3818 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3819 msm_kgsl_3d0.dev.platform_data;
3820 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3821 320000000;
3822 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3823 266667000;
3824 }
3825}
3826
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003827static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3828 .irq_base = PM8921_IRQ_BASE,
3829 .devirq = MSM_GPIO_TO_INT(104),
3830 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3831};
3832
3833static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3834 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3835};
3836
3837static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3838 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3839};
3840
3841static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3842 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303843 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003844};
3845
3846static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3847 .pull_up = 1,
3848 .kpd_trigger_delay_us = 970,
3849 .wakeup = 1,
3850};
3851
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303852/* Rotate lock key is not available so use F1 */
3853#define KEY_ROTATE_LOCK KEY_F1
3854
3855static const unsigned int keymap_liquid[] = {
3856 KEY(0, 0, KEY_VOLUMEUP),
3857 KEY(0, 1, KEY_VOLUMEDOWN),
3858 KEY(1, 3, KEY_ROTATE_LOCK),
3859 KEY(1, 4, KEY_HOME),
3860};
3861
3862static struct matrix_keymap_data keymap_data_liquid = {
3863 .keymap_size = ARRAY_SIZE(keymap_liquid),
3864 .keymap = keymap_liquid,
3865};
3866
3867static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3868 .input_name = "keypad_8960_liquid",
3869 .input_phys_device = "keypad_8960/input0",
3870 .num_rows = 2,
3871 .num_cols = 5,
3872 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3873 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3874 .debounce_ms = 15,
3875 .scan_delay_ms = 32,
3876 .row_hold_ns = 91500,
3877 .wakeup = 1,
3878 .keymap_data = &keymap_data_liquid,
3879};
3880
3881
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003882static const unsigned int keymap[] = {
3883 KEY(0, 0, KEY_VOLUMEUP),
3884 KEY(0, 1, KEY_VOLUMEDOWN),
3885 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3886 KEY(0, 3, KEY_CAMERA_FOCUS),
3887};
3888
3889static struct matrix_keymap_data keymap_data = {
3890 .keymap_size = ARRAY_SIZE(keymap),
3891 .keymap = keymap,
3892};
3893
3894static struct pm8xxx_keypad_platform_data keypad_data = {
3895 .input_name = "keypad_8960",
3896 .input_phys_device = "keypad_8960/input0",
3897 .num_rows = 1,
3898 .num_cols = 5,
3899 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3900 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3901 .debounce_ms = 15,
3902 .scan_delay_ms = 32,
3903 .row_hold_ns = 91500,
3904 .wakeup = 1,
3905 .keymap_data = &keymap_data,
3906};
3907
3908static const unsigned int keymap_sim[] = {
3909 KEY(0, 0, KEY_7),
3910 KEY(0, 1, KEY_DOWN),
3911 KEY(0, 2, KEY_UP),
3912 KEY(0, 3, KEY_RIGHT),
3913 KEY(0, 4, KEY_ENTER),
3914 KEY(0, 5, KEY_L),
3915 KEY(0, 6, KEY_BACK),
3916 KEY(0, 7, KEY_M),
3917
3918 KEY(1, 0, KEY_LEFT),
3919 KEY(1, 1, KEY_SEND),
3920 KEY(1, 2, KEY_1),
3921 KEY(1, 3, KEY_4),
3922 KEY(1, 4, KEY_CLEAR),
3923 KEY(1, 5, KEY_MSDOS),
3924 KEY(1, 6, KEY_SPACE),
3925 KEY(1, 7, KEY_COMMA),
3926
3927 KEY(2, 0, KEY_6),
3928 KEY(2, 1, KEY_5),
3929 KEY(2, 2, KEY_8),
3930 KEY(2, 3, KEY_3),
3931 KEY(2, 4, KEY_NUMERIC_STAR),
3932 KEY(2, 5, KEY_UP),
3933 KEY(2, 6, KEY_DOWN),
3934 KEY(2, 7, KEY_LEFTSHIFT),
3935
3936 KEY(3, 0, KEY_9),
3937 KEY(3, 1, KEY_NUMERIC_POUND),
3938 KEY(3, 2, KEY_0),
3939 KEY(3, 3, KEY_2),
3940 KEY(3, 4, KEY_SLEEP),
3941 KEY(3, 5, KEY_F1),
3942 KEY(3, 6, KEY_F2),
3943 KEY(3, 7, KEY_F3),
3944
3945 KEY(4, 0, KEY_BACK),
3946 KEY(4, 1, KEY_HOME),
3947 KEY(4, 2, KEY_MENU),
3948 KEY(4, 3, KEY_VOLUMEUP),
3949 KEY(4, 4, KEY_VOLUMEDOWN),
3950 KEY(4, 5, KEY_F4),
3951 KEY(4, 6, KEY_F5),
3952 KEY(4, 7, KEY_F6),
3953
3954 KEY(5, 0, KEY_R),
3955 KEY(5, 1, KEY_T),
3956 KEY(5, 2, KEY_Y),
3957 KEY(5, 3, KEY_LEFTALT),
3958 KEY(5, 4, KEY_KPENTER),
3959 KEY(5, 5, KEY_Q),
3960 KEY(5, 6, KEY_W),
3961 KEY(5, 7, KEY_E),
3962
3963 KEY(6, 0, KEY_F),
3964 KEY(6, 1, KEY_G),
3965 KEY(6, 2, KEY_H),
3966 KEY(6, 3, KEY_CAPSLOCK),
3967 KEY(6, 4, KEY_PAGEUP),
3968 KEY(6, 5, KEY_A),
3969 KEY(6, 6, KEY_S),
3970 KEY(6, 7, KEY_D),
3971
3972 KEY(7, 0, KEY_V),
3973 KEY(7, 1, KEY_B),
3974 KEY(7, 2, KEY_N),
3975 KEY(7, 3, KEY_MENU),
3976 KEY(7, 4, KEY_PAGEDOWN),
3977 KEY(7, 5, KEY_Z),
3978 KEY(7, 6, KEY_X),
3979 KEY(7, 7, KEY_C),
3980
3981 KEY(8, 0, KEY_P),
3982 KEY(8, 1, KEY_J),
3983 KEY(8, 2, KEY_K),
3984 KEY(8, 3, KEY_INSERT),
3985 KEY(8, 4, KEY_LINEFEED),
3986 KEY(8, 5, KEY_U),
3987 KEY(8, 6, KEY_I),
3988 KEY(8, 7, KEY_O),
3989
3990 KEY(9, 0, KEY_4),
3991 KEY(9, 1, KEY_5),
3992 KEY(9, 2, KEY_6),
3993 KEY(9, 3, KEY_7),
3994 KEY(9, 4, KEY_8),
3995 KEY(9, 5, KEY_1),
3996 KEY(9, 6, KEY_2),
3997 KEY(9, 7, KEY_3),
3998
3999 KEY(10, 0, KEY_F7),
4000 KEY(10, 1, KEY_F8),
4001 KEY(10, 2, KEY_F9),
4002 KEY(10, 3, KEY_F10),
4003 KEY(10, 4, KEY_FN),
4004 KEY(10, 5, KEY_9),
4005 KEY(10, 6, KEY_0),
4006 KEY(10, 7, KEY_DOT),
4007
4008 KEY(11, 0, KEY_LEFTCTRL),
4009 KEY(11, 1, KEY_F11),
4010 KEY(11, 2, KEY_ENTER),
4011 KEY(11, 3, KEY_SEARCH),
4012 KEY(11, 4, KEY_DELETE),
4013 KEY(11, 5, KEY_RIGHT),
4014 KEY(11, 6, KEY_LEFT),
4015 KEY(11, 7, KEY_RIGHTSHIFT),
4016 KEY(0, 0, KEY_VOLUMEUP),
4017 KEY(0, 1, KEY_VOLUMEDOWN),
4018 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4019 KEY(0, 3, KEY_CAMERA_FOCUS),
4020};
4021
4022static struct matrix_keymap_data keymap_data_sim = {
4023 .keymap_size = ARRAY_SIZE(keymap_sim),
4024 .keymap = keymap_sim,
4025};
4026
4027static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4028 .input_name = "keypad_8960",
4029 .input_phys_device = "keypad_8960/input0",
4030 .num_rows = 12,
4031 .num_cols = 8,
4032 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4033 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4034 .debounce_ms = 15,
4035 .scan_delay_ms = 32,
4036 .row_hold_ns = 91500,
4037 .wakeup = 1,
4038 .keymap_data = &keymap_data_sim,
4039};
4040
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004041static int pm8921_therm_mitigation[] = {
4042 1100,
4043 700,
4044 600,
4045 325,
4046};
4047
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004048static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004049 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004050 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004051 .max_voltage = 4200,
4052 .min_voltage = 3200,
4053 .resume_voltage = 4100,
4054 .term_current = 100,
4055 .cool_temp = 10,
4056 .warm_temp = 40,
4057 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004058 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004059 .cool_bat_chg_current = 350,
4060 .warm_bat_chg_current = 350,
4061 .cool_bat_voltage = 4100,
4062 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004063 .thermal_mitigation = pm8921_therm_mitigation,
4064 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004065};
4066
4067static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4068 .priority = 0,
4069};
4070
4071static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4072 .r_sense = 10,
4073 .i_test = 2500,
4074 .v_failure = 3000,
4075 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004076};
4077
Jay Chokshide4cefb2011-08-04 18:10:44 -07004078#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004079#define PM8XXX_LED_PWM_PERIOD 1000
4080#define PM8XXX_LED_PWM_DUTY_MS 20
4081/**
4082 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4083 * driven using PWM feature.
4084 */
4085#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004086
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004087static struct led_info pm8921_led_info[] = {
4088 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004089 .name = "led:battery_charging",
4090 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004091 },
4092 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004093 .name = "led:battery_full",
4094 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004095 },
4096};
4097
Jay Chokshi8994e392011-09-14 18:20:39 -07004098static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004099 .num_leds = ARRAY_SIZE(pm8921_led_info),
4100 .leds = pm8921_led_info,
4101};
4102
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004103static int pm8921_led0_pwm_duty_pcts[56] = {
4104 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4105 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4106 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4107 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4108 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4109 14, 10, 6, 4, 1
4110};
4111
4112static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4113 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4114 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4115 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4116 .start_idx = 0,
4117};
4118
Jay Chokshi8994e392011-09-14 18:20:39 -07004119static struct pm8xxx_led_config pm8921_led_configs[] = {
4120 [0] = {
4121 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004122 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004123 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004124 .pwm_channel = 5,
4125 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4126 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004127 },
4128 [1] = {
4129 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004130 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004131 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004132 .pwm_channel = 4,
4133 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004134 },
4135};
4136
4137static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4138 .led_core = &pm8921_led_core_pdata,
4139 .configs = pm8921_led_configs,
4140 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4141};
4142
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004143static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4144 .irq_pdata = &pm8xxx_irq_pdata,
4145 .gpio_pdata = &pm8xxx_gpio_pdata,
4146 .mpp_pdata = &pm8xxx_mpp_pdata,
4147 .rtc_pdata = &pm8xxx_rtc_pdata,
4148 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4149 .keypad_pdata = &keypad_data,
4150 .misc_pdata = &pm8xxx_misc_pdata,
4151 .regulator_pdatas = msm_pm8921_regulator_pdata,
4152 .charger_pdata = &pm8921_chg_pdata,
4153 .bms_pdata = &pm8921_bms_pdata,
4154 .adc_pdata = &pm8921_adc_pdata,
4155 .leds_pdata = &pm8xxx_leds_pdata,
4156};
4157
4158static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4159 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4160 .slave = {
4161 .name = "pm8921-core",
4162 .platform_data = &pm8921_platform_data,
4163 },
4164};
4165
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004166#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
4167static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004168{
4169 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004170
4171 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
4172 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004173 pr_err("FPGA CS gpio_request failed: %d\n", ret);
4174 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004175 }
4176
4177 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004178
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004179 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004180fail:
4181 return ret;
4182}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004183#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004184static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004185{
4186 return 0;
4187}
4188#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004189
4190static struct msm_cpuidle_state msm_cstates[] __initdata = {
4191 {0, 0, "C0", "WFI",
4192 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4193
4194 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4195 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4196
4197 {0, 2, "C2", "POWER_COLLAPSE",
4198 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4199
4200 {1, 0, "C0", "WFI",
4201 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4202
4203 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4204 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4205};
4206
4207static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4208 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4209 .idle_supported = 1,
4210 .suspend_supported = 1,
4211 .idle_enabled = 0,
4212 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004213 },
4214
4215 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4216 .idle_supported = 1,
4217 .suspend_supported = 1,
4218 .idle_enabled = 0,
4219 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004220 },
4221
4222 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4223 .idle_supported = 1,
4224 .suspend_supported = 1,
4225 .idle_enabled = 1,
4226 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004227 },
4228
4229 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4230 .idle_supported = 0,
4231 .suspend_supported = 1,
4232 .idle_enabled = 0,
4233 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004234 },
4235
4236 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4237 .idle_supported = 1,
4238 .suspend_supported = 1,
4239 .idle_enabled = 0,
4240 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004241 },
4242
4243 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4244 .idle_supported = 1,
4245 .suspend_supported = 0,
4246 .idle_enabled = 1,
4247 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004248 },
4249};
4250
4251static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4252 {
4253 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4254 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4255 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004256 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004257 },
4258
4259 {
4260 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4261 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4262 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004263 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004264 },
4265
4266 {
4267 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4268 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4269 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004270 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004271 },
4272
4273 {
4274 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4275 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4276 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004277 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004278 },
4279
4280 {
4281 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4282 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4283 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004284 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004285 },
4286
4287 {
4288 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4289 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4290 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004291 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004292 },
4293
4294 {
4295 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4296 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4297 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004298 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004299 },
4300
4301 {
4302 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4303 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4304 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004305 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004306 },
4307};
4308
4309#ifdef CONFIG_I2C
4310#define I2C_SURF 1
4311#define I2C_FFA (1 << 1)
4312#define I2C_RUMI (1 << 2)
4313#define I2C_SIM (1 << 3)
4314#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004315#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004316
4317struct i2c_registry {
4318 u8 machs;
4319 int bus;
4320 struct i2c_board_info *info;
4321 int len;
4322};
4323
4324#ifdef CONFIG_MSM_CAMERA
4325static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4326#ifdef CONFIG_IMX074
4327 {
4328 I2C_BOARD_INFO("imx074", 0x1A),
4329 },
4330#endif
4331#ifdef CONFIG_OV2720
4332 {
4333 I2C_BOARD_INFO("ov2720", 0x6C),
4334 },
4335#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004336 {
4337 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4338 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304339#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4340 {
4341 I2C_BOARD_INFO("sc628a", 0x6E),
4342 },
4343#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004344};
4345#endif
4346
4347/* Sensors DSPS platform data */
4348#ifdef CONFIG_MSM_DSPS
4349#define DSPS_PIL_GENERIC_NAME "dsps"
4350#endif /* CONFIG_MSM_DSPS */
4351
4352static void __init msm8960_init_dsps(void)
4353{
4354#ifdef CONFIG_MSM_DSPS
4355 struct msm_dsps_platform_data *pdata =
4356 msm_dsps_device.dev.platform_data;
4357 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4358 pdata->gpios = NULL;
4359 pdata->gpios_num = 0;
4360
4361 platform_device_register(&msm_dsps_device);
4362#endif /* CONFIG_MSM_DSPS */
4363}
4364
Amir Samuelov5137e392011-09-21 17:31:25 +03004365#ifdef CONFIG_ISL9519_CHARGER
4366static struct isl_platform_data isl_data __initdata = {
4367 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4368 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4369 .max_system_voltage = 4200,
4370 .min_system_voltage = 3200,
4371 .chgcurrent = 1000, /* 1900, */
4372 .term_current = 400, /* Need fine tuning */
4373 .input_current = 2048,
4374};
4375
4376static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4377 {
4378 I2C_BOARD_INFO("isl9519q", 0x9),
4379 .irq = 0, /* Not required when notify-by-pmic */
4380 .platform_data = &isl_data,
4381 },
4382};
4383#endif /* CONFIG_ISL9519_CHARGER */
4384
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004385static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4386#ifdef CONFIG_MSM_CAMERA
4387 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004388 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004389 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4390 msm_camera_boardinfo,
4391 ARRAY_SIZE(msm_camera_boardinfo),
4392 },
4393#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004394#ifdef CONFIG_ISL9519_CHARGER
4395 {
4396 I2C_LIQUID,
4397 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4398 isl_charger_i2c_info,
4399 ARRAY_SIZE(isl_charger_i2c_info),
4400 },
4401#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004402 {
4403 I2C_SURF | I2C_FFA | I2C_FLUID,
4404 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4405 cyttsp_info,
4406 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004407 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304408 {
4409 I2C_LIQUID,
4410 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4411 mxt_device_info,
4412 ARRAY_SIZE(mxt_device_info),
4413 },
4414
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004415};
4416#endif /* CONFIG_I2C */
4417
4418static void __init register_i2c_devices(void)
4419{
4420#ifdef CONFIG_I2C
4421 u8 mach_mask = 0;
4422 int i;
4423
4424 /* Build the matching 'supported_machs' bitmask */
4425 if (machine_is_msm8960_cdp())
4426 mach_mask = I2C_SURF;
4427 else if (machine_is_msm8960_rumi3())
4428 mach_mask = I2C_RUMI;
4429 else if (machine_is_msm8960_sim())
4430 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004431 else if (machine_is_msm8960_fluid())
4432 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004433 else if (machine_is_msm8960_liquid())
4434 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004435 else if (machine_is_msm8960_mtp())
4436 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004437 else
4438 pr_err("unmatched machine ID in register_i2c_devices\n");
4439
4440 /* Run the array and install devices as appropriate */
4441 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4442 if (msm8960_i2c_devices[i].machs & mach_mask)
4443 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4444 msm8960_i2c_devices[i].info,
4445 msm8960_i2c_devices[i].len);
4446 }
4447#endif
4448}
4449
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004450static void __init msm8960_sim_init(void)
4451{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004452 BUG_ON(msm_rpm_init(&msm_rpm_data));
4453 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4454 ARRAY_SIZE(msm_rpmrs_levels)));
4455 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004456 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004457 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004458 msm8960_device_ssbi_pm8921.dev.platform_data =
4459 &msm8960_ssbi_pm8921_pdata;
4460 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004461
4462 /* Simulator supports a QWERTY keypad */
4463 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4464
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004465 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4466 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4467 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004468 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004469 msm8960_i2c_init();
4470 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4471 msm_spm_l2_init(msm_spm_l2_data);
4472 msm8960_init_buses();
4473 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4474 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004475 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004476 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004477
4478 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4479 &msm8960_qup_spi_gsbi1_pdata;
4480 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4481
4482 msm8960_init_mmc();
4483 msm_fb_add_devices();
4484 slim_register_board_info(msm_slim_devices,
4485 ARRAY_SIZE(msm_slim_devices));
4486 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4487 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4488 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4489 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004490 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004491}
4492
4493static void __init msm8960_rumi3_init(void)
4494{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004495 BUG_ON(msm_rpm_init(&msm_rpm_data));
4496 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4497 ARRAY_SIZE(msm_rpmrs_levels)));
4498 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004499 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004500 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004501 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004502 msm8960_device_ssbi_pm8921.dev.platform_data =
4503 &msm8960_ssbi_pm8921_pdata;
4504 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4505 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4506 &msm8960_qup_spi_gsbi1_pdata;
4507 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4508 msm8960_i2c_init();
4509 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4510 msm_spm_l2_init(msm_spm_l2_data);
4511 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4512 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004513 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004514 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004515 register_i2c_devices();
4516 msm_fb_add_devices();
4517 slim_register_board_info(msm_slim_devices,
4518 ARRAY_SIZE(msm_slim_devices));
4519 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4520 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4521 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4522 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004523 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004524}
4525
4526static void __init msm8960_cdp_init(void)
4527{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004528 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4529 pr_err("meminfo_init() failed!\n");
4530
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004531 BUG_ON(msm_rpm_init(&msm_rpm_data));
4532 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4533 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004534
4535 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004536 regulator_suppress_info_printing();
4537 if (msm_xo_init())
4538 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004539 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004540 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004541 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4542 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4543 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304544 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004545 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004546 if (machine_is_msm8960_cdp())
4547 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304548 if (machine_is_msm8960_liquid())
4549 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004550 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4551 &msm8960_qup_spi_gsbi1_pdata;
4552 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4553 msm8960_device_ssbi_pm8921.dev.platform_data =
4554 &msm8960_ssbi_pm8921_pdata;
4555 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4556 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004557 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004558 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4559 msm_spm_l2_init(msm_spm_l2_data);
4560 msm8960_init_buses();
4561 platform_add_devices(msm_footswitch_devices,
4562 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004563 if (machine_is_msm8960_liquid())
4564 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004565 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4566 pm8921_gpio_mpp_init();
4567 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4568 msm8960_init_cam();
4569 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004570 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304571 if (machine_is_msm8960_liquid())
4572 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004573 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004574 msm_fb_add_devices();
4575 slim_register_board_info(msm_slim_devices,
4576 ARRAY_SIZE(msm_slim_devices));
4577 msm8960_init_dsps();
4578 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4579 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4580 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4581 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004582 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004583 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004584}
4585
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004586MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4587 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004588 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004589 .init_irq = msm8960_init_irq,
4590 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004591 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004592 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004593MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004594
4595MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4596 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004597 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004598 .init_irq = msm8960_init_irq,
4599 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004600 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004601 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004602MACHINE_END
4603
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004604MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4605 .map_io = msm8960_map_io,
4606 .reserve = msm8960_reserve,
4607 .init_irq = msm8960_init_irq,
4608 .timer = &msm_timer,
4609 .init_machine = msm8960_cdp_init,
4610 .init_early = msm8960_allocate_memory_regions,
4611MACHINE_END
4612
4613MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4614 .map_io = msm8960_map_io,
4615 .reserve = msm8960_reserve,
4616 .init_irq = msm8960_init_irq,
4617 .timer = &msm_timer,
4618 .init_machine = msm8960_cdp_init,
4619 .init_early = msm8960_allocate_memory_regions,
4620MACHINE_END
4621
4622MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4623 .map_io = msm8960_map_io,
4624 .reserve = msm8960_reserve,
4625 .init_irq = msm8960_init_irq,
4626 .timer = &msm_timer,
4627 .init_machine = msm8960_cdp_init,
4628 .init_early = msm8960_allocate_memory_regions,
4629MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004630
4631MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4632 .map_io = msm8960_map_io,
4633 .reserve = msm8960_reserve,
4634 .init_irq = msm8960_init_irq,
4635 .timer = &msm_timer,
4636 .init_machine = msm8960_cdp_init,
4637 .init_early = msm8960_allocate_memory_regions,
4638MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004639
4640#ifdef CONFIG_ARCH_MSM8930
4641MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4642 .map_io = msm8930_map_io,
4643 .reserve = msm8960_reserve,
4644 .init_irq = msm8960_init_irq,
4645 .timer = &msm_timer,
4646 .init_machine = msm8960_cdp_init,
4647 .init_early = msm8960_allocate_memory_regions,
4648MACHINE_END
4649
4650MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4651 .map_io = msm8930_map_io,
4652 .reserve = msm8960_reserve,
4653 .init_irq = msm8960_init_irq,
4654 .timer = &msm_timer,
4655 .init_machine = msm8960_cdp_init,
4656 .init_early = msm8960_allocate_memory_regions,
4657MACHINE_END
4658
4659MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4660 .map_io = msm8930_map_io,
4661 .reserve = msm8960_reserve,
4662 .init_irq = msm8960_init_irq,
4663 .timer = &msm_timer,
4664 .init_machine = msm8960_cdp_init,
4665 .init_early = msm8960_allocate_memory_regions,
4666MACHINE_END
4667#endif