blob: a13503744d66cf4c9c05af98bee1d729194c2b92 [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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019#include <linux/gpio.h>
20#include <linux/msm_ssbi.h>
21#include <linux/regulator/gpio-regulator.h>
22#include <linux/mfd/pm8xxx/pm8921.h>
23#include <linux/regulator/consumer.h>
24#include <linux/spi/spi.h>
25#include <linux/slimbus/slimbus.h>
26#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060027#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#ifdef CONFIG_ANDROID_PMEM
29#include <linux/android_pmem.h>
30#endif
31#include <linux/cyttsp.h>
32#include <linux/dma-mapping.h>
33#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070034#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <linux/leds.h>
36#include <linux/leds-pm8xxx.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080037
38#include <asm/mach-types.h>
39#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070040#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080041#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080043
44#include <mach/board.h>
45#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <mach/msm_spi.h>
47#ifdef CONFIG_USB_MSM_OTG_72K
48#include <mach/msm_hsusb.h>
49#else
50#include <linux/usb/msm_hsusb.h>
51#endif
52#include <linux/usb/android.h>
53#include <mach/usbdiag.h>
54#include <mach/socinfo.h>
55#include <mach/rpm.h>
56#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070057#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070058#include <mach/msm_bus_board.h>
59#include <mach/msm_memtypes.h>
60#include <mach/dma.h>
61#include <mach/msm_dsps.h>
62#include <mach/msm_xo.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080063
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064#ifdef CONFIG_WCD9310_CODEC
65#include <linux/slimbus/slimbus.h>
66#include <linux/mfd/wcd9310/core.h>
67#include <linux/mfd/wcd9310/pdata.h>
68#endif
69
Laura Abbottd6183792011-08-19 13:42:24 -070070#include <linux/ion.h>
71#include <mach/ion.h>
72
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070073#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080074#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070075#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076#include "spm.h"
77#include "board-msm8960.h"
78#include "pm.h"
79#include "cpuidle.h"
80#include "rpm_resources.h"
81#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070082#include "acpuclock.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083
84static struct platform_device msm_fm_platform_init = {
85 .name = "iris_fm",
86 .id = -1,
87};
88
89struct pm8xxx_gpio_init {
90 unsigned gpio;
91 struct pm_gpio config;
92};
93
94struct pm8xxx_mpp_init {
95 unsigned mpp;
96 struct pm8xxx_mpp_config_data config;
97};
98
99#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
100 _func, _inv, _disable) \
101{ \
102 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
103 .config = { \
104 .direction = _dir, \
105 .output_buffer = _buf, \
106 .output_value = _val, \
107 .pull = _pull, \
108 .vin_sel = _vin, \
109 .out_strength = _out_strength, \
110 .function = _func, \
111 .inv_int_pol = _inv, \
112 .disable_pin = _disable, \
113 } \
114}
115
116#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
117{ \
118 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
119 .config = { \
120 .type = PM8XXX_MPP_TYPE_##_type, \
121 .level = _level, \
122 .control = PM8XXX_MPP_##_control, \
123 } \
124}
125
126#define PM8XXX_GPIO_DISABLE(_gpio) \
127 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
128 0, 0, 0, 1)
129
130#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
131 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
132 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
133 PM_GPIO_STRENGTH_HIGH, \
134 PM_GPIO_FUNC_NORMAL, 0, 0)
135
136#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
138 _pull, PM_GPIO_VIN_S4, \
139 PM_GPIO_STRENGTH_NO, \
140 PM_GPIO_FUNC_NORMAL, 0, 0)
141
142#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
143 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
144 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
145 PM_GPIO_STRENGTH_HIGH, \
146 _func, 0, 0)
147
148/* Initial PM8921 GPIO configurations */
149static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
150 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
151 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
152 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
153 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700154 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700155 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
156 PM8XXX_GPIO_OUTPUT(43, 0), /* DISP_RESET_N */
157};
158
159/* Initial PM8921 MPP configurations */
160static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
161 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
162 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
163 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6,
164 DOUT_CTRL_LOW),
165 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
166 DOUT_CTRL_LOW),
167};
168
169static void __init pm8921_gpio_mpp_init(void)
170{
171 int i, rc;
172
173 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
174 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
175 &pm8921_gpios[i].config);
176 if (rc) {
177 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
178 break;
179 }
180 }
181
182 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
183 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
184 &pm8921_mpps[i].config);
185 if (rc) {
186 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
187 break;
188 }
189 }
190}
191
192#define FPGA_CS_GPIO 14
193#define KS8851_RST_GPIO 89
194#define KS8851_IRQ_GPIO 90
195
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700196#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
197enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700198 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700199 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
200 /* CAM Expander */
201 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
202 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
203 GPIO_CAM_GP_AFBUSY,
204 GPIO_CAM_GP_STROBE_CE,
205 GPIO_CAM_GP_CAM1MP_XCLR,
206 GPIO_CAM_GP_CAMIF_RESET_N,
207 GPIO_CAM_GP_XMT_FLASH_INT,
208 GPIO_CAM_GP_LED_EN1,
209 GPIO_CAM_GP_LED_EN2,
210
211};
212#endif
213
Harini Jayaraman608d0462011-08-09 19:10:03 -0600214/* The SPI configurations apply to GSBI 1*/
215static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700216 .func = GPIOMUX_FUNC_1,
217 .drv = GPIOMUX_DRV_8MA,
218 .pull = GPIOMUX_PULL_NONE,
219};
220
Harini Jayaraman608d0462011-08-09 19:10:03 -0600221static struct gpiomux_setting spi_suspended_config = {
222 .func = GPIOMUX_FUNC_GPIO,
223 .drv = GPIOMUX_DRV_2MA,
224 .pull = GPIOMUX_PULL_DOWN,
225};
226
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700227static struct gpiomux_setting gsbi3 = {
228 .func = GPIOMUX_FUNC_1,
229 .drv = GPIOMUX_DRV_8MA,
230 .pull = GPIOMUX_PULL_NONE,
231};
232
233static struct gpiomux_setting gsbi4 = {
234 .func = GPIOMUX_FUNC_1,
235 .drv = GPIOMUX_DRV_8MA,
236 .pull = GPIOMUX_PULL_NONE,
237};
238
239static struct gpiomux_setting gsbi5 = {
240 .func = GPIOMUX_FUNC_1,
241 .drv = GPIOMUX_DRV_8MA,
242 .pull = GPIOMUX_PULL_NONE,
243};
244
245static struct gpiomux_setting gsbi10 = {
246 .func = GPIOMUX_FUNC_2,
247 .drv = GPIOMUX_DRV_8MA,
248 .pull = GPIOMUX_PULL_NONE,
249};
250
251static struct gpiomux_setting gsbi12 = {
252 .func = GPIOMUX_FUNC_1,
253 .drv = GPIOMUX_DRV_8MA,
254 .pull = GPIOMUX_PULL_NONE,
255};
256
257static struct gpiomux_setting cdc_mclk = {
258 .func = GPIOMUX_FUNC_1,
259 .drv = GPIOMUX_DRV_8MA,
260 .pull = GPIOMUX_PULL_NONE,
261};
262
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700263#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264static struct gpiomux_setting gpio_eth_config = {
265 .pull = GPIOMUX_PULL_NONE,
266 .drv = GPIOMUX_DRV_8MA,
267 .func = GPIOMUX_FUNC_GPIO,
268};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700269#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700270
271static struct gpiomux_setting slimbus = {
272 .func = GPIOMUX_FUNC_1,
273 .drv = GPIOMUX_DRV_8MA,
274 .pull = GPIOMUX_PULL_KEEPER,
275};
276
277struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700278#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279 {
280 .gpio = KS8851_IRQ_GPIO,
281 .settings = {
282 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
283 }
284 },
285 {
286 .gpio = KS8851_RST_GPIO,
287 .settings = {
288 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
289 }
290 },
291 {
292 .gpio = FPGA_CS_GPIO,
293 .settings = {
294 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
295 }
296 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700297#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700298};
299
300static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
301 {
302 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
303 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600304 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
305 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306 },
307 },
308 {
309 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
310 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600311 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
312 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313 },
314 },
315 {
316 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
317 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600318 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
319 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320 },
321 },
322 {
323 .gpio = 9, /* GSBI1 QUP SPI_CLK */
324 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600325 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
326 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700327 },
328 },
329 {
330 .gpio = 16, /* GSBI3 I2C QUP SDA */
331 .settings = {
332 [GPIOMUX_SUSPENDED] = &gsbi3,
333 },
334 },
335 {
336 .gpio = 17, /* GSBI3 I2C QUP SCL */
337 .settings = {
338 [GPIOMUX_SUSPENDED] = &gsbi3,
339 },
340 },
341 {
342 .gpio = 20, /* GSBI4 I2C QUP SDA */
343 .settings = {
344 [GPIOMUX_SUSPENDED] = &gsbi4,
345 },
346 },
347 {
348 .gpio = 21, /* GSBI4 I2C QUP SCL */
349 .settings = {
350 [GPIOMUX_SUSPENDED] = &gsbi4,
351 },
352 },
353 {
354 .gpio = 22, /* GSBI5 UART2 */
355 .settings = {
356 [GPIOMUX_SUSPENDED] = &gsbi5,
357 },
358 },
359 {
360 .gpio = 23, /* GSBI5 UART2 */
361 .settings = {
362 [GPIOMUX_SUSPENDED] = &gsbi5,
363 },
364 },
365 {
366 .gpio = 24, /* GSBI5 UART2 */
367 .settings = {
368 [GPIOMUX_SUSPENDED] = &gsbi5,
369 },
370 },
371 {
372 .gpio = 25, /* GSBI5 UART2 */
373 .settings = {
374 [GPIOMUX_SUSPENDED] = &gsbi5,
375 },
376 },
377 {
378 .gpio = 44, /* GSBI12 I2C QUP SDA */
379 .settings = {
380 [GPIOMUX_SUSPENDED] = &gsbi12,
381 },
382 },
383 {
384 .gpio = 45, /* GSBI12 I2C QUP SCL */
385 .settings = {
386 [GPIOMUX_SUSPENDED] = &gsbi12,
387 },
388 },
389 {
390 .gpio = 73, /* GSBI10 I2C QUP SDA */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi10,
393 },
394 },
395 {
396 .gpio = 74, /* GSBI10 I2C QUP SCL */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi10,
399 },
400 },
401};
402
403static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
404 {
405 .gpio = 60, /* slimbus data */
406 .settings = {
407 [GPIOMUX_SUSPENDED] = &slimbus,
408 },
409 },
410 {
411 .gpio = 61, /* slimbus clk */
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &slimbus,
414 },
415 },
416};
417
418static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
419 {
420 .gpio = 59,
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &cdc_mclk,
423 },
424 },
425};
426static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
427 .func = GPIOMUX_FUNC_GPIO,
428 .drv = GPIOMUX_DRV_2MA,
429 .pull = GPIOMUX_PULL_NONE,
430};
431
432static struct gpiomux_setting wcnss_5wire_active_cfg = {
433 .func = GPIOMUX_FUNC_1,
434 .drv = GPIOMUX_DRV_6MA,
435 .pull = GPIOMUX_PULL_DOWN,
436};
437
438static struct msm_gpiomux_config wcnss_5wire_interface[] = {
439 {
440 .gpio = 84,
441 .settings = {
442 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
443 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
444 },
445 },
446 {
447 .gpio = 85,
448 .settings = {
449 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
450 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
451 },
452 },
453 {
454 .gpio = 86,
455 .settings = {
456 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
457 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
458 },
459 },
460 {
461 .gpio = 87,
462 .settings = {
463 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
464 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
465 },
466 },
467 {
468 .gpio = 88,
469 .settings = {
470 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
471 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
472 },
473 },
474};
Nishant Pandit474f2252011-07-23 23:17:56 +0530475static struct gpiomux_setting cam_settings[4] = {
476 {
477 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
478 .drv = GPIOMUX_DRV_2MA,
479 .pull = GPIOMUX_PULL_DOWN,
480 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700481
Nishant Pandit474f2252011-07-23 23:17:56 +0530482 {
483 .func = GPIOMUX_FUNC_1, /*active 1*/
484 .drv = GPIOMUX_DRV_2MA,
485 .pull = GPIOMUX_PULL_NONE,
486 },
487
488 {
489 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
490 .drv = GPIOMUX_DRV_2MA,
491 .pull = GPIOMUX_PULL_NONE,
492 },
493
494 {
495 .func = GPIOMUX_FUNC_1, /*active 3*/
496 .drv = GPIOMUX_DRV_8MA,
497 .pull = GPIOMUX_PULL_UP,
498 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700499};
500
Nishant Pandit474f2252011-07-23 23:17:56 +0530501static struct msm_gpiomux_config msm8960_cam_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700502 {
503 .gpio = 2,
504 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530505 [GPIOMUX_ACTIVE] = &cam_settings[2],
506 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700507 },
508 },
509 {
510 .gpio = 3,
511 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530512 [GPIOMUX_ACTIVE] = &cam_settings[1],
513 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700514 },
515 },
516 {
517 .gpio = 4,
518 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530519 [GPIOMUX_ACTIVE] = &cam_settings[1],
520 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700521 },
522 },
523 {
524 .gpio = 5,
525 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530526 [GPIOMUX_ACTIVE] = &cam_settings[1],
527 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700528 },
529 },
530 {
531 .gpio = 18,
532 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530533 [GPIOMUX_ACTIVE] = &cam_settings[3],
534 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700535 },
536 },
537 {
538 .gpio = 19,
539 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530540 [GPIOMUX_ACTIVE] = &cam_settings[3],
541 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700542 },
543 },
544 {
545 .gpio = 20,
546 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530547 [GPIOMUX_ACTIVE] = &cam_settings[3],
548 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700549 },
550 },
551 {
552 .gpio = 21,
553 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530554 [GPIOMUX_ACTIVE] = &cam_settings[3],
555 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700556 },
557 },
558 {
559 .gpio = 76,
560 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530561 [GPIOMUX_ACTIVE] = &cam_settings[2],
562 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700563 },
564 },
565 {
566 .gpio = 107,
567 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530568 [GPIOMUX_ACTIVE] = &cam_settings[2],
569 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700570 },
571 },
572};
573
574static struct gpiomux_setting cyts_resout_sus_cfg = {
575 .func = GPIOMUX_FUNC_GPIO,
576 .drv = GPIOMUX_DRV_6MA,
577 .pull = GPIOMUX_PULL_UP,
578};
579
580static struct gpiomux_setting cyts_resout_act_cfg = {
581 .func = GPIOMUX_FUNC_GPIO,
582 .drv = GPIOMUX_DRV_6MA,
583 .pull = GPIOMUX_PULL_UP,
584};
585
586static struct gpiomux_setting cyts_sleep_sus_cfg = {
587 .func = GPIOMUX_FUNC_GPIO,
588 .drv = GPIOMUX_DRV_6MA,
589 .pull = GPIOMUX_PULL_DOWN,
590};
591
592static struct gpiomux_setting cyts_sleep_act_cfg = {
593 .func = GPIOMUX_FUNC_GPIO,
594 .drv = GPIOMUX_DRV_6MA,
595 .pull = GPIOMUX_PULL_DOWN,
596};
597
598static struct gpiomux_setting cyts_int_act_cfg = {
599 .func = GPIOMUX_FUNC_GPIO,
600 .drv = GPIOMUX_DRV_8MA,
601 .pull = GPIOMUX_PULL_UP,
602};
603
604static struct gpiomux_setting cyts_int_sus_cfg = {
605 .func = GPIOMUX_FUNC_GPIO,
606 .drv = GPIOMUX_DRV_2MA,
607 .pull = GPIOMUX_PULL_UP,
608};
609
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700610static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
611 { /* TS INTERRUPT */
612 .gpio = 11,
613 .settings = {
614 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
615 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
616 },
617 },
618 { /* TS SLEEP */
619 .gpio = 50,
620 .settings = {
621 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
622 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
623 },
624 },
625 { /* TS RESOUT */
626 .gpio = 52,
627 .settings = {
628 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
629 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
630 },
631 },
632};
633
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700634#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
635enum {
636 SX150X_CAM,
637};
638
Nishant Pandit474f2252011-07-23 23:17:56 +0530639static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700640 [SX150X_CAM] = {
641 .gpio_base = GPIO_CAM_EXPANDER_BASE,
642 .oscio_is_gpo = false,
643 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530644 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700645 .io_open_drain_ena = 0x0,
646 .irq_summary = -1,
647 },
648};
Nishant Pandit474f2252011-07-23 23:17:56 +0530649
650#endif
651
652#ifdef CONFIG_I2C
653
654#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
655#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
656
657#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
658
659static struct i2c_board_info cam_expander_i2c_info[] = {
660 {
661 I2C_BOARD_INFO("sx1508q", 0x22),
662 .platform_data = &sx150x_data[SX150X_CAM]
663 },
664};
665
666static struct msm_cam_expander_info cam_expander_info[] = {
667 {
668 cam_expander_i2c_info,
669 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
670 },
671};
672#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700673#endif
674
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700675#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
676#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700677#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700678#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
679
Laura Abbottd6183792011-08-19 13:42:24 -0700680#define MSM_ION_EBI_SIZE SZ_8M
681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700682#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
683static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
684static int __init pmem_kernel_ebi1_size_setup(char *p)
685{
686 pmem_kernel_ebi1_size = memparse(p, NULL);
687 return 0;
688}
689early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
690#endif
691
692#ifdef CONFIG_ANDROID_PMEM
693static unsigned pmem_size = MSM_PMEM_SIZE;
694static int __init pmem_size_setup(char *p)
695{
696 pmem_size = memparse(p, NULL);
697 return 0;
698}
699early_param("pmem_size", pmem_size_setup);
700
701static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
702
703static int __init pmem_adsp_size_setup(char *p)
704{
705 pmem_adsp_size = memparse(p, NULL);
706 return 0;
707}
708early_param("pmem_adsp_size", pmem_adsp_size_setup);
709
710static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
711
712static int __init pmem_audio_size_setup(char *p)
713{
714 pmem_audio_size = memparse(p, NULL);
715 return 0;
716}
717early_param("pmem_audio_size", pmem_audio_size_setup);
718#endif
719
720#ifdef CONFIG_ANDROID_PMEM
721static struct android_pmem_platform_data android_pmem_pdata = {
722 .name = "pmem",
723 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
724 .cached = 1,
725 .memory_type = MEMTYPE_EBI1,
726};
727
728static struct platform_device android_pmem_device = {
729 .name = "android_pmem",
730 .id = 0,
731 .dev = {.platform_data = &android_pmem_pdata},
732};
733
734static struct android_pmem_platform_data android_pmem_adsp_pdata = {
735 .name = "pmem_adsp",
736 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
737 .cached = 0,
738 .memory_type = MEMTYPE_EBI1,
739};
740static struct platform_device android_pmem_adsp_device = {
741 .name = "android_pmem",
742 .id = 2,
743 .dev = { .platform_data = &android_pmem_adsp_pdata },
744};
745
746static struct android_pmem_platform_data android_pmem_audio_pdata = {
747 .name = "pmem_audio",
748 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
749 .cached = 0,
750 .memory_type = MEMTYPE_EBI1,
751};
752
753static struct platform_device android_pmem_audio_device = {
754 .name = "android_pmem",
755 .id = 4,
756 .dev = { .platform_data = &android_pmem_audio_pdata },
757};
758#endif
759
760static struct memtype_reserve msm8960_reserve_table[] __initdata = {
761 [MEMTYPE_SMI] = {
762 },
763 [MEMTYPE_EBI0] = {
764 .flags = MEMTYPE_FLAGS_1M_ALIGN,
765 },
766 [MEMTYPE_EBI1] = {
767 .flags = MEMTYPE_FLAGS_1M_ALIGN,
768 },
769};
770
771static void __init size_pmem_devices(void)
772{
773#ifdef CONFIG_ANDROID_PMEM
774 android_pmem_adsp_pdata.size = pmem_adsp_size;
775 android_pmem_pdata.size = pmem_size;
776 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
777#endif
778}
779
780static void __init reserve_memory_for(struct android_pmem_platform_data *p)
781{
782 msm8960_reserve_table[p->memory_type].size += p->size;
783}
784
785static void __init reserve_pmem_memory(void)
786{
787#ifdef CONFIG_ANDROID_PMEM
788 reserve_memory_for(&android_pmem_adsp_pdata);
789 reserve_memory_for(&android_pmem_pdata);
790 reserve_memory_for(&android_pmem_audio_pdata);
791 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
792#endif
793}
794
Larry Basselb4126da2011-07-18 14:31:33 -0700795static int msm8960_paddr_to_memtype(unsigned int paddr)
796{
797 return MEMTYPE_EBI1;
798}
799
Laura Abbottd6183792011-08-19 13:42:24 -0700800#ifdef CONFIG_ION_MSM
801struct ion_platform_data ion_pdata = {
802 .nr = 3,
803 .heaps = {
804 {
805 .id = ION_HEAP_SYSTEM_ID,
806 .type = ION_HEAP_TYPE_SYSTEM,
807 .name = ION_KMALLOC_HEAP_NAME,
808 },
809 {
810 .id = ION_HEAP_SYSTEM_CONTIG_ID,
811 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
812 .name = ION_VMALLOC_HEAP_NAME,
813 },
814 {
815 .id = ION_HEAP_EBI_ID,
816 .type = ION_HEAP_TYPE_CARVEOUT,
817 .name = ION_EBI1_HEAP_NAME,
818 .size = MSM_ION_EBI_SIZE,
819 .memory_type = ION_EBI_TYPE,
820 },
821 }
822};
823
824struct platform_device ion_dev = {
825 .name = "ion-msm",
826 .id = 1,
827 .dev = { .platform_data = &ion_pdata },
828};
829#endif
830
831static void reserve_ion_memory(void)
832{
833#ifdef CONFIG_ION_MSM
834 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
835#endif
836}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700837static void __init msm8960_calculate_reserve_sizes(void)
838{
839 size_pmem_devices();
840 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700841 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700842}
843
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700844static struct reserve_info msm8960_reserve_info __initdata = {
845 .memtype_reserve_table = msm8960_reserve_table,
846 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
847 .paddr_to_memtype = msm8960_paddr_to_memtype,
848};
849
Larry Basselb4126da2011-07-18 14:31:33 -0700850static int msm8960_memory_bank_size(void)
851{
852 return 1<<29;
853}
854
855static void __init locate_unstable_memory(void)
856{
857 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
858 unsigned long bank_size;
859 unsigned long low, high;
860
861 bank_size = msm8960_memory_bank_size();
862 low = meminfo.bank[0].start;
863 high = mb->start + mb->size;
864 low &= ~(bank_size - 1);
865
866 if (high - low <= bank_size)
867 return;
868 msm8960_reserve_info.low_unstable_address = low + bank_size;
869 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
870 msm8960_reserve_info.bank_size = bank_size;
871 pr_info("low unstable address %lx max size %lx bank size %lx\n",
872 msm8960_reserve_info.low_unstable_address,
873 msm8960_reserve_info.max_unstable_size,
874 msm8960_reserve_info.bank_size);
875}
876
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700877static void __init msm8960_reserve(void)
878{
879 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700880 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700881 msm_reserve();
882}
883
Larry Bassela4414b12011-08-04 11:11:02 -0700884static int msm8960_change_memory_power(u64 start, u64 size,
885 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700886{
Larry Bassela4414b12011-08-04 11:11:02 -0700887 return size;
Larry Bassela7eadea2011-07-14 10:46:00 -0700888}
889
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700890#ifdef CONFIG_MSM_CAMERA
891
Kevin Chan28446522011-07-26 16:39:53 -0700892static uint16_t msm_cam_gpio_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700893 5, /*CAMIF_MCLK*/
894 20, /*CAMIF_I2C_DATA*/
895 21, /*CAMIF_I2C_CLK*/
896};
897
898#define VFE_CAMIF_TIMER1_GPIO 2
899#define VFE_CAMIF_TIMER2_GPIO 3
900#define VFE_CAMIF_TIMER3_GPIO_INT 4
901struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
902 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
903 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
904 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
905 .flash_recharge_duration = 50000,
906 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
907};
908
Nishant Pandit474f2252011-07-23 23:17:56 +0530909#ifdef CONFIG_MSM_CAMERA_FLASH
910static struct msm_camera_sensor_flash_src msm_flash_src = {
911 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
912 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
913 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
914#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
915 defined(CONFIG_GPIO_SX150X_MODULE))
916 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
917#endif
918};
919#endif
920
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700921#ifdef CONFIG_IMX074
922static struct msm_camera_sensor_platform_info sensor_board_info = {
Mansoor Aftab6d6ff5e2011-07-20 17:25:36 -0700923 .mount_angle = 90
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700924};
925#endif
926
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700927struct msm_camera_device_platform_data msm_camera_csi0_device_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700928 .ioclk.mclk_clk_rate = 24000000,
929 .ioclk.vfe_clk_rate = 228570000,
930 .csid_core = 0,
Kevin Chan28446522011-07-26 16:39:53 -0700931 .cam_gpio_tbl = msm_cam_gpio_tbl,
932 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700933};
934
935struct msm_camera_device_platform_data msm_camera_csi1_device_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700936 .ioclk.mclk_clk_rate = 24000000,
937 .ioclk.vfe_clk_rate = 228570000,
938 .csid_core = 1,
Kevin Chan28446522011-07-26 16:39:53 -0700939 .cam_gpio_tbl = msm_cam_gpio_tbl,
940 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700941};
942
943#ifdef CONFIG_IMX074
944static struct msm_camera_sensor_flash_data flash_imx074 = {
945 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530946#ifdef CONFIG_MSM_CAMERA_FLASH
947 .flash_src = &msm_flash_src
948#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700949};
950
951static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
952 .sensor_name = "imx074",
953 .sensor_reset = 107,
954 .sensor_pwd = 85,
955 .vcm_pwd = 0,
956 .vcm_enable = 1,
957 .pdata = &msm_camera_csi0_device_data,
958 .flash_data = &flash_imx074,
959 .strobe_flash_data = &strobe_flash_xenon,
960 .sensor_platform_info = &sensor_board_info,
961 .csi_if = 1
962};
963
964struct platform_device msm8960_camera_sensor_imx074 = {
965 .name = "msm_camera_imx074",
966 .dev = {
967 .platform_data = &msm_camera_sensor_imx074_data,
968 },
969};
970#endif
971#ifdef CONFIG_OV2720
972static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -0700973 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700974};
975
976static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
977 .sensor_name = "ov2720",
978 .sensor_reset = 76,
979 .sensor_pwd = 85,
980 .vcm_pwd = 0,
981 .vcm_enable = 1,
982 .pdata = &msm_camera_csi1_device_data,
983 .flash_data = &flash_ov2720,
984 .csi_if = 1
985};
986
987struct platform_device msm8960_camera_sensor_ov2720 = {
988 .name = "msm_camera_ov2720",
989 .dev = {
990 .platform_data = &msm_camera_sensor_ov2720_data,
991 },
992};
993#endif
Kevin Chandfecce22011-07-13 10:52:41 -0700994
995static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
996 .flash_type = MSM_CAMERA_FLASH_LED,
997};
998
999static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1000 .sensor_name = "qs_mt9p017",
1001 .sensor_reset = 107,
1002 .sensor_pwd = 85,
1003 .vcm_pwd = 0,
1004 .vcm_enable = 1,
1005 .pdata = &msm_camera_csi0_device_data,
1006 .flash_data = &flash_qs_mt9p017,
1007 .sensor_platform_info = &sensor_board_info,
1008 .csi_if = 1
1009};
1010
1011struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1012 .name = "msm_camera_qs_mt9p017",
1013 .dev = {
1014 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1015 },
1016};
1017
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001018static void __init msm8960_init_cam(void)
1019{
1020 int i;
1021 struct platform_device *cam_dev[] = {
1022 &msm8960_camera_sensor_imx074,
1023 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001024 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001025 };
1026
1027 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1028 struct msm_camera_sensor_info *s_info;
1029 s_info = cam_dev[i]->dev.platform_data;
1030 msm_get_cam_resources(s_info);
1031 platform_device_register(cam_dev[i]);
1032 }
1033}
1034#endif
1035
1036#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
1037/* prim = 608 x 1024 x 4(bpp) x 3(pages) */
1038#define MSM_FB_PRIM_BUF_SIZE 0x720000
1039#else
1040/* prim = 608 x 1024 x 4(bpp) x 2(pages) */
1041#define MSM_FB_PRIM_BUF_SIZE 0x4C0000
1042#endif
1043
1044#ifdef CONFIG_FB_MSM_MIPI_DSI
Nagamalleswararao Ganji0b8dbd02011-08-18 20:46:59 -07001045#define MIPI_DSI_WRITEBACK_SIZE (1024 * 600 * 3 * 2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001046#else
1047#define MIPI_DSI_WRITEBACK_SIZE 0
1048#endif
1049
1050#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1051/* hdmi = 1920 x 1088 x 2(bpp) x 1(page) */
1052#define MSM_FB_EXT_BUF_SIZE 0x3FC000
1053#elif defined(CONFIG_FB_MSM_TVOUT)
1054/* tvout = 720 x 576 x 2(bpp) x 2(pages) */
1055#define MSM_FB_EXT_BUF_SIZE 0x195000
1056#else /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1057#define MSM_FB_EXT_BUF_SIZE 0
1058#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1059
1060#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE +\
1061 MIPI_DSI_WRITEBACK_SIZE, 4096)
1062
1063#define MDP_VSYNC_GPIO 0
1064
1065static struct resource msm_fb_resources[] = {
1066 {
1067 .flags = IORESOURCE_DMA,
1068 }
1069};
1070
1071static struct platform_device msm_fb_device = {
1072 .name = "msm_fb",
1073 .id = 0,
1074 .num_resources = ARRAY_SIZE(msm_fb_resources),
1075 .resource = msm_fb_resources,
1076};
1077
1078static bool dsi_power_on;
1079
1080static int mipi_dsi_panel_power(int on)
1081{
1082 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001083 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001084 int rc;
1085
1086 struct pm_gpio gpio43_param = {
1087 .direction = PM_GPIO_DIR_OUT,
1088 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1089 .output_value = 0,
1090 .pull = PM_GPIO_PULL_NO,
1091 .vin_sel = 2,
1092 .out_strength = PM_GPIO_STRENGTH_HIGH,
1093 .function = PM_GPIO_FUNC_PAIRED,
1094 .inv_int_pol = 0,
1095 .disable_pin = 0,
1096 };
1097
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001098 pr_info("%s: state : %d\n", __func__, on);
1099
1100 if (!dsi_power_on) {
1101
1102 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1103 "dsi_vdc");
1104 if (IS_ERR(reg_l8)) {
1105 pr_err("could not get 8921_l8, rc = %ld\n",
1106 PTR_ERR(reg_l8));
1107 return -ENODEV;
1108 }
1109
1110 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1111 "dsi_vddio");
1112 if (IS_ERR(reg_l23)) {
1113 pr_err("could not get 8921_l23, rc = %ld\n",
1114 PTR_ERR(reg_l23));
1115 return -ENODEV;
1116 }
1117
1118 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1119 "dsi_vdda");
1120 if (IS_ERR(reg_l2)) {
1121 pr_err("could not get 8921_l2, rc = %ld\n",
1122 PTR_ERR(reg_l2));
1123 return -ENODEV;
1124 }
1125
1126 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1127 if (rc) {
1128 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1129 return -EINVAL;
1130 }
1131 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1132 if (rc) {
1133 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1134 return -EINVAL;
1135 }
1136 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1137 if (rc) {
1138 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1139 return -EINVAL;
1140 }
1141
1142 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1143 rc = gpio_request(gpio43, "disp_rst_n");
1144 if (rc) {
1145 pr_err("request gpio 43 failed, rc=%d\n", rc);
1146 return -ENODEV;
1147 }
1148
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001149 dsi_power_on = true;
1150 }
1151
1152 if (on) {
1153 rc = regulator_set_optimum_mode(reg_l8, 100000);
1154 if (rc < 0) {
1155 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1156 return -EINVAL;
1157 }
1158 rc = regulator_set_optimum_mode(reg_l23, 100000);
1159 if (rc < 0) {
1160 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1161 return -EINVAL;
1162 }
1163 rc = regulator_set_optimum_mode(reg_l2, 100000);
1164 if (rc < 0) {
1165 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1166 return -EINVAL;
1167 }
1168 rc = regulator_enable(reg_l8);
1169 if (rc) {
1170 pr_err("enable l8 failed, rc=%d\n", rc);
1171 return -ENODEV;
1172 }
1173 rc = regulator_enable(reg_l23);
1174 if (rc) {
1175 pr_err("enable l8 failed, rc=%d\n", rc);
1176 return -ENODEV;
1177 }
1178 rc = regulator_enable(reg_l2);
1179 if (rc) {
1180 pr_err("enable l2 failed, rc=%d\n", rc);
1181 return -ENODEV;
1182 }
1183
1184 gpio43_param.pull = PM_GPIO_PULL_NO;
1185 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1186 if (rc) {
1187 pr_err("gpio_config 43 failed (1), rc=%d\n", rc);
1188 return -EINVAL;
1189 }
1190 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1191 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1192 if (rc) {
1193 pr_err("gpio_config 43 failed (2), rc=%d\n", rc);
1194 return -EINVAL;
1195 }
1196 gpio43_param.pull = PM_GPIO_PULL_NO;
1197 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1198 if (rc) {
1199 pr_err("gpio_config 43 failed (3), rc=%d\n", rc);
1200 return -EINVAL;
1201 }
1202 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1203 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1204 if (rc) {
1205 pr_err("gpio_config 43 failed (4), rc=%d\n", rc);
1206 return -EINVAL;
1207 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001208 gpio_set_value_cansleep(gpio43, 1);
1209 } else {
1210 rc = regulator_set_optimum_mode(reg_l8, 100);
1211 if (rc < 0) {
1212 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1213 return -EINVAL;
1214 }
1215 rc = regulator_set_optimum_mode(reg_l23, 100);
1216 if (rc < 0) {
1217 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1218 return -EINVAL;
1219 }
1220 rc = regulator_set_optimum_mode(reg_l2, 100);
1221 if (rc < 0) {
1222 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1223 return -EINVAL;
1224 }
1225 gpio_set_value_cansleep(gpio43, 0);
1226 }
1227 return 0;
1228}
1229
1230static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1231 .vsync_gpio = MDP_VSYNC_GPIO,
1232 .dsi_power_save = mipi_dsi_panel_power,
1233};
1234
1235#ifdef CONFIG_MSM_BUS_SCALING
1236
1237static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001238 {
1239 .src = MSM_BUS_MASTER_MDP_PORT0,
1240 .dst = MSM_BUS_SLAVE_EBI_CH0,
1241 .ab = 0,
1242 .ib = 0,
1243 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001244};
1245
1246static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001247 {
1248 .src = MSM_BUS_MASTER_MDP_PORT0,
1249 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001250 .ab = 216000000 * 2,
1251 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001252 },
1253};
1254
1255static struct msm_bus_vectors mdp_vga_vectors[] = {
1256 /* VGA and less video */
1257 {
1258 .src = MSM_BUS_MASTER_MDP_PORT0,
1259 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001260 .ab = 216000000 * 2,
1261 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001262 },
1263};
1264
1265static struct msm_bus_vectors mdp_720p_vectors[] = {
1266 /* 720p and less video */
1267 {
1268 .src = MSM_BUS_MASTER_MDP_PORT0,
1269 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001270 .ab = 230400000 * 2,
1271 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001272 },
1273};
1274
1275static struct msm_bus_vectors mdp_1080p_vectors[] = {
1276 /* 1080p and less video */
1277 {
1278 .src = MSM_BUS_MASTER_MDP_PORT0,
1279 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001280 .ab = 334080000 * 2,
1281 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001282 },
1283};
1284
1285static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1286 {
1287 ARRAY_SIZE(mdp_init_vectors),
1288 mdp_init_vectors,
1289 },
1290 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001291 ARRAY_SIZE(mdp_ui_vectors),
1292 mdp_ui_vectors,
1293 },
1294 {
1295 ARRAY_SIZE(mdp_ui_vectors),
1296 mdp_ui_vectors,
1297 },
1298 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001299 ARRAY_SIZE(mdp_vga_vectors),
1300 mdp_vga_vectors,
1301 },
1302 {
1303 ARRAY_SIZE(mdp_720p_vectors),
1304 mdp_720p_vectors,
1305 },
1306 {
1307 ARRAY_SIZE(mdp_1080p_vectors),
1308 mdp_1080p_vectors,
1309 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001310};
1311
1312static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1313 mdp_bus_scale_usecases,
1314 ARRAY_SIZE(mdp_bus_scale_usecases),
1315 .name = "mdp",
1316};
1317
1318#endif
1319
1320int mdp_core_clk_rate_table[] = {
1321 85330000,
1322 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001323 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001324 200000000,
1325};
1326
1327static struct msm_panel_common_pdata mdp_pdata = {
1328 .gpio = MDP_VSYNC_GPIO,
1329 .mdp_core_clk_rate = 85330000,
1330 .mdp_core_clk_table = mdp_core_clk_rate_table,
1331 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1332#ifdef CONFIG_MSM_BUS_SCALING
1333 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1334#endif
1335 .mdp_rev = MDP_REV_42,
1336};
1337
1338static struct platform_device mipi_dsi_renesas_panel_device = {
1339 .name = "mipi_renesas",
1340 .id = 0,
1341};
1342
1343static struct platform_device mipi_dsi_simulator_panel_device = {
1344 .name = "mipi_simulator",
1345 .id = 0,
1346};
1347
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001348#define LPM_CHANNEL0 0
1349static int toshiba_gpio[] = {LPM_CHANNEL0};
1350
1351static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1352 .gpio = toshiba_gpio,
1353};
1354
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001355static struct platform_device mipi_dsi_toshiba_panel_device = {
1356 .name = "mipi_toshiba",
1357 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001358 .dev = {
1359 .platform_data = &toshiba_pdata,
1360 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361};
1362
1363#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1364static struct resource hdmi_msm_resources[] = {
1365 {
1366 .name = "hdmi_msm_qfprom_addr",
1367 .start = 0x00700000,
1368 .end = 0x007060FF,
1369 .flags = IORESOURCE_MEM,
1370 },
1371 {
1372 .name = "hdmi_msm_hdmi_addr",
1373 .start = 0x04A00000,
1374 .end = 0x04A00FFF,
1375 .flags = IORESOURCE_MEM,
1376 },
1377 {
1378 .name = "hdmi_msm_irq",
1379 .start = HDMI_IRQ,
1380 .end = HDMI_IRQ,
1381 .flags = IORESOURCE_IRQ,
1382 },
1383};
1384
1385static int hdmi_enable_5v(int on);
1386static int hdmi_core_power(int on, int show);
1387static int hdmi_cec_power(int on);
1388
1389static struct msm_hdmi_platform_data hdmi_msm_data = {
1390 .irq = HDMI_IRQ,
1391 .enable_5v = hdmi_enable_5v,
1392 .core_power = hdmi_core_power,
1393 .cec_power = hdmi_cec_power,
1394};
1395
1396static struct platform_device hdmi_msm_device = {
1397 .name = "hdmi_msm",
1398 .id = 0,
1399 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1400 .resource = hdmi_msm_resources,
1401 .dev.platform_data = &hdmi_msm_data,
1402};
1403#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1404
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001405#ifdef CONFIG_MSM_BUS_SCALING
1406static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1407 {
1408 .src = MSM_BUS_MASTER_MDP_PORT0,
1409 .dst = MSM_BUS_SLAVE_EBI_CH0,
1410 .ab = 0,
1411 .ib = 0,
1412 },
1413};
1414static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1415 {
1416 .src = MSM_BUS_MASTER_MDP_PORT0,
1417 .dst = MSM_BUS_SLAVE_EBI_CH0,
1418 .ab = 566092800 * 2,
1419 .ib = 707616000 * 2,
1420 },
1421};
1422static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1423 {
1424 ARRAY_SIZE(dtv_bus_init_vectors),
1425 dtv_bus_init_vectors,
1426 },
1427 {
1428 ARRAY_SIZE(dtv_bus_def_vectors),
1429 dtv_bus_def_vectors,
1430 },
1431};
1432static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1433 dtv_bus_scale_usecases,
1434 ARRAY_SIZE(dtv_bus_scale_usecases),
1435 .name = "dtv",
1436};
1437
1438static struct lcdc_platform_data dtv_pdata = {
1439 .bus_scale_table = &dtv_bus_scale_pdata,
1440};
1441#endif
1442
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001443static void __init msm_fb_add_devices(void)
1444{
1445 if (machine_is_msm8x60_rumi3()) {
1446 msm_fb_register_device("mdp", NULL);
1447 mipi_dsi_pdata.target_type = 1;
1448 } else
1449 msm_fb_register_device("mdp", &mdp_pdata);
1450 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001451#ifdef CONFIG_MSM_BUS_SCALING
1452 msm_fb_register_device("dtv", &dtv_pdata);
1453#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001454}
1455
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001456static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1457 .func = GPIOMUX_FUNC_GPIO,
1458 .drv = GPIOMUX_DRV_2MA,
1459 .pull = GPIOMUX_PULL_DOWN,
1460};
1461
1462static struct gpiomux_setting mdp_vsync_active_cfg = {
1463 .func = GPIOMUX_FUNC_1,
1464 .drv = GPIOMUX_DRV_2MA,
1465 .pull = GPIOMUX_PULL_DOWN,
1466};
1467
1468static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1469 {
1470 .gpio = MDP_VSYNC_GPIO,
1471 .settings = {
1472 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1473 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1474 },
1475 }
1476};
1477
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001478#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1479static struct gpiomux_setting hdmi_suspend_cfg = {
1480 .func = GPIOMUX_FUNC_GPIO,
1481 .drv = GPIOMUX_DRV_2MA,
1482 .pull = GPIOMUX_PULL_DOWN,
1483};
1484
1485static struct gpiomux_setting hdmi_active_1_cfg = {
1486 .func = GPIOMUX_FUNC_1,
1487 .drv = GPIOMUX_DRV_2MA,
1488 .pull = GPIOMUX_PULL_UP,
1489};
1490
1491static struct gpiomux_setting hdmi_active_2_cfg = {
1492 .func = GPIOMUX_FUNC_1,
1493 .drv = GPIOMUX_DRV_2MA,
1494 .pull = GPIOMUX_PULL_DOWN,
1495};
1496
1497static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1498 {
1499 .gpio = 99,
1500 .settings = {
1501 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1502 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1503 },
1504 },
1505 {
1506 .gpio = 100,
1507 .settings = {
1508 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1509 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1510 },
1511 },
1512 {
1513 .gpio = 101,
1514 .settings = {
1515 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1516 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1517 },
1518 },
1519 {
1520 .gpio = 102,
1521 .settings = {
1522 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1523 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1524 },
1525 },
1526};
1527
1528static int hdmi_enable_5v(int on)
1529{
1530 /* TBD: PM8921 regulator instead of 8901 */
1531 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1532 static int prev_on;
1533 int rc;
1534
1535 if (on == prev_on)
1536 return 0;
1537
1538 if (!reg_8921_hdmi_mvs)
1539 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1540 "hdmi_mvs");
1541
1542 if (on) {
1543 rc = regulator_enable(reg_8921_hdmi_mvs);
1544 if (rc) {
1545 pr_err("'%s' regulator enable failed, rc=%d\n",
1546 "8921_hdmi_mvs", rc);
1547 return rc;
1548 }
1549 pr_debug("%s(on): success\n", __func__);
1550 } else {
1551 rc = regulator_disable(reg_8921_hdmi_mvs);
1552 if (rc)
1553 pr_warning("'%s' regulator disable failed, rc=%d\n",
1554 "8921_hdmi_mvs", rc);
1555 pr_debug("%s(off): success\n", __func__);
1556 }
1557
1558 prev_on = on;
1559
1560 return 0;
1561}
1562
1563static int hdmi_core_power(int on, int show)
1564{
1565 static struct regulator *reg_8921_l23, *reg_8921_s4;
1566 static int prev_on;
1567 int rc;
1568
1569 if (on == prev_on)
1570 return 0;
1571
1572 /* TBD: PM8921 regulator instead of 8901 */
1573 if (!reg_8921_l23)
1574 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
1575
1576 if (!reg_8921_s4)
1577 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
1578
1579 if (on) {
1580 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1581 if (rc < 0) {
1582 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1583 return -EINVAL;
1584 }
1585
1586 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1587 if (!rc)
1588 rc = regulator_enable(reg_8921_l23);
1589 if (rc) {
1590 pr_err("'%s' regulator enable failed, rc=%d\n",
1591 "hdmi_avdd", rc);
1592 return rc;
1593 }
1594 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1595 if (!rc)
1596 rc = regulator_enable(reg_8921_s4);
1597 if (rc) {
1598 pr_err("'%s' regulator enable failed, rc=%d\n",
1599 "hdmi_vcc", rc);
1600 return rc;
1601 }
1602
1603 rc = gpio_request(100, "HDMI_DDC_CLK");
1604 if (rc) {
1605 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1606 "HDMI_DDC_CLK", 100, rc);
1607 goto error1;
1608 }
1609 rc = gpio_request(101, "HDMI_DDC_DATA");
1610 if (rc) {
1611 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1612 "HDMI_DDC_DATA", 101, rc);
1613 goto error2;
1614 }
1615 rc = gpio_request(102, "HDMI_HPD");
1616 if (rc) {
1617 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1618 "HDMI_HPD", 102, rc);
1619 goto error3;
1620 }
1621 pr_debug("%s(on): success\n", __func__);
1622 } else {
1623 gpio_free(100);
1624 gpio_free(101);
1625 gpio_free(102);
1626
1627 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1628 if (rc < 0) {
1629 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1630 return -EINVAL;
1631 }
1632
1633 pr_debug("%s(off): success\n", __func__);
1634 }
1635
1636 prev_on = on;
1637
1638 return 0;
1639
1640error3:
1641 gpio_free(101);
1642error2:
1643 gpio_free(100);
1644error1:
1645 regulator_disable(reg_8921_l23);
1646 return rc;
1647}
1648
1649static int hdmi_cec_power(int on)
1650{
1651 static int prev_on;
1652 int rc;
1653
1654 if (on == prev_on)
1655 return 0;
1656
1657 if (on) {
1658 rc = gpio_request(99, "HDMI_CEC_VAR");
1659 if (rc) {
1660 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1661 "HDMI_CEC_VAR", 99, rc);
1662 goto error;
1663 }
1664 pr_debug("%s(on): success\n", __func__);
1665 } else {
1666 gpio_free(99);
1667 pr_debug("%s(off): success\n", __func__);
1668 }
1669
1670 prev_on = on;
1671
1672 return 0;
1673error:
1674 return rc;
1675}
1676#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1677
1678static void __init msm8960_allocate_memory_regions(void)
1679{
1680 void *addr;
1681 unsigned long size;
1682
1683 size = MSM_FB_SIZE;
1684 addr = alloc_bootmem_align(size, 0x1000);
1685 msm_fb_resources[0].start = __pa(addr);
1686 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1687 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1688 size, addr, __pa(addr));
1689
1690}
1691#ifdef CONFIG_WCD9310_CODEC
1692
1693#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1694
Patrick Lai3043fba2011-08-01 14:15:57 -07001695/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
1696 * 4 micbiases are used to power various analog and digital
1697 * microphones operating at 1800 mV. Technically, all micbiases
1698 * can source from single cfilter since all microphones operate
1699 * at the same voltage level. The arrangement below is to make
1700 * sure all cfilters are exercised. LDO_H regulator ouput level
1701 * does not need to be as high as 2.85V. It is choosen for
1702 * microphone sensitivity purpose.
1703 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001704static struct tabla_pdata tabla_platform_data = {
1705 .slimbus_slave_device = {
1706 .name = "tabla-slave",
1707 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1708 },
1709 .irq = MSM_GPIO_TO_INT(62),
1710 .irq_base = TABLA_INTERRUPT_BASE,
1711 .num_irqs = NR_TABLA_IRQS,
1712 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07001713 .micbias = {
1714 .ldoh_v = TABLA_LDOH_2P85_V,
1715 .cfilt1_mv = 1800,
1716 .cfilt2_mv = 1800,
1717 .cfilt3_mv = 1800,
1718 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1719 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1720 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1721 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1722 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001723};
1724
1725static struct slim_device msm_slim_tabla = {
1726 .name = "tabla-slim",
1727 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1728 .dev = {
1729 .platform_data = &tabla_platform_data,
1730 },
1731};
1732#endif
1733
1734static struct slim_boardinfo msm_slim_devices[] = {
1735#ifdef CONFIG_WCD9310_CODEC
1736 {
1737 .bus_num = 1,
1738 .slim_slave = &msm_slim_tabla,
1739 },
1740#endif
1741 /* add more slimbus slaves as needed */
1742};
1743
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001744#define MSM_WCNSS_PHYS 0x03000000
1745#define MSM_WCNSS_SIZE 0x280000
1746
1747static struct resource resources_wcnss_wlan[] = {
1748 {
1749 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1750 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1751 .name = "wcnss_wlanrx_irq",
1752 .flags = IORESOURCE_IRQ,
1753 },
1754 {
1755 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1756 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1757 .name = "wcnss_wlantx_irq",
1758 .flags = IORESOURCE_IRQ,
1759 },
1760 {
1761 .start = MSM_WCNSS_PHYS,
1762 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1763 .name = "wcnss_mmio",
1764 .flags = IORESOURCE_MEM,
1765 },
1766};
1767
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001768static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1769 .has_48mhz_xo = 1,
1770};
1771
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001772static struct platform_device msm_device_wcnss_wlan = {
1773 .name = "wcnss_wlan",
1774 .id = 0,
1775 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1776 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001777 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001778};
1779
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001780#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1781 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1782 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1783 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1784
1785#define QCE_SIZE 0x10000
1786#define QCE_0_BASE 0x18500000
1787
1788#define QCE_HW_KEY_SUPPORT 0
1789#define QCE_SHA_HMAC_SUPPORT 1
1790#define QCE_SHARE_CE_RESOURCE 1
1791#define QCE_CE_SHARED 0
1792
1793static struct resource qcrypto_resources[] = {
1794 [0] = {
1795 .start = QCE_0_BASE,
1796 .end = QCE_0_BASE + QCE_SIZE - 1,
1797 .flags = IORESOURCE_MEM,
1798 },
1799 [1] = {
1800 .name = "crypto_channels",
1801 .start = DMOV_CE_IN_CHAN,
1802 .end = DMOV_CE_OUT_CHAN,
1803 .flags = IORESOURCE_DMA,
1804 },
1805 [2] = {
1806 .name = "crypto_crci_in",
1807 .start = DMOV_CE_IN_CRCI,
1808 .end = DMOV_CE_IN_CRCI,
1809 .flags = IORESOURCE_DMA,
1810 },
1811 [3] = {
1812 .name = "crypto_crci_out",
1813 .start = DMOV_CE_OUT_CRCI,
1814 .end = DMOV_CE_OUT_CRCI,
1815 .flags = IORESOURCE_DMA,
1816 },
1817};
1818
1819static struct resource qcedev_resources[] = {
1820 [0] = {
1821 .start = QCE_0_BASE,
1822 .end = QCE_0_BASE + QCE_SIZE - 1,
1823 .flags = IORESOURCE_MEM,
1824 },
1825 [1] = {
1826 .name = "crypto_channels",
1827 .start = DMOV_CE_IN_CHAN,
1828 .end = DMOV_CE_OUT_CHAN,
1829 .flags = IORESOURCE_DMA,
1830 },
1831 [2] = {
1832 .name = "crypto_crci_in",
1833 .start = DMOV_CE_IN_CRCI,
1834 .end = DMOV_CE_IN_CRCI,
1835 .flags = IORESOURCE_DMA,
1836 },
1837 [3] = {
1838 .name = "crypto_crci_out",
1839 .start = DMOV_CE_OUT_CRCI,
1840 .end = DMOV_CE_OUT_CRCI,
1841 .flags = IORESOURCE_DMA,
1842 },
1843};
1844
1845#endif
1846
1847#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1848 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1849
1850static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1851 .ce_shared = QCE_CE_SHARED,
1852 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1853 .hw_key_support = QCE_HW_KEY_SUPPORT,
1854 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1855};
1856
1857static struct platform_device qcrypto_device = {
1858 .name = "qcrypto",
1859 .id = 0,
1860 .num_resources = ARRAY_SIZE(qcrypto_resources),
1861 .resource = qcrypto_resources,
1862 .dev = {
1863 .coherent_dma_mask = DMA_BIT_MASK(32),
1864 .platform_data = &qcrypto_ce_hw_suppport,
1865 },
1866};
1867#endif
1868
1869#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1870 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1871
1872static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1873 .ce_shared = QCE_CE_SHARED,
1874 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1875 .hw_key_support = QCE_HW_KEY_SUPPORT,
1876 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1877};
1878
1879static struct platform_device qcedev_device = {
1880 .name = "qce",
1881 .id = 0,
1882 .num_resources = ARRAY_SIZE(qcedev_resources),
1883 .resource = qcedev_resources,
1884 .dev = {
1885 .coherent_dma_mask = DMA_BIT_MASK(32),
1886 .platform_data = &qcedev_ce_hw_suppport,
1887 },
1888};
1889#endif
1890
1891
1892static int __init gpiomux_init(void)
1893{
1894 int rc;
1895
1896 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1897 if (rc) {
1898 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1899 return rc;
1900 }
1901
1902 msm_gpiomux_install(msm8960_cam_configs,
1903 ARRAY_SIZE(msm8960_cam_configs));
1904
1905 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07001906 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907
1908 msm_gpiomux_install(msm8960_gsbi_configs,
1909 ARRAY_SIZE(msm8960_gsbi_configs));
1910
1911 msm_gpiomux_install(msm8960_cyts_configs,
1912 ARRAY_SIZE(msm8960_cyts_configs));
1913
1914 msm_gpiomux_install(msm8960_slimbus_config,
1915 ARRAY_SIZE(msm8960_slimbus_config));
1916
1917 msm_gpiomux_install(msm8960_audio_codec_configs,
1918 ARRAY_SIZE(msm8960_audio_codec_configs));
1919
1920#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1921 msm_gpiomux_install(msm8960_hdmi_configs,
1922 ARRAY_SIZE(msm8960_hdmi_configs));
1923#endif
1924
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001925 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1926 ARRAY_SIZE(msm8960_mdp_vsync_configs));
1927
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001928 msm_gpiomux_install(wcnss_5wire_interface,
1929 ARRAY_SIZE(wcnss_5wire_interface));
1930
1931 return 0;
1932}
1933
Matt Wagantall6d9ebee2011-08-26 12:15:24 -07001934static struct acpuclk_platform_data msm8960_acpuclk_data __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001935 .acpu_switch_time_us = 0,
1936 .vdd_switch_time_us = 0,
Matt Wagantall6d9ebee2011-08-26 12:15:24 -07001937 .init = acpuclk_8960_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001938};
1939
1940#define MSM_SHARED_RAM_PHYS 0x80000000
1941
1942static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
1943 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
1944 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1945 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
1946 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1947 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
1948 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1949 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
1950 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1951 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
1952 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1953 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
1954 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1955 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
1956 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1957 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
1958 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1959 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
1960 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
1961 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
1962 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1963 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
1964 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1965 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1966 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
1967 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
1968 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1969 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
1970 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1971 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1972 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1973};
1974
1975static struct pm8921_adc_properties pm8921_adc_data = {
1976 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
1977 .bitresolution = 15,
1978 .bipolar = 0,
1979};
1980
1981static struct pm8921_adc_platform_data pm8921_adc_pdata = {
1982 .adc_channel = pm8921_adc_channels_data,
1983 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
1984 .adc_prop = &pm8921_adc_data,
1985};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001986
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001987static void __init msm8960_map_io(void)
1988{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001989 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001990 msm_map_msm8960_io();
1991}
1992
1993static void __init msm8960_init_irq(void)
1994{
1995 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001996
1997 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001998 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001999 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002000
2001 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002002 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002003
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002004 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2005 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002006
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002007 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2008 * as they are configured as level, which does not play nice with
2009 * handle_percpu_irq.
2010 */
2011 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2012 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002013 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002014 }
2015}
2016
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002017/* MSM8960 have 5 SDCC controllers */
2018enum sdcc_controllers {
2019 SDCC1,
2020 SDCC2,
2021 SDCC3,
2022 SDCC4,
2023 SDCC5,
2024 MAX_SDCC_CONTROLLER
2025};
2026
2027/* All SDCC controllers requires VDD/VCC voltage */
2028static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2029 /* SDCC1 : eMMC card connected */
2030 [SDCC1] = {
2031 .name = "sdc_vdd",
2032 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302033 .high_vol_level = 2950000,
2034 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302035 .always_on = 1,
2036 .lpm_sup = 1,
2037 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002038 .hpm_uA = 200000, /* 200mA */
2039 },
2040 /* SDCC3 : External card slot connected */
2041 [SDCC3] = {
2042 .name = "sdc_vdd",
2043 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302044 .high_vol_level = 2950000,
2045 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002046 .hpm_uA = 600000, /* 600mA */
2047 }
2048};
2049
2050/* Only slots having eMMC card will require VCCQ voltage */
2051static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2052 /* SDCC1 : eMMC card connected */
2053 [SDCC1] = {
2054 .name = "sdc_vccq",
2055 .set_voltage_sup = 1,
2056 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302057 .high_vol_level = 1800000,
2058 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002059 .hpm_uA = 200000, /* 200mA */
2060 }
2061};
2062
2063/* All SDCC controllers may require voting for VDD PAD voltage */
2064static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2065 /* SDCC3 : External card slot connected */
2066 [SDCC3] = {
2067 .name = "sdc_vddp",
2068 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302069 .high_vol_level = 2950000,
2070 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002071 .always_on = 1,
2072 .lpm_sup = 1,
2073 /* Max. Active current required is 16 mA */
2074 .hpm_uA = 16000,
2075 /*
2076 * Sleep current required is ~300 uA. But min. vote can be
2077 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2078 * during sleep.
2079 */
2080 .lpm_uA = 2000,
2081 }
2082};
2083
2084static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2085 /* SDCC1 : eMMC card connected */
2086 [SDCC1] = {
2087 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2088 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2089 },
2090 /* SDCC3 : External card slot connected */
2091 [SDCC3] = {
2092 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2093 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2094 }
2095};
2096
2097/* SDC1 pad data */
2098static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2099 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302100 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2101 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002102};
2103
2104static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2105 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2106 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2107 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2108};
2109
2110static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
2111 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2112 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2113};
2114
2115static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
2116 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2117 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2118};
2119
2120/* SDC3 pad data */
2121static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2122 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2123 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2124 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2125};
2126
2127static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2128 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2129 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2130 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2131};
2132
2133static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
2134 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2135 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2136};
2137
2138static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
2139 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2140 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2141};
2142
2143struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2144 [SDCC1] = {
2145 .on = sdc1_pad_pull_on_cfg,
2146 .off = sdc1_pad_pull_off_cfg,
2147 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2148 },
2149 [SDCC3] = {
2150 .on = sdc3_pad_pull_on_cfg,
2151 .off = sdc3_pad_pull_off_cfg,
2152 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2153 },
2154};
2155
2156struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2157 [SDCC1] = {
2158 .on = sdc1_pad_drv_on_cfg,
2159 .off = sdc1_pad_drv_off_cfg,
2160 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2161 },
2162 [SDCC3] = {
2163 .on = sdc3_pad_drv_on_cfg,
2164 .off = sdc3_pad_drv_off_cfg,
2165 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2166 },
2167};
2168
2169struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2170 [SDCC1] = {
2171 .pull = &mmc_pad_pull_data[SDCC1],
2172 .drv = &mmc_pad_drv_data[SDCC1]
2173 },
2174 [SDCC3] = {
2175 .pull = &mmc_pad_pull_data[SDCC3],
2176 .drv = &mmc_pad_drv_data[SDCC3]
2177 },
2178};
2179
2180struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2181 [SDCC1] = {
2182 .pad_data = &mmc_pad_data[SDCC1],
2183 },
2184 [SDCC3] = {
2185 .pad_data = &mmc_pad_data[SDCC3],
2186 },
2187};
2188
2189static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302190 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002191};
2192
2193static unsigned int sdc3_sup_clk_rates[] = {
2194 400000, 24000000, 48000000, 96000000
2195};
2196
2197#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2198static struct mmc_platform_data msm8960_sdc1_data = {
2199 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2200#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2201 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2202#else
2203 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2204#endif
2205 .sup_clk_table = sdc1_sup_clk_rates,
2206 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2207 .nonremovable = 1,
2208 .sdcc_v4_sup = true,
2209 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302210 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002211};
2212#endif
2213
2214#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2215static struct mmc_platform_data msm8960_sdc3_data = {
2216 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2217 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2218 .sup_clk_table = sdc3_sup_clk_rates,
2219 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
2220 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
2221 .sdcc_v4_sup = true,
2222 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2223 .pin_data = &mmc_slot_pin_data[SDCC3],
2224#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2225 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2226 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2227 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2228#endif
2229 .xpc_cap = 1,
2230 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2231 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302232 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002233};
2234#endif
2235
2236static void __init msm8960_init_mmc(void)
2237{
2238#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2239 /* SDC1 : eMMC card connected */
2240 msm_add_sdcc(1, &msm8960_sdc1_data);
2241#endif
2242#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2243 /* SDC3: External card slot */
2244 msm_add_sdcc(3, &msm8960_sdc3_data);
2245#endif
2246}
2247
2248static void __init msm8960_init_buses(void)
2249{
2250#ifdef CONFIG_MSM_BUS_SCALING
2251 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2252 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2253 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2254 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2255 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2256 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2257 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2258 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2259 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2260 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2261#endif
2262}
2263
2264static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2265 .max_clock_speed = 15060000,
2266};
2267
2268#ifdef CONFIG_USB_MSM_OTG_72K
2269static struct msm_otg_platform_data msm_otg_pdata;
2270#else
2271#define USB_5V_EN 42
2272static void msm_hsusb_vbus_power(bool on)
2273{
2274 int rc;
2275 static bool vbus_is_on;
2276 static struct regulator *mvs_otg_switch;
2277 struct pm_gpio param = {
2278 .direction = PM_GPIO_DIR_OUT,
2279 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2280 .output_value = 1,
2281 .pull = PM_GPIO_PULL_NO,
2282 .vin_sel = PM_GPIO_VIN_S4,
2283 .out_strength = PM_GPIO_STRENGTH_MED,
2284 .function = PM_GPIO_FUNC_NORMAL,
2285 };
2286
2287 if (vbus_is_on == on)
2288 return;
2289
2290 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002291 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2292 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002293 if (IS_ERR(mvs_otg_switch)) {
2294 pr_err("Unable to get mvs_otg_switch\n");
2295 return;
2296 }
2297
2298 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2299 "usb_5v_en");
2300 if (rc < 0) {
2301 pr_err("failed to request usb_5v_en gpio\n");
2302 goto put_mvs_otg;
2303 }
2304
2305 if (regulator_enable(mvs_otg_switch)) {
2306 pr_err("unable to enable mvs_otg_switch\n");
2307 goto free_usb_5v_en;
2308 }
2309
2310 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2311 &param);
2312 if (rc < 0) {
2313 pr_err("failed to configure usb_5v_en gpio\n");
2314 goto disable_mvs_otg;
2315 }
2316 vbus_is_on = true;
2317 return;
2318 }
2319disable_mvs_otg:
2320 regulator_disable(mvs_otg_switch);
2321free_usb_5v_en:
2322 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2323put_mvs_otg:
2324 regulator_put(mvs_otg_switch);
2325 vbus_is_on = false;
2326}
2327
2328static struct msm_otg_platform_data msm_otg_pdata = {
2329 .mode = USB_OTG,
2330 .otg_control = OTG_PMIC_CONTROL,
2331 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2332 .pclk_src_name = "dfab_usb_hs_clk",
2333 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2334 .vbus_power = msm_hsusb_vbus_power,
2335};
2336#endif
2337
2338#define PID_MAGIC_ID 0x71432909
2339#define SERIAL_NUM_MAGIC_ID 0x61945374
2340#define SERIAL_NUMBER_LENGTH 127
2341#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2342
2343struct magic_num_struct {
2344 uint32_t pid;
2345 uint32_t serial_num;
2346};
2347
2348struct dload_struct {
2349 uint32_t reserved1;
2350 uint32_t reserved2;
2351 uint32_t reserved3;
2352 uint16_t reserved4;
2353 uint16_t pid;
2354 char serial_number[SERIAL_NUMBER_LENGTH];
2355 uint16_t reserved5;
2356 struct magic_num_struct magic_struct;
2357};
2358
2359static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2360{
2361 struct dload_struct __iomem *dload = 0;
2362
2363 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2364 if (!dload) {
2365 pr_err("%s: cannot remap I/O memory region: %08x\n",
2366 __func__, DLOAD_USB_BASE_ADD);
2367 return -ENXIO;
2368 }
2369
2370 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2371 __func__, dload, pid, snum);
2372 /* update pid */
2373 dload->magic_struct.pid = PID_MAGIC_ID;
2374 dload->pid = pid;
2375
2376 /* update serial number */
2377 dload->magic_struct.serial_num = 0;
2378 if (!snum) {
2379 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2380 goto out;
2381 }
2382
2383 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2384 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2385 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2386out:
2387 iounmap(dload);
2388 return 0;
2389}
2390
2391static struct android_usb_platform_data android_usb_pdata = {
2392 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2393};
2394
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002395static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002396 .name = "android_usb",
2397 .id = -1,
2398 .dev = {
2399 .platform_data = &android_usb_pdata,
2400 },
2401};
2402
2403static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2404 0x03, 0x0f,
2405};
2406
2407static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2408 0x00, 0x24, 0x54, 0x10,
2409 0x09, 0x03, 0x01,
2410 0x10, 0x54, 0x30, 0x0C,
2411 0x24, 0x30, 0x0f,
2412};
2413
2414static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2415 0x00, 0x24, 0x54, 0x10,
2416 0x09, 0x07, 0x01, 0x0B,
2417 0x10, 0x54, 0x30, 0x0C,
2418 0x24, 0x30, 0x0f,
2419};
2420
2421static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2422 [0] = {
2423 .mode = MSM_SPM_MODE_CLOCK_GATING,
2424 .notify_rpm = false,
2425 .cmd = spm_wfi_cmd_sequence,
2426 },
2427 [1] = {
2428 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2429 .notify_rpm = false,
2430 .cmd = spm_power_collapse_without_rpm,
2431 },
2432 [2] = {
2433 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2434 .notify_rpm = true,
2435 .cmd = spm_power_collapse_with_rpm,
2436 },
2437};
2438
2439static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2440 [0] = {
2441 .reg_base_addr = MSM_SAW0_BASE,
2442 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2443 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2444 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2445#if defined(CONFIG_MSM_AVS_HW)
2446 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2447 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2448#endif
2449 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2450 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2451 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2452 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2453 .vctl_timeout_us = 50,
2454 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2455 .modes = msm_spm_seq_list,
2456 },
2457 [1] = {
2458 .reg_base_addr = MSM_SAW1_BASE,
2459 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2460 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2461 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2462#if defined(CONFIG_MSM_AVS_HW)
2463 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2464 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2465#endif
2466 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2467 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2468 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2469 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2470 .vctl_timeout_us = 50,
2471 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2472 .modes = msm_spm_seq_list,
2473 },
2474};
2475
2476static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2477 0x00, 0x20, 0x03, 0x20,
2478 0x00, 0x0f,
2479};
2480
2481static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2482 0x00, 0x20, 0x34, 0x64,
2483 0x48, 0x07, 0x48, 0x20,
2484 0x50, 0x64, 0x04, 0x34,
2485 0x50, 0x0f,
2486};
2487static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2488 0x00, 0x10, 0x34, 0x64,
2489 0x48, 0x07, 0x48, 0x10,
2490 0x50, 0x64, 0x04, 0x34,
2491 0x50, 0x0F,
2492};
2493
2494static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2495 [0] = {
2496 .mode = MSM_SPM_L2_MODE_RETENTION,
2497 .notify_rpm = false,
2498 .cmd = l2_spm_wfi_cmd_sequence,
2499 },
2500 [1] = {
2501 .mode = MSM_SPM_L2_MODE_GDHS,
2502 .notify_rpm = true,
2503 .cmd = l2_spm_gdhs_cmd_sequence,
2504 },
2505 [2] = {
2506 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2507 .notify_rpm = true,
2508 .cmd = l2_spm_power_off_cmd_sequence,
2509 },
2510};
2511
2512
2513static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2514 [0] = {
2515 .reg_base_addr = MSM_SAW_L2_BASE,
2516 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2517 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2518 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2519 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2520 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2521 .modes = msm_spm_l2_seq_list,
2522 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2523 },
2524};
2525
2526#define CYTTSP_TS_GPIO_IRQ 11
2527#define CYTTSP_TS_SLEEP_GPIO 50
2528#define CYTTSP_TS_RESOUT_N_GPIO 52
2529
2530/*virtual key support */
2531static ssize_t tma340_vkeys_show(struct kobject *kobj,
2532 struct kobj_attribute *attr, char *buf)
2533{
2534 return snprintf(buf, 200,
2535 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2536 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2537 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2538 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2539 "\n");
2540}
2541
2542static struct kobj_attribute tma340_vkeys_attr = {
2543 .attr = {
2544 .mode = S_IRUGO,
2545 },
2546 .show = &tma340_vkeys_show,
2547};
2548
2549static struct attribute *tma340_properties_attrs[] = {
2550 &tma340_vkeys_attr.attr,
2551 NULL
2552};
2553
2554static struct attribute_group tma340_properties_attr_group = {
2555 .attrs = tma340_properties_attrs,
2556};
2557
2558
2559static int cyttsp_platform_init(struct i2c_client *client)
2560{
2561 int rc = 0;
2562 static struct kobject *tma340_properties_kobj;
2563
2564 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2565 tma340_properties_kobj = kobject_create_and_add("board_properties",
2566 NULL);
2567 if (tma340_properties_kobj)
2568 rc = sysfs_create_group(tma340_properties_kobj,
2569 &tma340_properties_attr_group);
2570 if (!tma340_properties_kobj || rc)
2571 pr_err("%s: failed to create board_properties\n",
2572 __func__);
2573
2574 return 0;
2575}
2576
2577static struct cyttsp_regulator regulator_data[] = {
2578 {
2579 .name = "vdd",
2580 .min_uV = CY_TMA300_VTG_MIN_UV,
2581 .max_uV = CY_TMA300_VTG_MAX_UV,
2582 .load_uA = CY_TMA300_CURR_24HZ_UA,
2583 },
2584 /* TODO: Remove after runtime PM is enabled in I2C driver */
2585 {
2586 .name = "vcc_i2c",
2587 .min_uV = CY_I2C_VTG_MIN_UV,
2588 .max_uV = CY_I2C_VTG_MAX_UV,
2589 .load_uA = CY_I2C_CURR_UA,
2590 },
2591};
2592
2593static struct cyttsp_platform_data cyttsp_pdata = {
2594 .panel_maxx = 634,
2595 .panel_maxy = 1166,
2596 .disp_maxx = 616,
2597 .disp_maxy = 1023,
2598 .disp_minx = 0,
2599 .disp_miny = 16,
2600 .flags = 0x01,
2601 .gen = CY_GEN3, /* or */
2602 .use_st = CY_USE_ST,
2603 .use_mt = CY_USE_MT,
2604 .use_hndshk = CY_SEND_HNDSHK,
2605 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302606 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002607 .use_gestures = CY_USE_GESTURES,
2608 .fw_fname = "cyttsp_8960_cdp.hex",
2609 /* activate up to 4 groups
2610 * and set active distance
2611 */
2612 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2613 CY_GEST_GRP3 | CY_GEST_GRP4 |
2614 CY_ACT_DIST,
2615 /* change act_intrvl to customize the Active power state
2616 * scanning/processing refresh interval for Operating mode
2617 */
2618 .act_intrvl = CY_ACT_INTRVL_DFLT,
2619 /* change tch_tmout to customize the touch timeout for the
2620 * Active power state for Operating mode
2621 */
2622 .tch_tmout = CY_TCH_TMOUT_DFLT,
2623 /* change lp_intrvl to customize the Low Power power state
2624 * scanning/processing refresh interval for Operating mode
2625 */
2626 .lp_intrvl = CY_LP_INTRVL_DFLT,
2627 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2628 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2629 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2630 .regulator_info = regulator_data,
2631 .num_regulators = ARRAY_SIZE(regulator_data),
2632 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302633 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002634};
2635
2636static struct i2c_board_info cyttsp_info[] __initdata = {
2637 {
2638 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2639 .platform_data = &cyttsp_pdata,
2640#ifndef CY_USE_TIMER
2641 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2642#endif /* CY_USE_TIMER */
2643 },
2644};
2645
2646static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
2647{
2648}
2649
2650static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2651 .clk_freq = 100000,
2652 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002653 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2654};
2655
2656static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2657 .clk_freq = 100000,
2658 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002659 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2660};
2661
2662static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2663 .clk_freq = 100000,
2664 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002665 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2666};
2667
2668static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2669 .clk_freq = 100000,
2670 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002671 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2672};
2673
2674static struct msm_rpm_platform_data msm_rpm_data = {
2675 .reg_base_addrs = {
2676 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
2677 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
2678 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
2679 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
2680 },
2681
2682 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
2683 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
2684 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
2685 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
2686 .msm_apps_ipc_rpm_val = 4,
2687};
2688
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002689static struct platform_device msm_rpm_device = {
2690 .name = "msm_rpm",
2691 .id = -1,
2692};
2693
2694
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002695static struct spi_board_info spi_board_info[] __initdata = {
2696 {
2697 .modalias = "ks8851",
2698 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2699 .max_speed_hz = 19200000,
2700 .bus_num = 0,
2701 .chip_select = 0,
2702 .mode = SPI_MODE_0,
2703 },
2704};
2705
2706static struct platform_device msm_device_saw_core0 = {
2707 .name = "saw-regulator",
2708 .id = 0,
2709 .dev = {
2710 .platform_data = &msm_saw_regulator_pdata_s5,
2711 },
2712};
2713
2714static struct platform_device msm_device_saw_core1 = {
2715 .name = "saw-regulator",
2716 .id = 1,
2717 .dev = {
2718 .platform_data = &msm_saw_regulator_pdata_s6,
2719 },
2720};
2721
2722#ifdef CONFIG_MSM_FAKE_BATTERY
2723static struct platform_device fish_battery_device = {
2724 .name = "fish_battery",
2725};
2726#endif
2727
David Collins26f05562011-06-20 09:56:28 -07002728static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002729 .name = GPIO_REGULATOR_DEV_NAME,
2730 .id = PM8921_MPP_PM_TO_SYS(7),
2731 .dev = {
2732 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2733 },
2734};
2735
David Collins26f05562011-06-20 09:56:28 -07002736static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002737 .name = GPIO_REGULATOR_DEV_NAME,
2738 .id = 91,
2739 .dev = {
2740 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2741 },
2742};
2743
David Collinsb10be1d2011-09-02 10:29:31 -07002744static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2745 .name = GPIO_REGULATOR_DEV_NAME,
2746 .id = PM8921_GPIO_PM_TO_SYS(17),
2747 .dev = {
2748 .platform_data =
2749 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2750 },
2751};
2752
David Collins26f05562011-06-20 09:56:28 -07002753static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2754 .name = "rpm-regulator",
2755 .id = -1,
2756 .dev = {
2757 .platform_data = &msm_rpm_regulator_pdata,
2758 },
2759};
2760
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002761static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002762 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002763 &msm_device_smd,
2764 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302765 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002766 &msm_device_saw_core0,
2767 &msm_device_saw_core1,
2768 &msm8960_device_ext_5v_vreg,
2769 &msm8960_device_ext_l2_vreg,
2770 &msm8960_device_ssbi_pm8921,
2771 &msm8960_device_qup_spi_gsbi1,
2772 &msm8960_device_qup_i2c_gsbi3,
2773 &msm8960_device_qup_i2c_gsbi4,
2774 &msm8960_device_qup_i2c_gsbi10,
2775#ifndef CONFIG_MSM_DSPS
2776 &msm8960_device_qup_i2c_gsbi12,
2777#endif
2778 &msm_slim_ctrl,
2779 &msm_device_wcnss_wlan,
2780#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2781 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2782 &qcrypto_device,
2783#endif
2784
2785#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2786 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2787 &qcedev_device,
2788#endif
2789#ifdef CONFIG_MSM_ROTATOR
2790 &msm_rotator_device,
2791#endif
2792 &msm_device_sps,
2793#ifdef CONFIG_MSM_FAKE_BATTERY
2794 &fish_battery_device,
2795#endif
2796#ifdef CONFIG_ANDROID_PMEM
2797 &android_pmem_device,
2798 &android_pmem_adsp_device,
2799 &android_pmem_audio_device,
2800#endif
2801 &msm_fb_device,
2802 &msm_device_vidc,
2803 &msm_device_bam_dmux,
2804 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002805
2806#ifdef CONFIG_HW_RANDOM_MSM
2807 &msm_device_rng,
2808#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002809 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07002810#ifdef CONFIG_ION_MSM
2811 &ion_dev,
2812#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002813};
2814
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002815static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002816 &msm8960_device_otg,
2817 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002818 &msm_device_hsusb_host,
2819 &android_usb_device,
2820 &msm_device_vidc,
2821 &mipi_dsi_simulator_panel_device,
2822 &msm_bus_apps_fabric,
2823 &msm_bus_sys_fabric,
2824 &msm_bus_mm_fabric,
2825 &msm_bus_sys_fpb,
2826 &msm_bus_cpss_fpb,
2827 &msm_pcm,
2828 &msm_pcm_routing,
2829 &msm_cpudai0,
2830 &msm_cpudai1,
2831 &msm_cpudai_hdmi_rx,
2832 &msm_cpudai_bt_rx,
2833 &msm_cpudai_bt_tx,
2834 &msm_cpudai_fm_rx,
2835 &msm_cpudai_fm_tx,
2836 &msm_cpu_fe,
2837 &msm_stub_codec,
2838 &msm_voice,
2839 &msm_voip,
2840 &msm_lpa_pcm,
2841
2842#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2843 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2844 &qcrypto_device,
2845#endif
2846
2847#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2848 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2849 &qcedev_device,
2850#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002851};
2852
2853static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002854 &msm_kgsl_3d0,
2855 &msm_kgsl_2d0,
2856 &msm_kgsl_2d1,
2857 &mipi_dsi_renesas_panel_device,
2858#ifdef CONFIG_MSM_GEMINI
2859 &msm8960_gemini_device,
2860#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002861};
2862
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002863static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002864 &msm8960_device_otg,
2865 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002866 &msm_device_hsusb_host,
2867 &android_usb_device,
2868 &msm_pcm,
2869 &msm_pcm_routing,
2870 &msm_cpudai0,
2871 &msm_cpudai1,
2872 &msm_cpudai_hdmi_rx,
2873 &msm_cpudai_bt_rx,
2874 &msm_cpudai_bt_tx,
2875 &msm_cpudai_fm_rx,
2876 &msm_cpudai_fm_tx,
2877 &msm_cpu_fe,
2878 &msm_stub_codec,
2879 &msm_kgsl_3d0,
2880#ifdef CONFIG_MSM_KGSL_2D
2881 &msm_kgsl_2d0,
2882 &msm_kgsl_2d1,
2883#endif
2884 &mipi_dsi_toshiba_panel_device,
2885#ifdef CONFIG_MSM_GEMINI
2886 &msm8960_gemini_device,
2887#endif
2888 &msm_voice,
2889 &msm_voip,
2890 &msm_lpa_pcm,
2891#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2892 &hdmi_msm_device,
2893#endif
2894 &msm_pcm_hostless,
2895 &msm_bus_apps_fabric,
2896 &msm_bus_sys_fabric,
2897 &msm_bus_mm_fabric,
2898 &msm_bus_sys_fpb,
2899 &msm_bus_cpss_fpb,
2900};
2901
2902static void __init msm8960_i2c_init(void)
2903{
2904 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2905 &msm8960_i2c_qup_gsbi4_pdata;
2906
2907 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2908 &msm8960_i2c_qup_gsbi3_pdata;
2909
2910 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2911 &msm8960_i2c_qup_gsbi10_pdata;
2912
2913 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2914 &msm8960_i2c_qup_gsbi12_pdata;
2915}
2916
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002917static void __init msm8960_gfx_init(void)
2918{
2919 uint32_t soc_platform_version = socinfo_get_platform_version();
2920 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2921 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2922 msm_kgsl_3d0.dev.platform_data;
2923 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
2924 320000000;
2925 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
2926 266667000;
2927 }
2928}
2929
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002930static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
2931 .irq_base = PM8921_IRQ_BASE,
2932 .devirq = MSM_GPIO_TO_INT(104),
2933 .irq_trigger_flag = IRQF_TRIGGER_LOW,
2934};
2935
2936static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
2937 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
2938};
2939
2940static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
2941 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
2942};
2943
2944static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
2945 .rtc_write_enable = false,
2946};
2947
2948static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
2949 .pull_up = 1,
2950 .kpd_trigger_delay_us = 970,
2951 .wakeup = 1,
2952};
2953
2954static const unsigned int keymap[] = {
2955 KEY(0, 0, KEY_VOLUMEUP),
2956 KEY(0, 1, KEY_VOLUMEDOWN),
2957 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
2958 KEY(0, 3, KEY_CAMERA_FOCUS),
2959};
2960
2961static struct matrix_keymap_data keymap_data = {
2962 .keymap_size = ARRAY_SIZE(keymap),
2963 .keymap = keymap,
2964};
2965
2966static struct pm8xxx_keypad_platform_data keypad_data = {
2967 .input_name = "keypad_8960",
2968 .input_phys_device = "keypad_8960/input0",
2969 .num_rows = 1,
2970 .num_cols = 5,
2971 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
2972 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
2973 .debounce_ms = 15,
2974 .scan_delay_ms = 32,
2975 .row_hold_ns = 91500,
2976 .wakeup = 1,
2977 .keymap_data = &keymap_data,
2978};
2979
2980static const unsigned int keymap_sim[] = {
2981 KEY(0, 0, KEY_7),
2982 KEY(0, 1, KEY_DOWN),
2983 KEY(0, 2, KEY_UP),
2984 KEY(0, 3, KEY_RIGHT),
2985 KEY(0, 4, KEY_ENTER),
2986 KEY(0, 5, KEY_L),
2987 KEY(0, 6, KEY_BACK),
2988 KEY(0, 7, KEY_M),
2989
2990 KEY(1, 0, KEY_LEFT),
2991 KEY(1, 1, KEY_SEND),
2992 KEY(1, 2, KEY_1),
2993 KEY(1, 3, KEY_4),
2994 KEY(1, 4, KEY_CLEAR),
2995 KEY(1, 5, KEY_MSDOS),
2996 KEY(1, 6, KEY_SPACE),
2997 KEY(1, 7, KEY_COMMA),
2998
2999 KEY(2, 0, KEY_6),
3000 KEY(2, 1, KEY_5),
3001 KEY(2, 2, KEY_8),
3002 KEY(2, 3, KEY_3),
3003 KEY(2, 4, KEY_NUMERIC_STAR),
3004 KEY(2, 5, KEY_UP),
3005 KEY(2, 6, KEY_DOWN),
3006 KEY(2, 7, KEY_LEFTSHIFT),
3007
3008 KEY(3, 0, KEY_9),
3009 KEY(3, 1, KEY_NUMERIC_POUND),
3010 KEY(3, 2, KEY_0),
3011 KEY(3, 3, KEY_2),
3012 KEY(3, 4, KEY_SLEEP),
3013 KEY(3, 5, KEY_F1),
3014 KEY(3, 6, KEY_F2),
3015 KEY(3, 7, KEY_F3),
3016
3017 KEY(4, 0, KEY_BACK),
3018 KEY(4, 1, KEY_HOME),
3019 KEY(4, 2, KEY_MENU),
3020 KEY(4, 3, KEY_VOLUMEUP),
3021 KEY(4, 4, KEY_VOLUMEDOWN),
3022 KEY(4, 5, KEY_F4),
3023 KEY(4, 6, KEY_F5),
3024 KEY(4, 7, KEY_F6),
3025
3026 KEY(5, 0, KEY_R),
3027 KEY(5, 1, KEY_T),
3028 KEY(5, 2, KEY_Y),
3029 KEY(5, 3, KEY_LEFTALT),
3030 KEY(5, 4, KEY_KPENTER),
3031 KEY(5, 5, KEY_Q),
3032 KEY(5, 6, KEY_W),
3033 KEY(5, 7, KEY_E),
3034
3035 KEY(6, 0, KEY_F),
3036 KEY(6, 1, KEY_G),
3037 KEY(6, 2, KEY_H),
3038 KEY(6, 3, KEY_CAPSLOCK),
3039 KEY(6, 4, KEY_PAGEUP),
3040 KEY(6, 5, KEY_A),
3041 KEY(6, 6, KEY_S),
3042 KEY(6, 7, KEY_D),
3043
3044 KEY(7, 0, KEY_V),
3045 KEY(7, 1, KEY_B),
3046 KEY(7, 2, KEY_N),
3047 KEY(7, 3, KEY_MENU),
3048 KEY(7, 4, KEY_PAGEDOWN),
3049 KEY(7, 5, KEY_Z),
3050 KEY(7, 6, KEY_X),
3051 KEY(7, 7, KEY_C),
3052
3053 KEY(8, 0, KEY_P),
3054 KEY(8, 1, KEY_J),
3055 KEY(8, 2, KEY_K),
3056 KEY(8, 3, KEY_INSERT),
3057 KEY(8, 4, KEY_LINEFEED),
3058 KEY(8, 5, KEY_U),
3059 KEY(8, 6, KEY_I),
3060 KEY(8, 7, KEY_O),
3061
3062 KEY(9, 0, KEY_4),
3063 KEY(9, 1, KEY_5),
3064 KEY(9, 2, KEY_6),
3065 KEY(9, 3, KEY_7),
3066 KEY(9, 4, KEY_8),
3067 KEY(9, 5, KEY_1),
3068 KEY(9, 6, KEY_2),
3069 KEY(9, 7, KEY_3),
3070
3071 KEY(10, 0, KEY_F7),
3072 KEY(10, 1, KEY_F8),
3073 KEY(10, 2, KEY_F9),
3074 KEY(10, 3, KEY_F10),
3075 KEY(10, 4, KEY_FN),
3076 KEY(10, 5, KEY_9),
3077 KEY(10, 6, KEY_0),
3078 KEY(10, 7, KEY_DOT),
3079
3080 KEY(11, 0, KEY_LEFTCTRL),
3081 KEY(11, 1, KEY_F11),
3082 KEY(11, 2, KEY_ENTER),
3083 KEY(11, 3, KEY_SEARCH),
3084 KEY(11, 4, KEY_DELETE),
3085 KEY(11, 5, KEY_RIGHT),
3086 KEY(11, 6, KEY_LEFT),
3087 KEY(11, 7, KEY_RIGHTSHIFT),
3088 KEY(0, 0, KEY_VOLUMEUP),
3089 KEY(0, 1, KEY_VOLUMEDOWN),
3090 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3091 KEY(0, 3, KEY_CAMERA_FOCUS),
3092};
3093
3094static struct matrix_keymap_data keymap_data_sim = {
3095 .keymap_size = ARRAY_SIZE(keymap_sim),
3096 .keymap = keymap_sim,
3097};
3098
3099static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3100 .input_name = "keypad_8960",
3101 .input_phys_device = "keypad_8960/input0",
3102 .num_rows = 12,
3103 .num_cols = 8,
3104 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3105 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3106 .debounce_ms = 15,
3107 .scan_delay_ms = 32,
3108 .row_hold_ns = 91500,
3109 .wakeup = 1,
3110 .keymap_data = &keymap_data_sim,
3111};
3112
3113static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003114 .safety_time = 180,
3115 .update_time = 1,
3116 .max_voltage = 4200,
3117 .min_voltage = 3200,
3118 .resume_voltage = 4100,
3119 .term_current = 100,
3120 .cool_temp = 10,
3121 .warm_temp = 40,
3122 .temp_check_period = 1,
3123 .max_bat_chg_current = 400,
3124 .cool_bat_chg_current = 350,
3125 .warm_bat_chg_current = 350,
3126 .cool_bat_voltage = 4100,
3127 .warm_bat_voltage = 4100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003128};
3129
3130static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3131 .priority = 0,
3132};
3133
3134static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3135 .r_sense = 10,
3136 .i_test = 2500,
3137 .v_failure = 3000,
3138 .calib_delay_ms = 600000,
3139 .batt_data = &palladium_1500_data,
3140};
3141
Jay Chokshide4cefb2011-08-04 18:10:44 -07003142#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3143
3144/**
3145 * 'flag' stores three values; led id, led mode, and max current of led.
3146 * The bit packing format is as follow,
3147 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3148 * led_id (1 nibble)
3149 */
3150#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3151 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3152 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3153 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3154 PM8XXX_LED_MAX_CURRENT_MASK))
3155
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003156static struct led_info pm8921_led_info[] = {
3157 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003158 .name = "led:usb",
3159 .default_trigger = "usb-online",
3160 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3161 PM8XXX_LED_MODE_MANUAL,
3162 PM8921_LC_LED_MAX_CURRENT),
3163 },
3164 [1] = {
3165 .name = "led:ac",
3166 .default_trigger = "ac-online",
3167 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3168 PM8XXX_LED_MODE_MANUAL,
3169 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003170 },
3171};
3172
3173static struct led_platform_data pm8xxx_leds_pdata = {
3174 .num_leds = ARRAY_SIZE(pm8921_led_info),
3175 .leds = pm8921_led_info,
3176};
3177
3178static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3179 .irq_pdata = &pm8xxx_irq_pdata,
3180 .gpio_pdata = &pm8xxx_gpio_pdata,
3181 .mpp_pdata = &pm8xxx_mpp_pdata,
3182 .rtc_pdata = &pm8xxx_rtc_pdata,
3183 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3184 .keypad_pdata = &keypad_data,
3185 .misc_pdata = &pm8xxx_misc_pdata,
3186 .regulator_pdatas = msm_pm8921_regulator_pdata,
3187 .charger_pdata = &pm8921_chg_pdata,
3188 .bms_pdata = &pm8921_bms_pdata,
3189 .adc_pdata = &pm8921_adc_pdata,
3190 .leds_pdata = &pm8xxx_leds_pdata,
3191};
3192
3193static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3194 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3195 .slave = {
3196 .name = "pm8921-core",
3197 .platform_data = &pm8921_platform_data,
3198 },
3199};
3200
3201static void msm8960_wcnss_init(void)
3202{
3203 int i, ret, j;
3204
3205 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3206 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3207 "wcnss_5_wire");
3208 if (ret) {
3209 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3210 wcnss_5wire_interface[i].gpio, ret);
3211 goto fail;
3212 }
3213 }
3214
3215 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3216
3217 return;
3218
3219fail:
3220 for (j = 0; j < i; j++)
3221 gpio_free(wcnss_5wire_interface[j].gpio);
3222}
3223
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003224#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003225static int ethernet_init(void)
3226{
3227 int ret;
3228 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3229 if (ret) {
3230 pr_err("ks8851 gpio_request failed: %d\n", ret);
3231 goto fail;
3232 }
3233
3234 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3235 if (ret) {
3236 pr_err("ks8851 gpio_request failed: %d\n", ret);
3237 goto fail_rst;
3238 }
3239
3240 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3241 if (ret) {
3242 pr_err("ks8851 gpio_request failed: %d\n", ret);
3243 goto fail_cs;
3244 }
3245
3246 gpio_direction_output(FPGA_CS_GPIO, 1);
3247 gpio_direction_output(KS8851_RST_GPIO, 1);
3248 return 0;
3249fail_cs:
3250 gpio_free(KS8851_RST_GPIO);
3251fail_rst:
3252 gpio_free(KS8851_IRQ_GPIO);
3253fail:
3254 return ret;
3255}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003256#else
3257static int ethernet_init(void)
3258{
3259 return 0;
3260}
3261#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003262
3263static struct msm_cpuidle_state msm_cstates[] __initdata = {
3264 {0, 0, "C0", "WFI",
3265 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3266
3267 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3268 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3269
3270 {0, 2, "C2", "POWER_COLLAPSE",
3271 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3272
3273 {1, 0, "C0", "WFI",
3274 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3275
3276 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3277 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3278};
3279
3280static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3281 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3282 .idle_supported = 1,
3283 .suspend_supported = 1,
3284 .idle_enabled = 0,
3285 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003286 },
3287
3288 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3289 .idle_supported = 1,
3290 .suspend_supported = 1,
3291 .idle_enabled = 0,
3292 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003293 },
3294
3295 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3296 .idle_supported = 1,
3297 .suspend_supported = 1,
3298 .idle_enabled = 1,
3299 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003300 },
3301
3302 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3303 .idle_supported = 0,
3304 .suspend_supported = 1,
3305 .idle_enabled = 0,
3306 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003307 },
3308
3309 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3310 .idle_supported = 1,
3311 .suspend_supported = 1,
3312 .idle_enabled = 0,
3313 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003314 },
3315
3316 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3317 .idle_supported = 1,
3318 .suspend_supported = 0,
3319 .idle_enabled = 1,
3320 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003321 },
3322};
3323
3324static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3325 {
3326 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3327 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3328 true,
3329 1, 8000, 100000, 1,
3330 },
3331
3332 {
3333 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3334 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3335 true,
3336 1500, 5000, 60100000, 3000,
3337 },
3338
3339 {
3340 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3341 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3342 false,
3343 1800, 5000, 60350000, 3500,
3344 },
3345
3346 {
3347 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3348 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3349 false,
3350 2800, 2500, 65350000, 4800,
3351 },
3352
3353 {
3354 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3355 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3356 false,
3357 3800, 4500, 67850000, 5500,
3358 },
3359
3360 {
3361 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3362 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3363 false,
3364 4800, 2000, 71850000, 6800,
3365 },
3366
3367 {
3368 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3369 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3370 false,
3371 6800, 500, 75850000, 8800,
3372 },
3373
3374 {
3375 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3376 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3377 false,
3378 7800, 0, 76350000, 9800,
3379 },
3380};
3381
3382#ifdef CONFIG_I2C
3383#define I2C_SURF 1
3384#define I2C_FFA (1 << 1)
3385#define I2C_RUMI (1 << 2)
3386#define I2C_SIM (1 << 3)
3387#define I2C_FLUID (1 << 4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003388
3389struct i2c_registry {
3390 u8 machs;
3391 int bus;
3392 struct i2c_board_info *info;
3393 int len;
3394};
3395
3396#ifdef CONFIG_MSM_CAMERA
3397static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3398#ifdef CONFIG_IMX074
3399 {
3400 I2C_BOARD_INFO("imx074", 0x1A),
3401 },
3402#endif
3403#ifdef CONFIG_OV2720
3404 {
3405 I2C_BOARD_INFO("ov2720", 0x6C),
3406 },
3407#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003408 {
3409 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3410 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303411#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3412 {
3413 I2C_BOARD_INFO("sc628a", 0x6E),
3414 },
3415#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003416};
3417#endif
3418
3419/* Sensors DSPS platform data */
3420#ifdef CONFIG_MSM_DSPS
3421#define DSPS_PIL_GENERIC_NAME "dsps"
3422#endif /* CONFIG_MSM_DSPS */
3423
3424static void __init msm8960_init_dsps(void)
3425{
3426#ifdef CONFIG_MSM_DSPS
3427 struct msm_dsps_platform_data *pdata =
3428 msm_dsps_device.dev.platform_data;
3429 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3430 pdata->gpios = NULL;
3431 pdata->gpios_num = 0;
3432
3433 platform_device_register(&msm_dsps_device);
3434#endif /* CONFIG_MSM_DSPS */
3435}
3436
3437static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3438#ifdef CONFIG_MSM_CAMERA
3439 {
3440 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_RUMI,
3441 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3442 msm_camera_boardinfo,
3443 ARRAY_SIZE(msm_camera_boardinfo),
3444 },
3445#endif
3446 {
3447 I2C_SURF | I2C_FFA | I2C_FLUID,
3448 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3449 cyttsp_info,
3450 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003451 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003452};
3453#endif /* CONFIG_I2C */
3454
3455static void __init register_i2c_devices(void)
3456{
3457#ifdef CONFIG_I2C
3458 u8 mach_mask = 0;
3459 int i;
3460
3461 /* Build the matching 'supported_machs' bitmask */
3462 if (machine_is_msm8960_cdp())
3463 mach_mask = I2C_SURF;
3464 else if (machine_is_msm8960_rumi3())
3465 mach_mask = I2C_RUMI;
3466 else if (machine_is_msm8960_sim())
3467 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003468 else if (machine_is_msm8960_fluid())
3469 mach_mask = I2C_FLUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003470 else if (machine_is_msm8960_mtp())
3471 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003472 else
3473 pr_err("unmatched machine ID in register_i2c_devices\n");
3474
3475 /* Run the array and install devices as appropriate */
3476 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3477 if (msm8960_i2c_devices[i].machs & mach_mask)
3478 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3479 msm8960_i2c_devices[i].info,
3480 msm8960_i2c_devices[i].len);
3481 }
3482#endif
3483}
3484
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003485static void __init msm8960_sim_init(void)
3486{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003487 if (socinfo_init() < 0)
3488 pr_err("socinfo_init() failed!\n");
3489
3490 BUG_ON(msm_rpm_init(&msm_rpm_data));
3491 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3492 ARRAY_SIZE(msm_rpmrs_levels)));
3493 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003494 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003495 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003496 msm8960_device_ssbi_pm8921.dev.platform_data =
3497 &msm8960_ssbi_pm8921_pdata;
3498 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003499
3500 /* Simulator supports a QWERTY keypad */
3501 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
3502
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003503 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3504 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3505 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003506 gpiomux_init();
3507 ethernet_init();
3508 msm8960_i2c_init();
3509 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3510 msm_spm_l2_init(msm_spm_l2_data);
3511 msm8960_init_buses();
3512 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3513 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003514 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantall6d9ebee2011-08-26 12:15:24 -07003515 acpuclk_init(&msm8960_acpuclk_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003516
3517 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3518 &msm8960_qup_spi_gsbi1_pdata;
3519 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3520
3521 msm8960_init_mmc();
3522 msm_fb_add_devices();
3523 slim_register_board_info(msm_slim_devices,
3524 ARRAY_SIZE(msm_slim_devices));
3525 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3526 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3527 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3528 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003529}
3530
3531static void __init msm8960_rumi3_init(void)
3532{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003533 if (socinfo_init() < 0)
3534 pr_err("socinfo_init() failed!\n");
3535
3536 BUG_ON(msm_rpm_init(&msm_rpm_data));
3537 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3538 ARRAY_SIZE(msm_rpmrs_levels)));
3539 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07003540 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003541 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003542 gpiomux_init();
3543 ethernet_init();
3544 msm8960_device_ssbi_pm8921.dev.platform_data =
3545 &msm8960_ssbi_pm8921_pdata;
3546 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3547 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3548 &msm8960_qup_spi_gsbi1_pdata;
3549 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3550 msm8960_i2c_init();
3551 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3552 msm_spm_l2_init(msm_spm_l2_data);
3553 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3554 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003555 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003556 msm8960_init_mmc();
3557
3558 register_i2c_devices();
3559 msm_fb_add_devices();
3560 slim_register_board_info(msm_slim_devices,
3561 ARRAY_SIZE(msm_slim_devices));
3562 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3563 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3564 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3565 msm_pm_data);
3566}
3567
3568static void __init msm8960_cdp_init(void)
3569{
3570 if (socinfo_init() < 0)
3571 pr_err("socinfo_init() failed!\n");
3572
3573 BUG_ON(msm_rpm_init(&msm_rpm_data));
3574 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3575 ARRAY_SIZE(msm_rpmrs_levels)));
3576 regulator_suppress_info_printing();
3577 if (msm_xo_init())
3578 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07003579 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07003580 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003581 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3582 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3583 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003584 gpiomux_init();
3585 ethernet_init();
3586 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3587 &msm8960_qup_spi_gsbi1_pdata;
3588 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3589 msm8960_device_ssbi_pm8921.dev.platform_data =
3590 &msm8960_ssbi_pm8921_pdata;
3591 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3592 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003593 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003594 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3595 msm_spm_l2_init(msm_spm_l2_data);
3596 msm8960_init_buses();
3597 platform_add_devices(msm_footswitch_devices,
3598 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07003599 if (machine_is_msm8960_liquid())
3600 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003601 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3602 pm8921_gpio_mpp_init();
3603 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3604 msm8960_init_cam();
3605 msm8960_init_mmc();
Matt Wagantall6d9ebee2011-08-26 12:15:24 -07003606 acpuclk_init(&msm8960_acpuclk_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003607 register_i2c_devices();
3608 msm8960_wcnss_init();
3609 msm_fb_add_devices();
3610 slim_register_board_info(msm_slim_devices,
3611 ARRAY_SIZE(msm_slim_devices));
3612 msm8960_init_dsps();
3613 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3614 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3615 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3616 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07003617 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003618}
3619
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003620MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3621 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003622 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003623 .init_irq = msm8960_init_irq,
3624 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003625 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003626 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003627MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003628
3629MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3630 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003631 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003632 .init_irq = msm8960_init_irq,
3633 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003634 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003635 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003636MACHINE_END
3637
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003638MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3639 .map_io = msm8960_map_io,
3640 .reserve = msm8960_reserve,
3641 .init_irq = msm8960_init_irq,
3642 .timer = &msm_timer,
3643 .init_machine = msm8960_cdp_init,
3644 .init_early = msm8960_allocate_memory_regions,
3645MACHINE_END
3646
3647MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3648 .map_io = msm8960_map_io,
3649 .reserve = msm8960_reserve,
3650 .init_irq = msm8960_init_irq,
3651 .timer = &msm_timer,
3652 .init_machine = msm8960_cdp_init,
3653 .init_early = msm8960_allocate_memory_regions,
3654MACHINE_END
3655
3656MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3657 .map_io = msm8960_map_io,
3658 .reserve = msm8960_reserve,
3659 .init_irq = msm8960_init_irq,
3660 .timer = &msm_timer,
3661 .init_machine = msm8960_cdp_init,
3662 .init_early = msm8960_allocate_memory_regions,
3663MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003664
3665MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3666 .map_io = msm8960_map_io,
3667 .reserve = msm8960_reserve,
3668 .init_irq = msm8960_init_irq,
3669 .timer = &msm_timer,
3670 .init_machine = msm8960_cdp_init,
3671 .init_early = msm8960_allocate_memory_regions,
3672MACHINE_END