blob: 145459b7db4d6d62874f0ad83f9658c547adb977 [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>
27#ifdef CONFIG_ANDROID_PMEM
28#include <linux/android_pmem.h>
29#endif
30#include <linux/cyttsp.h>
31#include <linux/dma-mapping.h>
32#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070033#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034#include <linux/leds.h>
35#include <linux/leds-pm8xxx.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080036
37#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070039#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080040#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080042
43#include <mach/board.h>
44#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include <mach/msm_spi.h>
46#ifdef CONFIG_USB_MSM_OTG_72K
47#include <mach/msm_hsusb.h>
48#else
49#include <linux/usb/msm_hsusb.h>
50#endif
51#include <linux/usb/android.h>
52#include <mach/usbdiag.h>
53#include <mach/socinfo.h>
54#include <mach/rpm.h>
55#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070056#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057#include <mach/msm_bus_board.h>
58#include <mach/msm_memtypes.h>
59#include <mach/dma.h>
60#include <mach/msm_dsps.h>
61#include <mach/msm_xo.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080062
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#ifdef CONFIG_WCD9310_CODEC
64#include <linux/slimbus/slimbus.h>
65#include <linux/mfd/wcd9310/core.h>
66#include <linux/mfd/wcd9310/pdata.h>
67#endif
68
69#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080070#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072#include "spm.h"
73#include "board-msm8960.h"
74#include "pm.h"
75#include "cpuidle.h"
76#include "rpm_resources.h"
77#include "mpm.h"
78
79static struct platform_device msm_fm_platform_init = {
80 .name = "iris_fm",
81 .id = -1,
82};
83
84struct pm8xxx_gpio_init {
85 unsigned gpio;
86 struct pm_gpio config;
87};
88
89struct pm8xxx_mpp_init {
90 unsigned mpp;
91 struct pm8xxx_mpp_config_data config;
92};
93
94#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
95 _func, _inv, _disable) \
96{ \
97 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
98 .config = { \
99 .direction = _dir, \
100 .output_buffer = _buf, \
101 .output_value = _val, \
102 .pull = _pull, \
103 .vin_sel = _vin, \
104 .out_strength = _out_strength, \
105 .function = _func, \
106 .inv_int_pol = _inv, \
107 .disable_pin = _disable, \
108 } \
109}
110
111#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
112{ \
113 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
114 .config = { \
115 .type = PM8XXX_MPP_TYPE_##_type, \
116 .level = _level, \
117 .control = PM8XXX_MPP_##_control, \
118 } \
119}
120
121#define PM8XXX_GPIO_DISABLE(_gpio) \
122 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
123 0, 0, 0, 1)
124
125#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
126 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
127 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
128 PM_GPIO_STRENGTH_HIGH, \
129 PM_GPIO_FUNC_NORMAL, 0, 0)
130
131#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
132 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
133 _pull, PM_GPIO_VIN_S4, \
134 PM_GPIO_STRENGTH_NO, \
135 PM_GPIO_FUNC_NORMAL, 0, 0)
136
137#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
138 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
139 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
140 PM_GPIO_STRENGTH_HIGH, \
141 _func, 0, 0)
142
143/* Initial PM8921 GPIO configurations */
144static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
145 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
146 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
147 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
148 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700149 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700150 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
151 PM8XXX_GPIO_OUTPUT(43, 0), /* DISP_RESET_N */
152};
153
154/* Initial PM8921 MPP configurations */
155static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
156 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
157 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
158 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6,
159 DOUT_CTRL_LOW),
160 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
161 DOUT_CTRL_LOW),
162};
163
164static void __init pm8921_gpio_mpp_init(void)
165{
166 int i, rc;
167
168 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
169 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
170 &pm8921_gpios[i].config);
171 if (rc) {
172 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
173 break;
174 }
175 }
176
177 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
178 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
179 &pm8921_mpps[i].config);
180 if (rc) {
181 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
182 break;
183 }
184 }
185}
186
187#define FPGA_CS_GPIO 14
188#define KS8851_RST_GPIO 89
189#define KS8851_IRQ_GPIO 90
190
191/* Macros assume PMIC GPIOs and MPPs start at 1 */
192#define PM8921_GPIO_BASE NR_GPIO_IRQS
193#define PM8921_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_GPIO_BASE)
194#define PM8921_MPP_BASE (PM8921_GPIO_BASE + PM8921_NR_GPIOS)
195#define PM8921_MPP_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_MPP_BASE)
196#define PM8921_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
197#define PM8921_MPP_IRQ_BASE (PM8921_IRQ_BASE + NR_GPIO_IRQS)
198
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700199#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
200enum {
201 GPIO_EXPANDER_IRQ_BASE = (PM8921_MPP_IRQ_BASE + PM8921_NR_MPPS),
202 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
203 /* CAM Expander */
204 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
205 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
206 GPIO_CAM_GP_AFBUSY,
207 GPIO_CAM_GP_STROBE_CE,
208 GPIO_CAM_GP_CAM1MP_XCLR,
209 GPIO_CAM_GP_CAMIF_RESET_N,
210 GPIO_CAM_GP_XMT_FLASH_INT,
211 GPIO_CAM_GP_LED_EN1,
212 GPIO_CAM_GP_LED_EN2,
213
214};
215#endif
216
Harini Jayaraman608d0462011-08-09 19:10:03 -0600217/* The SPI configurations apply to GSBI 1*/
218static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700219 .func = GPIOMUX_FUNC_1,
220 .drv = GPIOMUX_DRV_8MA,
221 .pull = GPIOMUX_PULL_NONE,
222};
223
Harini Jayaraman608d0462011-08-09 19:10:03 -0600224static struct gpiomux_setting spi_suspended_config = {
225 .func = GPIOMUX_FUNC_GPIO,
226 .drv = GPIOMUX_DRV_2MA,
227 .pull = GPIOMUX_PULL_DOWN,
228};
229
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700230static struct gpiomux_setting gsbi3 = {
231 .func = GPIOMUX_FUNC_1,
232 .drv = GPIOMUX_DRV_8MA,
233 .pull = GPIOMUX_PULL_NONE,
234};
235
236static struct gpiomux_setting gsbi4 = {
237 .func = GPIOMUX_FUNC_1,
238 .drv = GPIOMUX_DRV_8MA,
239 .pull = GPIOMUX_PULL_NONE,
240};
241
242static struct gpiomux_setting gsbi5 = {
243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_8MA,
245 .pull = GPIOMUX_PULL_NONE,
246};
247
248static struct gpiomux_setting gsbi10 = {
249 .func = GPIOMUX_FUNC_2,
250 .drv = GPIOMUX_DRV_8MA,
251 .pull = GPIOMUX_PULL_NONE,
252};
253
254static struct gpiomux_setting gsbi12 = {
255 .func = GPIOMUX_FUNC_1,
256 .drv = GPIOMUX_DRV_8MA,
257 .pull = GPIOMUX_PULL_NONE,
258};
259
260static struct gpiomux_setting cdc_mclk = {
261 .func = GPIOMUX_FUNC_1,
262 .drv = GPIOMUX_DRV_8MA,
263 .pull = GPIOMUX_PULL_NONE,
264};
265
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700266#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267static struct gpiomux_setting gpio_eth_config = {
268 .pull = GPIOMUX_PULL_NONE,
269 .drv = GPIOMUX_DRV_8MA,
270 .func = GPIOMUX_FUNC_GPIO,
271};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700272#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700273
274static struct gpiomux_setting slimbus = {
275 .func = GPIOMUX_FUNC_1,
276 .drv = GPIOMUX_DRV_8MA,
277 .pull = GPIOMUX_PULL_KEEPER,
278};
279
280struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700281#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282 {
283 .gpio = KS8851_IRQ_GPIO,
284 .settings = {
285 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
286 }
287 },
288 {
289 .gpio = KS8851_RST_GPIO,
290 .settings = {
291 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
292 }
293 },
294 {
295 .gpio = FPGA_CS_GPIO,
296 .settings = {
297 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
298 }
299 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700300#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700301};
302
303static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
304 {
305 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
306 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600307 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
308 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309 },
310 },
311 {
312 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
313 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600314 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
315 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316 },
317 },
318 {
319 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
320 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600321 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
322 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323 },
324 },
325 {
326 .gpio = 9, /* GSBI1 QUP SPI_CLK */
327 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600328 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
329 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330 },
331 },
332 {
333 .gpio = 16, /* GSBI3 I2C QUP SDA */
334 .settings = {
335 [GPIOMUX_SUSPENDED] = &gsbi3,
336 },
337 },
338 {
339 .gpio = 17, /* GSBI3 I2C QUP SCL */
340 .settings = {
341 [GPIOMUX_SUSPENDED] = &gsbi3,
342 },
343 },
344 {
345 .gpio = 20, /* GSBI4 I2C QUP SDA */
346 .settings = {
347 [GPIOMUX_SUSPENDED] = &gsbi4,
348 },
349 },
350 {
351 .gpio = 21, /* GSBI4 I2C QUP SCL */
352 .settings = {
353 [GPIOMUX_SUSPENDED] = &gsbi4,
354 },
355 },
356 {
357 .gpio = 22, /* GSBI5 UART2 */
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &gsbi5,
360 },
361 },
362 {
363 .gpio = 23, /* GSBI5 UART2 */
364 .settings = {
365 [GPIOMUX_SUSPENDED] = &gsbi5,
366 },
367 },
368 {
369 .gpio = 24, /* GSBI5 UART2 */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &gsbi5,
372 },
373 },
374 {
375 .gpio = 25, /* GSBI5 UART2 */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &gsbi5,
378 },
379 },
380 {
381 .gpio = 44, /* GSBI12 I2C QUP SDA */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &gsbi12,
384 },
385 },
386 {
387 .gpio = 45, /* GSBI12 I2C QUP SCL */
388 .settings = {
389 [GPIOMUX_SUSPENDED] = &gsbi12,
390 },
391 },
392 {
393 .gpio = 73, /* GSBI10 I2C QUP SDA */
394 .settings = {
395 [GPIOMUX_SUSPENDED] = &gsbi10,
396 },
397 },
398 {
399 .gpio = 74, /* GSBI10 I2C QUP SCL */
400 .settings = {
401 [GPIOMUX_SUSPENDED] = &gsbi10,
402 },
403 },
404};
405
406static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
407 {
408 .gpio = 60, /* slimbus data */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &slimbus,
411 },
412 },
413 {
414 .gpio = 61, /* slimbus clk */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &slimbus,
417 },
418 },
419};
420
421static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
422 {
423 .gpio = 59,
424 .settings = {
425 [GPIOMUX_SUSPENDED] = &cdc_mclk,
426 },
427 },
428};
429static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
430 .func = GPIOMUX_FUNC_GPIO,
431 .drv = GPIOMUX_DRV_2MA,
432 .pull = GPIOMUX_PULL_NONE,
433};
434
435static struct gpiomux_setting wcnss_5wire_active_cfg = {
436 .func = GPIOMUX_FUNC_1,
437 .drv = GPIOMUX_DRV_6MA,
438 .pull = GPIOMUX_PULL_DOWN,
439};
440
441static struct msm_gpiomux_config wcnss_5wire_interface[] = {
442 {
443 .gpio = 84,
444 .settings = {
445 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
446 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
447 },
448 },
449 {
450 .gpio = 85,
451 .settings = {
452 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
453 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
454 },
455 },
456 {
457 .gpio = 86,
458 .settings = {
459 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
460 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
461 },
462 },
463 {
464 .gpio = 87,
465 .settings = {
466 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
467 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
468 },
469 },
470 {
471 .gpio = 88,
472 .settings = {
473 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
474 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
475 },
476 },
477};
Nishant Pandit474f2252011-07-23 23:17:56 +0530478static struct gpiomux_setting cam_settings[4] = {
479 {
480 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
481 .drv = GPIOMUX_DRV_2MA,
482 .pull = GPIOMUX_PULL_DOWN,
483 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700484
Nishant Pandit474f2252011-07-23 23:17:56 +0530485 {
486 .func = GPIOMUX_FUNC_1, /*active 1*/
487 .drv = GPIOMUX_DRV_2MA,
488 .pull = GPIOMUX_PULL_NONE,
489 },
490
491 {
492 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
493 .drv = GPIOMUX_DRV_2MA,
494 .pull = GPIOMUX_PULL_NONE,
495 },
496
497 {
498 .func = GPIOMUX_FUNC_1, /*active 3*/
499 .drv = GPIOMUX_DRV_8MA,
500 .pull = GPIOMUX_PULL_UP,
501 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700502};
503
Nishant Pandit474f2252011-07-23 23:17:56 +0530504static struct msm_gpiomux_config msm8960_cam_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700505 {
506 .gpio = 2,
507 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530508 [GPIOMUX_ACTIVE] = &cam_settings[2],
509 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700510 },
511 },
512 {
513 .gpio = 3,
514 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530515 [GPIOMUX_ACTIVE] = &cam_settings[1],
516 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700517 },
518 },
519 {
520 .gpio = 4,
521 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530522 [GPIOMUX_ACTIVE] = &cam_settings[1],
523 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700524 },
525 },
526 {
527 .gpio = 5,
528 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530529 [GPIOMUX_ACTIVE] = &cam_settings[1],
530 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700531 },
532 },
533 {
534 .gpio = 18,
535 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530536 [GPIOMUX_ACTIVE] = &cam_settings[3],
537 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700538 },
539 },
540 {
541 .gpio = 19,
542 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530543 [GPIOMUX_ACTIVE] = &cam_settings[3],
544 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700545 },
546 },
547 {
548 .gpio = 20,
549 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530550 [GPIOMUX_ACTIVE] = &cam_settings[3],
551 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700552 },
553 },
554 {
555 .gpio = 21,
556 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530557 [GPIOMUX_ACTIVE] = &cam_settings[3],
558 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700559 },
560 },
561 {
562 .gpio = 76,
563 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530564 [GPIOMUX_ACTIVE] = &cam_settings[2],
565 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700566 },
567 },
568 {
569 .gpio = 107,
570 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530571 [GPIOMUX_ACTIVE] = &cam_settings[2],
572 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700573 },
574 },
575};
576
577static struct gpiomux_setting cyts_resout_sus_cfg = {
578 .func = GPIOMUX_FUNC_GPIO,
579 .drv = GPIOMUX_DRV_6MA,
580 .pull = GPIOMUX_PULL_UP,
581};
582
583static struct gpiomux_setting cyts_resout_act_cfg = {
584 .func = GPIOMUX_FUNC_GPIO,
585 .drv = GPIOMUX_DRV_6MA,
586 .pull = GPIOMUX_PULL_UP,
587};
588
589static struct gpiomux_setting cyts_sleep_sus_cfg = {
590 .func = GPIOMUX_FUNC_GPIO,
591 .drv = GPIOMUX_DRV_6MA,
592 .pull = GPIOMUX_PULL_DOWN,
593};
594
595static struct gpiomux_setting cyts_sleep_act_cfg = {
596 .func = GPIOMUX_FUNC_GPIO,
597 .drv = GPIOMUX_DRV_6MA,
598 .pull = GPIOMUX_PULL_DOWN,
599};
600
601static struct gpiomux_setting cyts_int_act_cfg = {
602 .func = GPIOMUX_FUNC_GPIO,
603 .drv = GPIOMUX_DRV_8MA,
604 .pull = GPIOMUX_PULL_UP,
605};
606
607static struct gpiomux_setting cyts_int_sus_cfg = {
608 .func = GPIOMUX_FUNC_GPIO,
609 .drv = GPIOMUX_DRV_2MA,
610 .pull = GPIOMUX_PULL_UP,
611};
612
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700613static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
614 { /* TS INTERRUPT */
615 .gpio = 11,
616 .settings = {
617 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
618 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
619 },
620 },
621 { /* TS SLEEP */
622 .gpio = 50,
623 .settings = {
624 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
625 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
626 },
627 },
628 { /* TS RESOUT */
629 .gpio = 52,
630 .settings = {
631 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
632 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
633 },
634 },
635};
636
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700637#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
638enum {
639 SX150X_CAM,
640};
641
Nishant Pandit474f2252011-07-23 23:17:56 +0530642static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700643 [SX150X_CAM] = {
644 .gpio_base = GPIO_CAM_EXPANDER_BASE,
645 .oscio_is_gpo = false,
646 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530647 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700648 .io_open_drain_ena = 0x0,
649 .irq_summary = -1,
650 },
651};
Nishant Pandit474f2252011-07-23 23:17:56 +0530652
653#endif
654
655#ifdef CONFIG_I2C
656
657#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
658#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
659
660#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
661
662static struct i2c_board_info cam_expander_i2c_info[] = {
663 {
664 I2C_BOARD_INFO("sx1508q", 0x22),
665 .platform_data = &sx150x_data[SX150X_CAM]
666 },
667};
668
669static struct msm_cam_expander_info cam_expander_info[] = {
670 {
671 cam_expander_i2c_info,
672 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
673 },
674};
675#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700676#endif
677
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700678#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
679#define MSM_PMEM_ADSP_SIZE 0x3800000
680#define MSM_PMEM_AUDIO_SIZE 0x279000
681#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
682
683#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
684static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
685static int __init pmem_kernel_ebi1_size_setup(char *p)
686{
687 pmem_kernel_ebi1_size = memparse(p, NULL);
688 return 0;
689}
690early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
691#endif
692
693#ifdef CONFIG_ANDROID_PMEM
694static unsigned pmem_size = MSM_PMEM_SIZE;
695static int __init pmem_size_setup(char *p)
696{
697 pmem_size = memparse(p, NULL);
698 return 0;
699}
700early_param("pmem_size", pmem_size_setup);
701
702static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
703
704static int __init pmem_adsp_size_setup(char *p)
705{
706 pmem_adsp_size = memparse(p, NULL);
707 return 0;
708}
709early_param("pmem_adsp_size", pmem_adsp_size_setup);
710
711static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
712
713static int __init pmem_audio_size_setup(char *p)
714{
715 pmem_audio_size = memparse(p, NULL);
716 return 0;
717}
718early_param("pmem_audio_size", pmem_audio_size_setup);
719#endif
720
721#ifdef CONFIG_ANDROID_PMEM
722static struct android_pmem_platform_data android_pmem_pdata = {
723 .name = "pmem",
724 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
725 .cached = 1,
726 .memory_type = MEMTYPE_EBI1,
727};
728
729static struct platform_device android_pmem_device = {
730 .name = "android_pmem",
731 .id = 0,
732 .dev = {.platform_data = &android_pmem_pdata},
733};
734
735static struct android_pmem_platform_data android_pmem_adsp_pdata = {
736 .name = "pmem_adsp",
737 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
738 .cached = 0,
739 .memory_type = MEMTYPE_EBI1,
740};
741static struct platform_device android_pmem_adsp_device = {
742 .name = "android_pmem",
743 .id = 2,
744 .dev = { .platform_data = &android_pmem_adsp_pdata },
745};
746
747static struct android_pmem_platform_data android_pmem_audio_pdata = {
748 .name = "pmem_audio",
749 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
750 .cached = 0,
751 .memory_type = MEMTYPE_EBI1,
752};
753
754static struct platform_device android_pmem_audio_device = {
755 .name = "android_pmem",
756 .id = 4,
757 .dev = { .platform_data = &android_pmem_audio_pdata },
758};
759#endif
760
761static struct memtype_reserve msm8960_reserve_table[] __initdata = {
762 [MEMTYPE_SMI] = {
763 },
764 [MEMTYPE_EBI0] = {
765 .flags = MEMTYPE_FLAGS_1M_ALIGN,
766 },
767 [MEMTYPE_EBI1] = {
768 .flags = MEMTYPE_FLAGS_1M_ALIGN,
769 },
770};
771
772static void __init size_pmem_devices(void)
773{
774#ifdef CONFIG_ANDROID_PMEM
775 android_pmem_adsp_pdata.size = pmem_adsp_size;
776 android_pmem_pdata.size = pmem_size;
777 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
778#endif
779}
780
781static void __init reserve_memory_for(struct android_pmem_platform_data *p)
782{
783 msm8960_reserve_table[p->memory_type].size += p->size;
784}
785
786static void __init reserve_pmem_memory(void)
787{
788#ifdef CONFIG_ANDROID_PMEM
789 reserve_memory_for(&android_pmem_adsp_pdata);
790 reserve_memory_for(&android_pmem_pdata);
791 reserve_memory_for(&android_pmem_audio_pdata);
792 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
793#endif
794}
795
Larry Basselb4126da2011-07-18 14:31:33 -0700796static int msm8960_paddr_to_memtype(unsigned int paddr)
797{
798 return MEMTYPE_EBI1;
799}
800
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700801static void __init msm8960_calculate_reserve_sizes(void)
802{
803 size_pmem_devices();
804 reserve_pmem_memory();
805}
806
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700807static struct reserve_info msm8960_reserve_info __initdata = {
808 .memtype_reserve_table = msm8960_reserve_table,
809 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
810 .paddr_to_memtype = msm8960_paddr_to_memtype,
811};
812
Larry Basselb4126da2011-07-18 14:31:33 -0700813static int msm8960_memory_bank_size(void)
814{
815 return 1<<29;
816}
817
818static void __init locate_unstable_memory(void)
819{
820 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
821 unsigned long bank_size;
822 unsigned long low, high;
823
824 bank_size = msm8960_memory_bank_size();
825 low = meminfo.bank[0].start;
826 high = mb->start + mb->size;
827 low &= ~(bank_size - 1);
828
829 if (high - low <= bank_size)
830 return;
831 msm8960_reserve_info.low_unstable_address = low + bank_size;
832 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
833 msm8960_reserve_info.bank_size = bank_size;
834 pr_info("low unstable address %lx max size %lx bank size %lx\n",
835 msm8960_reserve_info.low_unstable_address,
836 msm8960_reserve_info.max_unstable_size,
837 msm8960_reserve_info.bank_size);
838}
839
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700840static void __init msm8960_reserve(void)
841{
842 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700843 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700844 msm_reserve();
845}
846
Larry Bassela7eadea2011-07-14 10:46:00 -0700847static int msm8960_change_memory_power(unsigned long start_pfn,
848 unsigned long nr_pages, int change_type)
849{
850 return 1;
851}
852
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700853#ifdef CONFIG_MSM_CAMERA
854
Kevin Chan28446522011-07-26 16:39:53 -0700855static uint16_t msm_cam_gpio_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700856 5, /*CAMIF_MCLK*/
857 20, /*CAMIF_I2C_DATA*/
858 21, /*CAMIF_I2C_CLK*/
859};
860
861#define VFE_CAMIF_TIMER1_GPIO 2
862#define VFE_CAMIF_TIMER2_GPIO 3
863#define VFE_CAMIF_TIMER3_GPIO_INT 4
864struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
865 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
866 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
867 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
868 .flash_recharge_duration = 50000,
869 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
870};
871
Nishant Pandit474f2252011-07-23 23:17:56 +0530872#ifdef CONFIG_MSM_CAMERA_FLASH
873static struct msm_camera_sensor_flash_src msm_flash_src = {
874 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
875 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
876 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
877#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
878 defined(CONFIG_GPIO_SX150X_MODULE))
879 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
880#endif
881};
882#endif
883
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700884#ifdef CONFIG_IMX074
885static struct msm_camera_sensor_platform_info sensor_board_info = {
Mansoor Aftab6d6ff5e2011-07-20 17:25:36 -0700886 .mount_angle = 90
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700887};
888#endif
889
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700890struct msm_camera_device_platform_data msm_camera_csi0_device_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700891 .ioclk.mclk_clk_rate = 24000000,
892 .ioclk.vfe_clk_rate = 228570000,
893 .csid_core = 0,
Kevin Chan28446522011-07-26 16:39:53 -0700894 .cam_gpio_tbl = msm_cam_gpio_tbl,
895 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700896};
897
898struct msm_camera_device_platform_data msm_camera_csi1_device_data = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700899 .ioclk.mclk_clk_rate = 24000000,
900 .ioclk.vfe_clk_rate = 228570000,
901 .csid_core = 1,
Kevin Chan28446522011-07-26 16:39:53 -0700902 .cam_gpio_tbl = msm_cam_gpio_tbl,
903 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700904};
905
906#ifdef CONFIG_IMX074
907static struct msm_camera_sensor_flash_data flash_imx074 = {
908 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530909#ifdef CONFIG_MSM_CAMERA_FLASH
910 .flash_src = &msm_flash_src
911#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700912};
913
914static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
915 .sensor_name = "imx074",
916 .sensor_reset = 107,
917 .sensor_pwd = 85,
918 .vcm_pwd = 0,
919 .vcm_enable = 1,
920 .pdata = &msm_camera_csi0_device_data,
921 .flash_data = &flash_imx074,
922 .strobe_flash_data = &strobe_flash_xenon,
923 .sensor_platform_info = &sensor_board_info,
924 .csi_if = 1
925};
926
927struct platform_device msm8960_camera_sensor_imx074 = {
928 .name = "msm_camera_imx074",
929 .dev = {
930 .platform_data = &msm_camera_sensor_imx074_data,
931 },
932};
933#endif
934#ifdef CONFIG_OV2720
935static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -0700936 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700937};
938
939static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
940 .sensor_name = "ov2720",
941 .sensor_reset = 76,
942 .sensor_pwd = 85,
943 .vcm_pwd = 0,
944 .vcm_enable = 1,
945 .pdata = &msm_camera_csi1_device_data,
946 .flash_data = &flash_ov2720,
947 .csi_if = 1
948};
949
950struct platform_device msm8960_camera_sensor_ov2720 = {
951 .name = "msm_camera_ov2720",
952 .dev = {
953 .platform_data = &msm_camera_sensor_ov2720_data,
954 },
955};
956#endif
Kevin Chandfecce22011-07-13 10:52:41 -0700957
958static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
959 .flash_type = MSM_CAMERA_FLASH_LED,
960};
961
962static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
963 .sensor_name = "qs_mt9p017",
964 .sensor_reset = 107,
965 .sensor_pwd = 85,
966 .vcm_pwd = 0,
967 .vcm_enable = 1,
968 .pdata = &msm_camera_csi0_device_data,
969 .flash_data = &flash_qs_mt9p017,
970 .sensor_platform_info = &sensor_board_info,
971 .csi_if = 1
972};
973
974struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
975 .name = "msm_camera_qs_mt9p017",
976 .dev = {
977 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
978 },
979};
980
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700981static void __init msm8960_init_cam(void)
982{
983 int i;
984 struct platform_device *cam_dev[] = {
985 &msm8960_camera_sensor_imx074,
986 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -0700987 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700988 };
989
990 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
991 struct msm_camera_sensor_info *s_info;
992 s_info = cam_dev[i]->dev.platform_data;
993 msm_get_cam_resources(s_info);
994 platform_device_register(cam_dev[i]);
995 }
996}
997#endif
998
999#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
1000/* prim = 608 x 1024 x 4(bpp) x 3(pages) */
1001#define MSM_FB_PRIM_BUF_SIZE 0x720000
1002#else
1003/* prim = 608 x 1024 x 4(bpp) x 2(pages) */
1004#define MSM_FB_PRIM_BUF_SIZE 0x4C0000
1005#endif
1006
1007#ifdef CONFIG_FB_MSM_MIPI_DSI
1008/* 960 x 540 x 3 x 2 */
1009#define MIPI_DSI_WRITEBACK_SIZE 0x300000
1010#else
1011#define MIPI_DSI_WRITEBACK_SIZE 0
1012#endif
1013
1014#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1015/* hdmi = 1920 x 1088 x 2(bpp) x 1(page) */
1016#define MSM_FB_EXT_BUF_SIZE 0x3FC000
1017#elif defined(CONFIG_FB_MSM_TVOUT)
1018/* tvout = 720 x 576 x 2(bpp) x 2(pages) */
1019#define MSM_FB_EXT_BUF_SIZE 0x195000
1020#else /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1021#define MSM_FB_EXT_BUF_SIZE 0
1022#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1023
1024#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE +\
1025 MIPI_DSI_WRITEBACK_SIZE, 4096)
1026
1027#define MDP_VSYNC_GPIO 0
1028
1029static struct resource msm_fb_resources[] = {
1030 {
1031 .flags = IORESOURCE_DMA,
1032 }
1033};
1034
1035static struct platform_device msm_fb_device = {
1036 .name = "msm_fb",
1037 .id = 0,
1038 .num_resources = ARRAY_SIZE(msm_fb_resources),
1039 .resource = msm_fb_resources,
1040};
1041
1042static bool dsi_power_on;
1043
1044static int mipi_dsi_panel_power(int on)
1045{
1046 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001047 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001048 int rc;
1049
1050 struct pm_gpio gpio43_param = {
1051 .direction = PM_GPIO_DIR_OUT,
1052 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1053 .output_value = 0,
1054 .pull = PM_GPIO_PULL_NO,
1055 .vin_sel = 2,
1056 .out_strength = PM_GPIO_STRENGTH_HIGH,
1057 .function = PM_GPIO_FUNC_PAIRED,
1058 .inv_int_pol = 0,
1059 .disable_pin = 0,
1060 };
1061
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001062 pr_info("%s: state : %d\n", __func__, on);
1063
1064 if (!dsi_power_on) {
1065
1066 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1067 "dsi_vdc");
1068 if (IS_ERR(reg_l8)) {
1069 pr_err("could not get 8921_l8, rc = %ld\n",
1070 PTR_ERR(reg_l8));
1071 return -ENODEV;
1072 }
1073
1074 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1075 "dsi_vddio");
1076 if (IS_ERR(reg_l23)) {
1077 pr_err("could not get 8921_l23, rc = %ld\n",
1078 PTR_ERR(reg_l23));
1079 return -ENODEV;
1080 }
1081
1082 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1083 "dsi_vdda");
1084 if (IS_ERR(reg_l2)) {
1085 pr_err("could not get 8921_l2, rc = %ld\n",
1086 PTR_ERR(reg_l2));
1087 return -ENODEV;
1088 }
1089
1090 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1091 if (rc) {
1092 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1093 return -EINVAL;
1094 }
1095 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1096 if (rc) {
1097 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1098 return -EINVAL;
1099 }
1100 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1101 if (rc) {
1102 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1103 return -EINVAL;
1104 }
1105
1106 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1107 rc = gpio_request(gpio43, "disp_rst_n");
1108 if (rc) {
1109 pr_err("request gpio 43 failed, rc=%d\n", rc);
1110 return -ENODEV;
1111 }
1112
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001113 dsi_power_on = true;
1114 }
1115
1116 if (on) {
1117 rc = regulator_set_optimum_mode(reg_l8, 100000);
1118 if (rc < 0) {
1119 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1120 return -EINVAL;
1121 }
1122 rc = regulator_set_optimum_mode(reg_l23, 100000);
1123 if (rc < 0) {
1124 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1125 return -EINVAL;
1126 }
1127 rc = regulator_set_optimum_mode(reg_l2, 100000);
1128 if (rc < 0) {
1129 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1130 return -EINVAL;
1131 }
1132 rc = regulator_enable(reg_l8);
1133 if (rc) {
1134 pr_err("enable l8 failed, rc=%d\n", rc);
1135 return -ENODEV;
1136 }
1137 rc = regulator_enable(reg_l23);
1138 if (rc) {
1139 pr_err("enable l8 failed, rc=%d\n", rc);
1140 return -ENODEV;
1141 }
1142 rc = regulator_enable(reg_l2);
1143 if (rc) {
1144 pr_err("enable l2 failed, rc=%d\n", rc);
1145 return -ENODEV;
1146 }
1147
1148 gpio43_param.pull = PM_GPIO_PULL_NO;
1149 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1150 if (rc) {
1151 pr_err("gpio_config 43 failed (1), rc=%d\n", rc);
1152 return -EINVAL;
1153 }
1154 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1155 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1156 if (rc) {
1157 pr_err("gpio_config 43 failed (2), rc=%d\n", rc);
1158 return -EINVAL;
1159 }
1160 gpio43_param.pull = PM_GPIO_PULL_NO;
1161 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1162 if (rc) {
1163 pr_err("gpio_config 43 failed (3), rc=%d\n", rc);
1164 return -EINVAL;
1165 }
1166 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1167 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1168 if (rc) {
1169 pr_err("gpio_config 43 failed (4), rc=%d\n", rc);
1170 return -EINVAL;
1171 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001172 gpio_set_value_cansleep(gpio43, 1);
1173 } else {
1174 rc = regulator_set_optimum_mode(reg_l8, 100);
1175 if (rc < 0) {
1176 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1177 return -EINVAL;
1178 }
1179 rc = regulator_set_optimum_mode(reg_l23, 100);
1180 if (rc < 0) {
1181 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1182 return -EINVAL;
1183 }
1184 rc = regulator_set_optimum_mode(reg_l2, 100);
1185 if (rc < 0) {
1186 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1187 return -EINVAL;
1188 }
1189 gpio_set_value_cansleep(gpio43, 0);
1190 }
1191 return 0;
1192}
1193
1194static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1195 .vsync_gpio = MDP_VSYNC_GPIO,
1196 .dsi_power_save = mipi_dsi_panel_power,
1197};
1198
1199#ifdef CONFIG_MSM_BUS_SCALING
1200
1201static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001202 {
1203 .src = MSM_BUS_MASTER_MDP_PORT0,
1204 .dst = MSM_BUS_SLAVE_EBI_CH0,
1205 .ab = 0,
1206 .ib = 0,
1207 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001208};
1209
1210static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001211 {
1212 .src = MSM_BUS_MASTER_MDP_PORT0,
1213 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001214 .ab = 216000000 * 2,
1215 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001216 },
1217};
1218
1219static struct msm_bus_vectors mdp_vga_vectors[] = {
1220 /* VGA and less video */
1221 {
1222 .src = MSM_BUS_MASTER_MDP_PORT0,
1223 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001224 .ab = 216000000 * 2,
1225 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001226 },
1227};
1228
1229static struct msm_bus_vectors mdp_720p_vectors[] = {
1230 /* 720p and less video */
1231 {
1232 .src = MSM_BUS_MASTER_MDP_PORT0,
1233 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001234 .ab = 230400000 * 2,
1235 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001236 },
1237};
1238
1239static struct msm_bus_vectors mdp_1080p_vectors[] = {
1240 /* 1080p and less video */
1241 {
1242 .src = MSM_BUS_MASTER_MDP_PORT0,
1243 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001244 .ab = 334080000 * 2,
1245 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001246 },
1247};
1248
1249static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1250 {
1251 ARRAY_SIZE(mdp_init_vectors),
1252 mdp_init_vectors,
1253 },
1254 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001255 ARRAY_SIZE(mdp_ui_vectors),
1256 mdp_ui_vectors,
1257 },
1258 {
1259 ARRAY_SIZE(mdp_ui_vectors),
1260 mdp_ui_vectors,
1261 },
1262 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001263 ARRAY_SIZE(mdp_vga_vectors),
1264 mdp_vga_vectors,
1265 },
1266 {
1267 ARRAY_SIZE(mdp_720p_vectors),
1268 mdp_720p_vectors,
1269 },
1270 {
1271 ARRAY_SIZE(mdp_1080p_vectors),
1272 mdp_1080p_vectors,
1273 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001274};
1275
1276static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1277 mdp_bus_scale_usecases,
1278 ARRAY_SIZE(mdp_bus_scale_usecases),
1279 .name = "mdp",
1280};
1281
1282#endif
1283
1284int mdp_core_clk_rate_table[] = {
1285 85330000,
1286 85330000,
1287 128000000,
1288 200000000,
1289 200000000,
1290};
1291
1292static struct msm_panel_common_pdata mdp_pdata = {
1293 .gpio = MDP_VSYNC_GPIO,
1294 .mdp_core_clk_rate = 85330000,
1295 .mdp_core_clk_table = mdp_core_clk_rate_table,
1296 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1297#ifdef CONFIG_MSM_BUS_SCALING
1298 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1299#endif
1300 .mdp_rev = MDP_REV_42,
1301};
1302
1303static struct platform_device mipi_dsi_renesas_panel_device = {
1304 .name = "mipi_renesas",
1305 .id = 0,
1306};
1307
1308static struct platform_device mipi_dsi_simulator_panel_device = {
1309 .name = "mipi_simulator",
1310 .id = 0,
1311};
1312
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001313#define LPM_CHANNEL0 0
1314static int toshiba_gpio[] = {LPM_CHANNEL0};
1315
1316static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1317 .gpio = toshiba_gpio,
1318};
1319
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001320static struct platform_device mipi_dsi_toshiba_panel_device = {
1321 .name = "mipi_toshiba",
1322 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001323 .dev = {
1324 .platform_data = &toshiba_pdata,
1325 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326};
1327
1328#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1329static struct resource hdmi_msm_resources[] = {
1330 {
1331 .name = "hdmi_msm_qfprom_addr",
1332 .start = 0x00700000,
1333 .end = 0x007060FF,
1334 .flags = IORESOURCE_MEM,
1335 },
1336 {
1337 .name = "hdmi_msm_hdmi_addr",
1338 .start = 0x04A00000,
1339 .end = 0x04A00FFF,
1340 .flags = IORESOURCE_MEM,
1341 },
1342 {
1343 .name = "hdmi_msm_irq",
1344 .start = HDMI_IRQ,
1345 .end = HDMI_IRQ,
1346 .flags = IORESOURCE_IRQ,
1347 },
1348};
1349
1350static int hdmi_enable_5v(int on);
1351static int hdmi_core_power(int on, int show);
1352static int hdmi_cec_power(int on);
1353
1354static struct msm_hdmi_platform_data hdmi_msm_data = {
1355 .irq = HDMI_IRQ,
1356 .enable_5v = hdmi_enable_5v,
1357 .core_power = hdmi_core_power,
1358 .cec_power = hdmi_cec_power,
1359};
1360
1361static struct platform_device hdmi_msm_device = {
1362 .name = "hdmi_msm",
1363 .id = 0,
1364 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1365 .resource = hdmi_msm_resources,
1366 .dev.platform_data = &hdmi_msm_data,
1367};
1368#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1369
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001370#ifdef CONFIG_MSM_BUS_SCALING
1371static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1372 {
1373 .src = MSM_BUS_MASTER_MDP_PORT0,
1374 .dst = MSM_BUS_SLAVE_EBI_CH0,
1375 .ab = 0,
1376 .ib = 0,
1377 },
1378};
1379static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1380 {
1381 .src = MSM_BUS_MASTER_MDP_PORT0,
1382 .dst = MSM_BUS_SLAVE_EBI_CH0,
1383 .ab = 566092800 * 2,
1384 .ib = 707616000 * 2,
1385 },
1386};
1387static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1388 {
1389 ARRAY_SIZE(dtv_bus_init_vectors),
1390 dtv_bus_init_vectors,
1391 },
1392 {
1393 ARRAY_SIZE(dtv_bus_def_vectors),
1394 dtv_bus_def_vectors,
1395 },
1396};
1397static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1398 dtv_bus_scale_usecases,
1399 ARRAY_SIZE(dtv_bus_scale_usecases),
1400 .name = "dtv",
1401};
1402
1403static struct lcdc_platform_data dtv_pdata = {
1404 .bus_scale_table = &dtv_bus_scale_pdata,
1405};
1406#endif
1407
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001408static void __init msm_fb_add_devices(void)
1409{
1410 if (machine_is_msm8x60_rumi3()) {
1411 msm_fb_register_device("mdp", NULL);
1412 mipi_dsi_pdata.target_type = 1;
1413 } else
1414 msm_fb_register_device("mdp", &mdp_pdata);
1415 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001416#ifdef CONFIG_MSM_BUS_SCALING
1417 msm_fb_register_device("dtv", &dtv_pdata);
1418#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001419}
1420
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001421static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1422 .func = GPIOMUX_FUNC_GPIO,
1423 .drv = GPIOMUX_DRV_2MA,
1424 .pull = GPIOMUX_PULL_DOWN,
1425};
1426
1427static struct gpiomux_setting mdp_vsync_active_cfg = {
1428 .func = GPIOMUX_FUNC_1,
1429 .drv = GPIOMUX_DRV_2MA,
1430 .pull = GPIOMUX_PULL_DOWN,
1431};
1432
1433static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1434 {
1435 .gpio = MDP_VSYNC_GPIO,
1436 .settings = {
1437 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1438 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1439 },
1440 }
1441};
1442
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001443#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1444static struct gpiomux_setting hdmi_suspend_cfg = {
1445 .func = GPIOMUX_FUNC_GPIO,
1446 .drv = GPIOMUX_DRV_2MA,
1447 .pull = GPIOMUX_PULL_DOWN,
1448};
1449
1450static struct gpiomux_setting hdmi_active_1_cfg = {
1451 .func = GPIOMUX_FUNC_1,
1452 .drv = GPIOMUX_DRV_2MA,
1453 .pull = GPIOMUX_PULL_UP,
1454};
1455
1456static struct gpiomux_setting hdmi_active_2_cfg = {
1457 .func = GPIOMUX_FUNC_1,
1458 .drv = GPIOMUX_DRV_2MA,
1459 .pull = GPIOMUX_PULL_DOWN,
1460};
1461
1462static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1463 {
1464 .gpio = 99,
1465 .settings = {
1466 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1467 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1468 },
1469 },
1470 {
1471 .gpio = 100,
1472 .settings = {
1473 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1474 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1475 },
1476 },
1477 {
1478 .gpio = 101,
1479 .settings = {
1480 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1481 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1482 },
1483 },
1484 {
1485 .gpio = 102,
1486 .settings = {
1487 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1488 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1489 },
1490 },
1491};
1492
1493static int hdmi_enable_5v(int on)
1494{
1495 /* TBD: PM8921 regulator instead of 8901 */
1496 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1497 static int prev_on;
1498 int rc;
1499
1500 if (on == prev_on)
1501 return 0;
1502
1503 if (!reg_8921_hdmi_mvs)
1504 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1505 "hdmi_mvs");
1506
1507 if (on) {
1508 rc = regulator_enable(reg_8921_hdmi_mvs);
1509 if (rc) {
1510 pr_err("'%s' regulator enable failed, rc=%d\n",
1511 "8921_hdmi_mvs", rc);
1512 return rc;
1513 }
1514 pr_debug("%s(on): success\n", __func__);
1515 } else {
1516 rc = regulator_disable(reg_8921_hdmi_mvs);
1517 if (rc)
1518 pr_warning("'%s' regulator disable failed, rc=%d\n",
1519 "8921_hdmi_mvs", rc);
1520 pr_debug("%s(off): success\n", __func__);
1521 }
1522
1523 prev_on = on;
1524
1525 return 0;
1526}
1527
1528static int hdmi_core_power(int on, int show)
1529{
1530 static struct regulator *reg_8921_l23, *reg_8921_s4;
1531 static int prev_on;
1532 int rc;
1533
1534 if (on == prev_on)
1535 return 0;
1536
1537 /* TBD: PM8921 regulator instead of 8901 */
1538 if (!reg_8921_l23)
1539 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
1540
1541 if (!reg_8921_s4)
1542 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
1543
1544 if (on) {
1545 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1546 if (rc < 0) {
1547 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1548 return -EINVAL;
1549 }
1550
1551 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1552 if (!rc)
1553 rc = regulator_enable(reg_8921_l23);
1554 if (rc) {
1555 pr_err("'%s' regulator enable failed, rc=%d\n",
1556 "hdmi_avdd", rc);
1557 return rc;
1558 }
1559 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1560 if (!rc)
1561 rc = regulator_enable(reg_8921_s4);
1562 if (rc) {
1563 pr_err("'%s' regulator enable failed, rc=%d\n",
1564 "hdmi_vcc", rc);
1565 return rc;
1566 }
1567
1568 rc = gpio_request(100, "HDMI_DDC_CLK");
1569 if (rc) {
1570 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1571 "HDMI_DDC_CLK", 100, rc);
1572 goto error1;
1573 }
1574 rc = gpio_request(101, "HDMI_DDC_DATA");
1575 if (rc) {
1576 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1577 "HDMI_DDC_DATA", 101, rc);
1578 goto error2;
1579 }
1580 rc = gpio_request(102, "HDMI_HPD");
1581 if (rc) {
1582 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1583 "HDMI_HPD", 102, rc);
1584 goto error3;
1585 }
1586 pr_debug("%s(on): success\n", __func__);
1587 } else {
1588 gpio_free(100);
1589 gpio_free(101);
1590 gpio_free(102);
1591
1592 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1593 if (rc < 0) {
1594 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1595 return -EINVAL;
1596 }
1597
1598 pr_debug("%s(off): success\n", __func__);
1599 }
1600
1601 prev_on = on;
1602
1603 return 0;
1604
1605error3:
1606 gpio_free(101);
1607error2:
1608 gpio_free(100);
1609error1:
1610 regulator_disable(reg_8921_l23);
1611 return rc;
1612}
1613
1614static int hdmi_cec_power(int on)
1615{
1616 static int prev_on;
1617 int rc;
1618
1619 if (on == prev_on)
1620 return 0;
1621
1622 if (on) {
1623 rc = gpio_request(99, "HDMI_CEC_VAR");
1624 if (rc) {
1625 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1626 "HDMI_CEC_VAR", 99, rc);
1627 goto error;
1628 }
1629 pr_debug("%s(on): success\n", __func__);
1630 } else {
1631 gpio_free(99);
1632 pr_debug("%s(off): success\n", __func__);
1633 }
1634
1635 prev_on = on;
1636
1637 return 0;
1638error:
1639 return rc;
1640}
1641#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1642
1643static void __init msm8960_allocate_memory_regions(void)
1644{
1645 void *addr;
1646 unsigned long size;
1647
1648 size = MSM_FB_SIZE;
1649 addr = alloc_bootmem_align(size, 0x1000);
1650 msm_fb_resources[0].start = __pa(addr);
1651 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1652 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1653 size, addr, __pa(addr));
1654
1655}
1656#ifdef CONFIG_WCD9310_CODEC
1657
1658#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1659
1660static struct tabla_pdata tabla_platform_data = {
1661 .slimbus_slave_device = {
1662 .name = "tabla-slave",
1663 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1664 },
1665 .irq = MSM_GPIO_TO_INT(62),
1666 .irq_base = TABLA_INTERRUPT_BASE,
1667 .num_irqs = NR_TABLA_IRQS,
1668 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1669};
1670
1671static struct slim_device msm_slim_tabla = {
1672 .name = "tabla-slim",
1673 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1674 .dev = {
1675 .platform_data = &tabla_platform_data,
1676 },
1677};
1678#endif
1679
1680static struct slim_boardinfo msm_slim_devices[] = {
1681#ifdef CONFIG_WCD9310_CODEC
1682 {
1683 .bus_num = 1,
1684 .slim_slave = &msm_slim_tabla,
1685 },
1686#endif
1687 /* add more slimbus slaves as needed */
1688};
1689
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001690#define MSM_WCNSS_PHYS 0x03000000
1691#define MSM_WCNSS_SIZE 0x280000
1692
1693static struct resource resources_wcnss_wlan[] = {
1694 {
1695 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1696 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1697 .name = "wcnss_wlanrx_irq",
1698 .flags = IORESOURCE_IRQ,
1699 },
1700 {
1701 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1702 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1703 .name = "wcnss_wlantx_irq",
1704 .flags = IORESOURCE_IRQ,
1705 },
1706 {
1707 .start = MSM_WCNSS_PHYS,
1708 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1709 .name = "wcnss_mmio",
1710 .flags = IORESOURCE_MEM,
1711 },
1712};
1713
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001714static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1715 .has_48mhz_xo = 1,
1716};
1717
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001718static struct platform_device msm_device_wcnss_wlan = {
1719 .name = "wcnss_wlan",
1720 .id = 0,
1721 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1722 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001723 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001724};
1725
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001726#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1727 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1728 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1729 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1730
1731#define QCE_SIZE 0x10000
1732#define QCE_0_BASE 0x18500000
1733
1734#define QCE_HW_KEY_SUPPORT 0
1735#define QCE_SHA_HMAC_SUPPORT 1
1736#define QCE_SHARE_CE_RESOURCE 1
1737#define QCE_CE_SHARED 0
1738
1739static struct resource qcrypto_resources[] = {
1740 [0] = {
1741 .start = QCE_0_BASE,
1742 .end = QCE_0_BASE + QCE_SIZE - 1,
1743 .flags = IORESOURCE_MEM,
1744 },
1745 [1] = {
1746 .name = "crypto_channels",
1747 .start = DMOV_CE_IN_CHAN,
1748 .end = DMOV_CE_OUT_CHAN,
1749 .flags = IORESOURCE_DMA,
1750 },
1751 [2] = {
1752 .name = "crypto_crci_in",
1753 .start = DMOV_CE_IN_CRCI,
1754 .end = DMOV_CE_IN_CRCI,
1755 .flags = IORESOURCE_DMA,
1756 },
1757 [3] = {
1758 .name = "crypto_crci_out",
1759 .start = DMOV_CE_OUT_CRCI,
1760 .end = DMOV_CE_OUT_CRCI,
1761 .flags = IORESOURCE_DMA,
1762 },
1763};
1764
1765static struct resource qcedev_resources[] = {
1766 [0] = {
1767 .start = QCE_0_BASE,
1768 .end = QCE_0_BASE + QCE_SIZE - 1,
1769 .flags = IORESOURCE_MEM,
1770 },
1771 [1] = {
1772 .name = "crypto_channels",
1773 .start = DMOV_CE_IN_CHAN,
1774 .end = DMOV_CE_OUT_CHAN,
1775 .flags = IORESOURCE_DMA,
1776 },
1777 [2] = {
1778 .name = "crypto_crci_in",
1779 .start = DMOV_CE_IN_CRCI,
1780 .end = DMOV_CE_IN_CRCI,
1781 .flags = IORESOURCE_DMA,
1782 },
1783 [3] = {
1784 .name = "crypto_crci_out",
1785 .start = DMOV_CE_OUT_CRCI,
1786 .end = DMOV_CE_OUT_CRCI,
1787 .flags = IORESOURCE_DMA,
1788 },
1789};
1790
1791#endif
1792
1793#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1794 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1795
1796static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1797 .ce_shared = QCE_CE_SHARED,
1798 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1799 .hw_key_support = QCE_HW_KEY_SUPPORT,
1800 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1801};
1802
1803static struct platform_device qcrypto_device = {
1804 .name = "qcrypto",
1805 .id = 0,
1806 .num_resources = ARRAY_SIZE(qcrypto_resources),
1807 .resource = qcrypto_resources,
1808 .dev = {
1809 .coherent_dma_mask = DMA_BIT_MASK(32),
1810 .platform_data = &qcrypto_ce_hw_suppport,
1811 },
1812};
1813#endif
1814
1815#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1816 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1817
1818static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1819 .ce_shared = QCE_CE_SHARED,
1820 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1821 .hw_key_support = QCE_HW_KEY_SUPPORT,
1822 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1823};
1824
1825static struct platform_device qcedev_device = {
1826 .name = "qce",
1827 .id = 0,
1828 .num_resources = ARRAY_SIZE(qcedev_resources),
1829 .resource = qcedev_resources,
1830 .dev = {
1831 .coherent_dma_mask = DMA_BIT_MASK(32),
1832 .platform_data = &qcedev_ce_hw_suppport,
1833 },
1834};
1835#endif
1836
1837
1838static int __init gpiomux_init(void)
1839{
1840 int rc;
1841
1842 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1843 if (rc) {
1844 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1845 return rc;
1846 }
1847
1848 msm_gpiomux_install(msm8960_cam_configs,
1849 ARRAY_SIZE(msm8960_cam_configs));
1850
1851 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07001852 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001853
1854 msm_gpiomux_install(msm8960_gsbi_configs,
1855 ARRAY_SIZE(msm8960_gsbi_configs));
1856
1857 msm_gpiomux_install(msm8960_cyts_configs,
1858 ARRAY_SIZE(msm8960_cyts_configs));
1859
1860 msm_gpiomux_install(msm8960_slimbus_config,
1861 ARRAY_SIZE(msm8960_slimbus_config));
1862
1863 msm_gpiomux_install(msm8960_audio_codec_configs,
1864 ARRAY_SIZE(msm8960_audio_codec_configs));
1865
1866#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1867 msm_gpiomux_install(msm8960_hdmi_configs,
1868 ARRAY_SIZE(msm8960_hdmi_configs));
1869#endif
1870
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001871 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1872 ARRAY_SIZE(msm8960_mdp_vsync_configs));
1873
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001874 msm_gpiomux_install(wcnss_5wire_interface,
1875 ARRAY_SIZE(wcnss_5wire_interface));
1876
1877 return 0;
1878}
1879
1880static struct msm_acpu_clock_platform_data msm8960_acpu_clock_data = {
1881 .acpu_switch_time_us = 0,
1882 .vdd_switch_time_us = 0,
1883};
1884
1885#define MSM_SHARED_RAM_PHYS 0x80000000
1886
1887static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
1888 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
1889 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1890 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
1891 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1892 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
1893 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1894 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
1895 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1896 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
1897 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1898 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
1899 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1900 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
1901 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1902 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
1903 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1904 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
1905 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
1906 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
1907 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1908 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
1909 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1910 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1911 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
1912 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
1913 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1914 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
1915 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1916 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1917 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1918};
1919
1920static struct pm8921_adc_properties pm8921_adc_data = {
1921 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
1922 .bitresolution = 15,
1923 .bipolar = 0,
1924};
1925
1926static struct pm8921_adc_platform_data pm8921_adc_pdata = {
1927 .adc_channel = pm8921_adc_channels_data,
1928 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
1929 .adc_prop = &pm8921_adc_data,
1930};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001931
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001932static void __init msm8960_map_io(void)
1933{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001934 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001935 msm_map_msm8960_io();
1936}
1937
1938static void __init msm8960_init_irq(void)
1939{
1940 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001941
1942 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001943 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001944 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001945
1946 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001947 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001948
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001949 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
1950 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08001951
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001952 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
1953 * as they are configured as level, which does not play nice with
1954 * handle_percpu_irq.
1955 */
1956 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
1957 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01001958 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001959 }
1960}
1961
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001962/* MSM8960 have 5 SDCC controllers */
1963enum sdcc_controllers {
1964 SDCC1,
1965 SDCC2,
1966 SDCC3,
1967 SDCC4,
1968 SDCC5,
1969 MAX_SDCC_CONTROLLER
1970};
1971
1972/* All SDCC controllers requires VDD/VCC voltage */
1973static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
1974 /* SDCC1 : eMMC card connected */
1975 [SDCC1] = {
1976 .name = "sdc_vdd",
1977 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301978 .high_vol_level = 2950000,
1979 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001980 .hpm_uA = 200000, /* 200mA */
1981 },
1982 /* SDCC3 : External card slot connected */
1983 [SDCC3] = {
1984 .name = "sdc_vdd",
1985 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301986 .high_vol_level = 2950000,
1987 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001988 .hpm_uA = 600000, /* 600mA */
1989 }
1990};
1991
1992/* Only slots having eMMC card will require VCCQ voltage */
1993static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
1994 /* SDCC1 : eMMC card connected */
1995 [SDCC1] = {
1996 .name = "sdc_vccq",
1997 .set_voltage_sup = 1,
1998 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301999 .high_vol_level = 1800000,
2000 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002001 .hpm_uA = 200000, /* 200mA */
2002 }
2003};
2004
2005/* All SDCC controllers may require voting for VDD PAD voltage */
2006static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2007 /* SDCC3 : External card slot connected */
2008 [SDCC3] = {
2009 .name = "sdc_vddp",
2010 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302011 .high_vol_level = 2950000,
2012 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002013 .always_on = 1,
2014 .lpm_sup = 1,
2015 /* Max. Active current required is 16 mA */
2016 .hpm_uA = 16000,
2017 /*
2018 * Sleep current required is ~300 uA. But min. vote can be
2019 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2020 * during sleep.
2021 */
2022 .lpm_uA = 2000,
2023 }
2024};
2025
2026static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2027 /* SDCC1 : eMMC card connected */
2028 [SDCC1] = {
2029 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2030 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2031 },
2032 /* SDCC3 : External card slot connected */
2033 [SDCC3] = {
2034 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2035 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2036 }
2037};
2038
2039/* SDC1 pad data */
2040static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2041 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
2042 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2043 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
2044};
2045
2046static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2047 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2048 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2049 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2050};
2051
2052static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
2053 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2054 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2055};
2056
2057static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
2058 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2059 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2060};
2061
2062/* SDC3 pad data */
2063static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2064 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2065 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2066 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2067};
2068
2069static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2070 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2071 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2072 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2073};
2074
2075static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
2076 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2077 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2078};
2079
2080static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
2081 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2082 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2083};
2084
2085struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2086 [SDCC1] = {
2087 .on = sdc1_pad_pull_on_cfg,
2088 .off = sdc1_pad_pull_off_cfg,
2089 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2090 },
2091 [SDCC3] = {
2092 .on = sdc3_pad_pull_on_cfg,
2093 .off = sdc3_pad_pull_off_cfg,
2094 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2095 },
2096};
2097
2098struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2099 [SDCC1] = {
2100 .on = sdc1_pad_drv_on_cfg,
2101 .off = sdc1_pad_drv_off_cfg,
2102 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2103 },
2104 [SDCC3] = {
2105 .on = sdc3_pad_drv_on_cfg,
2106 .off = sdc3_pad_drv_off_cfg,
2107 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2108 },
2109};
2110
2111struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2112 [SDCC1] = {
2113 .pull = &mmc_pad_pull_data[SDCC1],
2114 .drv = &mmc_pad_drv_data[SDCC1]
2115 },
2116 [SDCC3] = {
2117 .pull = &mmc_pad_pull_data[SDCC3],
2118 .drv = &mmc_pad_drv_data[SDCC3]
2119 },
2120};
2121
2122struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2123 [SDCC1] = {
2124 .pad_data = &mmc_pad_data[SDCC1],
2125 },
2126 [SDCC3] = {
2127 .pad_data = &mmc_pad_data[SDCC3],
2128 },
2129};
2130
2131static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002132 400000, 24000000, 48000000, 96000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002133};
2134
2135static unsigned int sdc3_sup_clk_rates[] = {
2136 400000, 24000000, 48000000, 96000000
2137};
2138
2139#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2140static struct mmc_platform_data msm8960_sdc1_data = {
2141 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2142#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2143 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2144#else
2145 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2146#endif
2147 .sup_clk_table = sdc1_sup_clk_rates,
2148 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2149 .nonremovable = 1,
2150 .sdcc_v4_sup = true,
2151 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002152 .pin_data = &mmc_slot_pin_data[SDCC1],
2153 .uhs_caps = MMC_CAP_1_8V_DDR
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002154};
2155#endif
2156
2157#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2158static struct mmc_platform_data msm8960_sdc3_data = {
2159 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2160 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2161 .sup_clk_table = sdc3_sup_clk_rates,
2162 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
2163 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
2164 .sdcc_v4_sup = true,
2165 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2166 .pin_data = &mmc_slot_pin_data[SDCC3],
2167#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2168 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2169 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2170 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2171#endif
2172 .xpc_cap = 1,
2173 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2174 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002175 MMC_CAP_MAX_CURRENT_600 | MMC_CAP_1_8V_DDR)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002176};
2177#endif
2178
2179static void __init msm8960_init_mmc(void)
2180{
2181#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2182 /* SDC1 : eMMC card connected */
2183 msm_add_sdcc(1, &msm8960_sdc1_data);
2184#endif
2185#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2186 /* SDC3: External card slot */
2187 msm_add_sdcc(3, &msm8960_sdc3_data);
2188#endif
2189}
2190
2191static void __init msm8960_init_buses(void)
2192{
2193#ifdef CONFIG_MSM_BUS_SCALING
2194 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2195 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2196 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2197 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2198 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2199 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2200 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2201 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2202 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2203 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2204#endif
2205}
2206
2207static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2208 .max_clock_speed = 15060000,
2209};
2210
2211#ifdef CONFIG_USB_MSM_OTG_72K
2212static struct msm_otg_platform_data msm_otg_pdata;
2213#else
2214#define USB_5V_EN 42
2215static void msm_hsusb_vbus_power(bool on)
2216{
2217 int rc;
2218 static bool vbus_is_on;
2219 static struct regulator *mvs_otg_switch;
2220 struct pm_gpio param = {
2221 .direction = PM_GPIO_DIR_OUT,
2222 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2223 .output_value = 1,
2224 .pull = PM_GPIO_PULL_NO,
2225 .vin_sel = PM_GPIO_VIN_S4,
2226 .out_strength = PM_GPIO_STRENGTH_MED,
2227 .function = PM_GPIO_FUNC_NORMAL,
2228 };
2229
2230 if (vbus_is_on == on)
2231 return;
2232
2233 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002234 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2235 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002236 if (IS_ERR(mvs_otg_switch)) {
2237 pr_err("Unable to get mvs_otg_switch\n");
2238 return;
2239 }
2240
2241 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2242 "usb_5v_en");
2243 if (rc < 0) {
2244 pr_err("failed to request usb_5v_en gpio\n");
2245 goto put_mvs_otg;
2246 }
2247
2248 if (regulator_enable(mvs_otg_switch)) {
2249 pr_err("unable to enable mvs_otg_switch\n");
2250 goto free_usb_5v_en;
2251 }
2252
2253 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2254 &param);
2255 if (rc < 0) {
2256 pr_err("failed to configure usb_5v_en gpio\n");
2257 goto disable_mvs_otg;
2258 }
2259 vbus_is_on = true;
2260 return;
2261 }
2262disable_mvs_otg:
2263 regulator_disable(mvs_otg_switch);
2264free_usb_5v_en:
2265 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2266put_mvs_otg:
2267 regulator_put(mvs_otg_switch);
2268 vbus_is_on = false;
2269}
2270
2271static struct msm_otg_platform_data msm_otg_pdata = {
2272 .mode = USB_OTG,
2273 .otg_control = OTG_PMIC_CONTROL,
2274 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2275 .pclk_src_name = "dfab_usb_hs_clk",
2276 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2277 .vbus_power = msm_hsusb_vbus_power,
2278};
2279#endif
2280
2281#define PID_MAGIC_ID 0x71432909
2282#define SERIAL_NUM_MAGIC_ID 0x61945374
2283#define SERIAL_NUMBER_LENGTH 127
2284#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2285
2286struct magic_num_struct {
2287 uint32_t pid;
2288 uint32_t serial_num;
2289};
2290
2291struct dload_struct {
2292 uint32_t reserved1;
2293 uint32_t reserved2;
2294 uint32_t reserved3;
2295 uint16_t reserved4;
2296 uint16_t pid;
2297 char serial_number[SERIAL_NUMBER_LENGTH];
2298 uint16_t reserved5;
2299 struct magic_num_struct magic_struct;
2300};
2301
2302static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2303{
2304 struct dload_struct __iomem *dload = 0;
2305
2306 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2307 if (!dload) {
2308 pr_err("%s: cannot remap I/O memory region: %08x\n",
2309 __func__, DLOAD_USB_BASE_ADD);
2310 return -ENXIO;
2311 }
2312
2313 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2314 __func__, dload, pid, snum);
2315 /* update pid */
2316 dload->magic_struct.pid = PID_MAGIC_ID;
2317 dload->pid = pid;
2318
2319 /* update serial number */
2320 dload->magic_struct.serial_num = 0;
2321 if (!snum) {
2322 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2323 goto out;
2324 }
2325
2326 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2327 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2328 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2329out:
2330 iounmap(dload);
2331 return 0;
2332}
2333
2334static struct android_usb_platform_data android_usb_pdata = {
2335 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2336};
2337
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002338static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002339 .name = "android_usb",
2340 .id = -1,
2341 .dev = {
2342 .platform_data = &android_usb_pdata,
2343 },
2344};
2345
2346static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2347 0x03, 0x0f,
2348};
2349
2350static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2351 0x00, 0x24, 0x54, 0x10,
2352 0x09, 0x03, 0x01,
2353 0x10, 0x54, 0x30, 0x0C,
2354 0x24, 0x30, 0x0f,
2355};
2356
2357static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2358 0x00, 0x24, 0x54, 0x10,
2359 0x09, 0x07, 0x01, 0x0B,
2360 0x10, 0x54, 0x30, 0x0C,
2361 0x24, 0x30, 0x0f,
2362};
2363
2364static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2365 [0] = {
2366 .mode = MSM_SPM_MODE_CLOCK_GATING,
2367 .notify_rpm = false,
2368 .cmd = spm_wfi_cmd_sequence,
2369 },
2370 [1] = {
2371 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2372 .notify_rpm = false,
2373 .cmd = spm_power_collapse_without_rpm,
2374 },
2375 [2] = {
2376 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2377 .notify_rpm = true,
2378 .cmd = spm_power_collapse_with_rpm,
2379 },
2380};
2381
2382static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2383 [0] = {
2384 .reg_base_addr = MSM_SAW0_BASE,
2385 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2386 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2387 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2388#if defined(CONFIG_MSM_AVS_HW)
2389 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2390 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2391#endif
2392 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2393 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2394 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2395 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2396 .vctl_timeout_us = 50,
2397 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2398 .modes = msm_spm_seq_list,
2399 },
2400 [1] = {
2401 .reg_base_addr = MSM_SAW1_BASE,
2402 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2403 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2404 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2405#if defined(CONFIG_MSM_AVS_HW)
2406 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2407 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2408#endif
2409 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2410 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2411 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2412 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2413 .vctl_timeout_us = 50,
2414 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2415 .modes = msm_spm_seq_list,
2416 },
2417};
2418
2419static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2420 0x00, 0x20, 0x03, 0x20,
2421 0x00, 0x0f,
2422};
2423
2424static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2425 0x00, 0x20, 0x34, 0x64,
2426 0x48, 0x07, 0x48, 0x20,
2427 0x50, 0x64, 0x04, 0x34,
2428 0x50, 0x0f,
2429};
2430static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2431 0x00, 0x10, 0x34, 0x64,
2432 0x48, 0x07, 0x48, 0x10,
2433 0x50, 0x64, 0x04, 0x34,
2434 0x50, 0x0F,
2435};
2436
2437static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2438 [0] = {
2439 .mode = MSM_SPM_L2_MODE_RETENTION,
2440 .notify_rpm = false,
2441 .cmd = l2_spm_wfi_cmd_sequence,
2442 },
2443 [1] = {
2444 .mode = MSM_SPM_L2_MODE_GDHS,
2445 .notify_rpm = true,
2446 .cmd = l2_spm_gdhs_cmd_sequence,
2447 },
2448 [2] = {
2449 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2450 .notify_rpm = true,
2451 .cmd = l2_spm_power_off_cmd_sequence,
2452 },
2453};
2454
2455
2456static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2457 [0] = {
2458 .reg_base_addr = MSM_SAW_L2_BASE,
2459 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2460 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2461 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2462 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2463 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2464 .modes = msm_spm_l2_seq_list,
2465 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2466 },
2467};
2468
2469#define CYTTSP_TS_GPIO_IRQ 11
2470#define CYTTSP_TS_SLEEP_GPIO 50
2471#define CYTTSP_TS_RESOUT_N_GPIO 52
2472
2473/*virtual key support */
2474static ssize_t tma340_vkeys_show(struct kobject *kobj,
2475 struct kobj_attribute *attr, char *buf)
2476{
2477 return snprintf(buf, 200,
2478 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2479 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2480 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2481 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2482 "\n");
2483}
2484
2485static struct kobj_attribute tma340_vkeys_attr = {
2486 .attr = {
2487 .mode = S_IRUGO,
2488 },
2489 .show = &tma340_vkeys_show,
2490};
2491
2492static struct attribute *tma340_properties_attrs[] = {
2493 &tma340_vkeys_attr.attr,
2494 NULL
2495};
2496
2497static struct attribute_group tma340_properties_attr_group = {
2498 .attrs = tma340_properties_attrs,
2499};
2500
2501
2502static int cyttsp_platform_init(struct i2c_client *client)
2503{
2504 int rc = 0;
2505 static struct kobject *tma340_properties_kobj;
2506
2507 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2508 tma340_properties_kobj = kobject_create_and_add("board_properties",
2509 NULL);
2510 if (tma340_properties_kobj)
2511 rc = sysfs_create_group(tma340_properties_kobj,
2512 &tma340_properties_attr_group);
2513 if (!tma340_properties_kobj || rc)
2514 pr_err("%s: failed to create board_properties\n",
2515 __func__);
2516
2517 return 0;
2518}
2519
2520static struct cyttsp_regulator regulator_data[] = {
2521 {
2522 .name = "vdd",
2523 .min_uV = CY_TMA300_VTG_MIN_UV,
2524 .max_uV = CY_TMA300_VTG_MAX_UV,
2525 .load_uA = CY_TMA300_CURR_24HZ_UA,
2526 },
2527 /* TODO: Remove after runtime PM is enabled in I2C driver */
2528 {
2529 .name = "vcc_i2c",
2530 .min_uV = CY_I2C_VTG_MIN_UV,
2531 .max_uV = CY_I2C_VTG_MAX_UV,
2532 .load_uA = CY_I2C_CURR_UA,
2533 },
2534};
2535
2536static struct cyttsp_platform_data cyttsp_pdata = {
2537 .panel_maxx = 634,
2538 .panel_maxy = 1166,
2539 .disp_maxx = 616,
2540 .disp_maxy = 1023,
2541 .disp_minx = 0,
2542 .disp_miny = 16,
2543 .flags = 0x01,
2544 .gen = CY_GEN3, /* or */
2545 .use_st = CY_USE_ST,
2546 .use_mt = CY_USE_MT,
2547 .use_hndshk = CY_SEND_HNDSHK,
2548 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayal15187772011-06-22 17:39:41 +05302549 .use_sleep = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002550 .use_gestures = CY_USE_GESTURES,
2551 .fw_fname = "cyttsp_8960_cdp.hex",
2552 /* activate up to 4 groups
2553 * and set active distance
2554 */
2555 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2556 CY_GEST_GRP3 | CY_GEST_GRP4 |
2557 CY_ACT_DIST,
2558 /* change act_intrvl to customize the Active power state
2559 * scanning/processing refresh interval for Operating mode
2560 */
2561 .act_intrvl = CY_ACT_INTRVL_DFLT,
2562 /* change tch_tmout to customize the touch timeout for the
2563 * Active power state for Operating mode
2564 */
2565 .tch_tmout = CY_TCH_TMOUT_DFLT,
2566 /* change lp_intrvl to customize the Low Power power state
2567 * scanning/processing refresh interval for Operating mode
2568 */
2569 .lp_intrvl = CY_LP_INTRVL_DFLT,
2570 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2571 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2572 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2573 .regulator_info = regulator_data,
2574 .num_regulators = ARRAY_SIZE(regulator_data),
2575 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302576 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002577};
2578
2579static struct i2c_board_info cyttsp_info[] __initdata = {
2580 {
2581 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2582 .platform_data = &cyttsp_pdata,
2583#ifndef CY_USE_TIMER
2584 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2585#endif /* CY_USE_TIMER */
2586 },
2587};
2588
2589static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
2590{
2591}
2592
2593static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2594 .clk_freq = 100000,
2595 .src_clk_rate = 24000000,
2596 .clk = "gsbi_qup_clk",
2597 .pclk = "gsbi_pclk",
2598 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2599};
2600
2601static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2602 .clk_freq = 100000,
2603 .src_clk_rate = 24000000,
2604 .clk = "gsbi_qup_clk",
2605 .pclk = "gsbi_pclk",
2606 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2607};
2608
2609static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2610 .clk_freq = 100000,
2611 .src_clk_rate = 24000000,
2612 .clk = "gsbi_qup_clk",
2613 .pclk = "gsbi_pclk",
2614 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2615};
2616
2617static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2618 .clk_freq = 100000,
2619 .src_clk_rate = 24000000,
2620 .clk = "gsbi_qup_clk",
2621 .pclk = "gsbi_pclk",
2622 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2623};
2624
2625static struct msm_rpm_platform_data msm_rpm_data = {
2626 .reg_base_addrs = {
2627 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
2628 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
2629 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
2630 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
2631 },
2632
2633 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
2634 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
2635 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
2636 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
2637 .msm_apps_ipc_rpm_val = 4,
2638};
2639
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002640static struct platform_device msm_rpm_device = {
2641 .name = "msm_rpm",
2642 .id = -1,
2643};
2644
2645
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002646static struct spi_board_info spi_board_info[] __initdata = {
2647 {
2648 .modalias = "ks8851",
2649 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2650 .max_speed_hz = 19200000,
2651 .bus_num = 0,
2652 .chip_select = 0,
2653 .mode = SPI_MODE_0,
2654 },
2655};
2656
2657static struct platform_device msm_device_saw_core0 = {
2658 .name = "saw-regulator",
2659 .id = 0,
2660 .dev = {
2661 .platform_data = &msm_saw_regulator_pdata_s5,
2662 },
2663};
2664
2665static struct platform_device msm_device_saw_core1 = {
2666 .name = "saw-regulator",
2667 .id = 1,
2668 .dev = {
2669 .platform_data = &msm_saw_regulator_pdata_s6,
2670 },
2671};
2672
2673#ifdef CONFIG_MSM_FAKE_BATTERY
2674static struct platform_device fish_battery_device = {
2675 .name = "fish_battery",
2676};
2677#endif
2678
2679struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
2680 .name = GPIO_REGULATOR_DEV_NAME,
2681 .id = PM8921_MPP_PM_TO_SYS(7),
2682 .dev = {
2683 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2684 },
2685};
2686
2687struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
2688 .name = GPIO_REGULATOR_DEV_NAME,
2689 .id = 91,
2690 .dev = {
2691 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2692 },
2693};
2694
2695static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002696 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002697 &msm_device_smd,
2698 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302699 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002700 &msm_device_saw_core0,
2701 &msm_device_saw_core1,
2702 &msm8960_device_ext_5v_vreg,
2703 &msm8960_device_ext_l2_vreg,
2704 &msm8960_device_ssbi_pm8921,
2705 &msm8960_device_qup_spi_gsbi1,
2706 &msm8960_device_qup_i2c_gsbi3,
2707 &msm8960_device_qup_i2c_gsbi4,
2708 &msm8960_device_qup_i2c_gsbi10,
2709#ifndef CONFIG_MSM_DSPS
2710 &msm8960_device_qup_i2c_gsbi12,
2711#endif
2712 &msm_slim_ctrl,
2713 &msm_device_wcnss_wlan,
2714#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2715 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2716 &qcrypto_device,
2717#endif
2718
2719#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2720 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2721 &qcedev_device,
2722#endif
2723#ifdef CONFIG_MSM_ROTATOR
2724 &msm_rotator_device,
2725#endif
2726 &msm_device_sps,
2727#ifdef CONFIG_MSM_FAKE_BATTERY
2728 &fish_battery_device,
2729#endif
2730#ifdef CONFIG_ANDROID_PMEM
2731 &android_pmem_device,
2732 &android_pmem_adsp_device,
2733 &android_pmem_audio_device,
2734#endif
2735 &msm_fb_device,
2736 &msm_device_vidc,
2737 &msm_device_bam_dmux,
2738 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002739
2740#ifdef CONFIG_HW_RANDOM_MSM
2741 &msm_device_rng,
2742#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002743 &msm_rpm_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002744};
2745
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002746static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002747 &msm8960_device_otg,
2748 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002749 &msm_device_hsusb_host,
2750 &android_usb_device,
2751 &msm_device_vidc,
2752 &mipi_dsi_simulator_panel_device,
2753 &msm_bus_apps_fabric,
2754 &msm_bus_sys_fabric,
2755 &msm_bus_mm_fabric,
2756 &msm_bus_sys_fpb,
2757 &msm_bus_cpss_fpb,
2758 &msm_pcm,
2759 &msm_pcm_routing,
2760 &msm_cpudai0,
2761 &msm_cpudai1,
2762 &msm_cpudai_hdmi_rx,
2763 &msm_cpudai_bt_rx,
2764 &msm_cpudai_bt_tx,
2765 &msm_cpudai_fm_rx,
2766 &msm_cpudai_fm_tx,
2767 &msm_cpu_fe,
2768 &msm_stub_codec,
2769 &msm_voice,
2770 &msm_voip,
2771 &msm_lpa_pcm,
2772
2773#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2774 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2775 &qcrypto_device,
2776#endif
2777
2778#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2779 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2780 &qcedev_device,
2781#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002782};
2783
2784static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002785 &msm_kgsl_3d0,
2786 &msm_kgsl_2d0,
2787 &msm_kgsl_2d1,
2788 &mipi_dsi_renesas_panel_device,
2789#ifdef CONFIG_MSM_GEMINI
2790 &msm8960_gemini_device,
2791#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002792};
2793
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002794static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002795 &msm8960_device_otg,
2796 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002797 &msm_device_hsusb_host,
2798 &android_usb_device,
2799 &msm_pcm,
2800 &msm_pcm_routing,
2801 &msm_cpudai0,
2802 &msm_cpudai1,
2803 &msm_cpudai_hdmi_rx,
2804 &msm_cpudai_bt_rx,
2805 &msm_cpudai_bt_tx,
2806 &msm_cpudai_fm_rx,
2807 &msm_cpudai_fm_tx,
2808 &msm_cpu_fe,
2809 &msm_stub_codec,
2810 &msm_kgsl_3d0,
2811#ifdef CONFIG_MSM_KGSL_2D
2812 &msm_kgsl_2d0,
2813 &msm_kgsl_2d1,
2814#endif
2815 &mipi_dsi_toshiba_panel_device,
2816#ifdef CONFIG_MSM_GEMINI
2817 &msm8960_gemini_device,
2818#endif
2819 &msm_voice,
2820 &msm_voip,
2821 &msm_lpa_pcm,
2822#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2823 &hdmi_msm_device,
2824#endif
2825 &msm_pcm_hostless,
2826 &msm_bus_apps_fabric,
2827 &msm_bus_sys_fabric,
2828 &msm_bus_mm_fabric,
2829 &msm_bus_sys_fpb,
2830 &msm_bus_cpss_fpb,
2831};
2832
2833static void __init msm8960_i2c_init(void)
2834{
2835 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2836 &msm8960_i2c_qup_gsbi4_pdata;
2837
2838 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2839 &msm8960_i2c_qup_gsbi3_pdata;
2840
2841 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2842 &msm8960_i2c_qup_gsbi10_pdata;
2843
2844 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2845 &msm8960_i2c_qup_gsbi12_pdata;
2846}
2847
2848static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
2849 .irq_base = PM8921_IRQ_BASE,
2850 .devirq = MSM_GPIO_TO_INT(104),
2851 .irq_trigger_flag = IRQF_TRIGGER_LOW,
2852};
2853
2854static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
2855 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
2856};
2857
2858static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
2859 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
2860};
2861
2862static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
2863 .rtc_write_enable = false,
2864};
2865
2866static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
2867 .pull_up = 1,
2868 .kpd_trigger_delay_us = 970,
2869 .wakeup = 1,
2870};
2871
2872static const unsigned int keymap[] = {
2873 KEY(0, 0, KEY_VOLUMEUP),
2874 KEY(0, 1, KEY_VOLUMEDOWN),
2875 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
2876 KEY(0, 3, KEY_CAMERA_FOCUS),
2877};
2878
2879static struct matrix_keymap_data keymap_data = {
2880 .keymap_size = ARRAY_SIZE(keymap),
2881 .keymap = keymap,
2882};
2883
2884static struct pm8xxx_keypad_platform_data keypad_data = {
2885 .input_name = "keypad_8960",
2886 .input_phys_device = "keypad_8960/input0",
2887 .num_rows = 1,
2888 .num_cols = 5,
2889 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
2890 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
2891 .debounce_ms = 15,
2892 .scan_delay_ms = 32,
2893 .row_hold_ns = 91500,
2894 .wakeup = 1,
2895 .keymap_data = &keymap_data,
2896};
2897
2898static const unsigned int keymap_sim[] = {
2899 KEY(0, 0, KEY_7),
2900 KEY(0, 1, KEY_DOWN),
2901 KEY(0, 2, KEY_UP),
2902 KEY(0, 3, KEY_RIGHT),
2903 KEY(0, 4, KEY_ENTER),
2904 KEY(0, 5, KEY_L),
2905 KEY(0, 6, KEY_BACK),
2906 KEY(0, 7, KEY_M),
2907
2908 KEY(1, 0, KEY_LEFT),
2909 KEY(1, 1, KEY_SEND),
2910 KEY(1, 2, KEY_1),
2911 KEY(1, 3, KEY_4),
2912 KEY(1, 4, KEY_CLEAR),
2913 KEY(1, 5, KEY_MSDOS),
2914 KEY(1, 6, KEY_SPACE),
2915 KEY(1, 7, KEY_COMMA),
2916
2917 KEY(2, 0, KEY_6),
2918 KEY(2, 1, KEY_5),
2919 KEY(2, 2, KEY_8),
2920 KEY(2, 3, KEY_3),
2921 KEY(2, 4, KEY_NUMERIC_STAR),
2922 KEY(2, 5, KEY_UP),
2923 KEY(2, 6, KEY_DOWN),
2924 KEY(2, 7, KEY_LEFTSHIFT),
2925
2926 KEY(3, 0, KEY_9),
2927 KEY(3, 1, KEY_NUMERIC_POUND),
2928 KEY(3, 2, KEY_0),
2929 KEY(3, 3, KEY_2),
2930 KEY(3, 4, KEY_SLEEP),
2931 KEY(3, 5, KEY_F1),
2932 KEY(3, 6, KEY_F2),
2933 KEY(3, 7, KEY_F3),
2934
2935 KEY(4, 0, KEY_BACK),
2936 KEY(4, 1, KEY_HOME),
2937 KEY(4, 2, KEY_MENU),
2938 KEY(4, 3, KEY_VOLUMEUP),
2939 KEY(4, 4, KEY_VOLUMEDOWN),
2940 KEY(4, 5, KEY_F4),
2941 KEY(4, 6, KEY_F5),
2942 KEY(4, 7, KEY_F6),
2943
2944 KEY(5, 0, KEY_R),
2945 KEY(5, 1, KEY_T),
2946 KEY(5, 2, KEY_Y),
2947 KEY(5, 3, KEY_LEFTALT),
2948 KEY(5, 4, KEY_KPENTER),
2949 KEY(5, 5, KEY_Q),
2950 KEY(5, 6, KEY_W),
2951 KEY(5, 7, KEY_E),
2952
2953 KEY(6, 0, KEY_F),
2954 KEY(6, 1, KEY_G),
2955 KEY(6, 2, KEY_H),
2956 KEY(6, 3, KEY_CAPSLOCK),
2957 KEY(6, 4, KEY_PAGEUP),
2958 KEY(6, 5, KEY_A),
2959 KEY(6, 6, KEY_S),
2960 KEY(6, 7, KEY_D),
2961
2962 KEY(7, 0, KEY_V),
2963 KEY(7, 1, KEY_B),
2964 KEY(7, 2, KEY_N),
2965 KEY(7, 3, KEY_MENU),
2966 KEY(7, 4, KEY_PAGEDOWN),
2967 KEY(7, 5, KEY_Z),
2968 KEY(7, 6, KEY_X),
2969 KEY(7, 7, KEY_C),
2970
2971 KEY(8, 0, KEY_P),
2972 KEY(8, 1, KEY_J),
2973 KEY(8, 2, KEY_K),
2974 KEY(8, 3, KEY_INSERT),
2975 KEY(8, 4, KEY_LINEFEED),
2976 KEY(8, 5, KEY_U),
2977 KEY(8, 6, KEY_I),
2978 KEY(8, 7, KEY_O),
2979
2980 KEY(9, 0, KEY_4),
2981 KEY(9, 1, KEY_5),
2982 KEY(9, 2, KEY_6),
2983 KEY(9, 3, KEY_7),
2984 KEY(9, 4, KEY_8),
2985 KEY(9, 5, KEY_1),
2986 KEY(9, 6, KEY_2),
2987 KEY(9, 7, KEY_3),
2988
2989 KEY(10, 0, KEY_F7),
2990 KEY(10, 1, KEY_F8),
2991 KEY(10, 2, KEY_F9),
2992 KEY(10, 3, KEY_F10),
2993 KEY(10, 4, KEY_FN),
2994 KEY(10, 5, KEY_9),
2995 KEY(10, 6, KEY_0),
2996 KEY(10, 7, KEY_DOT),
2997
2998 KEY(11, 0, KEY_LEFTCTRL),
2999 KEY(11, 1, KEY_F11),
3000 KEY(11, 2, KEY_ENTER),
3001 KEY(11, 3, KEY_SEARCH),
3002 KEY(11, 4, KEY_DELETE),
3003 KEY(11, 5, KEY_RIGHT),
3004 KEY(11, 6, KEY_LEFT),
3005 KEY(11, 7, KEY_RIGHTSHIFT),
3006 KEY(0, 0, KEY_VOLUMEUP),
3007 KEY(0, 1, KEY_VOLUMEDOWN),
3008 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3009 KEY(0, 3, KEY_CAMERA_FOCUS),
3010};
3011
3012static struct matrix_keymap_data keymap_data_sim = {
3013 .keymap_size = ARRAY_SIZE(keymap_sim),
3014 .keymap = keymap_sim,
3015};
3016
3017static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3018 .input_name = "keypad_8960",
3019 .input_phys_device = "keypad_8960/input0",
3020 .num_rows = 12,
3021 .num_cols = 8,
3022 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3023 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3024 .debounce_ms = 15,
3025 .scan_delay_ms = 32,
3026 .row_hold_ns = 91500,
3027 .wakeup = 1,
3028 .keymap_data = &keymap_data_sim,
3029};
3030
3031static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
3032 .safety_time = 180,
3033 .update_time = 1,
3034 .max_voltage = 4200,
3035 .min_voltage = 3200,
3036 .resume_voltage = 4100,
3037 .term_current = 100,
3038};
3039
3040static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3041 .priority = 0,
3042};
3043
3044static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3045 .r_sense = 10,
3046 .i_test = 2500,
3047 .v_failure = 3000,
3048 .calib_delay_ms = 600000,
3049 .batt_data = &palladium_1500_data,
3050};
3051
3052static struct led_info pm8921_led_info[] = {
3053 [0] = {
3054 .name = "led:drv1",
3055 .flags = PM8XXX_ID_LED_1,
3056 },
3057};
3058
3059static struct led_platform_data pm8xxx_leds_pdata = {
3060 .num_leds = ARRAY_SIZE(pm8921_led_info),
3061 .leds = pm8921_led_info,
3062};
3063
3064static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3065 .irq_pdata = &pm8xxx_irq_pdata,
3066 .gpio_pdata = &pm8xxx_gpio_pdata,
3067 .mpp_pdata = &pm8xxx_mpp_pdata,
3068 .rtc_pdata = &pm8xxx_rtc_pdata,
3069 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3070 .keypad_pdata = &keypad_data,
3071 .misc_pdata = &pm8xxx_misc_pdata,
3072 .regulator_pdatas = msm_pm8921_regulator_pdata,
3073 .charger_pdata = &pm8921_chg_pdata,
3074 .bms_pdata = &pm8921_bms_pdata,
3075 .adc_pdata = &pm8921_adc_pdata,
3076 .leds_pdata = &pm8xxx_leds_pdata,
3077};
3078
3079static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3080 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3081 .slave = {
3082 .name = "pm8921-core",
3083 .platform_data = &pm8921_platform_data,
3084 },
3085};
3086
3087static void msm8960_wcnss_init(void)
3088{
3089 int i, ret, j;
3090
3091 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3092 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3093 "wcnss_5_wire");
3094 if (ret) {
3095 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3096 wcnss_5wire_interface[i].gpio, ret);
3097 goto fail;
3098 }
3099 }
3100
3101 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3102
3103 return;
3104
3105fail:
3106 for (j = 0; j < i; j++)
3107 gpio_free(wcnss_5wire_interface[j].gpio);
3108}
3109
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003110#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003111static int ethernet_init(void)
3112{
3113 int ret;
3114 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3115 if (ret) {
3116 pr_err("ks8851 gpio_request failed: %d\n", ret);
3117 goto fail;
3118 }
3119
3120 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3121 if (ret) {
3122 pr_err("ks8851 gpio_request failed: %d\n", ret);
3123 goto fail_rst;
3124 }
3125
3126 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3127 if (ret) {
3128 pr_err("ks8851 gpio_request failed: %d\n", ret);
3129 goto fail_cs;
3130 }
3131
3132 gpio_direction_output(FPGA_CS_GPIO, 1);
3133 gpio_direction_output(KS8851_RST_GPIO, 1);
3134 return 0;
3135fail_cs:
3136 gpio_free(KS8851_RST_GPIO);
3137fail_rst:
3138 gpio_free(KS8851_IRQ_GPIO);
3139fail:
3140 return ret;
3141}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003142#else
3143static int ethernet_init(void)
3144{
3145 return 0;
3146}
3147#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003148
3149static struct msm_cpuidle_state msm_cstates[] __initdata = {
3150 {0, 0, "C0", "WFI",
3151 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3152
3153 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3154 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3155
3156 {0, 2, "C2", "POWER_COLLAPSE",
3157 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3158
3159 {1, 0, "C0", "WFI",
3160 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3161
3162 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3163 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3164};
3165
3166static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3167 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3168 .idle_supported = 1,
3169 .suspend_supported = 1,
3170 .idle_enabled = 0,
3171 .suspend_enabled = 0,
3172 .latency = 4000,
3173 .residency = 13000,
3174 },
3175
3176 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3177 .idle_supported = 1,
3178 .suspend_supported = 1,
3179 .idle_enabled = 0,
3180 .suspend_enabled = 0,
3181 .latency = 500,
3182 .residency = 6000,
3183 },
3184
3185 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3186 .idle_supported = 1,
3187 .suspend_supported = 1,
3188 .idle_enabled = 1,
3189 .suspend_enabled = 1,
3190 .latency = 2,
3191 .residency = 0,
3192 },
3193
3194 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3195 .idle_supported = 0,
3196 .suspend_supported = 1,
3197 .idle_enabled = 0,
3198 .suspend_enabled = 0,
3199 .latency = 600,
3200 .residency = 7200,
3201 },
3202
3203 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3204 .idle_supported = 1,
3205 .suspend_supported = 1,
3206 .idle_enabled = 0,
3207 .suspend_enabled = 0,
3208 .latency = 500,
3209 .residency = 6000,
3210 },
3211
3212 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3213 .idle_supported = 1,
3214 .suspend_supported = 0,
3215 .idle_enabled = 1,
3216 .suspend_enabled = 0,
3217 .latency = 2,
3218 .residency = 0,
3219 },
3220};
3221
3222static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3223 {
3224 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3225 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3226 true,
3227 1, 8000, 100000, 1,
3228 },
3229
3230 {
3231 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3232 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3233 true,
3234 1500, 5000, 60100000, 3000,
3235 },
3236
3237 {
3238 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3239 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3240 false,
3241 1800, 5000, 60350000, 3500,
3242 },
3243
3244 {
3245 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3246 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3247 false,
3248 2800, 2500, 65350000, 4800,
3249 },
3250
3251 {
3252 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3253 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3254 false,
3255 3800, 4500, 67850000, 5500,
3256 },
3257
3258 {
3259 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3260 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3261 false,
3262 4800, 2000, 71850000, 6800,
3263 },
3264
3265 {
3266 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3267 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3268 false,
3269 6800, 500, 75850000, 8800,
3270 },
3271
3272 {
3273 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3274 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3275 false,
3276 7800, 0, 76350000, 9800,
3277 },
3278};
3279
3280#ifdef CONFIG_I2C
3281#define I2C_SURF 1
3282#define I2C_FFA (1 << 1)
3283#define I2C_RUMI (1 << 2)
3284#define I2C_SIM (1 << 3)
3285#define I2C_FLUID (1 << 4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003286
3287struct i2c_registry {
3288 u8 machs;
3289 int bus;
3290 struct i2c_board_info *info;
3291 int len;
3292};
3293
3294#ifdef CONFIG_MSM_CAMERA
3295static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3296#ifdef CONFIG_IMX074
3297 {
3298 I2C_BOARD_INFO("imx074", 0x1A),
3299 },
3300#endif
3301#ifdef CONFIG_OV2720
3302 {
3303 I2C_BOARD_INFO("ov2720", 0x6C),
3304 },
3305#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003306 {
3307 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3308 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303309#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3310 {
3311 I2C_BOARD_INFO("sc628a", 0x6E),
3312 },
3313#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003314};
3315#endif
3316
3317/* Sensors DSPS platform data */
3318#ifdef CONFIG_MSM_DSPS
3319#define DSPS_PIL_GENERIC_NAME "dsps"
3320#endif /* CONFIG_MSM_DSPS */
3321
3322static void __init msm8960_init_dsps(void)
3323{
3324#ifdef CONFIG_MSM_DSPS
3325 struct msm_dsps_platform_data *pdata =
3326 msm_dsps_device.dev.platform_data;
3327 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3328 pdata->gpios = NULL;
3329 pdata->gpios_num = 0;
3330
3331 platform_device_register(&msm_dsps_device);
3332#endif /* CONFIG_MSM_DSPS */
3333}
3334
3335static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3336#ifdef CONFIG_MSM_CAMERA
3337 {
3338 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_RUMI,
3339 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3340 msm_camera_boardinfo,
3341 ARRAY_SIZE(msm_camera_boardinfo),
3342 },
3343#endif
3344 {
3345 I2C_SURF | I2C_FFA | I2C_FLUID,
3346 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3347 cyttsp_info,
3348 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003349 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003350};
3351#endif /* CONFIG_I2C */
3352
3353static void __init register_i2c_devices(void)
3354{
3355#ifdef CONFIG_I2C
3356 u8 mach_mask = 0;
3357 int i;
3358
3359 /* Build the matching 'supported_machs' bitmask */
3360 if (machine_is_msm8960_cdp())
3361 mach_mask = I2C_SURF;
3362 else if (machine_is_msm8960_rumi3())
3363 mach_mask = I2C_RUMI;
3364 else if (machine_is_msm8960_sim())
3365 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003366 else if (machine_is_msm8960_fluid())
3367 mach_mask = I2C_FLUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003368 else if (machine_is_msm8960_mtp())
3369 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003370 else
3371 pr_err("unmatched machine ID in register_i2c_devices\n");
3372
3373 /* Run the array and install devices as appropriate */
3374 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3375 if (msm8960_i2c_devices[i].machs & mach_mask)
3376 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3377 msm8960_i2c_devices[i].info,
3378 msm8960_i2c_devices[i].len);
3379 }
3380#endif
3381}
3382
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003383static void __init msm8960_sim_init(void)
3384{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003385 if (socinfo_init() < 0)
3386 pr_err("socinfo_init() failed!\n");
3387
3388 BUG_ON(msm_rpm_init(&msm_rpm_data));
3389 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3390 ARRAY_SIZE(msm_rpmrs_levels)));
3391 regulator_suppress_info_printing();
Stephen Boydbb600ae2011-08-02 20:11:40 -07003392 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003393 msm8960_device_ssbi_pm8921.dev.platform_data =
3394 &msm8960_ssbi_pm8921_pdata;
3395 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003396
3397 /* Simulator supports a QWERTY keypad */
3398 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
3399
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003400 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3401 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3402 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003403 gpiomux_init();
3404 ethernet_init();
3405 msm8960_i2c_init();
3406 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3407 msm_spm_l2_init(msm_spm_l2_data);
3408 msm8960_init_buses();
3409 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3410 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003411 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003412 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3413
3414 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3415 &msm8960_qup_spi_gsbi1_pdata;
3416 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3417
3418 msm8960_init_mmc();
3419 msm_fb_add_devices();
3420 slim_register_board_info(msm_slim_devices,
3421 ARRAY_SIZE(msm_slim_devices));
3422 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3423 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3424 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3425 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003426}
3427
3428static void __init msm8960_rumi3_init(void)
3429{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003430 if (socinfo_init() < 0)
3431 pr_err("socinfo_init() failed!\n");
3432
3433 BUG_ON(msm_rpm_init(&msm_rpm_data));
3434 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3435 ARRAY_SIZE(msm_rpmrs_levels)));
3436 regulator_suppress_info_printing();
Stephen Boydbb600ae2011-08-02 20:11:40 -07003437 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003438 gpiomux_init();
3439 ethernet_init();
3440 msm8960_device_ssbi_pm8921.dev.platform_data =
3441 &msm8960_ssbi_pm8921_pdata;
3442 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3443 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3444 &msm8960_qup_spi_gsbi1_pdata;
3445 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3446 msm8960_i2c_init();
3447 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3448 msm_spm_l2_init(msm_spm_l2_data);
3449 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3450 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003451 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003452 msm8960_init_mmc();
3453
3454 register_i2c_devices();
3455 msm_fb_add_devices();
3456 slim_register_board_info(msm_slim_devices,
3457 ARRAY_SIZE(msm_slim_devices));
3458 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3459 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3460 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3461 msm_pm_data);
3462}
3463
3464static void __init msm8960_cdp_init(void)
3465{
3466 if (socinfo_init() < 0)
3467 pr_err("socinfo_init() failed!\n");
3468
3469 BUG_ON(msm_rpm_init(&msm_rpm_data));
3470 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3471 ARRAY_SIZE(msm_rpmrs_levels)));
3472 regulator_suppress_info_printing();
3473 if (msm_xo_init())
3474 pr_err("Failed to initialize XO votes\n");
Stephen Boydbb600ae2011-08-02 20:11:40 -07003475 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003476 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3477 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3478 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003479 gpiomux_init();
3480 ethernet_init();
3481 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3482 &msm8960_qup_spi_gsbi1_pdata;
3483 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3484 msm8960_device_ssbi_pm8921.dev.platform_data =
3485 &msm8960_ssbi_pm8921_pdata;
3486 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3487 msm8960_i2c_init();
3488 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3489 msm_spm_l2_init(msm_spm_l2_data);
3490 msm8960_init_buses();
3491 platform_add_devices(msm_footswitch_devices,
3492 msm_num_footswitch_devices);
3493 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3494 pm8921_gpio_mpp_init();
3495 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3496 msm8960_init_cam();
3497 msm8960_init_mmc();
3498 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3499 register_i2c_devices();
3500 msm8960_wcnss_init();
3501 msm_fb_add_devices();
3502 slim_register_board_info(msm_slim_devices,
3503 ARRAY_SIZE(msm_slim_devices));
3504 msm8960_init_dsps();
3505 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3506 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3507 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3508 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07003509 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003510}
3511
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003512MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3513 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003514 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003515 .init_irq = msm8960_init_irq,
3516 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003517 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003518 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003519MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003520
3521MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3522 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003523 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003524 .init_irq = msm8960_init_irq,
3525 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003526 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003527 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003528MACHINE_END
3529
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003530MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3531 .map_io = msm8960_map_io,
3532 .reserve = msm8960_reserve,
3533 .init_irq = msm8960_init_irq,
3534 .timer = &msm_timer,
3535 .init_machine = msm8960_cdp_init,
3536 .init_early = msm8960_allocate_memory_regions,
3537MACHINE_END
3538
3539MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3540 .map_io = msm8960_map_io,
3541 .reserve = msm8960_reserve,
3542 .init_irq = msm8960_init_irq,
3543 .timer = &msm_timer,
3544 .init_machine = msm8960_cdp_init,
3545 .init_early = msm8960_allocate_memory_regions,
3546MACHINE_END
3547
3548MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3549 .map_io = msm8960_map_io,
3550 .reserve = msm8960_reserve,
3551 .init_irq = msm8960_init_irq,
3552 .timer = &msm_timer,
3553 .init_machine = msm8960_cdp_init,
3554 .init_early = msm8960_allocate_memory_regions,
3555MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003556
3557MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3558 .map_io = msm8960_map_io,
3559 .reserve = msm8960_reserve,
3560 .init_irq = msm8960_init_irq,
3561 .timer = &msm_timer,
3562 .init_machine = msm8960_cdp_init,
3563 .init_early = msm8960_allocate_memory_regions,
3564MACHINE_END