blob: 2615cd4570b843088d27d0f610d3479727ec20f1 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -070024#include <linux/mfd/pm8xxx/pm8921-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080042
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070045#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048
49#include <mach/board.h>
50#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <mach/msm_spi.h>
52#ifdef CONFIG_USB_MSM_OTG_72K
53#include <mach/msm_hsusb.h>
54#else
55#include <linux/usb/msm_hsusb.h>
56#endif
57#include <linux/usb/android.h>
58#include <mach/usbdiag.h>
59#include <mach/socinfo.h>
60#include <mach/rpm.h>
61#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070062#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#include <mach/msm_bus_board.h>
64#include <mach/msm_memtypes.h>
65#include <mach/dma.h>
66#include <mach/msm_dsps.h>
67#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070068#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#ifdef CONFIG_WCD9310_CODEC
71#include <linux/slimbus/slimbus.h>
72#include <linux/mfd/wcd9310/core.h>
73#include <linux/mfd/wcd9310/pdata.h>
74#endif
75
Laura Abbottd6183792011-08-19 13:42:24 -070076#include <linux/ion.h>
77#include <mach/ion.h>
78
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080080#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "spm.h"
83#include "board-msm8960.h"
84#include "pm.h"
85#include "cpuidle.h"
86#include "rpm_resources.h"
87#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070088#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070089#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070090#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091
92static struct platform_device msm_fm_platform_init = {
93 .name = "iris_fm",
94 .id = -1,
95};
96
97struct pm8xxx_gpio_init {
98 unsigned gpio;
99 struct pm_gpio config;
100};
101
102struct pm8xxx_mpp_init {
103 unsigned mpp;
104 struct pm8xxx_mpp_config_data config;
105};
106
107#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
108 _func, _inv, _disable) \
109{ \
110 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
111 .config = { \
112 .direction = _dir, \
113 .output_buffer = _buf, \
114 .output_value = _val, \
115 .pull = _pull, \
116 .vin_sel = _vin, \
117 .out_strength = _out_strength, \
118 .function = _func, \
119 .inv_int_pol = _inv, \
120 .disable_pin = _disable, \
121 } \
122}
123
124#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
125{ \
126 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
127 .config = { \
128 .type = PM8XXX_MPP_TYPE_##_type, \
129 .level = _level, \
130 .control = PM8XXX_MPP_##_control, \
131 } \
132}
133
134#define PM8XXX_GPIO_DISABLE(_gpio) \
135 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
136 0, 0, 0, 1)
137
138#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
139 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
140 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
141 PM_GPIO_STRENGTH_HIGH, \
142 PM_GPIO_FUNC_NORMAL, 0, 0)
143
144#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
145 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
146 _pull, PM_GPIO_VIN_S4, \
147 PM_GPIO_STRENGTH_NO, \
148 PM_GPIO_FUNC_NORMAL, 0, 0)
149
150#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
151 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
152 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
153 PM_GPIO_STRENGTH_HIGH, \
154 _func, 0, 0)
155
156/* Initial PM8921 GPIO configurations */
157static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
158 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
159 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
160 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300161 /* External regulator shared by display and touchscreen on LiQUID */
162 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
163 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700165 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700167 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700168};
169
170/* Initial PM8921 MPP configurations */
171static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
172 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
173 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700174 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
175 DOUT_CTRL_LOW),
176};
177
178static void __init pm8921_gpio_mpp_init(void)
179{
180 int i, rc;
181
182 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
183 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
184 &pm8921_gpios[i].config);
185 if (rc) {
186 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
187 break;
188 }
189 }
190
191 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
192 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
193 &pm8921_mpps[i].config);
194 if (rc) {
195 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
196 break;
197 }
198 }
199}
200
201#define FPGA_CS_GPIO 14
202#define KS8851_RST_GPIO 89
203#define KS8851_IRQ_GPIO 90
204
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700205#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
206enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700207 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700208 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
209 /* CAM Expander */
210 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
211 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
212 GPIO_CAM_GP_AFBUSY,
213 GPIO_CAM_GP_STROBE_CE,
214 GPIO_CAM_GP_CAM1MP_XCLR,
215 GPIO_CAM_GP_CAMIF_RESET_N,
216 GPIO_CAM_GP_XMT_FLASH_INT,
217 GPIO_CAM_GP_LED_EN1,
218 GPIO_CAM_GP_LED_EN2,
219
220};
221#endif
222
Harini Jayaraman608d0462011-08-09 19:10:03 -0600223/* The SPI configurations apply to GSBI 1*/
224static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700225 .func = GPIOMUX_FUNC_1,
226 .drv = GPIOMUX_DRV_8MA,
227 .pull = GPIOMUX_PULL_NONE,
228};
229
Harini Jayaraman608d0462011-08-09 19:10:03 -0600230static struct gpiomux_setting spi_suspended_config = {
231 .func = GPIOMUX_FUNC_GPIO,
232 .drv = GPIOMUX_DRV_2MA,
233 .pull = GPIOMUX_PULL_DOWN,
234};
235
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530236static struct gpiomux_setting gsbi3_suspended_cfg = {
237 .func = GPIOMUX_FUNC_1,
238 .drv = GPIOMUX_DRV_2MA,
239 .pull = GPIOMUX_PULL_KEEPER,
240};
241
242static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_8MA,
245 .pull = GPIOMUX_PULL_NONE,
246};
247
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700248static struct gpiomux_setting gsbi5 = {
249 .func = GPIOMUX_FUNC_1,
250 .drv = GPIOMUX_DRV_8MA,
251 .pull = GPIOMUX_PULL_NONE,
252};
253
254static struct gpiomux_setting gsbi10 = {
255 .func = GPIOMUX_FUNC_2,
256 .drv = GPIOMUX_DRV_8MA,
257 .pull = GPIOMUX_PULL_NONE,
258};
259
260static struct gpiomux_setting gsbi12 = {
261 .func = GPIOMUX_FUNC_1,
262 .drv = GPIOMUX_DRV_8MA,
263 .pull = GPIOMUX_PULL_NONE,
264};
265
266static struct gpiomux_setting cdc_mclk = {
267 .func = GPIOMUX_FUNC_1,
268 .drv = GPIOMUX_DRV_8MA,
269 .pull = GPIOMUX_PULL_NONE,
270};
271
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700272static struct gpiomux_setting audio_auxpcm[] = {
273 /* Suspended state */
274 {
275 .func = GPIOMUX_FUNC_GPIO,
276 .drv = GPIOMUX_DRV_2MA,
277 .pull = GPIOMUX_PULL_NONE,
278 },
279 /* Active state */
280 {
281 .func = GPIOMUX_FUNC_1,
282 .drv = GPIOMUX_DRV_2MA,
283 .pull = GPIOMUX_PULL_NONE,
284 },
285};
286
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700287#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288static struct gpiomux_setting gpio_eth_config = {
289 .pull = GPIOMUX_PULL_NONE,
290 .drv = GPIOMUX_DRV_8MA,
291 .func = GPIOMUX_FUNC_GPIO,
292};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700293#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700294
295static struct gpiomux_setting slimbus = {
296 .func = GPIOMUX_FUNC_1,
297 .drv = GPIOMUX_DRV_8MA,
298 .pull = GPIOMUX_PULL_KEEPER,
299};
300
301struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700302#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700303 {
304 .gpio = KS8851_IRQ_GPIO,
305 .settings = {
306 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
307 }
308 },
309 {
310 .gpio = KS8851_RST_GPIO,
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
313 }
314 },
315 {
316 .gpio = FPGA_CS_GPIO,
317 .settings = {
318 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
319 }
320 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700321#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322};
323
324static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
325 {
326 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
327 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600328 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
329 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330 },
331 },
332 {
333 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
334 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600335 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
336 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337 },
338 },
339 {
340 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
341 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600342 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
343 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700344 },
345 },
346 {
347 .gpio = 9, /* GSBI1 QUP SPI_CLK */
348 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600349 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
350 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700351 },
352 },
353 {
354 .gpio = 16, /* GSBI3 I2C QUP SDA */
355 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530356 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
357 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358 },
359 },
360 {
361 .gpio = 17, /* GSBI3 I2C QUP SCL */
362 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530363 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
364 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700365 },
366 },
367 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700368 .gpio = 22, /* GSBI5 UART2 */
369 .settings = {
370 [GPIOMUX_SUSPENDED] = &gsbi5,
371 },
372 },
373 {
374 .gpio = 23, /* GSBI5 UART2 */
375 .settings = {
376 [GPIOMUX_SUSPENDED] = &gsbi5,
377 },
378 },
379 {
380 .gpio = 24, /* GSBI5 UART2 */
381 .settings = {
382 [GPIOMUX_SUSPENDED] = &gsbi5,
383 },
384 },
385 {
386 .gpio = 25, /* GSBI5 UART2 */
387 .settings = {
388 [GPIOMUX_SUSPENDED] = &gsbi5,
389 },
390 },
391 {
392 .gpio = 44, /* GSBI12 I2C QUP SDA */
393 .settings = {
394 [GPIOMUX_SUSPENDED] = &gsbi12,
395 },
396 },
397 {
398 .gpio = 45, /* GSBI12 I2C QUP SCL */
399 .settings = {
400 [GPIOMUX_SUSPENDED] = &gsbi12,
401 },
402 },
403 {
404 .gpio = 73, /* GSBI10 I2C QUP SDA */
405 .settings = {
406 [GPIOMUX_SUSPENDED] = &gsbi10,
407 },
408 },
409 {
410 .gpio = 74, /* GSBI10 I2C QUP SCL */
411 .settings = {
412 [GPIOMUX_SUSPENDED] = &gsbi10,
413 },
414 },
415};
416
417static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
418 {
419 .gpio = 60, /* slimbus data */
420 .settings = {
421 [GPIOMUX_SUSPENDED] = &slimbus,
422 },
423 },
424 {
425 .gpio = 61, /* slimbus clk */
426 .settings = {
427 [GPIOMUX_SUSPENDED] = &slimbus,
428 },
429 },
430};
431
432static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
433 {
434 .gpio = 59,
435 .settings = {
436 [GPIOMUX_SUSPENDED] = &cdc_mclk,
437 },
438 },
439};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700440
441static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
442 {
443 .gpio = 63,
444 .settings = {
445 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
446 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
447 },
448 },
449 {
450 .gpio = 64,
451 .settings = {
452 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
453 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
454 },
455 },
456 {
457 .gpio = 65,
458 .settings = {
459 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
460 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
461 },
462 },
463 {
464 .gpio = 66,
465 .settings = {
466 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
467 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
468 },
469 },
470};
471
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700472static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
473 .func = GPIOMUX_FUNC_GPIO,
474 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700475 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700476};
477
478static struct gpiomux_setting wcnss_5wire_active_cfg = {
479 .func = GPIOMUX_FUNC_1,
480 .drv = GPIOMUX_DRV_6MA,
481 .pull = GPIOMUX_PULL_DOWN,
482};
483
484static struct msm_gpiomux_config wcnss_5wire_interface[] = {
485 {
486 .gpio = 84,
487 .settings = {
488 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
489 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
490 },
491 },
492 {
493 .gpio = 85,
494 .settings = {
495 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
496 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
497 },
498 },
499 {
500 .gpio = 86,
501 .settings = {
502 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
503 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
504 },
505 },
506 {
507 .gpio = 87,
508 .settings = {
509 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
510 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
511 },
512 },
513 {
514 .gpio = 88,
515 .settings = {
516 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
517 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
518 },
519 },
520};
Nishant Pandit24153d82011-08-27 16:05:13 +0530521static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530522 {
523 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
524 .drv = GPIOMUX_DRV_2MA,
525 .pull = GPIOMUX_PULL_DOWN,
526 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700527
Nishant Pandit474f2252011-07-23 23:17:56 +0530528 {
529 .func = GPIOMUX_FUNC_1, /*active 1*/
530 .drv = GPIOMUX_DRV_2MA,
531 .pull = GPIOMUX_PULL_NONE,
532 },
533
534 {
535 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
536 .drv = GPIOMUX_DRV_2MA,
537 .pull = GPIOMUX_PULL_NONE,
538 },
539
540 {
541 .func = GPIOMUX_FUNC_1, /*active 3*/
542 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700543 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530544 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530545
546 {
547 .func = GPIOMUX_FUNC_5, /*active 4*/
548 .drv = GPIOMUX_DRV_8MA,
549 .pull = GPIOMUX_PULL_UP,
550 },
551
552 {
553 .func = GPIOMUX_FUNC_6, /*active 5*/
554 .drv = GPIOMUX_DRV_8MA,
555 .pull = GPIOMUX_PULL_UP,
556 },
557
558 {
559 .func = GPIOMUX_FUNC_2, /*active 6*/
560 .drv = GPIOMUX_DRV_2MA,
561 .pull = GPIOMUX_PULL_UP,
562 },
563
564 {
565 .func = GPIOMUX_FUNC_3, /*active 7*/
566 .drv = GPIOMUX_DRV_8MA,
567 .pull = GPIOMUX_PULL_UP,
568 },
569
Kevin Chan4c58d292011-09-13 11:03:25 -0700570 {
571 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
572 .drv = GPIOMUX_DRV_2MA,
573 .pull = GPIOMUX_PULL_KEEPER,
574 },
575
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576};
577
Nishant Pandit24153d82011-08-27 16:05:13 +0530578static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700579 {
580 .gpio = 2,
581 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530582 [GPIOMUX_ACTIVE] = &cam_settings[2],
583 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700584 },
585 },
586 {
587 .gpio = 3,
588 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530589 [GPIOMUX_ACTIVE] = &cam_settings[1],
590 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591 },
592 },
593 {
594 .gpio = 4,
595 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530596 [GPIOMUX_ACTIVE] = &cam_settings[1],
597 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598 },
599 },
600 {
601 .gpio = 5,
602 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530603 [GPIOMUX_ACTIVE] = &cam_settings[1],
604 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700605 },
606 },
607 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530608 .gpio = 76,
609 .settings = {
610 [GPIOMUX_ACTIVE] = &cam_settings[2],
611 [GPIOMUX_SUSPENDED] = &cam_settings[0],
612 },
613 },
614 {
615 .gpio = 107,
616 .settings = {
617 [GPIOMUX_ACTIVE] = &cam_settings[2],
618 [GPIOMUX_SUSPENDED] = &cam_settings[0],
619 },
620 },
621};
622
623static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
624 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700625 .gpio = 18,
626 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530627 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700628 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700629 },
630 },
631 {
632 .gpio = 19,
633 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530634 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700635 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700636 },
637 },
638 {
639 .gpio = 20,
640 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530641 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700642 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700643 },
644 },
645 {
646 .gpio = 21,
647 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530648 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700649 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700650 },
651 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700652};
653
654static struct gpiomux_setting cyts_resout_sus_cfg = {
655 .func = GPIOMUX_FUNC_GPIO,
656 .drv = GPIOMUX_DRV_6MA,
657 .pull = GPIOMUX_PULL_UP,
658};
659
660static struct gpiomux_setting cyts_resout_act_cfg = {
661 .func = GPIOMUX_FUNC_GPIO,
662 .drv = GPIOMUX_DRV_6MA,
663 .pull = GPIOMUX_PULL_UP,
664};
665
666static struct gpiomux_setting cyts_sleep_sus_cfg = {
667 .func = GPIOMUX_FUNC_GPIO,
668 .drv = GPIOMUX_DRV_6MA,
669 .pull = GPIOMUX_PULL_DOWN,
670};
671
672static struct gpiomux_setting cyts_sleep_act_cfg = {
673 .func = GPIOMUX_FUNC_GPIO,
674 .drv = GPIOMUX_DRV_6MA,
675 .pull = GPIOMUX_PULL_DOWN,
676};
677
678static struct gpiomux_setting cyts_int_act_cfg = {
679 .func = GPIOMUX_FUNC_GPIO,
680 .drv = GPIOMUX_DRV_8MA,
681 .pull = GPIOMUX_PULL_UP,
682};
683
684static struct gpiomux_setting cyts_int_sus_cfg = {
685 .func = GPIOMUX_FUNC_GPIO,
686 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530687 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700688};
689
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700690static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
691 { /* TS INTERRUPT */
692 .gpio = 11,
693 .settings = {
694 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
695 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
696 },
697 },
698 { /* TS SLEEP */
699 .gpio = 50,
700 .settings = {
701 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
702 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
703 },
704 },
705 { /* TS RESOUT */
706 .gpio = 52,
707 .settings = {
708 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
709 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
710 },
711 },
712};
713
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530714#ifdef CONFIG_USB_EHCI_MSM_HSIC
715static struct gpiomux_setting hsic_act_cfg = {
716 .func = GPIOMUX_FUNC_1,
717 .drv = GPIOMUX_DRV_12MA,
718 .pull = GPIOMUX_PULL_NONE,
719};
720
721static struct gpiomux_setting hsic_sus_cfg = {
722 .func = GPIOMUX_FUNC_GPIO,
723 .drv = GPIOMUX_DRV_2MA,
724 .pull = GPIOMUX_PULL_DOWN,
725};
726
727static struct msm_gpiomux_config msm8960_hsic_configs[] = {
728 {
729 .gpio = 150, /*HSIC_STROBE */
730 .settings = {
731 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
732 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
733 },
734 },
735 {
736 .gpio = 151, /* HSIC_DATA */
737 .settings = {
738 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
739 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
740 },
741 },
742};
743#endif
744
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700745#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
746enum {
747 SX150X_CAM,
748};
749
Nishant Pandit474f2252011-07-23 23:17:56 +0530750static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700751 [SX150X_CAM] = {
752 .gpio_base = GPIO_CAM_EXPANDER_BASE,
753 .oscio_is_gpo = false,
754 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530755 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700756 .io_open_drain_ena = 0x0,
757 .irq_summary = -1,
758 },
759};
Nishant Pandit474f2252011-07-23 23:17:56 +0530760
761#endif
762
763#ifdef CONFIG_I2C
764
765#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
766#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300767#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530768
769#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
770
771static struct i2c_board_info cam_expander_i2c_info[] = {
772 {
773 I2C_BOARD_INFO("sx1508q", 0x22),
774 .platform_data = &sx150x_data[SX150X_CAM]
775 },
776};
777
778static struct msm_cam_expander_info cam_expander_info[] = {
779 {
780 cam_expander_i2c_info,
781 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
782 },
783};
784#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700785#endif
786
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700787#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
788#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700789#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700790#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
791#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
792#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700793#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700794#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700795#define MSM_ION_EBI_SIZE SZ_8M
796
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700797#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
798static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
799static int __init pmem_kernel_ebi1_size_setup(char *p)
800{
801 pmem_kernel_ebi1_size = memparse(p, NULL);
802 return 0;
803}
804early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
805#endif
806
807#ifdef CONFIG_ANDROID_PMEM
808static unsigned pmem_size = MSM_PMEM_SIZE;
809static int __init pmem_size_setup(char *p)
810{
811 pmem_size = memparse(p, NULL);
812 return 0;
813}
814early_param("pmem_size", pmem_size_setup);
815
816static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
817
818static int __init pmem_adsp_size_setup(char *p)
819{
820 pmem_adsp_size = memparse(p, NULL);
821 return 0;
822}
823early_param("pmem_adsp_size", pmem_adsp_size_setup);
824
825static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
826
827static int __init pmem_audio_size_setup(char *p)
828{
829 pmem_audio_size = memparse(p, NULL);
830 return 0;
831}
832early_param("pmem_audio_size", pmem_audio_size_setup);
833#endif
834
835#ifdef CONFIG_ANDROID_PMEM
836static struct android_pmem_platform_data android_pmem_pdata = {
837 .name = "pmem",
838 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
839 .cached = 1,
840 .memory_type = MEMTYPE_EBI1,
841};
842
843static struct platform_device android_pmem_device = {
844 .name = "android_pmem",
845 .id = 0,
846 .dev = {.platform_data = &android_pmem_pdata},
847};
848
849static struct android_pmem_platform_data android_pmem_adsp_pdata = {
850 .name = "pmem_adsp",
851 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
852 .cached = 0,
853 .memory_type = MEMTYPE_EBI1,
854};
855static struct platform_device android_pmem_adsp_device = {
856 .name = "android_pmem",
857 .id = 2,
858 .dev = { .platform_data = &android_pmem_adsp_pdata },
859};
860
861static struct android_pmem_platform_data android_pmem_audio_pdata = {
862 .name = "pmem_audio",
863 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
864 .cached = 0,
865 .memory_type = MEMTYPE_EBI1,
866};
867
868static struct platform_device android_pmem_audio_device = {
869 .name = "android_pmem",
870 .id = 4,
871 .dev = { .platform_data = &android_pmem_audio_pdata },
872};
873#endif
874
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700875#define DSP_RAM_BASE_8960 0x8da00000
876#define DSP_RAM_SIZE_8960 0x1800000
877static int dspcrashd_pdata_8960 = 0xDEADDEAD;
878
879static struct resource resources_dspcrashd_8960[] = {
880 {
881 .name = "msm_dspcrashd",
882 .start = DSP_RAM_BASE_8960,
883 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
884 .flags = IORESOURCE_DMA,
885 },
886};
887
888struct platform_device msm_device_dspcrashd_8960 = {
889 .name = "msm_dspcrashd",
890 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
891 .resource = resources_dspcrashd_8960,
892 .dev = { .platform_data = &dspcrashd_pdata_8960 },
893};
894
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700895static struct memtype_reserve msm8960_reserve_table[] __initdata = {
896 [MEMTYPE_SMI] = {
897 },
898 [MEMTYPE_EBI0] = {
899 .flags = MEMTYPE_FLAGS_1M_ALIGN,
900 },
901 [MEMTYPE_EBI1] = {
902 .flags = MEMTYPE_FLAGS_1M_ALIGN,
903 },
904};
905
906static void __init size_pmem_devices(void)
907{
908#ifdef CONFIG_ANDROID_PMEM
909 android_pmem_adsp_pdata.size = pmem_adsp_size;
910 android_pmem_pdata.size = pmem_size;
911 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
912#endif
913}
914
915static void __init reserve_memory_for(struct android_pmem_platform_data *p)
916{
917 msm8960_reserve_table[p->memory_type].size += p->size;
918}
919
920static void __init reserve_pmem_memory(void)
921{
922#ifdef CONFIG_ANDROID_PMEM
923 reserve_memory_for(&android_pmem_adsp_pdata);
924 reserve_memory_for(&android_pmem_pdata);
925 reserve_memory_for(&android_pmem_audio_pdata);
926 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
927#endif
928}
929
Larry Basselb4126da2011-07-18 14:31:33 -0700930static int msm8960_paddr_to_memtype(unsigned int paddr)
931{
932 return MEMTYPE_EBI1;
933}
934
Laura Abbottd6183792011-08-19 13:42:24 -0700935#ifdef CONFIG_ION_MSM
936struct ion_platform_data ion_pdata = {
937 .nr = 3,
938 .heaps = {
939 {
940 .id = ION_HEAP_SYSTEM_ID,
941 .type = ION_HEAP_TYPE_SYSTEM,
942 .name = ION_KMALLOC_HEAP_NAME,
943 },
944 {
945 .id = ION_HEAP_SYSTEM_CONTIG_ID,
946 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
947 .name = ION_VMALLOC_HEAP_NAME,
948 },
949 {
950 .id = ION_HEAP_EBI_ID,
951 .type = ION_HEAP_TYPE_CARVEOUT,
952 .name = ION_EBI1_HEAP_NAME,
953 .size = MSM_ION_EBI_SIZE,
954 .memory_type = ION_EBI_TYPE,
955 },
956 }
957};
958
959struct platform_device ion_dev = {
960 .name = "ion-msm",
961 .id = 1,
962 .dev = { .platform_data = &ion_pdata },
963};
964#endif
965
966static void reserve_ion_memory(void)
967{
968#ifdef CONFIG_ION_MSM
969 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
970#endif
971}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700972static void __init msm8960_calculate_reserve_sizes(void)
973{
974 size_pmem_devices();
975 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700976 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700977}
978
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700979static struct reserve_info msm8960_reserve_info __initdata = {
980 .memtype_reserve_table = msm8960_reserve_table,
981 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
982 .paddr_to_memtype = msm8960_paddr_to_memtype,
983};
984
Larry Basselb4126da2011-07-18 14:31:33 -0700985static int msm8960_memory_bank_size(void)
986{
987 return 1<<29;
988}
989
990static void __init locate_unstable_memory(void)
991{
992 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
993 unsigned long bank_size;
994 unsigned long low, high;
995
996 bank_size = msm8960_memory_bank_size();
997 low = meminfo.bank[0].start;
998 high = mb->start + mb->size;
999 low &= ~(bank_size - 1);
1000
1001 if (high - low <= bank_size)
1002 return;
1003 msm8960_reserve_info.low_unstable_address = low + bank_size;
1004 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
1005 msm8960_reserve_info.bank_size = bank_size;
1006 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1007 msm8960_reserve_info.low_unstable_address,
1008 msm8960_reserve_info.max_unstable_size,
1009 msm8960_reserve_info.bank_size);
1010}
1011
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001012static void __init msm8960_reserve(void)
1013{
1014 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001015 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001016 msm_reserve();
1017}
1018
Larry Bassela4414b12011-08-04 11:11:02 -07001019static int msm8960_change_memory_power(u64 start, u64 size,
1020 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001021{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001022 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001023}
1024
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001025#ifdef CONFIG_MSM_CAMERA
1026
Nishant Pandit24153d82011-08-27 16:05:13 +05301027static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001028 5, /*CAMIF_MCLK*/
1029 20, /*CAMIF_I2C_DATA*/
1030 21, /*CAMIF_I2C_CLK*/
1031};
1032
Nishant Pandit24153d82011-08-27 16:05:13 +05301033static struct msm_camera_gpio_conf gpio_conf = {
1034 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1035 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1036 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1037 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1038};
1039
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001040#define VFE_CAMIF_TIMER1_GPIO 2
1041#define VFE_CAMIF_TIMER2_GPIO 3
1042#define VFE_CAMIF_TIMER3_GPIO_INT 4
1043struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1044 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1045 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1046 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1047 .flash_recharge_duration = 50000,
1048 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1049};
1050
Nishant Pandit474f2252011-07-23 23:17:56 +05301051#ifdef CONFIG_MSM_CAMERA_FLASH
1052static struct msm_camera_sensor_flash_src msm_flash_src = {
1053 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1054 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1055 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1056#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1057 defined(CONFIG_GPIO_SX150X_MODULE))
1058 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1059#endif
1060};
1061#endif
1062
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001063static struct msm_bus_vectors cam_init_vectors[] = {
1064 {
1065 .src = MSM_BUS_MASTER_VFE,
1066 .dst = MSM_BUS_SLAVE_EBI_CH0,
1067 .ab = 0,
1068 .ib = 0,
1069 },
1070 {
1071 .src = MSM_BUS_MASTER_VPE,
1072 .dst = MSM_BUS_SLAVE_EBI_CH0,
1073 .ab = 0,
1074 .ib = 0,
1075 },
1076 {
1077 .src = MSM_BUS_MASTER_JPEG_ENC,
1078 .dst = MSM_BUS_SLAVE_EBI_CH0,
1079 .ab = 0,
1080 .ib = 0,
1081 },
1082};
1083
1084static struct msm_bus_vectors cam_preview_vectors[] = {
1085 {
1086 .src = MSM_BUS_MASTER_VFE,
1087 .dst = MSM_BUS_SLAVE_EBI_CH0,
1088 .ab = 27648000,
1089 .ib = 110592000,
1090 },
1091 {
1092 .src = MSM_BUS_MASTER_VPE,
1093 .dst = MSM_BUS_SLAVE_EBI_CH0,
1094 .ab = 0,
1095 .ib = 0,
1096 },
1097 {
1098 .src = MSM_BUS_MASTER_JPEG_ENC,
1099 .dst = MSM_BUS_SLAVE_EBI_CH0,
1100 .ab = 0,
1101 .ib = 0,
1102 },
1103};
1104
1105static struct msm_bus_vectors cam_video_vectors[] = {
1106 {
1107 .src = MSM_BUS_MASTER_VFE,
1108 .dst = MSM_BUS_SLAVE_EBI_CH0,
1109 .ab = 140451840,
1110 .ib = 561807360,
1111 },
1112 {
1113 .src = MSM_BUS_MASTER_VPE,
1114 .dst = MSM_BUS_SLAVE_EBI_CH0,
1115 .ab = 206807040,
1116 .ib = 488816640,
1117 },
1118 {
1119 .src = MSM_BUS_MASTER_JPEG_ENC,
1120 .dst = MSM_BUS_SLAVE_EBI_CH0,
1121 .ab = 0,
1122 .ib = 0,
1123 },
1124};
1125
1126static struct msm_bus_vectors cam_snapshot_vectors[] = {
1127 {
1128 .src = MSM_BUS_MASTER_VFE,
1129 .dst = MSM_BUS_SLAVE_EBI_CH0,
1130 .ab = 274423680,
1131 .ib = 1097694720,
1132 },
1133 {
1134 .src = MSM_BUS_MASTER_VPE,
1135 .dst = MSM_BUS_SLAVE_EBI_CH0,
1136 .ab = 0,
1137 .ib = 0,
1138 },
1139 {
1140 .src = MSM_BUS_MASTER_JPEG_ENC,
1141 .dst = MSM_BUS_SLAVE_EBI_CH0,
1142 .ab = 540000000,
1143 .ib = 1350000000,
1144 },
1145};
1146
1147static struct msm_bus_vectors cam_zsl_vectors[] = {
1148 {
1149 .src = MSM_BUS_MASTER_VFE,
1150 .dst = MSM_BUS_SLAVE_EBI_CH0,
1151 .ab = 302071680,
1152 .ib = 1208286720,
1153 },
1154 {
1155 .src = MSM_BUS_MASTER_VPE,
1156 .dst = MSM_BUS_SLAVE_EBI_CH0,
1157 .ab = 0,
1158 .ib = 0,
1159 },
1160 {
1161 .src = MSM_BUS_MASTER_JPEG_ENC,
1162 .dst = MSM_BUS_SLAVE_EBI_CH0,
1163 .ab = 540000000,
1164 .ib = 1350000000,
1165 },
1166};
1167
1168static struct msm_bus_paths cam_bus_client_config[] = {
1169 {
1170 ARRAY_SIZE(cam_init_vectors),
1171 cam_init_vectors,
1172 },
1173 {
1174 ARRAY_SIZE(cam_preview_vectors),
1175 cam_preview_vectors,
1176 },
1177 {
1178 ARRAY_SIZE(cam_video_vectors),
1179 cam_video_vectors,
1180 },
1181 {
1182 ARRAY_SIZE(cam_snapshot_vectors),
1183 cam_snapshot_vectors,
1184 },
1185 {
1186 ARRAY_SIZE(cam_zsl_vectors),
1187 cam_zsl_vectors,
1188 },
1189};
1190
1191static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1192 cam_bus_client_config,
1193 ARRAY_SIZE(cam_bus_client_config),
1194 .name = "msm_camera",
1195};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001196
Nishant Pandit24153d82011-08-27 16:05:13 +05301197struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1198 {
1199 .ioclk.mclk_clk_rate = 24000000,
1200 .ioclk.vfe_clk_rate = 228570000,
1201 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001202 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301203 },
1204 {
1205 .ioclk.mclk_clk_rate = 24000000,
1206 .ioclk.vfe_clk_rate = 228570000,
1207 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001208 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301209 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001210};
1211
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001212#ifdef CONFIG_IMX074_ACT
1213static struct i2c_board_info imx074_actuator_i2c_info = {
1214 I2C_BOARD_INFO("imx074_act", 0x11),
1215};
1216
1217static struct msm_actuator_info imx074_actuator_info = {
1218 .board_info = &imx074_actuator_i2c_info,
1219 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1220 .vcm_pwd = 0,
1221 .vcm_enable = 1,
1222};
1223#endif
1224
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001225#ifdef CONFIG_IMX074
1226static struct msm_camera_sensor_flash_data flash_imx074 = {
1227 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301228#ifdef CONFIG_MSM_CAMERA_FLASH
1229 .flash_src = &msm_flash_src
1230#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001231};
1232
Nishant Pandit24153d82011-08-27 16:05:13 +05301233static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1234 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001235 .sensor_reset = 107,
1236 .sensor_pwd = 85,
1237 .vcm_pwd = 0,
1238 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301239};
1240
1241static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1242 .sensor_name = "imx074",
1243 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001244 .flash_data = &flash_imx074,
1245 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301246 .sensor_platform_info = &sensor_board_info_imx074,
1247 .gpio_conf = &gpio_conf,
1248 .csi_if = 1,
1249 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001250#ifdef CONFIG_IMX074_ACT
1251 .actuator_info = &imx074_actuator_info
1252#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001253};
1254
1255struct platform_device msm8960_camera_sensor_imx074 = {
1256 .name = "msm_camera_imx074",
1257 .dev = {
1258 .platform_data = &msm_camera_sensor_imx074_data,
1259 },
1260};
1261#endif
1262#ifdef CONFIG_OV2720
1263static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001264 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001265};
1266
Nishant Pandit24153d82011-08-27 16:05:13 +05301267static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1268 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001269 .sensor_reset = 76,
1270 .sensor_pwd = 85,
1271 .vcm_pwd = 0,
1272 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301273};
1274
1275static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1276 .sensor_name = "ov2720",
1277 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001278 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301279 .sensor_platform_info = &sensor_board_info_ov2720,
1280 .gpio_conf = &gpio_conf,
1281 .csi_if = 1,
1282 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001283};
1284
1285struct platform_device msm8960_camera_sensor_ov2720 = {
1286 .name = "msm_camera_ov2720",
1287 .dev = {
1288 .platform_data = &msm_camera_sensor_ov2720_data,
1289 },
1290};
1291#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001292
1293static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1294 .flash_type = MSM_CAMERA_FLASH_LED,
1295};
1296
Nishant Pandit24153d82011-08-27 16:05:13 +05301297static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1298 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001299 .sensor_reset = 107,
1300 .sensor_pwd = 85,
1301 .vcm_pwd = 0,
1302 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301303};
1304
1305static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1306 .sensor_name = "qs_mt9p017",
1307 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001308 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301309 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1310 .gpio_conf = &gpio_conf,
1311 .csi_if = 1,
1312 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001313};
1314
1315struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1316 .name = "msm_camera_qs_mt9p017",
1317 .dev = {
1318 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1319 },
1320};
1321
Kevin Chan8b0d2322011-09-10 21:06:31 -07001322static struct msm8960_privacy_light_cfg privacy_light_info = {
1323 .mpp = PM8921_MPP_PM_TO_SYS(12),
1324};
1325
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326static void __init msm8960_init_cam(void)
1327{
1328 int i;
1329 struct platform_device *cam_dev[] = {
1330 &msm8960_camera_sensor_imx074,
1331 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001332 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001333 };
1334
Kevin Chan8b0d2322011-09-10 21:06:31 -07001335 if (machine_is_msm8960_liquid()) {
1336 struct msm_camera_sensor_info *s_info;
1337 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1338 s_info->sensor_platform_info->mount_angle = 180;
1339 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1340 s_info->sensor_platform_info->privacy_light = 1;
1341 s_info->sensor_platform_info->privacy_light_info =
1342 &privacy_light_info;
1343 }
1344
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001345 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1346 struct msm_camera_sensor_info *s_info;
1347 s_info = cam_dev[i]->dev.platform_data;
1348 msm_get_cam_resources(s_info);
1349 platform_device_register(cam_dev[i]);
1350 }
1351}
1352#endif
1353
1354#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001355#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001356#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001357#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001358#endif
1359
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360
1361#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001362#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001363#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001364#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1365#else
1366#define MSM_FB_EXT_BUF_SIZE 0
1367#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001368
kuogee hsieh3830eb92011-09-12 15:25:57 -07001369#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1370/* width x height x 3 bpp x 2 frame buffer */
1371#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1372#define MSM_FB_WRITEBACK_OFFSET \
1373 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1374#else
1375#define MSM_FB_WRITEBACK_SIZE 0
1376#define MSM_FB_WRITEBACK_OFFSET 0
1377#endif
1378
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001379#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1380/* 4 bpp x 2 page HDMI case */
1381#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1382#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001383/* Note: must be multiple of 4096 */
1384#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1385 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001386#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001387
1388static int writeback_offset(void)
1389{
1390 return MSM_FB_WRITEBACK_OFFSET;
1391}
1392
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001393
1394#define MDP_VSYNC_GPIO 0
1395
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001396#define PANEL_NAME_MAX_LEN 30
1397#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1398#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1399#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1400#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1401#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1402#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1403#define HDMI_PANEL_NAME "hdmi_msm"
1404#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001405
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001406static struct resource msm_fb_resources[] = {
1407 {
1408 .flags = IORESOURCE_DMA,
1409 }
1410};
1411
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001412static int msm_fb_detect_panel(const char *name)
1413{
1414 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001415 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1416 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1417 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001418 return 0;
1419 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001420 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1421 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1422 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001423 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001424
1425#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1426 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1427 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1428 PANEL_NAME_MAX_LEN)))
1429 return 0;
1430
1431 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1432 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1433 PANEL_NAME_MAX_LEN)))
1434 return 0;
1435
1436 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1437 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1438 PANEL_NAME_MAX_LEN)))
1439 return 0;
1440
1441 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1442 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1443 PANEL_NAME_MAX_LEN)))
1444 return 0;
1445#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001446 }
1447
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001448 if (!strncmp(name, HDMI_PANEL_NAME,
1449 strnlen(HDMI_PANEL_NAME,
1450 PANEL_NAME_MAX_LEN)))
1451 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001452
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001453 if (!strncmp(name, TVOUT_PANEL_NAME,
1454 strnlen(TVOUT_PANEL_NAME,
1455 PANEL_NAME_MAX_LEN)))
1456 return 0;
1457
1458 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001459 return -ENODEV;
1460}
1461
1462static struct msm_fb_platform_data msm_fb_pdata = {
1463 .detect_client = msm_fb_detect_panel,
1464};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001465
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001466static struct platform_device msm_fb_device = {
1467 .name = "msm_fb",
1468 .id = 0,
1469 .num_resources = ARRAY_SIZE(msm_fb_resources),
1470 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001471 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001472};
1473
1474static bool dsi_power_on;
1475
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001476/**
1477 * LiQUID panel on/off
1478 *
1479 * @param on
1480 *
1481 * @return int
1482 */
1483static int mipi_dsi_liquid_panel_power(int on)
1484{
1485 static struct regulator *reg_l2, *reg_ext_3p3v;
1486 static int gpio21, gpio24, gpio43;
1487 int rc;
1488
1489 pr_info("%s: on=%d\n", __func__, on);
1490
1491 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1492 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1493 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1494
1495 if (!dsi_power_on) {
1496
1497 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1498 "dsi_vdda");
1499 if (IS_ERR(reg_l2)) {
1500 pr_err("could not get 8921_l2, rc = %ld\n",
1501 PTR_ERR(reg_l2));
1502 return -ENODEV;
1503 }
1504
1505 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1506 if (rc) {
1507 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1508 return -EINVAL;
1509 }
1510
1511 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1512 "vdd_lvds_3p3v");
1513 if (IS_ERR(reg_ext_3p3v)) {
1514 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1515 PTR_ERR(reg_ext_3p3v));
1516 return -ENODEV;
1517 }
1518
1519 rc = gpio_request(gpio21, "disp_pwr_en_n");
1520 if (rc) {
1521 pr_err("request gpio 21 failed, rc=%d\n", rc);
1522 return -ENODEV;
1523 }
1524
1525 rc = gpio_request(gpio43, "disp_rst_n");
1526 if (rc) {
1527 pr_err("request gpio 43 failed, rc=%d\n", rc);
1528 return -ENODEV;
1529 }
1530
1531 rc = gpio_request(gpio24, "disp_backlight_pwm");
1532 if (rc) {
1533 pr_err("request gpio 24 failed, rc=%d\n", rc);
1534 return -ENODEV;
1535 }
1536
1537 dsi_power_on = true;
1538 }
1539
1540 if (on) {
1541 rc = regulator_set_optimum_mode(reg_l2, 100000);
1542 if (rc < 0) {
1543 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1544 return -EINVAL;
1545 }
1546 rc = regulator_enable(reg_l2);
1547 if (rc) {
1548 pr_err("enable l2 failed, rc=%d\n", rc);
1549 return -ENODEV;
1550 }
1551
1552 rc = regulator_enable(reg_ext_3p3v);
1553 if (rc) {
1554 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1555 return -ENODEV;
1556 }
1557
1558 /* set reset pin before power enable */
1559 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1560
1561 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1562 msleep(20);
1563 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1564 msleep(20);
1565 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1566 msleep(20);
1567 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1568 msleep(20);
1569 } else {
1570 gpio_set_value_cansleep(gpio43, 0);
1571 gpio_set_value_cansleep(gpio21, 1);
1572
1573 rc = regulator_disable(reg_l2);
1574 if (rc) {
1575 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1576 return -ENODEV;
1577 }
1578 rc = regulator_disable(reg_ext_3p3v);
1579 if (rc) {
1580 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1581 return -ENODEV;
1582 }
1583 rc = regulator_set_optimum_mode(reg_l2, 100);
1584 if (rc < 0) {
1585 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1586 return -EINVAL;
1587 }
1588 }
1589
1590 return 0;
1591}
1592
1593static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001594{
1595 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001596 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001597 int rc;
1598
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001599 pr_info("%s: state : %d\n", __func__, on);
1600
1601 if (!dsi_power_on) {
1602
1603 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1604 "dsi_vdc");
1605 if (IS_ERR(reg_l8)) {
1606 pr_err("could not get 8921_l8, rc = %ld\n",
1607 PTR_ERR(reg_l8));
1608 return -ENODEV;
1609 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001610 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1611 "dsi_vddio");
1612 if (IS_ERR(reg_l23)) {
1613 pr_err("could not get 8921_l23, rc = %ld\n",
1614 PTR_ERR(reg_l23));
1615 return -ENODEV;
1616 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001617 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1618 "dsi_vdda");
1619 if (IS_ERR(reg_l2)) {
1620 pr_err("could not get 8921_l2, rc = %ld\n",
1621 PTR_ERR(reg_l2));
1622 return -ENODEV;
1623 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001624 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1625 if (rc) {
1626 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1627 return -EINVAL;
1628 }
1629 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1630 if (rc) {
1631 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1632 return -EINVAL;
1633 }
1634 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1635 if (rc) {
1636 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1637 return -EINVAL;
1638 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001639 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1640 rc = gpio_request(gpio43, "disp_rst_n");
1641 if (rc) {
1642 pr_err("request gpio 43 failed, rc=%d\n", rc);
1643 return -ENODEV;
1644 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001645 dsi_power_on = true;
1646 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001647 if (on) {
1648 rc = regulator_set_optimum_mode(reg_l8, 100000);
1649 if (rc < 0) {
1650 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1651 return -EINVAL;
1652 }
1653 rc = regulator_set_optimum_mode(reg_l23, 100000);
1654 if (rc < 0) {
1655 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1656 return -EINVAL;
1657 }
1658 rc = regulator_set_optimum_mode(reg_l2, 100000);
1659 if (rc < 0) {
1660 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1661 return -EINVAL;
1662 }
1663 rc = regulator_enable(reg_l8);
1664 if (rc) {
1665 pr_err("enable l8 failed, rc=%d\n", rc);
1666 return -ENODEV;
1667 }
1668 rc = regulator_enable(reg_l23);
1669 if (rc) {
1670 pr_err("enable l8 failed, rc=%d\n", rc);
1671 return -ENODEV;
1672 }
1673 rc = regulator_enable(reg_l2);
1674 if (rc) {
1675 pr_err("enable l2 failed, rc=%d\n", rc);
1676 return -ENODEV;
1677 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001678 gpio_set_value_cansleep(gpio43, 1);
1679 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001680 rc = regulator_disable(reg_l2);
1681 if (rc) {
1682 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1683 return -ENODEV;
1684 }
1685 rc = regulator_disable(reg_l8);
1686 if (rc) {
1687 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1688 return -ENODEV;
1689 }
1690 rc = regulator_disable(reg_l23);
1691 if (rc) {
1692 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1693 return -ENODEV;
1694 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001695 rc = regulator_set_optimum_mode(reg_l8, 100);
1696 if (rc < 0) {
1697 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1698 return -EINVAL;
1699 }
1700 rc = regulator_set_optimum_mode(reg_l23, 100);
1701 if (rc < 0) {
1702 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1703 return -EINVAL;
1704 }
1705 rc = regulator_set_optimum_mode(reg_l2, 100);
1706 if (rc < 0) {
1707 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1708 return -EINVAL;
1709 }
1710 gpio_set_value_cansleep(gpio43, 0);
1711 }
1712 return 0;
1713}
1714
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001715static int mipi_dsi_panel_power(int on)
1716{
1717 int ret;
1718
1719 pr_info("%s: on=%d\n", __func__, on);
1720
1721 if (machine_is_msm8960_liquid())
1722 ret = mipi_dsi_liquid_panel_power(on);
1723 else
1724 ret = mipi_dsi_cdp_panel_power(on);
1725
1726 return ret;
1727}
1728
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001729static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1730 .vsync_gpio = MDP_VSYNC_GPIO,
1731 .dsi_power_save = mipi_dsi_panel_power,
1732};
1733
1734#ifdef CONFIG_MSM_BUS_SCALING
1735
1736static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001737 {
1738 .src = MSM_BUS_MASTER_MDP_PORT0,
1739 .dst = MSM_BUS_SLAVE_EBI_CH0,
1740 .ab = 0,
1741 .ib = 0,
1742 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001743};
1744
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001745#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1746static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1747 /* If HDMI is used as primary */
1748 {
1749 .src = MSM_BUS_MASTER_MDP_PORT0,
1750 .dst = MSM_BUS_SLAVE_EBI_CH0,
1751 .ab = 2000000000,
1752 .ib = 2000000000,
1753 },
1754};
1755static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1756 {
1757 ARRAY_SIZE(mdp_init_vectors),
1758 mdp_init_vectors,
1759 },
1760 {
1761 ARRAY_SIZE(hdmi_as_primary_vectors),
1762 hdmi_as_primary_vectors,
1763 },
1764 {
1765 ARRAY_SIZE(hdmi_as_primary_vectors),
1766 hdmi_as_primary_vectors,
1767 },
1768 {
1769 ARRAY_SIZE(hdmi_as_primary_vectors),
1770 hdmi_as_primary_vectors,
1771 },
1772 {
1773 ARRAY_SIZE(hdmi_as_primary_vectors),
1774 hdmi_as_primary_vectors,
1775 },
1776 {
1777 ARRAY_SIZE(hdmi_as_primary_vectors),
1778 hdmi_as_primary_vectors,
1779 },
1780};
1781#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001782static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001783 {
1784 .src = MSM_BUS_MASTER_MDP_PORT0,
1785 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001786 .ab = 216000000 * 2,
1787 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001788 },
1789};
1790
1791static struct msm_bus_vectors mdp_vga_vectors[] = {
1792 /* VGA and less video */
1793 {
1794 .src = MSM_BUS_MASTER_MDP_PORT0,
1795 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001796 .ab = 216000000 * 2,
1797 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001798 },
1799};
1800
1801static struct msm_bus_vectors mdp_720p_vectors[] = {
1802 /* 720p and less video */
1803 {
1804 .src = MSM_BUS_MASTER_MDP_PORT0,
1805 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001806 .ab = 230400000 * 2,
1807 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001808 },
1809};
1810
1811static struct msm_bus_vectors mdp_1080p_vectors[] = {
1812 /* 1080p and less video */
1813 {
1814 .src = MSM_BUS_MASTER_MDP_PORT0,
1815 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001816 .ab = 334080000 * 2,
1817 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001818 },
1819};
1820
1821static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1822 {
1823 ARRAY_SIZE(mdp_init_vectors),
1824 mdp_init_vectors,
1825 },
1826 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001827 ARRAY_SIZE(mdp_ui_vectors),
1828 mdp_ui_vectors,
1829 },
1830 {
1831 ARRAY_SIZE(mdp_ui_vectors),
1832 mdp_ui_vectors,
1833 },
1834 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001835 ARRAY_SIZE(mdp_vga_vectors),
1836 mdp_vga_vectors,
1837 },
1838 {
1839 ARRAY_SIZE(mdp_720p_vectors),
1840 mdp_720p_vectors,
1841 },
1842 {
1843 ARRAY_SIZE(mdp_1080p_vectors),
1844 mdp_1080p_vectors,
1845 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001846};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001847#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001848
1849static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1850 mdp_bus_scale_usecases,
1851 ARRAY_SIZE(mdp_bus_scale_usecases),
1852 .name = "mdp",
1853};
1854
1855#endif
1856
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001857#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1858int mdp_core_clk_rate_table[] = {
1859 200000000,
1860 200000000,
1861 200000000,
1862 200000000,
1863};
1864#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001865int mdp_core_clk_rate_table[] = {
1866 85330000,
1867 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001868 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001869 200000000,
1870};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001871#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001872
1873static struct msm_panel_common_pdata mdp_pdata = {
1874 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001875#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1876 .mdp_core_clk_rate = 200000000,
1877#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001878 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001879#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001880 .mdp_core_clk_table = mdp_core_clk_rate_table,
1881 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1882#ifdef CONFIG_MSM_BUS_SCALING
1883 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1884#endif
1885 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001886 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001887};
1888
1889static struct platform_device mipi_dsi_renesas_panel_device = {
1890 .name = "mipi_renesas",
1891 .id = 0,
1892};
1893
1894static struct platform_device mipi_dsi_simulator_panel_device = {
1895 .name = "mipi_simulator",
1896 .id = 0,
1897};
1898
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001899#define LPM_CHANNEL0 0
1900static int toshiba_gpio[] = {LPM_CHANNEL0};
1901
1902static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1903 .gpio = toshiba_gpio,
1904};
1905
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001906static struct platform_device mipi_dsi_toshiba_panel_device = {
1907 .name = "mipi_toshiba",
1908 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001909 .dev = {
1910 .platform_data = &toshiba_pdata,
1911 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001912};
1913
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001914static int dsi2lvds_gpio[2] = {
1915 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1916 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1917 };
1918
1919static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1920 .gpio_num = dsi2lvds_gpio,
1921};
1922
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001923static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1924
1925/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1926 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1927 /* timing */
1928 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1929 0x0c, 0x03, 0x04, 0xa0},
1930 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1931 {0xff, 0x00, 0x06, 0x00}, /* strength */
1932 /* pll control */
1933 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1934 0x40, 0x07, 0x03,
1935 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1936};
1937
1938static struct mipi_dsi_panel_platform_data novatek_pdata = {
1939 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1940};
1941
1942static struct platform_device mipi_dsi_novatek_panel_device = {
1943 .name = "mipi_novatek",
1944 .id = 0,
1945 .dev = {
1946 .platform_data = &novatek_pdata,
1947 }
1948};
1949
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001950static struct platform_device mipi_dsi2lvds_bridge_device = {
1951 .name = "mipi_tc358764",
1952 .id = 0,
1953 .dev.platform_data = &mipi_dsi2lvds_pdata,
1954};
1955
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001956#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1957static struct resource hdmi_msm_resources[] = {
1958 {
1959 .name = "hdmi_msm_qfprom_addr",
1960 .start = 0x00700000,
1961 .end = 0x007060FF,
1962 .flags = IORESOURCE_MEM,
1963 },
1964 {
1965 .name = "hdmi_msm_hdmi_addr",
1966 .start = 0x04A00000,
1967 .end = 0x04A00FFF,
1968 .flags = IORESOURCE_MEM,
1969 },
1970 {
1971 .name = "hdmi_msm_irq",
1972 .start = HDMI_IRQ,
1973 .end = HDMI_IRQ,
1974 .flags = IORESOURCE_IRQ,
1975 },
1976};
1977
1978static int hdmi_enable_5v(int on);
1979static int hdmi_core_power(int on, int show);
1980static int hdmi_cec_power(int on);
1981
1982static struct msm_hdmi_platform_data hdmi_msm_data = {
1983 .irq = HDMI_IRQ,
1984 .enable_5v = hdmi_enable_5v,
1985 .core_power = hdmi_core_power,
1986 .cec_power = hdmi_cec_power,
1987};
1988
1989static struct platform_device hdmi_msm_device = {
1990 .name = "hdmi_msm",
1991 .id = 0,
1992 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1993 .resource = hdmi_msm_resources,
1994 .dev.platform_data = &hdmi_msm_data,
1995};
1996#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1997
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001998#ifdef CONFIG_MSM_BUS_SCALING
1999static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2000 {
2001 .src = MSM_BUS_MASTER_MDP_PORT0,
2002 .dst = MSM_BUS_SLAVE_EBI_CH0,
2003 .ab = 0,
2004 .ib = 0,
2005 },
2006};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002007
2008#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2009static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2010 {
2011 .src = MSM_BUS_MASTER_MDP_PORT0,
2012 .dst = MSM_BUS_SLAVE_EBI_CH0,
2013 .ab = 2000000000,
2014 .ib = 2000000000,
2015 },
2016};
2017#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002018static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2019 {
2020 .src = MSM_BUS_MASTER_MDP_PORT0,
2021 .dst = MSM_BUS_SLAVE_EBI_CH0,
2022 .ab = 566092800 * 2,
2023 .ib = 707616000 * 2,
2024 },
2025};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002026#endif
2027
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002028static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2029 {
2030 ARRAY_SIZE(dtv_bus_init_vectors),
2031 dtv_bus_init_vectors,
2032 },
2033 {
2034 ARRAY_SIZE(dtv_bus_def_vectors),
2035 dtv_bus_def_vectors,
2036 },
2037};
2038static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2039 dtv_bus_scale_usecases,
2040 ARRAY_SIZE(dtv_bus_scale_usecases),
2041 .name = "dtv",
2042};
2043
2044static struct lcdc_platform_data dtv_pdata = {
2045 .bus_scale_table = &dtv_bus_scale_pdata,
2046};
2047#endif
2048
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002049static void __init msm_fb_add_devices(void)
2050{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002051 struct platform_device *ptr = NULL;
2052
2053 if (machine_is_msm8960_liquid())
2054 ptr = &mipi_dsi2lvds_bridge_device;
2055 else
2056 ptr = &mipi_dsi_toshiba_panel_device;
2057 platform_add_devices(&ptr, 1);
2058
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002059 if (machine_is_msm8x60_rumi3()) {
2060 msm_fb_register_device("mdp", NULL);
2061 mipi_dsi_pdata.target_type = 1;
2062 } else
2063 msm_fb_register_device("mdp", &mdp_pdata);
2064 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002065#ifdef CONFIG_MSM_BUS_SCALING
2066 msm_fb_register_device("dtv", &dtv_pdata);
2067#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002068}
2069
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002070static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2071 .func = GPIOMUX_FUNC_GPIO,
2072 .drv = GPIOMUX_DRV_2MA,
2073 .pull = GPIOMUX_PULL_DOWN,
2074};
2075
2076static struct gpiomux_setting mdp_vsync_active_cfg = {
2077 .func = GPIOMUX_FUNC_1,
2078 .drv = GPIOMUX_DRV_2MA,
2079 .pull = GPIOMUX_PULL_DOWN,
2080};
2081
2082static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2083 {
2084 .gpio = MDP_VSYNC_GPIO,
2085 .settings = {
2086 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2087 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2088 },
2089 }
2090};
2091
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002092#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2093static struct gpiomux_setting hdmi_suspend_cfg = {
2094 .func = GPIOMUX_FUNC_GPIO,
2095 .drv = GPIOMUX_DRV_2MA,
2096 .pull = GPIOMUX_PULL_DOWN,
2097};
2098
2099static struct gpiomux_setting hdmi_active_1_cfg = {
2100 .func = GPIOMUX_FUNC_1,
2101 .drv = GPIOMUX_DRV_2MA,
2102 .pull = GPIOMUX_PULL_UP,
2103};
2104
2105static struct gpiomux_setting hdmi_active_2_cfg = {
2106 .func = GPIOMUX_FUNC_1,
2107 .drv = GPIOMUX_DRV_2MA,
2108 .pull = GPIOMUX_PULL_DOWN,
2109};
2110
2111static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2112 {
2113 .gpio = 99,
2114 .settings = {
2115 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2116 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2117 },
2118 },
2119 {
2120 .gpio = 100,
2121 .settings = {
2122 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2123 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2124 },
2125 },
2126 {
2127 .gpio = 101,
2128 .settings = {
2129 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2130 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2131 },
2132 },
2133 {
2134 .gpio = 102,
2135 .settings = {
2136 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2137 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2138 },
2139 },
2140};
2141
2142static int hdmi_enable_5v(int on)
2143{
2144 /* TBD: PM8921 regulator instead of 8901 */
2145 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2146 static int prev_on;
2147 int rc;
2148
2149 if (on == prev_on)
2150 return 0;
2151
2152 if (!reg_8921_hdmi_mvs)
2153 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2154 "hdmi_mvs");
2155
2156 if (on) {
2157 rc = regulator_enable(reg_8921_hdmi_mvs);
2158 if (rc) {
2159 pr_err("'%s' regulator enable failed, rc=%d\n",
2160 "8921_hdmi_mvs", rc);
2161 return rc;
2162 }
2163 pr_debug("%s(on): success\n", __func__);
2164 } else {
2165 rc = regulator_disable(reg_8921_hdmi_mvs);
2166 if (rc)
2167 pr_warning("'%s' regulator disable failed, rc=%d\n",
2168 "8921_hdmi_mvs", rc);
2169 pr_debug("%s(off): success\n", __func__);
2170 }
2171
2172 prev_on = on;
2173
2174 return 0;
2175}
2176
2177static int hdmi_core_power(int on, int show)
2178{
2179 static struct regulator *reg_8921_l23, *reg_8921_s4;
2180 static int prev_on;
2181 int rc;
2182
2183 if (on == prev_on)
2184 return 0;
2185
2186 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002187 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002188 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002189 if (IS_ERR(reg_8921_l23)) {
2190 pr_err("could not get reg_8921_l23, rc = %ld\n",
2191 PTR_ERR(reg_8921_l23));
2192 return -ENODEV;
2193 }
2194 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2195 if (rc) {
2196 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2197 return -EINVAL;
2198 }
2199 }
2200 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002201 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002202 if (IS_ERR(reg_8921_s4)) {
2203 pr_err("could not get reg_8921_s4, rc = %ld\n",
2204 PTR_ERR(reg_8921_s4));
2205 return -ENODEV;
2206 }
2207 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2208 if (rc) {
2209 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2210 return -EINVAL;
2211 }
2212 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002213
2214 if (on) {
2215 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2216 if (rc < 0) {
2217 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2218 return -EINVAL;
2219 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002220 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002221 if (rc) {
2222 pr_err("'%s' regulator enable failed, rc=%d\n",
2223 "hdmi_avdd", rc);
2224 return rc;
2225 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002226 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002227 if (rc) {
2228 pr_err("'%s' regulator enable failed, rc=%d\n",
2229 "hdmi_vcc", rc);
2230 return rc;
2231 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002232 rc = gpio_request(100, "HDMI_DDC_CLK");
2233 if (rc) {
2234 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2235 "HDMI_DDC_CLK", 100, rc);
2236 goto error1;
2237 }
2238 rc = gpio_request(101, "HDMI_DDC_DATA");
2239 if (rc) {
2240 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2241 "HDMI_DDC_DATA", 101, rc);
2242 goto error2;
2243 }
2244 rc = gpio_request(102, "HDMI_HPD");
2245 if (rc) {
2246 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2247 "HDMI_HPD", 102, rc);
2248 goto error3;
2249 }
2250 pr_debug("%s(on): success\n", __func__);
2251 } else {
2252 gpio_free(100);
2253 gpio_free(101);
2254 gpio_free(102);
2255
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002256 rc = regulator_disable(reg_8921_l23);
2257 if (rc) {
2258 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2259 return -ENODEV;
2260 }
2261 rc = regulator_disable(reg_8921_s4);
2262 if (rc) {
2263 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2264 return -ENODEV;
2265 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002266 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2267 if (rc < 0) {
2268 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2269 return -EINVAL;
2270 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002271 pr_debug("%s(off): success\n", __func__);
2272 }
2273
2274 prev_on = on;
2275
2276 return 0;
2277
2278error3:
2279 gpio_free(101);
2280error2:
2281 gpio_free(100);
2282error1:
2283 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002284 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002285 return rc;
2286}
2287
2288static int hdmi_cec_power(int on)
2289{
2290 static int prev_on;
2291 int rc;
2292
2293 if (on == prev_on)
2294 return 0;
2295
2296 if (on) {
2297 rc = gpio_request(99, "HDMI_CEC_VAR");
2298 if (rc) {
2299 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2300 "HDMI_CEC_VAR", 99, rc);
2301 goto error;
2302 }
2303 pr_debug("%s(on): success\n", __func__);
2304 } else {
2305 gpio_free(99);
2306 pr_debug("%s(off): success\n", __func__);
2307 }
2308
2309 prev_on = on;
2310
2311 return 0;
2312error:
2313 return rc;
2314}
2315#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2316
2317static void __init msm8960_allocate_memory_regions(void)
2318{
2319 void *addr;
2320 unsigned long size;
2321
2322 size = MSM_FB_SIZE;
2323 addr = alloc_bootmem_align(size, 0x1000);
2324 msm_fb_resources[0].start = __pa(addr);
2325 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2326 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2327 size, addr, __pa(addr));
2328
2329}
2330#ifdef CONFIG_WCD9310_CODEC
2331
2332#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2333
Patrick Lai3043fba2011-08-01 14:15:57 -07002334/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2335 * 4 micbiases are used to power various analog and digital
2336 * microphones operating at 1800 mV. Technically, all micbiases
2337 * can source from single cfilter since all microphones operate
2338 * at the same voltage level. The arrangement below is to make
2339 * sure all cfilters are exercised. LDO_H regulator ouput level
2340 * does not need to be as high as 2.85V. It is choosen for
2341 * microphone sensitivity purpose.
2342 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002343static struct tabla_pdata tabla_platform_data = {
2344 .slimbus_slave_device = {
2345 .name = "tabla-slave",
2346 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2347 },
2348 .irq = MSM_GPIO_TO_INT(62),
2349 .irq_base = TABLA_INTERRUPT_BASE,
2350 .num_irqs = NR_TABLA_IRQS,
2351 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002352 .micbias = {
2353 .ldoh_v = TABLA_LDOH_2P85_V,
2354 .cfilt1_mv = 1800,
2355 .cfilt2_mv = 1800,
2356 .cfilt3_mv = 1800,
2357 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2358 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2359 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2360 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2361 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002362};
2363
2364static struct slim_device msm_slim_tabla = {
2365 .name = "tabla-slim",
2366 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2367 .dev = {
2368 .platform_data = &tabla_platform_data,
2369 },
2370};
2371#endif
2372
2373static struct slim_boardinfo msm_slim_devices[] = {
2374#ifdef CONFIG_WCD9310_CODEC
2375 {
2376 .bus_num = 1,
2377 .slim_slave = &msm_slim_tabla,
2378 },
2379#endif
2380 /* add more slimbus slaves as needed */
2381};
2382
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002383#define MSM_WCNSS_PHYS 0x03000000
2384#define MSM_WCNSS_SIZE 0x280000
2385
2386static struct resource resources_wcnss_wlan[] = {
2387 {
2388 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2389 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2390 .name = "wcnss_wlanrx_irq",
2391 .flags = IORESOURCE_IRQ,
2392 },
2393 {
2394 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2395 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2396 .name = "wcnss_wlantx_irq",
2397 .flags = IORESOURCE_IRQ,
2398 },
2399 {
2400 .start = MSM_WCNSS_PHYS,
2401 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2402 .name = "wcnss_mmio",
2403 .flags = IORESOURCE_MEM,
2404 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002405 {
2406 .start = 84,
2407 .end = 88,
2408 .name = "wcnss_gpios_5wire",
2409 .flags = IORESOURCE_IO,
2410 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002411};
2412
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002413static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2414 .has_48mhz_xo = 1,
2415};
2416
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002417static struct platform_device msm_device_wcnss_wlan = {
2418 .name = "wcnss_wlan",
2419 .id = 0,
2420 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2421 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002422 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002423};
2424
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002425#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2426 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2427 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2428 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2429
2430#define QCE_SIZE 0x10000
2431#define QCE_0_BASE 0x18500000
2432
2433#define QCE_HW_KEY_SUPPORT 0
2434#define QCE_SHA_HMAC_SUPPORT 1
2435#define QCE_SHARE_CE_RESOURCE 1
2436#define QCE_CE_SHARED 0
2437
2438static struct resource qcrypto_resources[] = {
2439 [0] = {
2440 .start = QCE_0_BASE,
2441 .end = QCE_0_BASE + QCE_SIZE - 1,
2442 .flags = IORESOURCE_MEM,
2443 },
2444 [1] = {
2445 .name = "crypto_channels",
2446 .start = DMOV_CE_IN_CHAN,
2447 .end = DMOV_CE_OUT_CHAN,
2448 .flags = IORESOURCE_DMA,
2449 },
2450 [2] = {
2451 .name = "crypto_crci_in",
2452 .start = DMOV_CE_IN_CRCI,
2453 .end = DMOV_CE_IN_CRCI,
2454 .flags = IORESOURCE_DMA,
2455 },
2456 [3] = {
2457 .name = "crypto_crci_out",
2458 .start = DMOV_CE_OUT_CRCI,
2459 .end = DMOV_CE_OUT_CRCI,
2460 .flags = IORESOURCE_DMA,
2461 },
2462};
2463
2464static struct resource qcedev_resources[] = {
2465 [0] = {
2466 .start = QCE_0_BASE,
2467 .end = QCE_0_BASE + QCE_SIZE - 1,
2468 .flags = IORESOURCE_MEM,
2469 },
2470 [1] = {
2471 .name = "crypto_channels",
2472 .start = DMOV_CE_IN_CHAN,
2473 .end = DMOV_CE_OUT_CHAN,
2474 .flags = IORESOURCE_DMA,
2475 },
2476 [2] = {
2477 .name = "crypto_crci_in",
2478 .start = DMOV_CE_IN_CRCI,
2479 .end = DMOV_CE_IN_CRCI,
2480 .flags = IORESOURCE_DMA,
2481 },
2482 [3] = {
2483 .name = "crypto_crci_out",
2484 .start = DMOV_CE_OUT_CRCI,
2485 .end = DMOV_CE_OUT_CRCI,
2486 .flags = IORESOURCE_DMA,
2487 },
2488};
2489
2490#endif
2491
2492#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2493 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2494
2495static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2496 .ce_shared = QCE_CE_SHARED,
2497 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2498 .hw_key_support = QCE_HW_KEY_SUPPORT,
2499 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2500};
2501
2502static struct platform_device qcrypto_device = {
2503 .name = "qcrypto",
2504 .id = 0,
2505 .num_resources = ARRAY_SIZE(qcrypto_resources),
2506 .resource = qcrypto_resources,
2507 .dev = {
2508 .coherent_dma_mask = DMA_BIT_MASK(32),
2509 .platform_data = &qcrypto_ce_hw_suppport,
2510 },
2511};
2512#endif
2513
2514#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2515 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2516
2517static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2518 .ce_shared = QCE_CE_SHARED,
2519 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2520 .hw_key_support = QCE_HW_KEY_SUPPORT,
2521 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2522};
2523
2524static struct platform_device qcedev_device = {
2525 .name = "qce",
2526 .id = 0,
2527 .num_resources = ARRAY_SIZE(qcedev_resources),
2528 .resource = qcedev_resources,
2529 .dev = {
2530 .coherent_dma_mask = DMA_BIT_MASK(32),
2531 .platform_data = &qcedev_ce_hw_suppport,
2532 },
2533};
2534#endif
2535
2536
2537static int __init gpiomux_init(void)
2538{
2539 int rc;
2540
2541 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2542 if (rc) {
2543 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2544 return rc;
2545 }
2546
Nishant Pandit24153d82011-08-27 16:05:13 +05302547 msm_gpiomux_install(msm8960_cam_common_configs,
2548 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002549
2550 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002551 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002552
2553 msm_gpiomux_install(msm8960_gsbi_configs,
2554 ARRAY_SIZE(msm8960_gsbi_configs));
2555
2556 msm_gpiomux_install(msm8960_cyts_configs,
2557 ARRAY_SIZE(msm8960_cyts_configs));
2558
2559 msm_gpiomux_install(msm8960_slimbus_config,
2560 ARRAY_SIZE(msm8960_slimbus_config));
2561
2562 msm_gpiomux_install(msm8960_audio_codec_configs,
2563 ARRAY_SIZE(msm8960_audio_codec_configs));
2564
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002565 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2566 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2567
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002568#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2569 msm_gpiomux_install(msm8960_hdmi_configs,
2570 ARRAY_SIZE(msm8960_hdmi_configs));
2571#endif
2572
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002573 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2574 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2575
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002576 msm_gpiomux_install(wcnss_5wire_interface,
2577 ARRAY_SIZE(wcnss_5wire_interface));
2578
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302579#ifdef CONFIG_USB_EHCI_MSM_HSIC
2580 msm_gpiomux_install(msm8960_hsic_configs,
2581 ARRAY_SIZE(msm8960_hsic_configs));
2582#endif
2583
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002584 return 0;
2585}
2586
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002587#define MSM_SHARED_RAM_PHYS 0x80000000
2588
2589static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2590 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2591 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2592 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2593 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2594 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2595 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2596 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2597 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2598 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2599 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2600 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2601 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002602 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2603 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2604 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2605 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2606 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2607 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2608 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2609 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2610 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2611 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2612 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2613 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2614 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2615 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002616 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002617 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2618 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2619 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002620 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2621 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002622};
2623
2624static struct pm8921_adc_properties pm8921_adc_data = {
2625 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2626 .bitresolution = 15,
2627 .bipolar = 0,
2628};
2629
2630static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2631 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002632 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002633 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002634 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002635};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002636
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002637static void __init msm8960_map_io(void)
2638{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002639 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002640 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002641
2642 if (socinfo_init() < 0)
2643 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002644}
2645
2646static void __init msm8960_init_irq(void)
2647{
2648 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002649
2650 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002651 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002652 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002653
2654 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002655 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002656
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002657 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2658 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002659
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002660 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2661 * as they are configured as level, which does not play nice with
2662 * handle_percpu_irq.
2663 */
2664 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2665 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002666 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002667 }
2668}
2669
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002670/* MSM8960 have 5 SDCC controllers */
2671enum sdcc_controllers {
2672 SDCC1,
2673 SDCC2,
2674 SDCC3,
2675 SDCC4,
2676 SDCC5,
2677 MAX_SDCC_CONTROLLER
2678};
2679
2680/* All SDCC controllers requires VDD/VCC voltage */
2681static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2682 /* SDCC1 : eMMC card connected */
2683 [SDCC1] = {
2684 .name = "sdc_vdd",
2685 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302686 .high_vol_level = 2950000,
2687 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302688 .always_on = 1,
2689 .lpm_sup = 1,
2690 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691 .hpm_uA = 200000, /* 200mA */
2692 },
2693 /* SDCC3 : External card slot connected */
2694 [SDCC3] = {
2695 .name = "sdc_vdd",
2696 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302697 .high_vol_level = 2950000,
2698 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002699 .hpm_uA = 600000, /* 600mA */
2700 }
2701};
2702
2703/* Only slots having eMMC card will require VCCQ voltage */
2704static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2705 /* SDCC1 : eMMC card connected */
2706 [SDCC1] = {
2707 .name = "sdc_vccq",
2708 .set_voltage_sup = 1,
2709 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302710 .high_vol_level = 1800000,
2711 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002712 .hpm_uA = 200000, /* 200mA */
2713 }
2714};
2715
2716/* All SDCC controllers may require voting for VDD PAD voltage */
2717static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2718 /* SDCC3 : External card slot connected */
2719 [SDCC3] = {
2720 .name = "sdc_vddp",
2721 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302722 .high_vol_level = 2950000,
2723 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002724 .always_on = 1,
2725 .lpm_sup = 1,
2726 /* Max. Active current required is 16 mA */
2727 .hpm_uA = 16000,
2728 /*
2729 * Sleep current required is ~300 uA. But min. vote can be
2730 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2731 * during sleep.
2732 */
2733 .lpm_uA = 2000,
2734 }
2735};
2736
2737static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2738 /* SDCC1 : eMMC card connected */
2739 [SDCC1] = {
2740 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2741 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2742 },
2743 /* SDCC3 : External card slot connected */
2744 [SDCC3] = {
2745 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2746 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2747 }
2748};
2749
2750/* SDC1 pad data */
2751static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2752 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302753 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2754 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002755};
2756
2757static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2758 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2759 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2760 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2761};
2762
2763static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302764 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002765 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2766 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2767};
2768
2769static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302770 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002771 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2772 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2773};
2774
2775/* SDC3 pad data */
2776static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2777 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2778 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2779 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2780};
2781
2782static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2783 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2784 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2785 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2786};
2787
2788static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302789 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002790 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2791 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2792};
2793
2794static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302795 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302796 /*
2797 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2798 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2799 * which would result in false card detection interrupts.
2800 */
2801 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2802 /*
2803 * Keeping DATA lines status to PULL UP will make sure that
2804 * there is no current leak during sleep if external pull up
2805 * is connected to DATA lines.
2806 */
2807 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002808};
2809
2810struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2811 [SDCC1] = {
2812 .on = sdc1_pad_pull_on_cfg,
2813 .off = sdc1_pad_pull_off_cfg,
2814 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2815 },
2816 [SDCC3] = {
2817 .on = sdc3_pad_pull_on_cfg,
2818 .off = sdc3_pad_pull_off_cfg,
2819 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2820 },
2821};
2822
2823struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2824 [SDCC1] = {
2825 .on = sdc1_pad_drv_on_cfg,
2826 .off = sdc1_pad_drv_off_cfg,
2827 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2828 },
2829 [SDCC3] = {
2830 .on = sdc3_pad_drv_on_cfg,
2831 .off = sdc3_pad_drv_off_cfg,
2832 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2833 },
2834};
2835
2836struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2837 [SDCC1] = {
2838 .pull = &mmc_pad_pull_data[SDCC1],
2839 .drv = &mmc_pad_drv_data[SDCC1]
2840 },
2841 [SDCC3] = {
2842 .pull = &mmc_pad_pull_data[SDCC3],
2843 .drv = &mmc_pad_drv_data[SDCC3]
2844 },
2845};
2846
2847struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2848 [SDCC1] = {
2849 .pad_data = &mmc_pad_data[SDCC1],
2850 },
2851 [SDCC3] = {
2852 .pad_data = &mmc_pad_data[SDCC3],
2853 },
2854};
2855
2856static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302857 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002858};
2859
2860static unsigned int sdc3_sup_clk_rates[] = {
2861 400000, 24000000, 48000000, 96000000
2862};
2863
2864#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2865static struct mmc_platform_data msm8960_sdc1_data = {
2866 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2867#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2868 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2869#else
2870 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2871#endif
2872 .sup_clk_table = sdc1_sup_clk_rates,
2873 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302874 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002875 .nonremovable = 1,
2876 .sdcc_v4_sup = true,
2877 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302878 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002879};
2880#endif
2881
2882#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2883static struct mmc_platform_data msm8960_sdc3_data = {
2884 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2885 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2886 .sup_clk_table = sdc3_sup_clk_rates,
2887 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302888 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302889#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002890 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302891#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002892 .sdcc_v4_sup = true,
2893 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2894 .pin_data = &mmc_slot_pin_data[SDCC3],
2895#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2896 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2897 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2898 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2899#endif
2900 .xpc_cap = 1,
2901 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2902 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302903 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002904};
2905#endif
2906
2907static void __init msm8960_init_mmc(void)
2908{
2909#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2910 /* SDC1 : eMMC card connected */
2911 msm_add_sdcc(1, &msm8960_sdc1_data);
2912#endif
2913#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2914 /* SDC3: External card slot */
2915 msm_add_sdcc(3, &msm8960_sdc3_data);
2916#endif
2917}
2918
2919static void __init msm8960_init_buses(void)
2920{
2921#ifdef CONFIG_MSM_BUS_SCALING
2922 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2923 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2924 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2925 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2926 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2927 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2928 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2929 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2930 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2931 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
Gagan Macdc1dc142011-09-16 15:13:35 -06002932 msm_bus_rpm_set_mt_mask();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002933#endif
2934}
2935
2936static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2937 .max_clock_speed = 15060000,
2938};
2939
2940#ifdef CONFIG_USB_MSM_OTG_72K
2941static struct msm_otg_platform_data msm_otg_pdata;
2942#else
2943#define USB_5V_EN 42
2944static void msm_hsusb_vbus_power(bool on)
2945{
2946 int rc;
2947 static bool vbus_is_on;
2948 static struct regulator *mvs_otg_switch;
2949 struct pm_gpio param = {
2950 .direction = PM_GPIO_DIR_OUT,
2951 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2952 .output_value = 1,
2953 .pull = PM_GPIO_PULL_NO,
2954 .vin_sel = PM_GPIO_VIN_S4,
2955 .out_strength = PM_GPIO_STRENGTH_MED,
2956 .function = PM_GPIO_FUNC_NORMAL,
2957 };
2958
2959 if (vbus_is_on == on)
2960 return;
2961
2962 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002963 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2964 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002965 if (IS_ERR(mvs_otg_switch)) {
2966 pr_err("Unable to get mvs_otg_switch\n");
2967 return;
2968 }
2969
2970 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2971 "usb_5v_en");
2972 if (rc < 0) {
2973 pr_err("failed to request usb_5v_en gpio\n");
2974 goto put_mvs_otg;
2975 }
2976
2977 if (regulator_enable(mvs_otg_switch)) {
2978 pr_err("unable to enable mvs_otg_switch\n");
2979 goto free_usb_5v_en;
2980 }
2981
2982 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2983 &param);
2984 if (rc < 0) {
2985 pr_err("failed to configure usb_5v_en gpio\n");
2986 goto disable_mvs_otg;
2987 }
2988 vbus_is_on = true;
2989 return;
2990 }
2991disable_mvs_otg:
2992 regulator_disable(mvs_otg_switch);
2993free_usb_5v_en:
2994 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2995put_mvs_otg:
2996 regulator_put(mvs_otg_switch);
2997 vbus_is_on = false;
2998}
2999
3000static struct msm_otg_platform_data msm_otg_pdata = {
3001 .mode = USB_OTG,
3002 .otg_control = OTG_PMIC_CONTROL,
3003 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3004 .pclk_src_name = "dfab_usb_hs_clk",
3005 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3006 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303007 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003008};
3009#endif
3010
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303011#ifdef CONFIG_USB_EHCI_MSM_HSIC
3012static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3013 .strobe = 150,
3014 .data = 151,
3015};
3016#else
3017static struct msm_hsic_host_platform_data msm_hsic_pdata;
3018#endif
3019
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003020#define PID_MAGIC_ID 0x71432909
3021#define SERIAL_NUM_MAGIC_ID 0x61945374
3022#define SERIAL_NUMBER_LENGTH 127
3023#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3024
3025struct magic_num_struct {
3026 uint32_t pid;
3027 uint32_t serial_num;
3028};
3029
3030struct dload_struct {
3031 uint32_t reserved1;
3032 uint32_t reserved2;
3033 uint32_t reserved3;
3034 uint16_t reserved4;
3035 uint16_t pid;
3036 char serial_number[SERIAL_NUMBER_LENGTH];
3037 uint16_t reserved5;
3038 struct magic_num_struct magic_struct;
3039};
3040
3041static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3042{
3043 struct dload_struct __iomem *dload = 0;
3044
3045 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3046 if (!dload) {
3047 pr_err("%s: cannot remap I/O memory region: %08x\n",
3048 __func__, DLOAD_USB_BASE_ADD);
3049 return -ENXIO;
3050 }
3051
3052 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3053 __func__, dload, pid, snum);
3054 /* update pid */
3055 dload->magic_struct.pid = PID_MAGIC_ID;
3056 dload->pid = pid;
3057
3058 /* update serial number */
3059 dload->magic_struct.serial_num = 0;
3060 if (!snum) {
3061 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3062 goto out;
3063 }
3064
3065 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
3066 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
3067 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
3068out:
3069 iounmap(dload);
3070 return 0;
3071}
3072
3073static struct android_usb_platform_data android_usb_pdata = {
3074 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3075};
3076
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003077static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003078 .name = "android_usb",
3079 .id = -1,
3080 .dev = {
3081 .platform_data = &android_usb_pdata,
3082 },
3083};
3084
3085static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3086 0x03, 0x0f,
3087};
3088
3089static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3090 0x00, 0x24, 0x54, 0x10,
3091 0x09, 0x03, 0x01,
3092 0x10, 0x54, 0x30, 0x0C,
3093 0x24, 0x30, 0x0f,
3094};
3095
3096static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3097 0x00, 0x24, 0x54, 0x10,
3098 0x09, 0x07, 0x01, 0x0B,
3099 0x10, 0x54, 0x30, 0x0C,
3100 0x24, 0x30, 0x0f,
3101};
3102
3103static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3104 [0] = {
3105 .mode = MSM_SPM_MODE_CLOCK_GATING,
3106 .notify_rpm = false,
3107 .cmd = spm_wfi_cmd_sequence,
3108 },
3109 [1] = {
3110 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3111 .notify_rpm = false,
3112 .cmd = spm_power_collapse_without_rpm,
3113 },
3114 [2] = {
3115 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3116 .notify_rpm = true,
3117 .cmd = spm_power_collapse_with_rpm,
3118 },
3119};
3120
3121static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3122 [0] = {
3123 .reg_base_addr = MSM_SAW0_BASE,
3124 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3125 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3126 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3127#if defined(CONFIG_MSM_AVS_HW)
3128 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3129 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3130#endif
3131 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3132 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3133 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3134 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3135 .vctl_timeout_us = 50,
3136 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3137 .modes = msm_spm_seq_list,
3138 },
3139 [1] = {
3140 .reg_base_addr = MSM_SAW1_BASE,
3141 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3142 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3143 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3144#if defined(CONFIG_MSM_AVS_HW)
3145 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3146 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3147#endif
3148 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3149 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3150 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3151 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3152 .vctl_timeout_us = 50,
3153 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3154 .modes = msm_spm_seq_list,
3155 },
3156};
3157
3158static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3159 0x00, 0x20, 0x03, 0x20,
3160 0x00, 0x0f,
3161};
3162
3163static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3164 0x00, 0x20, 0x34, 0x64,
3165 0x48, 0x07, 0x48, 0x20,
3166 0x50, 0x64, 0x04, 0x34,
3167 0x50, 0x0f,
3168};
3169static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3170 0x00, 0x10, 0x34, 0x64,
3171 0x48, 0x07, 0x48, 0x10,
3172 0x50, 0x64, 0x04, 0x34,
3173 0x50, 0x0F,
3174};
3175
3176static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3177 [0] = {
3178 .mode = MSM_SPM_L2_MODE_RETENTION,
3179 .notify_rpm = false,
3180 .cmd = l2_spm_wfi_cmd_sequence,
3181 },
3182 [1] = {
3183 .mode = MSM_SPM_L2_MODE_GDHS,
3184 .notify_rpm = true,
3185 .cmd = l2_spm_gdhs_cmd_sequence,
3186 },
3187 [2] = {
3188 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3189 .notify_rpm = true,
3190 .cmd = l2_spm_power_off_cmd_sequence,
3191 },
3192};
3193
3194
3195static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3196 [0] = {
3197 .reg_base_addr = MSM_SAW_L2_BASE,
3198 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3199 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3200 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3201 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3202 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3203 .modes = msm_spm_l2_seq_list,
3204 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3205 },
3206};
3207
3208#define CYTTSP_TS_GPIO_IRQ 11
3209#define CYTTSP_TS_SLEEP_GPIO 50
3210#define CYTTSP_TS_RESOUT_N_GPIO 52
3211
3212/*virtual key support */
3213static ssize_t tma340_vkeys_show(struct kobject *kobj,
3214 struct kobj_attribute *attr, char *buf)
3215{
3216 return snprintf(buf, 200,
3217 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3218 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3219 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3220 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3221 "\n");
3222}
3223
3224static struct kobj_attribute tma340_vkeys_attr = {
3225 .attr = {
3226 .mode = S_IRUGO,
3227 },
3228 .show = &tma340_vkeys_show,
3229};
3230
3231static struct attribute *tma340_properties_attrs[] = {
3232 &tma340_vkeys_attr.attr,
3233 NULL
3234};
3235
3236static struct attribute_group tma340_properties_attr_group = {
3237 .attrs = tma340_properties_attrs,
3238};
3239
3240
3241static int cyttsp_platform_init(struct i2c_client *client)
3242{
3243 int rc = 0;
3244 static struct kobject *tma340_properties_kobj;
3245
3246 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3247 tma340_properties_kobj = kobject_create_and_add("board_properties",
3248 NULL);
3249 if (tma340_properties_kobj)
3250 rc = sysfs_create_group(tma340_properties_kobj,
3251 &tma340_properties_attr_group);
3252 if (!tma340_properties_kobj || rc)
3253 pr_err("%s: failed to create board_properties\n",
3254 __func__);
3255
3256 return 0;
3257}
3258
3259static struct cyttsp_regulator regulator_data[] = {
3260 {
3261 .name = "vdd",
3262 .min_uV = CY_TMA300_VTG_MIN_UV,
3263 .max_uV = CY_TMA300_VTG_MAX_UV,
3264 .load_uA = CY_TMA300_CURR_24HZ_UA,
3265 },
3266 /* TODO: Remove after runtime PM is enabled in I2C driver */
3267 {
3268 .name = "vcc_i2c",
3269 .min_uV = CY_I2C_VTG_MIN_UV,
3270 .max_uV = CY_I2C_VTG_MAX_UV,
3271 .load_uA = CY_I2C_CURR_UA,
3272 },
3273};
3274
3275static struct cyttsp_platform_data cyttsp_pdata = {
3276 .panel_maxx = 634,
3277 .panel_maxy = 1166,
3278 .disp_maxx = 616,
3279 .disp_maxy = 1023,
3280 .disp_minx = 0,
3281 .disp_miny = 16,
3282 .flags = 0x01,
3283 .gen = CY_GEN3, /* or */
3284 .use_st = CY_USE_ST,
3285 .use_mt = CY_USE_MT,
3286 .use_hndshk = CY_SEND_HNDSHK,
3287 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303288 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003289 .use_gestures = CY_USE_GESTURES,
3290 .fw_fname = "cyttsp_8960_cdp.hex",
3291 /* activate up to 4 groups
3292 * and set active distance
3293 */
3294 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3295 CY_GEST_GRP3 | CY_GEST_GRP4 |
3296 CY_ACT_DIST,
3297 /* change act_intrvl to customize the Active power state
3298 * scanning/processing refresh interval for Operating mode
3299 */
3300 .act_intrvl = CY_ACT_INTRVL_DFLT,
3301 /* change tch_tmout to customize the touch timeout for the
3302 * Active power state for Operating mode
3303 */
3304 .tch_tmout = CY_TCH_TMOUT_DFLT,
3305 /* change lp_intrvl to customize the Low Power power state
3306 * scanning/processing refresh interval for Operating mode
3307 */
3308 .lp_intrvl = CY_LP_INTRVL_DFLT,
3309 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3310 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3311 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3312 .regulator_info = regulator_data,
3313 .num_regulators = ARRAY_SIZE(regulator_data),
3314 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303315 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003316};
3317
3318static struct i2c_board_info cyttsp_info[] __initdata = {
3319 {
3320 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3321 .platform_data = &cyttsp_pdata,
3322#ifndef CY_USE_TIMER
3323 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3324#endif /* CY_USE_TIMER */
3325 },
3326};
3327
Mohan Pallaka50837382011-09-07 11:00:57 +05303328/* configuration data */
3329static const u8 mxt_config_data[] = {
3330 /* T6 Object */
3331 0, 0, 0, 0, 0, 0,
3332 /* T38 Object */
3333 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
3334 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3335 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3336 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3339 0, 0, 0, 0,
3340 /* T7 Object */
3341 10, 10, 50,
3342 /* T8 Object */
3343 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3344 /* T9 Object */
3345 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3346 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3347 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3348 0, 5, 45, 46,
3349 /* T15 Object */
3350 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3351 0,
3352 /* T22 Object */
3353 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3354 0, 0, 255, 255, 255, 255, 0,
3355 /* T24 Object */
3356 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3357 0, 0, 0, 0, 0, 0, 0, 0, 0,
3358 /* T25 Object */
3359 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3360 0, 0, 0, 0,
3361 /* T27 Object */
3362 0, 0, 0, 0, 0, 0, 0,
3363 /* T28 Object */
3364 0, 0, 0, 8, 8, 8,
3365 /* T40 Object */
3366 0, 0, 0, 0, 0,
3367 /* T41 Object */
3368 0, 0, 0, 0, 0, 0,
3369 /* T43 Object */
3370 0, 0, 0, 0, 0, 0,
3371};
3372
3373#define MXT_TS_GPIO_IRQ 11
3374#define MXT_TS_LDO_EN_GPIO 50
3375#define MXT_TS_RESET_GPIO 52
3376
3377static void mxt_init_hw_liquid(void)
3378{
3379 int rc;
3380
3381 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3382 if (rc) {
3383 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3384 __func__, MXT_TS_GPIO_IRQ);
3385 return;
3386 }
3387
3388 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3389 if (rc) {
3390 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3391 __func__, MXT_TS_GPIO_IRQ);
3392 goto err_irq_gpio_req;
3393 }
3394
3395 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3396 if (rc) {
3397 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3398 __func__, MXT_TS_LDO_EN_GPIO);
3399 goto err_irq_gpio_req;
3400 }
3401
3402 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3403 if (rc) {
3404 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3405 __func__, MXT_TS_LDO_EN_GPIO);
3406 goto err_ldo_gpio_req;
3407 }
3408
3409 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3410 if (rc) {
3411 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3412 __func__, MXT_TS_RESET_GPIO);
3413 goto err_ldo_gpio_set_dir;
3414 }
3415
3416 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3417 if (rc) {
3418 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3419 __func__, MXT_TS_RESET_GPIO);
3420 goto err_reset_gpio_req;
3421 }
3422
3423 return;
3424
3425err_reset_gpio_req:
3426 gpio_free(MXT_TS_RESET_GPIO);
3427err_ldo_gpio_set_dir:
3428 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3429err_ldo_gpio_req:
3430 gpio_free(MXT_TS_LDO_EN_GPIO);
3431err_irq_gpio_req:
3432 gpio_free(MXT_TS_GPIO_IRQ);
3433}
3434
3435static struct mxt_platform_data mxt_platform_data = {
3436 .config = mxt_config_data,
3437 .config_length = ARRAY_SIZE(mxt_config_data),
3438 .x_line = 26,
3439 .y_line = 42,
3440 .x_size = 767,
3441 .y_size = 1365,
3442 .blen = 32,
3443 .threshold = 40,
3444 .voltage = 3300000, /* 3.3V */
3445 .orient = MXT_ROTATED_90,
3446 .irqflags = IRQF_TRIGGER_FALLING,
3447};
3448
3449static struct i2c_board_info mxt_device_info[] __initdata = {
3450 {
3451 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3452 .platform_data = &mxt_platform_data,
3453 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3454 },
3455};
3456
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003457static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3458{
3459}
3460
3461static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3462 .clk_freq = 100000,
3463 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003464 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3465};
3466
3467static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3468 .clk_freq = 100000,
3469 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003470 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3471};
3472
3473static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3474 .clk_freq = 100000,
3475 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003476 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3477};
3478
3479static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3480 .clk_freq = 100000,
3481 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003482 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3483};
3484
3485static struct msm_rpm_platform_data msm_rpm_data = {
3486 .reg_base_addrs = {
3487 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3488 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3489 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3490 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3491 },
3492
3493 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3494 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3495 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3496 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3497 .msm_apps_ipc_rpm_val = 4,
3498};
3499
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003500static struct ks8851_pdata spi_eth_pdata = {
3501 .irq_gpio = KS8851_IRQ_GPIO,
3502 .rst_gpio = KS8851_RST_GPIO,
3503};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003504
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003505static struct spi_board_info spi_board_info[] __initdata = {
3506 {
3507 .modalias = "ks8851",
3508 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3509 .max_speed_hz = 19200000,
3510 .bus_num = 0,
3511 .chip_select = 0,
3512 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003513 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003514 },
3515};
3516
3517static struct platform_device msm_device_saw_core0 = {
3518 .name = "saw-regulator",
3519 .id = 0,
3520 .dev = {
3521 .platform_data = &msm_saw_regulator_pdata_s5,
3522 },
3523};
3524
3525static struct platform_device msm_device_saw_core1 = {
3526 .name = "saw-regulator",
3527 .id = 1,
3528 .dev = {
3529 .platform_data = &msm_saw_regulator_pdata_s6,
3530 },
3531};
3532
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003533static struct tsens_platform_data msm_tsens_pdata = {
3534 .slope = 910,
3535 .tsens_factor = 1000,
3536 .hw_type = MSM_8960,
3537 .tsens_num_sensor = 5,
3538};
3539
3540static struct platform_device msm_tsens_device = {
3541 .name = "tsens8960-tm",
3542 .id = -1,
3543 .dev = {
3544 .platform_data = &msm_tsens_pdata,
3545 },
3546};
3547
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003548#ifdef CONFIG_MSM_FAKE_BATTERY
3549static struct platform_device fish_battery_device = {
3550 .name = "fish_battery",
3551};
3552#endif
3553
David Collins26f05562011-06-20 09:56:28 -07003554static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003555 .name = GPIO_REGULATOR_DEV_NAME,
3556 .id = PM8921_MPP_PM_TO_SYS(7),
3557 .dev = {
3558 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3559 },
3560};
3561
David Collins26f05562011-06-20 09:56:28 -07003562static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003563 .name = GPIO_REGULATOR_DEV_NAME,
3564 .id = 91,
3565 .dev = {
3566 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3567 },
3568};
3569
David Collinsb10be1d2011-09-02 10:29:31 -07003570static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3571 .name = GPIO_REGULATOR_DEV_NAME,
3572 .id = PM8921_GPIO_PM_TO_SYS(17),
3573 .dev = {
3574 .platform_data =
3575 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3576 },
3577};
3578
David Collins26f05562011-06-20 09:56:28 -07003579static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3580 .name = "rpm-regulator",
3581 .id = -1,
3582 .dev = {
3583 .platform_data = &msm_rpm_regulator_pdata,
3584 },
3585};
3586
David Collins4c31a872011-08-31 10:07:10 -07003587static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3588 .phys_addr_base = 0x0010C000,
3589 .reg_offsets = {
3590 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3591 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3592 },
3593 .phys_size = SZ_8K,
3594 .log_len = 4096, /* log's buffer length in bytes */
3595 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3596};
3597
3598static struct platform_device msm_rpm_log_device = {
3599 .name = "msm_rpm_log",
3600 .id = -1,
3601 .dev = {
3602 .platform_data = &msm_rpm_log_pdata,
3603 },
3604};
3605
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003606static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003607 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003608 &msm_device_smd,
3609 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303610 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003611 &msm_device_saw_core0,
3612 &msm_device_saw_core1,
3613 &msm8960_device_ext_5v_vreg,
3614 &msm8960_device_ext_l2_vreg,
3615 &msm8960_device_ssbi_pm8921,
3616 &msm8960_device_qup_spi_gsbi1,
3617 &msm8960_device_qup_i2c_gsbi3,
3618 &msm8960_device_qup_i2c_gsbi4,
3619 &msm8960_device_qup_i2c_gsbi10,
3620#ifndef CONFIG_MSM_DSPS
3621 &msm8960_device_qup_i2c_gsbi12,
3622#endif
3623 &msm_slim_ctrl,
3624 &msm_device_wcnss_wlan,
3625#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3626 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3627 &qcrypto_device,
3628#endif
3629
3630#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3631 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3632 &qcedev_device,
3633#endif
3634#ifdef CONFIG_MSM_ROTATOR
3635 &msm_rotator_device,
3636#endif
3637 &msm_device_sps,
3638#ifdef CONFIG_MSM_FAKE_BATTERY
3639 &fish_battery_device,
3640#endif
3641#ifdef CONFIG_ANDROID_PMEM
3642 &android_pmem_device,
3643 &android_pmem_adsp_device,
3644 &android_pmem_audio_device,
3645#endif
3646 &msm_fb_device,
3647 &msm_device_vidc,
3648 &msm_device_bam_dmux,
3649 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003650
3651#ifdef CONFIG_HW_RANDOM_MSM
3652 &msm_device_rng,
3653#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003654 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003655#ifdef CONFIG_ION_MSM
3656 &ion_dev,
3657#endif
David Collins4c31a872011-08-31 10:07:10 -07003658 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003659#ifdef CONFIG_MSM_QDSS
3660 &msm_etb_device,
3661 &msm_tpiu_device,
3662 &msm_funnel_device,
3663 &msm_ptm_device,
3664#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003665 &msm_device_dspcrashd_8960,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003666};
3667
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003668static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003669 &msm8960_device_otg,
3670 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003671 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303672 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003673 &android_usb_device,
3674 &msm_device_vidc,
3675 &mipi_dsi_simulator_panel_device,
3676 &msm_bus_apps_fabric,
3677 &msm_bus_sys_fabric,
3678 &msm_bus_mm_fabric,
3679 &msm_bus_sys_fpb,
3680 &msm_bus_cpss_fpb,
3681 &msm_pcm,
3682 &msm_pcm_routing,
3683 &msm_cpudai0,
3684 &msm_cpudai1,
3685 &msm_cpudai_hdmi_rx,
3686 &msm_cpudai_bt_rx,
3687 &msm_cpudai_bt_tx,
3688 &msm_cpudai_fm_rx,
3689 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003690 &msm_cpudai_auxpcm_rx,
3691 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003692 &msm_cpu_fe,
3693 &msm_stub_codec,
3694 &msm_voice,
3695 &msm_voip,
3696 &msm_lpa_pcm,
3697
3698#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3699 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3700 &qcrypto_device,
3701#endif
3702
3703#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3704 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3705 &qcedev_device,
3706#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003707};
3708
3709static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003710 &msm_kgsl_3d0,
3711 &msm_kgsl_2d0,
3712 &msm_kgsl_2d1,
3713 &mipi_dsi_renesas_panel_device,
3714#ifdef CONFIG_MSM_GEMINI
3715 &msm8960_gemini_device,
3716#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003717};
3718
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003719static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003720 &msm8960_device_otg,
3721 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003722 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303723 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003724 &android_usb_device,
3725 &msm_pcm,
3726 &msm_pcm_routing,
3727 &msm_cpudai0,
3728 &msm_cpudai1,
3729 &msm_cpudai_hdmi_rx,
3730 &msm_cpudai_bt_rx,
3731 &msm_cpudai_bt_tx,
3732 &msm_cpudai_fm_rx,
3733 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003734 &msm_cpudai_auxpcm_rx,
3735 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003736 &msm_cpu_fe,
3737 &msm_stub_codec,
3738 &msm_kgsl_3d0,
3739#ifdef CONFIG_MSM_KGSL_2D
3740 &msm_kgsl_2d0,
3741 &msm_kgsl_2d1,
3742#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003743 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003744#ifdef CONFIG_MSM_GEMINI
3745 &msm8960_gemini_device,
3746#endif
3747 &msm_voice,
3748 &msm_voip,
3749 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303750 &msm_cpudai_afe_01_rx,
3751 &msm_cpudai_afe_01_tx,
3752 &msm_cpudai_afe_02_rx,
3753 &msm_cpudai_afe_02_tx,
3754 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003755#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3756 &hdmi_msm_device,
3757#endif
3758 &msm_pcm_hostless,
3759 &msm_bus_apps_fabric,
3760 &msm_bus_sys_fabric,
3761 &msm_bus_mm_fabric,
3762 &msm_bus_sys_fpb,
3763 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003764 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003765};
3766
3767static void __init msm8960_i2c_init(void)
3768{
3769 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3770 &msm8960_i2c_qup_gsbi4_pdata;
3771
3772 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3773 &msm8960_i2c_qup_gsbi3_pdata;
3774
3775 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3776 &msm8960_i2c_qup_gsbi10_pdata;
3777
3778 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3779 &msm8960_i2c_qup_gsbi12_pdata;
3780}
3781
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003782static void __init msm8960_gfx_init(void)
3783{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003784 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003785 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3786 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3787 msm_kgsl_3d0.dev.platform_data;
3788 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3789 320000000;
3790 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3791 266667000;
3792 }
3793}
3794
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003795static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3796 .irq_base = PM8921_IRQ_BASE,
3797 .devirq = MSM_GPIO_TO_INT(104),
3798 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3799};
3800
3801static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3802 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3803};
3804
3805static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3806 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3807};
3808
3809static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3810 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303811 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003812};
3813
3814static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3815 .pull_up = 1,
3816 .kpd_trigger_delay_us = 970,
3817 .wakeup = 1,
3818};
3819
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303820/* Rotate lock key is not available so use F1 */
3821#define KEY_ROTATE_LOCK KEY_F1
3822
3823static const unsigned int keymap_liquid[] = {
3824 KEY(0, 0, KEY_VOLUMEUP),
3825 KEY(0, 1, KEY_VOLUMEDOWN),
3826 KEY(1, 3, KEY_ROTATE_LOCK),
3827 KEY(1, 4, KEY_HOME),
3828};
3829
3830static struct matrix_keymap_data keymap_data_liquid = {
3831 .keymap_size = ARRAY_SIZE(keymap_liquid),
3832 .keymap = keymap_liquid,
3833};
3834
3835static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3836 .input_name = "keypad_8960_liquid",
3837 .input_phys_device = "keypad_8960/input0",
3838 .num_rows = 2,
3839 .num_cols = 5,
3840 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3841 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3842 .debounce_ms = 15,
3843 .scan_delay_ms = 32,
3844 .row_hold_ns = 91500,
3845 .wakeup = 1,
3846 .keymap_data = &keymap_data_liquid,
3847};
3848
3849
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003850static const unsigned int keymap[] = {
3851 KEY(0, 0, KEY_VOLUMEUP),
3852 KEY(0, 1, KEY_VOLUMEDOWN),
3853 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3854 KEY(0, 3, KEY_CAMERA_FOCUS),
3855};
3856
3857static struct matrix_keymap_data keymap_data = {
3858 .keymap_size = ARRAY_SIZE(keymap),
3859 .keymap = keymap,
3860};
3861
3862static struct pm8xxx_keypad_platform_data keypad_data = {
3863 .input_name = "keypad_8960",
3864 .input_phys_device = "keypad_8960/input0",
3865 .num_rows = 1,
3866 .num_cols = 5,
3867 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3868 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3869 .debounce_ms = 15,
3870 .scan_delay_ms = 32,
3871 .row_hold_ns = 91500,
3872 .wakeup = 1,
3873 .keymap_data = &keymap_data,
3874};
3875
3876static const unsigned int keymap_sim[] = {
3877 KEY(0, 0, KEY_7),
3878 KEY(0, 1, KEY_DOWN),
3879 KEY(0, 2, KEY_UP),
3880 KEY(0, 3, KEY_RIGHT),
3881 KEY(0, 4, KEY_ENTER),
3882 KEY(0, 5, KEY_L),
3883 KEY(0, 6, KEY_BACK),
3884 KEY(0, 7, KEY_M),
3885
3886 KEY(1, 0, KEY_LEFT),
3887 KEY(1, 1, KEY_SEND),
3888 KEY(1, 2, KEY_1),
3889 KEY(1, 3, KEY_4),
3890 KEY(1, 4, KEY_CLEAR),
3891 KEY(1, 5, KEY_MSDOS),
3892 KEY(1, 6, KEY_SPACE),
3893 KEY(1, 7, KEY_COMMA),
3894
3895 KEY(2, 0, KEY_6),
3896 KEY(2, 1, KEY_5),
3897 KEY(2, 2, KEY_8),
3898 KEY(2, 3, KEY_3),
3899 KEY(2, 4, KEY_NUMERIC_STAR),
3900 KEY(2, 5, KEY_UP),
3901 KEY(2, 6, KEY_DOWN),
3902 KEY(2, 7, KEY_LEFTSHIFT),
3903
3904 KEY(3, 0, KEY_9),
3905 KEY(3, 1, KEY_NUMERIC_POUND),
3906 KEY(3, 2, KEY_0),
3907 KEY(3, 3, KEY_2),
3908 KEY(3, 4, KEY_SLEEP),
3909 KEY(3, 5, KEY_F1),
3910 KEY(3, 6, KEY_F2),
3911 KEY(3, 7, KEY_F3),
3912
3913 KEY(4, 0, KEY_BACK),
3914 KEY(4, 1, KEY_HOME),
3915 KEY(4, 2, KEY_MENU),
3916 KEY(4, 3, KEY_VOLUMEUP),
3917 KEY(4, 4, KEY_VOLUMEDOWN),
3918 KEY(4, 5, KEY_F4),
3919 KEY(4, 6, KEY_F5),
3920 KEY(4, 7, KEY_F6),
3921
3922 KEY(5, 0, KEY_R),
3923 KEY(5, 1, KEY_T),
3924 KEY(5, 2, KEY_Y),
3925 KEY(5, 3, KEY_LEFTALT),
3926 KEY(5, 4, KEY_KPENTER),
3927 KEY(5, 5, KEY_Q),
3928 KEY(5, 6, KEY_W),
3929 KEY(5, 7, KEY_E),
3930
3931 KEY(6, 0, KEY_F),
3932 KEY(6, 1, KEY_G),
3933 KEY(6, 2, KEY_H),
3934 KEY(6, 3, KEY_CAPSLOCK),
3935 KEY(6, 4, KEY_PAGEUP),
3936 KEY(6, 5, KEY_A),
3937 KEY(6, 6, KEY_S),
3938 KEY(6, 7, KEY_D),
3939
3940 KEY(7, 0, KEY_V),
3941 KEY(7, 1, KEY_B),
3942 KEY(7, 2, KEY_N),
3943 KEY(7, 3, KEY_MENU),
3944 KEY(7, 4, KEY_PAGEDOWN),
3945 KEY(7, 5, KEY_Z),
3946 KEY(7, 6, KEY_X),
3947 KEY(7, 7, KEY_C),
3948
3949 KEY(8, 0, KEY_P),
3950 KEY(8, 1, KEY_J),
3951 KEY(8, 2, KEY_K),
3952 KEY(8, 3, KEY_INSERT),
3953 KEY(8, 4, KEY_LINEFEED),
3954 KEY(8, 5, KEY_U),
3955 KEY(8, 6, KEY_I),
3956 KEY(8, 7, KEY_O),
3957
3958 KEY(9, 0, KEY_4),
3959 KEY(9, 1, KEY_5),
3960 KEY(9, 2, KEY_6),
3961 KEY(9, 3, KEY_7),
3962 KEY(9, 4, KEY_8),
3963 KEY(9, 5, KEY_1),
3964 KEY(9, 6, KEY_2),
3965 KEY(9, 7, KEY_3),
3966
3967 KEY(10, 0, KEY_F7),
3968 KEY(10, 1, KEY_F8),
3969 KEY(10, 2, KEY_F9),
3970 KEY(10, 3, KEY_F10),
3971 KEY(10, 4, KEY_FN),
3972 KEY(10, 5, KEY_9),
3973 KEY(10, 6, KEY_0),
3974 KEY(10, 7, KEY_DOT),
3975
3976 KEY(11, 0, KEY_LEFTCTRL),
3977 KEY(11, 1, KEY_F11),
3978 KEY(11, 2, KEY_ENTER),
3979 KEY(11, 3, KEY_SEARCH),
3980 KEY(11, 4, KEY_DELETE),
3981 KEY(11, 5, KEY_RIGHT),
3982 KEY(11, 6, KEY_LEFT),
3983 KEY(11, 7, KEY_RIGHTSHIFT),
3984 KEY(0, 0, KEY_VOLUMEUP),
3985 KEY(0, 1, KEY_VOLUMEDOWN),
3986 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3987 KEY(0, 3, KEY_CAMERA_FOCUS),
3988};
3989
3990static struct matrix_keymap_data keymap_data_sim = {
3991 .keymap_size = ARRAY_SIZE(keymap_sim),
3992 .keymap = keymap_sim,
3993};
3994
3995static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3996 .input_name = "keypad_8960",
3997 .input_phys_device = "keypad_8960/input0",
3998 .num_rows = 12,
3999 .num_cols = 8,
4000 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4001 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4002 .debounce_ms = 15,
4003 .scan_delay_ms = 32,
4004 .row_hold_ns = 91500,
4005 .wakeup = 1,
4006 .keymap_data = &keymap_data_sim,
4007};
4008
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004009static int pm8921_therm_mitigation[] = {
4010 1100,
4011 700,
4012 600,
4013 325,
4014};
4015
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004016static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004017 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004018 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004019 .max_voltage = 4200,
4020 .min_voltage = 3200,
4021 .resume_voltage = 4100,
4022 .term_current = 100,
4023 .cool_temp = 10,
4024 .warm_temp = 40,
4025 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004026 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004027 .cool_bat_chg_current = 350,
4028 .warm_bat_chg_current = 350,
4029 .cool_bat_voltage = 4100,
4030 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004031 .thermal_mitigation = pm8921_therm_mitigation,
4032 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004033};
4034
4035static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4036 .priority = 0,
4037};
4038
4039static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4040 .r_sense = 10,
4041 .i_test = 2500,
4042 .v_failure = 3000,
4043 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004044};
4045
Jay Chokshide4cefb2011-08-04 18:10:44 -07004046#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
4047
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004048static struct led_info pm8921_led_info[] = {
4049 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07004050 .name = "led:usb",
4051 .default_trigger = "usb-online",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004052 },
4053 [1] = {
4054 .name = "led:ac",
4055 .default_trigger = "ac-online",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004056 },
4057};
4058
Jay Chokshi8994e392011-09-14 18:20:39 -07004059static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004060 .num_leds = ARRAY_SIZE(pm8921_led_info),
4061 .leds = pm8921_led_info,
4062};
4063
Jay Chokshi8994e392011-09-14 18:20:39 -07004064static struct pm8xxx_led_config pm8921_led_configs[] = {
4065 [0] = {
4066 .id = PM8XXX_ID_LED_0,
4067 .mode = PM8XXX_LED_MODE_MANUAL,
4068 .max_current = PM8921_LC_LED_MAX_CURRENT,
4069 },
4070 [1] = {
4071 .id = PM8XXX_ID_LED_1,
4072 .mode = PM8XXX_LED_MODE_MANUAL,
4073 .max_current = PM8921_LC_LED_MAX_CURRENT,
4074 },
4075};
4076
4077static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4078 .led_core = &pm8921_led_core_pdata,
4079 .configs = pm8921_led_configs,
4080 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4081};
4082
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004083static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4084 .irq_pdata = &pm8xxx_irq_pdata,
4085 .gpio_pdata = &pm8xxx_gpio_pdata,
4086 .mpp_pdata = &pm8xxx_mpp_pdata,
4087 .rtc_pdata = &pm8xxx_rtc_pdata,
4088 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4089 .keypad_pdata = &keypad_data,
4090 .misc_pdata = &pm8xxx_misc_pdata,
4091 .regulator_pdatas = msm_pm8921_regulator_pdata,
4092 .charger_pdata = &pm8921_chg_pdata,
4093 .bms_pdata = &pm8921_bms_pdata,
4094 .adc_pdata = &pm8921_adc_pdata,
4095 .leds_pdata = &pm8xxx_leds_pdata,
4096};
4097
4098static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4099 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4100 .slave = {
4101 .name = "pm8921-core",
4102 .platform_data = &pm8921_platform_data,
4103 },
4104};
4105
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004106#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
4107static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004108{
4109 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004110
4111 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
4112 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004113 pr_err("FPGA CS gpio_request failed: %d\n", ret);
4114 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004115 }
4116
4117 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004118
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004119 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004120fail:
4121 return ret;
4122}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004123#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004124static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07004125{
4126 return 0;
4127}
4128#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004129
4130static struct msm_cpuidle_state msm_cstates[] __initdata = {
4131 {0, 0, "C0", "WFI",
4132 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4133
4134 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4135 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4136
4137 {0, 2, "C2", "POWER_COLLAPSE",
4138 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4139
4140 {1, 0, "C0", "WFI",
4141 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4142
4143 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4144 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4145};
4146
4147static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4148 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4149 .idle_supported = 1,
4150 .suspend_supported = 1,
4151 .idle_enabled = 0,
4152 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004153 },
4154
4155 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4156 .idle_supported = 1,
4157 .suspend_supported = 1,
4158 .idle_enabled = 0,
4159 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004160 },
4161
4162 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4163 .idle_supported = 1,
4164 .suspend_supported = 1,
4165 .idle_enabled = 1,
4166 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004167 },
4168
4169 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4170 .idle_supported = 0,
4171 .suspend_supported = 1,
4172 .idle_enabled = 0,
4173 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004174 },
4175
4176 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4177 .idle_supported = 1,
4178 .suspend_supported = 1,
4179 .idle_enabled = 0,
4180 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004181 },
4182
4183 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4184 .idle_supported = 1,
4185 .suspend_supported = 0,
4186 .idle_enabled = 1,
4187 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004188 },
4189};
4190
4191static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4192 {
4193 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4194 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4195 true,
4196 1, 8000, 100000, 1,
4197 },
4198
4199 {
4200 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4201 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4202 true,
4203 1500, 5000, 60100000, 3000,
4204 },
4205
4206 {
4207 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4208 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4209 false,
4210 1800, 5000, 60350000, 3500,
4211 },
4212
4213 {
4214 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4215 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4216 false,
4217 2800, 2500, 65350000, 4800,
4218 },
4219
4220 {
4221 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4222 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4223 false,
4224 3800, 4500, 67850000, 5500,
4225 },
4226
4227 {
4228 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4229 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4230 false,
4231 4800, 2000, 71850000, 6800,
4232 },
4233
4234 {
4235 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4236 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4237 false,
4238 6800, 500, 75850000, 8800,
4239 },
4240
4241 {
4242 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4243 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4244 false,
4245 7800, 0, 76350000, 9800,
4246 },
4247};
4248
4249#ifdef CONFIG_I2C
4250#define I2C_SURF 1
4251#define I2C_FFA (1 << 1)
4252#define I2C_RUMI (1 << 2)
4253#define I2C_SIM (1 << 3)
4254#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004255#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004256
4257struct i2c_registry {
4258 u8 machs;
4259 int bus;
4260 struct i2c_board_info *info;
4261 int len;
4262};
4263
4264#ifdef CONFIG_MSM_CAMERA
4265static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4266#ifdef CONFIG_IMX074
4267 {
4268 I2C_BOARD_INFO("imx074", 0x1A),
4269 },
4270#endif
4271#ifdef CONFIG_OV2720
4272 {
4273 I2C_BOARD_INFO("ov2720", 0x6C),
4274 },
4275#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004276 {
4277 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4278 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304279#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4280 {
4281 I2C_BOARD_INFO("sc628a", 0x6E),
4282 },
4283#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004284};
4285#endif
4286
4287/* Sensors DSPS platform data */
4288#ifdef CONFIG_MSM_DSPS
4289#define DSPS_PIL_GENERIC_NAME "dsps"
4290#endif /* CONFIG_MSM_DSPS */
4291
4292static void __init msm8960_init_dsps(void)
4293{
4294#ifdef CONFIG_MSM_DSPS
4295 struct msm_dsps_platform_data *pdata =
4296 msm_dsps_device.dev.platform_data;
4297 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4298 pdata->gpios = NULL;
4299 pdata->gpios_num = 0;
4300
4301 platform_device_register(&msm_dsps_device);
4302#endif /* CONFIG_MSM_DSPS */
4303}
4304
Amir Samuelov5137e392011-09-21 17:31:25 +03004305#ifdef CONFIG_ISL9519_CHARGER
4306static struct isl_platform_data isl_data __initdata = {
4307 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4308 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4309 .max_system_voltage = 4200,
4310 .min_system_voltage = 3200,
4311 .chgcurrent = 1000, /* 1900, */
4312 .term_current = 400, /* Need fine tuning */
4313 .input_current = 2048,
4314};
4315
4316static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4317 {
4318 I2C_BOARD_INFO("isl9519q", 0x9),
4319 .irq = 0, /* Not required when notify-by-pmic */
4320 .platform_data = &isl_data,
4321 },
4322};
4323#endif /* CONFIG_ISL9519_CHARGER */
4324
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004325static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4326#ifdef CONFIG_MSM_CAMERA
4327 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004328 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004329 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4330 msm_camera_boardinfo,
4331 ARRAY_SIZE(msm_camera_boardinfo),
4332 },
4333#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004334#ifdef CONFIG_ISL9519_CHARGER
4335 {
4336 I2C_LIQUID,
4337 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4338 isl_charger_i2c_info,
4339 ARRAY_SIZE(isl_charger_i2c_info),
4340 },
4341#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004342 {
4343 I2C_SURF | I2C_FFA | I2C_FLUID,
4344 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4345 cyttsp_info,
4346 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004347 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304348 {
4349 I2C_LIQUID,
4350 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4351 mxt_device_info,
4352 ARRAY_SIZE(mxt_device_info),
4353 },
4354
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004355};
4356#endif /* CONFIG_I2C */
4357
4358static void __init register_i2c_devices(void)
4359{
4360#ifdef CONFIG_I2C
4361 u8 mach_mask = 0;
4362 int i;
4363
4364 /* Build the matching 'supported_machs' bitmask */
4365 if (machine_is_msm8960_cdp())
4366 mach_mask = I2C_SURF;
4367 else if (machine_is_msm8960_rumi3())
4368 mach_mask = I2C_RUMI;
4369 else if (machine_is_msm8960_sim())
4370 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004371 else if (machine_is_msm8960_fluid())
4372 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004373 else if (machine_is_msm8960_liquid())
4374 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004375 else if (machine_is_msm8960_mtp())
4376 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004377 else
4378 pr_err("unmatched machine ID in register_i2c_devices\n");
4379
4380 /* Run the array and install devices as appropriate */
4381 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4382 if (msm8960_i2c_devices[i].machs & mach_mask)
4383 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4384 msm8960_i2c_devices[i].info,
4385 msm8960_i2c_devices[i].len);
4386 }
4387#endif
4388}
4389
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004390static void __init msm8960_sim_init(void)
4391{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004392 BUG_ON(msm_rpm_init(&msm_rpm_data));
4393 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4394 ARRAY_SIZE(msm_rpmrs_levels)));
4395 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004396 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004397 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004398 msm8960_device_ssbi_pm8921.dev.platform_data =
4399 &msm8960_ssbi_pm8921_pdata;
4400 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004401
4402 /* Simulator supports a QWERTY keypad */
4403 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4404
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004405 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4406 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4407 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004408 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004409 msm8960_i2c_init();
4410 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4411 msm_spm_l2_init(msm_spm_l2_data);
4412 msm8960_init_buses();
4413 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4414 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004415 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004416 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004417
4418 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4419 &msm8960_qup_spi_gsbi1_pdata;
4420 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4421
4422 msm8960_init_mmc();
4423 msm_fb_add_devices();
4424 slim_register_board_info(msm_slim_devices,
4425 ARRAY_SIZE(msm_slim_devices));
4426 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4427 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4428 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4429 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004430}
4431
4432static void __init msm8960_rumi3_init(void)
4433{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004434 BUG_ON(msm_rpm_init(&msm_rpm_data));
4435 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4436 ARRAY_SIZE(msm_rpmrs_levels)));
4437 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004438 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004439 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004440 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004441 msm8960_device_ssbi_pm8921.dev.platform_data =
4442 &msm8960_ssbi_pm8921_pdata;
4443 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4444 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4445 &msm8960_qup_spi_gsbi1_pdata;
4446 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4447 msm8960_i2c_init();
4448 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4449 msm_spm_l2_init(msm_spm_l2_data);
4450 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4451 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004452 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004453 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004454 register_i2c_devices();
4455 msm_fb_add_devices();
4456 slim_register_board_info(msm_slim_devices,
4457 ARRAY_SIZE(msm_slim_devices));
4458 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4459 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4460 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4461 msm_pm_data);
4462}
4463
4464static void __init msm8960_cdp_init(void)
4465{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004466 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4467 pr_err("meminfo_init() failed!\n");
4468
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004469 BUG_ON(msm_rpm_init(&msm_rpm_data));
4470 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4471 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004472
4473 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004474 regulator_suppress_info_printing();
4475 if (msm_xo_init())
4476 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004477 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004478 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004479 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4480 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4481 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304482 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004483 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004484 if (machine_is_msm8960_cdp())
4485 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304486 if (machine_is_msm8960_liquid())
4487 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004488 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4489 &msm8960_qup_spi_gsbi1_pdata;
4490 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4491 msm8960_device_ssbi_pm8921.dev.platform_data =
4492 &msm8960_ssbi_pm8921_pdata;
4493 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4494 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004495 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004496 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4497 msm_spm_l2_init(msm_spm_l2_data);
4498 msm8960_init_buses();
4499 platform_add_devices(msm_footswitch_devices,
4500 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004501 if (machine_is_msm8960_liquid())
4502 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004503 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4504 pm8921_gpio_mpp_init();
4505 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4506 msm8960_init_cam();
4507 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004508 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304509 if (machine_is_msm8960_liquid())
4510 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004511 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004512 msm_fb_add_devices();
4513 slim_register_board_info(msm_slim_devices,
4514 ARRAY_SIZE(msm_slim_devices));
4515 msm8960_init_dsps();
4516 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4517 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4518 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4519 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004520 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004521}
4522
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004523MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4524 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004525 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004526 .init_irq = msm8960_init_irq,
4527 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004528 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004529 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004530MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004531
4532MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4533 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004534 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004535 .init_irq = msm8960_init_irq,
4536 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004537 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004538 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004539MACHINE_END
4540
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004541MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4542 .map_io = msm8960_map_io,
4543 .reserve = msm8960_reserve,
4544 .init_irq = msm8960_init_irq,
4545 .timer = &msm_timer,
4546 .init_machine = msm8960_cdp_init,
4547 .init_early = msm8960_allocate_memory_regions,
4548MACHINE_END
4549
4550MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4551 .map_io = msm8960_map_io,
4552 .reserve = msm8960_reserve,
4553 .init_irq = msm8960_init_irq,
4554 .timer = &msm_timer,
4555 .init_machine = msm8960_cdp_init,
4556 .init_early = msm8960_allocate_memory_regions,
4557MACHINE_END
4558
4559MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4560 .map_io = msm8960_map_io,
4561 .reserve = msm8960_reserve,
4562 .init_irq = msm8960_init_irq,
4563 .timer = &msm_timer,
4564 .init_machine = msm8960_cdp_init,
4565 .init_early = msm8960_allocate_memory_regions,
4566MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004567
4568MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4569 .map_io = msm8960_map_io,
4570 .reserve = msm8960_reserve,
4571 .init_irq = msm8960_init_irq,
4572 .timer = &msm_timer,
4573 .init_machine = msm8960_cdp_init,
4574 .init_early = msm8960_allocate_memory_regions,
4575MACHINE_END