blob: e8e8eca054442101a15a9924a4fd52f66ed08b90 [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>
24#include <linux/regulator/consumer.h>
25#include <linux/spi/spi.h>
26#include <linux/slimbus/slimbus.h>
27#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060028#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
32#include <linux/cyttsp.h>
33#include <linux/dma-mapping.h>
34#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070035#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036#include <linux/leds.h>
37#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053038#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070039#include <linux/msm_tsens.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080040
41#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070043#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080044#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046
47#include <mach/board.h>
48#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include <mach/msm_spi.h>
50#ifdef CONFIG_USB_MSM_OTG_72K
51#include <mach/msm_hsusb.h>
52#else
53#include <linux/usb/msm_hsusb.h>
54#endif
55#include <linux/usb/android.h>
56#include <mach/usbdiag.h>
57#include <mach/socinfo.h>
58#include <mach/rpm.h>
59#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070060#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061#include <mach/msm_bus_board.h>
62#include <mach/msm_memtypes.h>
63#include <mach/dma.h>
64#include <mach/msm_dsps.h>
65#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070066#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080067
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068#ifdef CONFIG_WCD9310_CODEC
69#include <linux/slimbus/slimbus.h>
70#include <linux/mfd/wcd9310/core.h>
71#include <linux/mfd/wcd9310/pdata.h>
72#endif
73
Laura Abbottd6183792011-08-19 13:42:24 -070074#include <linux/ion.h>
75#include <mach/ion.h>
76
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080078#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#include "spm.h"
81#include "board-msm8960.h"
82#include "pm.h"
83#include "cpuidle.h"
84#include "rpm_resources.h"
85#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070086#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070087#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070088#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070089
90static struct platform_device msm_fm_platform_init = {
91 .name = "iris_fm",
92 .id = -1,
93};
94
95struct pm8xxx_gpio_init {
96 unsigned gpio;
97 struct pm_gpio config;
98};
99
100struct pm8xxx_mpp_init {
101 unsigned mpp;
102 struct pm8xxx_mpp_config_data config;
103};
104
105#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
106 _func, _inv, _disable) \
107{ \
108 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
109 .config = { \
110 .direction = _dir, \
111 .output_buffer = _buf, \
112 .output_value = _val, \
113 .pull = _pull, \
114 .vin_sel = _vin, \
115 .out_strength = _out_strength, \
116 .function = _func, \
117 .inv_int_pol = _inv, \
118 .disable_pin = _disable, \
119 } \
120}
121
122#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
123{ \
124 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
125 .config = { \
126 .type = PM8XXX_MPP_TYPE_##_type, \
127 .level = _level, \
128 .control = PM8XXX_MPP_##_control, \
129 } \
130}
131
132#define PM8XXX_GPIO_DISABLE(_gpio) \
133 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
134 0, 0, 0, 1)
135
136#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
138 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
139 PM_GPIO_STRENGTH_HIGH, \
140 PM_GPIO_FUNC_NORMAL, 0, 0)
141
142#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
143 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
144 _pull, PM_GPIO_VIN_S4, \
145 PM_GPIO_STRENGTH_NO, \
146 PM_GPIO_FUNC_NORMAL, 0, 0)
147
148#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
149 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
150 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
151 PM_GPIO_STRENGTH_HIGH, \
152 _func, 0, 0)
153
154/* Initial PM8921 GPIO configurations */
155static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
156 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
157 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
158 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300159 /* External regulator shared by display and touchscreen on LiQUID */
160 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
161 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700162 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700163 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700165 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166};
167
168/* Initial PM8921 MPP configurations */
169static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
170 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
171 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
172 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6,
173 DOUT_CTRL_LOW),
174 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
175 DOUT_CTRL_LOW),
176};
177
178static void __init pm8921_gpio_mpp_init(void)
179{
180 int i, rc;
181
182 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
183 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
184 &pm8921_gpios[i].config);
185 if (rc) {
186 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
187 break;
188 }
189 }
190
191 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
192 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
193 &pm8921_mpps[i].config);
194 if (rc) {
195 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
196 break;
197 }
198 }
199}
200
201#define FPGA_CS_GPIO 14
202#define KS8851_RST_GPIO 89
203#define KS8851_IRQ_GPIO 90
204
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700205#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
206enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700207 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700208 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
209 /* CAM Expander */
210 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
211 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
212 GPIO_CAM_GP_AFBUSY,
213 GPIO_CAM_GP_STROBE_CE,
214 GPIO_CAM_GP_CAM1MP_XCLR,
215 GPIO_CAM_GP_CAMIF_RESET_N,
216 GPIO_CAM_GP_XMT_FLASH_INT,
217 GPIO_CAM_GP_LED_EN1,
218 GPIO_CAM_GP_LED_EN2,
219
220};
221#endif
222
Harini Jayaraman608d0462011-08-09 19:10:03 -0600223/* The SPI configurations apply to GSBI 1*/
224static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700225 .func = GPIOMUX_FUNC_1,
226 .drv = GPIOMUX_DRV_8MA,
227 .pull = GPIOMUX_PULL_NONE,
228};
229
Harini Jayaraman608d0462011-08-09 19:10:03 -0600230static struct gpiomux_setting spi_suspended_config = {
231 .func = GPIOMUX_FUNC_GPIO,
232 .drv = GPIOMUX_DRV_2MA,
233 .pull = GPIOMUX_PULL_DOWN,
234};
235
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236static struct gpiomux_setting gsbi3 = {
237 .func = GPIOMUX_FUNC_1,
238 .drv = GPIOMUX_DRV_8MA,
239 .pull = GPIOMUX_PULL_NONE,
240};
241
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242static struct gpiomux_setting gsbi5 = {
243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_8MA,
245 .pull = GPIOMUX_PULL_NONE,
246};
247
248static struct gpiomux_setting gsbi10 = {
249 .func = GPIOMUX_FUNC_2,
250 .drv = GPIOMUX_DRV_8MA,
251 .pull = GPIOMUX_PULL_NONE,
252};
253
254static struct gpiomux_setting gsbi12 = {
255 .func = GPIOMUX_FUNC_1,
256 .drv = GPIOMUX_DRV_8MA,
257 .pull = GPIOMUX_PULL_NONE,
258};
259
260static struct gpiomux_setting cdc_mclk = {
261 .func = GPIOMUX_FUNC_1,
262 .drv = GPIOMUX_DRV_8MA,
263 .pull = GPIOMUX_PULL_NONE,
264};
265
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700266#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267static struct gpiomux_setting gpio_eth_config = {
268 .pull = GPIOMUX_PULL_NONE,
269 .drv = GPIOMUX_DRV_8MA,
270 .func = GPIOMUX_FUNC_GPIO,
271};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700272#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700273
274static struct gpiomux_setting slimbus = {
275 .func = GPIOMUX_FUNC_1,
276 .drv = GPIOMUX_DRV_8MA,
277 .pull = GPIOMUX_PULL_KEEPER,
278};
279
280struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700281#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282 {
283 .gpio = KS8851_IRQ_GPIO,
284 .settings = {
285 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
286 }
287 },
288 {
289 .gpio = KS8851_RST_GPIO,
290 .settings = {
291 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
292 }
293 },
294 {
295 .gpio = FPGA_CS_GPIO,
296 .settings = {
297 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
298 }
299 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700300#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700301};
302
303static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
304 {
305 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
306 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600307 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
308 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309 },
310 },
311 {
312 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
313 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600314 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
315 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316 },
317 },
318 {
319 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
320 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600321 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
322 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323 },
324 },
325 {
326 .gpio = 9, /* GSBI1 QUP SPI_CLK */
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 = 16, /* GSBI3 I2C QUP SDA */
334 .settings = {
335 [GPIOMUX_SUSPENDED] = &gsbi3,
336 },
337 },
338 {
339 .gpio = 17, /* GSBI3 I2C QUP SCL */
340 .settings = {
341 [GPIOMUX_SUSPENDED] = &gsbi3,
342 },
343 },
344 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 .gpio = 22, /* GSBI5 UART2 */
346 .settings = {
347 [GPIOMUX_SUSPENDED] = &gsbi5,
348 },
349 },
350 {
351 .gpio = 23, /* GSBI5 UART2 */
352 .settings = {
353 [GPIOMUX_SUSPENDED] = &gsbi5,
354 },
355 },
356 {
357 .gpio = 24, /* GSBI5 UART2 */
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &gsbi5,
360 },
361 },
362 {
363 .gpio = 25, /* GSBI5 UART2 */
364 .settings = {
365 [GPIOMUX_SUSPENDED] = &gsbi5,
366 },
367 },
368 {
369 .gpio = 44, /* GSBI12 I2C QUP SDA */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &gsbi12,
372 },
373 },
374 {
375 .gpio = 45, /* GSBI12 I2C QUP SCL */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &gsbi12,
378 },
379 },
380 {
381 .gpio = 73, /* GSBI10 I2C QUP SDA */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &gsbi10,
384 },
385 },
386 {
387 .gpio = 74, /* GSBI10 I2C QUP SCL */
388 .settings = {
389 [GPIOMUX_SUSPENDED] = &gsbi10,
390 },
391 },
392};
393
394static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
395 {
396 .gpio = 60, /* slimbus data */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &slimbus,
399 },
400 },
401 {
402 .gpio = 61, /* slimbus clk */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &slimbus,
405 },
406 },
407};
408
409static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
410 {
411 .gpio = 59,
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &cdc_mclk,
414 },
415 },
416};
417static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
418 .func = GPIOMUX_FUNC_GPIO,
419 .drv = GPIOMUX_DRV_2MA,
420 .pull = GPIOMUX_PULL_NONE,
421};
422
423static struct gpiomux_setting wcnss_5wire_active_cfg = {
424 .func = GPIOMUX_FUNC_1,
425 .drv = GPIOMUX_DRV_6MA,
426 .pull = GPIOMUX_PULL_DOWN,
427};
428
429static struct msm_gpiomux_config wcnss_5wire_interface[] = {
430 {
431 .gpio = 84,
432 .settings = {
433 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
434 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
435 },
436 },
437 {
438 .gpio = 85,
439 .settings = {
440 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
441 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
442 },
443 },
444 {
445 .gpio = 86,
446 .settings = {
447 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
448 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
449 },
450 },
451 {
452 .gpio = 87,
453 .settings = {
454 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
455 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
456 },
457 },
458 {
459 .gpio = 88,
460 .settings = {
461 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
462 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
463 },
464 },
465};
Nishant Pandit24153d82011-08-27 16:05:13 +0530466static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530467 {
468 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
469 .drv = GPIOMUX_DRV_2MA,
470 .pull = GPIOMUX_PULL_DOWN,
471 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700472
Nishant Pandit474f2252011-07-23 23:17:56 +0530473 {
474 .func = GPIOMUX_FUNC_1, /*active 1*/
475 .drv = GPIOMUX_DRV_2MA,
476 .pull = GPIOMUX_PULL_NONE,
477 },
478
479 {
480 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
481 .drv = GPIOMUX_DRV_2MA,
482 .pull = GPIOMUX_PULL_NONE,
483 },
484
485 {
486 .func = GPIOMUX_FUNC_1, /*active 3*/
487 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700488 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530489 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530490
491 {
492 .func = GPIOMUX_FUNC_5, /*active 4*/
493 .drv = GPIOMUX_DRV_8MA,
494 .pull = GPIOMUX_PULL_UP,
495 },
496
497 {
498 .func = GPIOMUX_FUNC_6, /*active 5*/
499 .drv = GPIOMUX_DRV_8MA,
500 .pull = GPIOMUX_PULL_UP,
501 },
502
503 {
504 .func = GPIOMUX_FUNC_2, /*active 6*/
505 .drv = GPIOMUX_DRV_2MA,
506 .pull = GPIOMUX_PULL_UP,
507 },
508
509 {
510 .func = GPIOMUX_FUNC_3, /*active 7*/
511 .drv = GPIOMUX_DRV_8MA,
512 .pull = GPIOMUX_PULL_UP,
513 },
514
Kevin Chan4c58d292011-09-13 11:03:25 -0700515 {
516 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
517 .drv = GPIOMUX_DRV_2MA,
518 .pull = GPIOMUX_PULL_KEEPER,
519 },
520
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700521};
522
Nishant Pandit24153d82011-08-27 16:05:13 +0530523static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700524 {
525 .gpio = 2,
526 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530527 [GPIOMUX_ACTIVE] = &cam_settings[2],
528 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700529 },
530 },
531 {
532 .gpio = 3,
533 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530534 [GPIOMUX_ACTIVE] = &cam_settings[1],
535 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700536 },
537 },
538 {
539 .gpio = 4,
540 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530541 [GPIOMUX_ACTIVE] = &cam_settings[1],
542 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700543 },
544 },
545 {
546 .gpio = 5,
547 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530548 [GPIOMUX_ACTIVE] = &cam_settings[1],
549 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700550 },
551 },
552 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530553 .gpio = 76,
554 .settings = {
555 [GPIOMUX_ACTIVE] = &cam_settings[2],
556 [GPIOMUX_SUSPENDED] = &cam_settings[0],
557 },
558 },
559 {
560 .gpio = 107,
561 .settings = {
562 [GPIOMUX_ACTIVE] = &cam_settings[2],
563 [GPIOMUX_SUSPENDED] = &cam_settings[0],
564 },
565 },
566};
567
568static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
569 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700570 .gpio = 18,
571 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530572 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700573 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700574 },
575 },
576 {
577 .gpio = 19,
578 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530579 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700580 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700581 },
582 },
583 {
584 .gpio = 20,
585 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530586 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700587 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700588 },
589 },
590 {
591 .gpio = 21,
592 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530593 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700594 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595 },
596 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597};
598
599static struct gpiomux_setting cyts_resout_sus_cfg = {
600 .func = GPIOMUX_FUNC_GPIO,
601 .drv = GPIOMUX_DRV_6MA,
602 .pull = GPIOMUX_PULL_UP,
603};
604
605static struct gpiomux_setting cyts_resout_act_cfg = {
606 .func = GPIOMUX_FUNC_GPIO,
607 .drv = GPIOMUX_DRV_6MA,
608 .pull = GPIOMUX_PULL_UP,
609};
610
611static struct gpiomux_setting cyts_sleep_sus_cfg = {
612 .func = GPIOMUX_FUNC_GPIO,
613 .drv = GPIOMUX_DRV_6MA,
614 .pull = GPIOMUX_PULL_DOWN,
615};
616
617static struct gpiomux_setting cyts_sleep_act_cfg = {
618 .func = GPIOMUX_FUNC_GPIO,
619 .drv = GPIOMUX_DRV_6MA,
620 .pull = GPIOMUX_PULL_DOWN,
621};
622
623static struct gpiomux_setting cyts_int_act_cfg = {
624 .func = GPIOMUX_FUNC_GPIO,
625 .drv = GPIOMUX_DRV_8MA,
626 .pull = GPIOMUX_PULL_UP,
627};
628
629static struct gpiomux_setting cyts_int_sus_cfg = {
630 .func = GPIOMUX_FUNC_GPIO,
631 .drv = GPIOMUX_DRV_2MA,
632 .pull = GPIOMUX_PULL_UP,
633};
634
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700635static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
636 { /* TS INTERRUPT */
637 .gpio = 11,
638 .settings = {
639 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
640 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
641 },
642 },
643 { /* TS SLEEP */
644 .gpio = 50,
645 .settings = {
646 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
647 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
648 },
649 },
650 { /* TS RESOUT */
651 .gpio = 52,
652 .settings = {
653 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
654 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
655 },
656 },
657};
658
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700659#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
660enum {
661 SX150X_CAM,
662};
663
Nishant Pandit474f2252011-07-23 23:17:56 +0530664static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700665 [SX150X_CAM] = {
666 .gpio_base = GPIO_CAM_EXPANDER_BASE,
667 .oscio_is_gpo = false,
668 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530669 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700670 .io_open_drain_ena = 0x0,
671 .irq_summary = -1,
672 },
673};
Nishant Pandit474f2252011-07-23 23:17:56 +0530674
675#endif
676
677#ifdef CONFIG_I2C
678
679#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
680#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300681#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530682
683#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
684
685static struct i2c_board_info cam_expander_i2c_info[] = {
686 {
687 I2C_BOARD_INFO("sx1508q", 0x22),
688 .platform_data = &sx150x_data[SX150X_CAM]
689 },
690};
691
692static struct msm_cam_expander_info cam_expander_info[] = {
693 {
694 cam_expander_i2c_info,
695 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
696 },
697};
698#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700699#endif
700
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700701#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
702#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700703#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700704#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
705
Laura Abbottd6183792011-08-19 13:42:24 -0700706#define MSM_ION_EBI_SIZE SZ_8M
707
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700708#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
709static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
710static int __init pmem_kernel_ebi1_size_setup(char *p)
711{
712 pmem_kernel_ebi1_size = memparse(p, NULL);
713 return 0;
714}
715early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
716#endif
717
718#ifdef CONFIG_ANDROID_PMEM
719static unsigned pmem_size = MSM_PMEM_SIZE;
720static int __init pmem_size_setup(char *p)
721{
722 pmem_size = memparse(p, NULL);
723 return 0;
724}
725early_param("pmem_size", pmem_size_setup);
726
727static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
728
729static int __init pmem_adsp_size_setup(char *p)
730{
731 pmem_adsp_size = memparse(p, NULL);
732 return 0;
733}
734early_param("pmem_adsp_size", pmem_adsp_size_setup);
735
736static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
737
738static int __init pmem_audio_size_setup(char *p)
739{
740 pmem_audio_size = memparse(p, NULL);
741 return 0;
742}
743early_param("pmem_audio_size", pmem_audio_size_setup);
744#endif
745
746#ifdef CONFIG_ANDROID_PMEM
747static struct android_pmem_platform_data android_pmem_pdata = {
748 .name = "pmem",
749 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
750 .cached = 1,
751 .memory_type = MEMTYPE_EBI1,
752};
753
754static struct platform_device android_pmem_device = {
755 .name = "android_pmem",
756 .id = 0,
757 .dev = {.platform_data = &android_pmem_pdata},
758};
759
760static struct android_pmem_platform_data android_pmem_adsp_pdata = {
761 .name = "pmem_adsp",
762 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
763 .cached = 0,
764 .memory_type = MEMTYPE_EBI1,
765};
766static struct platform_device android_pmem_adsp_device = {
767 .name = "android_pmem",
768 .id = 2,
769 .dev = { .platform_data = &android_pmem_adsp_pdata },
770};
771
772static struct android_pmem_platform_data android_pmem_audio_pdata = {
773 .name = "pmem_audio",
774 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
775 .cached = 0,
776 .memory_type = MEMTYPE_EBI1,
777};
778
779static struct platform_device android_pmem_audio_device = {
780 .name = "android_pmem",
781 .id = 4,
782 .dev = { .platform_data = &android_pmem_audio_pdata },
783};
784#endif
785
786static struct memtype_reserve msm8960_reserve_table[] __initdata = {
787 [MEMTYPE_SMI] = {
788 },
789 [MEMTYPE_EBI0] = {
790 .flags = MEMTYPE_FLAGS_1M_ALIGN,
791 },
792 [MEMTYPE_EBI1] = {
793 .flags = MEMTYPE_FLAGS_1M_ALIGN,
794 },
795};
796
797static void __init size_pmem_devices(void)
798{
799#ifdef CONFIG_ANDROID_PMEM
800 android_pmem_adsp_pdata.size = pmem_adsp_size;
801 android_pmem_pdata.size = pmem_size;
802 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
803#endif
804}
805
806static void __init reserve_memory_for(struct android_pmem_platform_data *p)
807{
808 msm8960_reserve_table[p->memory_type].size += p->size;
809}
810
811static void __init reserve_pmem_memory(void)
812{
813#ifdef CONFIG_ANDROID_PMEM
814 reserve_memory_for(&android_pmem_adsp_pdata);
815 reserve_memory_for(&android_pmem_pdata);
816 reserve_memory_for(&android_pmem_audio_pdata);
817 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
818#endif
819}
820
Larry Basselb4126da2011-07-18 14:31:33 -0700821static int msm8960_paddr_to_memtype(unsigned int paddr)
822{
823 return MEMTYPE_EBI1;
824}
825
Laura Abbottd6183792011-08-19 13:42:24 -0700826#ifdef CONFIG_ION_MSM
827struct ion_platform_data ion_pdata = {
828 .nr = 3,
829 .heaps = {
830 {
831 .id = ION_HEAP_SYSTEM_ID,
832 .type = ION_HEAP_TYPE_SYSTEM,
833 .name = ION_KMALLOC_HEAP_NAME,
834 },
835 {
836 .id = ION_HEAP_SYSTEM_CONTIG_ID,
837 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
838 .name = ION_VMALLOC_HEAP_NAME,
839 },
840 {
841 .id = ION_HEAP_EBI_ID,
842 .type = ION_HEAP_TYPE_CARVEOUT,
843 .name = ION_EBI1_HEAP_NAME,
844 .size = MSM_ION_EBI_SIZE,
845 .memory_type = ION_EBI_TYPE,
846 },
847 }
848};
849
850struct platform_device ion_dev = {
851 .name = "ion-msm",
852 .id = 1,
853 .dev = { .platform_data = &ion_pdata },
854};
855#endif
856
857static void reserve_ion_memory(void)
858{
859#ifdef CONFIG_ION_MSM
860 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
861#endif
862}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700863static void __init msm8960_calculate_reserve_sizes(void)
864{
865 size_pmem_devices();
866 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700867 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700868}
869
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870static struct reserve_info msm8960_reserve_info __initdata = {
871 .memtype_reserve_table = msm8960_reserve_table,
872 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
873 .paddr_to_memtype = msm8960_paddr_to_memtype,
874};
875
Larry Basselb4126da2011-07-18 14:31:33 -0700876static int msm8960_memory_bank_size(void)
877{
878 return 1<<29;
879}
880
881static void __init locate_unstable_memory(void)
882{
883 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
884 unsigned long bank_size;
885 unsigned long low, high;
886
887 bank_size = msm8960_memory_bank_size();
888 low = meminfo.bank[0].start;
889 high = mb->start + mb->size;
890 low &= ~(bank_size - 1);
891
892 if (high - low <= bank_size)
893 return;
894 msm8960_reserve_info.low_unstable_address = low + bank_size;
895 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
896 msm8960_reserve_info.bank_size = bank_size;
897 pr_info("low unstable address %lx max size %lx bank size %lx\n",
898 msm8960_reserve_info.low_unstable_address,
899 msm8960_reserve_info.max_unstable_size,
900 msm8960_reserve_info.bank_size);
901}
902
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903static void __init msm8960_reserve(void)
904{
905 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700906 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700907 msm_reserve();
908}
909
Larry Bassela4414b12011-08-04 11:11:02 -0700910static int msm8960_change_memory_power(u64 start, u64 size,
911 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700912{
Larry Bassela4414b12011-08-04 11:11:02 -0700913 return size;
Larry Bassela7eadea2011-07-14 10:46:00 -0700914}
915
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700916#ifdef CONFIG_MSM_CAMERA
917
Nishant Pandit24153d82011-08-27 16:05:13 +0530918static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700919 5, /*CAMIF_MCLK*/
920 20, /*CAMIF_I2C_DATA*/
921 21, /*CAMIF_I2C_CLK*/
922};
923
Nishant Pandit24153d82011-08-27 16:05:13 +0530924static struct msm_camera_gpio_conf gpio_conf = {
925 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
926 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
927 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
928 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
929};
930
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700931#define VFE_CAMIF_TIMER1_GPIO 2
932#define VFE_CAMIF_TIMER2_GPIO 3
933#define VFE_CAMIF_TIMER3_GPIO_INT 4
934struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
935 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
936 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
937 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
938 .flash_recharge_duration = 50000,
939 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
940};
941
Nishant Pandit474f2252011-07-23 23:17:56 +0530942#ifdef CONFIG_MSM_CAMERA_FLASH
943static struct msm_camera_sensor_flash_src msm_flash_src = {
944 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
945 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
946 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
947#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
948 defined(CONFIG_GPIO_SX150X_MODULE))
949 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
950#endif
951};
952#endif
953
Nishant Pandit24153d82011-08-27 16:05:13 +0530954struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
955 {
956 .ioclk.mclk_clk_rate = 24000000,
957 .ioclk.vfe_clk_rate = 228570000,
958 .csid_core = 0,
959 },
960 {
961 .ioclk.mclk_clk_rate = 24000000,
962 .ioclk.vfe_clk_rate = 228570000,
963 .csid_core = 1,
964 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700965};
966
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -0700967#ifdef CONFIG_IMX074_ACT
968static struct i2c_board_info imx074_actuator_i2c_info = {
969 I2C_BOARD_INFO("imx074_act", 0x11),
970};
971
972static struct msm_actuator_info imx074_actuator_info = {
973 .board_info = &imx074_actuator_i2c_info,
974 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
975 .vcm_pwd = 0,
976 .vcm_enable = 1,
977};
978#endif
979
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700980#ifdef CONFIG_IMX074
981static struct msm_camera_sensor_flash_data flash_imx074 = {
982 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530983#ifdef CONFIG_MSM_CAMERA_FLASH
984 .flash_src = &msm_flash_src
985#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700986};
987
Nishant Pandit24153d82011-08-27 16:05:13 +0530988static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
989 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700990 .sensor_reset = 107,
991 .sensor_pwd = 85,
992 .vcm_pwd = 0,
993 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +0530994};
995
996static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
997 .sensor_name = "imx074",
998 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999 .flash_data = &flash_imx074,
1000 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301001 .sensor_platform_info = &sensor_board_info_imx074,
1002 .gpio_conf = &gpio_conf,
1003 .csi_if = 1,
1004 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001005#ifdef CONFIG_IMX074_ACT
1006 .actuator_info = &imx074_actuator_info
1007#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001008};
1009
1010struct platform_device msm8960_camera_sensor_imx074 = {
1011 .name = "msm_camera_imx074",
1012 .dev = {
1013 .platform_data = &msm_camera_sensor_imx074_data,
1014 },
1015};
1016#endif
1017#ifdef CONFIG_OV2720
1018static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001019 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001020};
1021
Nishant Pandit24153d82011-08-27 16:05:13 +05301022static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1023 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001024 .sensor_reset = 76,
1025 .sensor_pwd = 85,
1026 .vcm_pwd = 0,
1027 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301028};
1029
1030static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1031 .sensor_name = "ov2720",
1032 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001033 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301034 .sensor_platform_info = &sensor_board_info_ov2720,
1035 .gpio_conf = &gpio_conf,
1036 .csi_if = 1,
1037 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001038};
1039
1040struct platform_device msm8960_camera_sensor_ov2720 = {
1041 .name = "msm_camera_ov2720",
1042 .dev = {
1043 .platform_data = &msm_camera_sensor_ov2720_data,
1044 },
1045};
1046#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001047
1048static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1049 .flash_type = MSM_CAMERA_FLASH_LED,
1050};
1051
Nishant Pandit24153d82011-08-27 16:05:13 +05301052static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1053 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001054 .sensor_reset = 107,
1055 .sensor_pwd = 85,
1056 .vcm_pwd = 0,
1057 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301058};
1059
1060static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1061 .sensor_name = "qs_mt9p017",
1062 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001063 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301064 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1065 .gpio_conf = &gpio_conf,
1066 .csi_if = 1,
1067 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001068};
1069
1070struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1071 .name = "msm_camera_qs_mt9p017",
1072 .dev = {
1073 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1074 },
1075};
1076
Kevin Chan8b0d2322011-09-10 21:06:31 -07001077static struct msm8960_privacy_light_cfg privacy_light_info = {
1078 .mpp = PM8921_MPP_PM_TO_SYS(12),
1079};
1080
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001081static void __init msm8960_init_cam(void)
1082{
1083 int i;
1084 struct platform_device *cam_dev[] = {
1085 &msm8960_camera_sensor_imx074,
1086 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001087 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001088 };
1089
Kevin Chan8b0d2322011-09-10 21:06:31 -07001090 if (machine_is_msm8960_liquid()) {
1091 struct msm_camera_sensor_info *s_info;
1092 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1093 s_info->sensor_platform_info->mount_angle = 180;
1094 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1095 s_info->sensor_platform_info->privacy_light = 1;
1096 s_info->sensor_platform_info->privacy_light_info =
1097 &privacy_light_info;
1098 }
1099
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001100 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1101 struct msm_camera_sensor_info *s_info;
1102 s_info = cam_dev[i]->dev.platform_data;
1103 msm_get_cam_resources(s_info);
1104 platform_device_register(cam_dev[i]);
1105 }
1106}
1107#endif
1108
1109#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001110#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001111#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001112#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001113#endif
1114
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001115
1116#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001117#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001118#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001119#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1120#else
1121#define MSM_FB_EXT_BUF_SIZE 0
1122#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001123
kuogee hsieh3830eb92011-09-12 15:25:57 -07001124#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1125/* width x height x 3 bpp x 2 frame buffer */
1126#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1127#define MSM_FB_WRITEBACK_OFFSET \
1128 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1129#else
1130#define MSM_FB_WRITEBACK_SIZE 0
1131#define MSM_FB_WRITEBACK_OFFSET 0
1132#endif
1133
1134
1135/* Note: must be multiple of 4096 */
1136#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1137 MSM_FB_WRITEBACK_SIZE, 4096)
1138
1139static int writeback_offset(void)
1140{
1141 return MSM_FB_WRITEBACK_OFFSET;
1142}
1143
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001144
1145#define MDP_VSYNC_GPIO 0
1146
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001147#define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga"
1148#define TOSHIBA_PANEL_NAME_LEN 24
1149#define CHIMEI_PANEL_NAME "mipi_chimei_wxga"
1150#define CHIMEI_PANEL_NAME_LEN 16
1151
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001152static struct resource msm_fb_resources[] = {
1153 {
1154 .flags = IORESOURCE_DMA,
1155 }
1156};
1157
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001158#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1159static int msm_fb_detect_panel(const char *name)
1160{
1161 if (machine_is_msm8960_liquid()) {
1162 if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN))
1163 return 0;
1164 } else {
1165 if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN))
1166 return 0;
1167 }
1168
1169 pr_warning("%s: not supported '%s'", __func__, name);
1170
1171 return -ENODEV;
1172}
1173
1174static struct msm_fb_platform_data msm_fb_pdata = {
1175 .detect_client = msm_fb_detect_panel,
1176};
1177#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
1178
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001179static struct platform_device msm_fb_device = {
1180 .name = "msm_fb",
1181 .id = 0,
1182 .num_resources = ARRAY_SIZE(msm_fb_resources),
1183 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001184#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1185 .dev.platform_data = &msm_fb_pdata,
1186#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001187};
1188
1189static bool dsi_power_on;
1190
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001191/**
1192 * LiQUID panel on/off
1193 *
1194 * @param on
1195 *
1196 * @return int
1197 */
1198static int mipi_dsi_liquid_panel_power(int on)
1199{
1200 static struct regulator *reg_l2, *reg_ext_3p3v;
1201 static int gpio21, gpio24, gpio43;
1202 int rc;
1203
1204 pr_info("%s: on=%d\n", __func__, on);
1205
1206 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1207 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1208 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1209
1210 if (!dsi_power_on) {
1211
1212 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1213 "dsi_vdda");
1214 if (IS_ERR(reg_l2)) {
1215 pr_err("could not get 8921_l2, rc = %ld\n",
1216 PTR_ERR(reg_l2));
1217 return -ENODEV;
1218 }
1219
1220 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1221 if (rc) {
1222 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1223 return -EINVAL;
1224 }
1225
1226 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1227 "vdd_lvds_3p3v");
1228 if (IS_ERR(reg_ext_3p3v)) {
1229 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1230 PTR_ERR(reg_ext_3p3v));
1231 return -ENODEV;
1232 }
1233
1234 rc = gpio_request(gpio21, "disp_pwr_en_n");
1235 if (rc) {
1236 pr_err("request gpio 21 failed, rc=%d\n", rc);
1237 return -ENODEV;
1238 }
1239
1240 rc = gpio_request(gpio43, "disp_rst_n");
1241 if (rc) {
1242 pr_err("request gpio 43 failed, rc=%d\n", rc);
1243 return -ENODEV;
1244 }
1245
1246 rc = gpio_request(gpio24, "disp_backlight_pwm");
1247 if (rc) {
1248 pr_err("request gpio 24 failed, rc=%d\n", rc);
1249 return -ENODEV;
1250 }
1251
1252 dsi_power_on = true;
1253 }
1254
1255 if (on) {
1256 rc = regulator_set_optimum_mode(reg_l2, 100000);
1257 if (rc < 0) {
1258 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1259 return -EINVAL;
1260 }
1261 rc = regulator_enable(reg_l2);
1262 if (rc) {
1263 pr_err("enable l2 failed, rc=%d\n", rc);
1264 return -ENODEV;
1265 }
1266
1267 rc = regulator_enable(reg_ext_3p3v);
1268 if (rc) {
1269 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1270 return -ENODEV;
1271 }
1272
1273 /* set reset pin before power enable */
1274 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1275
1276 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1277 msleep(20);
1278 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1279 msleep(20);
1280 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1281 msleep(20);
1282 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1283 msleep(20);
1284 } else {
1285 gpio_set_value_cansleep(gpio43, 0);
1286 gpio_set_value_cansleep(gpio21, 1);
1287
1288 rc = regulator_disable(reg_l2);
1289 if (rc) {
1290 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1291 return -ENODEV;
1292 }
1293 rc = regulator_disable(reg_ext_3p3v);
1294 if (rc) {
1295 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1296 return -ENODEV;
1297 }
1298 rc = regulator_set_optimum_mode(reg_l2, 100);
1299 if (rc < 0) {
1300 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1301 return -EINVAL;
1302 }
1303 }
1304
1305 return 0;
1306}
1307
1308static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001309{
1310 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001311 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001312 int rc;
1313
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001314 pr_info("%s: state : %d\n", __func__, on);
1315
1316 if (!dsi_power_on) {
1317
1318 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1319 "dsi_vdc");
1320 if (IS_ERR(reg_l8)) {
1321 pr_err("could not get 8921_l8, rc = %ld\n",
1322 PTR_ERR(reg_l8));
1323 return -ENODEV;
1324 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001325 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1326 "dsi_vddio");
1327 if (IS_ERR(reg_l23)) {
1328 pr_err("could not get 8921_l23, rc = %ld\n",
1329 PTR_ERR(reg_l23));
1330 return -ENODEV;
1331 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001332 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1333 "dsi_vdda");
1334 if (IS_ERR(reg_l2)) {
1335 pr_err("could not get 8921_l2, rc = %ld\n",
1336 PTR_ERR(reg_l2));
1337 return -ENODEV;
1338 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001339 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1340 if (rc) {
1341 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1342 return -EINVAL;
1343 }
1344 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1345 if (rc) {
1346 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1347 return -EINVAL;
1348 }
1349 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1350 if (rc) {
1351 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1352 return -EINVAL;
1353 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001354 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1355 rc = gpio_request(gpio43, "disp_rst_n");
1356 if (rc) {
1357 pr_err("request gpio 43 failed, rc=%d\n", rc);
1358 return -ENODEV;
1359 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360 dsi_power_on = true;
1361 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001362 if (on) {
1363 rc = regulator_set_optimum_mode(reg_l8, 100000);
1364 if (rc < 0) {
1365 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1366 return -EINVAL;
1367 }
1368 rc = regulator_set_optimum_mode(reg_l23, 100000);
1369 if (rc < 0) {
1370 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1371 return -EINVAL;
1372 }
1373 rc = regulator_set_optimum_mode(reg_l2, 100000);
1374 if (rc < 0) {
1375 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1376 return -EINVAL;
1377 }
1378 rc = regulator_enable(reg_l8);
1379 if (rc) {
1380 pr_err("enable l8 failed, rc=%d\n", rc);
1381 return -ENODEV;
1382 }
1383 rc = regulator_enable(reg_l23);
1384 if (rc) {
1385 pr_err("enable l8 failed, rc=%d\n", rc);
1386 return -ENODEV;
1387 }
1388 rc = regulator_enable(reg_l2);
1389 if (rc) {
1390 pr_err("enable l2 failed, rc=%d\n", rc);
1391 return -ENODEV;
1392 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001393 gpio_set_value_cansleep(gpio43, 1);
1394 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001395 rc = regulator_disable(reg_l2);
1396 if (rc) {
1397 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1398 return -ENODEV;
1399 }
1400 rc = regulator_disable(reg_l8);
1401 if (rc) {
1402 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1403 return -ENODEV;
1404 }
1405 rc = regulator_disable(reg_l23);
1406 if (rc) {
1407 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1408 return -ENODEV;
1409 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001410 rc = regulator_set_optimum_mode(reg_l8, 100);
1411 if (rc < 0) {
1412 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1413 return -EINVAL;
1414 }
1415 rc = regulator_set_optimum_mode(reg_l23, 100);
1416 if (rc < 0) {
1417 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1418 return -EINVAL;
1419 }
1420 rc = regulator_set_optimum_mode(reg_l2, 100);
1421 if (rc < 0) {
1422 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1423 return -EINVAL;
1424 }
1425 gpio_set_value_cansleep(gpio43, 0);
1426 }
1427 return 0;
1428}
1429
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001430static int mipi_dsi_panel_power(int on)
1431{
1432 int ret;
1433
1434 pr_info("%s: on=%d\n", __func__, on);
1435
1436 if (machine_is_msm8960_liquid())
1437 ret = mipi_dsi_liquid_panel_power(on);
1438 else
1439 ret = mipi_dsi_cdp_panel_power(on);
1440
1441 return ret;
1442}
1443
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001444static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1445 .vsync_gpio = MDP_VSYNC_GPIO,
1446 .dsi_power_save = mipi_dsi_panel_power,
1447};
1448
1449#ifdef CONFIG_MSM_BUS_SCALING
1450
1451static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001452 {
1453 .src = MSM_BUS_MASTER_MDP_PORT0,
1454 .dst = MSM_BUS_SLAVE_EBI_CH0,
1455 .ab = 0,
1456 .ib = 0,
1457 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001458};
1459
1460static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001461 {
1462 .src = MSM_BUS_MASTER_MDP_PORT0,
1463 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001464 .ab = 216000000 * 2,
1465 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001466 },
1467};
1468
1469static struct msm_bus_vectors mdp_vga_vectors[] = {
1470 /* VGA and less video */
1471 {
1472 .src = MSM_BUS_MASTER_MDP_PORT0,
1473 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001474 .ab = 216000000 * 2,
1475 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001476 },
1477};
1478
1479static struct msm_bus_vectors mdp_720p_vectors[] = {
1480 /* 720p and less video */
1481 {
1482 .src = MSM_BUS_MASTER_MDP_PORT0,
1483 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001484 .ab = 230400000 * 2,
1485 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001486 },
1487};
1488
1489static struct msm_bus_vectors mdp_1080p_vectors[] = {
1490 /* 1080p and less video */
1491 {
1492 .src = MSM_BUS_MASTER_MDP_PORT0,
1493 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001494 .ab = 334080000 * 2,
1495 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001496 },
1497};
1498
1499static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1500 {
1501 ARRAY_SIZE(mdp_init_vectors),
1502 mdp_init_vectors,
1503 },
1504 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001505 ARRAY_SIZE(mdp_ui_vectors),
1506 mdp_ui_vectors,
1507 },
1508 {
1509 ARRAY_SIZE(mdp_ui_vectors),
1510 mdp_ui_vectors,
1511 },
1512 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001513 ARRAY_SIZE(mdp_vga_vectors),
1514 mdp_vga_vectors,
1515 },
1516 {
1517 ARRAY_SIZE(mdp_720p_vectors),
1518 mdp_720p_vectors,
1519 },
1520 {
1521 ARRAY_SIZE(mdp_1080p_vectors),
1522 mdp_1080p_vectors,
1523 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001524};
1525
1526static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1527 mdp_bus_scale_usecases,
1528 ARRAY_SIZE(mdp_bus_scale_usecases),
1529 .name = "mdp",
1530};
1531
1532#endif
1533
1534int mdp_core_clk_rate_table[] = {
1535 85330000,
1536 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001537 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001538 200000000,
1539};
1540
1541static struct msm_panel_common_pdata mdp_pdata = {
1542 .gpio = MDP_VSYNC_GPIO,
1543 .mdp_core_clk_rate = 85330000,
1544 .mdp_core_clk_table = mdp_core_clk_rate_table,
1545 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1546#ifdef CONFIG_MSM_BUS_SCALING
1547 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1548#endif
1549 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001550 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001551};
1552
1553static struct platform_device mipi_dsi_renesas_panel_device = {
1554 .name = "mipi_renesas",
1555 .id = 0,
1556};
1557
1558static struct platform_device mipi_dsi_simulator_panel_device = {
1559 .name = "mipi_simulator",
1560 .id = 0,
1561};
1562
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001563#define LPM_CHANNEL0 0
1564static int toshiba_gpio[] = {LPM_CHANNEL0};
1565
1566static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1567 .gpio = toshiba_gpio,
1568};
1569
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001570static struct platform_device mipi_dsi_toshiba_panel_device = {
1571 .name = "mipi_toshiba",
1572 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001573 .dev = {
1574 .platform_data = &toshiba_pdata,
1575 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001576};
1577
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001578static int dsi2lvds_gpio[2] = {
1579 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1580 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1581 };
1582
1583static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1584 .gpio_num = dsi2lvds_gpio,
1585};
1586
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001587static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1588
1589/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1590 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1591 /* timing */
1592 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1593 0x0c, 0x03, 0x04, 0xa0},
1594 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1595 {0xff, 0x00, 0x06, 0x00}, /* strength */
1596 /* pll control */
1597 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1598 0x40, 0x07, 0x03,
1599 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1600};
1601
1602static struct mipi_dsi_panel_platform_data novatek_pdata = {
1603 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1604};
1605
1606static struct platform_device mipi_dsi_novatek_panel_device = {
1607 .name = "mipi_novatek",
1608 .id = 0,
1609 .dev = {
1610 .platform_data = &novatek_pdata,
1611 }
1612};
1613
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001614static struct platform_device mipi_dsi2lvds_bridge_device = {
1615 .name = "mipi_tc358764",
1616 .id = 0,
1617 .dev.platform_data = &mipi_dsi2lvds_pdata,
1618};
1619
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001620#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1621static struct resource hdmi_msm_resources[] = {
1622 {
1623 .name = "hdmi_msm_qfprom_addr",
1624 .start = 0x00700000,
1625 .end = 0x007060FF,
1626 .flags = IORESOURCE_MEM,
1627 },
1628 {
1629 .name = "hdmi_msm_hdmi_addr",
1630 .start = 0x04A00000,
1631 .end = 0x04A00FFF,
1632 .flags = IORESOURCE_MEM,
1633 },
1634 {
1635 .name = "hdmi_msm_irq",
1636 .start = HDMI_IRQ,
1637 .end = HDMI_IRQ,
1638 .flags = IORESOURCE_IRQ,
1639 },
1640};
1641
1642static int hdmi_enable_5v(int on);
1643static int hdmi_core_power(int on, int show);
1644static int hdmi_cec_power(int on);
1645
1646static struct msm_hdmi_platform_data hdmi_msm_data = {
1647 .irq = HDMI_IRQ,
1648 .enable_5v = hdmi_enable_5v,
1649 .core_power = hdmi_core_power,
1650 .cec_power = hdmi_cec_power,
1651};
1652
1653static struct platform_device hdmi_msm_device = {
1654 .name = "hdmi_msm",
1655 .id = 0,
1656 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1657 .resource = hdmi_msm_resources,
1658 .dev.platform_data = &hdmi_msm_data,
1659};
1660#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1661
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001662#ifdef CONFIG_MSM_BUS_SCALING
1663static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1664 {
1665 .src = MSM_BUS_MASTER_MDP_PORT0,
1666 .dst = MSM_BUS_SLAVE_EBI_CH0,
1667 .ab = 0,
1668 .ib = 0,
1669 },
1670};
1671static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1672 {
1673 .src = MSM_BUS_MASTER_MDP_PORT0,
1674 .dst = MSM_BUS_SLAVE_EBI_CH0,
1675 .ab = 566092800 * 2,
1676 .ib = 707616000 * 2,
1677 },
1678};
1679static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1680 {
1681 ARRAY_SIZE(dtv_bus_init_vectors),
1682 dtv_bus_init_vectors,
1683 },
1684 {
1685 ARRAY_SIZE(dtv_bus_def_vectors),
1686 dtv_bus_def_vectors,
1687 },
1688};
1689static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1690 dtv_bus_scale_usecases,
1691 ARRAY_SIZE(dtv_bus_scale_usecases),
1692 .name = "dtv",
1693};
1694
1695static struct lcdc_platform_data dtv_pdata = {
1696 .bus_scale_table = &dtv_bus_scale_pdata,
1697};
1698#endif
1699
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001700static void __init msm_fb_add_devices(void)
1701{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001702 struct platform_device *ptr = NULL;
1703
1704 if (machine_is_msm8960_liquid())
1705 ptr = &mipi_dsi2lvds_bridge_device;
1706 else
1707 ptr = &mipi_dsi_toshiba_panel_device;
1708 platform_add_devices(&ptr, 1);
1709
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001710 if (machine_is_msm8x60_rumi3()) {
1711 msm_fb_register_device("mdp", NULL);
1712 mipi_dsi_pdata.target_type = 1;
1713 } else
1714 msm_fb_register_device("mdp", &mdp_pdata);
1715 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001716#ifdef CONFIG_MSM_BUS_SCALING
1717 msm_fb_register_device("dtv", &dtv_pdata);
1718#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001719}
1720
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001721static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1722 .func = GPIOMUX_FUNC_GPIO,
1723 .drv = GPIOMUX_DRV_2MA,
1724 .pull = GPIOMUX_PULL_DOWN,
1725};
1726
1727static struct gpiomux_setting mdp_vsync_active_cfg = {
1728 .func = GPIOMUX_FUNC_1,
1729 .drv = GPIOMUX_DRV_2MA,
1730 .pull = GPIOMUX_PULL_DOWN,
1731};
1732
1733static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1734 {
1735 .gpio = MDP_VSYNC_GPIO,
1736 .settings = {
1737 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1738 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1739 },
1740 }
1741};
1742
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001743#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1744static struct gpiomux_setting hdmi_suspend_cfg = {
1745 .func = GPIOMUX_FUNC_GPIO,
1746 .drv = GPIOMUX_DRV_2MA,
1747 .pull = GPIOMUX_PULL_DOWN,
1748};
1749
1750static struct gpiomux_setting hdmi_active_1_cfg = {
1751 .func = GPIOMUX_FUNC_1,
1752 .drv = GPIOMUX_DRV_2MA,
1753 .pull = GPIOMUX_PULL_UP,
1754};
1755
1756static struct gpiomux_setting hdmi_active_2_cfg = {
1757 .func = GPIOMUX_FUNC_1,
1758 .drv = GPIOMUX_DRV_2MA,
1759 .pull = GPIOMUX_PULL_DOWN,
1760};
1761
1762static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1763 {
1764 .gpio = 99,
1765 .settings = {
1766 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1767 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1768 },
1769 },
1770 {
1771 .gpio = 100,
1772 .settings = {
1773 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1774 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1775 },
1776 },
1777 {
1778 .gpio = 101,
1779 .settings = {
1780 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1781 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1782 },
1783 },
1784 {
1785 .gpio = 102,
1786 .settings = {
1787 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1788 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1789 },
1790 },
1791};
1792
1793static int hdmi_enable_5v(int on)
1794{
1795 /* TBD: PM8921 regulator instead of 8901 */
1796 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1797 static int prev_on;
1798 int rc;
1799
1800 if (on == prev_on)
1801 return 0;
1802
1803 if (!reg_8921_hdmi_mvs)
1804 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1805 "hdmi_mvs");
1806
1807 if (on) {
1808 rc = regulator_enable(reg_8921_hdmi_mvs);
1809 if (rc) {
1810 pr_err("'%s' regulator enable failed, rc=%d\n",
1811 "8921_hdmi_mvs", rc);
1812 return rc;
1813 }
1814 pr_debug("%s(on): success\n", __func__);
1815 } else {
1816 rc = regulator_disable(reg_8921_hdmi_mvs);
1817 if (rc)
1818 pr_warning("'%s' regulator disable failed, rc=%d\n",
1819 "8921_hdmi_mvs", rc);
1820 pr_debug("%s(off): success\n", __func__);
1821 }
1822
1823 prev_on = on;
1824
1825 return 0;
1826}
1827
1828static int hdmi_core_power(int on, int show)
1829{
1830 static struct regulator *reg_8921_l23, *reg_8921_s4;
1831 static int prev_on;
1832 int rc;
1833
1834 if (on == prev_on)
1835 return 0;
1836
1837 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001838 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001839 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001840 if (IS_ERR(reg_8921_l23)) {
1841 pr_err("could not get reg_8921_l23, rc = %ld\n",
1842 PTR_ERR(reg_8921_l23));
1843 return -ENODEV;
1844 }
1845 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1846 if (rc) {
1847 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
1848 return -EINVAL;
1849 }
1850 }
1851 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001852 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001853 if (IS_ERR(reg_8921_s4)) {
1854 pr_err("could not get reg_8921_s4, rc = %ld\n",
1855 PTR_ERR(reg_8921_s4));
1856 return -ENODEV;
1857 }
1858 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1859 if (rc) {
1860 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
1861 return -EINVAL;
1862 }
1863 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001864
1865 if (on) {
1866 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1867 if (rc < 0) {
1868 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1869 return -EINVAL;
1870 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001871 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001872 if (rc) {
1873 pr_err("'%s' regulator enable failed, rc=%d\n",
1874 "hdmi_avdd", rc);
1875 return rc;
1876 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001877 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001878 if (rc) {
1879 pr_err("'%s' regulator enable failed, rc=%d\n",
1880 "hdmi_vcc", rc);
1881 return rc;
1882 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001883 rc = gpio_request(100, "HDMI_DDC_CLK");
1884 if (rc) {
1885 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1886 "HDMI_DDC_CLK", 100, rc);
1887 goto error1;
1888 }
1889 rc = gpio_request(101, "HDMI_DDC_DATA");
1890 if (rc) {
1891 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1892 "HDMI_DDC_DATA", 101, rc);
1893 goto error2;
1894 }
1895 rc = gpio_request(102, "HDMI_HPD");
1896 if (rc) {
1897 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1898 "HDMI_HPD", 102, rc);
1899 goto error3;
1900 }
1901 pr_debug("%s(on): success\n", __func__);
1902 } else {
1903 gpio_free(100);
1904 gpio_free(101);
1905 gpio_free(102);
1906
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001907 rc = regulator_disable(reg_8921_l23);
1908 if (rc) {
1909 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
1910 return -ENODEV;
1911 }
1912 rc = regulator_disable(reg_8921_s4);
1913 if (rc) {
1914 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
1915 return -ENODEV;
1916 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001917 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1918 if (rc < 0) {
1919 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1920 return -EINVAL;
1921 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001922 pr_debug("%s(off): success\n", __func__);
1923 }
1924
1925 prev_on = on;
1926
1927 return 0;
1928
1929error3:
1930 gpio_free(101);
1931error2:
1932 gpio_free(100);
1933error1:
1934 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001935 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001936 return rc;
1937}
1938
1939static int hdmi_cec_power(int on)
1940{
1941 static int prev_on;
1942 int rc;
1943
1944 if (on == prev_on)
1945 return 0;
1946
1947 if (on) {
1948 rc = gpio_request(99, "HDMI_CEC_VAR");
1949 if (rc) {
1950 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1951 "HDMI_CEC_VAR", 99, rc);
1952 goto error;
1953 }
1954 pr_debug("%s(on): success\n", __func__);
1955 } else {
1956 gpio_free(99);
1957 pr_debug("%s(off): success\n", __func__);
1958 }
1959
1960 prev_on = on;
1961
1962 return 0;
1963error:
1964 return rc;
1965}
1966#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1967
1968static void __init msm8960_allocate_memory_regions(void)
1969{
1970 void *addr;
1971 unsigned long size;
1972
1973 size = MSM_FB_SIZE;
1974 addr = alloc_bootmem_align(size, 0x1000);
1975 msm_fb_resources[0].start = __pa(addr);
1976 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1977 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1978 size, addr, __pa(addr));
1979
1980}
1981#ifdef CONFIG_WCD9310_CODEC
1982
1983#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1984
Patrick Lai3043fba2011-08-01 14:15:57 -07001985/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
1986 * 4 micbiases are used to power various analog and digital
1987 * microphones operating at 1800 mV. Technically, all micbiases
1988 * can source from single cfilter since all microphones operate
1989 * at the same voltage level. The arrangement below is to make
1990 * sure all cfilters are exercised. LDO_H regulator ouput level
1991 * does not need to be as high as 2.85V. It is choosen for
1992 * microphone sensitivity purpose.
1993 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001994static struct tabla_pdata tabla_platform_data = {
1995 .slimbus_slave_device = {
1996 .name = "tabla-slave",
1997 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1998 },
1999 .irq = MSM_GPIO_TO_INT(62),
2000 .irq_base = TABLA_INTERRUPT_BASE,
2001 .num_irqs = NR_TABLA_IRQS,
2002 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002003 .micbias = {
2004 .ldoh_v = TABLA_LDOH_2P85_V,
2005 .cfilt1_mv = 1800,
2006 .cfilt2_mv = 1800,
2007 .cfilt3_mv = 1800,
2008 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2009 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2010 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2011 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2012 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002013};
2014
2015static struct slim_device msm_slim_tabla = {
2016 .name = "tabla-slim",
2017 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2018 .dev = {
2019 .platform_data = &tabla_platform_data,
2020 },
2021};
2022#endif
2023
2024static struct slim_boardinfo msm_slim_devices[] = {
2025#ifdef CONFIG_WCD9310_CODEC
2026 {
2027 .bus_num = 1,
2028 .slim_slave = &msm_slim_tabla,
2029 },
2030#endif
2031 /* add more slimbus slaves as needed */
2032};
2033
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002034#define MSM_WCNSS_PHYS 0x03000000
2035#define MSM_WCNSS_SIZE 0x280000
2036
2037static struct resource resources_wcnss_wlan[] = {
2038 {
2039 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2040 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2041 .name = "wcnss_wlanrx_irq",
2042 .flags = IORESOURCE_IRQ,
2043 },
2044 {
2045 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2046 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2047 .name = "wcnss_wlantx_irq",
2048 .flags = IORESOURCE_IRQ,
2049 },
2050 {
2051 .start = MSM_WCNSS_PHYS,
2052 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2053 .name = "wcnss_mmio",
2054 .flags = IORESOURCE_MEM,
2055 },
2056};
2057
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002058static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2059 .has_48mhz_xo = 1,
2060};
2061
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002062static struct platform_device msm_device_wcnss_wlan = {
2063 .name = "wcnss_wlan",
2064 .id = 0,
2065 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2066 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002067 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002068};
2069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002070#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2071 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2072 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2073 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2074
2075#define QCE_SIZE 0x10000
2076#define QCE_0_BASE 0x18500000
2077
2078#define QCE_HW_KEY_SUPPORT 0
2079#define QCE_SHA_HMAC_SUPPORT 1
2080#define QCE_SHARE_CE_RESOURCE 1
2081#define QCE_CE_SHARED 0
2082
2083static struct resource qcrypto_resources[] = {
2084 [0] = {
2085 .start = QCE_0_BASE,
2086 .end = QCE_0_BASE + QCE_SIZE - 1,
2087 .flags = IORESOURCE_MEM,
2088 },
2089 [1] = {
2090 .name = "crypto_channels",
2091 .start = DMOV_CE_IN_CHAN,
2092 .end = DMOV_CE_OUT_CHAN,
2093 .flags = IORESOURCE_DMA,
2094 },
2095 [2] = {
2096 .name = "crypto_crci_in",
2097 .start = DMOV_CE_IN_CRCI,
2098 .end = DMOV_CE_IN_CRCI,
2099 .flags = IORESOURCE_DMA,
2100 },
2101 [3] = {
2102 .name = "crypto_crci_out",
2103 .start = DMOV_CE_OUT_CRCI,
2104 .end = DMOV_CE_OUT_CRCI,
2105 .flags = IORESOURCE_DMA,
2106 },
2107};
2108
2109static struct resource qcedev_resources[] = {
2110 [0] = {
2111 .start = QCE_0_BASE,
2112 .end = QCE_0_BASE + QCE_SIZE - 1,
2113 .flags = IORESOURCE_MEM,
2114 },
2115 [1] = {
2116 .name = "crypto_channels",
2117 .start = DMOV_CE_IN_CHAN,
2118 .end = DMOV_CE_OUT_CHAN,
2119 .flags = IORESOURCE_DMA,
2120 },
2121 [2] = {
2122 .name = "crypto_crci_in",
2123 .start = DMOV_CE_IN_CRCI,
2124 .end = DMOV_CE_IN_CRCI,
2125 .flags = IORESOURCE_DMA,
2126 },
2127 [3] = {
2128 .name = "crypto_crci_out",
2129 .start = DMOV_CE_OUT_CRCI,
2130 .end = DMOV_CE_OUT_CRCI,
2131 .flags = IORESOURCE_DMA,
2132 },
2133};
2134
2135#endif
2136
2137#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2138 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2139
2140static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2141 .ce_shared = QCE_CE_SHARED,
2142 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2143 .hw_key_support = QCE_HW_KEY_SUPPORT,
2144 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2145};
2146
2147static struct platform_device qcrypto_device = {
2148 .name = "qcrypto",
2149 .id = 0,
2150 .num_resources = ARRAY_SIZE(qcrypto_resources),
2151 .resource = qcrypto_resources,
2152 .dev = {
2153 .coherent_dma_mask = DMA_BIT_MASK(32),
2154 .platform_data = &qcrypto_ce_hw_suppport,
2155 },
2156};
2157#endif
2158
2159#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2160 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2161
2162static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2163 .ce_shared = QCE_CE_SHARED,
2164 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2165 .hw_key_support = QCE_HW_KEY_SUPPORT,
2166 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2167};
2168
2169static struct platform_device qcedev_device = {
2170 .name = "qce",
2171 .id = 0,
2172 .num_resources = ARRAY_SIZE(qcedev_resources),
2173 .resource = qcedev_resources,
2174 .dev = {
2175 .coherent_dma_mask = DMA_BIT_MASK(32),
2176 .platform_data = &qcedev_ce_hw_suppport,
2177 },
2178};
2179#endif
2180
2181
2182static int __init gpiomux_init(void)
2183{
2184 int rc;
2185
2186 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2187 if (rc) {
2188 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2189 return rc;
2190 }
2191
Nishant Pandit24153d82011-08-27 16:05:13 +05302192 msm_gpiomux_install(msm8960_cam_common_configs,
2193 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002194
2195 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002196 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002197
2198 msm_gpiomux_install(msm8960_gsbi_configs,
2199 ARRAY_SIZE(msm8960_gsbi_configs));
2200
2201 msm_gpiomux_install(msm8960_cyts_configs,
2202 ARRAY_SIZE(msm8960_cyts_configs));
2203
2204 msm_gpiomux_install(msm8960_slimbus_config,
2205 ARRAY_SIZE(msm8960_slimbus_config));
2206
2207 msm_gpiomux_install(msm8960_audio_codec_configs,
2208 ARRAY_SIZE(msm8960_audio_codec_configs));
2209
2210#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2211 msm_gpiomux_install(msm8960_hdmi_configs,
2212 ARRAY_SIZE(msm8960_hdmi_configs));
2213#endif
2214
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002215 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2216 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2217
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002218 msm_gpiomux_install(wcnss_5wire_interface,
2219 ARRAY_SIZE(wcnss_5wire_interface));
2220
2221 return 0;
2222}
2223
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002224#define MSM_SHARED_RAM_PHYS 0x80000000
2225
2226static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2227 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2228 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2229 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2230 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2231 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2232 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2233 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2234 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2235 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2236 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2237 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2238 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2239 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
2240 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2241 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
2242 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2243 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2244 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2245 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2246 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2247 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2248 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2249 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2250 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2251 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2252 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2253 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2254 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2255 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2256 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002257 {"pa_therm", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
2258 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2259 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2260 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002261};
2262
2263static struct pm8921_adc_properties pm8921_adc_data = {
2264 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2265 .bitresolution = 15,
2266 .bipolar = 0,
2267};
2268
2269static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2270 .adc_channel = pm8921_adc_channels_data,
2271 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
2272 .adc_prop = &pm8921_adc_data,
2273};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002274
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002275static void __init msm8960_map_io(void)
2276{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002277 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002278 msm_map_msm8960_io();
2279}
2280
2281static void __init msm8960_init_irq(void)
2282{
2283 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002284
2285 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002286 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002287 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002288
2289 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002290 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002291
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002292 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2293 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002294
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002295 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2296 * as they are configured as level, which does not play nice with
2297 * handle_percpu_irq.
2298 */
2299 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2300 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002301 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002302 }
2303}
2304
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002305/* MSM8960 have 5 SDCC controllers */
2306enum sdcc_controllers {
2307 SDCC1,
2308 SDCC2,
2309 SDCC3,
2310 SDCC4,
2311 SDCC5,
2312 MAX_SDCC_CONTROLLER
2313};
2314
2315/* All SDCC controllers requires VDD/VCC voltage */
2316static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2317 /* SDCC1 : eMMC card connected */
2318 [SDCC1] = {
2319 .name = "sdc_vdd",
2320 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302321 .high_vol_level = 2950000,
2322 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302323 .always_on = 1,
2324 .lpm_sup = 1,
2325 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002326 .hpm_uA = 200000, /* 200mA */
2327 },
2328 /* SDCC3 : External card slot connected */
2329 [SDCC3] = {
2330 .name = "sdc_vdd",
2331 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302332 .high_vol_level = 2950000,
2333 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002334 .hpm_uA = 600000, /* 600mA */
2335 }
2336};
2337
2338/* Only slots having eMMC card will require VCCQ voltage */
2339static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2340 /* SDCC1 : eMMC card connected */
2341 [SDCC1] = {
2342 .name = "sdc_vccq",
2343 .set_voltage_sup = 1,
2344 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302345 .high_vol_level = 1800000,
2346 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347 .hpm_uA = 200000, /* 200mA */
2348 }
2349};
2350
2351/* All SDCC controllers may require voting for VDD PAD voltage */
2352static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2353 /* SDCC3 : External card slot connected */
2354 [SDCC3] = {
2355 .name = "sdc_vddp",
2356 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302357 .high_vol_level = 2950000,
2358 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002359 .always_on = 1,
2360 .lpm_sup = 1,
2361 /* Max. Active current required is 16 mA */
2362 .hpm_uA = 16000,
2363 /*
2364 * Sleep current required is ~300 uA. But min. vote can be
2365 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2366 * during sleep.
2367 */
2368 .lpm_uA = 2000,
2369 }
2370};
2371
2372static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2373 /* SDCC1 : eMMC card connected */
2374 [SDCC1] = {
2375 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2376 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2377 },
2378 /* SDCC3 : External card slot connected */
2379 [SDCC3] = {
2380 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2381 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2382 }
2383};
2384
2385/* SDC1 pad data */
2386static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2387 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302388 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2389 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002390};
2391
2392static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2393 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2394 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2395 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2396};
2397
2398static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302399 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002400 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2401 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2402};
2403
2404static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302405 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002406 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2407 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2408};
2409
2410/* SDC3 pad data */
2411static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2412 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2413 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2414 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2415};
2416
2417static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2418 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2419 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2420 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2421};
2422
2423static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302424 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002425 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2426 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2427};
2428
2429static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302430 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002431 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2432 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2433};
2434
2435struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2436 [SDCC1] = {
2437 .on = sdc1_pad_pull_on_cfg,
2438 .off = sdc1_pad_pull_off_cfg,
2439 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2440 },
2441 [SDCC3] = {
2442 .on = sdc3_pad_pull_on_cfg,
2443 .off = sdc3_pad_pull_off_cfg,
2444 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2445 },
2446};
2447
2448struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2449 [SDCC1] = {
2450 .on = sdc1_pad_drv_on_cfg,
2451 .off = sdc1_pad_drv_off_cfg,
2452 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2453 },
2454 [SDCC3] = {
2455 .on = sdc3_pad_drv_on_cfg,
2456 .off = sdc3_pad_drv_off_cfg,
2457 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2458 },
2459};
2460
2461struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2462 [SDCC1] = {
2463 .pull = &mmc_pad_pull_data[SDCC1],
2464 .drv = &mmc_pad_drv_data[SDCC1]
2465 },
2466 [SDCC3] = {
2467 .pull = &mmc_pad_pull_data[SDCC3],
2468 .drv = &mmc_pad_drv_data[SDCC3]
2469 },
2470};
2471
2472struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2473 [SDCC1] = {
2474 .pad_data = &mmc_pad_data[SDCC1],
2475 },
2476 [SDCC3] = {
2477 .pad_data = &mmc_pad_data[SDCC3],
2478 },
2479};
2480
2481static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302482 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002483};
2484
2485static unsigned int sdc3_sup_clk_rates[] = {
2486 400000, 24000000, 48000000, 96000000
2487};
2488
2489#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2490static struct mmc_platform_data msm8960_sdc1_data = {
2491 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2492#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2493 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2494#else
2495 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2496#endif
2497 .sup_clk_table = sdc1_sup_clk_rates,
2498 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2499 .nonremovable = 1,
2500 .sdcc_v4_sup = true,
2501 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302502 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002503};
2504#endif
2505
2506#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2507static struct mmc_platform_data msm8960_sdc3_data = {
2508 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2509 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2510 .sup_clk_table = sdc3_sup_clk_rates,
2511 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302512#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002513 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302514#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002515 .sdcc_v4_sup = true,
2516 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2517 .pin_data = &mmc_slot_pin_data[SDCC3],
2518#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2519 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2520 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2521 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2522#endif
2523 .xpc_cap = 1,
2524 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2525 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302526 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002527};
2528#endif
2529
2530static void __init msm8960_init_mmc(void)
2531{
2532#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2533 /* SDC1 : eMMC card connected */
2534 msm_add_sdcc(1, &msm8960_sdc1_data);
2535#endif
2536#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2537 /* SDC3: External card slot */
2538 msm_add_sdcc(3, &msm8960_sdc3_data);
2539#endif
2540}
2541
2542static void __init msm8960_init_buses(void)
2543{
2544#ifdef CONFIG_MSM_BUS_SCALING
2545 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2546 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2547 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2548 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2549 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2550 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2551 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2552 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2553 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2554 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2555#endif
2556}
2557
2558static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2559 .max_clock_speed = 15060000,
2560};
2561
2562#ifdef CONFIG_USB_MSM_OTG_72K
2563static struct msm_otg_platform_data msm_otg_pdata;
2564#else
2565#define USB_5V_EN 42
2566static void msm_hsusb_vbus_power(bool on)
2567{
2568 int rc;
2569 static bool vbus_is_on;
2570 static struct regulator *mvs_otg_switch;
2571 struct pm_gpio param = {
2572 .direction = PM_GPIO_DIR_OUT,
2573 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2574 .output_value = 1,
2575 .pull = PM_GPIO_PULL_NO,
2576 .vin_sel = PM_GPIO_VIN_S4,
2577 .out_strength = PM_GPIO_STRENGTH_MED,
2578 .function = PM_GPIO_FUNC_NORMAL,
2579 };
2580
2581 if (vbus_is_on == on)
2582 return;
2583
2584 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002585 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2586 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002587 if (IS_ERR(mvs_otg_switch)) {
2588 pr_err("Unable to get mvs_otg_switch\n");
2589 return;
2590 }
2591
2592 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2593 "usb_5v_en");
2594 if (rc < 0) {
2595 pr_err("failed to request usb_5v_en gpio\n");
2596 goto put_mvs_otg;
2597 }
2598
2599 if (regulator_enable(mvs_otg_switch)) {
2600 pr_err("unable to enable mvs_otg_switch\n");
2601 goto free_usb_5v_en;
2602 }
2603
2604 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2605 &param);
2606 if (rc < 0) {
2607 pr_err("failed to configure usb_5v_en gpio\n");
2608 goto disable_mvs_otg;
2609 }
2610 vbus_is_on = true;
2611 return;
2612 }
2613disable_mvs_otg:
2614 regulator_disable(mvs_otg_switch);
2615free_usb_5v_en:
2616 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2617put_mvs_otg:
2618 regulator_put(mvs_otg_switch);
2619 vbus_is_on = false;
2620}
2621
2622static struct msm_otg_platform_data msm_otg_pdata = {
2623 .mode = USB_OTG,
2624 .otg_control = OTG_PMIC_CONTROL,
2625 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2626 .pclk_src_name = "dfab_usb_hs_clk",
2627 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2628 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302629 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002630};
2631#endif
2632
2633#define PID_MAGIC_ID 0x71432909
2634#define SERIAL_NUM_MAGIC_ID 0x61945374
2635#define SERIAL_NUMBER_LENGTH 127
2636#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2637
2638struct magic_num_struct {
2639 uint32_t pid;
2640 uint32_t serial_num;
2641};
2642
2643struct dload_struct {
2644 uint32_t reserved1;
2645 uint32_t reserved2;
2646 uint32_t reserved3;
2647 uint16_t reserved4;
2648 uint16_t pid;
2649 char serial_number[SERIAL_NUMBER_LENGTH];
2650 uint16_t reserved5;
2651 struct magic_num_struct magic_struct;
2652};
2653
2654static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2655{
2656 struct dload_struct __iomem *dload = 0;
2657
2658 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2659 if (!dload) {
2660 pr_err("%s: cannot remap I/O memory region: %08x\n",
2661 __func__, DLOAD_USB_BASE_ADD);
2662 return -ENXIO;
2663 }
2664
2665 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2666 __func__, dload, pid, snum);
2667 /* update pid */
2668 dload->magic_struct.pid = PID_MAGIC_ID;
2669 dload->pid = pid;
2670
2671 /* update serial number */
2672 dload->magic_struct.serial_num = 0;
2673 if (!snum) {
2674 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2675 goto out;
2676 }
2677
2678 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2679 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2680 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2681out:
2682 iounmap(dload);
2683 return 0;
2684}
2685
2686static struct android_usb_platform_data android_usb_pdata = {
2687 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2688};
2689
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002690static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691 .name = "android_usb",
2692 .id = -1,
2693 .dev = {
2694 .platform_data = &android_usb_pdata,
2695 },
2696};
2697
2698static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2699 0x03, 0x0f,
2700};
2701
2702static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2703 0x00, 0x24, 0x54, 0x10,
2704 0x09, 0x03, 0x01,
2705 0x10, 0x54, 0x30, 0x0C,
2706 0x24, 0x30, 0x0f,
2707};
2708
2709static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2710 0x00, 0x24, 0x54, 0x10,
2711 0x09, 0x07, 0x01, 0x0B,
2712 0x10, 0x54, 0x30, 0x0C,
2713 0x24, 0x30, 0x0f,
2714};
2715
2716static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2717 [0] = {
2718 .mode = MSM_SPM_MODE_CLOCK_GATING,
2719 .notify_rpm = false,
2720 .cmd = spm_wfi_cmd_sequence,
2721 },
2722 [1] = {
2723 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2724 .notify_rpm = false,
2725 .cmd = spm_power_collapse_without_rpm,
2726 },
2727 [2] = {
2728 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2729 .notify_rpm = true,
2730 .cmd = spm_power_collapse_with_rpm,
2731 },
2732};
2733
2734static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2735 [0] = {
2736 .reg_base_addr = MSM_SAW0_BASE,
2737 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2738 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2739 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2740#if defined(CONFIG_MSM_AVS_HW)
2741 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2742 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2743#endif
2744 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2745 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2746 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2747 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2748 .vctl_timeout_us = 50,
2749 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2750 .modes = msm_spm_seq_list,
2751 },
2752 [1] = {
2753 .reg_base_addr = MSM_SAW1_BASE,
2754 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2755 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2756 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2757#if defined(CONFIG_MSM_AVS_HW)
2758 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2759 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2760#endif
2761 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2762 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2763 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2764 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2765 .vctl_timeout_us = 50,
2766 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2767 .modes = msm_spm_seq_list,
2768 },
2769};
2770
2771static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2772 0x00, 0x20, 0x03, 0x20,
2773 0x00, 0x0f,
2774};
2775
2776static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2777 0x00, 0x20, 0x34, 0x64,
2778 0x48, 0x07, 0x48, 0x20,
2779 0x50, 0x64, 0x04, 0x34,
2780 0x50, 0x0f,
2781};
2782static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2783 0x00, 0x10, 0x34, 0x64,
2784 0x48, 0x07, 0x48, 0x10,
2785 0x50, 0x64, 0x04, 0x34,
2786 0x50, 0x0F,
2787};
2788
2789static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2790 [0] = {
2791 .mode = MSM_SPM_L2_MODE_RETENTION,
2792 .notify_rpm = false,
2793 .cmd = l2_spm_wfi_cmd_sequence,
2794 },
2795 [1] = {
2796 .mode = MSM_SPM_L2_MODE_GDHS,
2797 .notify_rpm = true,
2798 .cmd = l2_spm_gdhs_cmd_sequence,
2799 },
2800 [2] = {
2801 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2802 .notify_rpm = true,
2803 .cmd = l2_spm_power_off_cmd_sequence,
2804 },
2805};
2806
2807
2808static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2809 [0] = {
2810 .reg_base_addr = MSM_SAW_L2_BASE,
2811 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2812 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2813 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2814 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2815 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2816 .modes = msm_spm_l2_seq_list,
2817 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2818 },
2819};
2820
2821#define CYTTSP_TS_GPIO_IRQ 11
2822#define CYTTSP_TS_SLEEP_GPIO 50
2823#define CYTTSP_TS_RESOUT_N_GPIO 52
2824
2825/*virtual key support */
2826static ssize_t tma340_vkeys_show(struct kobject *kobj,
2827 struct kobj_attribute *attr, char *buf)
2828{
2829 return snprintf(buf, 200,
2830 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2831 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2832 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2833 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2834 "\n");
2835}
2836
2837static struct kobj_attribute tma340_vkeys_attr = {
2838 .attr = {
2839 .mode = S_IRUGO,
2840 },
2841 .show = &tma340_vkeys_show,
2842};
2843
2844static struct attribute *tma340_properties_attrs[] = {
2845 &tma340_vkeys_attr.attr,
2846 NULL
2847};
2848
2849static struct attribute_group tma340_properties_attr_group = {
2850 .attrs = tma340_properties_attrs,
2851};
2852
2853
2854static int cyttsp_platform_init(struct i2c_client *client)
2855{
2856 int rc = 0;
2857 static struct kobject *tma340_properties_kobj;
2858
2859 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2860 tma340_properties_kobj = kobject_create_and_add("board_properties",
2861 NULL);
2862 if (tma340_properties_kobj)
2863 rc = sysfs_create_group(tma340_properties_kobj,
2864 &tma340_properties_attr_group);
2865 if (!tma340_properties_kobj || rc)
2866 pr_err("%s: failed to create board_properties\n",
2867 __func__);
2868
2869 return 0;
2870}
2871
2872static struct cyttsp_regulator regulator_data[] = {
2873 {
2874 .name = "vdd",
2875 .min_uV = CY_TMA300_VTG_MIN_UV,
2876 .max_uV = CY_TMA300_VTG_MAX_UV,
2877 .load_uA = CY_TMA300_CURR_24HZ_UA,
2878 },
2879 /* TODO: Remove after runtime PM is enabled in I2C driver */
2880 {
2881 .name = "vcc_i2c",
2882 .min_uV = CY_I2C_VTG_MIN_UV,
2883 .max_uV = CY_I2C_VTG_MAX_UV,
2884 .load_uA = CY_I2C_CURR_UA,
2885 },
2886};
2887
2888static struct cyttsp_platform_data cyttsp_pdata = {
2889 .panel_maxx = 634,
2890 .panel_maxy = 1166,
2891 .disp_maxx = 616,
2892 .disp_maxy = 1023,
2893 .disp_minx = 0,
2894 .disp_miny = 16,
2895 .flags = 0x01,
2896 .gen = CY_GEN3, /* or */
2897 .use_st = CY_USE_ST,
2898 .use_mt = CY_USE_MT,
2899 .use_hndshk = CY_SEND_HNDSHK,
2900 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302901 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002902 .use_gestures = CY_USE_GESTURES,
2903 .fw_fname = "cyttsp_8960_cdp.hex",
2904 /* activate up to 4 groups
2905 * and set active distance
2906 */
2907 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2908 CY_GEST_GRP3 | CY_GEST_GRP4 |
2909 CY_ACT_DIST,
2910 /* change act_intrvl to customize the Active power state
2911 * scanning/processing refresh interval for Operating mode
2912 */
2913 .act_intrvl = CY_ACT_INTRVL_DFLT,
2914 /* change tch_tmout to customize the touch timeout for the
2915 * Active power state for Operating mode
2916 */
2917 .tch_tmout = CY_TCH_TMOUT_DFLT,
2918 /* change lp_intrvl to customize the Low Power power state
2919 * scanning/processing refresh interval for Operating mode
2920 */
2921 .lp_intrvl = CY_LP_INTRVL_DFLT,
2922 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2923 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2924 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2925 .regulator_info = regulator_data,
2926 .num_regulators = ARRAY_SIZE(regulator_data),
2927 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302928 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002929};
2930
2931static struct i2c_board_info cyttsp_info[] __initdata = {
2932 {
2933 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2934 .platform_data = &cyttsp_pdata,
2935#ifndef CY_USE_TIMER
2936 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2937#endif /* CY_USE_TIMER */
2938 },
2939};
2940
Mohan Pallaka50837382011-09-07 11:00:57 +05302941/* configuration data */
2942static const u8 mxt_config_data[] = {
2943 /* T6 Object */
2944 0, 0, 0, 0, 0, 0,
2945 /* T38 Object */
2946 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
2947 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2948 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2949 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2950 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2951 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2952 0, 0, 0, 0,
2953 /* T7 Object */
2954 10, 10, 50,
2955 /* T8 Object */
2956 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2957 /* T9 Object */
2958 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
2959 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
2960 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
2961 0, 5, 45, 46,
2962 /* T15 Object */
2963 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2964 0,
2965 /* T22 Object */
2966 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2967 0, 0, 255, 255, 255, 255, 0,
2968 /* T24 Object */
2969 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2970 0, 0, 0, 0, 0, 0, 0, 0, 0,
2971 /* T25 Object */
2972 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2973 0, 0, 0, 0,
2974 /* T27 Object */
2975 0, 0, 0, 0, 0, 0, 0,
2976 /* T28 Object */
2977 0, 0, 0, 8, 8, 8,
2978 /* T40 Object */
2979 0, 0, 0, 0, 0,
2980 /* T41 Object */
2981 0, 0, 0, 0, 0, 0,
2982 /* T43 Object */
2983 0, 0, 0, 0, 0, 0,
2984};
2985
2986#define MXT_TS_GPIO_IRQ 11
2987#define MXT_TS_LDO_EN_GPIO 50
2988#define MXT_TS_RESET_GPIO 52
2989
2990static void mxt_init_hw_liquid(void)
2991{
2992 int rc;
2993
2994 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
2995 if (rc) {
2996 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
2997 __func__, MXT_TS_GPIO_IRQ);
2998 return;
2999 }
3000
3001 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3002 if (rc) {
3003 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3004 __func__, MXT_TS_GPIO_IRQ);
3005 goto err_irq_gpio_req;
3006 }
3007
3008 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3009 if (rc) {
3010 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3011 __func__, MXT_TS_LDO_EN_GPIO);
3012 goto err_irq_gpio_req;
3013 }
3014
3015 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3016 if (rc) {
3017 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3018 __func__, MXT_TS_LDO_EN_GPIO);
3019 goto err_ldo_gpio_req;
3020 }
3021
3022 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3023 if (rc) {
3024 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3025 __func__, MXT_TS_RESET_GPIO);
3026 goto err_ldo_gpio_set_dir;
3027 }
3028
3029 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3030 if (rc) {
3031 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3032 __func__, MXT_TS_RESET_GPIO);
3033 goto err_reset_gpio_req;
3034 }
3035
3036 return;
3037
3038err_reset_gpio_req:
3039 gpio_free(MXT_TS_RESET_GPIO);
3040err_ldo_gpio_set_dir:
3041 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3042err_ldo_gpio_req:
3043 gpio_free(MXT_TS_LDO_EN_GPIO);
3044err_irq_gpio_req:
3045 gpio_free(MXT_TS_GPIO_IRQ);
3046}
3047
3048static struct mxt_platform_data mxt_platform_data = {
3049 .config = mxt_config_data,
3050 .config_length = ARRAY_SIZE(mxt_config_data),
3051 .x_line = 26,
3052 .y_line = 42,
3053 .x_size = 767,
3054 .y_size = 1365,
3055 .blen = 32,
3056 .threshold = 40,
3057 .voltage = 3300000, /* 3.3V */
3058 .orient = MXT_ROTATED_90,
3059 .irqflags = IRQF_TRIGGER_FALLING,
3060};
3061
3062static struct i2c_board_info mxt_device_info[] __initdata = {
3063 {
3064 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3065 .platform_data = &mxt_platform_data,
3066 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3067 },
3068};
3069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003070static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3071{
3072}
3073
3074static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3075 .clk_freq = 100000,
3076 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003077 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3078};
3079
3080static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3081 .clk_freq = 100000,
3082 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003083 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3084};
3085
3086static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3087 .clk_freq = 100000,
3088 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003089 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3090};
3091
3092static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3093 .clk_freq = 100000,
3094 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003095 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3096};
3097
3098static struct msm_rpm_platform_data msm_rpm_data = {
3099 .reg_base_addrs = {
3100 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3101 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3102 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3103 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3104 },
3105
3106 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3107 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3108 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3109 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3110 .msm_apps_ipc_rpm_val = 4,
3111};
3112
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003113static struct platform_device msm_rpm_device = {
3114 .name = "msm_rpm",
3115 .id = -1,
3116};
3117
3118
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003119static struct spi_board_info spi_board_info[] __initdata = {
3120 {
3121 .modalias = "ks8851",
3122 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3123 .max_speed_hz = 19200000,
3124 .bus_num = 0,
3125 .chip_select = 0,
3126 .mode = SPI_MODE_0,
3127 },
3128};
3129
3130static struct platform_device msm_device_saw_core0 = {
3131 .name = "saw-regulator",
3132 .id = 0,
3133 .dev = {
3134 .platform_data = &msm_saw_regulator_pdata_s5,
3135 },
3136};
3137
3138static struct platform_device msm_device_saw_core1 = {
3139 .name = "saw-regulator",
3140 .id = 1,
3141 .dev = {
3142 .platform_data = &msm_saw_regulator_pdata_s6,
3143 },
3144};
3145
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003146static struct tsens_platform_data msm_tsens_pdata = {
3147 .slope = 910,
3148 .tsens_factor = 1000,
3149 .hw_type = MSM_8960,
3150 .tsens_num_sensor = 5,
3151};
3152
3153static struct platform_device msm_tsens_device = {
3154 .name = "tsens8960-tm",
3155 .id = -1,
3156 .dev = {
3157 .platform_data = &msm_tsens_pdata,
3158 },
3159};
3160
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003161#ifdef CONFIG_MSM_FAKE_BATTERY
3162static struct platform_device fish_battery_device = {
3163 .name = "fish_battery",
3164};
3165#endif
3166
David Collins26f05562011-06-20 09:56:28 -07003167static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003168 .name = GPIO_REGULATOR_DEV_NAME,
3169 .id = PM8921_MPP_PM_TO_SYS(7),
3170 .dev = {
3171 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3172 },
3173};
3174
David Collins26f05562011-06-20 09:56:28 -07003175static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003176 .name = GPIO_REGULATOR_DEV_NAME,
3177 .id = 91,
3178 .dev = {
3179 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3180 },
3181};
3182
David Collinsb10be1d2011-09-02 10:29:31 -07003183static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3184 .name = GPIO_REGULATOR_DEV_NAME,
3185 .id = PM8921_GPIO_PM_TO_SYS(17),
3186 .dev = {
3187 .platform_data =
3188 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3189 },
3190};
3191
David Collins26f05562011-06-20 09:56:28 -07003192static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3193 .name = "rpm-regulator",
3194 .id = -1,
3195 .dev = {
3196 .platform_data = &msm_rpm_regulator_pdata,
3197 },
3198};
3199
David Collins4c31a872011-08-31 10:07:10 -07003200static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3201 .phys_addr_base = 0x0010C000,
3202 .reg_offsets = {
3203 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3204 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3205 },
3206 .phys_size = SZ_8K,
3207 .log_len = 4096, /* log's buffer length in bytes */
3208 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3209};
3210
3211static struct platform_device msm_rpm_log_device = {
3212 .name = "msm_rpm_log",
3213 .id = -1,
3214 .dev = {
3215 .platform_data = &msm_rpm_log_pdata,
3216 },
3217};
3218
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003219static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003220 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003221 &msm_device_smd,
3222 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303223 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003224 &msm_device_saw_core0,
3225 &msm_device_saw_core1,
3226 &msm8960_device_ext_5v_vreg,
3227 &msm8960_device_ext_l2_vreg,
3228 &msm8960_device_ssbi_pm8921,
3229 &msm8960_device_qup_spi_gsbi1,
3230 &msm8960_device_qup_i2c_gsbi3,
3231 &msm8960_device_qup_i2c_gsbi4,
3232 &msm8960_device_qup_i2c_gsbi10,
3233#ifndef CONFIG_MSM_DSPS
3234 &msm8960_device_qup_i2c_gsbi12,
3235#endif
3236 &msm_slim_ctrl,
3237 &msm_device_wcnss_wlan,
3238#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3239 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3240 &qcrypto_device,
3241#endif
3242
3243#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3244 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3245 &qcedev_device,
3246#endif
3247#ifdef CONFIG_MSM_ROTATOR
3248 &msm_rotator_device,
3249#endif
3250 &msm_device_sps,
3251#ifdef CONFIG_MSM_FAKE_BATTERY
3252 &fish_battery_device,
3253#endif
3254#ifdef CONFIG_ANDROID_PMEM
3255 &android_pmem_device,
3256 &android_pmem_adsp_device,
3257 &android_pmem_audio_device,
3258#endif
3259 &msm_fb_device,
3260 &msm_device_vidc,
3261 &msm_device_bam_dmux,
3262 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003263
3264#ifdef CONFIG_HW_RANDOM_MSM
3265 &msm_device_rng,
3266#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003267 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003268#ifdef CONFIG_ION_MSM
3269 &ion_dev,
3270#endif
David Collins4c31a872011-08-31 10:07:10 -07003271 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003272#ifdef CONFIG_MSM_QDSS
3273 &msm_etb_device,
3274 &msm_tpiu_device,
3275 &msm_funnel_device,
3276 &msm_ptm_device,
3277#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003278};
3279
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003280static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003281 &msm8960_device_otg,
3282 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003283 &msm_device_hsusb_host,
3284 &android_usb_device,
3285 &msm_device_vidc,
3286 &mipi_dsi_simulator_panel_device,
3287 &msm_bus_apps_fabric,
3288 &msm_bus_sys_fabric,
3289 &msm_bus_mm_fabric,
3290 &msm_bus_sys_fpb,
3291 &msm_bus_cpss_fpb,
3292 &msm_pcm,
3293 &msm_pcm_routing,
3294 &msm_cpudai0,
3295 &msm_cpudai1,
3296 &msm_cpudai_hdmi_rx,
3297 &msm_cpudai_bt_rx,
3298 &msm_cpudai_bt_tx,
3299 &msm_cpudai_fm_rx,
3300 &msm_cpudai_fm_tx,
3301 &msm_cpu_fe,
3302 &msm_stub_codec,
3303 &msm_voice,
3304 &msm_voip,
3305 &msm_lpa_pcm,
3306
3307#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3308 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3309 &qcrypto_device,
3310#endif
3311
3312#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3313 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3314 &qcedev_device,
3315#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003316};
3317
3318static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003319 &msm_kgsl_3d0,
3320 &msm_kgsl_2d0,
3321 &msm_kgsl_2d1,
3322 &mipi_dsi_renesas_panel_device,
3323#ifdef CONFIG_MSM_GEMINI
3324 &msm8960_gemini_device,
3325#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003326};
3327
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003328static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003329 &msm8960_device_otg,
3330 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003331 &msm_device_hsusb_host,
3332 &android_usb_device,
3333 &msm_pcm,
3334 &msm_pcm_routing,
3335 &msm_cpudai0,
3336 &msm_cpudai1,
3337 &msm_cpudai_hdmi_rx,
3338 &msm_cpudai_bt_rx,
3339 &msm_cpudai_bt_tx,
3340 &msm_cpudai_fm_rx,
3341 &msm_cpudai_fm_tx,
3342 &msm_cpu_fe,
3343 &msm_stub_codec,
3344 &msm_kgsl_3d0,
3345#ifdef CONFIG_MSM_KGSL_2D
3346 &msm_kgsl_2d0,
3347 &msm_kgsl_2d1,
3348#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003349 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003350#ifdef CONFIG_MSM_GEMINI
3351 &msm8960_gemini_device,
3352#endif
3353 &msm_voice,
3354 &msm_voip,
3355 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303356 &msm_cpudai_afe_01_rx,
3357 &msm_cpudai_afe_01_tx,
3358 &msm_cpudai_afe_02_rx,
3359 &msm_cpudai_afe_02_tx,
3360 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003361#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3362 &hdmi_msm_device,
3363#endif
3364 &msm_pcm_hostless,
3365 &msm_bus_apps_fabric,
3366 &msm_bus_sys_fabric,
3367 &msm_bus_mm_fabric,
3368 &msm_bus_sys_fpb,
3369 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003370 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003371};
3372
3373static void __init msm8960_i2c_init(void)
3374{
3375 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3376 &msm8960_i2c_qup_gsbi4_pdata;
3377
3378 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3379 &msm8960_i2c_qup_gsbi3_pdata;
3380
3381 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3382 &msm8960_i2c_qup_gsbi10_pdata;
3383
3384 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3385 &msm8960_i2c_qup_gsbi12_pdata;
3386}
3387
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003388static void __init msm8960_gfx_init(void)
3389{
3390 uint32_t soc_platform_version = socinfo_get_platform_version();
3391 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3392 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3393 msm_kgsl_3d0.dev.platform_data;
3394 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3395 320000000;
3396 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3397 266667000;
3398 }
3399}
3400
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003401static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3402 .irq_base = PM8921_IRQ_BASE,
3403 .devirq = MSM_GPIO_TO_INT(104),
3404 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3405};
3406
3407static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3408 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3409};
3410
3411static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3412 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3413};
3414
3415static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3416 .rtc_write_enable = false,
3417};
3418
3419static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3420 .pull_up = 1,
3421 .kpd_trigger_delay_us = 970,
3422 .wakeup = 1,
3423};
3424
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303425/* Rotate lock key is not available so use F1 */
3426#define KEY_ROTATE_LOCK KEY_F1
3427
3428static const unsigned int keymap_liquid[] = {
3429 KEY(0, 0, KEY_VOLUMEUP),
3430 KEY(0, 1, KEY_VOLUMEDOWN),
3431 KEY(1, 3, KEY_ROTATE_LOCK),
3432 KEY(1, 4, KEY_HOME),
3433};
3434
3435static struct matrix_keymap_data keymap_data_liquid = {
3436 .keymap_size = ARRAY_SIZE(keymap_liquid),
3437 .keymap = keymap_liquid,
3438};
3439
3440static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3441 .input_name = "keypad_8960_liquid",
3442 .input_phys_device = "keypad_8960/input0",
3443 .num_rows = 2,
3444 .num_cols = 5,
3445 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3446 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3447 .debounce_ms = 15,
3448 .scan_delay_ms = 32,
3449 .row_hold_ns = 91500,
3450 .wakeup = 1,
3451 .keymap_data = &keymap_data_liquid,
3452};
3453
3454
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003455static const unsigned int keymap[] = {
3456 KEY(0, 0, KEY_VOLUMEUP),
3457 KEY(0, 1, KEY_VOLUMEDOWN),
3458 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3459 KEY(0, 3, KEY_CAMERA_FOCUS),
3460};
3461
3462static struct matrix_keymap_data keymap_data = {
3463 .keymap_size = ARRAY_SIZE(keymap),
3464 .keymap = keymap,
3465};
3466
3467static struct pm8xxx_keypad_platform_data keypad_data = {
3468 .input_name = "keypad_8960",
3469 .input_phys_device = "keypad_8960/input0",
3470 .num_rows = 1,
3471 .num_cols = 5,
3472 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3473 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3474 .debounce_ms = 15,
3475 .scan_delay_ms = 32,
3476 .row_hold_ns = 91500,
3477 .wakeup = 1,
3478 .keymap_data = &keymap_data,
3479};
3480
3481static const unsigned int keymap_sim[] = {
3482 KEY(0, 0, KEY_7),
3483 KEY(0, 1, KEY_DOWN),
3484 KEY(0, 2, KEY_UP),
3485 KEY(0, 3, KEY_RIGHT),
3486 KEY(0, 4, KEY_ENTER),
3487 KEY(0, 5, KEY_L),
3488 KEY(0, 6, KEY_BACK),
3489 KEY(0, 7, KEY_M),
3490
3491 KEY(1, 0, KEY_LEFT),
3492 KEY(1, 1, KEY_SEND),
3493 KEY(1, 2, KEY_1),
3494 KEY(1, 3, KEY_4),
3495 KEY(1, 4, KEY_CLEAR),
3496 KEY(1, 5, KEY_MSDOS),
3497 KEY(1, 6, KEY_SPACE),
3498 KEY(1, 7, KEY_COMMA),
3499
3500 KEY(2, 0, KEY_6),
3501 KEY(2, 1, KEY_5),
3502 KEY(2, 2, KEY_8),
3503 KEY(2, 3, KEY_3),
3504 KEY(2, 4, KEY_NUMERIC_STAR),
3505 KEY(2, 5, KEY_UP),
3506 KEY(2, 6, KEY_DOWN),
3507 KEY(2, 7, KEY_LEFTSHIFT),
3508
3509 KEY(3, 0, KEY_9),
3510 KEY(3, 1, KEY_NUMERIC_POUND),
3511 KEY(3, 2, KEY_0),
3512 KEY(3, 3, KEY_2),
3513 KEY(3, 4, KEY_SLEEP),
3514 KEY(3, 5, KEY_F1),
3515 KEY(3, 6, KEY_F2),
3516 KEY(3, 7, KEY_F3),
3517
3518 KEY(4, 0, KEY_BACK),
3519 KEY(4, 1, KEY_HOME),
3520 KEY(4, 2, KEY_MENU),
3521 KEY(4, 3, KEY_VOLUMEUP),
3522 KEY(4, 4, KEY_VOLUMEDOWN),
3523 KEY(4, 5, KEY_F4),
3524 KEY(4, 6, KEY_F5),
3525 KEY(4, 7, KEY_F6),
3526
3527 KEY(5, 0, KEY_R),
3528 KEY(5, 1, KEY_T),
3529 KEY(5, 2, KEY_Y),
3530 KEY(5, 3, KEY_LEFTALT),
3531 KEY(5, 4, KEY_KPENTER),
3532 KEY(5, 5, KEY_Q),
3533 KEY(5, 6, KEY_W),
3534 KEY(5, 7, KEY_E),
3535
3536 KEY(6, 0, KEY_F),
3537 KEY(6, 1, KEY_G),
3538 KEY(6, 2, KEY_H),
3539 KEY(6, 3, KEY_CAPSLOCK),
3540 KEY(6, 4, KEY_PAGEUP),
3541 KEY(6, 5, KEY_A),
3542 KEY(6, 6, KEY_S),
3543 KEY(6, 7, KEY_D),
3544
3545 KEY(7, 0, KEY_V),
3546 KEY(7, 1, KEY_B),
3547 KEY(7, 2, KEY_N),
3548 KEY(7, 3, KEY_MENU),
3549 KEY(7, 4, KEY_PAGEDOWN),
3550 KEY(7, 5, KEY_Z),
3551 KEY(7, 6, KEY_X),
3552 KEY(7, 7, KEY_C),
3553
3554 KEY(8, 0, KEY_P),
3555 KEY(8, 1, KEY_J),
3556 KEY(8, 2, KEY_K),
3557 KEY(8, 3, KEY_INSERT),
3558 KEY(8, 4, KEY_LINEFEED),
3559 KEY(8, 5, KEY_U),
3560 KEY(8, 6, KEY_I),
3561 KEY(8, 7, KEY_O),
3562
3563 KEY(9, 0, KEY_4),
3564 KEY(9, 1, KEY_5),
3565 KEY(9, 2, KEY_6),
3566 KEY(9, 3, KEY_7),
3567 KEY(9, 4, KEY_8),
3568 KEY(9, 5, KEY_1),
3569 KEY(9, 6, KEY_2),
3570 KEY(9, 7, KEY_3),
3571
3572 KEY(10, 0, KEY_F7),
3573 KEY(10, 1, KEY_F8),
3574 KEY(10, 2, KEY_F9),
3575 KEY(10, 3, KEY_F10),
3576 KEY(10, 4, KEY_FN),
3577 KEY(10, 5, KEY_9),
3578 KEY(10, 6, KEY_0),
3579 KEY(10, 7, KEY_DOT),
3580
3581 KEY(11, 0, KEY_LEFTCTRL),
3582 KEY(11, 1, KEY_F11),
3583 KEY(11, 2, KEY_ENTER),
3584 KEY(11, 3, KEY_SEARCH),
3585 KEY(11, 4, KEY_DELETE),
3586 KEY(11, 5, KEY_RIGHT),
3587 KEY(11, 6, KEY_LEFT),
3588 KEY(11, 7, KEY_RIGHTSHIFT),
3589 KEY(0, 0, KEY_VOLUMEUP),
3590 KEY(0, 1, KEY_VOLUMEDOWN),
3591 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3592 KEY(0, 3, KEY_CAMERA_FOCUS),
3593};
3594
3595static struct matrix_keymap_data keymap_data_sim = {
3596 .keymap_size = ARRAY_SIZE(keymap_sim),
3597 .keymap = keymap_sim,
3598};
3599
3600static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3601 .input_name = "keypad_8960",
3602 .input_phys_device = "keypad_8960/input0",
3603 .num_rows = 12,
3604 .num_cols = 8,
3605 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3606 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3607 .debounce_ms = 15,
3608 .scan_delay_ms = 32,
3609 .row_hold_ns = 91500,
3610 .wakeup = 1,
3611 .keymap_data = &keymap_data_sim,
3612};
3613
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003614static int pm8921_therm_mitigation[] = {
3615 1100,
3616 700,
3617 600,
3618 325,
3619};
3620
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003621static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003622 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003623 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003624 .max_voltage = 4200,
3625 .min_voltage = 3200,
3626 .resume_voltage = 4100,
3627 .term_current = 100,
3628 .cool_temp = 10,
3629 .warm_temp = 40,
3630 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003631 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003632 .cool_bat_chg_current = 350,
3633 .warm_bat_chg_current = 350,
3634 .cool_bat_voltage = 4100,
3635 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003636 .thermal_mitigation = pm8921_therm_mitigation,
3637 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003638};
3639
3640static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3641 .priority = 0,
3642};
3643
3644static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3645 .r_sense = 10,
3646 .i_test = 2500,
3647 .v_failure = 3000,
3648 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003649};
3650
Jay Chokshide4cefb2011-08-04 18:10:44 -07003651#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3652
3653/**
3654 * 'flag' stores three values; led id, led mode, and max current of led.
3655 * The bit packing format is as follow,
3656 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3657 * led_id (1 nibble)
3658 */
3659#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3660 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3661 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3662 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3663 PM8XXX_LED_MAX_CURRENT_MASK))
3664
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003665static struct led_info pm8921_led_info[] = {
3666 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003667 .name = "led:usb",
3668 .default_trigger = "usb-online",
3669 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3670 PM8XXX_LED_MODE_MANUAL,
3671 PM8921_LC_LED_MAX_CURRENT),
3672 },
3673 [1] = {
3674 .name = "led:ac",
3675 .default_trigger = "ac-online",
3676 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3677 PM8XXX_LED_MODE_MANUAL,
3678 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003679 },
3680};
3681
3682static struct led_platform_data pm8xxx_leds_pdata = {
3683 .num_leds = ARRAY_SIZE(pm8921_led_info),
3684 .leds = pm8921_led_info,
3685};
3686
3687static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3688 .irq_pdata = &pm8xxx_irq_pdata,
3689 .gpio_pdata = &pm8xxx_gpio_pdata,
3690 .mpp_pdata = &pm8xxx_mpp_pdata,
3691 .rtc_pdata = &pm8xxx_rtc_pdata,
3692 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3693 .keypad_pdata = &keypad_data,
3694 .misc_pdata = &pm8xxx_misc_pdata,
3695 .regulator_pdatas = msm_pm8921_regulator_pdata,
3696 .charger_pdata = &pm8921_chg_pdata,
3697 .bms_pdata = &pm8921_bms_pdata,
3698 .adc_pdata = &pm8921_adc_pdata,
3699 .leds_pdata = &pm8xxx_leds_pdata,
3700};
3701
3702static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3703 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3704 .slave = {
3705 .name = "pm8921-core",
3706 .platform_data = &pm8921_platform_data,
3707 },
3708};
3709
3710static void msm8960_wcnss_init(void)
3711{
3712 int i, ret, j;
3713
3714 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3715 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3716 "wcnss_5_wire");
3717 if (ret) {
3718 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3719 wcnss_5wire_interface[i].gpio, ret);
3720 goto fail;
3721 }
3722 }
3723
3724 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3725
3726 return;
3727
3728fail:
3729 for (j = 0; j < i; j++)
3730 gpio_free(wcnss_5wire_interface[j].gpio);
3731}
3732
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003733#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003734static int ethernet_init(void)
3735{
3736 int ret;
3737 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3738 if (ret) {
3739 pr_err("ks8851 gpio_request failed: %d\n", ret);
3740 goto fail;
3741 }
3742
3743 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3744 if (ret) {
3745 pr_err("ks8851 gpio_request failed: %d\n", ret);
3746 goto fail_rst;
3747 }
3748
3749 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3750 if (ret) {
3751 pr_err("ks8851 gpio_request failed: %d\n", ret);
3752 goto fail_cs;
3753 }
3754
3755 gpio_direction_output(FPGA_CS_GPIO, 1);
3756 gpio_direction_output(KS8851_RST_GPIO, 1);
3757 return 0;
3758fail_cs:
3759 gpio_free(KS8851_RST_GPIO);
3760fail_rst:
3761 gpio_free(KS8851_IRQ_GPIO);
3762fail:
3763 return ret;
3764}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003765#else
3766static int ethernet_init(void)
3767{
3768 return 0;
3769}
3770#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003771
3772static struct msm_cpuidle_state msm_cstates[] __initdata = {
3773 {0, 0, "C0", "WFI",
3774 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3775
3776 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3777 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3778
3779 {0, 2, "C2", "POWER_COLLAPSE",
3780 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3781
3782 {1, 0, "C0", "WFI",
3783 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3784
3785 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3786 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3787};
3788
3789static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3790 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3791 .idle_supported = 1,
3792 .suspend_supported = 1,
3793 .idle_enabled = 0,
3794 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003795 },
3796
3797 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3798 .idle_supported = 1,
3799 .suspend_supported = 1,
3800 .idle_enabled = 0,
3801 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003802 },
3803
3804 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3805 .idle_supported = 1,
3806 .suspend_supported = 1,
3807 .idle_enabled = 1,
3808 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003809 },
3810
3811 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3812 .idle_supported = 0,
3813 .suspend_supported = 1,
3814 .idle_enabled = 0,
3815 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003816 },
3817
3818 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3819 .idle_supported = 1,
3820 .suspend_supported = 1,
3821 .idle_enabled = 0,
3822 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003823 },
3824
3825 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3826 .idle_supported = 1,
3827 .suspend_supported = 0,
3828 .idle_enabled = 1,
3829 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003830 },
3831};
3832
3833static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3834 {
3835 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3836 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3837 true,
3838 1, 8000, 100000, 1,
3839 },
3840
3841 {
3842 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3843 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3844 true,
3845 1500, 5000, 60100000, 3000,
3846 },
3847
3848 {
3849 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3850 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3851 false,
3852 1800, 5000, 60350000, 3500,
3853 },
3854
3855 {
3856 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3857 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3858 false,
3859 2800, 2500, 65350000, 4800,
3860 },
3861
3862 {
3863 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3864 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3865 false,
3866 3800, 4500, 67850000, 5500,
3867 },
3868
3869 {
3870 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3871 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3872 false,
3873 4800, 2000, 71850000, 6800,
3874 },
3875
3876 {
3877 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3878 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3879 false,
3880 6800, 500, 75850000, 8800,
3881 },
3882
3883 {
3884 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3885 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3886 false,
3887 7800, 0, 76350000, 9800,
3888 },
3889};
3890
3891#ifdef CONFIG_I2C
3892#define I2C_SURF 1
3893#define I2C_FFA (1 << 1)
3894#define I2C_RUMI (1 << 2)
3895#define I2C_SIM (1 << 3)
3896#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003897#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003898
3899struct i2c_registry {
3900 u8 machs;
3901 int bus;
3902 struct i2c_board_info *info;
3903 int len;
3904};
3905
3906#ifdef CONFIG_MSM_CAMERA
3907static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3908#ifdef CONFIG_IMX074
3909 {
3910 I2C_BOARD_INFO("imx074", 0x1A),
3911 },
3912#endif
3913#ifdef CONFIG_OV2720
3914 {
3915 I2C_BOARD_INFO("ov2720", 0x6C),
3916 },
3917#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003918 {
3919 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3920 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303921#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3922 {
3923 I2C_BOARD_INFO("sc628a", 0x6E),
3924 },
3925#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003926};
3927#endif
3928
3929/* Sensors DSPS platform data */
3930#ifdef CONFIG_MSM_DSPS
3931#define DSPS_PIL_GENERIC_NAME "dsps"
3932#endif /* CONFIG_MSM_DSPS */
3933
3934static void __init msm8960_init_dsps(void)
3935{
3936#ifdef CONFIG_MSM_DSPS
3937 struct msm_dsps_platform_data *pdata =
3938 msm_dsps_device.dev.platform_data;
3939 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3940 pdata->gpios = NULL;
3941 pdata->gpios_num = 0;
3942
3943 platform_device_register(&msm_dsps_device);
3944#endif /* CONFIG_MSM_DSPS */
3945}
3946
Amir Samuelov5137e392011-09-21 17:31:25 +03003947#ifdef CONFIG_ISL9519_CHARGER
3948static struct isl_platform_data isl_data __initdata = {
3949 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3950 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3951 .max_system_voltage = 4200,
3952 .min_system_voltage = 3200,
3953 .chgcurrent = 1000, /* 1900, */
3954 .term_current = 400, /* Need fine tuning */
3955 .input_current = 2048,
3956};
3957
3958static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3959 {
3960 I2C_BOARD_INFO("isl9519q", 0x9),
3961 .irq = 0, /* Not required when notify-by-pmic */
3962 .platform_data = &isl_data,
3963 },
3964};
3965#endif /* CONFIG_ISL9519_CHARGER */
3966
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003967static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3968#ifdef CONFIG_MSM_CAMERA
3969 {
Amir Samuelov05f87802011-08-27 18:30:12 +03003970 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003971 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3972 msm_camera_boardinfo,
3973 ARRAY_SIZE(msm_camera_boardinfo),
3974 },
3975#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03003976#ifdef CONFIG_ISL9519_CHARGER
3977 {
3978 I2C_LIQUID,
3979 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3980 isl_charger_i2c_info,
3981 ARRAY_SIZE(isl_charger_i2c_info),
3982 },
3983#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003984 {
3985 I2C_SURF | I2C_FFA | I2C_FLUID,
3986 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3987 cyttsp_info,
3988 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003989 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303990 {
3991 I2C_LIQUID,
3992 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3993 mxt_device_info,
3994 ARRAY_SIZE(mxt_device_info),
3995 },
3996
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003997};
3998#endif /* CONFIG_I2C */
3999
4000static void __init register_i2c_devices(void)
4001{
4002#ifdef CONFIG_I2C
4003 u8 mach_mask = 0;
4004 int i;
4005
4006 /* Build the matching 'supported_machs' bitmask */
4007 if (machine_is_msm8960_cdp())
4008 mach_mask = I2C_SURF;
4009 else if (machine_is_msm8960_rumi3())
4010 mach_mask = I2C_RUMI;
4011 else if (machine_is_msm8960_sim())
4012 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004013 else if (machine_is_msm8960_fluid())
4014 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004015 else if (machine_is_msm8960_liquid())
4016 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004017 else if (machine_is_msm8960_mtp())
4018 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004019 else
4020 pr_err("unmatched machine ID in register_i2c_devices\n");
4021
4022 /* Run the array and install devices as appropriate */
4023 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4024 if (msm8960_i2c_devices[i].machs & mach_mask)
4025 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4026 msm8960_i2c_devices[i].info,
4027 msm8960_i2c_devices[i].len);
4028 }
4029#endif
4030}
4031
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004032static void __init msm8960_sim_init(void)
4033{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004034 if (socinfo_init() < 0)
4035 pr_err("socinfo_init() failed!\n");
4036
4037 BUG_ON(msm_rpm_init(&msm_rpm_data));
4038 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4039 ARRAY_SIZE(msm_rpmrs_levels)));
4040 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004041 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004042 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004043 msm8960_device_ssbi_pm8921.dev.platform_data =
4044 &msm8960_ssbi_pm8921_pdata;
4045 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004046
4047 /* Simulator supports a QWERTY keypad */
4048 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4049
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004050 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4051 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4052 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004053 gpiomux_init();
4054 ethernet_init();
4055 msm8960_i2c_init();
4056 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4057 msm_spm_l2_init(msm_spm_l2_data);
4058 msm8960_init_buses();
4059 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4060 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004061 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004062 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004063
4064 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4065 &msm8960_qup_spi_gsbi1_pdata;
4066 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4067
4068 msm8960_init_mmc();
4069 msm_fb_add_devices();
4070 slim_register_board_info(msm_slim_devices,
4071 ARRAY_SIZE(msm_slim_devices));
4072 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4073 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4074 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4075 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004076}
4077
4078static void __init msm8960_rumi3_init(void)
4079{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004080 if (socinfo_init() < 0)
4081 pr_err("socinfo_init() failed!\n");
4082
4083 BUG_ON(msm_rpm_init(&msm_rpm_data));
4084 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4085 ARRAY_SIZE(msm_rpmrs_levels)));
4086 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004087 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004088 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004089 gpiomux_init();
4090 ethernet_init();
4091 msm8960_device_ssbi_pm8921.dev.platform_data =
4092 &msm8960_ssbi_pm8921_pdata;
4093 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4094 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4095 &msm8960_qup_spi_gsbi1_pdata;
4096 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4097 msm8960_i2c_init();
4098 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4099 msm_spm_l2_init(msm_spm_l2_data);
4100 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4101 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004102 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004103 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004104 register_i2c_devices();
4105 msm_fb_add_devices();
4106 slim_register_board_info(msm_slim_devices,
4107 ARRAY_SIZE(msm_slim_devices));
4108 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4109 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4110 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4111 msm_pm_data);
4112}
4113
4114static void __init msm8960_cdp_init(void)
4115{
4116 if (socinfo_init() < 0)
4117 pr_err("socinfo_init() failed!\n");
4118
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004119 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4120 pr_err("meminfo_init() failed!\n");
4121
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004122 BUG_ON(msm_rpm_init(&msm_rpm_data));
4123 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4124 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004125
4126 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004127 regulator_suppress_info_printing();
4128 if (msm_xo_init())
4129 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004130 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004131 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004132 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4133 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4134 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004135 gpiomux_init();
4136 ethernet_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304137 if (machine_is_msm8960_liquid())
4138 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004139 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4140 &msm8960_qup_spi_gsbi1_pdata;
4141 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4142 msm8960_device_ssbi_pm8921.dev.platform_data =
4143 &msm8960_ssbi_pm8921_pdata;
4144 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4145 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004146 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004147 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4148 msm_spm_l2_init(msm_spm_l2_data);
4149 msm8960_init_buses();
4150 platform_add_devices(msm_footswitch_devices,
4151 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004152 if (machine_is_msm8960_liquid())
4153 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004154 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4155 pm8921_gpio_mpp_init();
4156 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4157 msm8960_init_cam();
4158 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004159 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304160 if (machine_is_msm8960_liquid())
4161 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004162 register_i2c_devices();
4163 msm8960_wcnss_init();
4164 msm_fb_add_devices();
4165 slim_register_board_info(msm_slim_devices,
4166 ARRAY_SIZE(msm_slim_devices));
4167 msm8960_init_dsps();
4168 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4169 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4170 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4171 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004172 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004173}
4174
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004175MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4176 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004177 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004178 .init_irq = msm8960_init_irq,
4179 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004180 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004181 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004182MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004183
4184MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4185 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004186 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004187 .init_irq = msm8960_init_irq,
4188 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004189 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004190 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004191MACHINE_END
4192
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004193MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4194 .map_io = msm8960_map_io,
4195 .reserve = msm8960_reserve,
4196 .init_irq = msm8960_init_irq,
4197 .timer = &msm_timer,
4198 .init_machine = msm8960_cdp_init,
4199 .init_early = msm8960_allocate_memory_regions,
4200MACHINE_END
4201
4202MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4203 .map_io = msm8960_map_io,
4204 .reserve = msm8960_reserve,
4205 .init_irq = msm8960_init_irq,
4206 .timer = &msm_timer,
4207 .init_machine = msm8960_cdp_init,
4208 .init_early = msm8960_allocate_memory_regions,
4209MACHINE_END
4210
4211MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4212 .map_io = msm8960_map_io,
4213 .reserve = msm8960_reserve,
4214 .init_irq = msm8960_init_irq,
4215 .timer = &msm_timer,
4216 .init_machine = msm8960_cdp_init,
4217 .init_early = msm8960_allocate_memory_regions,
4218MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004219
4220MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4221 .map_io = msm8960_map_io,
4222 .reserve = msm8960_reserve,
4223 .init_irq = msm8960_init_irq,
4224 .timer = &msm_timer,
4225 .init_machine = msm8960_cdp_init,
4226 .init_early = msm8960_allocate_memory_regions,
4227MACHINE_END