blob: 66ead3f0199163ca40004caa5a1edfd0a83a4ff5 [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
855static int msm_cam_gpio_tbl[] = {
856 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
890static int config_gpio_table(int gpio_en)
891{
892 int rc = 0, i = 0;
893 if (gpio_en) {
894 for (i = 0; i < ARRAY_SIZE(msm_cam_gpio_tbl); i++) {
895 rc = gpio_request(msm_cam_gpio_tbl[i], "CAM_GPIO");
896 if (rc < 0) {
897 pr_err("%s not able to get gpio\n", __func__);
898 for (i--; i >= 0; i--)
899 gpio_free(msm_cam_gpio_tbl[i]);
900 break;
901 }
902 }
903 } else {
904 for (i = 0; i < ARRAY_SIZE(msm_cam_gpio_tbl); i++)
905 gpio_free(msm_cam_gpio_tbl[i]);
906 }
907 return rc;
908}
909
910static int config_camera_on_gpios(void)
911{
912 int rc = 0;
913
914 rc = config_gpio_table(1);
915 if (rc < 0) {
916 printk(KERN_ERR "%s: CAMSENSOR gpio table request"
917 "failed\n", __func__);
918 return rc;
919 }
920 return rc;
921}
922
923static void config_camera_off_gpios(void)
924{
925 config_gpio_table(0);
926}
927
928struct msm_camera_device_platform_data msm_camera_csi0_device_data = {
929 .camera_gpio_on = config_camera_on_gpios,
930 .camera_gpio_off = config_camera_off_gpios,
931 .ioclk.mclk_clk_rate = 24000000,
932 .ioclk.vfe_clk_rate = 228570000,
933 .csid_core = 0,
934};
935
936struct msm_camera_device_platform_data msm_camera_csi1_device_data = {
937 .camera_gpio_on = config_camera_on_gpios,
938 .camera_gpio_off = config_camera_off_gpios,
939 .ioclk.mclk_clk_rate = 24000000,
940 .ioclk.vfe_clk_rate = 228570000,
941 .csid_core = 1,
942};
943
944#ifdef CONFIG_IMX074
945static struct msm_camera_sensor_flash_data flash_imx074 = {
946 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530947#ifdef CONFIG_MSM_CAMERA_FLASH
948 .flash_src = &msm_flash_src
949#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700950};
951
952static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
953 .sensor_name = "imx074",
954 .sensor_reset = 107,
955 .sensor_pwd = 85,
956 .vcm_pwd = 0,
957 .vcm_enable = 1,
958 .pdata = &msm_camera_csi0_device_data,
959 .flash_data = &flash_imx074,
960 .strobe_flash_data = &strobe_flash_xenon,
961 .sensor_platform_info = &sensor_board_info,
962 .csi_if = 1
963};
964
965struct platform_device msm8960_camera_sensor_imx074 = {
966 .name = "msm_camera_imx074",
967 .dev = {
968 .platform_data = &msm_camera_sensor_imx074_data,
969 },
970};
971#endif
972#ifdef CONFIG_OV2720
973static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -0700974 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700975};
976
977static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
978 .sensor_name = "ov2720",
979 .sensor_reset = 76,
980 .sensor_pwd = 85,
981 .vcm_pwd = 0,
982 .vcm_enable = 1,
983 .pdata = &msm_camera_csi1_device_data,
984 .flash_data = &flash_ov2720,
985 .csi_if = 1
986};
987
988struct platform_device msm8960_camera_sensor_ov2720 = {
989 .name = "msm_camera_ov2720",
990 .dev = {
991 .platform_data = &msm_camera_sensor_ov2720_data,
992 },
993};
994#endif
Kevin Chandfecce22011-07-13 10:52:41 -0700995
996static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
997 .flash_type = MSM_CAMERA_FLASH_LED,
998};
999
1000static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1001 .sensor_name = "qs_mt9p017",
1002 .sensor_reset = 107,
1003 .sensor_pwd = 85,
1004 .vcm_pwd = 0,
1005 .vcm_enable = 1,
1006 .pdata = &msm_camera_csi0_device_data,
1007 .flash_data = &flash_qs_mt9p017,
1008 .sensor_platform_info = &sensor_board_info,
1009 .csi_if = 1
1010};
1011
1012struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1013 .name = "msm_camera_qs_mt9p017",
1014 .dev = {
1015 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1016 },
1017};
1018
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001019static void __init msm8960_init_cam(void)
1020{
1021 int i;
1022 struct platform_device *cam_dev[] = {
1023 &msm8960_camera_sensor_imx074,
1024 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001025 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001026 };
1027
1028 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1029 struct msm_camera_sensor_info *s_info;
1030 s_info = cam_dev[i]->dev.platform_data;
1031 msm_get_cam_resources(s_info);
1032 platform_device_register(cam_dev[i]);
1033 }
1034}
1035#endif
1036
1037#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
1038/* prim = 608 x 1024 x 4(bpp) x 3(pages) */
1039#define MSM_FB_PRIM_BUF_SIZE 0x720000
1040#else
1041/* prim = 608 x 1024 x 4(bpp) x 2(pages) */
1042#define MSM_FB_PRIM_BUF_SIZE 0x4C0000
1043#endif
1044
1045#ifdef CONFIG_FB_MSM_MIPI_DSI
1046/* 960 x 540 x 3 x 2 */
1047#define MIPI_DSI_WRITEBACK_SIZE 0x300000
1048#else
1049#define MIPI_DSI_WRITEBACK_SIZE 0
1050#endif
1051
1052#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1053/* hdmi = 1920 x 1088 x 2(bpp) x 1(page) */
1054#define MSM_FB_EXT_BUF_SIZE 0x3FC000
1055#elif defined(CONFIG_FB_MSM_TVOUT)
1056/* tvout = 720 x 576 x 2(bpp) x 2(pages) */
1057#define MSM_FB_EXT_BUF_SIZE 0x195000
1058#else /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1059#define MSM_FB_EXT_BUF_SIZE 0
1060#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1061
1062#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE +\
1063 MIPI_DSI_WRITEBACK_SIZE, 4096)
1064
1065#define MDP_VSYNC_GPIO 0
1066
1067static struct resource msm_fb_resources[] = {
1068 {
1069 .flags = IORESOURCE_DMA,
1070 }
1071};
1072
1073static struct platform_device msm_fb_device = {
1074 .name = "msm_fb",
1075 .id = 0,
1076 .num_resources = ARRAY_SIZE(msm_fb_resources),
1077 .resource = msm_fb_resources,
1078};
1079
1080static bool dsi_power_on;
1081
1082static int mipi_dsi_panel_power(int on)
1083{
1084 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001085 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001086 int rc;
1087
1088 struct pm_gpio gpio43_param = {
1089 .direction = PM_GPIO_DIR_OUT,
1090 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1091 .output_value = 0,
1092 .pull = PM_GPIO_PULL_NO,
1093 .vin_sel = 2,
1094 .out_strength = PM_GPIO_STRENGTH_HIGH,
1095 .function = PM_GPIO_FUNC_PAIRED,
1096 .inv_int_pol = 0,
1097 .disable_pin = 0,
1098 };
1099
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001100 pr_info("%s: state : %d\n", __func__, on);
1101
1102 if (!dsi_power_on) {
1103
1104 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1105 "dsi_vdc");
1106 if (IS_ERR(reg_l8)) {
1107 pr_err("could not get 8921_l8, rc = %ld\n",
1108 PTR_ERR(reg_l8));
1109 return -ENODEV;
1110 }
1111
1112 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1113 "dsi_vddio");
1114 if (IS_ERR(reg_l23)) {
1115 pr_err("could not get 8921_l23, rc = %ld\n",
1116 PTR_ERR(reg_l23));
1117 return -ENODEV;
1118 }
1119
1120 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1121 "dsi_vdda");
1122 if (IS_ERR(reg_l2)) {
1123 pr_err("could not get 8921_l2, rc = %ld\n",
1124 PTR_ERR(reg_l2));
1125 return -ENODEV;
1126 }
1127
1128 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1129 if (rc) {
1130 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1131 return -EINVAL;
1132 }
1133 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1134 if (rc) {
1135 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1136 return -EINVAL;
1137 }
1138 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1139 if (rc) {
1140 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1141 return -EINVAL;
1142 }
1143
1144 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1145 rc = gpio_request(gpio43, "disp_rst_n");
1146 if (rc) {
1147 pr_err("request gpio 43 failed, rc=%d\n", rc);
1148 return -ENODEV;
1149 }
1150
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001151 dsi_power_on = true;
1152 }
1153
1154 if (on) {
1155 rc = regulator_set_optimum_mode(reg_l8, 100000);
1156 if (rc < 0) {
1157 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1158 return -EINVAL;
1159 }
1160 rc = regulator_set_optimum_mode(reg_l23, 100000);
1161 if (rc < 0) {
1162 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1163 return -EINVAL;
1164 }
1165 rc = regulator_set_optimum_mode(reg_l2, 100000);
1166 if (rc < 0) {
1167 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1168 return -EINVAL;
1169 }
1170 rc = regulator_enable(reg_l8);
1171 if (rc) {
1172 pr_err("enable l8 failed, rc=%d\n", rc);
1173 return -ENODEV;
1174 }
1175 rc = regulator_enable(reg_l23);
1176 if (rc) {
1177 pr_err("enable l8 failed, rc=%d\n", rc);
1178 return -ENODEV;
1179 }
1180 rc = regulator_enable(reg_l2);
1181 if (rc) {
1182 pr_err("enable l2 failed, rc=%d\n", rc);
1183 return -ENODEV;
1184 }
1185
1186 gpio43_param.pull = PM_GPIO_PULL_NO;
1187 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1188 if (rc) {
1189 pr_err("gpio_config 43 failed (1), rc=%d\n", rc);
1190 return -EINVAL;
1191 }
1192 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1193 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1194 if (rc) {
1195 pr_err("gpio_config 43 failed (2), rc=%d\n", rc);
1196 return -EINVAL;
1197 }
1198 gpio43_param.pull = PM_GPIO_PULL_NO;
1199 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1200 if (rc) {
1201 pr_err("gpio_config 43 failed (3), rc=%d\n", rc);
1202 return -EINVAL;
1203 }
1204 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1205 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1206 if (rc) {
1207 pr_err("gpio_config 43 failed (4), rc=%d\n", rc);
1208 return -EINVAL;
1209 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001210 gpio_set_value_cansleep(gpio43, 1);
1211 } else {
1212 rc = regulator_set_optimum_mode(reg_l8, 100);
1213 if (rc < 0) {
1214 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1215 return -EINVAL;
1216 }
1217 rc = regulator_set_optimum_mode(reg_l23, 100);
1218 if (rc < 0) {
1219 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1220 return -EINVAL;
1221 }
1222 rc = regulator_set_optimum_mode(reg_l2, 100);
1223 if (rc < 0) {
1224 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1225 return -EINVAL;
1226 }
1227 gpio_set_value_cansleep(gpio43, 0);
1228 }
1229 return 0;
1230}
1231
1232static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1233 .vsync_gpio = MDP_VSYNC_GPIO,
1234 .dsi_power_save = mipi_dsi_panel_power,
1235};
1236
1237#ifdef CONFIG_MSM_BUS_SCALING
1238
1239static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001240 {
1241 .src = MSM_BUS_MASTER_MDP_PORT0,
1242 .dst = MSM_BUS_SLAVE_EBI_CH0,
1243 .ab = 0,
1244 .ib = 0,
1245 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001246};
1247
1248static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001249 {
1250 .src = MSM_BUS_MASTER_MDP_PORT0,
1251 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001252 .ab = 216000000 * 2,
1253 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001254 },
1255};
1256
1257static struct msm_bus_vectors mdp_vga_vectors[] = {
1258 /* VGA and less video */
1259 {
1260 .src = MSM_BUS_MASTER_MDP_PORT0,
1261 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001262 .ab = 216000000 * 2,
1263 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001264 },
1265};
1266
1267static struct msm_bus_vectors mdp_720p_vectors[] = {
1268 /* 720p and less video */
1269 {
1270 .src = MSM_BUS_MASTER_MDP_PORT0,
1271 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001272 .ab = 230400000 * 2,
1273 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001274 },
1275};
1276
1277static struct msm_bus_vectors mdp_1080p_vectors[] = {
1278 /* 1080p and less video */
1279 {
1280 .src = MSM_BUS_MASTER_MDP_PORT0,
1281 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001282 .ab = 334080000 * 2,
1283 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001284 },
1285};
1286
1287static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1288 {
1289 ARRAY_SIZE(mdp_init_vectors),
1290 mdp_init_vectors,
1291 },
1292 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001293 ARRAY_SIZE(mdp_ui_vectors),
1294 mdp_ui_vectors,
1295 },
1296 {
1297 ARRAY_SIZE(mdp_ui_vectors),
1298 mdp_ui_vectors,
1299 },
1300 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001301 ARRAY_SIZE(mdp_vga_vectors),
1302 mdp_vga_vectors,
1303 },
1304 {
1305 ARRAY_SIZE(mdp_720p_vectors),
1306 mdp_720p_vectors,
1307 },
1308 {
1309 ARRAY_SIZE(mdp_1080p_vectors),
1310 mdp_1080p_vectors,
1311 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001312};
1313
1314static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1315 mdp_bus_scale_usecases,
1316 ARRAY_SIZE(mdp_bus_scale_usecases),
1317 .name = "mdp",
1318};
1319
1320#endif
1321
1322int mdp_core_clk_rate_table[] = {
1323 85330000,
1324 85330000,
1325 128000000,
1326 200000000,
1327 200000000,
1328};
1329
1330static struct msm_panel_common_pdata mdp_pdata = {
1331 .gpio = MDP_VSYNC_GPIO,
1332 .mdp_core_clk_rate = 85330000,
1333 .mdp_core_clk_table = mdp_core_clk_rate_table,
1334 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1335#ifdef CONFIG_MSM_BUS_SCALING
1336 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1337#endif
1338 .mdp_rev = MDP_REV_42,
1339};
1340
1341static struct platform_device mipi_dsi_renesas_panel_device = {
1342 .name = "mipi_renesas",
1343 .id = 0,
1344};
1345
1346static struct platform_device mipi_dsi_simulator_panel_device = {
1347 .name = "mipi_simulator",
1348 .id = 0,
1349};
1350
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001351#define LPM_CHANNEL0 0
1352static int toshiba_gpio[] = {LPM_CHANNEL0};
1353
1354static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1355 .gpio = toshiba_gpio,
1356};
1357
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001358static struct platform_device mipi_dsi_toshiba_panel_device = {
1359 .name = "mipi_toshiba",
1360 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001361 .dev = {
1362 .platform_data = &toshiba_pdata,
1363 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364};
1365
1366#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1367static struct resource hdmi_msm_resources[] = {
1368 {
1369 .name = "hdmi_msm_qfprom_addr",
1370 .start = 0x00700000,
1371 .end = 0x007060FF,
1372 .flags = IORESOURCE_MEM,
1373 },
1374 {
1375 .name = "hdmi_msm_hdmi_addr",
1376 .start = 0x04A00000,
1377 .end = 0x04A00FFF,
1378 .flags = IORESOURCE_MEM,
1379 },
1380 {
1381 .name = "hdmi_msm_irq",
1382 .start = HDMI_IRQ,
1383 .end = HDMI_IRQ,
1384 .flags = IORESOURCE_IRQ,
1385 },
1386};
1387
1388static int hdmi_enable_5v(int on);
1389static int hdmi_core_power(int on, int show);
1390static int hdmi_cec_power(int on);
1391
1392static struct msm_hdmi_platform_data hdmi_msm_data = {
1393 .irq = HDMI_IRQ,
1394 .enable_5v = hdmi_enable_5v,
1395 .core_power = hdmi_core_power,
1396 .cec_power = hdmi_cec_power,
1397};
1398
1399static struct platform_device hdmi_msm_device = {
1400 .name = "hdmi_msm",
1401 .id = 0,
1402 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1403 .resource = hdmi_msm_resources,
1404 .dev.platform_data = &hdmi_msm_data,
1405};
1406#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1407
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001408#ifdef CONFIG_MSM_BUS_SCALING
1409static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1410 {
1411 .src = MSM_BUS_MASTER_MDP_PORT0,
1412 .dst = MSM_BUS_SLAVE_EBI_CH0,
1413 .ab = 0,
1414 .ib = 0,
1415 },
1416};
1417static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1418 {
1419 .src = MSM_BUS_MASTER_MDP_PORT0,
1420 .dst = MSM_BUS_SLAVE_EBI_CH0,
1421 .ab = 566092800 * 2,
1422 .ib = 707616000 * 2,
1423 },
1424};
1425static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1426 {
1427 ARRAY_SIZE(dtv_bus_init_vectors),
1428 dtv_bus_init_vectors,
1429 },
1430 {
1431 ARRAY_SIZE(dtv_bus_def_vectors),
1432 dtv_bus_def_vectors,
1433 },
1434};
1435static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1436 dtv_bus_scale_usecases,
1437 ARRAY_SIZE(dtv_bus_scale_usecases),
1438 .name = "dtv",
1439};
1440
1441static struct lcdc_platform_data dtv_pdata = {
1442 .bus_scale_table = &dtv_bus_scale_pdata,
1443};
1444#endif
1445
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001446static void __init msm_fb_add_devices(void)
1447{
1448 if (machine_is_msm8x60_rumi3()) {
1449 msm_fb_register_device("mdp", NULL);
1450 mipi_dsi_pdata.target_type = 1;
1451 } else
1452 msm_fb_register_device("mdp", &mdp_pdata);
1453 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001454#ifdef CONFIG_MSM_BUS_SCALING
1455 msm_fb_register_device("dtv", &dtv_pdata);
1456#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001457}
1458
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001459static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1460 .func = GPIOMUX_FUNC_GPIO,
1461 .drv = GPIOMUX_DRV_2MA,
1462 .pull = GPIOMUX_PULL_DOWN,
1463};
1464
1465static struct gpiomux_setting mdp_vsync_active_cfg = {
1466 .func = GPIOMUX_FUNC_1,
1467 .drv = GPIOMUX_DRV_2MA,
1468 .pull = GPIOMUX_PULL_DOWN,
1469};
1470
1471static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1472 {
1473 .gpio = MDP_VSYNC_GPIO,
1474 .settings = {
1475 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1476 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1477 },
1478 }
1479};
1480
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001481#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1482static struct gpiomux_setting hdmi_suspend_cfg = {
1483 .func = GPIOMUX_FUNC_GPIO,
1484 .drv = GPIOMUX_DRV_2MA,
1485 .pull = GPIOMUX_PULL_DOWN,
1486};
1487
1488static struct gpiomux_setting hdmi_active_1_cfg = {
1489 .func = GPIOMUX_FUNC_1,
1490 .drv = GPIOMUX_DRV_2MA,
1491 .pull = GPIOMUX_PULL_UP,
1492};
1493
1494static struct gpiomux_setting hdmi_active_2_cfg = {
1495 .func = GPIOMUX_FUNC_1,
1496 .drv = GPIOMUX_DRV_2MA,
1497 .pull = GPIOMUX_PULL_DOWN,
1498};
1499
1500static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1501 {
1502 .gpio = 99,
1503 .settings = {
1504 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1505 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1506 },
1507 },
1508 {
1509 .gpio = 100,
1510 .settings = {
1511 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1512 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1513 },
1514 },
1515 {
1516 .gpio = 101,
1517 .settings = {
1518 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1519 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1520 },
1521 },
1522 {
1523 .gpio = 102,
1524 .settings = {
1525 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1526 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1527 },
1528 },
1529};
1530
1531static int hdmi_enable_5v(int on)
1532{
1533 /* TBD: PM8921 regulator instead of 8901 */
1534 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1535 static int prev_on;
1536 int rc;
1537
1538 if (on == prev_on)
1539 return 0;
1540
1541 if (!reg_8921_hdmi_mvs)
1542 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1543 "hdmi_mvs");
1544
1545 if (on) {
1546 rc = regulator_enable(reg_8921_hdmi_mvs);
1547 if (rc) {
1548 pr_err("'%s' regulator enable failed, rc=%d\n",
1549 "8921_hdmi_mvs", rc);
1550 return rc;
1551 }
1552 pr_debug("%s(on): success\n", __func__);
1553 } else {
1554 rc = regulator_disable(reg_8921_hdmi_mvs);
1555 if (rc)
1556 pr_warning("'%s' regulator disable failed, rc=%d\n",
1557 "8921_hdmi_mvs", rc);
1558 pr_debug("%s(off): success\n", __func__);
1559 }
1560
1561 prev_on = on;
1562
1563 return 0;
1564}
1565
1566static int hdmi_core_power(int on, int show)
1567{
1568 static struct regulator *reg_8921_l23, *reg_8921_s4;
1569 static int prev_on;
1570 int rc;
1571
1572 if (on == prev_on)
1573 return 0;
1574
1575 /* TBD: PM8921 regulator instead of 8901 */
1576 if (!reg_8921_l23)
1577 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
1578
1579 if (!reg_8921_s4)
1580 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
1581
1582 if (on) {
1583 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1584 if (rc < 0) {
1585 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1586 return -EINVAL;
1587 }
1588
1589 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1590 if (!rc)
1591 rc = regulator_enable(reg_8921_l23);
1592 if (rc) {
1593 pr_err("'%s' regulator enable failed, rc=%d\n",
1594 "hdmi_avdd", rc);
1595 return rc;
1596 }
1597 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1598 if (!rc)
1599 rc = regulator_enable(reg_8921_s4);
1600 if (rc) {
1601 pr_err("'%s' regulator enable failed, rc=%d\n",
1602 "hdmi_vcc", rc);
1603 return rc;
1604 }
1605
1606 rc = gpio_request(100, "HDMI_DDC_CLK");
1607 if (rc) {
1608 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1609 "HDMI_DDC_CLK", 100, rc);
1610 goto error1;
1611 }
1612 rc = gpio_request(101, "HDMI_DDC_DATA");
1613 if (rc) {
1614 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1615 "HDMI_DDC_DATA", 101, rc);
1616 goto error2;
1617 }
1618 rc = gpio_request(102, "HDMI_HPD");
1619 if (rc) {
1620 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1621 "HDMI_HPD", 102, rc);
1622 goto error3;
1623 }
1624 pr_debug("%s(on): success\n", __func__);
1625 } else {
1626 gpio_free(100);
1627 gpio_free(101);
1628 gpio_free(102);
1629
1630 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1631 if (rc < 0) {
1632 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1633 return -EINVAL;
1634 }
1635
1636 pr_debug("%s(off): success\n", __func__);
1637 }
1638
1639 prev_on = on;
1640
1641 return 0;
1642
1643error3:
1644 gpio_free(101);
1645error2:
1646 gpio_free(100);
1647error1:
1648 regulator_disable(reg_8921_l23);
1649 return rc;
1650}
1651
1652static int hdmi_cec_power(int on)
1653{
1654 static int prev_on;
1655 int rc;
1656
1657 if (on == prev_on)
1658 return 0;
1659
1660 if (on) {
1661 rc = gpio_request(99, "HDMI_CEC_VAR");
1662 if (rc) {
1663 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1664 "HDMI_CEC_VAR", 99, rc);
1665 goto error;
1666 }
1667 pr_debug("%s(on): success\n", __func__);
1668 } else {
1669 gpio_free(99);
1670 pr_debug("%s(off): success\n", __func__);
1671 }
1672
1673 prev_on = on;
1674
1675 return 0;
1676error:
1677 return rc;
1678}
1679#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1680
1681static void __init msm8960_allocate_memory_regions(void)
1682{
1683 void *addr;
1684 unsigned long size;
1685
1686 size = MSM_FB_SIZE;
1687 addr = alloc_bootmem_align(size, 0x1000);
1688 msm_fb_resources[0].start = __pa(addr);
1689 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1690 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1691 size, addr, __pa(addr));
1692
1693}
1694#ifdef CONFIG_WCD9310_CODEC
1695
1696#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1697
1698static struct tabla_pdata tabla_platform_data = {
1699 .slimbus_slave_device = {
1700 .name = "tabla-slave",
1701 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1702 },
1703 .irq = MSM_GPIO_TO_INT(62),
1704 .irq_base = TABLA_INTERRUPT_BASE,
1705 .num_irqs = NR_TABLA_IRQS,
1706 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1707};
1708
1709static struct slim_device msm_slim_tabla = {
1710 .name = "tabla-slim",
1711 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1712 .dev = {
1713 .platform_data = &tabla_platform_data,
1714 },
1715};
1716#endif
1717
1718static struct slim_boardinfo msm_slim_devices[] = {
1719#ifdef CONFIG_WCD9310_CODEC
1720 {
1721 .bus_num = 1,
1722 .slim_slave = &msm_slim_tabla,
1723 },
1724#endif
1725 /* add more slimbus slaves as needed */
1726};
1727
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001728#define MSM_WCNSS_PHYS 0x03000000
1729#define MSM_WCNSS_SIZE 0x280000
1730
1731static struct resource resources_wcnss_wlan[] = {
1732 {
1733 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1734 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1735 .name = "wcnss_wlanrx_irq",
1736 .flags = IORESOURCE_IRQ,
1737 },
1738 {
1739 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1740 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1741 .name = "wcnss_wlantx_irq",
1742 .flags = IORESOURCE_IRQ,
1743 },
1744 {
1745 .start = MSM_WCNSS_PHYS,
1746 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1747 .name = "wcnss_mmio",
1748 .flags = IORESOURCE_MEM,
1749 },
1750};
1751
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001752static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1753 .has_48mhz_xo = 1,
1754};
1755
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001756static struct platform_device msm_device_wcnss_wlan = {
1757 .name = "wcnss_wlan",
1758 .id = 0,
1759 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1760 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07001761 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001762};
1763
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1765 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1766 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1767 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1768
1769#define QCE_SIZE 0x10000
1770#define QCE_0_BASE 0x18500000
1771
1772#define QCE_HW_KEY_SUPPORT 0
1773#define QCE_SHA_HMAC_SUPPORT 1
1774#define QCE_SHARE_CE_RESOURCE 1
1775#define QCE_CE_SHARED 0
1776
1777static struct resource qcrypto_resources[] = {
1778 [0] = {
1779 .start = QCE_0_BASE,
1780 .end = QCE_0_BASE + QCE_SIZE - 1,
1781 .flags = IORESOURCE_MEM,
1782 },
1783 [1] = {
1784 .name = "crypto_channels",
1785 .start = DMOV_CE_IN_CHAN,
1786 .end = DMOV_CE_OUT_CHAN,
1787 .flags = IORESOURCE_DMA,
1788 },
1789 [2] = {
1790 .name = "crypto_crci_in",
1791 .start = DMOV_CE_IN_CRCI,
1792 .end = DMOV_CE_IN_CRCI,
1793 .flags = IORESOURCE_DMA,
1794 },
1795 [3] = {
1796 .name = "crypto_crci_out",
1797 .start = DMOV_CE_OUT_CRCI,
1798 .end = DMOV_CE_OUT_CRCI,
1799 .flags = IORESOURCE_DMA,
1800 },
1801};
1802
1803static struct resource qcedev_resources[] = {
1804 [0] = {
1805 .start = QCE_0_BASE,
1806 .end = QCE_0_BASE + QCE_SIZE - 1,
1807 .flags = IORESOURCE_MEM,
1808 },
1809 [1] = {
1810 .name = "crypto_channels",
1811 .start = DMOV_CE_IN_CHAN,
1812 .end = DMOV_CE_OUT_CHAN,
1813 .flags = IORESOURCE_DMA,
1814 },
1815 [2] = {
1816 .name = "crypto_crci_in",
1817 .start = DMOV_CE_IN_CRCI,
1818 .end = DMOV_CE_IN_CRCI,
1819 .flags = IORESOURCE_DMA,
1820 },
1821 [3] = {
1822 .name = "crypto_crci_out",
1823 .start = DMOV_CE_OUT_CRCI,
1824 .end = DMOV_CE_OUT_CRCI,
1825 .flags = IORESOURCE_DMA,
1826 },
1827};
1828
1829#endif
1830
1831#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1832 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1833
1834static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1835 .ce_shared = QCE_CE_SHARED,
1836 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1837 .hw_key_support = QCE_HW_KEY_SUPPORT,
1838 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1839};
1840
1841static struct platform_device qcrypto_device = {
1842 .name = "qcrypto",
1843 .id = 0,
1844 .num_resources = ARRAY_SIZE(qcrypto_resources),
1845 .resource = qcrypto_resources,
1846 .dev = {
1847 .coherent_dma_mask = DMA_BIT_MASK(32),
1848 .platform_data = &qcrypto_ce_hw_suppport,
1849 },
1850};
1851#endif
1852
1853#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1854 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1855
1856static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1857 .ce_shared = QCE_CE_SHARED,
1858 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1859 .hw_key_support = QCE_HW_KEY_SUPPORT,
1860 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1861};
1862
1863static struct platform_device qcedev_device = {
1864 .name = "qce",
1865 .id = 0,
1866 .num_resources = ARRAY_SIZE(qcedev_resources),
1867 .resource = qcedev_resources,
1868 .dev = {
1869 .coherent_dma_mask = DMA_BIT_MASK(32),
1870 .platform_data = &qcedev_ce_hw_suppport,
1871 },
1872};
1873#endif
1874
1875
1876static int __init gpiomux_init(void)
1877{
1878 int rc;
1879
1880 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1881 if (rc) {
1882 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1883 return rc;
1884 }
1885
1886 msm_gpiomux_install(msm8960_cam_configs,
1887 ARRAY_SIZE(msm8960_cam_configs));
1888
1889 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07001890 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001891
1892 msm_gpiomux_install(msm8960_gsbi_configs,
1893 ARRAY_SIZE(msm8960_gsbi_configs));
1894
1895 msm_gpiomux_install(msm8960_cyts_configs,
1896 ARRAY_SIZE(msm8960_cyts_configs));
1897
1898 msm_gpiomux_install(msm8960_slimbus_config,
1899 ARRAY_SIZE(msm8960_slimbus_config));
1900
1901 msm_gpiomux_install(msm8960_audio_codec_configs,
1902 ARRAY_SIZE(msm8960_audio_codec_configs));
1903
1904#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1905 msm_gpiomux_install(msm8960_hdmi_configs,
1906 ARRAY_SIZE(msm8960_hdmi_configs));
1907#endif
1908
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001909 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1910 ARRAY_SIZE(msm8960_mdp_vsync_configs));
1911
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001912 msm_gpiomux_install(wcnss_5wire_interface,
1913 ARRAY_SIZE(wcnss_5wire_interface));
1914
1915 return 0;
1916}
1917
1918static struct msm_acpu_clock_platform_data msm8960_acpu_clock_data = {
1919 .acpu_switch_time_us = 0,
1920 .vdd_switch_time_us = 0,
1921};
1922
1923#define MSM_SHARED_RAM_PHYS 0x80000000
1924
1925static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
1926 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
1927 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1928 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
1929 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1930 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
1931 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1932 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
1933 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1934 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
1935 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1936 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
1937 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1938 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
1939 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1940 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
1941 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1942 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
1943 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
1944 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
1945 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1946 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
1947 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1948 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1949 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
1950 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
1951 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1952 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
1953 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1954 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1955 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1956};
1957
1958static struct pm8921_adc_properties pm8921_adc_data = {
1959 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
1960 .bitresolution = 15,
1961 .bipolar = 0,
1962};
1963
1964static struct pm8921_adc_platform_data pm8921_adc_pdata = {
1965 .adc_channel = pm8921_adc_channels_data,
1966 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
1967 .adc_prop = &pm8921_adc_data,
1968};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001969
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001970static void __init msm8960_map_io(void)
1971{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001972 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001973 msm_map_msm8960_io();
1974}
1975
1976static void __init msm8960_init_irq(void)
1977{
1978 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001979
1980 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001981 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001983
1984 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001985 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001986
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001987 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
1988 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08001989
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001990 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
1991 * as they are configured as level, which does not play nice with
1992 * handle_percpu_irq.
1993 */
1994 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
1995 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01001996 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001997 }
1998}
1999
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002000/* MSM8960 have 5 SDCC controllers */
2001enum sdcc_controllers {
2002 SDCC1,
2003 SDCC2,
2004 SDCC3,
2005 SDCC4,
2006 SDCC5,
2007 MAX_SDCC_CONTROLLER
2008};
2009
2010/* All SDCC controllers requires VDD/VCC voltage */
2011static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2012 /* SDCC1 : eMMC card connected */
2013 [SDCC1] = {
2014 .name = "sdc_vdd",
2015 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302016 .high_vol_level = 2950000,
2017 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002018 .hpm_uA = 200000, /* 200mA */
2019 },
2020 /* SDCC3 : External card slot connected */
2021 [SDCC3] = {
2022 .name = "sdc_vdd",
2023 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302024 .high_vol_level = 2950000,
2025 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002026 .hpm_uA = 600000, /* 600mA */
2027 }
2028};
2029
2030/* Only slots having eMMC card will require VCCQ voltage */
2031static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2032 /* SDCC1 : eMMC card connected */
2033 [SDCC1] = {
2034 .name = "sdc_vccq",
2035 .set_voltage_sup = 1,
2036 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302037 .high_vol_level = 1800000,
2038 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002039 .hpm_uA = 200000, /* 200mA */
2040 }
2041};
2042
2043/* All SDCC controllers may require voting for VDD PAD voltage */
2044static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2045 /* SDCC3 : External card slot connected */
2046 [SDCC3] = {
2047 .name = "sdc_vddp",
2048 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302049 .high_vol_level = 2950000,
2050 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002051 .always_on = 1,
2052 .lpm_sup = 1,
2053 /* Max. Active current required is 16 mA */
2054 .hpm_uA = 16000,
2055 /*
2056 * Sleep current required is ~300 uA. But min. vote can be
2057 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2058 * during sleep.
2059 */
2060 .lpm_uA = 2000,
2061 }
2062};
2063
2064static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2065 /* SDCC1 : eMMC card connected */
2066 [SDCC1] = {
2067 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2068 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2069 },
2070 /* SDCC3 : External card slot connected */
2071 [SDCC3] = {
2072 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2073 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2074 }
2075};
2076
2077/* SDC1 pad data */
2078static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2079 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
2080 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2081 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
2082};
2083
2084static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2085 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2086 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2087 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2088};
2089
2090static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
2091 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2092 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2093};
2094
2095static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
2096 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2097 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2098};
2099
2100/* SDC3 pad data */
2101static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2102 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2103 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2104 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2105};
2106
2107static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2108 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2109 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2110 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2111};
2112
2113static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
2114 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2115 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2116};
2117
2118static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
2119 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2120 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2121};
2122
2123struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2124 [SDCC1] = {
2125 .on = sdc1_pad_pull_on_cfg,
2126 .off = sdc1_pad_pull_off_cfg,
2127 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2128 },
2129 [SDCC3] = {
2130 .on = sdc3_pad_pull_on_cfg,
2131 .off = sdc3_pad_pull_off_cfg,
2132 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2133 },
2134};
2135
2136struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2137 [SDCC1] = {
2138 .on = sdc1_pad_drv_on_cfg,
2139 .off = sdc1_pad_drv_off_cfg,
2140 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2141 },
2142 [SDCC3] = {
2143 .on = sdc3_pad_drv_on_cfg,
2144 .off = sdc3_pad_drv_off_cfg,
2145 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2146 },
2147};
2148
2149struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2150 [SDCC1] = {
2151 .pull = &mmc_pad_pull_data[SDCC1],
2152 .drv = &mmc_pad_drv_data[SDCC1]
2153 },
2154 [SDCC3] = {
2155 .pull = &mmc_pad_pull_data[SDCC3],
2156 .drv = &mmc_pad_drv_data[SDCC3]
2157 },
2158};
2159
2160struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2161 [SDCC1] = {
2162 .pad_data = &mmc_pad_data[SDCC1],
2163 },
2164 [SDCC3] = {
2165 .pad_data = &mmc_pad_data[SDCC3],
2166 },
2167};
2168
2169static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002170 400000, 24000000, 48000000, 96000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002171};
2172
2173static unsigned int sdc3_sup_clk_rates[] = {
2174 400000, 24000000, 48000000, 96000000
2175};
2176
2177#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2178static struct mmc_platform_data msm8960_sdc1_data = {
2179 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2180#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2181 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2182#else
2183 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2184#endif
2185 .sup_clk_table = sdc1_sup_clk_rates,
2186 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2187 .nonremovable = 1,
2188 .sdcc_v4_sup = true,
2189 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002190 .pin_data = &mmc_slot_pin_data[SDCC1],
2191 .uhs_caps = MMC_CAP_1_8V_DDR
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002192};
2193#endif
2194
2195#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2196static struct mmc_platform_data msm8960_sdc3_data = {
2197 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2198 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2199 .sup_clk_table = sdc3_sup_clk_rates,
2200 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
2201 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
2202 .sdcc_v4_sup = true,
2203 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2204 .pin_data = &mmc_slot_pin_data[SDCC3],
2205#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2206 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2207 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2208 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2209#endif
2210 .xpc_cap = 1,
2211 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2212 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002213 MMC_CAP_MAX_CURRENT_600 | MMC_CAP_1_8V_DDR)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002214};
2215#endif
2216
2217static void __init msm8960_init_mmc(void)
2218{
2219#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2220 /* SDC1 : eMMC card connected */
2221 msm_add_sdcc(1, &msm8960_sdc1_data);
2222#endif
2223#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2224 /* SDC3: External card slot */
2225 msm_add_sdcc(3, &msm8960_sdc3_data);
2226#endif
2227}
2228
2229static void __init msm8960_init_buses(void)
2230{
2231#ifdef CONFIG_MSM_BUS_SCALING
2232 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2233 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2234 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2235 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2236 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2237 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2238 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2239 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2240 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2241 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2242#endif
2243}
2244
2245static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2246 .max_clock_speed = 15060000,
2247};
2248
2249#ifdef CONFIG_USB_MSM_OTG_72K
2250static struct msm_otg_platform_data msm_otg_pdata;
2251#else
2252#define USB_5V_EN 42
2253static void msm_hsusb_vbus_power(bool on)
2254{
2255 int rc;
2256 static bool vbus_is_on;
2257 static struct regulator *mvs_otg_switch;
2258 struct pm_gpio param = {
2259 .direction = PM_GPIO_DIR_OUT,
2260 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2261 .output_value = 1,
2262 .pull = PM_GPIO_PULL_NO,
2263 .vin_sel = PM_GPIO_VIN_S4,
2264 .out_strength = PM_GPIO_STRENGTH_MED,
2265 .function = PM_GPIO_FUNC_NORMAL,
2266 };
2267
2268 if (vbus_is_on == on)
2269 return;
2270
2271 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002272 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2273 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002274 if (IS_ERR(mvs_otg_switch)) {
2275 pr_err("Unable to get mvs_otg_switch\n");
2276 return;
2277 }
2278
2279 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2280 "usb_5v_en");
2281 if (rc < 0) {
2282 pr_err("failed to request usb_5v_en gpio\n");
2283 goto put_mvs_otg;
2284 }
2285
2286 if (regulator_enable(mvs_otg_switch)) {
2287 pr_err("unable to enable mvs_otg_switch\n");
2288 goto free_usb_5v_en;
2289 }
2290
2291 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2292 &param);
2293 if (rc < 0) {
2294 pr_err("failed to configure usb_5v_en gpio\n");
2295 goto disable_mvs_otg;
2296 }
2297 vbus_is_on = true;
2298 return;
2299 }
2300disable_mvs_otg:
2301 regulator_disable(mvs_otg_switch);
2302free_usb_5v_en:
2303 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2304put_mvs_otg:
2305 regulator_put(mvs_otg_switch);
2306 vbus_is_on = false;
2307}
2308
2309static struct msm_otg_platform_data msm_otg_pdata = {
2310 .mode = USB_OTG,
2311 .otg_control = OTG_PMIC_CONTROL,
2312 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2313 .pclk_src_name = "dfab_usb_hs_clk",
2314 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2315 .vbus_power = msm_hsusb_vbus_power,
2316};
2317#endif
2318
2319#define PID_MAGIC_ID 0x71432909
2320#define SERIAL_NUM_MAGIC_ID 0x61945374
2321#define SERIAL_NUMBER_LENGTH 127
2322#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2323
2324struct magic_num_struct {
2325 uint32_t pid;
2326 uint32_t serial_num;
2327};
2328
2329struct dload_struct {
2330 uint32_t reserved1;
2331 uint32_t reserved2;
2332 uint32_t reserved3;
2333 uint16_t reserved4;
2334 uint16_t pid;
2335 char serial_number[SERIAL_NUMBER_LENGTH];
2336 uint16_t reserved5;
2337 struct magic_num_struct magic_struct;
2338};
2339
2340static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2341{
2342 struct dload_struct __iomem *dload = 0;
2343
2344 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2345 if (!dload) {
2346 pr_err("%s: cannot remap I/O memory region: %08x\n",
2347 __func__, DLOAD_USB_BASE_ADD);
2348 return -ENXIO;
2349 }
2350
2351 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2352 __func__, dload, pid, snum);
2353 /* update pid */
2354 dload->magic_struct.pid = PID_MAGIC_ID;
2355 dload->pid = pid;
2356
2357 /* update serial number */
2358 dload->magic_struct.serial_num = 0;
2359 if (!snum) {
2360 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2361 goto out;
2362 }
2363
2364 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2365 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2366 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2367out:
2368 iounmap(dload);
2369 return 0;
2370}
2371
2372static struct android_usb_platform_data android_usb_pdata = {
2373 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2374};
2375
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002376static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002377 .name = "android_usb",
2378 .id = -1,
2379 .dev = {
2380 .platform_data = &android_usb_pdata,
2381 },
2382};
2383
2384static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2385 0x03, 0x0f,
2386};
2387
2388static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2389 0x00, 0x24, 0x54, 0x10,
2390 0x09, 0x03, 0x01,
2391 0x10, 0x54, 0x30, 0x0C,
2392 0x24, 0x30, 0x0f,
2393};
2394
2395static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2396 0x00, 0x24, 0x54, 0x10,
2397 0x09, 0x07, 0x01, 0x0B,
2398 0x10, 0x54, 0x30, 0x0C,
2399 0x24, 0x30, 0x0f,
2400};
2401
2402static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2403 [0] = {
2404 .mode = MSM_SPM_MODE_CLOCK_GATING,
2405 .notify_rpm = false,
2406 .cmd = spm_wfi_cmd_sequence,
2407 },
2408 [1] = {
2409 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2410 .notify_rpm = false,
2411 .cmd = spm_power_collapse_without_rpm,
2412 },
2413 [2] = {
2414 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2415 .notify_rpm = true,
2416 .cmd = spm_power_collapse_with_rpm,
2417 },
2418};
2419
2420static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2421 [0] = {
2422 .reg_base_addr = MSM_SAW0_BASE,
2423 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2424 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2425 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2426#if defined(CONFIG_MSM_AVS_HW)
2427 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2428 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2429#endif
2430 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2431 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2432 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2433 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2434 .vctl_timeout_us = 50,
2435 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2436 .modes = msm_spm_seq_list,
2437 },
2438 [1] = {
2439 .reg_base_addr = MSM_SAW1_BASE,
2440 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2441 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2442 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2443#if defined(CONFIG_MSM_AVS_HW)
2444 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2445 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2446#endif
2447 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2448 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2449 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2450 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2451 .vctl_timeout_us = 50,
2452 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2453 .modes = msm_spm_seq_list,
2454 },
2455};
2456
2457static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2458 0x00, 0x20, 0x03, 0x20,
2459 0x00, 0x0f,
2460};
2461
2462static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2463 0x00, 0x20, 0x34, 0x64,
2464 0x48, 0x07, 0x48, 0x20,
2465 0x50, 0x64, 0x04, 0x34,
2466 0x50, 0x0f,
2467};
2468static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2469 0x00, 0x10, 0x34, 0x64,
2470 0x48, 0x07, 0x48, 0x10,
2471 0x50, 0x64, 0x04, 0x34,
2472 0x50, 0x0F,
2473};
2474
2475static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2476 [0] = {
2477 .mode = MSM_SPM_L2_MODE_RETENTION,
2478 .notify_rpm = false,
2479 .cmd = l2_spm_wfi_cmd_sequence,
2480 },
2481 [1] = {
2482 .mode = MSM_SPM_L2_MODE_GDHS,
2483 .notify_rpm = true,
2484 .cmd = l2_spm_gdhs_cmd_sequence,
2485 },
2486 [2] = {
2487 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2488 .notify_rpm = true,
2489 .cmd = l2_spm_power_off_cmd_sequence,
2490 },
2491};
2492
2493
2494static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2495 [0] = {
2496 .reg_base_addr = MSM_SAW_L2_BASE,
2497 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2498 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2499 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2500 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2501 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2502 .modes = msm_spm_l2_seq_list,
2503 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2504 },
2505};
2506
2507#define CYTTSP_TS_GPIO_IRQ 11
2508#define CYTTSP_TS_SLEEP_GPIO 50
2509#define CYTTSP_TS_RESOUT_N_GPIO 52
2510
2511/*virtual key support */
2512static ssize_t tma340_vkeys_show(struct kobject *kobj,
2513 struct kobj_attribute *attr, char *buf)
2514{
2515 return snprintf(buf, 200,
2516 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2517 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2518 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2519 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2520 "\n");
2521}
2522
2523static struct kobj_attribute tma340_vkeys_attr = {
2524 .attr = {
2525 .mode = S_IRUGO,
2526 },
2527 .show = &tma340_vkeys_show,
2528};
2529
2530static struct attribute *tma340_properties_attrs[] = {
2531 &tma340_vkeys_attr.attr,
2532 NULL
2533};
2534
2535static struct attribute_group tma340_properties_attr_group = {
2536 .attrs = tma340_properties_attrs,
2537};
2538
2539
2540static int cyttsp_platform_init(struct i2c_client *client)
2541{
2542 int rc = 0;
2543 static struct kobject *tma340_properties_kobj;
2544
2545 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2546 tma340_properties_kobj = kobject_create_and_add("board_properties",
2547 NULL);
2548 if (tma340_properties_kobj)
2549 rc = sysfs_create_group(tma340_properties_kobj,
2550 &tma340_properties_attr_group);
2551 if (!tma340_properties_kobj || rc)
2552 pr_err("%s: failed to create board_properties\n",
2553 __func__);
2554
2555 return 0;
2556}
2557
2558static struct cyttsp_regulator regulator_data[] = {
2559 {
2560 .name = "vdd",
2561 .min_uV = CY_TMA300_VTG_MIN_UV,
2562 .max_uV = CY_TMA300_VTG_MAX_UV,
2563 .load_uA = CY_TMA300_CURR_24HZ_UA,
2564 },
2565 /* TODO: Remove after runtime PM is enabled in I2C driver */
2566 {
2567 .name = "vcc_i2c",
2568 .min_uV = CY_I2C_VTG_MIN_UV,
2569 .max_uV = CY_I2C_VTG_MAX_UV,
2570 .load_uA = CY_I2C_CURR_UA,
2571 },
2572};
2573
2574static struct cyttsp_platform_data cyttsp_pdata = {
2575 .panel_maxx = 634,
2576 .panel_maxy = 1166,
2577 .disp_maxx = 616,
2578 .disp_maxy = 1023,
2579 .disp_minx = 0,
2580 .disp_miny = 16,
2581 .flags = 0x01,
2582 .gen = CY_GEN3, /* or */
2583 .use_st = CY_USE_ST,
2584 .use_mt = CY_USE_MT,
2585 .use_hndshk = CY_SEND_HNDSHK,
2586 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayal15187772011-06-22 17:39:41 +05302587 .use_sleep = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002588 .use_gestures = CY_USE_GESTURES,
2589 .fw_fname = "cyttsp_8960_cdp.hex",
2590 /* activate up to 4 groups
2591 * and set active distance
2592 */
2593 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2594 CY_GEST_GRP3 | CY_GEST_GRP4 |
2595 CY_ACT_DIST,
2596 /* change act_intrvl to customize the Active power state
2597 * scanning/processing refresh interval for Operating mode
2598 */
2599 .act_intrvl = CY_ACT_INTRVL_DFLT,
2600 /* change tch_tmout to customize the touch timeout for the
2601 * Active power state for Operating mode
2602 */
2603 .tch_tmout = CY_TCH_TMOUT_DFLT,
2604 /* change lp_intrvl to customize the Low Power power state
2605 * scanning/processing refresh interval for Operating mode
2606 */
2607 .lp_intrvl = CY_LP_INTRVL_DFLT,
2608 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2609 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2610 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2611 .regulator_info = regulator_data,
2612 .num_regulators = ARRAY_SIZE(regulator_data),
2613 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302614 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002615};
2616
2617static struct i2c_board_info cyttsp_info[] __initdata = {
2618 {
2619 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2620 .platform_data = &cyttsp_pdata,
2621#ifndef CY_USE_TIMER
2622 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2623#endif /* CY_USE_TIMER */
2624 },
2625};
2626
2627static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
2628{
2629}
2630
2631static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2632 .clk_freq = 100000,
2633 .src_clk_rate = 24000000,
2634 .clk = "gsbi_qup_clk",
2635 .pclk = "gsbi_pclk",
2636 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2637};
2638
2639static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2640 .clk_freq = 100000,
2641 .src_clk_rate = 24000000,
2642 .clk = "gsbi_qup_clk",
2643 .pclk = "gsbi_pclk",
2644 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2645};
2646
2647static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2648 .clk_freq = 100000,
2649 .src_clk_rate = 24000000,
2650 .clk = "gsbi_qup_clk",
2651 .pclk = "gsbi_pclk",
2652 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2653};
2654
2655static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2656 .clk_freq = 100000,
2657 .src_clk_rate = 24000000,
2658 .clk = "gsbi_qup_clk",
2659 .pclk = "gsbi_pclk",
2660 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2661};
2662
2663static struct msm_rpm_platform_data msm_rpm_data = {
2664 .reg_base_addrs = {
2665 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
2666 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
2667 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
2668 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
2669 },
2670
2671 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
2672 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
2673 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
2674 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
2675 .msm_apps_ipc_rpm_val = 4,
2676};
2677
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002678static struct platform_device msm_rpm_device = {
2679 .name = "msm_rpm",
2680 .id = -1,
2681};
2682
2683
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002684static struct spi_board_info spi_board_info[] __initdata = {
2685 {
2686 .modalias = "ks8851",
2687 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2688 .max_speed_hz = 19200000,
2689 .bus_num = 0,
2690 .chip_select = 0,
2691 .mode = SPI_MODE_0,
2692 },
2693};
2694
2695static struct platform_device msm_device_saw_core0 = {
2696 .name = "saw-regulator",
2697 .id = 0,
2698 .dev = {
2699 .platform_data = &msm_saw_regulator_pdata_s5,
2700 },
2701};
2702
2703static struct platform_device msm_device_saw_core1 = {
2704 .name = "saw-regulator",
2705 .id = 1,
2706 .dev = {
2707 .platform_data = &msm_saw_regulator_pdata_s6,
2708 },
2709};
2710
2711#ifdef CONFIG_MSM_FAKE_BATTERY
2712static struct platform_device fish_battery_device = {
2713 .name = "fish_battery",
2714};
2715#endif
2716
2717struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
2718 .name = GPIO_REGULATOR_DEV_NAME,
2719 .id = PM8921_MPP_PM_TO_SYS(7),
2720 .dev = {
2721 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2722 },
2723};
2724
2725struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
2726 .name = GPIO_REGULATOR_DEV_NAME,
2727 .id = 91,
2728 .dev = {
2729 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2730 },
2731};
2732
2733static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002734 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002735 &msm_device_smd,
2736 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302737 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002738 &msm_device_saw_core0,
2739 &msm_device_saw_core1,
2740 &msm8960_device_ext_5v_vreg,
2741 &msm8960_device_ext_l2_vreg,
2742 &msm8960_device_ssbi_pm8921,
2743 &msm8960_device_qup_spi_gsbi1,
2744 &msm8960_device_qup_i2c_gsbi3,
2745 &msm8960_device_qup_i2c_gsbi4,
2746 &msm8960_device_qup_i2c_gsbi10,
2747#ifndef CONFIG_MSM_DSPS
2748 &msm8960_device_qup_i2c_gsbi12,
2749#endif
2750 &msm_slim_ctrl,
2751 &msm_device_wcnss_wlan,
2752#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2753 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2754 &qcrypto_device,
2755#endif
2756
2757#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2758 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2759 &qcedev_device,
2760#endif
2761#ifdef CONFIG_MSM_ROTATOR
2762 &msm_rotator_device,
2763#endif
2764 &msm_device_sps,
2765#ifdef CONFIG_MSM_FAKE_BATTERY
2766 &fish_battery_device,
2767#endif
2768#ifdef CONFIG_ANDROID_PMEM
2769 &android_pmem_device,
2770 &android_pmem_adsp_device,
2771 &android_pmem_audio_device,
2772#endif
2773 &msm_fb_device,
2774 &msm_device_vidc,
2775 &msm_device_bam_dmux,
2776 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002777
2778#ifdef CONFIG_HW_RANDOM_MSM
2779 &msm_device_rng,
2780#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002781 &msm_rpm_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002782};
2783
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002784static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002785 &msm8960_device_otg,
2786 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002787 &msm_device_hsusb_host,
2788 &android_usb_device,
2789 &msm_device_vidc,
2790 &mipi_dsi_simulator_panel_device,
2791 &msm_bus_apps_fabric,
2792 &msm_bus_sys_fabric,
2793 &msm_bus_mm_fabric,
2794 &msm_bus_sys_fpb,
2795 &msm_bus_cpss_fpb,
2796 &msm_pcm,
2797 &msm_pcm_routing,
2798 &msm_cpudai0,
2799 &msm_cpudai1,
2800 &msm_cpudai_hdmi_rx,
2801 &msm_cpudai_bt_rx,
2802 &msm_cpudai_bt_tx,
2803 &msm_cpudai_fm_rx,
2804 &msm_cpudai_fm_tx,
2805 &msm_cpu_fe,
2806 &msm_stub_codec,
2807 &msm_voice,
2808 &msm_voip,
2809 &msm_lpa_pcm,
2810
2811#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2812 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2813 &qcrypto_device,
2814#endif
2815
2816#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2817 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2818 &qcedev_device,
2819#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002820};
2821
2822static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002823 &msm_kgsl_3d0,
2824 &msm_kgsl_2d0,
2825 &msm_kgsl_2d1,
2826 &mipi_dsi_renesas_panel_device,
2827#ifdef CONFIG_MSM_GEMINI
2828 &msm8960_gemini_device,
2829#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002830};
2831
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002832static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002833 &msm8960_device_otg,
2834 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002835 &msm_device_hsusb_host,
2836 &android_usb_device,
2837 &msm_pcm,
2838 &msm_pcm_routing,
2839 &msm_cpudai0,
2840 &msm_cpudai1,
2841 &msm_cpudai_hdmi_rx,
2842 &msm_cpudai_bt_rx,
2843 &msm_cpudai_bt_tx,
2844 &msm_cpudai_fm_rx,
2845 &msm_cpudai_fm_tx,
2846 &msm_cpu_fe,
2847 &msm_stub_codec,
2848 &msm_kgsl_3d0,
2849#ifdef CONFIG_MSM_KGSL_2D
2850 &msm_kgsl_2d0,
2851 &msm_kgsl_2d1,
2852#endif
2853 &mipi_dsi_toshiba_panel_device,
2854#ifdef CONFIG_MSM_GEMINI
2855 &msm8960_gemini_device,
2856#endif
2857 &msm_voice,
2858 &msm_voip,
2859 &msm_lpa_pcm,
2860#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2861 &hdmi_msm_device,
2862#endif
2863 &msm_pcm_hostless,
2864 &msm_bus_apps_fabric,
2865 &msm_bus_sys_fabric,
2866 &msm_bus_mm_fabric,
2867 &msm_bus_sys_fpb,
2868 &msm_bus_cpss_fpb,
2869};
2870
2871static void __init msm8960_i2c_init(void)
2872{
2873 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2874 &msm8960_i2c_qup_gsbi4_pdata;
2875
2876 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2877 &msm8960_i2c_qup_gsbi3_pdata;
2878
2879 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2880 &msm8960_i2c_qup_gsbi10_pdata;
2881
2882 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2883 &msm8960_i2c_qup_gsbi12_pdata;
2884}
2885
2886static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
2887 .irq_base = PM8921_IRQ_BASE,
2888 .devirq = MSM_GPIO_TO_INT(104),
2889 .irq_trigger_flag = IRQF_TRIGGER_LOW,
2890};
2891
2892static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
2893 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
2894};
2895
2896static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
2897 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
2898};
2899
2900static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
2901 .rtc_write_enable = false,
2902};
2903
2904static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
2905 .pull_up = 1,
2906 .kpd_trigger_delay_us = 970,
2907 .wakeup = 1,
2908};
2909
2910static const unsigned int keymap[] = {
2911 KEY(0, 0, KEY_VOLUMEUP),
2912 KEY(0, 1, KEY_VOLUMEDOWN),
2913 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
2914 KEY(0, 3, KEY_CAMERA_FOCUS),
2915};
2916
2917static struct matrix_keymap_data keymap_data = {
2918 .keymap_size = ARRAY_SIZE(keymap),
2919 .keymap = keymap,
2920};
2921
2922static struct pm8xxx_keypad_platform_data keypad_data = {
2923 .input_name = "keypad_8960",
2924 .input_phys_device = "keypad_8960/input0",
2925 .num_rows = 1,
2926 .num_cols = 5,
2927 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
2928 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
2929 .debounce_ms = 15,
2930 .scan_delay_ms = 32,
2931 .row_hold_ns = 91500,
2932 .wakeup = 1,
2933 .keymap_data = &keymap_data,
2934};
2935
2936static const unsigned int keymap_sim[] = {
2937 KEY(0, 0, KEY_7),
2938 KEY(0, 1, KEY_DOWN),
2939 KEY(0, 2, KEY_UP),
2940 KEY(0, 3, KEY_RIGHT),
2941 KEY(0, 4, KEY_ENTER),
2942 KEY(0, 5, KEY_L),
2943 KEY(0, 6, KEY_BACK),
2944 KEY(0, 7, KEY_M),
2945
2946 KEY(1, 0, KEY_LEFT),
2947 KEY(1, 1, KEY_SEND),
2948 KEY(1, 2, KEY_1),
2949 KEY(1, 3, KEY_4),
2950 KEY(1, 4, KEY_CLEAR),
2951 KEY(1, 5, KEY_MSDOS),
2952 KEY(1, 6, KEY_SPACE),
2953 KEY(1, 7, KEY_COMMA),
2954
2955 KEY(2, 0, KEY_6),
2956 KEY(2, 1, KEY_5),
2957 KEY(2, 2, KEY_8),
2958 KEY(2, 3, KEY_3),
2959 KEY(2, 4, KEY_NUMERIC_STAR),
2960 KEY(2, 5, KEY_UP),
2961 KEY(2, 6, KEY_DOWN),
2962 KEY(2, 7, KEY_LEFTSHIFT),
2963
2964 KEY(3, 0, KEY_9),
2965 KEY(3, 1, KEY_NUMERIC_POUND),
2966 KEY(3, 2, KEY_0),
2967 KEY(3, 3, KEY_2),
2968 KEY(3, 4, KEY_SLEEP),
2969 KEY(3, 5, KEY_F1),
2970 KEY(3, 6, KEY_F2),
2971 KEY(3, 7, KEY_F3),
2972
2973 KEY(4, 0, KEY_BACK),
2974 KEY(4, 1, KEY_HOME),
2975 KEY(4, 2, KEY_MENU),
2976 KEY(4, 3, KEY_VOLUMEUP),
2977 KEY(4, 4, KEY_VOLUMEDOWN),
2978 KEY(4, 5, KEY_F4),
2979 KEY(4, 6, KEY_F5),
2980 KEY(4, 7, KEY_F6),
2981
2982 KEY(5, 0, KEY_R),
2983 KEY(5, 1, KEY_T),
2984 KEY(5, 2, KEY_Y),
2985 KEY(5, 3, KEY_LEFTALT),
2986 KEY(5, 4, KEY_KPENTER),
2987 KEY(5, 5, KEY_Q),
2988 KEY(5, 6, KEY_W),
2989 KEY(5, 7, KEY_E),
2990
2991 KEY(6, 0, KEY_F),
2992 KEY(6, 1, KEY_G),
2993 KEY(6, 2, KEY_H),
2994 KEY(6, 3, KEY_CAPSLOCK),
2995 KEY(6, 4, KEY_PAGEUP),
2996 KEY(6, 5, KEY_A),
2997 KEY(6, 6, KEY_S),
2998 KEY(6, 7, KEY_D),
2999
3000 KEY(7, 0, KEY_V),
3001 KEY(7, 1, KEY_B),
3002 KEY(7, 2, KEY_N),
3003 KEY(7, 3, KEY_MENU),
3004 KEY(7, 4, KEY_PAGEDOWN),
3005 KEY(7, 5, KEY_Z),
3006 KEY(7, 6, KEY_X),
3007 KEY(7, 7, KEY_C),
3008
3009 KEY(8, 0, KEY_P),
3010 KEY(8, 1, KEY_J),
3011 KEY(8, 2, KEY_K),
3012 KEY(8, 3, KEY_INSERT),
3013 KEY(8, 4, KEY_LINEFEED),
3014 KEY(8, 5, KEY_U),
3015 KEY(8, 6, KEY_I),
3016 KEY(8, 7, KEY_O),
3017
3018 KEY(9, 0, KEY_4),
3019 KEY(9, 1, KEY_5),
3020 KEY(9, 2, KEY_6),
3021 KEY(9, 3, KEY_7),
3022 KEY(9, 4, KEY_8),
3023 KEY(9, 5, KEY_1),
3024 KEY(9, 6, KEY_2),
3025 KEY(9, 7, KEY_3),
3026
3027 KEY(10, 0, KEY_F7),
3028 KEY(10, 1, KEY_F8),
3029 KEY(10, 2, KEY_F9),
3030 KEY(10, 3, KEY_F10),
3031 KEY(10, 4, KEY_FN),
3032 KEY(10, 5, KEY_9),
3033 KEY(10, 6, KEY_0),
3034 KEY(10, 7, KEY_DOT),
3035
3036 KEY(11, 0, KEY_LEFTCTRL),
3037 KEY(11, 1, KEY_F11),
3038 KEY(11, 2, KEY_ENTER),
3039 KEY(11, 3, KEY_SEARCH),
3040 KEY(11, 4, KEY_DELETE),
3041 KEY(11, 5, KEY_RIGHT),
3042 KEY(11, 6, KEY_LEFT),
3043 KEY(11, 7, KEY_RIGHTSHIFT),
3044 KEY(0, 0, KEY_VOLUMEUP),
3045 KEY(0, 1, KEY_VOLUMEDOWN),
3046 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3047 KEY(0, 3, KEY_CAMERA_FOCUS),
3048};
3049
3050static struct matrix_keymap_data keymap_data_sim = {
3051 .keymap_size = ARRAY_SIZE(keymap_sim),
3052 .keymap = keymap_sim,
3053};
3054
3055static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3056 .input_name = "keypad_8960",
3057 .input_phys_device = "keypad_8960/input0",
3058 .num_rows = 12,
3059 .num_cols = 8,
3060 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3061 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3062 .debounce_ms = 15,
3063 .scan_delay_ms = 32,
3064 .row_hold_ns = 91500,
3065 .wakeup = 1,
3066 .keymap_data = &keymap_data_sim,
3067};
3068
3069static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
3070 .safety_time = 180,
3071 .update_time = 1,
3072 .max_voltage = 4200,
3073 .min_voltage = 3200,
3074 .resume_voltage = 4100,
3075 .term_current = 100,
3076};
3077
3078static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3079 .priority = 0,
3080};
3081
3082static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3083 .r_sense = 10,
3084 .i_test = 2500,
3085 .v_failure = 3000,
3086 .calib_delay_ms = 600000,
3087 .batt_data = &palladium_1500_data,
3088};
3089
3090static struct led_info pm8921_led_info[] = {
3091 [0] = {
3092 .name = "led:drv1",
3093 .flags = PM8XXX_ID_LED_1,
3094 },
3095};
3096
3097static struct led_platform_data pm8xxx_leds_pdata = {
3098 .num_leds = ARRAY_SIZE(pm8921_led_info),
3099 .leds = pm8921_led_info,
3100};
3101
3102static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3103 .irq_pdata = &pm8xxx_irq_pdata,
3104 .gpio_pdata = &pm8xxx_gpio_pdata,
3105 .mpp_pdata = &pm8xxx_mpp_pdata,
3106 .rtc_pdata = &pm8xxx_rtc_pdata,
3107 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3108 .keypad_pdata = &keypad_data,
3109 .misc_pdata = &pm8xxx_misc_pdata,
3110 .regulator_pdatas = msm_pm8921_regulator_pdata,
3111 .charger_pdata = &pm8921_chg_pdata,
3112 .bms_pdata = &pm8921_bms_pdata,
3113 .adc_pdata = &pm8921_adc_pdata,
3114 .leds_pdata = &pm8xxx_leds_pdata,
3115};
3116
3117static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3118 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3119 .slave = {
3120 .name = "pm8921-core",
3121 .platform_data = &pm8921_platform_data,
3122 },
3123};
3124
3125static void msm8960_wcnss_init(void)
3126{
3127 int i, ret, j;
3128
3129 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3130 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3131 "wcnss_5_wire");
3132 if (ret) {
3133 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3134 wcnss_5wire_interface[i].gpio, ret);
3135 goto fail;
3136 }
3137 }
3138
3139 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3140
3141 return;
3142
3143fail:
3144 for (j = 0; j < i; j++)
3145 gpio_free(wcnss_5wire_interface[j].gpio);
3146}
3147
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003148#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003149static int ethernet_init(void)
3150{
3151 int ret;
3152 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3153 if (ret) {
3154 pr_err("ks8851 gpio_request failed: %d\n", ret);
3155 goto fail;
3156 }
3157
3158 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3159 if (ret) {
3160 pr_err("ks8851 gpio_request failed: %d\n", ret);
3161 goto fail_rst;
3162 }
3163
3164 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3165 if (ret) {
3166 pr_err("ks8851 gpio_request failed: %d\n", ret);
3167 goto fail_cs;
3168 }
3169
3170 gpio_direction_output(FPGA_CS_GPIO, 1);
3171 gpio_direction_output(KS8851_RST_GPIO, 1);
3172 return 0;
3173fail_cs:
3174 gpio_free(KS8851_RST_GPIO);
3175fail_rst:
3176 gpio_free(KS8851_IRQ_GPIO);
3177fail:
3178 return ret;
3179}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003180#else
3181static int ethernet_init(void)
3182{
3183 return 0;
3184}
3185#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003186
3187static struct msm_cpuidle_state msm_cstates[] __initdata = {
3188 {0, 0, "C0", "WFI",
3189 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3190
3191 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3192 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3193
3194 {0, 2, "C2", "POWER_COLLAPSE",
3195 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3196
3197 {1, 0, "C0", "WFI",
3198 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3199
3200 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3201 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3202};
3203
3204static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3205 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3206 .idle_supported = 1,
3207 .suspend_supported = 1,
3208 .idle_enabled = 0,
3209 .suspend_enabled = 0,
3210 .latency = 4000,
3211 .residency = 13000,
3212 },
3213
3214 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3215 .idle_supported = 1,
3216 .suspend_supported = 1,
3217 .idle_enabled = 0,
3218 .suspend_enabled = 0,
3219 .latency = 500,
3220 .residency = 6000,
3221 },
3222
3223 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3224 .idle_supported = 1,
3225 .suspend_supported = 1,
3226 .idle_enabled = 1,
3227 .suspend_enabled = 1,
3228 .latency = 2,
3229 .residency = 0,
3230 },
3231
3232 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3233 .idle_supported = 0,
3234 .suspend_supported = 1,
3235 .idle_enabled = 0,
3236 .suspend_enabled = 0,
3237 .latency = 600,
3238 .residency = 7200,
3239 },
3240
3241 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3242 .idle_supported = 1,
3243 .suspend_supported = 1,
3244 .idle_enabled = 0,
3245 .suspend_enabled = 0,
3246 .latency = 500,
3247 .residency = 6000,
3248 },
3249
3250 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3251 .idle_supported = 1,
3252 .suspend_supported = 0,
3253 .idle_enabled = 1,
3254 .suspend_enabled = 0,
3255 .latency = 2,
3256 .residency = 0,
3257 },
3258};
3259
3260static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3261 {
3262 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3263 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3264 true,
3265 1, 8000, 100000, 1,
3266 },
3267
3268 {
3269 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3270 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3271 true,
3272 1500, 5000, 60100000, 3000,
3273 },
3274
3275 {
3276 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3277 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3278 false,
3279 1800, 5000, 60350000, 3500,
3280 },
3281
3282 {
3283 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3284 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3285 false,
3286 2800, 2500, 65350000, 4800,
3287 },
3288
3289 {
3290 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3291 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3292 false,
3293 3800, 4500, 67850000, 5500,
3294 },
3295
3296 {
3297 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3298 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3299 false,
3300 4800, 2000, 71850000, 6800,
3301 },
3302
3303 {
3304 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3305 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3306 false,
3307 6800, 500, 75850000, 8800,
3308 },
3309
3310 {
3311 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3312 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3313 false,
3314 7800, 0, 76350000, 9800,
3315 },
3316};
3317
3318#ifdef CONFIG_I2C
3319#define I2C_SURF 1
3320#define I2C_FFA (1 << 1)
3321#define I2C_RUMI (1 << 2)
3322#define I2C_SIM (1 << 3)
3323#define I2C_FLUID (1 << 4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003324
3325struct i2c_registry {
3326 u8 machs;
3327 int bus;
3328 struct i2c_board_info *info;
3329 int len;
3330};
3331
3332#ifdef CONFIG_MSM_CAMERA
3333static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3334#ifdef CONFIG_IMX074
3335 {
3336 I2C_BOARD_INFO("imx074", 0x1A),
3337 },
3338#endif
3339#ifdef CONFIG_OV2720
3340 {
3341 I2C_BOARD_INFO("ov2720", 0x6C),
3342 },
3343#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003344 {
3345 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3346 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303347#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3348 {
3349 I2C_BOARD_INFO("sc628a", 0x6E),
3350 },
3351#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003352};
3353#endif
3354
3355/* Sensors DSPS platform data */
3356#ifdef CONFIG_MSM_DSPS
3357#define DSPS_PIL_GENERIC_NAME "dsps"
3358#endif /* CONFIG_MSM_DSPS */
3359
3360static void __init msm8960_init_dsps(void)
3361{
3362#ifdef CONFIG_MSM_DSPS
3363 struct msm_dsps_platform_data *pdata =
3364 msm_dsps_device.dev.platform_data;
3365 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3366 pdata->gpios = NULL;
3367 pdata->gpios_num = 0;
3368
3369 platform_device_register(&msm_dsps_device);
3370#endif /* CONFIG_MSM_DSPS */
3371}
3372
3373static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3374#ifdef CONFIG_MSM_CAMERA
3375 {
3376 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_RUMI,
3377 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3378 msm_camera_boardinfo,
3379 ARRAY_SIZE(msm_camera_boardinfo),
3380 },
3381#endif
3382 {
3383 I2C_SURF | I2C_FFA | I2C_FLUID,
3384 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3385 cyttsp_info,
3386 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003387 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003388};
3389#endif /* CONFIG_I2C */
3390
3391static void __init register_i2c_devices(void)
3392{
3393#ifdef CONFIG_I2C
3394 u8 mach_mask = 0;
3395 int i;
3396
3397 /* Build the matching 'supported_machs' bitmask */
3398 if (machine_is_msm8960_cdp())
3399 mach_mask = I2C_SURF;
3400 else if (machine_is_msm8960_rumi3())
3401 mach_mask = I2C_RUMI;
3402 else if (machine_is_msm8960_sim())
3403 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003404 else if (machine_is_msm8960_fluid())
3405 mach_mask = I2C_FLUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003406 else if (machine_is_msm8960_mtp())
3407 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003408 else
3409 pr_err("unmatched machine ID in register_i2c_devices\n");
3410
3411 /* Run the array and install devices as appropriate */
3412 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3413 if (msm8960_i2c_devices[i].machs & mach_mask)
3414 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3415 msm8960_i2c_devices[i].info,
3416 msm8960_i2c_devices[i].len);
3417 }
3418#endif
3419}
3420
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003421static void __init msm8960_sim_init(void)
3422{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003423 if (socinfo_init() < 0)
3424 pr_err("socinfo_init() failed!\n");
3425
3426 BUG_ON(msm_rpm_init(&msm_rpm_data));
3427 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3428 ARRAY_SIZE(msm_rpmrs_levels)));
3429 regulator_suppress_info_printing();
Stephen Boydbb600ae2011-08-02 20:11:40 -07003430 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003431 msm8960_device_ssbi_pm8921.dev.platform_data =
3432 &msm8960_ssbi_pm8921_pdata;
3433 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003434
3435 /* Simulator supports a QWERTY keypad */
3436 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
3437
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003438 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3439 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3440 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003441 gpiomux_init();
3442 ethernet_init();
3443 msm8960_i2c_init();
3444 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3445 msm_spm_l2_init(msm_spm_l2_data);
3446 msm8960_init_buses();
3447 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3448 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003449 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003450 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3451
3452 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3453 &msm8960_qup_spi_gsbi1_pdata;
3454 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3455
3456 msm8960_init_mmc();
3457 msm_fb_add_devices();
3458 slim_register_board_info(msm_slim_devices,
3459 ARRAY_SIZE(msm_slim_devices));
3460 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3461 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3462 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3463 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003464}
3465
3466static void __init msm8960_rumi3_init(void)
3467{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003468 if (socinfo_init() < 0)
3469 pr_err("socinfo_init() failed!\n");
3470
3471 BUG_ON(msm_rpm_init(&msm_rpm_data));
3472 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3473 ARRAY_SIZE(msm_rpmrs_levels)));
3474 regulator_suppress_info_printing();
Stephen Boydbb600ae2011-08-02 20:11:40 -07003475 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003476 gpiomux_init();
3477 ethernet_init();
3478 msm8960_device_ssbi_pm8921.dev.platform_data =
3479 &msm8960_ssbi_pm8921_pdata;
3480 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
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_i2c_init();
3485 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3486 msm_spm_l2_init(msm_spm_l2_data);
3487 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3488 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003489 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003490 msm8960_init_mmc();
3491
3492 register_i2c_devices();
3493 msm_fb_add_devices();
3494 slim_register_board_info(msm_slim_devices,
3495 ARRAY_SIZE(msm_slim_devices));
3496 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3497 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3498 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3499 msm_pm_data);
3500}
3501
3502static void __init msm8960_cdp_init(void)
3503{
3504 if (socinfo_init() < 0)
3505 pr_err("socinfo_init() failed!\n");
3506
3507 BUG_ON(msm_rpm_init(&msm_rpm_data));
3508 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3509 ARRAY_SIZE(msm_rpmrs_levels)));
3510 regulator_suppress_info_printing();
3511 if (msm_xo_init())
3512 pr_err("Failed to initialize XO votes\n");
Stephen Boydbb600ae2011-08-02 20:11:40 -07003513 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003514 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3515 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3516 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003517 gpiomux_init();
3518 ethernet_init();
3519 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3520 &msm8960_qup_spi_gsbi1_pdata;
3521 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3522 msm8960_device_ssbi_pm8921.dev.platform_data =
3523 &msm8960_ssbi_pm8921_pdata;
3524 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3525 msm8960_i2c_init();
3526 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3527 msm_spm_l2_init(msm_spm_l2_data);
3528 msm8960_init_buses();
3529 platform_add_devices(msm_footswitch_devices,
3530 msm_num_footswitch_devices);
3531 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3532 pm8921_gpio_mpp_init();
3533 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3534 msm8960_init_cam();
3535 msm8960_init_mmc();
3536 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3537 register_i2c_devices();
3538 msm8960_wcnss_init();
3539 msm_fb_add_devices();
3540 slim_register_board_info(msm_slim_devices,
3541 ARRAY_SIZE(msm_slim_devices));
3542 msm8960_init_dsps();
3543 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3544 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3545 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3546 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07003547 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003548}
3549
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003550MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3551 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003552 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003553 .init_irq = msm8960_init_irq,
3554 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003555 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003556 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003557MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003558
3559MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3560 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003561 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003562 .init_irq = msm8960_init_irq,
3563 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003564 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003565 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003566MACHINE_END
3567
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003568MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3569 .map_io = msm8960_map_io,
3570 .reserve = msm8960_reserve,
3571 .init_irq = msm8960_init_irq,
3572 .timer = &msm_timer,
3573 .init_machine = msm8960_cdp_init,
3574 .init_early = msm8960_allocate_memory_regions,
3575MACHINE_END
3576
3577MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3578 .map_io = msm8960_map_io,
3579 .reserve = msm8960_reserve,
3580 .init_irq = msm8960_init_irq,
3581 .timer = &msm_timer,
3582 .init_machine = msm8960_cdp_init,
3583 .init_early = msm8960_allocate_memory_regions,
3584MACHINE_END
3585
3586MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3587 .map_io = msm8960_map_io,
3588 .reserve = msm8960_reserve,
3589 .init_irq = msm8960_init_irq,
3590 .timer = &msm_timer,
3591 .init_machine = msm8960_cdp_init,
3592 .init_early = msm8960_allocate_memory_regions,
3593MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003594
3595MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3596 .map_io = msm8960_map_io,
3597 .reserve = msm8960_reserve,
3598 .init_irq = msm8960_init_irq,
3599 .timer = &msm_timer,
3600 .init_machine = msm8960_cdp_init,
3601 .init_early = msm8960_allocate_memory_regions,
3602MACHINE_END