blob: 9656b9383429eab2c236e792d4c30551f5f20000 [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),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700172 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
173 DOUT_CTRL_LOW),
174};
175
176static void __init pm8921_gpio_mpp_init(void)
177{
178 int i, rc;
179
180 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
181 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
182 &pm8921_gpios[i].config);
183 if (rc) {
184 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
185 break;
186 }
187 }
188
189 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
190 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
191 &pm8921_mpps[i].config);
192 if (rc) {
193 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
194 break;
195 }
196 }
197}
198
199#define FPGA_CS_GPIO 14
200#define KS8851_RST_GPIO 89
201#define KS8851_IRQ_GPIO 90
202
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700203#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
204enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700205 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700206 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
207 /* CAM Expander */
208 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
209 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
210 GPIO_CAM_GP_AFBUSY,
211 GPIO_CAM_GP_STROBE_CE,
212 GPIO_CAM_GP_CAM1MP_XCLR,
213 GPIO_CAM_GP_CAMIF_RESET_N,
214 GPIO_CAM_GP_XMT_FLASH_INT,
215 GPIO_CAM_GP_LED_EN1,
216 GPIO_CAM_GP_LED_EN2,
217
218};
219#endif
220
Harini Jayaraman608d0462011-08-09 19:10:03 -0600221/* The SPI configurations apply to GSBI 1*/
222static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700223 .func = GPIOMUX_FUNC_1,
224 .drv = GPIOMUX_DRV_8MA,
225 .pull = GPIOMUX_PULL_NONE,
226};
227
Harini Jayaraman608d0462011-08-09 19:10:03 -0600228static struct gpiomux_setting spi_suspended_config = {
229 .func = GPIOMUX_FUNC_GPIO,
230 .drv = GPIOMUX_DRV_2MA,
231 .pull = GPIOMUX_PULL_DOWN,
232};
233
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700234static struct gpiomux_setting gsbi3 = {
235 .func = GPIOMUX_FUNC_1,
236 .drv = GPIOMUX_DRV_8MA,
237 .pull = GPIOMUX_PULL_NONE,
238};
239
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700240static struct gpiomux_setting gsbi5 = {
241 .func = GPIOMUX_FUNC_1,
242 .drv = GPIOMUX_DRV_8MA,
243 .pull = GPIOMUX_PULL_NONE,
244};
245
246static struct gpiomux_setting gsbi10 = {
247 .func = GPIOMUX_FUNC_2,
248 .drv = GPIOMUX_DRV_8MA,
249 .pull = GPIOMUX_PULL_NONE,
250};
251
252static struct gpiomux_setting gsbi12 = {
253 .func = GPIOMUX_FUNC_1,
254 .drv = GPIOMUX_DRV_8MA,
255 .pull = GPIOMUX_PULL_NONE,
256};
257
258static struct gpiomux_setting cdc_mclk = {
259 .func = GPIOMUX_FUNC_1,
260 .drv = GPIOMUX_DRV_8MA,
261 .pull = GPIOMUX_PULL_NONE,
262};
263
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700264#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700265static struct gpiomux_setting gpio_eth_config = {
266 .pull = GPIOMUX_PULL_NONE,
267 .drv = GPIOMUX_DRV_8MA,
268 .func = GPIOMUX_FUNC_GPIO,
269};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700270#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700271
272static struct gpiomux_setting slimbus = {
273 .func = GPIOMUX_FUNC_1,
274 .drv = GPIOMUX_DRV_8MA,
275 .pull = GPIOMUX_PULL_KEEPER,
276};
277
278struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700279#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700280 {
281 .gpio = KS8851_IRQ_GPIO,
282 .settings = {
283 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
284 }
285 },
286 {
287 .gpio = KS8851_RST_GPIO,
288 .settings = {
289 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
290 }
291 },
292 {
293 .gpio = FPGA_CS_GPIO,
294 .settings = {
295 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
296 }
297 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700298#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700299};
300
301static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
302 {
303 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
304 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600305 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
306 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700307 },
308 },
309 {
310 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
311 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600312 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
313 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314 },
315 },
316 {
317 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
318 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600319 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
320 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700321 },
322 },
323 {
324 .gpio = 9, /* GSBI1 QUP SPI_CLK */
325 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600326 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
327 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700328 },
329 },
330 {
331 .gpio = 16, /* GSBI3 I2C QUP SDA */
332 .settings = {
333 [GPIOMUX_SUSPENDED] = &gsbi3,
334 },
335 },
336 {
337 .gpio = 17, /* GSBI3 I2C QUP SCL */
338 .settings = {
339 [GPIOMUX_SUSPENDED] = &gsbi3,
340 },
341 },
342 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343 .gpio = 22, /* GSBI5 UART2 */
344 .settings = {
345 [GPIOMUX_SUSPENDED] = &gsbi5,
346 },
347 },
348 {
349 .gpio = 23, /* GSBI5 UART2 */
350 .settings = {
351 [GPIOMUX_SUSPENDED] = &gsbi5,
352 },
353 },
354 {
355 .gpio = 24, /* GSBI5 UART2 */
356 .settings = {
357 [GPIOMUX_SUSPENDED] = &gsbi5,
358 },
359 },
360 {
361 .gpio = 25, /* GSBI5 UART2 */
362 .settings = {
363 [GPIOMUX_SUSPENDED] = &gsbi5,
364 },
365 },
366 {
367 .gpio = 44, /* GSBI12 I2C QUP SDA */
368 .settings = {
369 [GPIOMUX_SUSPENDED] = &gsbi12,
370 },
371 },
372 {
373 .gpio = 45, /* GSBI12 I2C QUP SCL */
374 .settings = {
375 [GPIOMUX_SUSPENDED] = &gsbi12,
376 },
377 },
378 {
379 .gpio = 73, /* GSBI10 I2C QUP SDA */
380 .settings = {
381 [GPIOMUX_SUSPENDED] = &gsbi10,
382 },
383 },
384 {
385 .gpio = 74, /* GSBI10 I2C QUP SCL */
386 .settings = {
387 [GPIOMUX_SUSPENDED] = &gsbi10,
388 },
389 },
390};
391
392static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
393 {
394 .gpio = 60, /* slimbus data */
395 .settings = {
396 [GPIOMUX_SUSPENDED] = &slimbus,
397 },
398 },
399 {
400 .gpio = 61, /* slimbus clk */
401 .settings = {
402 [GPIOMUX_SUSPENDED] = &slimbus,
403 },
404 },
405};
406
407static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
408 {
409 .gpio = 59,
410 .settings = {
411 [GPIOMUX_SUSPENDED] = &cdc_mclk,
412 },
413 },
414};
415static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
416 .func = GPIOMUX_FUNC_GPIO,
417 .drv = GPIOMUX_DRV_2MA,
418 .pull = GPIOMUX_PULL_NONE,
419};
420
421static struct gpiomux_setting wcnss_5wire_active_cfg = {
422 .func = GPIOMUX_FUNC_1,
423 .drv = GPIOMUX_DRV_6MA,
424 .pull = GPIOMUX_PULL_DOWN,
425};
426
427static struct msm_gpiomux_config wcnss_5wire_interface[] = {
428 {
429 .gpio = 84,
430 .settings = {
431 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
432 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
433 },
434 },
435 {
436 .gpio = 85,
437 .settings = {
438 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
439 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
440 },
441 },
442 {
443 .gpio = 86,
444 .settings = {
445 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
446 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
447 },
448 },
449 {
450 .gpio = 87,
451 .settings = {
452 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
453 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
454 },
455 },
456 {
457 .gpio = 88,
458 .settings = {
459 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
460 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
461 },
462 },
463};
Nishant Pandit24153d82011-08-27 16:05:13 +0530464static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530465 {
466 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
467 .drv = GPIOMUX_DRV_2MA,
468 .pull = GPIOMUX_PULL_DOWN,
469 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700470
Nishant Pandit474f2252011-07-23 23:17:56 +0530471 {
472 .func = GPIOMUX_FUNC_1, /*active 1*/
473 .drv = GPIOMUX_DRV_2MA,
474 .pull = GPIOMUX_PULL_NONE,
475 },
476
477 {
478 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
479 .drv = GPIOMUX_DRV_2MA,
480 .pull = GPIOMUX_PULL_NONE,
481 },
482
483 {
484 .func = GPIOMUX_FUNC_1, /*active 3*/
485 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700486 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530487 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530488
489 {
490 .func = GPIOMUX_FUNC_5, /*active 4*/
491 .drv = GPIOMUX_DRV_8MA,
492 .pull = GPIOMUX_PULL_UP,
493 },
494
495 {
496 .func = GPIOMUX_FUNC_6, /*active 5*/
497 .drv = GPIOMUX_DRV_8MA,
498 .pull = GPIOMUX_PULL_UP,
499 },
500
501 {
502 .func = GPIOMUX_FUNC_2, /*active 6*/
503 .drv = GPIOMUX_DRV_2MA,
504 .pull = GPIOMUX_PULL_UP,
505 },
506
507 {
508 .func = GPIOMUX_FUNC_3, /*active 7*/
509 .drv = GPIOMUX_DRV_8MA,
510 .pull = GPIOMUX_PULL_UP,
511 },
512
Kevin Chan4c58d292011-09-13 11:03:25 -0700513 {
514 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
515 .drv = GPIOMUX_DRV_2MA,
516 .pull = GPIOMUX_PULL_KEEPER,
517 },
518
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700519};
520
Nishant Pandit24153d82011-08-27 16:05:13 +0530521static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700522 {
523 .gpio = 2,
524 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530525 [GPIOMUX_ACTIVE] = &cam_settings[2],
526 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700527 },
528 },
529 {
530 .gpio = 3,
531 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530532 [GPIOMUX_ACTIVE] = &cam_settings[1],
533 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700534 },
535 },
536 {
537 .gpio = 4,
538 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530539 [GPIOMUX_ACTIVE] = &cam_settings[1],
540 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700541 },
542 },
543 {
544 .gpio = 5,
545 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530546 [GPIOMUX_ACTIVE] = &cam_settings[1],
547 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700548 },
549 },
550 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530551 .gpio = 76,
552 .settings = {
553 [GPIOMUX_ACTIVE] = &cam_settings[2],
554 [GPIOMUX_SUSPENDED] = &cam_settings[0],
555 },
556 },
557 {
558 .gpio = 107,
559 .settings = {
560 [GPIOMUX_ACTIVE] = &cam_settings[2],
561 [GPIOMUX_SUSPENDED] = &cam_settings[0],
562 },
563 },
564};
565
566static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
567 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568 .gpio = 18,
569 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530570 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700571 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700572 },
573 },
574 {
575 .gpio = 19,
576 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530577 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700578 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700579 },
580 },
581 {
582 .gpio = 20,
583 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530584 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700585 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700586 },
587 },
588 {
589 .gpio = 21,
590 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530591 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700592 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700593 },
594 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595};
596
597static struct gpiomux_setting cyts_resout_sus_cfg = {
598 .func = GPIOMUX_FUNC_GPIO,
599 .drv = GPIOMUX_DRV_6MA,
600 .pull = GPIOMUX_PULL_UP,
601};
602
603static struct gpiomux_setting cyts_resout_act_cfg = {
604 .func = GPIOMUX_FUNC_GPIO,
605 .drv = GPIOMUX_DRV_6MA,
606 .pull = GPIOMUX_PULL_UP,
607};
608
609static struct gpiomux_setting cyts_sleep_sus_cfg = {
610 .func = GPIOMUX_FUNC_GPIO,
611 .drv = GPIOMUX_DRV_6MA,
612 .pull = GPIOMUX_PULL_DOWN,
613};
614
615static struct gpiomux_setting cyts_sleep_act_cfg = {
616 .func = GPIOMUX_FUNC_GPIO,
617 .drv = GPIOMUX_DRV_6MA,
618 .pull = GPIOMUX_PULL_DOWN,
619};
620
621static struct gpiomux_setting cyts_int_act_cfg = {
622 .func = GPIOMUX_FUNC_GPIO,
623 .drv = GPIOMUX_DRV_8MA,
624 .pull = GPIOMUX_PULL_UP,
625};
626
627static struct gpiomux_setting cyts_int_sus_cfg = {
628 .func = GPIOMUX_FUNC_GPIO,
629 .drv = GPIOMUX_DRV_2MA,
630 .pull = GPIOMUX_PULL_UP,
631};
632
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700633static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
634 { /* TS INTERRUPT */
635 .gpio = 11,
636 .settings = {
637 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
638 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
639 },
640 },
641 { /* TS SLEEP */
642 .gpio = 50,
643 .settings = {
644 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
645 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
646 },
647 },
648 { /* TS RESOUT */
649 .gpio = 52,
650 .settings = {
651 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
652 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
653 },
654 },
655};
656
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700657#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
658enum {
659 SX150X_CAM,
660};
661
Nishant Pandit474f2252011-07-23 23:17:56 +0530662static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700663 [SX150X_CAM] = {
664 .gpio_base = GPIO_CAM_EXPANDER_BASE,
665 .oscio_is_gpo = false,
666 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530667 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700668 .io_open_drain_ena = 0x0,
669 .irq_summary = -1,
670 },
671};
Nishant Pandit474f2252011-07-23 23:17:56 +0530672
673#endif
674
675#ifdef CONFIG_I2C
676
677#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
678#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300679#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530680
681#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
682
683static struct i2c_board_info cam_expander_i2c_info[] = {
684 {
685 I2C_BOARD_INFO("sx1508q", 0x22),
686 .platform_data = &sx150x_data[SX150X_CAM]
687 },
688};
689
690static struct msm_cam_expander_info cam_expander_info[] = {
691 {
692 cam_expander_i2c_info,
693 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
694 },
695};
696#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700697#endif
698
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700699#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
700#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700701#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700702#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
703
Laura Abbottd6183792011-08-19 13:42:24 -0700704#define MSM_ION_EBI_SIZE SZ_8M
705
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700706#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
707static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
708static int __init pmem_kernel_ebi1_size_setup(char *p)
709{
710 pmem_kernel_ebi1_size = memparse(p, NULL);
711 return 0;
712}
713early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
714#endif
715
716#ifdef CONFIG_ANDROID_PMEM
717static unsigned pmem_size = MSM_PMEM_SIZE;
718static int __init pmem_size_setup(char *p)
719{
720 pmem_size = memparse(p, NULL);
721 return 0;
722}
723early_param("pmem_size", pmem_size_setup);
724
725static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
726
727static int __init pmem_adsp_size_setup(char *p)
728{
729 pmem_adsp_size = memparse(p, NULL);
730 return 0;
731}
732early_param("pmem_adsp_size", pmem_adsp_size_setup);
733
734static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
735
736static int __init pmem_audio_size_setup(char *p)
737{
738 pmem_audio_size = memparse(p, NULL);
739 return 0;
740}
741early_param("pmem_audio_size", pmem_audio_size_setup);
742#endif
743
744#ifdef CONFIG_ANDROID_PMEM
745static struct android_pmem_platform_data android_pmem_pdata = {
746 .name = "pmem",
747 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
748 .cached = 1,
749 .memory_type = MEMTYPE_EBI1,
750};
751
752static struct platform_device android_pmem_device = {
753 .name = "android_pmem",
754 .id = 0,
755 .dev = {.platform_data = &android_pmem_pdata},
756};
757
758static struct android_pmem_platform_data android_pmem_adsp_pdata = {
759 .name = "pmem_adsp",
760 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
761 .cached = 0,
762 .memory_type = MEMTYPE_EBI1,
763};
764static struct platform_device android_pmem_adsp_device = {
765 .name = "android_pmem",
766 .id = 2,
767 .dev = { .platform_data = &android_pmem_adsp_pdata },
768};
769
770static struct android_pmem_platform_data android_pmem_audio_pdata = {
771 .name = "pmem_audio",
772 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
773 .cached = 0,
774 .memory_type = MEMTYPE_EBI1,
775};
776
777static struct platform_device android_pmem_audio_device = {
778 .name = "android_pmem",
779 .id = 4,
780 .dev = { .platform_data = &android_pmem_audio_pdata },
781};
782#endif
783
784static struct memtype_reserve msm8960_reserve_table[] __initdata = {
785 [MEMTYPE_SMI] = {
786 },
787 [MEMTYPE_EBI0] = {
788 .flags = MEMTYPE_FLAGS_1M_ALIGN,
789 },
790 [MEMTYPE_EBI1] = {
791 .flags = MEMTYPE_FLAGS_1M_ALIGN,
792 },
793};
794
795static void __init size_pmem_devices(void)
796{
797#ifdef CONFIG_ANDROID_PMEM
798 android_pmem_adsp_pdata.size = pmem_adsp_size;
799 android_pmem_pdata.size = pmem_size;
800 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
801#endif
802}
803
804static void __init reserve_memory_for(struct android_pmem_platform_data *p)
805{
806 msm8960_reserve_table[p->memory_type].size += p->size;
807}
808
809static void __init reserve_pmem_memory(void)
810{
811#ifdef CONFIG_ANDROID_PMEM
812 reserve_memory_for(&android_pmem_adsp_pdata);
813 reserve_memory_for(&android_pmem_pdata);
814 reserve_memory_for(&android_pmem_audio_pdata);
815 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
816#endif
817}
818
Larry Basselb4126da2011-07-18 14:31:33 -0700819static int msm8960_paddr_to_memtype(unsigned int paddr)
820{
821 return MEMTYPE_EBI1;
822}
823
Laura Abbottd6183792011-08-19 13:42:24 -0700824#ifdef CONFIG_ION_MSM
825struct ion_platform_data ion_pdata = {
826 .nr = 3,
827 .heaps = {
828 {
829 .id = ION_HEAP_SYSTEM_ID,
830 .type = ION_HEAP_TYPE_SYSTEM,
831 .name = ION_KMALLOC_HEAP_NAME,
832 },
833 {
834 .id = ION_HEAP_SYSTEM_CONTIG_ID,
835 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
836 .name = ION_VMALLOC_HEAP_NAME,
837 },
838 {
839 .id = ION_HEAP_EBI_ID,
840 .type = ION_HEAP_TYPE_CARVEOUT,
841 .name = ION_EBI1_HEAP_NAME,
842 .size = MSM_ION_EBI_SIZE,
843 .memory_type = ION_EBI_TYPE,
844 },
845 }
846};
847
848struct platform_device ion_dev = {
849 .name = "ion-msm",
850 .id = 1,
851 .dev = { .platform_data = &ion_pdata },
852};
853#endif
854
855static void reserve_ion_memory(void)
856{
857#ifdef CONFIG_ION_MSM
858 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
859#endif
860}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700861static void __init msm8960_calculate_reserve_sizes(void)
862{
863 size_pmem_devices();
864 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700865 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700866}
867
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700868static struct reserve_info msm8960_reserve_info __initdata = {
869 .memtype_reserve_table = msm8960_reserve_table,
870 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
871 .paddr_to_memtype = msm8960_paddr_to_memtype,
872};
873
Larry Basselb4126da2011-07-18 14:31:33 -0700874static int msm8960_memory_bank_size(void)
875{
876 return 1<<29;
877}
878
879static void __init locate_unstable_memory(void)
880{
881 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
882 unsigned long bank_size;
883 unsigned long low, high;
884
885 bank_size = msm8960_memory_bank_size();
886 low = meminfo.bank[0].start;
887 high = mb->start + mb->size;
888 low &= ~(bank_size - 1);
889
890 if (high - low <= bank_size)
891 return;
892 msm8960_reserve_info.low_unstable_address = low + bank_size;
893 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
894 msm8960_reserve_info.bank_size = bank_size;
895 pr_info("low unstable address %lx max size %lx bank size %lx\n",
896 msm8960_reserve_info.low_unstable_address,
897 msm8960_reserve_info.max_unstable_size,
898 msm8960_reserve_info.bank_size);
899}
900
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700901static void __init msm8960_reserve(void)
902{
903 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700904 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905 msm_reserve();
906}
907
Larry Bassela4414b12011-08-04 11:11:02 -0700908static int msm8960_change_memory_power(u64 start, u64 size,
909 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700910{
Larry Bassela4414b12011-08-04 11:11:02 -0700911 return size;
Larry Bassela7eadea2011-07-14 10:46:00 -0700912}
913
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700914#ifdef CONFIG_MSM_CAMERA
915
Nishant Pandit24153d82011-08-27 16:05:13 +0530916static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700917 5, /*CAMIF_MCLK*/
918 20, /*CAMIF_I2C_DATA*/
919 21, /*CAMIF_I2C_CLK*/
920};
921
Nishant Pandit24153d82011-08-27 16:05:13 +0530922static struct msm_camera_gpio_conf gpio_conf = {
923 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
924 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
925 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
926 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
927};
928
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700929#define VFE_CAMIF_TIMER1_GPIO 2
930#define VFE_CAMIF_TIMER2_GPIO 3
931#define VFE_CAMIF_TIMER3_GPIO_INT 4
932struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
933 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
934 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
935 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
936 .flash_recharge_duration = 50000,
937 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
938};
939
Nishant Pandit474f2252011-07-23 23:17:56 +0530940#ifdef CONFIG_MSM_CAMERA_FLASH
941static struct msm_camera_sensor_flash_src msm_flash_src = {
942 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
943 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
944 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
945#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
946 defined(CONFIG_GPIO_SX150X_MODULE))
947 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
948#endif
949};
950#endif
951
Nishant Pandit24153d82011-08-27 16:05:13 +0530952struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
953 {
954 .ioclk.mclk_clk_rate = 24000000,
955 .ioclk.vfe_clk_rate = 228570000,
956 .csid_core = 0,
957 },
958 {
959 .ioclk.mclk_clk_rate = 24000000,
960 .ioclk.vfe_clk_rate = 228570000,
961 .csid_core = 1,
962 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700963};
964
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -0700965#ifdef CONFIG_IMX074_ACT
966static struct i2c_board_info imx074_actuator_i2c_info = {
967 I2C_BOARD_INFO("imx074_act", 0x11),
968};
969
970static struct msm_actuator_info imx074_actuator_info = {
971 .board_info = &imx074_actuator_i2c_info,
972 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
973 .vcm_pwd = 0,
974 .vcm_enable = 1,
975};
976#endif
977
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700978#ifdef CONFIG_IMX074
979static struct msm_camera_sensor_flash_data flash_imx074 = {
980 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530981#ifdef CONFIG_MSM_CAMERA_FLASH
982 .flash_src = &msm_flash_src
983#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700984};
985
Nishant Pandit24153d82011-08-27 16:05:13 +0530986static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
987 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700988 .sensor_reset = 107,
989 .sensor_pwd = 85,
990 .vcm_pwd = 0,
991 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +0530992};
993
994static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
995 .sensor_name = "imx074",
996 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700997 .flash_data = &flash_imx074,
998 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +0530999 .sensor_platform_info = &sensor_board_info_imx074,
1000 .gpio_conf = &gpio_conf,
1001 .csi_if = 1,
1002 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001003#ifdef CONFIG_IMX074_ACT
1004 .actuator_info = &imx074_actuator_info
1005#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001006};
1007
1008struct platform_device msm8960_camera_sensor_imx074 = {
1009 .name = "msm_camera_imx074",
1010 .dev = {
1011 .platform_data = &msm_camera_sensor_imx074_data,
1012 },
1013};
1014#endif
1015#ifdef CONFIG_OV2720
1016static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001017 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001018};
1019
Nishant Pandit24153d82011-08-27 16:05:13 +05301020static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1021 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001022 .sensor_reset = 76,
1023 .sensor_pwd = 85,
1024 .vcm_pwd = 0,
1025 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301026};
1027
1028static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1029 .sensor_name = "ov2720",
1030 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001031 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301032 .sensor_platform_info = &sensor_board_info_ov2720,
1033 .gpio_conf = &gpio_conf,
1034 .csi_if = 1,
1035 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001036};
1037
1038struct platform_device msm8960_camera_sensor_ov2720 = {
1039 .name = "msm_camera_ov2720",
1040 .dev = {
1041 .platform_data = &msm_camera_sensor_ov2720_data,
1042 },
1043};
1044#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001045
1046static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1047 .flash_type = MSM_CAMERA_FLASH_LED,
1048};
1049
Nishant Pandit24153d82011-08-27 16:05:13 +05301050static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1051 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001052 .sensor_reset = 107,
1053 .sensor_pwd = 85,
1054 .vcm_pwd = 0,
1055 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301056};
1057
1058static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1059 .sensor_name = "qs_mt9p017",
1060 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001061 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301062 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1063 .gpio_conf = &gpio_conf,
1064 .csi_if = 1,
1065 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001066};
1067
1068struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1069 .name = "msm_camera_qs_mt9p017",
1070 .dev = {
1071 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1072 },
1073};
1074
Kevin Chan8b0d2322011-09-10 21:06:31 -07001075static struct msm8960_privacy_light_cfg privacy_light_info = {
1076 .mpp = PM8921_MPP_PM_TO_SYS(12),
1077};
1078
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001079static void __init msm8960_init_cam(void)
1080{
1081 int i;
1082 struct platform_device *cam_dev[] = {
1083 &msm8960_camera_sensor_imx074,
1084 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001085 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001086 };
1087
Kevin Chan8b0d2322011-09-10 21:06:31 -07001088 if (machine_is_msm8960_liquid()) {
1089 struct msm_camera_sensor_info *s_info;
1090 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1091 s_info->sensor_platform_info->mount_angle = 180;
1092 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1093 s_info->sensor_platform_info->privacy_light = 1;
1094 s_info->sensor_platform_info->privacy_light_info =
1095 &privacy_light_info;
1096 }
1097
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001098 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1099 struct msm_camera_sensor_info *s_info;
1100 s_info = cam_dev[i]->dev.platform_data;
1101 msm_get_cam_resources(s_info);
1102 platform_device_register(cam_dev[i]);
1103 }
1104}
1105#endif
1106
1107#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001108#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001109#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001110#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001111#endif
1112
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001113
1114#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001115#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001116#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001117#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1118#else
1119#define MSM_FB_EXT_BUF_SIZE 0
1120#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001121
kuogee hsieh3830eb92011-09-12 15:25:57 -07001122#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1123/* width x height x 3 bpp x 2 frame buffer */
1124#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1125#define MSM_FB_WRITEBACK_OFFSET \
1126 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1127#else
1128#define MSM_FB_WRITEBACK_SIZE 0
1129#define MSM_FB_WRITEBACK_OFFSET 0
1130#endif
1131
1132
1133/* Note: must be multiple of 4096 */
1134#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1135 MSM_FB_WRITEBACK_SIZE, 4096)
1136
1137static int writeback_offset(void)
1138{
1139 return MSM_FB_WRITEBACK_OFFSET;
1140}
1141
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001142
1143#define MDP_VSYNC_GPIO 0
1144
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001145#define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga"
1146#define TOSHIBA_PANEL_NAME_LEN 24
1147#define CHIMEI_PANEL_NAME "mipi_chimei_wxga"
1148#define CHIMEI_PANEL_NAME_LEN 16
1149
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001150static struct resource msm_fb_resources[] = {
1151 {
1152 .flags = IORESOURCE_DMA,
1153 }
1154};
1155
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001156#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1157static int msm_fb_detect_panel(const char *name)
1158{
1159 if (machine_is_msm8960_liquid()) {
1160 if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN))
1161 return 0;
1162 } else {
1163 if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN))
1164 return 0;
1165 }
1166
1167 pr_warning("%s: not supported '%s'", __func__, name);
1168
1169 return -ENODEV;
1170}
1171
1172static struct msm_fb_platform_data msm_fb_pdata = {
1173 .detect_client = msm_fb_detect_panel,
1174};
1175#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
1176
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001177static struct platform_device msm_fb_device = {
1178 .name = "msm_fb",
1179 .id = 0,
1180 .num_resources = ARRAY_SIZE(msm_fb_resources),
1181 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001182#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1183 .dev.platform_data = &msm_fb_pdata,
1184#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001185};
1186
1187static bool dsi_power_on;
1188
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001189/**
1190 * LiQUID panel on/off
1191 *
1192 * @param on
1193 *
1194 * @return int
1195 */
1196static int mipi_dsi_liquid_panel_power(int on)
1197{
1198 static struct regulator *reg_l2, *reg_ext_3p3v;
1199 static int gpio21, gpio24, gpio43;
1200 int rc;
1201
1202 pr_info("%s: on=%d\n", __func__, on);
1203
1204 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1205 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1206 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1207
1208 if (!dsi_power_on) {
1209
1210 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1211 "dsi_vdda");
1212 if (IS_ERR(reg_l2)) {
1213 pr_err("could not get 8921_l2, rc = %ld\n",
1214 PTR_ERR(reg_l2));
1215 return -ENODEV;
1216 }
1217
1218 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1219 if (rc) {
1220 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1221 return -EINVAL;
1222 }
1223
1224 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1225 "vdd_lvds_3p3v");
1226 if (IS_ERR(reg_ext_3p3v)) {
1227 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1228 PTR_ERR(reg_ext_3p3v));
1229 return -ENODEV;
1230 }
1231
1232 rc = gpio_request(gpio21, "disp_pwr_en_n");
1233 if (rc) {
1234 pr_err("request gpio 21 failed, rc=%d\n", rc);
1235 return -ENODEV;
1236 }
1237
1238 rc = gpio_request(gpio43, "disp_rst_n");
1239 if (rc) {
1240 pr_err("request gpio 43 failed, rc=%d\n", rc);
1241 return -ENODEV;
1242 }
1243
1244 rc = gpio_request(gpio24, "disp_backlight_pwm");
1245 if (rc) {
1246 pr_err("request gpio 24 failed, rc=%d\n", rc);
1247 return -ENODEV;
1248 }
1249
1250 dsi_power_on = true;
1251 }
1252
1253 if (on) {
1254 rc = regulator_set_optimum_mode(reg_l2, 100000);
1255 if (rc < 0) {
1256 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1257 return -EINVAL;
1258 }
1259 rc = regulator_enable(reg_l2);
1260 if (rc) {
1261 pr_err("enable l2 failed, rc=%d\n", rc);
1262 return -ENODEV;
1263 }
1264
1265 rc = regulator_enable(reg_ext_3p3v);
1266 if (rc) {
1267 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1268 return -ENODEV;
1269 }
1270
1271 /* set reset pin before power enable */
1272 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1273
1274 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1275 msleep(20);
1276 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1277 msleep(20);
1278 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1279 msleep(20);
1280 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1281 msleep(20);
1282 } else {
1283 gpio_set_value_cansleep(gpio43, 0);
1284 gpio_set_value_cansleep(gpio21, 1);
1285
1286 rc = regulator_disable(reg_l2);
1287 if (rc) {
1288 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1289 return -ENODEV;
1290 }
1291 rc = regulator_disable(reg_ext_3p3v);
1292 if (rc) {
1293 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1294 return -ENODEV;
1295 }
1296 rc = regulator_set_optimum_mode(reg_l2, 100);
1297 if (rc < 0) {
1298 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1299 return -EINVAL;
1300 }
1301 }
1302
1303 return 0;
1304}
1305
1306static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001307{
1308 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001309 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001310 int rc;
1311
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001312 pr_info("%s: state : %d\n", __func__, on);
1313
1314 if (!dsi_power_on) {
1315
1316 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1317 "dsi_vdc");
1318 if (IS_ERR(reg_l8)) {
1319 pr_err("could not get 8921_l8, rc = %ld\n",
1320 PTR_ERR(reg_l8));
1321 return -ENODEV;
1322 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001323 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1324 "dsi_vddio");
1325 if (IS_ERR(reg_l23)) {
1326 pr_err("could not get 8921_l23, rc = %ld\n",
1327 PTR_ERR(reg_l23));
1328 return -ENODEV;
1329 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001330 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1331 "dsi_vdda");
1332 if (IS_ERR(reg_l2)) {
1333 pr_err("could not get 8921_l2, rc = %ld\n",
1334 PTR_ERR(reg_l2));
1335 return -ENODEV;
1336 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001337 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1338 if (rc) {
1339 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1340 return -EINVAL;
1341 }
1342 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1343 if (rc) {
1344 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1345 return -EINVAL;
1346 }
1347 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1348 if (rc) {
1349 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1350 return -EINVAL;
1351 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001352 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1353 rc = gpio_request(gpio43, "disp_rst_n");
1354 if (rc) {
1355 pr_err("request gpio 43 failed, rc=%d\n", rc);
1356 return -ENODEV;
1357 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001358 dsi_power_on = true;
1359 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001360 if (on) {
1361 rc = regulator_set_optimum_mode(reg_l8, 100000);
1362 if (rc < 0) {
1363 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1364 return -EINVAL;
1365 }
1366 rc = regulator_set_optimum_mode(reg_l23, 100000);
1367 if (rc < 0) {
1368 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1369 return -EINVAL;
1370 }
1371 rc = regulator_set_optimum_mode(reg_l2, 100000);
1372 if (rc < 0) {
1373 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1374 return -EINVAL;
1375 }
1376 rc = regulator_enable(reg_l8);
1377 if (rc) {
1378 pr_err("enable l8 failed, rc=%d\n", rc);
1379 return -ENODEV;
1380 }
1381 rc = regulator_enable(reg_l23);
1382 if (rc) {
1383 pr_err("enable l8 failed, rc=%d\n", rc);
1384 return -ENODEV;
1385 }
1386 rc = regulator_enable(reg_l2);
1387 if (rc) {
1388 pr_err("enable l2 failed, rc=%d\n", rc);
1389 return -ENODEV;
1390 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001391 gpio_set_value_cansleep(gpio43, 1);
1392 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001393 rc = regulator_disable(reg_l2);
1394 if (rc) {
1395 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1396 return -ENODEV;
1397 }
1398 rc = regulator_disable(reg_l8);
1399 if (rc) {
1400 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1401 return -ENODEV;
1402 }
1403 rc = regulator_disable(reg_l23);
1404 if (rc) {
1405 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1406 return -ENODEV;
1407 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001408 rc = regulator_set_optimum_mode(reg_l8, 100);
1409 if (rc < 0) {
1410 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1411 return -EINVAL;
1412 }
1413 rc = regulator_set_optimum_mode(reg_l23, 100);
1414 if (rc < 0) {
1415 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1416 return -EINVAL;
1417 }
1418 rc = regulator_set_optimum_mode(reg_l2, 100);
1419 if (rc < 0) {
1420 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1421 return -EINVAL;
1422 }
1423 gpio_set_value_cansleep(gpio43, 0);
1424 }
1425 return 0;
1426}
1427
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001428static int mipi_dsi_panel_power(int on)
1429{
1430 int ret;
1431
1432 pr_info("%s: on=%d\n", __func__, on);
1433
1434 if (machine_is_msm8960_liquid())
1435 ret = mipi_dsi_liquid_panel_power(on);
1436 else
1437 ret = mipi_dsi_cdp_panel_power(on);
1438
1439 return ret;
1440}
1441
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001442static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1443 .vsync_gpio = MDP_VSYNC_GPIO,
1444 .dsi_power_save = mipi_dsi_panel_power,
1445};
1446
1447#ifdef CONFIG_MSM_BUS_SCALING
1448
1449static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001450 {
1451 .src = MSM_BUS_MASTER_MDP_PORT0,
1452 .dst = MSM_BUS_SLAVE_EBI_CH0,
1453 .ab = 0,
1454 .ib = 0,
1455 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001456};
1457
1458static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001459 {
1460 .src = MSM_BUS_MASTER_MDP_PORT0,
1461 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001462 .ab = 216000000 * 2,
1463 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001464 },
1465};
1466
1467static struct msm_bus_vectors mdp_vga_vectors[] = {
1468 /* VGA and less video */
1469 {
1470 .src = MSM_BUS_MASTER_MDP_PORT0,
1471 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001472 .ab = 216000000 * 2,
1473 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001474 },
1475};
1476
1477static struct msm_bus_vectors mdp_720p_vectors[] = {
1478 /* 720p and less video */
1479 {
1480 .src = MSM_BUS_MASTER_MDP_PORT0,
1481 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001482 .ab = 230400000 * 2,
1483 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001484 },
1485};
1486
1487static struct msm_bus_vectors mdp_1080p_vectors[] = {
1488 /* 1080p and less video */
1489 {
1490 .src = MSM_BUS_MASTER_MDP_PORT0,
1491 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001492 .ab = 334080000 * 2,
1493 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001494 },
1495};
1496
1497static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1498 {
1499 ARRAY_SIZE(mdp_init_vectors),
1500 mdp_init_vectors,
1501 },
1502 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001503 ARRAY_SIZE(mdp_ui_vectors),
1504 mdp_ui_vectors,
1505 },
1506 {
1507 ARRAY_SIZE(mdp_ui_vectors),
1508 mdp_ui_vectors,
1509 },
1510 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001511 ARRAY_SIZE(mdp_vga_vectors),
1512 mdp_vga_vectors,
1513 },
1514 {
1515 ARRAY_SIZE(mdp_720p_vectors),
1516 mdp_720p_vectors,
1517 },
1518 {
1519 ARRAY_SIZE(mdp_1080p_vectors),
1520 mdp_1080p_vectors,
1521 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001522};
1523
1524static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1525 mdp_bus_scale_usecases,
1526 ARRAY_SIZE(mdp_bus_scale_usecases),
1527 .name = "mdp",
1528};
1529
1530#endif
1531
1532int mdp_core_clk_rate_table[] = {
1533 85330000,
1534 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001535 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001536 200000000,
1537};
1538
1539static struct msm_panel_common_pdata mdp_pdata = {
1540 .gpio = MDP_VSYNC_GPIO,
1541 .mdp_core_clk_rate = 85330000,
1542 .mdp_core_clk_table = mdp_core_clk_rate_table,
1543 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1544#ifdef CONFIG_MSM_BUS_SCALING
1545 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1546#endif
1547 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001548 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001549};
1550
1551static struct platform_device mipi_dsi_renesas_panel_device = {
1552 .name = "mipi_renesas",
1553 .id = 0,
1554};
1555
1556static struct platform_device mipi_dsi_simulator_panel_device = {
1557 .name = "mipi_simulator",
1558 .id = 0,
1559};
1560
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001561#define LPM_CHANNEL0 0
1562static int toshiba_gpio[] = {LPM_CHANNEL0};
1563
1564static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1565 .gpio = toshiba_gpio,
1566};
1567
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001568static struct platform_device mipi_dsi_toshiba_panel_device = {
1569 .name = "mipi_toshiba",
1570 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001571 .dev = {
1572 .platform_data = &toshiba_pdata,
1573 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001574};
1575
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001576static int dsi2lvds_gpio[2] = {
1577 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1578 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1579 };
1580
1581static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1582 .gpio_num = dsi2lvds_gpio,
1583};
1584
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001585static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1586
1587/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1588 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1589 /* timing */
1590 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1591 0x0c, 0x03, 0x04, 0xa0},
1592 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1593 {0xff, 0x00, 0x06, 0x00}, /* strength */
1594 /* pll control */
1595 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1596 0x40, 0x07, 0x03,
1597 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1598};
1599
1600static struct mipi_dsi_panel_platform_data novatek_pdata = {
1601 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1602};
1603
1604static struct platform_device mipi_dsi_novatek_panel_device = {
1605 .name = "mipi_novatek",
1606 .id = 0,
1607 .dev = {
1608 .platform_data = &novatek_pdata,
1609 }
1610};
1611
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001612static struct platform_device mipi_dsi2lvds_bridge_device = {
1613 .name = "mipi_tc358764",
1614 .id = 0,
1615 .dev.platform_data = &mipi_dsi2lvds_pdata,
1616};
1617
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001618#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1619static struct resource hdmi_msm_resources[] = {
1620 {
1621 .name = "hdmi_msm_qfprom_addr",
1622 .start = 0x00700000,
1623 .end = 0x007060FF,
1624 .flags = IORESOURCE_MEM,
1625 },
1626 {
1627 .name = "hdmi_msm_hdmi_addr",
1628 .start = 0x04A00000,
1629 .end = 0x04A00FFF,
1630 .flags = IORESOURCE_MEM,
1631 },
1632 {
1633 .name = "hdmi_msm_irq",
1634 .start = HDMI_IRQ,
1635 .end = HDMI_IRQ,
1636 .flags = IORESOURCE_IRQ,
1637 },
1638};
1639
1640static int hdmi_enable_5v(int on);
1641static int hdmi_core_power(int on, int show);
1642static int hdmi_cec_power(int on);
1643
1644static struct msm_hdmi_platform_data hdmi_msm_data = {
1645 .irq = HDMI_IRQ,
1646 .enable_5v = hdmi_enable_5v,
1647 .core_power = hdmi_core_power,
1648 .cec_power = hdmi_cec_power,
1649};
1650
1651static struct platform_device hdmi_msm_device = {
1652 .name = "hdmi_msm",
1653 .id = 0,
1654 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1655 .resource = hdmi_msm_resources,
1656 .dev.platform_data = &hdmi_msm_data,
1657};
1658#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1659
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001660#ifdef CONFIG_MSM_BUS_SCALING
1661static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1662 {
1663 .src = MSM_BUS_MASTER_MDP_PORT0,
1664 .dst = MSM_BUS_SLAVE_EBI_CH0,
1665 .ab = 0,
1666 .ib = 0,
1667 },
1668};
1669static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1670 {
1671 .src = MSM_BUS_MASTER_MDP_PORT0,
1672 .dst = MSM_BUS_SLAVE_EBI_CH0,
1673 .ab = 566092800 * 2,
1674 .ib = 707616000 * 2,
1675 },
1676};
1677static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1678 {
1679 ARRAY_SIZE(dtv_bus_init_vectors),
1680 dtv_bus_init_vectors,
1681 },
1682 {
1683 ARRAY_SIZE(dtv_bus_def_vectors),
1684 dtv_bus_def_vectors,
1685 },
1686};
1687static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1688 dtv_bus_scale_usecases,
1689 ARRAY_SIZE(dtv_bus_scale_usecases),
1690 .name = "dtv",
1691};
1692
1693static struct lcdc_platform_data dtv_pdata = {
1694 .bus_scale_table = &dtv_bus_scale_pdata,
1695};
1696#endif
1697
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698static void __init msm_fb_add_devices(void)
1699{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001700 struct platform_device *ptr = NULL;
1701
1702 if (machine_is_msm8960_liquid())
1703 ptr = &mipi_dsi2lvds_bridge_device;
1704 else
1705 ptr = &mipi_dsi_toshiba_panel_device;
1706 platform_add_devices(&ptr, 1);
1707
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001708 if (machine_is_msm8x60_rumi3()) {
1709 msm_fb_register_device("mdp", NULL);
1710 mipi_dsi_pdata.target_type = 1;
1711 } else
1712 msm_fb_register_device("mdp", &mdp_pdata);
1713 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001714#ifdef CONFIG_MSM_BUS_SCALING
1715 msm_fb_register_device("dtv", &dtv_pdata);
1716#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001717}
1718
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001719static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1720 .func = GPIOMUX_FUNC_GPIO,
1721 .drv = GPIOMUX_DRV_2MA,
1722 .pull = GPIOMUX_PULL_DOWN,
1723};
1724
1725static struct gpiomux_setting mdp_vsync_active_cfg = {
1726 .func = GPIOMUX_FUNC_1,
1727 .drv = GPIOMUX_DRV_2MA,
1728 .pull = GPIOMUX_PULL_DOWN,
1729};
1730
1731static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1732 {
1733 .gpio = MDP_VSYNC_GPIO,
1734 .settings = {
1735 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1736 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1737 },
1738 }
1739};
1740
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001741#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1742static struct gpiomux_setting hdmi_suspend_cfg = {
1743 .func = GPIOMUX_FUNC_GPIO,
1744 .drv = GPIOMUX_DRV_2MA,
1745 .pull = GPIOMUX_PULL_DOWN,
1746};
1747
1748static struct gpiomux_setting hdmi_active_1_cfg = {
1749 .func = GPIOMUX_FUNC_1,
1750 .drv = GPIOMUX_DRV_2MA,
1751 .pull = GPIOMUX_PULL_UP,
1752};
1753
1754static struct gpiomux_setting hdmi_active_2_cfg = {
1755 .func = GPIOMUX_FUNC_1,
1756 .drv = GPIOMUX_DRV_2MA,
1757 .pull = GPIOMUX_PULL_DOWN,
1758};
1759
1760static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1761 {
1762 .gpio = 99,
1763 .settings = {
1764 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1765 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1766 },
1767 },
1768 {
1769 .gpio = 100,
1770 .settings = {
1771 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1772 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1773 },
1774 },
1775 {
1776 .gpio = 101,
1777 .settings = {
1778 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1779 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1780 },
1781 },
1782 {
1783 .gpio = 102,
1784 .settings = {
1785 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1786 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1787 },
1788 },
1789};
1790
1791static int hdmi_enable_5v(int on)
1792{
1793 /* TBD: PM8921 regulator instead of 8901 */
1794 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1795 static int prev_on;
1796 int rc;
1797
1798 if (on == prev_on)
1799 return 0;
1800
1801 if (!reg_8921_hdmi_mvs)
1802 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1803 "hdmi_mvs");
1804
1805 if (on) {
1806 rc = regulator_enable(reg_8921_hdmi_mvs);
1807 if (rc) {
1808 pr_err("'%s' regulator enable failed, rc=%d\n",
1809 "8921_hdmi_mvs", rc);
1810 return rc;
1811 }
1812 pr_debug("%s(on): success\n", __func__);
1813 } else {
1814 rc = regulator_disable(reg_8921_hdmi_mvs);
1815 if (rc)
1816 pr_warning("'%s' regulator disable failed, rc=%d\n",
1817 "8921_hdmi_mvs", rc);
1818 pr_debug("%s(off): success\n", __func__);
1819 }
1820
1821 prev_on = on;
1822
1823 return 0;
1824}
1825
1826static int hdmi_core_power(int on, int show)
1827{
1828 static struct regulator *reg_8921_l23, *reg_8921_s4;
1829 static int prev_on;
1830 int rc;
1831
1832 if (on == prev_on)
1833 return 0;
1834
1835 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001836 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001837 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001838 if (IS_ERR(reg_8921_l23)) {
1839 pr_err("could not get reg_8921_l23, rc = %ld\n",
1840 PTR_ERR(reg_8921_l23));
1841 return -ENODEV;
1842 }
1843 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1844 if (rc) {
1845 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
1846 return -EINVAL;
1847 }
1848 }
1849 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001850 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001851 if (IS_ERR(reg_8921_s4)) {
1852 pr_err("could not get reg_8921_s4, rc = %ld\n",
1853 PTR_ERR(reg_8921_s4));
1854 return -ENODEV;
1855 }
1856 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1857 if (rc) {
1858 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
1859 return -EINVAL;
1860 }
1861 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001862
1863 if (on) {
1864 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1865 if (rc < 0) {
1866 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1867 return -EINVAL;
1868 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001869 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001870 if (rc) {
1871 pr_err("'%s' regulator enable failed, rc=%d\n",
1872 "hdmi_avdd", rc);
1873 return rc;
1874 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001875 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001876 if (rc) {
1877 pr_err("'%s' regulator enable failed, rc=%d\n",
1878 "hdmi_vcc", rc);
1879 return rc;
1880 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001881 rc = gpio_request(100, "HDMI_DDC_CLK");
1882 if (rc) {
1883 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1884 "HDMI_DDC_CLK", 100, rc);
1885 goto error1;
1886 }
1887 rc = gpio_request(101, "HDMI_DDC_DATA");
1888 if (rc) {
1889 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1890 "HDMI_DDC_DATA", 101, rc);
1891 goto error2;
1892 }
1893 rc = gpio_request(102, "HDMI_HPD");
1894 if (rc) {
1895 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1896 "HDMI_HPD", 102, rc);
1897 goto error3;
1898 }
1899 pr_debug("%s(on): success\n", __func__);
1900 } else {
1901 gpio_free(100);
1902 gpio_free(101);
1903 gpio_free(102);
1904
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001905 rc = regulator_disable(reg_8921_l23);
1906 if (rc) {
1907 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
1908 return -ENODEV;
1909 }
1910 rc = regulator_disable(reg_8921_s4);
1911 if (rc) {
1912 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
1913 return -ENODEV;
1914 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001915 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1916 if (rc < 0) {
1917 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1918 return -EINVAL;
1919 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001920 pr_debug("%s(off): success\n", __func__);
1921 }
1922
1923 prev_on = on;
1924
1925 return 0;
1926
1927error3:
1928 gpio_free(101);
1929error2:
1930 gpio_free(100);
1931error1:
1932 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001933 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001934 return rc;
1935}
1936
1937static int hdmi_cec_power(int on)
1938{
1939 static int prev_on;
1940 int rc;
1941
1942 if (on == prev_on)
1943 return 0;
1944
1945 if (on) {
1946 rc = gpio_request(99, "HDMI_CEC_VAR");
1947 if (rc) {
1948 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1949 "HDMI_CEC_VAR", 99, rc);
1950 goto error;
1951 }
1952 pr_debug("%s(on): success\n", __func__);
1953 } else {
1954 gpio_free(99);
1955 pr_debug("%s(off): success\n", __func__);
1956 }
1957
1958 prev_on = on;
1959
1960 return 0;
1961error:
1962 return rc;
1963}
1964#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1965
1966static void __init msm8960_allocate_memory_regions(void)
1967{
1968 void *addr;
1969 unsigned long size;
1970
1971 size = MSM_FB_SIZE;
1972 addr = alloc_bootmem_align(size, 0x1000);
1973 msm_fb_resources[0].start = __pa(addr);
1974 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1975 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1976 size, addr, __pa(addr));
1977
1978}
1979#ifdef CONFIG_WCD9310_CODEC
1980
1981#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1982
Patrick Lai3043fba2011-08-01 14:15:57 -07001983/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
1984 * 4 micbiases are used to power various analog and digital
1985 * microphones operating at 1800 mV. Technically, all micbiases
1986 * can source from single cfilter since all microphones operate
1987 * at the same voltage level. The arrangement below is to make
1988 * sure all cfilters are exercised. LDO_H regulator ouput level
1989 * does not need to be as high as 2.85V. It is choosen for
1990 * microphone sensitivity purpose.
1991 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001992static struct tabla_pdata tabla_platform_data = {
1993 .slimbus_slave_device = {
1994 .name = "tabla-slave",
1995 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1996 },
1997 .irq = MSM_GPIO_TO_INT(62),
1998 .irq_base = TABLA_INTERRUPT_BASE,
1999 .num_irqs = NR_TABLA_IRQS,
2000 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002001 .micbias = {
2002 .ldoh_v = TABLA_LDOH_2P85_V,
2003 .cfilt1_mv = 1800,
2004 .cfilt2_mv = 1800,
2005 .cfilt3_mv = 1800,
2006 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2007 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2008 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2009 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2010 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002011};
2012
2013static struct slim_device msm_slim_tabla = {
2014 .name = "tabla-slim",
2015 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2016 .dev = {
2017 .platform_data = &tabla_platform_data,
2018 },
2019};
2020#endif
2021
2022static struct slim_boardinfo msm_slim_devices[] = {
2023#ifdef CONFIG_WCD9310_CODEC
2024 {
2025 .bus_num = 1,
2026 .slim_slave = &msm_slim_tabla,
2027 },
2028#endif
2029 /* add more slimbus slaves as needed */
2030};
2031
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002032#define MSM_WCNSS_PHYS 0x03000000
2033#define MSM_WCNSS_SIZE 0x280000
2034
2035static struct resource resources_wcnss_wlan[] = {
2036 {
2037 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2038 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2039 .name = "wcnss_wlanrx_irq",
2040 .flags = IORESOURCE_IRQ,
2041 },
2042 {
2043 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2044 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2045 .name = "wcnss_wlantx_irq",
2046 .flags = IORESOURCE_IRQ,
2047 },
2048 {
2049 .start = MSM_WCNSS_PHYS,
2050 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2051 .name = "wcnss_mmio",
2052 .flags = IORESOURCE_MEM,
2053 },
2054};
2055
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002056static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2057 .has_48mhz_xo = 1,
2058};
2059
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002060static struct platform_device msm_device_wcnss_wlan = {
2061 .name = "wcnss_wlan",
2062 .id = 0,
2063 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2064 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002065 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002066};
2067
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002068#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2069 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2070 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2071 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2072
2073#define QCE_SIZE 0x10000
2074#define QCE_0_BASE 0x18500000
2075
2076#define QCE_HW_KEY_SUPPORT 0
2077#define QCE_SHA_HMAC_SUPPORT 1
2078#define QCE_SHARE_CE_RESOURCE 1
2079#define QCE_CE_SHARED 0
2080
2081static struct resource qcrypto_resources[] = {
2082 [0] = {
2083 .start = QCE_0_BASE,
2084 .end = QCE_0_BASE + QCE_SIZE - 1,
2085 .flags = IORESOURCE_MEM,
2086 },
2087 [1] = {
2088 .name = "crypto_channels",
2089 .start = DMOV_CE_IN_CHAN,
2090 .end = DMOV_CE_OUT_CHAN,
2091 .flags = IORESOURCE_DMA,
2092 },
2093 [2] = {
2094 .name = "crypto_crci_in",
2095 .start = DMOV_CE_IN_CRCI,
2096 .end = DMOV_CE_IN_CRCI,
2097 .flags = IORESOURCE_DMA,
2098 },
2099 [3] = {
2100 .name = "crypto_crci_out",
2101 .start = DMOV_CE_OUT_CRCI,
2102 .end = DMOV_CE_OUT_CRCI,
2103 .flags = IORESOURCE_DMA,
2104 },
2105};
2106
2107static struct resource qcedev_resources[] = {
2108 [0] = {
2109 .start = QCE_0_BASE,
2110 .end = QCE_0_BASE + QCE_SIZE - 1,
2111 .flags = IORESOURCE_MEM,
2112 },
2113 [1] = {
2114 .name = "crypto_channels",
2115 .start = DMOV_CE_IN_CHAN,
2116 .end = DMOV_CE_OUT_CHAN,
2117 .flags = IORESOURCE_DMA,
2118 },
2119 [2] = {
2120 .name = "crypto_crci_in",
2121 .start = DMOV_CE_IN_CRCI,
2122 .end = DMOV_CE_IN_CRCI,
2123 .flags = IORESOURCE_DMA,
2124 },
2125 [3] = {
2126 .name = "crypto_crci_out",
2127 .start = DMOV_CE_OUT_CRCI,
2128 .end = DMOV_CE_OUT_CRCI,
2129 .flags = IORESOURCE_DMA,
2130 },
2131};
2132
2133#endif
2134
2135#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2136 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2137
2138static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2139 .ce_shared = QCE_CE_SHARED,
2140 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2141 .hw_key_support = QCE_HW_KEY_SUPPORT,
2142 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2143};
2144
2145static struct platform_device qcrypto_device = {
2146 .name = "qcrypto",
2147 .id = 0,
2148 .num_resources = ARRAY_SIZE(qcrypto_resources),
2149 .resource = qcrypto_resources,
2150 .dev = {
2151 .coherent_dma_mask = DMA_BIT_MASK(32),
2152 .platform_data = &qcrypto_ce_hw_suppport,
2153 },
2154};
2155#endif
2156
2157#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2158 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2159
2160static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2161 .ce_shared = QCE_CE_SHARED,
2162 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2163 .hw_key_support = QCE_HW_KEY_SUPPORT,
2164 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2165};
2166
2167static struct platform_device qcedev_device = {
2168 .name = "qce",
2169 .id = 0,
2170 .num_resources = ARRAY_SIZE(qcedev_resources),
2171 .resource = qcedev_resources,
2172 .dev = {
2173 .coherent_dma_mask = DMA_BIT_MASK(32),
2174 .platform_data = &qcedev_ce_hw_suppport,
2175 },
2176};
2177#endif
2178
2179
2180static int __init gpiomux_init(void)
2181{
2182 int rc;
2183
2184 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2185 if (rc) {
2186 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2187 return rc;
2188 }
2189
Nishant Pandit24153d82011-08-27 16:05:13 +05302190 msm_gpiomux_install(msm8960_cam_common_configs,
2191 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002192
2193 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002194 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002195
2196 msm_gpiomux_install(msm8960_gsbi_configs,
2197 ARRAY_SIZE(msm8960_gsbi_configs));
2198
2199 msm_gpiomux_install(msm8960_cyts_configs,
2200 ARRAY_SIZE(msm8960_cyts_configs));
2201
2202 msm_gpiomux_install(msm8960_slimbus_config,
2203 ARRAY_SIZE(msm8960_slimbus_config));
2204
2205 msm_gpiomux_install(msm8960_audio_codec_configs,
2206 ARRAY_SIZE(msm8960_audio_codec_configs));
2207
2208#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2209 msm_gpiomux_install(msm8960_hdmi_configs,
2210 ARRAY_SIZE(msm8960_hdmi_configs));
2211#endif
2212
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002213 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2214 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2215
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002216 msm_gpiomux_install(wcnss_5wire_interface,
2217 ARRAY_SIZE(wcnss_5wire_interface));
2218
2219 return 0;
2220}
2221
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002222#define MSM_SHARED_RAM_PHYS 0x80000000
2223
2224static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2225 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2226 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2227 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2228 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2229 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2230 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2231 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2232 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2233 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2234 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2235 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2236 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2237 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
2238 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2239 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
2240 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2241 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2242 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2243 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2244 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2245 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2246 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2247 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2248 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2249 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2250 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2251 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2252 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2253 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2254 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002255 {"pa_therm", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
2256 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2257 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2258 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002259};
2260
2261static struct pm8921_adc_properties pm8921_adc_data = {
2262 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2263 .bitresolution = 15,
2264 .bipolar = 0,
2265};
2266
2267static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2268 .adc_channel = pm8921_adc_channels_data,
2269 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
2270 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadossab1cea62011-09-20 16:25:59 -07002271 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002272};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002273
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002274static void __init msm8960_map_io(void)
2275{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002276 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002277 msm_map_msm8960_io();
2278}
2279
2280static void __init msm8960_init_irq(void)
2281{
2282 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002283
2284 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002285 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002286 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002287
2288 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002289 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002290
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002291 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2292 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002293
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002294 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2295 * as they are configured as level, which does not play nice with
2296 * handle_percpu_irq.
2297 */
2298 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2299 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002300 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002301 }
2302}
2303
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002304/* MSM8960 have 5 SDCC controllers */
2305enum sdcc_controllers {
2306 SDCC1,
2307 SDCC2,
2308 SDCC3,
2309 SDCC4,
2310 SDCC5,
2311 MAX_SDCC_CONTROLLER
2312};
2313
2314/* All SDCC controllers requires VDD/VCC voltage */
2315static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2316 /* SDCC1 : eMMC card connected */
2317 [SDCC1] = {
2318 .name = "sdc_vdd",
2319 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302320 .high_vol_level = 2950000,
2321 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302322 .always_on = 1,
2323 .lpm_sup = 1,
2324 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002325 .hpm_uA = 200000, /* 200mA */
2326 },
2327 /* SDCC3 : External card slot connected */
2328 [SDCC3] = {
2329 .name = "sdc_vdd",
2330 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302331 .high_vol_level = 2950000,
2332 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002333 .hpm_uA = 600000, /* 600mA */
2334 }
2335};
2336
2337/* Only slots having eMMC card will require VCCQ voltage */
2338static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2339 /* SDCC1 : eMMC card connected */
2340 [SDCC1] = {
2341 .name = "sdc_vccq",
2342 .set_voltage_sup = 1,
2343 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302344 .high_vol_level = 1800000,
2345 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002346 .hpm_uA = 200000, /* 200mA */
2347 }
2348};
2349
2350/* All SDCC controllers may require voting for VDD PAD voltage */
2351static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2352 /* SDCC3 : External card slot connected */
2353 [SDCC3] = {
2354 .name = "sdc_vddp",
2355 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302356 .high_vol_level = 2950000,
2357 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002358 .always_on = 1,
2359 .lpm_sup = 1,
2360 /* Max. Active current required is 16 mA */
2361 .hpm_uA = 16000,
2362 /*
2363 * Sleep current required is ~300 uA. But min. vote can be
2364 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2365 * during sleep.
2366 */
2367 .lpm_uA = 2000,
2368 }
2369};
2370
2371static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2372 /* SDCC1 : eMMC card connected */
2373 [SDCC1] = {
2374 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2375 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2376 },
2377 /* SDCC3 : External card slot connected */
2378 [SDCC3] = {
2379 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2380 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2381 }
2382};
2383
2384/* SDC1 pad data */
2385static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2386 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302387 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2388 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002389};
2390
2391static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2392 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2393 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2394 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2395};
2396
2397static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302398 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002399 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2400 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2401};
2402
2403static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302404 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002405 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2406 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2407};
2408
2409/* SDC3 pad data */
2410static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2411 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2412 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2413 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2414};
2415
2416static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2417 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2418 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2419 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2420};
2421
2422static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302423 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002424 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2425 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2426};
2427
2428static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302429 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002430 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2431 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2432};
2433
2434struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2435 [SDCC1] = {
2436 .on = sdc1_pad_pull_on_cfg,
2437 .off = sdc1_pad_pull_off_cfg,
2438 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2439 },
2440 [SDCC3] = {
2441 .on = sdc3_pad_pull_on_cfg,
2442 .off = sdc3_pad_pull_off_cfg,
2443 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2444 },
2445};
2446
2447struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2448 [SDCC1] = {
2449 .on = sdc1_pad_drv_on_cfg,
2450 .off = sdc1_pad_drv_off_cfg,
2451 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2452 },
2453 [SDCC3] = {
2454 .on = sdc3_pad_drv_on_cfg,
2455 .off = sdc3_pad_drv_off_cfg,
2456 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2457 },
2458};
2459
2460struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2461 [SDCC1] = {
2462 .pull = &mmc_pad_pull_data[SDCC1],
2463 .drv = &mmc_pad_drv_data[SDCC1]
2464 },
2465 [SDCC3] = {
2466 .pull = &mmc_pad_pull_data[SDCC3],
2467 .drv = &mmc_pad_drv_data[SDCC3]
2468 },
2469};
2470
2471struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2472 [SDCC1] = {
2473 .pad_data = &mmc_pad_data[SDCC1],
2474 },
2475 [SDCC3] = {
2476 .pad_data = &mmc_pad_data[SDCC3],
2477 },
2478};
2479
2480static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302481 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002482};
2483
2484static unsigned int sdc3_sup_clk_rates[] = {
2485 400000, 24000000, 48000000, 96000000
2486};
2487
2488#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2489static struct mmc_platform_data msm8960_sdc1_data = {
2490 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2491#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2492 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2493#else
2494 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2495#endif
2496 .sup_clk_table = sdc1_sup_clk_rates,
2497 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2498 .nonremovable = 1,
2499 .sdcc_v4_sup = true,
2500 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302501 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002502};
2503#endif
2504
2505#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2506static struct mmc_platform_data msm8960_sdc3_data = {
2507 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2508 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2509 .sup_clk_table = sdc3_sup_clk_rates,
2510 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302511#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002512 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302513#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002514 .sdcc_v4_sup = true,
2515 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2516 .pin_data = &mmc_slot_pin_data[SDCC3],
2517#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2518 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2519 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2520 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2521#endif
2522 .xpc_cap = 1,
2523 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2524 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302525 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002526};
2527#endif
2528
2529static void __init msm8960_init_mmc(void)
2530{
2531#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2532 /* SDC1 : eMMC card connected */
2533 msm_add_sdcc(1, &msm8960_sdc1_data);
2534#endif
2535#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2536 /* SDC3: External card slot */
2537 msm_add_sdcc(3, &msm8960_sdc3_data);
2538#endif
2539}
2540
2541static void __init msm8960_init_buses(void)
2542{
2543#ifdef CONFIG_MSM_BUS_SCALING
2544 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2545 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2546 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2547 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2548 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2549 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2550 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2551 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2552 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2553 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2554#endif
2555}
2556
2557static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2558 .max_clock_speed = 15060000,
2559};
2560
2561#ifdef CONFIG_USB_MSM_OTG_72K
2562static struct msm_otg_platform_data msm_otg_pdata;
2563#else
2564#define USB_5V_EN 42
2565static void msm_hsusb_vbus_power(bool on)
2566{
2567 int rc;
2568 static bool vbus_is_on;
2569 static struct regulator *mvs_otg_switch;
2570 struct pm_gpio param = {
2571 .direction = PM_GPIO_DIR_OUT,
2572 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2573 .output_value = 1,
2574 .pull = PM_GPIO_PULL_NO,
2575 .vin_sel = PM_GPIO_VIN_S4,
2576 .out_strength = PM_GPIO_STRENGTH_MED,
2577 .function = PM_GPIO_FUNC_NORMAL,
2578 };
2579
2580 if (vbus_is_on == on)
2581 return;
2582
2583 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002584 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2585 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002586 if (IS_ERR(mvs_otg_switch)) {
2587 pr_err("Unable to get mvs_otg_switch\n");
2588 return;
2589 }
2590
2591 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2592 "usb_5v_en");
2593 if (rc < 0) {
2594 pr_err("failed to request usb_5v_en gpio\n");
2595 goto put_mvs_otg;
2596 }
2597
2598 if (regulator_enable(mvs_otg_switch)) {
2599 pr_err("unable to enable mvs_otg_switch\n");
2600 goto free_usb_5v_en;
2601 }
2602
2603 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2604 &param);
2605 if (rc < 0) {
2606 pr_err("failed to configure usb_5v_en gpio\n");
2607 goto disable_mvs_otg;
2608 }
2609 vbus_is_on = true;
2610 return;
2611 }
2612disable_mvs_otg:
2613 regulator_disable(mvs_otg_switch);
2614free_usb_5v_en:
2615 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2616put_mvs_otg:
2617 regulator_put(mvs_otg_switch);
2618 vbus_is_on = false;
2619}
2620
2621static struct msm_otg_platform_data msm_otg_pdata = {
2622 .mode = USB_OTG,
2623 .otg_control = OTG_PMIC_CONTROL,
2624 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2625 .pclk_src_name = "dfab_usb_hs_clk",
2626 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2627 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302628 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002629};
2630#endif
2631
2632#define PID_MAGIC_ID 0x71432909
2633#define SERIAL_NUM_MAGIC_ID 0x61945374
2634#define SERIAL_NUMBER_LENGTH 127
2635#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2636
2637struct magic_num_struct {
2638 uint32_t pid;
2639 uint32_t serial_num;
2640};
2641
2642struct dload_struct {
2643 uint32_t reserved1;
2644 uint32_t reserved2;
2645 uint32_t reserved3;
2646 uint16_t reserved4;
2647 uint16_t pid;
2648 char serial_number[SERIAL_NUMBER_LENGTH];
2649 uint16_t reserved5;
2650 struct magic_num_struct magic_struct;
2651};
2652
2653static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2654{
2655 struct dload_struct __iomem *dload = 0;
2656
2657 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2658 if (!dload) {
2659 pr_err("%s: cannot remap I/O memory region: %08x\n",
2660 __func__, DLOAD_USB_BASE_ADD);
2661 return -ENXIO;
2662 }
2663
2664 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2665 __func__, dload, pid, snum);
2666 /* update pid */
2667 dload->magic_struct.pid = PID_MAGIC_ID;
2668 dload->pid = pid;
2669
2670 /* update serial number */
2671 dload->magic_struct.serial_num = 0;
2672 if (!snum) {
2673 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2674 goto out;
2675 }
2676
2677 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2678 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2679 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2680out:
2681 iounmap(dload);
2682 return 0;
2683}
2684
2685static struct android_usb_platform_data android_usb_pdata = {
2686 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2687};
2688
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002689static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002690 .name = "android_usb",
2691 .id = -1,
2692 .dev = {
2693 .platform_data = &android_usb_pdata,
2694 },
2695};
2696
2697static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2698 0x03, 0x0f,
2699};
2700
2701static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2702 0x00, 0x24, 0x54, 0x10,
2703 0x09, 0x03, 0x01,
2704 0x10, 0x54, 0x30, 0x0C,
2705 0x24, 0x30, 0x0f,
2706};
2707
2708static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2709 0x00, 0x24, 0x54, 0x10,
2710 0x09, 0x07, 0x01, 0x0B,
2711 0x10, 0x54, 0x30, 0x0C,
2712 0x24, 0x30, 0x0f,
2713};
2714
2715static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2716 [0] = {
2717 .mode = MSM_SPM_MODE_CLOCK_GATING,
2718 .notify_rpm = false,
2719 .cmd = spm_wfi_cmd_sequence,
2720 },
2721 [1] = {
2722 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2723 .notify_rpm = false,
2724 .cmd = spm_power_collapse_without_rpm,
2725 },
2726 [2] = {
2727 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2728 .notify_rpm = true,
2729 .cmd = spm_power_collapse_with_rpm,
2730 },
2731};
2732
2733static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2734 [0] = {
2735 .reg_base_addr = MSM_SAW0_BASE,
2736 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2737 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2738 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2739#if defined(CONFIG_MSM_AVS_HW)
2740 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2741 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2742#endif
2743 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2744 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2745 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2746 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2747 .vctl_timeout_us = 50,
2748 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2749 .modes = msm_spm_seq_list,
2750 },
2751 [1] = {
2752 .reg_base_addr = MSM_SAW1_BASE,
2753 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2754 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2755 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2756#if defined(CONFIG_MSM_AVS_HW)
2757 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2758 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2759#endif
2760 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2761 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2762 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2763 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2764 .vctl_timeout_us = 50,
2765 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2766 .modes = msm_spm_seq_list,
2767 },
2768};
2769
2770static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2771 0x00, 0x20, 0x03, 0x20,
2772 0x00, 0x0f,
2773};
2774
2775static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2776 0x00, 0x20, 0x34, 0x64,
2777 0x48, 0x07, 0x48, 0x20,
2778 0x50, 0x64, 0x04, 0x34,
2779 0x50, 0x0f,
2780};
2781static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2782 0x00, 0x10, 0x34, 0x64,
2783 0x48, 0x07, 0x48, 0x10,
2784 0x50, 0x64, 0x04, 0x34,
2785 0x50, 0x0F,
2786};
2787
2788static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2789 [0] = {
2790 .mode = MSM_SPM_L2_MODE_RETENTION,
2791 .notify_rpm = false,
2792 .cmd = l2_spm_wfi_cmd_sequence,
2793 },
2794 [1] = {
2795 .mode = MSM_SPM_L2_MODE_GDHS,
2796 .notify_rpm = true,
2797 .cmd = l2_spm_gdhs_cmd_sequence,
2798 },
2799 [2] = {
2800 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2801 .notify_rpm = true,
2802 .cmd = l2_spm_power_off_cmd_sequence,
2803 },
2804};
2805
2806
2807static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2808 [0] = {
2809 .reg_base_addr = MSM_SAW_L2_BASE,
2810 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2811 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2812 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2813 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2814 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2815 .modes = msm_spm_l2_seq_list,
2816 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2817 },
2818};
2819
2820#define CYTTSP_TS_GPIO_IRQ 11
2821#define CYTTSP_TS_SLEEP_GPIO 50
2822#define CYTTSP_TS_RESOUT_N_GPIO 52
2823
2824/*virtual key support */
2825static ssize_t tma340_vkeys_show(struct kobject *kobj,
2826 struct kobj_attribute *attr, char *buf)
2827{
2828 return snprintf(buf, 200,
2829 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2830 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2831 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2832 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2833 "\n");
2834}
2835
2836static struct kobj_attribute tma340_vkeys_attr = {
2837 .attr = {
2838 .mode = S_IRUGO,
2839 },
2840 .show = &tma340_vkeys_show,
2841};
2842
2843static struct attribute *tma340_properties_attrs[] = {
2844 &tma340_vkeys_attr.attr,
2845 NULL
2846};
2847
2848static struct attribute_group tma340_properties_attr_group = {
2849 .attrs = tma340_properties_attrs,
2850};
2851
2852
2853static int cyttsp_platform_init(struct i2c_client *client)
2854{
2855 int rc = 0;
2856 static struct kobject *tma340_properties_kobj;
2857
2858 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2859 tma340_properties_kobj = kobject_create_and_add("board_properties",
2860 NULL);
2861 if (tma340_properties_kobj)
2862 rc = sysfs_create_group(tma340_properties_kobj,
2863 &tma340_properties_attr_group);
2864 if (!tma340_properties_kobj || rc)
2865 pr_err("%s: failed to create board_properties\n",
2866 __func__);
2867
2868 return 0;
2869}
2870
2871static struct cyttsp_regulator regulator_data[] = {
2872 {
2873 .name = "vdd",
2874 .min_uV = CY_TMA300_VTG_MIN_UV,
2875 .max_uV = CY_TMA300_VTG_MAX_UV,
2876 .load_uA = CY_TMA300_CURR_24HZ_UA,
2877 },
2878 /* TODO: Remove after runtime PM is enabled in I2C driver */
2879 {
2880 .name = "vcc_i2c",
2881 .min_uV = CY_I2C_VTG_MIN_UV,
2882 .max_uV = CY_I2C_VTG_MAX_UV,
2883 .load_uA = CY_I2C_CURR_UA,
2884 },
2885};
2886
2887static struct cyttsp_platform_data cyttsp_pdata = {
2888 .panel_maxx = 634,
2889 .panel_maxy = 1166,
2890 .disp_maxx = 616,
2891 .disp_maxy = 1023,
2892 .disp_minx = 0,
2893 .disp_miny = 16,
2894 .flags = 0x01,
2895 .gen = CY_GEN3, /* or */
2896 .use_st = CY_USE_ST,
2897 .use_mt = CY_USE_MT,
2898 .use_hndshk = CY_SEND_HNDSHK,
2899 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302900 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002901 .use_gestures = CY_USE_GESTURES,
2902 .fw_fname = "cyttsp_8960_cdp.hex",
2903 /* activate up to 4 groups
2904 * and set active distance
2905 */
2906 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2907 CY_GEST_GRP3 | CY_GEST_GRP4 |
2908 CY_ACT_DIST,
2909 /* change act_intrvl to customize the Active power state
2910 * scanning/processing refresh interval for Operating mode
2911 */
2912 .act_intrvl = CY_ACT_INTRVL_DFLT,
2913 /* change tch_tmout to customize the touch timeout for the
2914 * Active power state for Operating mode
2915 */
2916 .tch_tmout = CY_TCH_TMOUT_DFLT,
2917 /* change lp_intrvl to customize the Low Power power state
2918 * scanning/processing refresh interval for Operating mode
2919 */
2920 .lp_intrvl = CY_LP_INTRVL_DFLT,
2921 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2922 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2923 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2924 .regulator_info = regulator_data,
2925 .num_regulators = ARRAY_SIZE(regulator_data),
2926 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302927 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002928};
2929
2930static struct i2c_board_info cyttsp_info[] __initdata = {
2931 {
2932 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2933 .platform_data = &cyttsp_pdata,
2934#ifndef CY_USE_TIMER
2935 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2936#endif /* CY_USE_TIMER */
2937 },
2938};
2939
Mohan Pallaka50837382011-09-07 11:00:57 +05302940/* configuration data */
2941static const u8 mxt_config_data[] = {
2942 /* T6 Object */
2943 0, 0, 0, 0, 0, 0,
2944 /* T38 Object */
2945 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
2946 0, 0, 0, 0, 0, 0, 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,
2952 /* T7 Object */
2953 10, 10, 50,
2954 /* T8 Object */
2955 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2956 /* T9 Object */
2957 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
2958 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
2959 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
2960 0, 5, 45, 46,
2961 /* T15 Object */
2962 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2963 0,
2964 /* T22 Object */
2965 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2966 0, 0, 255, 255, 255, 255, 0,
2967 /* T24 Object */
2968 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2969 0, 0, 0, 0, 0, 0, 0, 0, 0,
2970 /* T25 Object */
2971 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2972 0, 0, 0, 0,
2973 /* T27 Object */
2974 0, 0, 0, 0, 0, 0, 0,
2975 /* T28 Object */
2976 0, 0, 0, 8, 8, 8,
2977 /* T40 Object */
2978 0, 0, 0, 0, 0,
2979 /* T41 Object */
2980 0, 0, 0, 0, 0, 0,
2981 /* T43 Object */
2982 0, 0, 0, 0, 0, 0,
2983};
2984
2985#define MXT_TS_GPIO_IRQ 11
2986#define MXT_TS_LDO_EN_GPIO 50
2987#define MXT_TS_RESET_GPIO 52
2988
2989static void mxt_init_hw_liquid(void)
2990{
2991 int rc;
2992
2993 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
2994 if (rc) {
2995 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
2996 __func__, MXT_TS_GPIO_IRQ);
2997 return;
2998 }
2999
3000 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3001 if (rc) {
3002 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3003 __func__, MXT_TS_GPIO_IRQ);
3004 goto err_irq_gpio_req;
3005 }
3006
3007 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3008 if (rc) {
3009 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3010 __func__, MXT_TS_LDO_EN_GPIO);
3011 goto err_irq_gpio_req;
3012 }
3013
3014 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3015 if (rc) {
3016 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3017 __func__, MXT_TS_LDO_EN_GPIO);
3018 goto err_ldo_gpio_req;
3019 }
3020
3021 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3022 if (rc) {
3023 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3024 __func__, MXT_TS_RESET_GPIO);
3025 goto err_ldo_gpio_set_dir;
3026 }
3027
3028 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3029 if (rc) {
3030 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3031 __func__, MXT_TS_RESET_GPIO);
3032 goto err_reset_gpio_req;
3033 }
3034
3035 return;
3036
3037err_reset_gpio_req:
3038 gpio_free(MXT_TS_RESET_GPIO);
3039err_ldo_gpio_set_dir:
3040 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3041err_ldo_gpio_req:
3042 gpio_free(MXT_TS_LDO_EN_GPIO);
3043err_irq_gpio_req:
3044 gpio_free(MXT_TS_GPIO_IRQ);
3045}
3046
3047static struct mxt_platform_data mxt_platform_data = {
3048 .config = mxt_config_data,
3049 .config_length = ARRAY_SIZE(mxt_config_data),
3050 .x_line = 26,
3051 .y_line = 42,
3052 .x_size = 767,
3053 .y_size = 1365,
3054 .blen = 32,
3055 .threshold = 40,
3056 .voltage = 3300000, /* 3.3V */
3057 .orient = MXT_ROTATED_90,
3058 .irqflags = IRQF_TRIGGER_FALLING,
3059};
3060
3061static struct i2c_board_info mxt_device_info[] __initdata = {
3062 {
3063 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3064 .platform_data = &mxt_platform_data,
3065 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3066 },
3067};
3068
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003069static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3070{
3071}
3072
3073static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3074 .clk_freq = 100000,
3075 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003076 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3077};
3078
3079static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3080 .clk_freq = 100000,
3081 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003082 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3083};
3084
3085static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3086 .clk_freq = 100000,
3087 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003088 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3089};
3090
3091static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3092 .clk_freq = 100000,
3093 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003094 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3095};
3096
3097static struct msm_rpm_platform_data msm_rpm_data = {
3098 .reg_base_addrs = {
3099 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3100 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3101 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3102 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3103 },
3104
3105 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3106 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3107 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3108 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3109 .msm_apps_ipc_rpm_val = 4,
3110};
3111
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003112static struct platform_device msm_rpm_device = {
3113 .name = "msm_rpm",
3114 .id = -1,
3115};
3116
3117
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003118static struct spi_board_info spi_board_info[] __initdata = {
3119 {
3120 .modalias = "ks8851",
3121 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3122 .max_speed_hz = 19200000,
3123 .bus_num = 0,
3124 .chip_select = 0,
3125 .mode = SPI_MODE_0,
3126 },
3127};
3128
3129static struct platform_device msm_device_saw_core0 = {
3130 .name = "saw-regulator",
3131 .id = 0,
3132 .dev = {
3133 .platform_data = &msm_saw_regulator_pdata_s5,
3134 },
3135};
3136
3137static struct platform_device msm_device_saw_core1 = {
3138 .name = "saw-regulator",
3139 .id = 1,
3140 .dev = {
3141 .platform_data = &msm_saw_regulator_pdata_s6,
3142 },
3143};
3144
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003145static struct tsens_platform_data msm_tsens_pdata = {
3146 .slope = 910,
3147 .tsens_factor = 1000,
3148 .hw_type = MSM_8960,
3149 .tsens_num_sensor = 5,
3150};
3151
3152static struct platform_device msm_tsens_device = {
3153 .name = "tsens8960-tm",
3154 .id = -1,
3155 .dev = {
3156 .platform_data = &msm_tsens_pdata,
3157 },
3158};
3159
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003160#ifdef CONFIG_MSM_FAKE_BATTERY
3161static struct platform_device fish_battery_device = {
3162 .name = "fish_battery",
3163};
3164#endif
3165
David Collins26f05562011-06-20 09:56:28 -07003166static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003167 .name = GPIO_REGULATOR_DEV_NAME,
3168 .id = PM8921_MPP_PM_TO_SYS(7),
3169 .dev = {
3170 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3171 },
3172};
3173
David Collins26f05562011-06-20 09:56:28 -07003174static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003175 .name = GPIO_REGULATOR_DEV_NAME,
3176 .id = 91,
3177 .dev = {
3178 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3179 },
3180};
3181
David Collinsb10be1d2011-09-02 10:29:31 -07003182static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3183 .name = GPIO_REGULATOR_DEV_NAME,
3184 .id = PM8921_GPIO_PM_TO_SYS(17),
3185 .dev = {
3186 .platform_data =
3187 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3188 },
3189};
3190
David Collins26f05562011-06-20 09:56:28 -07003191static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3192 .name = "rpm-regulator",
3193 .id = -1,
3194 .dev = {
3195 .platform_data = &msm_rpm_regulator_pdata,
3196 },
3197};
3198
David Collins4c31a872011-08-31 10:07:10 -07003199static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3200 .phys_addr_base = 0x0010C000,
3201 .reg_offsets = {
3202 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3203 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3204 },
3205 .phys_size = SZ_8K,
3206 .log_len = 4096, /* log's buffer length in bytes */
3207 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3208};
3209
3210static struct platform_device msm_rpm_log_device = {
3211 .name = "msm_rpm_log",
3212 .id = -1,
3213 .dev = {
3214 .platform_data = &msm_rpm_log_pdata,
3215 },
3216};
3217
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003218static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003219 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003220 &msm_device_smd,
3221 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303222 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003223 &msm_device_saw_core0,
3224 &msm_device_saw_core1,
3225 &msm8960_device_ext_5v_vreg,
3226 &msm8960_device_ext_l2_vreg,
3227 &msm8960_device_ssbi_pm8921,
3228 &msm8960_device_qup_spi_gsbi1,
3229 &msm8960_device_qup_i2c_gsbi3,
3230 &msm8960_device_qup_i2c_gsbi4,
3231 &msm8960_device_qup_i2c_gsbi10,
3232#ifndef CONFIG_MSM_DSPS
3233 &msm8960_device_qup_i2c_gsbi12,
3234#endif
3235 &msm_slim_ctrl,
3236 &msm_device_wcnss_wlan,
3237#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3238 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3239 &qcrypto_device,
3240#endif
3241
3242#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3243 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3244 &qcedev_device,
3245#endif
3246#ifdef CONFIG_MSM_ROTATOR
3247 &msm_rotator_device,
3248#endif
3249 &msm_device_sps,
3250#ifdef CONFIG_MSM_FAKE_BATTERY
3251 &fish_battery_device,
3252#endif
3253#ifdef CONFIG_ANDROID_PMEM
3254 &android_pmem_device,
3255 &android_pmem_adsp_device,
3256 &android_pmem_audio_device,
3257#endif
3258 &msm_fb_device,
3259 &msm_device_vidc,
3260 &msm_device_bam_dmux,
3261 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003262
3263#ifdef CONFIG_HW_RANDOM_MSM
3264 &msm_device_rng,
3265#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003266 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003267#ifdef CONFIG_ION_MSM
3268 &ion_dev,
3269#endif
David Collins4c31a872011-08-31 10:07:10 -07003270 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003271#ifdef CONFIG_MSM_QDSS
3272 &msm_etb_device,
3273 &msm_tpiu_device,
3274 &msm_funnel_device,
3275 &msm_ptm_device,
3276#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003277};
3278
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003279static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003280 &msm8960_device_otg,
3281 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003282 &msm_device_hsusb_host,
3283 &android_usb_device,
3284 &msm_device_vidc,
3285 &mipi_dsi_simulator_panel_device,
3286 &msm_bus_apps_fabric,
3287 &msm_bus_sys_fabric,
3288 &msm_bus_mm_fabric,
3289 &msm_bus_sys_fpb,
3290 &msm_bus_cpss_fpb,
3291 &msm_pcm,
3292 &msm_pcm_routing,
3293 &msm_cpudai0,
3294 &msm_cpudai1,
3295 &msm_cpudai_hdmi_rx,
3296 &msm_cpudai_bt_rx,
3297 &msm_cpudai_bt_tx,
3298 &msm_cpudai_fm_rx,
3299 &msm_cpudai_fm_tx,
3300 &msm_cpu_fe,
3301 &msm_stub_codec,
3302 &msm_voice,
3303 &msm_voip,
3304 &msm_lpa_pcm,
3305
3306#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3307 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3308 &qcrypto_device,
3309#endif
3310
3311#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3312 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3313 &qcedev_device,
3314#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003315};
3316
3317static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003318 &msm_kgsl_3d0,
3319 &msm_kgsl_2d0,
3320 &msm_kgsl_2d1,
3321 &mipi_dsi_renesas_panel_device,
3322#ifdef CONFIG_MSM_GEMINI
3323 &msm8960_gemini_device,
3324#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003325};
3326
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003327static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003328 &msm8960_device_otg,
3329 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003330 &msm_device_hsusb_host,
3331 &android_usb_device,
3332 &msm_pcm,
3333 &msm_pcm_routing,
3334 &msm_cpudai0,
3335 &msm_cpudai1,
3336 &msm_cpudai_hdmi_rx,
3337 &msm_cpudai_bt_rx,
3338 &msm_cpudai_bt_tx,
3339 &msm_cpudai_fm_rx,
3340 &msm_cpudai_fm_tx,
3341 &msm_cpu_fe,
3342 &msm_stub_codec,
3343 &msm_kgsl_3d0,
3344#ifdef CONFIG_MSM_KGSL_2D
3345 &msm_kgsl_2d0,
3346 &msm_kgsl_2d1,
3347#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003348 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003349#ifdef CONFIG_MSM_GEMINI
3350 &msm8960_gemini_device,
3351#endif
3352 &msm_voice,
3353 &msm_voip,
3354 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303355 &msm_cpudai_afe_01_rx,
3356 &msm_cpudai_afe_01_tx,
3357 &msm_cpudai_afe_02_rx,
3358 &msm_cpudai_afe_02_tx,
3359 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003360#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3361 &hdmi_msm_device,
3362#endif
3363 &msm_pcm_hostless,
3364 &msm_bus_apps_fabric,
3365 &msm_bus_sys_fabric,
3366 &msm_bus_mm_fabric,
3367 &msm_bus_sys_fpb,
3368 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003369 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003370};
3371
3372static void __init msm8960_i2c_init(void)
3373{
3374 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3375 &msm8960_i2c_qup_gsbi4_pdata;
3376
3377 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3378 &msm8960_i2c_qup_gsbi3_pdata;
3379
3380 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3381 &msm8960_i2c_qup_gsbi10_pdata;
3382
3383 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3384 &msm8960_i2c_qup_gsbi12_pdata;
3385}
3386
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003387static void __init msm8960_gfx_init(void)
3388{
3389 uint32_t soc_platform_version = socinfo_get_platform_version();
3390 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3391 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3392 msm_kgsl_3d0.dev.platform_data;
3393 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3394 320000000;
3395 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3396 266667000;
3397 }
3398}
3399
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003400static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3401 .irq_base = PM8921_IRQ_BASE,
3402 .devirq = MSM_GPIO_TO_INT(104),
3403 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3404};
3405
3406static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3407 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3408};
3409
3410static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3411 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3412};
3413
3414static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3415 .rtc_write_enable = false,
3416};
3417
3418static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3419 .pull_up = 1,
3420 .kpd_trigger_delay_us = 970,
3421 .wakeup = 1,
3422};
3423
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303424/* Rotate lock key is not available so use F1 */
3425#define KEY_ROTATE_LOCK KEY_F1
3426
3427static const unsigned int keymap_liquid[] = {
3428 KEY(0, 0, KEY_VOLUMEUP),
3429 KEY(0, 1, KEY_VOLUMEDOWN),
3430 KEY(1, 3, KEY_ROTATE_LOCK),
3431 KEY(1, 4, KEY_HOME),
3432};
3433
3434static struct matrix_keymap_data keymap_data_liquid = {
3435 .keymap_size = ARRAY_SIZE(keymap_liquid),
3436 .keymap = keymap_liquid,
3437};
3438
3439static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3440 .input_name = "keypad_8960_liquid",
3441 .input_phys_device = "keypad_8960/input0",
3442 .num_rows = 2,
3443 .num_cols = 5,
3444 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3445 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3446 .debounce_ms = 15,
3447 .scan_delay_ms = 32,
3448 .row_hold_ns = 91500,
3449 .wakeup = 1,
3450 .keymap_data = &keymap_data_liquid,
3451};
3452
3453
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003454static const unsigned int keymap[] = {
3455 KEY(0, 0, KEY_VOLUMEUP),
3456 KEY(0, 1, KEY_VOLUMEDOWN),
3457 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3458 KEY(0, 3, KEY_CAMERA_FOCUS),
3459};
3460
3461static struct matrix_keymap_data keymap_data = {
3462 .keymap_size = ARRAY_SIZE(keymap),
3463 .keymap = keymap,
3464};
3465
3466static struct pm8xxx_keypad_platform_data keypad_data = {
3467 .input_name = "keypad_8960",
3468 .input_phys_device = "keypad_8960/input0",
3469 .num_rows = 1,
3470 .num_cols = 5,
3471 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3472 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3473 .debounce_ms = 15,
3474 .scan_delay_ms = 32,
3475 .row_hold_ns = 91500,
3476 .wakeup = 1,
3477 .keymap_data = &keymap_data,
3478};
3479
3480static const unsigned int keymap_sim[] = {
3481 KEY(0, 0, KEY_7),
3482 KEY(0, 1, KEY_DOWN),
3483 KEY(0, 2, KEY_UP),
3484 KEY(0, 3, KEY_RIGHT),
3485 KEY(0, 4, KEY_ENTER),
3486 KEY(0, 5, KEY_L),
3487 KEY(0, 6, KEY_BACK),
3488 KEY(0, 7, KEY_M),
3489
3490 KEY(1, 0, KEY_LEFT),
3491 KEY(1, 1, KEY_SEND),
3492 KEY(1, 2, KEY_1),
3493 KEY(1, 3, KEY_4),
3494 KEY(1, 4, KEY_CLEAR),
3495 KEY(1, 5, KEY_MSDOS),
3496 KEY(1, 6, KEY_SPACE),
3497 KEY(1, 7, KEY_COMMA),
3498
3499 KEY(2, 0, KEY_6),
3500 KEY(2, 1, KEY_5),
3501 KEY(2, 2, KEY_8),
3502 KEY(2, 3, KEY_3),
3503 KEY(2, 4, KEY_NUMERIC_STAR),
3504 KEY(2, 5, KEY_UP),
3505 KEY(2, 6, KEY_DOWN),
3506 KEY(2, 7, KEY_LEFTSHIFT),
3507
3508 KEY(3, 0, KEY_9),
3509 KEY(3, 1, KEY_NUMERIC_POUND),
3510 KEY(3, 2, KEY_0),
3511 KEY(3, 3, KEY_2),
3512 KEY(3, 4, KEY_SLEEP),
3513 KEY(3, 5, KEY_F1),
3514 KEY(3, 6, KEY_F2),
3515 KEY(3, 7, KEY_F3),
3516
3517 KEY(4, 0, KEY_BACK),
3518 KEY(4, 1, KEY_HOME),
3519 KEY(4, 2, KEY_MENU),
3520 KEY(4, 3, KEY_VOLUMEUP),
3521 KEY(4, 4, KEY_VOLUMEDOWN),
3522 KEY(4, 5, KEY_F4),
3523 KEY(4, 6, KEY_F5),
3524 KEY(4, 7, KEY_F6),
3525
3526 KEY(5, 0, KEY_R),
3527 KEY(5, 1, KEY_T),
3528 KEY(5, 2, KEY_Y),
3529 KEY(5, 3, KEY_LEFTALT),
3530 KEY(5, 4, KEY_KPENTER),
3531 KEY(5, 5, KEY_Q),
3532 KEY(5, 6, KEY_W),
3533 KEY(5, 7, KEY_E),
3534
3535 KEY(6, 0, KEY_F),
3536 KEY(6, 1, KEY_G),
3537 KEY(6, 2, KEY_H),
3538 KEY(6, 3, KEY_CAPSLOCK),
3539 KEY(6, 4, KEY_PAGEUP),
3540 KEY(6, 5, KEY_A),
3541 KEY(6, 6, KEY_S),
3542 KEY(6, 7, KEY_D),
3543
3544 KEY(7, 0, KEY_V),
3545 KEY(7, 1, KEY_B),
3546 KEY(7, 2, KEY_N),
3547 KEY(7, 3, KEY_MENU),
3548 KEY(7, 4, KEY_PAGEDOWN),
3549 KEY(7, 5, KEY_Z),
3550 KEY(7, 6, KEY_X),
3551 KEY(7, 7, KEY_C),
3552
3553 KEY(8, 0, KEY_P),
3554 KEY(8, 1, KEY_J),
3555 KEY(8, 2, KEY_K),
3556 KEY(8, 3, KEY_INSERT),
3557 KEY(8, 4, KEY_LINEFEED),
3558 KEY(8, 5, KEY_U),
3559 KEY(8, 6, KEY_I),
3560 KEY(8, 7, KEY_O),
3561
3562 KEY(9, 0, KEY_4),
3563 KEY(9, 1, KEY_5),
3564 KEY(9, 2, KEY_6),
3565 KEY(9, 3, KEY_7),
3566 KEY(9, 4, KEY_8),
3567 KEY(9, 5, KEY_1),
3568 KEY(9, 6, KEY_2),
3569 KEY(9, 7, KEY_3),
3570
3571 KEY(10, 0, KEY_F7),
3572 KEY(10, 1, KEY_F8),
3573 KEY(10, 2, KEY_F9),
3574 KEY(10, 3, KEY_F10),
3575 KEY(10, 4, KEY_FN),
3576 KEY(10, 5, KEY_9),
3577 KEY(10, 6, KEY_0),
3578 KEY(10, 7, KEY_DOT),
3579
3580 KEY(11, 0, KEY_LEFTCTRL),
3581 KEY(11, 1, KEY_F11),
3582 KEY(11, 2, KEY_ENTER),
3583 KEY(11, 3, KEY_SEARCH),
3584 KEY(11, 4, KEY_DELETE),
3585 KEY(11, 5, KEY_RIGHT),
3586 KEY(11, 6, KEY_LEFT),
3587 KEY(11, 7, KEY_RIGHTSHIFT),
3588 KEY(0, 0, KEY_VOLUMEUP),
3589 KEY(0, 1, KEY_VOLUMEDOWN),
3590 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3591 KEY(0, 3, KEY_CAMERA_FOCUS),
3592};
3593
3594static struct matrix_keymap_data keymap_data_sim = {
3595 .keymap_size = ARRAY_SIZE(keymap_sim),
3596 .keymap = keymap_sim,
3597};
3598
3599static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3600 .input_name = "keypad_8960",
3601 .input_phys_device = "keypad_8960/input0",
3602 .num_rows = 12,
3603 .num_cols = 8,
3604 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3605 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3606 .debounce_ms = 15,
3607 .scan_delay_ms = 32,
3608 .row_hold_ns = 91500,
3609 .wakeup = 1,
3610 .keymap_data = &keymap_data_sim,
3611};
3612
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003613static int pm8921_therm_mitigation[] = {
3614 1100,
3615 700,
3616 600,
3617 325,
3618};
3619
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003620static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003621 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003622 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003623 .max_voltage = 4200,
3624 .min_voltage = 3200,
3625 .resume_voltage = 4100,
3626 .term_current = 100,
3627 .cool_temp = 10,
3628 .warm_temp = 40,
3629 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003630 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003631 .cool_bat_chg_current = 350,
3632 .warm_bat_chg_current = 350,
3633 .cool_bat_voltage = 4100,
3634 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003635 .thermal_mitigation = pm8921_therm_mitigation,
3636 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003637};
3638
3639static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3640 .priority = 0,
3641};
3642
3643static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3644 .r_sense = 10,
3645 .i_test = 2500,
3646 .v_failure = 3000,
3647 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003648};
3649
Jay Chokshide4cefb2011-08-04 18:10:44 -07003650#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3651
3652/**
3653 * 'flag' stores three values; led id, led mode, and max current of led.
3654 * The bit packing format is as follow,
3655 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3656 * led_id (1 nibble)
3657 */
3658#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3659 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3660 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3661 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3662 PM8XXX_LED_MAX_CURRENT_MASK))
3663
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003664static struct led_info pm8921_led_info[] = {
3665 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003666 .name = "led:usb",
3667 .default_trigger = "usb-online",
3668 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3669 PM8XXX_LED_MODE_MANUAL,
3670 PM8921_LC_LED_MAX_CURRENT),
3671 },
3672 [1] = {
3673 .name = "led:ac",
3674 .default_trigger = "ac-online",
3675 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3676 PM8XXX_LED_MODE_MANUAL,
3677 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003678 },
3679};
3680
3681static struct led_platform_data pm8xxx_leds_pdata = {
3682 .num_leds = ARRAY_SIZE(pm8921_led_info),
3683 .leds = pm8921_led_info,
3684};
3685
3686static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3687 .irq_pdata = &pm8xxx_irq_pdata,
3688 .gpio_pdata = &pm8xxx_gpio_pdata,
3689 .mpp_pdata = &pm8xxx_mpp_pdata,
3690 .rtc_pdata = &pm8xxx_rtc_pdata,
3691 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3692 .keypad_pdata = &keypad_data,
3693 .misc_pdata = &pm8xxx_misc_pdata,
3694 .regulator_pdatas = msm_pm8921_regulator_pdata,
3695 .charger_pdata = &pm8921_chg_pdata,
3696 .bms_pdata = &pm8921_bms_pdata,
3697 .adc_pdata = &pm8921_adc_pdata,
3698 .leds_pdata = &pm8xxx_leds_pdata,
3699};
3700
3701static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3702 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3703 .slave = {
3704 .name = "pm8921-core",
3705 .platform_data = &pm8921_platform_data,
3706 },
3707};
3708
3709static void msm8960_wcnss_init(void)
3710{
3711 int i, ret, j;
3712
3713 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3714 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3715 "wcnss_5_wire");
3716 if (ret) {
3717 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3718 wcnss_5wire_interface[i].gpio, ret);
3719 goto fail;
3720 }
3721 }
3722
3723 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3724
3725 return;
3726
3727fail:
3728 for (j = 0; j < i; j++)
3729 gpio_free(wcnss_5wire_interface[j].gpio);
3730}
3731
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003732#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003733static int ethernet_init(void)
3734{
3735 int ret;
3736 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3737 if (ret) {
3738 pr_err("ks8851 gpio_request failed: %d\n", ret);
3739 goto fail;
3740 }
3741
3742 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3743 if (ret) {
3744 pr_err("ks8851 gpio_request failed: %d\n", ret);
3745 goto fail_rst;
3746 }
3747
3748 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3749 if (ret) {
3750 pr_err("ks8851 gpio_request failed: %d\n", ret);
3751 goto fail_cs;
3752 }
3753
3754 gpio_direction_output(FPGA_CS_GPIO, 1);
3755 gpio_direction_output(KS8851_RST_GPIO, 1);
3756 return 0;
3757fail_cs:
3758 gpio_free(KS8851_RST_GPIO);
3759fail_rst:
3760 gpio_free(KS8851_IRQ_GPIO);
3761fail:
3762 return ret;
3763}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003764#else
3765static int ethernet_init(void)
3766{
3767 return 0;
3768}
3769#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003770
3771static struct msm_cpuidle_state msm_cstates[] __initdata = {
3772 {0, 0, "C0", "WFI",
3773 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3774
3775 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3776 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3777
3778 {0, 2, "C2", "POWER_COLLAPSE",
3779 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3780
3781 {1, 0, "C0", "WFI",
3782 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3783
3784 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3785 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3786};
3787
3788static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3789 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3790 .idle_supported = 1,
3791 .suspend_supported = 1,
3792 .idle_enabled = 0,
3793 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003794 },
3795
3796 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3797 .idle_supported = 1,
3798 .suspend_supported = 1,
3799 .idle_enabled = 0,
3800 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003801 },
3802
3803 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3804 .idle_supported = 1,
3805 .suspend_supported = 1,
3806 .idle_enabled = 1,
3807 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003808 },
3809
3810 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3811 .idle_supported = 0,
3812 .suspend_supported = 1,
3813 .idle_enabled = 0,
3814 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003815 },
3816
3817 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3818 .idle_supported = 1,
3819 .suspend_supported = 1,
3820 .idle_enabled = 0,
3821 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003822 },
3823
3824 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3825 .idle_supported = 1,
3826 .suspend_supported = 0,
3827 .idle_enabled = 1,
3828 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003829 },
3830};
3831
3832static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3833 {
3834 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3835 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3836 true,
3837 1, 8000, 100000, 1,
3838 },
3839
3840 {
3841 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3842 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3843 true,
3844 1500, 5000, 60100000, 3000,
3845 },
3846
3847 {
3848 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3849 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3850 false,
3851 1800, 5000, 60350000, 3500,
3852 },
3853
3854 {
3855 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3856 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3857 false,
3858 2800, 2500, 65350000, 4800,
3859 },
3860
3861 {
3862 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3863 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3864 false,
3865 3800, 4500, 67850000, 5500,
3866 },
3867
3868 {
3869 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3870 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3871 false,
3872 4800, 2000, 71850000, 6800,
3873 },
3874
3875 {
3876 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3877 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3878 false,
3879 6800, 500, 75850000, 8800,
3880 },
3881
3882 {
3883 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3884 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3885 false,
3886 7800, 0, 76350000, 9800,
3887 },
3888};
3889
3890#ifdef CONFIG_I2C
3891#define I2C_SURF 1
3892#define I2C_FFA (1 << 1)
3893#define I2C_RUMI (1 << 2)
3894#define I2C_SIM (1 << 3)
3895#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003896#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003897
3898struct i2c_registry {
3899 u8 machs;
3900 int bus;
3901 struct i2c_board_info *info;
3902 int len;
3903};
3904
3905#ifdef CONFIG_MSM_CAMERA
3906static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3907#ifdef CONFIG_IMX074
3908 {
3909 I2C_BOARD_INFO("imx074", 0x1A),
3910 },
3911#endif
3912#ifdef CONFIG_OV2720
3913 {
3914 I2C_BOARD_INFO("ov2720", 0x6C),
3915 },
3916#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003917 {
3918 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3919 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303920#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3921 {
3922 I2C_BOARD_INFO("sc628a", 0x6E),
3923 },
3924#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003925};
3926#endif
3927
3928/* Sensors DSPS platform data */
3929#ifdef CONFIG_MSM_DSPS
3930#define DSPS_PIL_GENERIC_NAME "dsps"
3931#endif /* CONFIG_MSM_DSPS */
3932
3933static void __init msm8960_init_dsps(void)
3934{
3935#ifdef CONFIG_MSM_DSPS
3936 struct msm_dsps_platform_data *pdata =
3937 msm_dsps_device.dev.platform_data;
3938 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3939 pdata->gpios = NULL;
3940 pdata->gpios_num = 0;
3941
3942 platform_device_register(&msm_dsps_device);
3943#endif /* CONFIG_MSM_DSPS */
3944}
3945
Amir Samuelov5137e392011-09-21 17:31:25 +03003946#ifdef CONFIG_ISL9519_CHARGER
3947static struct isl_platform_data isl_data __initdata = {
3948 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3949 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3950 .max_system_voltage = 4200,
3951 .min_system_voltage = 3200,
3952 .chgcurrent = 1000, /* 1900, */
3953 .term_current = 400, /* Need fine tuning */
3954 .input_current = 2048,
3955};
3956
3957static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3958 {
3959 I2C_BOARD_INFO("isl9519q", 0x9),
3960 .irq = 0, /* Not required when notify-by-pmic */
3961 .platform_data = &isl_data,
3962 },
3963};
3964#endif /* CONFIG_ISL9519_CHARGER */
3965
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003966static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3967#ifdef CONFIG_MSM_CAMERA
3968 {
Amir Samuelov05f87802011-08-27 18:30:12 +03003969 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003970 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3971 msm_camera_boardinfo,
3972 ARRAY_SIZE(msm_camera_boardinfo),
3973 },
3974#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03003975#ifdef CONFIG_ISL9519_CHARGER
3976 {
3977 I2C_LIQUID,
3978 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
3979 isl_charger_i2c_info,
3980 ARRAY_SIZE(isl_charger_i2c_info),
3981 },
3982#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003983 {
3984 I2C_SURF | I2C_FFA | I2C_FLUID,
3985 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3986 cyttsp_info,
3987 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003988 },
Mohan Pallaka50837382011-09-07 11:00:57 +05303989 {
3990 I2C_LIQUID,
3991 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3992 mxt_device_info,
3993 ARRAY_SIZE(mxt_device_info),
3994 },
3995
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003996};
3997#endif /* CONFIG_I2C */
3998
3999static void __init register_i2c_devices(void)
4000{
4001#ifdef CONFIG_I2C
4002 u8 mach_mask = 0;
4003 int i;
4004
4005 /* Build the matching 'supported_machs' bitmask */
4006 if (machine_is_msm8960_cdp())
4007 mach_mask = I2C_SURF;
4008 else if (machine_is_msm8960_rumi3())
4009 mach_mask = I2C_RUMI;
4010 else if (machine_is_msm8960_sim())
4011 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004012 else if (machine_is_msm8960_fluid())
4013 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004014 else if (machine_is_msm8960_liquid())
4015 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004016 else if (machine_is_msm8960_mtp())
4017 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004018 else
4019 pr_err("unmatched machine ID in register_i2c_devices\n");
4020
4021 /* Run the array and install devices as appropriate */
4022 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4023 if (msm8960_i2c_devices[i].machs & mach_mask)
4024 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4025 msm8960_i2c_devices[i].info,
4026 msm8960_i2c_devices[i].len);
4027 }
4028#endif
4029}
4030
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004031static void __init msm8960_sim_init(void)
4032{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004033 if (socinfo_init() < 0)
4034 pr_err("socinfo_init() failed!\n");
4035
4036 BUG_ON(msm_rpm_init(&msm_rpm_data));
4037 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4038 ARRAY_SIZE(msm_rpmrs_levels)));
4039 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004040 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004041 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004042 msm8960_device_ssbi_pm8921.dev.platform_data =
4043 &msm8960_ssbi_pm8921_pdata;
4044 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004045
4046 /* Simulator supports a QWERTY keypad */
4047 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4048
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004049 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4050 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4051 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004052 gpiomux_init();
4053 ethernet_init();
4054 msm8960_i2c_init();
4055 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4056 msm_spm_l2_init(msm_spm_l2_data);
4057 msm8960_init_buses();
4058 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4059 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004060 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004061 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004062
4063 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4064 &msm8960_qup_spi_gsbi1_pdata;
4065 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4066
4067 msm8960_init_mmc();
4068 msm_fb_add_devices();
4069 slim_register_board_info(msm_slim_devices,
4070 ARRAY_SIZE(msm_slim_devices));
4071 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4072 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4073 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4074 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004075}
4076
4077static void __init msm8960_rumi3_init(void)
4078{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004079 if (socinfo_init() < 0)
4080 pr_err("socinfo_init() failed!\n");
4081
4082 BUG_ON(msm_rpm_init(&msm_rpm_data));
4083 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4084 ARRAY_SIZE(msm_rpmrs_levels)));
4085 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004086 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004087 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004088 gpiomux_init();
4089 ethernet_init();
4090 msm8960_device_ssbi_pm8921.dev.platform_data =
4091 &msm8960_ssbi_pm8921_pdata;
4092 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4093 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4094 &msm8960_qup_spi_gsbi1_pdata;
4095 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4096 msm8960_i2c_init();
4097 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4098 msm_spm_l2_init(msm_spm_l2_data);
4099 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4100 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004101 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004102 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004103 register_i2c_devices();
4104 msm_fb_add_devices();
4105 slim_register_board_info(msm_slim_devices,
4106 ARRAY_SIZE(msm_slim_devices));
4107 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4108 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4109 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4110 msm_pm_data);
4111}
4112
4113static void __init msm8960_cdp_init(void)
4114{
4115 if (socinfo_init() < 0)
4116 pr_err("socinfo_init() failed!\n");
4117
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004118 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4119 pr_err("meminfo_init() failed!\n");
4120
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004121 BUG_ON(msm_rpm_init(&msm_rpm_data));
4122 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4123 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004124
4125 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004126 regulator_suppress_info_printing();
4127 if (msm_xo_init())
4128 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004129 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004130 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004131 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4132 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4133 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004134 gpiomux_init();
4135 ethernet_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304136 if (machine_is_msm8960_liquid())
4137 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004138 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4139 &msm8960_qup_spi_gsbi1_pdata;
4140 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4141 msm8960_device_ssbi_pm8921.dev.platform_data =
4142 &msm8960_ssbi_pm8921_pdata;
4143 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4144 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004145 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004146 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4147 msm_spm_l2_init(msm_spm_l2_data);
4148 msm8960_init_buses();
4149 platform_add_devices(msm_footswitch_devices,
4150 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004151 if (machine_is_msm8960_liquid())
4152 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004153 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4154 pm8921_gpio_mpp_init();
4155 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4156 msm8960_init_cam();
4157 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004158 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304159 if (machine_is_msm8960_liquid())
4160 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004161 register_i2c_devices();
4162 msm8960_wcnss_init();
4163 msm_fb_add_devices();
4164 slim_register_board_info(msm_slim_devices,
4165 ARRAY_SIZE(msm_slim_devices));
4166 msm8960_init_dsps();
4167 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4168 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4169 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4170 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004171 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004172}
4173
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004174MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4175 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004176 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004177 .init_irq = msm8960_init_irq,
4178 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004179 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004180 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004181MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004182
4183MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4184 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004185 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004186 .init_irq = msm8960_init_irq,
4187 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004188 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004189 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004190MACHINE_END
4191
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004192MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4193 .map_io = msm8960_map_io,
4194 .reserve = msm8960_reserve,
4195 .init_irq = msm8960_init_irq,
4196 .timer = &msm_timer,
4197 .init_machine = msm8960_cdp_init,
4198 .init_early = msm8960_allocate_memory_regions,
4199MACHINE_END
4200
4201MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4202 .map_io = msm8960_map_io,
4203 .reserve = msm8960_reserve,
4204 .init_irq = msm8960_init_irq,
4205 .timer = &msm_timer,
4206 .init_machine = msm8960_cdp_init,
4207 .init_early = msm8960_allocate_memory_regions,
4208MACHINE_END
4209
4210MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4211 .map_io = msm8960_map_io,
4212 .reserve = msm8960_reserve,
4213 .init_irq = msm8960_init_irq,
4214 .timer = &msm_timer,
4215 .init_machine = msm8960_cdp_init,
4216 .init_early = msm8960_allocate_memory_regions,
4217MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004218
4219MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4220 .map_io = msm8960_map_io,
4221 .reserve = msm8960_reserve,
4222 .init_irq = msm8960_init_irq,
4223 .timer = &msm_timer,
4224 .init_machine = msm8960_cdp_init,
4225 .init_early = msm8960_allocate_memory_regions,
4226MACHINE_END