blob: 20d63e0a3274aa4b6512e8568c7ea0b2ef565699 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
24#include <linux/regulator/consumer.h>
25#include <linux/spi/spi.h>
26#include <linux/slimbus/slimbus.h>
27#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060028#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029#ifdef CONFIG_ANDROID_PMEM
30#include <linux/android_pmem.h>
31#endif
32#include <linux/cyttsp.h>
33#include <linux/dma-mapping.h>
34#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070035#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036#include <linux/leds.h>
37#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053038#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070039#include <linux/msm_tsens.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080040
41#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070043#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080044#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046
47#include <mach/board.h>
48#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070049#include <mach/msm_spi.h>
50#ifdef CONFIG_USB_MSM_OTG_72K
51#include <mach/msm_hsusb.h>
52#else
53#include <linux/usb/msm_hsusb.h>
54#endif
55#include <linux/usb/android.h>
56#include <mach/usbdiag.h>
57#include <mach/socinfo.h>
58#include <mach/rpm.h>
59#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070060#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061#include <mach/msm_bus_board.h>
62#include <mach/msm_memtypes.h>
63#include <mach/dma.h>
64#include <mach/msm_dsps.h>
65#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070066#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080067
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068#ifdef CONFIG_WCD9310_CODEC
69#include <linux/slimbus/slimbus.h>
70#include <linux/mfd/wcd9310/core.h>
71#include <linux/mfd/wcd9310/pdata.h>
72#endif
73
Laura Abbottd6183792011-08-19 13:42:24 -070074#include <linux/ion.h>
75#include <mach/ion.h>
76
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080078#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#include "spm.h"
81#include "board-msm8960.h"
82#include "pm.h"
83#include "cpuidle.h"
84#include "rpm_resources.h"
85#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070086#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070087#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070088#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070089
90static struct platform_device msm_fm_platform_init = {
91 .name = "iris_fm",
92 .id = -1,
93};
94
95struct pm8xxx_gpio_init {
96 unsigned gpio;
97 struct pm_gpio config;
98};
99
100struct pm8xxx_mpp_init {
101 unsigned mpp;
102 struct pm8xxx_mpp_config_data config;
103};
104
105#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
106 _func, _inv, _disable) \
107{ \
108 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
109 .config = { \
110 .direction = _dir, \
111 .output_buffer = _buf, \
112 .output_value = _val, \
113 .pull = _pull, \
114 .vin_sel = _vin, \
115 .out_strength = _out_strength, \
116 .function = _func, \
117 .inv_int_pol = _inv, \
118 .disable_pin = _disable, \
119 } \
120}
121
122#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
123{ \
124 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
125 .config = { \
126 .type = PM8XXX_MPP_TYPE_##_type, \
127 .level = _level, \
128 .control = PM8XXX_MPP_##_control, \
129 } \
130}
131
132#define PM8XXX_GPIO_DISABLE(_gpio) \
133 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
134 0, 0, 0, 1)
135
136#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
138 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
139 PM_GPIO_STRENGTH_HIGH, \
140 PM_GPIO_FUNC_NORMAL, 0, 0)
141
142#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
143 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
144 _pull, PM_GPIO_VIN_S4, \
145 PM_GPIO_STRENGTH_NO, \
146 PM_GPIO_FUNC_NORMAL, 0, 0)
147
148#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
149 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
150 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
151 PM_GPIO_STRENGTH_HIGH, \
152 _func, 0, 0)
153
154/* Initial PM8921 GPIO configurations */
155static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
156 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
157 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
158 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300159 /* External regulator shared by display and touchscreen on LiQUID */
160 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
161 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700162 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700163 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700165 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166};
167
168/* Initial PM8921 MPP configurations */
169static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
170 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
171 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700172 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
173 DOUT_CTRL_LOW),
174};
175
176static void __init pm8921_gpio_mpp_init(void)
177{
178 int i, rc;
179
180 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
181 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
182 &pm8921_gpios[i].config);
183 if (rc) {
184 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
185 break;
186 }
187 }
188
189 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
190 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
191 &pm8921_mpps[i].config);
192 if (rc) {
193 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
194 break;
195 }
196 }
197}
198
199#define FPGA_CS_GPIO 14
200#define KS8851_RST_GPIO 89
201#define KS8851_IRQ_GPIO 90
202
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700203#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
204enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700205 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700206 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
207 /* CAM Expander */
208 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
209 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
210 GPIO_CAM_GP_AFBUSY,
211 GPIO_CAM_GP_STROBE_CE,
212 GPIO_CAM_GP_CAM1MP_XCLR,
213 GPIO_CAM_GP_CAMIF_RESET_N,
214 GPIO_CAM_GP_XMT_FLASH_INT,
215 GPIO_CAM_GP_LED_EN1,
216 GPIO_CAM_GP_LED_EN2,
217
218};
219#endif
220
Harini Jayaraman608d0462011-08-09 19:10:03 -0600221/* The SPI configurations apply to GSBI 1*/
222static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700223 .func = GPIOMUX_FUNC_1,
224 .drv = GPIOMUX_DRV_8MA,
225 .pull = GPIOMUX_PULL_NONE,
226};
227
Harini Jayaraman608d0462011-08-09 19:10:03 -0600228static struct gpiomux_setting spi_suspended_config = {
229 .func = GPIOMUX_FUNC_GPIO,
230 .drv = GPIOMUX_DRV_2MA,
231 .pull = GPIOMUX_PULL_DOWN,
232};
233
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700234static struct gpiomux_setting gsbi3 = {
235 .func = GPIOMUX_FUNC_1,
236 .drv = GPIOMUX_DRV_8MA,
237 .pull = GPIOMUX_PULL_NONE,
238};
239
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700240static struct gpiomux_setting gsbi5 = {
241 .func = GPIOMUX_FUNC_1,
242 .drv = GPIOMUX_DRV_8MA,
243 .pull = GPIOMUX_PULL_NONE,
244};
245
246static struct gpiomux_setting gsbi10 = {
247 .func = GPIOMUX_FUNC_2,
248 .drv = GPIOMUX_DRV_8MA,
249 .pull = GPIOMUX_PULL_NONE,
250};
251
252static struct gpiomux_setting gsbi12 = {
253 .func = GPIOMUX_FUNC_1,
254 .drv = GPIOMUX_DRV_8MA,
255 .pull = GPIOMUX_PULL_NONE,
256};
257
258static struct gpiomux_setting cdc_mclk = {
259 .func = GPIOMUX_FUNC_1,
260 .drv = GPIOMUX_DRV_8MA,
261 .pull = GPIOMUX_PULL_NONE,
262};
263
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700264static struct gpiomux_setting audio_auxpcm[] = {
265 /* Suspended state */
266 {
267 .func = GPIOMUX_FUNC_GPIO,
268 .drv = GPIOMUX_DRV_2MA,
269 .pull = GPIOMUX_PULL_NONE,
270 },
271 /* Active state */
272 {
273 .func = GPIOMUX_FUNC_1,
274 .drv = GPIOMUX_DRV_2MA,
275 .pull = GPIOMUX_PULL_NONE,
276 },
277};
278
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700279#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700280static struct gpiomux_setting gpio_eth_config = {
281 .pull = GPIOMUX_PULL_NONE,
282 .drv = GPIOMUX_DRV_8MA,
283 .func = GPIOMUX_FUNC_GPIO,
284};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700285#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700286
287static struct gpiomux_setting slimbus = {
288 .func = GPIOMUX_FUNC_1,
289 .drv = GPIOMUX_DRV_8MA,
290 .pull = GPIOMUX_PULL_KEEPER,
291};
292
293struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700294#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295 {
296 .gpio = KS8851_IRQ_GPIO,
297 .settings = {
298 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
299 }
300 },
301 {
302 .gpio = KS8851_RST_GPIO,
303 .settings = {
304 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
305 }
306 },
307 {
308 .gpio = FPGA_CS_GPIO,
309 .settings = {
310 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
311 }
312 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700313#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314};
315
316static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
317 {
318 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
319 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600320 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
321 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322 },
323 },
324 {
325 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
326 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600327 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
328 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329 },
330 },
331 {
332 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
333 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600334 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
335 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336 },
337 },
338 {
339 .gpio = 9, /* GSBI1 QUP SPI_CLK */
340 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600341 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
342 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343 },
344 },
345 {
346 .gpio = 16, /* GSBI3 I2C QUP SDA */
347 .settings = {
348 [GPIOMUX_SUSPENDED] = &gsbi3,
349 },
350 },
351 {
352 .gpio = 17, /* GSBI3 I2C QUP SCL */
353 .settings = {
354 [GPIOMUX_SUSPENDED] = &gsbi3,
355 },
356 },
357 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358 .gpio = 22, /* GSBI5 UART2 */
359 .settings = {
360 [GPIOMUX_SUSPENDED] = &gsbi5,
361 },
362 },
363 {
364 .gpio = 23, /* GSBI5 UART2 */
365 .settings = {
366 [GPIOMUX_SUSPENDED] = &gsbi5,
367 },
368 },
369 {
370 .gpio = 24, /* GSBI5 UART2 */
371 .settings = {
372 [GPIOMUX_SUSPENDED] = &gsbi5,
373 },
374 },
375 {
376 .gpio = 25, /* GSBI5 UART2 */
377 .settings = {
378 [GPIOMUX_SUSPENDED] = &gsbi5,
379 },
380 },
381 {
382 .gpio = 44, /* GSBI12 I2C QUP SDA */
383 .settings = {
384 [GPIOMUX_SUSPENDED] = &gsbi12,
385 },
386 },
387 {
388 .gpio = 45, /* GSBI12 I2C QUP SCL */
389 .settings = {
390 [GPIOMUX_SUSPENDED] = &gsbi12,
391 },
392 },
393 {
394 .gpio = 73, /* GSBI10 I2C QUP SDA */
395 .settings = {
396 [GPIOMUX_SUSPENDED] = &gsbi10,
397 },
398 },
399 {
400 .gpio = 74, /* GSBI10 I2C QUP SCL */
401 .settings = {
402 [GPIOMUX_SUSPENDED] = &gsbi10,
403 },
404 },
405};
406
407static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
408 {
409 .gpio = 60, /* slimbus data */
410 .settings = {
411 [GPIOMUX_SUSPENDED] = &slimbus,
412 },
413 },
414 {
415 .gpio = 61, /* slimbus clk */
416 .settings = {
417 [GPIOMUX_SUSPENDED] = &slimbus,
418 },
419 },
420};
421
422static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
423 {
424 .gpio = 59,
425 .settings = {
426 [GPIOMUX_SUSPENDED] = &cdc_mclk,
427 },
428 },
429};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700430
431static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
432 {
433 .gpio = 63,
434 .settings = {
435 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
436 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
437 },
438 },
439 {
440 .gpio = 64,
441 .settings = {
442 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
443 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
444 },
445 },
446 {
447 .gpio = 65,
448 .settings = {
449 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
450 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
451 },
452 },
453 {
454 .gpio = 66,
455 .settings = {
456 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
457 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
458 },
459 },
460};
461
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700462static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
463 .func = GPIOMUX_FUNC_GPIO,
464 .drv = GPIOMUX_DRV_2MA,
465 .pull = GPIOMUX_PULL_NONE,
466};
467
468static struct gpiomux_setting wcnss_5wire_active_cfg = {
469 .func = GPIOMUX_FUNC_1,
470 .drv = GPIOMUX_DRV_6MA,
471 .pull = GPIOMUX_PULL_DOWN,
472};
473
474static struct msm_gpiomux_config wcnss_5wire_interface[] = {
475 {
476 .gpio = 84,
477 .settings = {
478 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
479 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
480 },
481 },
482 {
483 .gpio = 85,
484 .settings = {
485 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
486 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
487 },
488 },
489 {
490 .gpio = 86,
491 .settings = {
492 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
493 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
494 },
495 },
496 {
497 .gpio = 87,
498 .settings = {
499 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
500 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
501 },
502 },
503 {
504 .gpio = 88,
505 .settings = {
506 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
507 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
508 },
509 },
510};
Nishant Pandit24153d82011-08-27 16:05:13 +0530511static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530512 {
513 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
514 .drv = GPIOMUX_DRV_2MA,
515 .pull = GPIOMUX_PULL_DOWN,
516 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700517
Nishant Pandit474f2252011-07-23 23:17:56 +0530518 {
519 .func = GPIOMUX_FUNC_1, /*active 1*/
520 .drv = GPIOMUX_DRV_2MA,
521 .pull = GPIOMUX_PULL_NONE,
522 },
523
524 {
525 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
526 .drv = GPIOMUX_DRV_2MA,
527 .pull = GPIOMUX_PULL_NONE,
528 },
529
530 {
531 .func = GPIOMUX_FUNC_1, /*active 3*/
532 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700533 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530534 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530535
536 {
537 .func = GPIOMUX_FUNC_5, /*active 4*/
538 .drv = GPIOMUX_DRV_8MA,
539 .pull = GPIOMUX_PULL_UP,
540 },
541
542 {
543 .func = GPIOMUX_FUNC_6, /*active 5*/
544 .drv = GPIOMUX_DRV_8MA,
545 .pull = GPIOMUX_PULL_UP,
546 },
547
548 {
549 .func = GPIOMUX_FUNC_2, /*active 6*/
550 .drv = GPIOMUX_DRV_2MA,
551 .pull = GPIOMUX_PULL_UP,
552 },
553
554 {
555 .func = GPIOMUX_FUNC_3, /*active 7*/
556 .drv = GPIOMUX_DRV_8MA,
557 .pull = GPIOMUX_PULL_UP,
558 },
559
Kevin Chan4c58d292011-09-13 11:03:25 -0700560 {
561 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
562 .drv = GPIOMUX_DRV_2MA,
563 .pull = GPIOMUX_PULL_KEEPER,
564 },
565
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700566};
567
Nishant Pandit24153d82011-08-27 16:05:13 +0530568static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700569 {
570 .gpio = 2,
571 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530572 [GPIOMUX_ACTIVE] = &cam_settings[2],
573 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700574 },
575 },
576 {
577 .gpio = 3,
578 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530579 [GPIOMUX_ACTIVE] = &cam_settings[1],
580 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700581 },
582 },
583 {
584 .gpio = 4,
585 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530586 [GPIOMUX_ACTIVE] = &cam_settings[1],
587 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700588 },
589 },
590 {
591 .gpio = 5,
592 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530593 [GPIOMUX_ACTIVE] = &cam_settings[1],
594 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595 },
596 },
597 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530598 .gpio = 76,
599 .settings = {
600 [GPIOMUX_ACTIVE] = &cam_settings[2],
601 [GPIOMUX_SUSPENDED] = &cam_settings[0],
602 },
603 },
604 {
605 .gpio = 107,
606 .settings = {
607 [GPIOMUX_ACTIVE] = &cam_settings[2],
608 [GPIOMUX_SUSPENDED] = &cam_settings[0],
609 },
610 },
611};
612
613static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
614 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700615 .gpio = 18,
616 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530617 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700618 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700619 },
620 },
621 {
622 .gpio = 19,
623 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530624 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700625 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700626 },
627 },
628 {
629 .gpio = 20,
630 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530631 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700632 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700633 },
634 },
635 {
636 .gpio = 21,
637 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530638 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700639 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700640 },
641 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700642};
643
644static struct gpiomux_setting cyts_resout_sus_cfg = {
645 .func = GPIOMUX_FUNC_GPIO,
646 .drv = GPIOMUX_DRV_6MA,
647 .pull = GPIOMUX_PULL_UP,
648};
649
650static struct gpiomux_setting cyts_resout_act_cfg = {
651 .func = GPIOMUX_FUNC_GPIO,
652 .drv = GPIOMUX_DRV_6MA,
653 .pull = GPIOMUX_PULL_UP,
654};
655
656static struct gpiomux_setting cyts_sleep_sus_cfg = {
657 .func = GPIOMUX_FUNC_GPIO,
658 .drv = GPIOMUX_DRV_6MA,
659 .pull = GPIOMUX_PULL_DOWN,
660};
661
662static struct gpiomux_setting cyts_sleep_act_cfg = {
663 .func = GPIOMUX_FUNC_GPIO,
664 .drv = GPIOMUX_DRV_6MA,
665 .pull = GPIOMUX_PULL_DOWN,
666};
667
668static struct gpiomux_setting cyts_int_act_cfg = {
669 .func = GPIOMUX_FUNC_GPIO,
670 .drv = GPIOMUX_DRV_8MA,
671 .pull = GPIOMUX_PULL_UP,
672};
673
674static struct gpiomux_setting cyts_int_sus_cfg = {
675 .func = GPIOMUX_FUNC_GPIO,
676 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530677 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700678};
679
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700680static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
681 { /* TS INTERRUPT */
682 .gpio = 11,
683 .settings = {
684 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
685 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
686 },
687 },
688 { /* TS SLEEP */
689 .gpio = 50,
690 .settings = {
691 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
692 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
693 },
694 },
695 { /* TS RESOUT */
696 .gpio = 52,
697 .settings = {
698 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
699 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
700 },
701 },
702};
703
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700704#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
705enum {
706 SX150X_CAM,
707};
708
Nishant Pandit474f2252011-07-23 23:17:56 +0530709static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700710 [SX150X_CAM] = {
711 .gpio_base = GPIO_CAM_EXPANDER_BASE,
712 .oscio_is_gpo = false,
713 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530714 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700715 .io_open_drain_ena = 0x0,
716 .irq_summary = -1,
717 },
718};
Nishant Pandit474f2252011-07-23 23:17:56 +0530719
720#endif
721
722#ifdef CONFIG_I2C
723
724#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
725#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300726#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530727
728#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
729
730static struct i2c_board_info cam_expander_i2c_info[] = {
731 {
732 I2C_BOARD_INFO("sx1508q", 0x22),
733 .platform_data = &sx150x_data[SX150X_CAM]
734 },
735};
736
737static struct msm_cam_expander_info cam_expander_info[] = {
738 {
739 cam_expander_i2c_info,
740 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
741 },
742};
743#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700744#endif
745
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700746#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
747#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700748#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700749#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
750
Laura Abbottd6183792011-08-19 13:42:24 -0700751#define MSM_ION_EBI_SIZE SZ_8M
752
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700753#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
754static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
755static int __init pmem_kernel_ebi1_size_setup(char *p)
756{
757 pmem_kernel_ebi1_size = memparse(p, NULL);
758 return 0;
759}
760early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
761#endif
762
763#ifdef CONFIG_ANDROID_PMEM
764static unsigned pmem_size = MSM_PMEM_SIZE;
765static int __init pmem_size_setup(char *p)
766{
767 pmem_size = memparse(p, NULL);
768 return 0;
769}
770early_param("pmem_size", pmem_size_setup);
771
772static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
773
774static int __init pmem_adsp_size_setup(char *p)
775{
776 pmem_adsp_size = memparse(p, NULL);
777 return 0;
778}
779early_param("pmem_adsp_size", pmem_adsp_size_setup);
780
781static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
782
783static int __init pmem_audio_size_setup(char *p)
784{
785 pmem_audio_size = memparse(p, NULL);
786 return 0;
787}
788early_param("pmem_audio_size", pmem_audio_size_setup);
789#endif
790
791#ifdef CONFIG_ANDROID_PMEM
792static struct android_pmem_platform_data android_pmem_pdata = {
793 .name = "pmem",
794 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
795 .cached = 1,
796 .memory_type = MEMTYPE_EBI1,
797};
798
799static struct platform_device android_pmem_device = {
800 .name = "android_pmem",
801 .id = 0,
802 .dev = {.platform_data = &android_pmem_pdata},
803};
804
805static struct android_pmem_platform_data android_pmem_adsp_pdata = {
806 .name = "pmem_adsp",
807 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
808 .cached = 0,
809 .memory_type = MEMTYPE_EBI1,
810};
811static struct platform_device android_pmem_adsp_device = {
812 .name = "android_pmem",
813 .id = 2,
814 .dev = { .platform_data = &android_pmem_adsp_pdata },
815};
816
817static struct android_pmem_platform_data android_pmem_audio_pdata = {
818 .name = "pmem_audio",
819 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
820 .cached = 0,
821 .memory_type = MEMTYPE_EBI1,
822};
823
824static struct platform_device android_pmem_audio_device = {
825 .name = "android_pmem",
826 .id = 4,
827 .dev = { .platform_data = &android_pmem_audio_pdata },
828};
829#endif
830
831static struct memtype_reserve msm8960_reserve_table[] __initdata = {
832 [MEMTYPE_SMI] = {
833 },
834 [MEMTYPE_EBI0] = {
835 .flags = MEMTYPE_FLAGS_1M_ALIGN,
836 },
837 [MEMTYPE_EBI1] = {
838 .flags = MEMTYPE_FLAGS_1M_ALIGN,
839 },
840};
841
842static void __init size_pmem_devices(void)
843{
844#ifdef CONFIG_ANDROID_PMEM
845 android_pmem_adsp_pdata.size = pmem_adsp_size;
846 android_pmem_pdata.size = pmem_size;
847 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
848#endif
849}
850
851static void __init reserve_memory_for(struct android_pmem_platform_data *p)
852{
853 msm8960_reserve_table[p->memory_type].size += p->size;
854}
855
856static void __init reserve_pmem_memory(void)
857{
858#ifdef CONFIG_ANDROID_PMEM
859 reserve_memory_for(&android_pmem_adsp_pdata);
860 reserve_memory_for(&android_pmem_pdata);
861 reserve_memory_for(&android_pmem_audio_pdata);
862 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
863#endif
864}
865
Larry Basselb4126da2011-07-18 14:31:33 -0700866static int msm8960_paddr_to_memtype(unsigned int paddr)
867{
868 return MEMTYPE_EBI1;
869}
870
Laura Abbottd6183792011-08-19 13:42:24 -0700871#ifdef CONFIG_ION_MSM
872struct ion_platform_data ion_pdata = {
873 .nr = 3,
874 .heaps = {
875 {
876 .id = ION_HEAP_SYSTEM_ID,
877 .type = ION_HEAP_TYPE_SYSTEM,
878 .name = ION_KMALLOC_HEAP_NAME,
879 },
880 {
881 .id = ION_HEAP_SYSTEM_CONTIG_ID,
882 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
883 .name = ION_VMALLOC_HEAP_NAME,
884 },
885 {
886 .id = ION_HEAP_EBI_ID,
887 .type = ION_HEAP_TYPE_CARVEOUT,
888 .name = ION_EBI1_HEAP_NAME,
889 .size = MSM_ION_EBI_SIZE,
890 .memory_type = ION_EBI_TYPE,
891 },
892 }
893};
894
895struct platform_device ion_dev = {
896 .name = "ion-msm",
897 .id = 1,
898 .dev = { .platform_data = &ion_pdata },
899};
900#endif
901
902static void reserve_ion_memory(void)
903{
904#ifdef CONFIG_ION_MSM
905 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
906#endif
907}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700908static void __init msm8960_calculate_reserve_sizes(void)
909{
910 size_pmem_devices();
911 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700912 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700913}
914
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700915static struct reserve_info msm8960_reserve_info __initdata = {
916 .memtype_reserve_table = msm8960_reserve_table,
917 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
918 .paddr_to_memtype = msm8960_paddr_to_memtype,
919};
920
Larry Basselb4126da2011-07-18 14:31:33 -0700921static int msm8960_memory_bank_size(void)
922{
923 return 1<<29;
924}
925
926static void __init locate_unstable_memory(void)
927{
928 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
929 unsigned long bank_size;
930 unsigned long low, high;
931
932 bank_size = msm8960_memory_bank_size();
933 low = meminfo.bank[0].start;
934 high = mb->start + mb->size;
935 low &= ~(bank_size - 1);
936
937 if (high - low <= bank_size)
938 return;
939 msm8960_reserve_info.low_unstable_address = low + bank_size;
940 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
941 msm8960_reserve_info.bank_size = bank_size;
942 pr_info("low unstable address %lx max size %lx bank size %lx\n",
943 msm8960_reserve_info.low_unstable_address,
944 msm8960_reserve_info.max_unstable_size,
945 msm8960_reserve_info.bank_size);
946}
947
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700948static void __init msm8960_reserve(void)
949{
950 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700951 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700952 msm_reserve();
953}
954
Larry Bassela4414b12011-08-04 11:11:02 -0700955static int msm8960_change_memory_power(u64 start, u64 size,
956 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700957{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700958 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700959}
960
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700961#ifdef CONFIG_MSM_CAMERA
962
Nishant Pandit24153d82011-08-27 16:05:13 +0530963static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700964 5, /*CAMIF_MCLK*/
965 20, /*CAMIF_I2C_DATA*/
966 21, /*CAMIF_I2C_CLK*/
967};
968
Nishant Pandit24153d82011-08-27 16:05:13 +0530969static struct msm_camera_gpio_conf gpio_conf = {
970 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
971 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
972 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
973 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
974};
975
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700976#define VFE_CAMIF_TIMER1_GPIO 2
977#define VFE_CAMIF_TIMER2_GPIO 3
978#define VFE_CAMIF_TIMER3_GPIO_INT 4
979struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
980 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
981 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
982 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
983 .flash_recharge_duration = 50000,
984 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
985};
986
Nishant Pandit474f2252011-07-23 23:17:56 +0530987#ifdef CONFIG_MSM_CAMERA_FLASH
988static struct msm_camera_sensor_flash_src msm_flash_src = {
989 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
990 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
991 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
992#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
993 defined(CONFIG_GPIO_SX150X_MODULE))
994 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
995#endif
996};
997#endif
998
Nishant Pandit24153d82011-08-27 16:05:13 +0530999struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1000 {
1001 .ioclk.mclk_clk_rate = 24000000,
1002 .ioclk.vfe_clk_rate = 228570000,
1003 .csid_core = 0,
1004 },
1005 {
1006 .ioclk.mclk_clk_rate = 24000000,
1007 .ioclk.vfe_clk_rate = 228570000,
1008 .csid_core = 1,
1009 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001010};
1011
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001012#ifdef CONFIG_IMX074_ACT
1013static struct i2c_board_info imx074_actuator_i2c_info = {
1014 I2C_BOARD_INFO("imx074_act", 0x11),
1015};
1016
1017static struct msm_actuator_info imx074_actuator_info = {
1018 .board_info = &imx074_actuator_i2c_info,
1019 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1020 .vcm_pwd = 0,
1021 .vcm_enable = 1,
1022};
1023#endif
1024
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001025#ifdef CONFIG_IMX074
1026static struct msm_camera_sensor_flash_data flash_imx074 = {
1027 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301028#ifdef CONFIG_MSM_CAMERA_FLASH
1029 .flash_src = &msm_flash_src
1030#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001031};
1032
Nishant Pandit24153d82011-08-27 16:05:13 +05301033static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1034 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001035 .sensor_reset = 107,
1036 .sensor_pwd = 85,
1037 .vcm_pwd = 0,
1038 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301039};
1040
1041static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1042 .sensor_name = "imx074",
1043 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001044 .flash_data = &flash_imx074,
1045 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301046 .sensor_platform_info = &sensor_board_info_imx074,
1047 .gpio_conf = &gpio_conf,
1048 .csi_if = 1,
1049 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001050#ifdef CONFIG_IMX074_ACT
1051 .actuator_info = &imx074_actuator_info
1052#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001053};
1054
1055struct platform_device msm8960_camera_sensor_imx074 = {
1056 .name = "msm_camera_imx074",
1057 .dev = {
1058 .platform_data = &msm_camera_sensor_imx074_data,
1059 },
1060};
1061#endif
1062#ifdef CONFIG_OV2720
1063static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001064 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001065};
1066
Nishant Pandit24153d82011-08-27 16:05:13 +05301067static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1068 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001069 .sensor_reset = 76,
1070 .sensor_pwd = 85,
1071 .vcm_pwd = 0,
1072 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301073};
1074
1075static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1076 .sensor_name = "ov2720",
1077 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001078 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301079 .sensor_platform_info = &sensor_board_info_ov2720,
1080 .gpio_conf = &gpio_conf,
1081 .csi_if = 1,
1082 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001083};
1084
1085struct platform_device msm8960_camera_sensor_ov2720 = {
1086 .name = "msm_camera_ov2720",
1087 .dev = {
1088 .platform_data = &msm_camera_sensor_ov2720_data,
1089 },
1090};
1091#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001092
1093static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1094 .flash_type = MSM_CAMERA_FLASH_LED,
1095};
1096
Nishant Pandit24153d82011-08-27 16:05:13 +05301097static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1098 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001099 .sensor_reset = 107,
1100 .sensor_pwd = 85,
1101 .vcm_pwd = 0,
1102 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301103};
1104
1105static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1106 .sensor_name = "qs_mt9p017",
1107 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001108 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301109 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1110 .gpio_conf = &gpio_conf,
1111 .csi_if = 1,
1112 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001113};
1114
1115struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1116 .name = "msm_camera_qs_mt9p017",
1117 .dev = {
1118 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1119 },
1120};
1121
Kevin Chan8b0d2322011-09-10 21:06:31 -07001122static struct msm8960_privacy_light_cfg privacy_light_info = {
1123 .mpp = PM8921_MPP_PM_TO_SYS(12),
1124};
1125
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001126static void __init msm8960_init_cam(void)
1127{
1128 int i;
1129 struct platform_device *cam_dev[] = {
1130 &msm8960_camera_sensor_imx074,
1131 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001132 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001133 };
1134
Kevin Chan8b0d2322011-09-10 21:06:31 -07001135 if (machine_is_msm8960_liquid()) {
1136 struct msm_camera_sensor_info *s_info;
1137 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1138 s_info->sensor_platform_info->mount_angle = 180;
1139 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1140 s_info->sensor_platform_info->privacy_light = 1;
1141 s_info->sensor_platform_info->privacy_light_info =
1142 &privacy_light_info;
1143 }
1144
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001145 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1146 struct msm_camera_sensor_info *s_info;
1147 s_info = cam_dev[i]->dev.platform_data;
1148 msm_get_cam_resources(s_info);
1149 platform_device_register(cam_dev[i]);
1150 }
1151}
1152#endif
1153
1154#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001155#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001156#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001157#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001158#endif
1159
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001160
1161#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001162#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001163#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001164#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1165#else
1166#define MSM_FB_EXT_BUF_SIZE 0
1167#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001168
kuogee hsieh3830eb92011-09-12 15:25:57 -07001169#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1170/* width x height x 3 bpp x 2 frame buffer */
1171#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1172#define MSM_FB_WRITEBACK_OFFSET \
1173 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1174#else
1175#define MSM_FB_WRITEBACK_SIZE 0
1176#define MSM_FB_WRITEBACK_OFFSET 0
1177#endif
1178
1179
1180/* Note: must be multiple of 4096 */
1181#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1182 MSM_FB_WRITEBACK_SIZE, 4096)
1183
1184static int writeback_offset(void)
1185{
1186 return MSM_FB_WRITEBACK_OFFSET;
1187}
1188
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001189
1190#define MDP_VSYNC_GPIO 0
1191
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001192#define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga"
1193#define TOSHIBA_PANEL_NAME_LEN 24
1194#define CHIMEI_PANEL_NAME "mipi_chimei_wxga"
1195#define CHIMEI_PANEL_NAME_LEN 16
1196
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001197static struct resource msm_fb_resources[] = {
1198 {
1199 .flags = IORESOURCE_DMA,
1200 }
1201};
1202
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001203#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1204static int msm_fb_detect_panel(const char *name)
1205{
1206 if (machine_is_msm8960_liquid()) {
1207 if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN))
1208 return 0;
1209 } else {
1210 if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN))
1211 return 0;
1212 }
1213
1214 pr_warning("%s: not supported '%s'", __func__, name);
1215
1216 return -ENODEV;
1217}
1218
1219static struct msm_fb_platform_data msm_fb_pdata = {
1220 .detect_client = msm_fb_detect_panel,
1221};
1222#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
1223
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001224static struct platform_device msm_fb_device = {
1225 .name = "msm_fb",
1226 .id = 0,
1227 .num_resources = ARRAY_SIZE(msm_fb_resources),
1228 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001229#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1230 .dev.platform_data = &msm_fb_pdata,
1231#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001232};
1233
1234static bool dsi_power_on;
1235
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001236/**
1237 * LiQUID panel on/off
1238 *
1239 * @param on
1240 *
1241 * @return int
1242 */
1243static int mipi_dsi_liquid_panel_power(int on)
1244{
1245 static struct regulator *reg_l2, *reg_ext_3p3v;
1246 static int gpio21, gpio24, gpio43;
1247 int rc;
1248
1249 pr_info("%s: on=%d\n", __func__, on);
1250
1251 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1252 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1253 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1254
1255 if (!dsi_power_on) {
1256
1257 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1258 "dsi_vdda");
1259 if (IS_ERR(reg_l2)) {
1260 pr_err("could not get 8921_l2, rc = %ld\n",
1261 PTR_ERR(reg_l2));
1262 return -ENODEV;
1263 }
1264
1265 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1266 if (rc) {
1267 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1268 return -EINVAL;
1269 }
1270
1271 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1272 "vdd_lvds_3p3v");
1273 if (IS_ERR(reg_ext_3p3v)) {
1274 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1275 PTR_ERR(reg_ext_3p3v));
1276 return -ENODEV;
1277 }
1278
1279 rc = gpio_request(gpio21, "disp_pwr_en_n");
1280 if (rc) {
1281 pr_err("request gpio 21 failed, rc=%d\n", rc);
1282 return -ENODEV;
1283 }
1284
1285 rc = gpio_request(gpio43, "disp_rst_n");
1286 if (rc) {
1287 pr_err("request gpio 43 failed, rc=%d\n", rc);
1288 return -ENODEV;
1289 }
1290
1291 rc = gpio_request(gpio24, "disp_backlight_pwm");
1292 if (rc) {
1293 pr_err("request gpio 24 failed, rc=%d\n", rc);
1294 return -ENODEV;
1295 }
1296
1297 dsi_power_on = true;
1298 }
1299
1300 if (on) {
1301 rc = regulator_set_optimum_mode(reg_l2, 100000);
1302 if (rc < 0) {
1303 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1304 return -EINVAL;
1305 }
1306 rc = regulator_enable(reg_l2);
1307 if (rc) {
1308 pr_err("enable l2 failed, rc=%d\n", rc);
1309 return -ENODEV;
1310 }
1311
1312 rc = regulator_enable(reg_ext_3p3v);
1313 if (rc) {
1314 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1315 return -ENODEV;
1316 }
1317
1318 /* set reset pin before power enable */
1319 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1320
1321 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1322 msleep(20);
1323 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1324 msleep(20);
1325 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1326 msleep(20);
1327 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1328 msleep(20);
1329 } else {
1330 gpio_set_value_cansleep(gpio43, 0);
1331 gpio_set_value_cansleep(gpio21, 1);
1332
1333 rc = regulator_disable(reg_l2);
1334 if (rc) {
1335 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1336 return -ENODEV;
1337 }
1338 rc = regulator_disable(reg_ext_3p3v);
1339 if (rc) {
1340 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1341 return -ENODEV;
1342 }
1343 rc = regulator_set_optimum_mode(reg_l2, 100);
1344 if (rc < 0) {
1345 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1346 return -EINVAL;
1347 }
1348 }
1349
1350 return 0;
1351}
1352
1353static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001354{
1355 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001356 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001357 int rc;
1358
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001359 pr_info("%s: state : %d\n", __func__, on);
1360
1361 if (!dsi_power_on) {
1362
1363 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1364 "dsi_vdc");
1365 if (IS_ERR(reg_l8)) {
1366 pr_err("could not get 8921_l8, rc = %ld\n",
1367 PTR_ERR(reg_l8));
1368 return -ENODEV;
1369 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001370 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1371 "dsi_vddio");
1372 if (IS_ERR(reg_l23)) {
1373 pr_err("could not get 8921_l23, rc = %ld\n",
1374 PTR_ERR(reg_l23));
1375 return -ENODEV;
1376 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001377 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1378 "dsi_vdda");
1379 if (IS_ERR(reg_l2)) {
1380 pr_err("could not get 8921_l2, rc = %ld\n",
1381 PTR_ERR(reg_l2));
1382 return -ENODEV;
1383 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001384 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1385 if (rc) {
1386 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1387 return -EINVAL;
1388 }
1389 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1390 if (rc) {
1391 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1392 return -EINVAL;
1393 }
1394 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1395 if (rc) {
1396 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1397 return -EINVAL;
1398 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001399 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1400 rc = gpio_request(gpio43, "disp_rst_n");
1401 if (rc) {
1402 pr_err("request gpio 43 failed, rc=%d\n", rc);
1403 return -ENODEV;
1404 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001405 dsi_power_on = true;
1406 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001407 if (on) {
1408 rc = regulator_set_optimum_mode(reg_l8, 100000);
1409 if (rc < 0) {
1410 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1411 return -EINVAL;
1412 }
1413 rc = regulator_set_optimum_mode(reg_l23, 100000);
1414 if (rc < 0) {
1415 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1416 return -EINVAL;
1417 }
1418 rc = regulator_set_optimum_mode(reg_l2, 100000);
1419 if (rc < 0) {
1420 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1421 return -EINVAL;
1422 }
1423 rc = regulator_enable(reg_l8);
1424 if (rc) {
1425 pr_err("enable l8 failed, rc=%d\n", rc);
1426 return -ENODEV;
1427 }
1428 rc = regulator_enable(reg_l23);
1429 if (rc) {
1430 pr_err("enable l8 failed, rc=%d\n", rc);
1431 return -ENODEV;
1432 }
1433 rc = regulator_enable(reg_l2);
1434 if (rc) {
1435 pr_err("enable l2 failed, rc=%d\n", rc);
1436 return -ENODEV;
1437 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001438 gpio_set_value_cansleep(gpio43, 1);
1439 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001440 rc = regulator_disable(reg_l2);
1441 if (rc) {
1442 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1443 return -ENODEV;
1444 }
1445 rc = regulator_disable(reg_l8);
1446 if (rc) {
1447 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1448 return -ENODEV;
1449 }
1450 rc = regulator_disable(reg_l23);
1451 if (rc) {
1452 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1453 return -ENODEV;
1454 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455 rc = regulator_set_optimum_mode(reg_l8, 100);
1456 if (rc < 0) {
1457 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1458 return -EINVAL;
1459 }
1460 rc = regulator_set_optimum_mode(reg_l23, 100);
1461 if (rc < 0) {
1462 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1463 return -EINVAL;
1464 }
1465 rc = regulator_set_optimum_mode(reg_l2, 100);
1466 if (rc < 0) {
1467 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1468 return -EINVAL;
1469 }
1470 gpio_set_value_cansleep(gpio43, 0);
1471 }
1472 return 0;
1473}
1474
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001475static int mipi_dsi_panel_power(int on)
1476{
1477 int ret;
1478
1479 pr_info("%s: on=%d\n", __func__, on);
1480
1481 if (machine_is_msm8960_liquid())
1482 ret = mipi_dsi_liquid_panel_power(on);
1483 else
1484 ret = mipi_dsi_cdp_panel_power(on);
1485
1486 return ret;
1487}
1488
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001489static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1490 .vsync_gpio = MDP_VSYNC_GPIO,
1491 .dsi_power_save = mipi_dsi_panel_power,
1492};
1493
1494#ifdef CONFIG_MSM_BUS_SCALING
1495
1496static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001497 {
1498 .src = MSM_BUS_MASTER_MDP_PORT0,
1499 .dst = MSM_BUS_SLAVE_EBI_CH0,
1500 .ab = 0,
1501 .ib = 0,
1502 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001503};
1504
1505static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001506 {
1507 .src = MSM_BUS_MASTER_MDP_PORT0,
1508 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001509 .ab = 216000000 * 2,
1510 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001511 },
1512};
1513
1514static struct msm_bus_vectors mdp_vga_vectors[] = {
1515 /* VGA and less video */
1516 {
1517 .src = MSM_BUS_MASTER_MDP_PORT0,
1518 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001519 .ab = 216000000 * 2,
1520 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001521 },
1522};
1523
1524static struct msm_bus_vectors mdp_720p_vectors[] = {
1525 /* 720p and less video */
1526 {
1527 .src = MSM_BUS_MASTER_MDP_PORT0,
1528 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001529 .ab = 230400000 * 2,
1530 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001531 },
1532};
1533
1534static struct msm_bus_vectors mdp_1080p_vectors[] = {
1535 /* 1080p and less video */
1536 {
1537 .src = MSM_BUS_MASTER_MDP_PORT0,
1538 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001539 .ab = 334080000 * 2,
1540 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001541 },
1542};
1543
1544static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1545 {
1546 ARRAY_SIZE(mdp_init_vectors),
1547 mdp_init_vectors,
1548 },
1549 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001550 ARRAY_SIZE(mdp_ui_vectors),
1551 mdp_ui_vectors,
1552 },
1553 {
1554 ARRAY_SIZE(mdp_ui_vectors),
1555 mdp_ui_vectors,
1556 },
1557 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001558 ARRAY_SIZE(mdp_vga_vectors),
1559 mdp_vga_vectors,
1560 },
1561 {
1562 ARRAY_SIZE(mdp_720p_vectors),
1563 mdp_720p_vectors,
1564 },
1565 {
1566 ARRAY_SIZE(mdp_1080p_vectors),
1567 mdp_1080p_vectors,
1568 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001569};
1570
1571static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1572 mdp_bus_scale_usecases,
1573 ARRAY_SIZE(mdp_bus_scale_usecases),
1574 .name = "mdp",
1575};
1576
1577#endif
1578
1579int mdp_core_clk_rate_table[] = {
1580 85330000,
1581 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001582 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001583 200000000,
1584};
1585
1586static struct msm_panel_common_pdata mdp_pdata = {
1587 .gpio = MDP_VSYNC_GPIO,
1588 .mdp_core_clk_rate = 85330000,
1589 .mdp_core_clk_table = mdp_core_clk_rate_table,
1590 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1591#ifdef CONFIG_MSM_BUS_SCALING
1592 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1593#endif
1594 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001595 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001596};
1597
1598static struct platform_device mipi_dsi_renesas_panel_device = {
1599 .name = "mipi_renesas",
1600 .id = 0,
1601};
1602
1603static struct platform_device mipi_dsi_simulator_panel_device = {
1604 .name = "mipi_simulator",
1605 .id = 0,
1606};
1607
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001608#define LPM_CHANNEL0 0
1609static int toshiba_gpio[] = {LPM_CHANNEL0};
1610
1611static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1612 .gpio = toshiba_gpio,
1613};
1614
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001615static struct platform_device mipi_dsi_toshiba_panel_device = {
1616 .name = "mipi_toshiba",
1617 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001618 .dev = {
1619 .platform_data = &toshiba_pdata,
1620 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001621};
1622
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001623static int dsi2lvds_gpio[2] = {
1624 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1625 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1626 };
1627
1628static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1629 .gpio_num = dsi2lvds_gpio,
1630};
1631
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001632static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1633
1634/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1635 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1636 /* timing */
1637 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1638 0x0c, 0x03, 0x04, 0xa0},
1639 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1640 {0xff, 0x00, 0x06, 0x00}, /* strength */
1641 /* pll control */
1642 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1643 0x40, 0x07, 0x03,
1644 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1645};
1646
1647static struct mipi_dsi_panel_platform_data novatek_pdata = {
1648 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1649};
1650
1651static struct platform_device mipi_dsi_novatek_panel_device = {
1652 .name = "mipi_novatek",
1653 .id = 0,
1654 .dev = {
1655 .platform_data = &novatek_pdata,
1656 }
1657};
1658
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001659static struct platform_device mipi_dsi2lvds_bridge_device = {
1660 .name = "mipi_tc358764",
1661 .id = 0,
1662 .dev.platform_data = &mipi_dsi2lvds_pdata,
1663};
1664
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001665#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1666static struct resource hdmi_msm_resources[] = {
1667 {
1668 .name = "hdmi_msm_qfprom_addr",
1669 .start = 0x00700000,
1670 .end = 0x007060FF,
1671 .flags = IORESOURCE_MEM,
1672 },
1673 {
1674 .name = "hdmi_msm_hdmi_addr",
1675 .start = 0x04A00000,
1676 .end = 0x04A00FFF,
1677 .flags = IORESOURCE_MEM,
1678 },
1679 {
1680 .name = "hdmi_msm_irq",
1681 .start = HDMI_IRQ,
1682 .end = HDMI_IRQ,
1683 .flags = IORESOURCE_IRQ,
1684 },
1685};
1686
1687static int hdmi_enable_5v(int on);
1688static int hdmi_core_power(int on, int show);
1689static int hdmi_cec_power(int on);
1690
1691static struct msm_hdmi_platform_data hdmi_msm_data = {
1692 .irq = HDMI_IRQ,
1693 .enable_5v = hdmi_enable_5v,
1694 .core_power = hdmi_core_power,
1695 .cec_power = hdmi_cec_power,
1696};
1697
1698static struct platform_device hdmi_msm_device = {
1699 .name = "hdmi_msm",
1700 .id = 0,
1701 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1702 .resource = hdmi_msm_resources,
1703 .dev.platform_data = &hdmi_msm_data,
1704};
1705#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1706
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001707#ifdef CONFIG_MSM_BUS_SCALING
1708static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1709 {
1710 .src = MSM_BUS_MASTER_MDP_PORT0,
1711 .dst = MSM_BUS_SLAVE_EBI_CH0,
1712 .ab = 0,
1713 .ib = 0,
1714 },
1715};
1716static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1717 {
1718 .src = MSM_BUS_MASTER_MDP_PORT0,
1719 .dst = MSM_BUS_SLAVE_EBI_CH0,
1720 .ab = 566092800 * 2,
1721 .ib = 707616000 * 2,
1722 },
1723};
1724static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1725 {
1726 ARRAY_SIZE(dtv_bus_init_vectors),
1727 dtv_bus_init_vectors,
1728 },
1729 {
1730 ARRAY_SIZE(dtv_bus_def_vectors),
1731 dtv_bus_def_vectors,
1732 },
1733};
1734static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1735 dtv_bus_scale_usecases,
1736 ARRAY_SIZE(dtv_bus_scale_usecases),
1737 .name = "dtv",
1738};
1739
1740static struct lcdc_platform_data dtv_pdata = {
1741 .bus_scale_table = &dtv_bus_scale_pdata,
1742};
1743#endif
1744
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001745static void __init msm_fb_add_devices(void)
1746{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001747 struct platform_device *ptr = NULL;
1748
1749 if (machine_is_msm8960_liquid())
1750 ptr = &mipi_dsi2lvds_bridge_device;
1751 else
1752 ptr = &mipi_dsi_toshiba_panel_device;
1753 platform_add_devices(&ptr, 1);
1754
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001755 if (machine_is_msm8x60_rumi3()) {
1756 msm_fb_register_device("mdp", NULL);
1757 mipi_dsi_pdata.target_type = 1;
1758 } else
1759 msm_fb_register_device("mdp", &mdp_pdata);
1760 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001761#ifdef CONFIG_MSM_BUS_SCALING
1762 msm_fb_register_device("dtv", &dtv_pdata);
1763#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001764}
1765
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001766static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1767 .func = GPIOMUX_FUNC_GPIO,
1768 .drv = GPIOMUX_DRV_2MA,
1769 .pull = GPIOMUX_PULL_DOWN,
1770};
1771
1772static struct gpiomux_setting mdp_vsync_active_cfg = {
1773 .func = GPIOMUX_FUNC_1,
1774 .drv = GPIOMUX_DRV_2MA,
1775 .pull = GPIOMUX_PULL_DOWN,
1776};
1777
1778static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1779 {
1780 .gpio = MDP_VSYNC_GPIO,
1781 .settings = {
1782 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1783 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1784 },
1785 }
1786};
1787
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001788#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1789static struct gpiomux_setting hdmi_suspend_cfg = {
1790 .func = GPIOMUX_FUNC_GPIO,
1791 .drv = GPIOMUX_DRV_2MA,
1792 .pull = GPIOMUX_PULL_DOWN,
1793};
1794
1795static struct gpiomux_setting hdmi_active_1_cfg = {
1796 .func = GPIOMUX_FUNC_1,
1797 .drv = GPIOMUX_DRV_2MA,
1798 .pull = GPIOMUX_PULL_UP,
1799};
1800
1801static struct gpiomux_setting hdmi_active_2_cfg = {
1802 .func = GPIOMUX_FUNC_1,
1803 .drv = GPIOMUX_DRV_2MA,
1804 .pull = GPIOMUX_PULL_DOWN,
1805};
1806
1807static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1808 {
1809 .gpio = 99,
1810 .settings = {
1811 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1812 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1813 },
1814 },
1815 {
1816 .gpio = 100,
1817 .settings = {
1818 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1819 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1820 },
1821 },
1822 {
1823 .gpio = 101,
1824 .settings = {
1825 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1826 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1827 },
1828 },
1829 {
1830 .gpio = 102,
1831 .settings = {
1832 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1833 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1834 },
1835 },
1836};
1837
1838static int hdmi_enable_5v(int on)
1839{
1840 /* TBD: PM8921 regulator instead of 8901 */
1841 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1842 static int prev_on;
1843 int rc;
1844
1845 if (on == prev_on)
1846 return 0;
1847
1848 if (!reg_8921_hdmi_mvs)
1849 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1850 "hdmi_mvs");
1851
1852 if (on) {
1853 rc = regulator_enable(reg_8921_hdmi_mvs);
1854 if (rc) {
1855 pr_err("'%s' regulator enable failed, rc=%d\n",
1856 "8921_hdmi_mvs", rc);
1857 return rc;
1858 }
1859 pr_debug("%s(on): success\n", __func__);
1860 } else {
1861 rc = regulator_disable(reg_8921_hdmi_mvs);
1862 if (rc)
1863 pr_warning("'%s' regulator disable failed, rc=%d\n",
1864 "8921_hdmi_mvs", rc);
1865 pr_debug("%s(off): success\n", __func__);
1866 }
1867
1868 prev_on = on;
1869
1870 return 0;
1871}
1872
1873static int hdmi_core_power(int on, int show)
1874{
1875 static struct regulator *reg_8921_l23, *reg_8921_s4;
1876 static int prev_on;
1877 int rc;
1878
1879 if (on == prev_on)
1880 return 0;
1881
1882 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001883 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001884 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001885 if (IS_ERR(reg_8921_l23)) {
1886 pr_err("could not get reg_8921_l23, rc = %ld\n",
1887 PTR_ERR(reg_8921_l23));
1888 return -ENODEV;
1889 }
1890 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1891 if (rc) {
1892 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
1893 return -EINVAL;
1894 }
1895 }
1896 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001897 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001898 if (IS_ERR(reg_8921_s4)) {
1899 pr_err("could not get reg_8921_s4, rc = %ld\n",
1900 PTR_ERR(reg_8921_s4));
1901 return -ENODEV;
1902 }
1903 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1904 if (rc) {
1905 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
1906 return -EINVAL;
1907 }
1908 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001909
1910 if (on) {
1911 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1912 if (rc < 0) {
1913 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1914 return -EINVAL;
1915 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001916 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001917 if (rc) {
1918 pr_err("'%s' regulator enable failed, rc=%d\n",
1919 "hdmi_avdd", rc);
1920 return rc;
1921 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001922 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001923 if (rc) {
1924 pr_err("'%s' regulator enable failed, rc=%d\n",
1925 "hdmi_vcc", rc);
1926 return rc;
1927 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001928 rc = gpio_request(100, "HDMI_DDC_CLK");
1929 if (rc) {
1930 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1931 "HDMI_DDC_CLK", 100, rc);
1932 goto error1;
1933 }
1934 rc = gpio_request(101, "HDMI_DDC_DATA");
1935 if (rc) {
1936 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1937 "HDMI_DDC_DATA", 101, rc);
1938 goto error2;
1939 }
1940 rc = gpio_request(102, "HDMI_HPD");
1941 if (rc) {
1942 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1943 "HDMI_HPD", 102, rc);
1944 goto error3;
1945 }
1946 pr_debug("%s(on): success\n", __func__);
1947 } else {
1948 gpio_free(100);
1949 gpio_free(101);
1950 gpio_free(102);
1951
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001952 rc = regulator_disable(reg_8921_l23);
1953 if (rc) {
1954 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
1955 return -ENODEV;
1956 }
1957 rc = regulator_disable(reg_8921_s4);
1958 if (rc) {
1959 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
1960 return -ENODEV;
1961 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001962 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1963 if (rc < 0) {
1964 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1965 return -EINVAL;
1966 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001967 pr_debug("%s(off): success\n", __func__);
1968 }
1969
1970 prev_on = on;
1971
1972 return 0;
1973
1974error3:
1975 gpio_free(101);
1976error2:
1977 gpio_free(100);
1978error1:
1979 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001980 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001981 return rc;
1982}
1983
1984static int hdmi_cec_power(int on)
1985{
1986 static int prev_on;
1987 int rc;
1988
1989 if (on == prev_on)
1990 return 0;
1991
1992 if (on) {
1993 rc = gpio_request(99, "HDMI_CEC_VAR");
1994 if (rc) {
1995 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1996 "HDMI_CEC_VAR", 99, rc);
1997 goto error;
1998 }
1999 pr_debug("%s(on): success\n", __func__);
2000 } else {
2001 gpio_free(99);
2002 pr_debug("%s(off): success\n", __func__);
2003 }
2004
2005 prev_on = on;
2006
2007 return 0;
2008error:
2009 return rc;
2010}
2011#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2012
2013static void __init msm8960_allocate_memory_regions(void)
2014{
2015 void *addr;
2016 unsigned long size;
2017
2018 size = MSM_FB_SIZE;
2019 addr = alloc_bootmem_align(size, 0x1000);
2020 msm_fb_resources[0].start = __pa(addr);
2021 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2022 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2023 size, addr, __pa(addr));
2024
2025}
2026#ifdef CONFIG_WCD9310_CODEC
2027
2028#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2029
Patrick Lai3043fba2011-08-01 14:15:57 -07002030/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2031 * 4 micbiases are used to power various analog and digital
2032 * microphones operating at 1800 mV. Technically, all micbiases
2033 * can source from single cfilter since all microphones operate
2034 * at the same voltage level. The arrangement below is to make
2035 * sure all cfilters are exercised. LDO_H regulator ouput level
2036 * does not need to be as high as 2.85V. It is choosen for
2037 * microphone sensitivity purpose.
2038 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002039static struct tabla_pdata tabla_platform_data = {
2040 .slimbus_slave_device = {
2041 .name = "tabla-slave",
2042 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2043 },
2044 .irq = MSM_GPIO_TO_INT(62),
2045 .irq_base = TABLA_INTERRUPT_BASE,
2046 .num_irqs = NR_TABLA_IRQS,
2047 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002048 .micbias = {
2049 .ldoh_v = TABLA_LDOH_2P85_V,
2050 .cfilt1_mv = 1800,
2051 .cfilt2_mv = 1800,
2052 .cfilt3_mv = 1800,
2053 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2054 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2055 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2056 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2057 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002058};
2059
2060static struct slim_device msm_slim_tabla = {
2061 .name = "tabla-slim",
2062 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2063 .dev = {
2064 .platform_data = &tabla_platform_data,
2065 },
2066};
2067#endif
2068
2069static struct slim_boardinfo msm_slim_devices[] = {
2070#ifdef CONFIG_WCD9310_CODEC
2071 {
2072 .bus_num = 1,
2073 .slim_slave = &msm_slim_tabla,
2074 },
2075#endif
2076 /* add more slimbus slaves as needed */
2077};
2078
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002079#define MSM_WCNSS_PHYS 0x03000000
2080#define MSM_WCNSS_SIZE 0x280000
2081
2082static struct resource resources_wcnss_wlan[] = {
2083 {
2084 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2085 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2086 .name = "wcnss_wlanrx_irq",
2087 .flags = IORESOURCE_IRQ,
2088 },
2089 {
2090 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2091 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2092 .name = "wcnss_wlantx_irq",
2093 .flags = IORESOURCE_IRQ,
2094 },
2095 {
2096 .start = MSM_WCNSS_PHYS,
2097 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2098 .name = "wcnss_mmio",
2099 .flags = IORESOURCE_MEM,
2100 },
2101};
2102
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002103static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2104 .has_48mhz_xo = 1,
2105};
2106
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002107static struct platform_device msm_device_wcnss_wlan = {
2108 .name = "wcnss_wlan",
2109 .id = 0,
2110 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2111 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002112 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002113};
2114
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002115#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2116 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2117 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2118 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2119
2120#define QCE_SIZE 0x10000
2121#define QCE_0_BASE 0x18500000
2122
2123#define QCE_HW_KEY_SUPPORT 0
2124#define QCE_SHA_HMAC_SUPPORT 1
2125#define QCE_SHARE_CE_RESOURCE 1
2126#define QCE_CE_SHARED 0
2127
2128static struct resource qcrypto_resources[] = {
2129 [0] = {
2130 .start = QCE_0_BASE,
2131 .end = QCE_0_BASE + QCE_SIZE - 1,
2132 .flags = IORESOURCE_MEM,
2133 },
2134 [1] = {
2135 .name = "crypto_channels",
2136 .start = DMOV_CE_IN_CHAN,
2137 .end = DMOV_CE_OUT_CHAN,
2138 .flags = IORESOURCE_DMA,
2139 },
2140 [2] = {
2141 .name = "crypto_crci_in",
2142 .start = DMOV_CE_IN_CRCI,
2143 .end = DMOV_CE_IN_CRCI,
2144 .flags = IORESOURCE_DMA,
2145 },
2146 [3] = {
2147 .name = "crypto_crci_out",
2148 .start = DMOV_CE_OUT_CRCI,
2149 .end = DMOV_CE_OUT_CRCI,
2150 .flags = IORESOURCE_DMA,
2151 },
2152};
2153
2154static struct resource qcedev_resources[] = {
2155 [0] = {
2156 .start = QCE_0_BASE,
2157 .end = QCE_0_BASE + QCE_SIZE - 1,
2158 .flags = IORESOURCE_MEM,
2159 },
2160 [1] = {
2161 .name = "crypto_channels",
2162 .start = DMOV_CE_IN_CHAN,
2163 .end = DMOV_CE_OUT_CHAN,
2164 .flags = IORESOURCE_DMA,
2165 },
2166 [2] = {
2167 .name = "crypto_crci_in",
2168 .start = DMOV_CE_IN_CRCI,
2169 .end = DMOV_CE_IN_CRCI,
2170 .flags = IORESOURCE_DMA,
2171 },
2172 [3] = {
2173 .name = "crypto_crci_out",
2174 .start = DMOV_CE_OUT_CRCI,
2175 .end = DMOV_CE_OUT_CRCI,
2176 .flags = IORESOURCE_DMA,
2177 },
2178};
2179
2180#endif
2181
2182#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2183 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2184
2185static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2186 .ce_shared = QCE_CE_SHARED,
2187 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2188 .hw_key_support = QCE_HW_KEY_SUPPORT,
2189 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2190};
2191
2192static struct platform_device qcrypto_device = {
2193 .name = "qcrypto",
2194 .id = 0,
2195 .num_resources = ARRAY_SIZE(qcrypto_resources),
2196 .resource = qcrypto_resources,
2197 .dev = {
2198 .coherent_dma_mask = DMA_BIT_MASK(32),
2199 .platform_data = &qcrypto_ce_hw_suppport,
2200 },
2201};
2202#endif
2203
2204#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2205 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2206
2207static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2208 .ce_shared = QCE_CE_SHARED,
2209 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2210 .hw_key_support = QCE_HW_KEY_SUPPORT,
2211 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2212};
2213
2214static struct platform_device qcedev_device = {
2215 .name = "qce",
2216 .id = 0,
2217 .num_resources = ARRAY_SIZE(qcedev_resources),
2218 .resource = qcedev_resources,
2219 .dev = {
2220 .coherent_dma_mask = DMA_BIT_MASK(32),
2221 .platform_data = &qcedev_ce_hw_suppport,
2222 },
2223};
2224#endif
2225
2226
2227static int __init gpiomux_init(void)
2228{
2229 int rc;
2230
2231 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2232 if (rc) {
2233 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2234 return rc;
2235 }
2236
Nishant Pandit24153d82011-08-27 16:05:13 +05302237 msm_gpiomux_install(msm8960_cam_common_configs,
2238 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002239
2240 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002241 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002242
2243 msm_gpiomux_install(msm8960_gsbi_configs,
2244 ARRAY_SIZE(msm8960_gsbi_configs));
2245
2246 msm_gpiomux_install(msm8960_cyts_configs,
2247 ARRAY_SIZE(msm8960_cyts_configs));
2248
2249 msm_gpiomux_install(msm8960_slimbus_config,
2250 ARRAY_SIZE(msm8960_slimbus_config));
2251
2252 msm_gpiomux_install(msm8960_audio_codec_configs,
2253 ARRAY_SIZE(msm8960_audio_codec_configs));
2254
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002255 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2256 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2257
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002258#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2259 msm_gpiomux_install(msm8960_hdmi_configs,
2260 ARRAY_SIZE(msm8960_hdmi_configs));
2261#endif
2262
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002263 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2264 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2265
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002266 msm_gpiomux_install(wcnss_5wire_interface,
2267 ARRAY_SIZE(wcnss_5wire_interface));
2268
2269 return 0;
2270}
2271
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002272#define MSM_SHARED_RAM_PHYS 0x80000000
2273
2274static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2275 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2276 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2277 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2278 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2279 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2280 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2281 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2282 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2283 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2284 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2285 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2286 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2287 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
2288 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2289 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
2290 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2291 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2292 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2293 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2294 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2295 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2296 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2297 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2298 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2299 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2300 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2301 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2302 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2303 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2304 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002305 {"pa_therm", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
2306 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2307 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2308 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309};
2310
2311static struct pm8921_adc_properties pm8921_adc_data = {
2312 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2313 .bitresolution = 15,
2314 .bipolar = 0,
2315};
2316
2317static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2318 .adc_channel = pm8921_adc_channels_data,
2319 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
2320 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadossab1cea62011-09-20 16:25:59 -07002321 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(0),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002322};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002323
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002324static void __init msm8960_map_io(void)
2325{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002326 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002327 msm_map_msm8960_io();
2328}
2329
2330static void __init msm8960_init_irq(void)
2331{
2332 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002333
2334 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002335 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002336 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002337
2338 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002339 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002340
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002341 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2342 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002343
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002344 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2345 * as they are configured as level, which does not play nice with
2346 * handle_percpu_irq.
2347 */
2348 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2349 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002350 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002351 }
2352}
2353
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002354/* MSM8960 have 5 SDCC controllers */
2355enum sdcc_controllers {
2356 SDCC1,
2357 SDCC2,
2358 SDCC3,
2359 SDCC4,
2360 SDCC5,
2361 MAX_SDCC_CONTROLLER
2362};
2363
2364/* All SDCC controllers requires VDD/VCC voltage */
2365static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2366 /* SDCC1 : eMMC card connected */
2367 [SDCC1] = {
2368 .name = "sdc_vdd",
2369 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302370 .high_vol_level = 2950000,
2371 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302372 .always_on = 1,
2373 .lpm_sup = 1,
2374 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002375 .hpm_uA = 200000, /* 200mA */
2376 },
2377 /* SDCC3 : External card slot connected */
2378 [SDCC3] = {
2379 .name = "sdc_vdd",
2380 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302381 .high_vol_level = 2950000,
2382 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002383 .hpm_uA = 600000, /* 600mA */
2384 }
2385};
2386
2387/* Only slots having eMMC card will require VCCQ voltage */
2388static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2389 /* SDCC1 : eMMC card connected */
2390 [SDCC1] = {
2391 .name = "sdc_vccq",
2392 .set_voltage_sup = 1,
2393 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302394 .high_vol_level = 1800000,
2395 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002396 .hpm_uA = 200000, /* 200mA */
2397 }
2398};
2399
2400/* All SDCC controllers may require voting for VDD PAD voltage */
2401static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2402 /* SDCC3 : External card slot connected */
2403 [SDCC3] = {
2404 .name = "sdc_vddp",
2405 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302406 .high_vol_level = 2950000,
2407 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002408 .always_on = 1,
2409 .lpm_sup = 1,
2410 /* Max. Active current required is 16 mA */
2411 .hpm_uA = 16000,
2412 /*
2413 * Sleep current required is ~300 uA. But min. vote can be
2414 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2415 * during sleep.
2416 */
2417 .lpm_uA = 2000,
2418 }
2419};
2420
2421static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2422 /* SDCC1 : eMMC card connected */
2423 [SDCC1] = {
2424 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2425 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2426 },
2427 /* SDCC3 : External card slot connected */
2428 [SDCC3] = {
2429 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2430 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2431 }
2432};
2433
2434/* SDC1 pad data */
2435static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2436 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302437 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2438 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002439};
2440
2441static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2442 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2443 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2444 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2445};
2446
2447static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302448 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002449 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2450 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2451};
2452
2453static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302454 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002455 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2456 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2457};
2458
2459/* SDC3 pad data */
2460static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2461 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2462 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2463 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2464};
2465
2466static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2467 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2468 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2469 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2470};
2471
2472static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302473 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002474 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2475 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2476};
2477
2478static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302479 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002480 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2481 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2482};
2483
2484struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2485 [SDCC1] = {
2486 .on = sdc1_pad_pull_on_cfg,
2487 .off = sdc1_pad_pull_off_cfg,
2488 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2489 },
2490 [SDCC3] = {
2491 .on = sdc3_pad_pull_on_cfg,
2492 .off = sdc3_pad_pull_off_cfg,
2493 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2494 },
2495};
2496
2497struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2498 [SDCC1] = {
2499 .on = sdc1_pad_drv_on_cfg,
2500 .off = sdc1_pad_drv_off_cfg,
2501 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2502 },
2503 [SDCC3] = {
2504 .on = sdc3_pad_drv_on_cfg,
2505 .off = sdc3_pad_drv_off_cfg,
2506 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2507 },
2508};
2509
2510struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2511 [SDCC1] = {
2512 .pull = &mmc_pad_pull_data[SDCC1],
2513 .drv = &mmc_pad_drv_data[SDCC1]
2514 },
2515 [SDCC3] = {
2516 .pull = &mmc_pad_pull_data[SDCC3],
2517 .drv = &mmc_pad_drv_data[SDCC3]
2518 },
2519};
2520
2521struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2522 [SDCC1] = {
2523 .pad_data = &mmc_pad_data[SDCC1],
2524 },
2525 [SDCC3] = {
2526 .pad_data = &mmc_pad_data[SDCC3],
2527 },
2528};
2529
2530static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302531 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002532};
2533
2534static unsigned int sdc3_sup_clk_rates[] = {
2535 400000, 24000000, 48000000, 96000000
2536};
2537
2538#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2539static struct mmc_platform_data msm8960_sdc1_data = {
2540 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2541#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2542 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2543#else
2544 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2545#endif
2546 .sup_clk_table = sdc1_sup_clk_rates,
2547 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2548 .nonremovable = 1,
2549 .sdcc_v4_sup = true,
2550 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302551 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002552};
2553#endif
2554
2555#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2556static struct mmc_platform_data msm8960_sdc3_data = {
2557 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2558 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2559 .sup_clk_table = sdc3_sup_clk_rates,
2560 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302561#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002562 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302563#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002564 .sdcc_v4_sup = true,
2565 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2566 .pin_data = &mmc_slot_pin_data[SDCC3],
2567#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2568 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2569 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2570 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2571#endif
2572 .xpc_cap = 1,
2573 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2574 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302575 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002576};
2577#endif
2578
2579static void __init msm8960_init_mmc(void)
2580{
2581#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2582 /* SDC1 : eMMC card connected */
2583 msm_add_sdcc(1, &msm8960_sdc1_data);
2584#endif
2585#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2586 /* SDC3: External card slot */
2587 msm_add_sdcc(3, &msm8960_sdc3_data);
2588#endif
2589}
2590
2591static void __init msm8960_init_buses(void)
2592{
2593#ifdef CONFIG_MSM_BUS_SCALING
2594 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2595 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2596 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2597 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2598 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2599 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2600 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2601 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2602 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2603 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2604#endif
2605}
2606
2607static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2608 .max_clock_speed = 15060000,
2609};
2610
2611#ifdef CONFIG_USB_MSM_OTG_72K
2612static struct msm_otg_platform_data msm_otg_pdata;
2613#else
2614#define USB_5V_EN 42
2615static void msm_hsusb_vbus_power(bool on)
2616{
2617 int rc;
2618 static bool vbus_is_on;
2619 static struct regulator *mvs_otg_switch;
2620 struct pm_gpio param = {
2621 .direction = PM_GPIO_DIR_OUT,
2622 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2623 .output_value = 1,
2624 .pull = PM_GPIO_PULL_NO,
2625 .vin_sel = PM_GPIO_VIN_S4,
2626 .out_strength = PM_GPIO_STRENGTH_MED,
2627 .function = PM_GPIO_FUNC_NORMAL,
2628 };
2629
2630 if (vbus_is_on == on)
2631 return;
2632
2633 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002634 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2635 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002636 if (IS_ERR(mvs_otg_switch)) {
2637 pr_err("Unable to get mvs_otg_switch\n");
2638 return;
2639 }
2640
2641 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2642 "usb_5v_en");
2643 if (rc < 0) {
2644 pr_err("failed to request usb_5v_en gpio\n");
2645 goto put_mvs_otg;
2646 }
2647
2648 if (regulator_enable(mvs_otg_switch)) {
2649 pr_err("unable to enable mvs_otg_switch\n");
2650 goto free_usb_5v_en;
2651 }
2652
2653 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2654 &param);
2655 if (rc < 0) {
2656 pr_err("failed to configure usb_5v_en gpio\n");
2657 goto disable_mvs_otg;
2658 }
2659 vbus_is_on = true;
2660 return;
2661 }
2662disable_mvs_otg:
2663 regulator_disable(mvs_otg_switch);
2664free_usb_5v_en:
2665 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2666put_mvs_otg:
2667 regulator_put(mvs_otg_switch);
2668 vbus_is_on = false;
2669}
2670
2671static struct msm_otg_platform_data msm_otg_pdata = {
2672 .mode = USB_OTG,
2673 .otg_control = OTG_PMIC_CONTROL,
2674 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2675 .pclk_src_name = "dfab_usb_hs_clk",
2676 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2677 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302678 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002679};
2680#endif
2681
2682#define PID_MAGIC_ID 0x71432909
2683#define SERIAL_NUM_MAGIC_ID 0x61945374
2684#define SERIAL_NUMBER_LENGTH 127
2685#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2686
2687struct magic_num_struct {
2688 uint32_t pid;
2689 uint32_t serial_num;
2690};
2691
2692struct dload_struct {
2693 uint32_t reserved1;
2694 uint32_t reserved2;
2695 uint32_t reserved3;
2696 uint16_t reserved4;
2697 uint16_t pid;
2698 char serial_number[SERIAL_NUMBER_LENGTH];
2699 uint16_t reserved5;
2700 struct magic_num_struct magic_struct;
2701};
2702
2703static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2704{
2705 struct dload_struct __iomem *dload = 0;
2706
2707 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2708 if (!dload) {
2709 pr_err("%s: cannot remap I/O memory region: %08x\n",
2710 __func__, DLOAD_USB_BASE_ADD);
2711 return -ENXIO;
2712 }
2713
2714 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2715 __func__, dload, pid, snum);
2716 /* update pid */
2717 dload->magic_struct.pid = PID_MAGIC_ID;
2718 dload->pid = pid;
2719
2720 /* update serial number */
2721 dload->magic_struct.serial_num = 0;
2722 if (!snum) {
2723 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2724 goto out;
2725 }
2726
2727 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2728 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2729 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2730out:
2731 iounmap(dload);
2732 return 0;
2733}
2734
2735static struct android_usb_platform_data android_usb_pdata = {
2736 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2737};
2738
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002739static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002740 .name = "android_usb",
2741 .id = -1,
2742 .dev = {
2743 .platform_data = &android_usb_pdata,
2744 },
2745};
2746
2747static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2748 0x03, 0x0f,
2749};
2750
2751static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2752 0x00, 0x24, 0x54, 0x10,
2753 0x09, 0x03, 0x01,
2754 0x10, 0x54, 0x30, 0x0C,
2755 0x24, 0x30, 0x0f,
2756};
2757
2758static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2759 0x00, 0x24, 0x54, 0x10,
2760 0x09, 0x07, 0x01, 0x0B,
2761 0x10, 0x54, 0x30, 0x0C,
2762 0x24, 0x30, 0x0f,
2763};
2764
2765static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2766 [0] = {
2767 .mode = MSM_SPM_MODE_CLOCK_GATING,
2768 .notify_rpm = false,
2769 .cmd = spm_wfi_cmd_sequence,
2770 },
2771 [1] = {
2772 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2773 .notify_rpm = false,
2774 .cmd = spm_power_collapse_without_rpm,
2775 },
2776 [2] = {
2777 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2778 .notify_rpm = true,
2779 .cmd = spm_power_collapse_with_rpm,
2780 },
2781};
2782
2783static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2784 [0] = {
2785 .reg_base_addr = MSM_SAW0_BASE,
2786 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2787 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2788 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2789#if defined(CONFIG_MSM_AVS_HW)
2790 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2791 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2792#endif
2793 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2794 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2795 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2796 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2797 .vctl_timeout_us = 50,
2798 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2799 .modes = msm_spm_seq_list,
2800 },
2801 [1] = {
2802 .reg_base_addr = MSM_SAW1_BASE,
2803 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2804 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2805 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2806#if defined(CONFIG_MSM_AVS_HW)
2807 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2808 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2809#endif
2810 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2811 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2812 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2813 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2814 .vctl_timeout_us = 50,
2815 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2816 .modes = msm_spm_seq_list,
2817 },
2818};
2819
2820static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2821 0x00, 0x20, 0x03, 0x20,
2822 0x00, 0x0f,
2823};
2824
2825static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2826 0x00, 0x20, 0x34, 0x64,
2827 0x48, 0x07, 0x48, 0x20,
2828 0x50, 0x64, 0x04, 0x34,
2829 0x50, 0x0f,
2830};
2831static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2832 0x00, 0x10, 0x34, 0x64,
2833 0x48, 0x07, 0x48, 0x10,
2834 0x50, 0x64, 0x04, 0x34,
2835 0x50, 0x0F,
2836};
2837
2838static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2839 [0] = {
2840 .mode = MSM_SPM_L2_MODE_RETENTION,
2841 .notify_rpm = false,
2842 .cmd = l2_spm_wfi_cmd_sequence,
2843 },
2844 [1] = {
2845 .mode = MSM_SPM_L2_MODE_GDHS,
2846 .notify_rpm = true,
2847 .cmd = l2_spm_gdhs_cmd_sequence,
2848 },
2849 [2] = {
2850 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2851 .notify_rpm = true,
2852 .cmd = l2_spm_power_off_cmd_sequence,
2853 },
2854};
2855
2856
2857static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2858 [0] = {
2859 .reg_base_addr = MSM_SAW_L2_BASE,
2860 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2861 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2862 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2863 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2864 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2865 .modes = msm_spm_l2_seq_list,
2866 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2867 },
2868};
2869
2870#define CYTTSP_TS_GPIO_IRQ 11
2871#define CYTTSP_TS_SLEEP_GPIO 50
2872#define CYTTSP_TS_RESOUT_N_GPIO 52
2873
2874/*virtual key support */
2875static ssize_t tma340_vkeys_show(struct kobject *kobj,
2876 struct kobj_attribute *attr, char *buf)
2877{
2878 return snprintf(buf, 200,
2879 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2880 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2881 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2882 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2883 "\n");
2884}
2885
2886static struct kobj_attribute tma340_vkeys_attr = {
2887 .attr = {
2888 .mode = S_IRUGO,
2889 },
2890 .show = &tma340_vkeys_show,
2891};
2892
2893static struct attribute *tma340_properties_attrs[] = {
2894 &tma340_vkeys_attr.attr,
2895 NULL
2896};
2897
2898static struct attribute_group tma340_properties_attr_group = {
2899 .attrs = tma340_properties_attrs,
2900};
2901
2902
2903static int cyttsp_platform_init(struct i2c_client *client)
2904{
2905 int rc = 0;
2906 static struct kobject *tma340_properties_kobj;
2907
2908 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2909 tma340_properties_kobj = kobject_create_and_add("board_properties",
2910 NULL);
2911 if (tma340_properties_kobj)
2912 rc = sysfs_create_group(tma340_properties_kobj,
2913 &tma340_properties_attr_group);
2914 if (!tma340_properties_kobj || rc)
2915 pr_err("%s: failed to create board_properties\n",
2916 __func__);
2917
2918 return 0;
2919}
2920
2921static struct cyttsp_regulator regulator_data[] = {
2922 {
2923 .name = "vdd",
2924 .min_uV = CY_TMA300_VTG_MIN_UV,
2925 .max_uV = CY_TMA300_VTG_MAX_UV,
2926 .load_uA = CY_TMA300_CURR_24HZ_UA,
2927 },
2928 /* TODO: Remove after runtime PM is enabled in I2C driver */
2929 {
2930 .name = "vcc_i2c",
2931 .min_uV = CY_I2C_VTG_MIN_UV,
2932 .max_uV = CY_I2C_VTG_MAX_UV,
2933 .load_uA = CY_I2C_CURR_UA,
2934 },
2935};
2936
2937static struct cyttsp_platform_data cyttsp_pdata = {
2938 .panel_maxx = 634,
2939 .panel_maxy = 1166,
2940 .disp_maxx = 616,
2941 .disp_maxy = 1023,
2942 .disp_minx = 0,
2943 .disp_miny = 16,
2944 .flags = 0x01,
2945 .gen = CY_GEN3, /* or */
2946 .use_st = CY_USE_ST,
2947 .use_mt = CY_USE_MT,
2948 .use_hndshk = CY_SEND_HNDSHK,
2949 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302950 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002951 .use_gestures = CY_USE_GESTURES,
2952 .fw_fname = "cyttsp_8960_cdp.hex",
2953 /* activate up to 4 groups
2954 * and set active distance
2955 */
2956 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2957 CY_GEST_GRP3 | CY_GEST_GRP4 |
2958 CY_ACT_DIST,
2959 /* change act_intrvl to customize the Active power state
2960 * scanning/processing refresh interval for Operating mode
2961 */
2962 .act_intrvl = CY_ACT_INTRVL_DFLT,
2963 /* change tch_tmout to customize the touch timeout for the
2964 * Active power state for Operating mode
2965 */
2966 .tch_tmout = CY_TCH_TMOUT_DFLT,
2967 /* change lp_intrvl to customize the Low Power power state
2968 * scanning/processing refresh interval for Operating mode
2969 */
2970 .lp_intrvl = CY_LP_INTRVL_DFLT,
2971 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2972 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2973 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2974 .regulator_info = regulator_data,
2975 .num_regulators = ARRAY_SIZE(regulator_data),
2976 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302977 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002978};
2979
2980static struct i2c_board_info cyttsp_info[] __initdata = {
2981 {
2982 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2983 .platform_data = &cyttsp_pdata,
2984#ifndef CY_USE_TIMER
2985 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2986#endif /* CY_USE_TIMER */
2987 },
2988};
2989
Mohan Pallaka50837382011-09-07 11:00:57 +05302990/* configuration data */
2991static const u8 mxt_config_data[] = {
2992 /* T6 Object */
2993 0, 0, 0, 0, 0, 0,
2994 /* T38 Object */
2995 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
2996 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2997 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2999 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3000 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3001 0, 0, 0, 0,
3002 /* T7 Object */
3003 10, 10, 50,
3004 /* T8 Object */
3005 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3006 /* T9 Object */
3007 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3008 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3009 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3010 0, 5, 45, 46,
3011 /* T15 Object */
3012 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3013 0,
3014 /* T22 Object */
3015 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3016 0, 0, 255, 255, 255, 255, 0,
3017 /* T24 Object */
3018 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3019 0, 0, 0, 0, 0, 0, 0, 0, 0,
3020 /* T25 Object */
3021 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3022 0, 0, 0, 0,
3023 /* T27 Object */
3024 0, 0, 0, 0, 0, 0, 0,
3025 /* T28 Object */
3026 0, 0, 0, 8, 8, 8,
3027 /* T40 Object */
3028 0, 0, 0, 0, 0,
3029 /* T41 Object */
3030 0, 0, 0, 0, 0, 0,
3031 /* T43 Object */
3032 0, 0, 0, 0, 0, 0,
3033};
3034
3035#define MXT_TS_GPIO_IRQ 11
3036#define MXT_TS_LDO_EN_GPIO 50
3037#define MXT_TS_RESET_GPIO 52
3038
3039static void mxt_init_hw_liquid(void)
3040{
3041 int rc;
3042
3043 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3044 if (rc) {
3045 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3046 __func__, MXT_TS_GPIO_IRQ);
3047 return;
3048 }
3049
3050 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3051 if (rc) {
3052 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3053 __func__, MXT_TS_GPIO_IRQ);
3054 goto err_irq_gpio_req;
3055 }
3056
3057 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3058 if (rc) {
3059 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3060 __func__, MXT_TS_LDO_EN_GPIO);
3061 goto err_irq_gpio_req;
3062 }
3063
3064 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3065 if (rc) {
3066 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3067 __func__, MXT_TS_LDO_EN_GPIO);
3068 goto err_ldo_gpio_req;
3069 }
3070
3071 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3072 if (rc) {
3073 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3074 __func__, MXT_TS_RESET_GPIO);
3075 goto err_ldo_gpio_set_dir;
3076 }
3077
3078 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3079 if (rc) {
3080 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3081 __func__, MXT_TS_RESET_GPIO);
3082 goto err_reset_gpio_req;
3083 }
3084
3085 return;
3086
3087err_reset_gpio_req:
3088 gpio_free(MXT_TS_RESET_GPIO);
3089err_ldo_gpio_set_dir:
3090 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3091err_ldo_gpio_req:
3092 gpio_free(MXT_TS_LDO_EN_GPIO);
3093err_irq_gpio_req:
3094 gpio_free(MXT_TS_GPIO_IRQ);
3095}
3096
3097static struct mxt_platform_data mxt_platform_data = {
3098 .config = mxt_config_data,
3099 .config_length = ARRAY_SIZE(mxt_config_data),
3100 .x_line = 26,
3101 .y_line = 42,
3102 .x_size = 767,
3103 .y_size = 1365,
3104 .blen = 32,
3105 .threshold = 40,
3106 .voltage = 3300000, /* 3.3V */
3107 .orient = MXT_ROTATED_90,
3108 .irqflags = IRQF_TRIGGER_FALLING,
3109};
3110
3111static struct i2c_board_info mxt_device_info[] __initdata = {
3112 {
3113 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3114 .platform_data = &mxt_platform_data,
3115 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3116 },
3117};
3118
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003119static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3120{
3121}
3122
3123static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3124 .clk_freq = 100000,
3125 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003126 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3127};
3128
3129static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3130 .clk_freq = 100000,
3131 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003132 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3133};
3134
3135static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3136 .clk_freq = 100000,
3137 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003138 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3139};
3140
3141static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3142 .clk_freq = 100000,
3143 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003144 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3145};
3146
3147static struct msm_rpm_platform_data msm_rpm_data = {
3148 .reg_base_addrs = {
3149 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3150 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3151 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3152 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3153 },
3154
3155 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3156 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3157 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3158 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3159 .msm_apps_ipc_rpm_val = 4,
3160};
3161
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003162static struct platform_device msm_rpm_device = {
3163 .name = "msm_rpm",
3164 .id = -1,
3165};
3166
3167
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003168static struct spi_board_info spi_board_info[] __initdata = {
3169 {
3170 .modalias = "ks8851",
3171 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3172 .max_speed_hz = 19200000,
3173 .bus_num = 0,
3174 .chip_select = 0,
3175 .mode = SPI_MODE_0,
3176 },
3177};
3178
3179static struct platform_device msm_device_saw_core0 = {
3180 .name = "saw-regulator",
3181 .id = 0,
3182 .dev = {
3183 .platform_data = &msm_saw_regulator_pdata_s5,
3184 },
3185};
3186
3187static struct platform_device msm_device_saw_core1 = {
3188 .name = "saw-regulator",
3189 .id = 1,
3190 .dev = {
3191 .platform_data = &msm_saw_regulator_pdata_s6,
3192 },
3193};
3194
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003195static struct tsens_platform_data msm_tsens_pdata = {
3196 .slope = 910,
3197 .tsens_factor = 1000,
3198 .hw_type = MSM_8960,
3199 .tsens_num_sensor = 5,
3200};
3201
3202static struct platform_device msm_tsens_device = {
3203 .name = "tsens8960-tm",
3204 .id = -1,
3205 .dev = {
3206 .platform_data = &msm_tsens_pdata,
3207 },
3208};
3209
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003210#ifdef CONFIG_MSM_FAKE_BATTERY
3211static struct platform_device fish_battery_device = {
3212 .name = "fish_battery",
3213};
3214#endif
3215
David Collins26f05562011-06-20 09:56:28 -07003216static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003217 .name = GPIO_REGULATOR_DEV_NAME,
3218 .id = PM8921_MPP_PM_TO_SYS(7),
3219 .dev = {
3220 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3221 },
3222};
3223
David Collins26f05562011-06-20 09:56:28 -07003224static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003225 .name = GPIO_REGULATOR_DEV_NAME,
3226 .id = 91,
3227 .dev = {
3228 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3229 },
3230};
3231
David Collinsb10be1d2011-09-02 10:29:31 -07003232static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3233 .name = GPIO_REGULATOR_DEV_NAME,
3234 .id = PM8921_GPIO_PM_TO_SYS(17),
3235 .dev = {
3236 .platform_data =
3237 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3238 },
3239};
3240
David Collins26f05562011-06-20 09:56:28 -07003241static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3242 .name = "rpm-regulator",
3243 .id = -1,
3244 .dev = {
3245 .platform_data = &msm_rpm_regulator_pdata,
3246 },
3247};
3248
David Collins4c31a872011-08-31 10:07:10 -07003249static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3250 .phys_addr_base = 0x0010C000,
3251 .reg_offsets = {
3252 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3253 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3254 },
3255 .phys_size = SZ_8K,
3256 .log_len = 4096, /* log's buffer length in bytes */
3257 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3258};
3259
3260static struct platform_device msm_rpm_log_device = {
3261 .name = "msm_rpm_log",
3262 .id = -1,
3263 .dev = {
3264 .platform_data = &msm_rpm_log_pdata,
3265 },
3266};
3267
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003268static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003269 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003270 &msm_device_smd,
3271 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303272 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003273 &msm_device_saw_core0,
3274 &msm_device_saw_core1,
3275 &msm8960_device_ext_5v_vreg,
3276 &msm8960_device_ext_l2_vreg,
3277 &msm8960_device_ssbi_pm8921,
3278 &msm8960_device_qup_spi_gsbi1,
3279 &msm8960_device_qup_i2c_gsbi3,
3280 &msm8960_device_qup_i2c_gsbi4,
3281 &msm8960_device_qup_i2c_gsbi10,
3282#ifndef CONFIG_MSM_DSPS
3283 &msm8960_device_qup_i2c_gsbi12,
3284#endif
3285 &msm_slim_ctrl,
3286 &msm_device_wcnss_wlan,
3287#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3288 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3289 &qcrypto_device,
3290#endif
3291
3292#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3293 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3294 &qcedev_device,
3295#endif
3296#ifdef CONFIG_MSM_ROTATOR
3297 &msm_rotator_device,
3298#endif
3299 &msm_device_sps,
3300#ifdef CONFIG_MSM_FAKE_BATTERY
3301 &fish_battery_device,
3302#endif
3303#ifdef CONFIG_ANDROID_PMEM
3304 &android_pmem_device,
3305 &android_pmem_adsp_device,
3306 &android_pmem_audio_device,
3307#endif
3308 &msm_fb_device,
3309 &msm_device_vidc,
3310 &msm_device_bam_dmux,
3311 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003312
3313#ifdef CONFIG_HW_RANDOM_MSM
3314 &msm_device_rng,
3315#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003316 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003317#ifdef CONFIG_ION_MSM
3318 &ion_dev,
3319#endif
David Collins4c31a872011-08-31 10:07:10 -07003320 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003321#ifdef CONFIG_MSM_QDSS
3322 &msm_etb_device,
3323 &msm_tpiu_device,
3324 &msm_funnel_device,
3325 &msm_ptm_device,
3326#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003327};
3328
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003329static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003330 &msm8960_device_otg,
3331 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003332 &msm_device_hsusb_host,
3333 &android_usb_device,
3334 &msm_device_vidc,
3335 &mipi_dsi_simulator_panel_device,
3336 &msm_bus_apps_fabric,
3337 &msm_bus_sys_fabric,
3338 &msm_bus_mm_fabric,
3339 &msm_bus_sys_fpb,
3340 &msm_bus_cpss_fpb,
3341 &msm_pcm,
3342 &msm_pcm_routing,
3343 &msm_cpudai0,
3344 &msm_cpudai1,
3345 &msm_cpudai_hdmi_rx,
3346 &msm_cpudai_bt_rx,
3347 &msm_cpudai_bt_tx,
3348 &msm_cpudai_fm_rx,
3349 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003350 &msm_cpudai_auxpcm_rx,
3351 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003352 &msm_cpu_fe,
3353 &msm_stub_codec,
3354 &msm_voice,
3355 &msm_voip,
3356 &msm_lpa_pcm,
3357
3358#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3359 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3360 &qcrypto_device,
3361#endif
3362
3363#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3364 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3365 &qcedev_device,
3366#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003367};
3368
3369static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003370 &msm_kgsl_3d0,
3371 &msm_kgsl_2d0,
3372 &msm_kgsl_2d1,
3373 &mipi_dsi_renesas_panel_device,
3374#ifdef CONFIG_MSM_GEMINI
3375 &msm8960_gemini_device,
3376#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003377};
3378
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003379static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003380 &msm8960_device_otg,
3381 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003382 &msm_device_hsusb_host,
3383 &android_usb_device,
3384 &msm_pcm,
3385 &msm_pcm_routing,
3386 &msm_cpudai0,
3387 &msm_cpudai1,
3388 &msm_cpudai_hdmi_rx,
3389 &msm_cpudai_bt_rx,
3390 &msm_cpudai_bt_tx,
3391 &msm_cpudai_fm_rx,
3392 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003393 &msm_cpudai_auxpcm_rx,
3394 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003395 &msm_cpu_fe,
3396 &msm_stub_codec,
3397 &msm_kgsl_3d0,
3398#ifdef CONFIG_MSM_KGSL_2D
3399 &msm_kgsl_2d0,
3400 &msm_kgsl_2d1,
3401#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003402 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003403#ifdef CONFIG_MSM_GEMINI
3404 &msm8960_gemini_device,
3405#endif
3406 &msm_voice,
3407 &msm_voip,
3408 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303409 &msm_cpudai_afe_01_rx,
3410 &msm_cpudai_afe_01_tx,
3411 &msm_cpudai_afe_02_rx,
3412 &msm_cpudai_afe_02_tx,
3413 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003414#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3415 &hdmi_msm_device,
3416#endif
3417 &msm_pcm_hostless,
3418 &msm_bus_apps_fabric,
3419 &msm_bus_sys_fabric,
3420 &msm_bus_mm_fabric,
3421 &msm_bus_sys_fpb,
3422 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003423 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003424};
3425
3426static void __init msm8960_i2c_init(void)
3427{
3428 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3429 &msm8960_i2c_qup_gsbi4_pdata;
3430
3431 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3432 &msm8960_i2c_qup_gsbi3_pdata;
3433
3434 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3435 &msm8960_i2c_qup_gsbi10_pdata;
3436
3437 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3438 &msm8960_i2c_qup_gsbi12_pdata;
3439}
3440
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003441static void __init msm8960_gfx_init(void)
3442{
3443 uint32_t soc_platform_version = socinfo_get_platform_version();
3444 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3445 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3446 msm_kgsl_3d0.dev.platform_data;
3447 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3448 320000000;
3449 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3450 266667000;
3451 }
3452}
3453
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003454static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3455 .irq_base = PM8921_IRQ_BASE,
3456 .devirq = MSM_GPIO_TO_INT(104),
3457 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3458};
3459
3460static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3461 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3462};
3463
3464static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3465 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3466};
3467
3468static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3469 .rtc_write_enable = false,
3470};
3471
3472static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3473 .pull_up = 1,
3474 .kpd_trigger_delay_us = 970,
3475 .wakeup = 1,
3476};
3477
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303478/* Rotate lock key is not available so use F1 */
3479#define KEY_ROTATE_LOCK KEY_F1
3480
3481static const unsigned int keymap_liquid[] = {
3482 KEY(0, 0, KEY_VOLUMEUP),
3483 KEY(0, 1, KEY_VOLUMEDOWN),
3484 KEY(1, 3, KEY_ROTATE_LOCK),
3485 KEY(1, 4, KEY_HOME),
3486};
3487
3488static struct matrix_keymap_data keymap_data_liquid = {
3489 .keymap_size = ARRAY_SIZE(keymap_liquid),
3490 .keymap = keymap_liquid,
3491};
3492
3493static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3494 .input_name = "keypad_8960_liquid",
3495 .input_phys_device = "keypad_8960/input0",
3496 .num_rows = 2,
3497 .num_cols = 5,
3498 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3499 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3500 .debounce_ms = 15,
3501 .scan_delay_ms = 32,
3502 .row_hold_ns = 91500,
3503 .wakeup = 1,
3504 .keymap_data = &keymap_data_liquid,
3505};
3506
3507
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003508static const unsigned int keymap[] = {
3509 KEY(0, 0, KEY_VOLUMEUP),
3510 KEY(0, 1, KEY_VOLUMEDOWN),
3511 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3512 KEY(0, 3, KEY_CAMERA_FOCUS),
3513};
3514
3515static struct matrix_keymap_data keymap_data = {
3516 .keymap_size = ARRAY_SIZE(keymap),
3517 .keymap = keymap,
3518};
3519
3520static struct pm8xxx_keypad_platform_data keypad_data = {
3521 .input_name = "keypad_8960",
3522 .input_phys_device = "keypad_8960/input0",
3523 .num_rows = 1,
3524 .num_cols = 5,
3525 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3526 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3527 .debounce_ms = 15,
3528 .scan_delay_ms = 32,
3529 .row_hold_ns = 91500,
3530 .wakeup = 1,
3531 .keymap_data = &keymap_data,
3532};
3533
3534static const unsigned int keymap_sim[] = {
3535 KEY(0, 0, KEY_7),
3536 KEY(0, 1, KEY_DOWN),
3537 KEY(0, 2, KEY_UP),
3538 KEY(0, 3, KEY_RIGHT),
3539 KEY(0, 4, KEY_ENTER),
3540 KEY(0, 5, KEY_L),
3541 KEY(0, 6, KEY_BACK),
3542 KEY(0, 7, KEY_M),
3543
3544 KEY(1, 0, KEY_LEFT),
3545 KEY(1, 1, KEY_SEND),
3546 KEY(1, 2, KEY_1),
3547 KEY(1, 3, KEY_4),
3548 KEY(1, 4, KEY_CLEAR),
3549 KEY(1, 5, KEY_MSDOS),
3550 KEY(1, 6, KEY_SPACE),
3551 KEY(1, 7, KEY_COMMA),
3552
3553 KEY(2, 0, KEY_6),
3554 KEY(2, 1, KEY_5),
3555 KEY(2, 2, KEY_8),
3556 KEY(2, 3, KEY_3),
3557 KEY(2, 4, KEY_NUMERIC_STAR),
3558 KEY(2, 5, KEY_UP),
3559 KEY(2, 6, KEY_DOWN),
3560 KEY(2, 7, KEY_LEFTSHIFT),
3561
3562 KEY(3, 0, KEY_9),
3563 KEY(3, 1, KEY_NUMERIC_POUND),
3564 KEY(3, 2, KEY_0),
3565 KEY(3, 3, KEY_2),
3566 KEY(3, 4, KEY_SLEEP),
3567 KEY(3, 5, KEY_F1),
3568 KEY(3, 6, KEY_F2),
3569 KEY(3, 7, KEY_F3),
3570
3571 KEY(4, 0, KEY_BACK),
3572 KEY(4, 1, KEY_HOME),
3573 KEY(4, 2, KEY_MENU),
3574 KEY(4, 3, KEY_VOLUMEUP),
3575 KEY(4, 4, KEY_VOLUMEDOWN),
3576 KEY(4, 5, KEY_F4),
3577 KEY(4, 6, KEY_F5),
3578 KEY(4, 7, KEY_F6),
3579
3580 KEY(5, 0, KEY_R),
3581 KEY(5, 1, KEY_T),
3582 KEY(5, 2, KEY_Y),
3583 KEY(5, 3, KEY_LEFTALT),
3584 KEY(5, 4, KEY_KPENTER),
3585 KEY(5, 5, KEY_Q),
3586 KEY(5, 6, KEY_W),
3587 KEY(5, 7, KEY_E),
3588
3589 KEY(6, 0, KEY_F),
3590 KEY(6, 1, KEY_G),
3591 KEY(6, 2, KEY_H),
3592 KEY(6, 3, KEY_CAPSLOCK),
3593 KEY(6, 4, KEY_PAGEUP),
3594 KEY(6, 5, KEY_A),
3595 KEY(6, 6, KEY_S),
3596 KEY(6, 7, KEY_D),
3597
3598 KEY(7, 0, KEY_V),
3599 KEY(7, 1, KEY_B),
3600 KEY(7, 2, KEY_N),
3601 KEY(7, 3, KEY_MENU),
3602 KEY(7, 4, KEY_PAGEDOWN),
3603 KEY(7, 5, KEY_Z),
3604 KEY(7, 6, KEY_X),
3605 KEY(7, 7, KEY_C),
3606
3607 KEY(8, 0, KEY_P),
3608 KEY(8, 1, KEY_J),
3609 KEY(8, 2, KEY_K),
3610 KEY(8, 3, KEY_INSERT),
3611 KEY(8, 4, KEY_LINEFEED),
3612 KEY(8, 5, KEY_U),
3613 KEY(8, 6, KEY_I),
3614 KEY(8, 7, KEY_O),
3615
3616 KEY(9, 0, KEY_4),
3617 KEY(9, 1, KEY_5),
3618 KEY(9, 2, KEY_6),
3619 KEY(9, 3, KEY_7),
3620 KEY(9, 4, KEY_8),
3621 KEY(9, 5, KEY_1),
3622 KEY(9, 6, KEY_2),
3623 KEY(9, 7, KEY_3),
3624
3625 KEY(10, 0, KEY_F7),
3626 KEY(10, 1, KEY_F8),
3627 KEY(10, 2, KEY_F9),
3628 KEY(10, 3, KEY_F10),
3629 KEY(10, 4, KEY_FN),
3630 KEY(10, 5, KEY_9),
3631 KEY(10, 6, KEY_0),
3632 KEY(10, 7, KEY_DOT),
3633
3634 KEY(11, 0, KEY_LEFTCTRL),
3635 KEY(11, 1, KEY_F11),
3636 KEY(11, 2, KEY_ENTER),
3637 KEY(11, 3, KEY_SEARCH),
3638 KEY(11, 4, KEY_DELETE),
3639 KEY(11, 5, KEY_RIGHT),
3640 KEY(11, 6, KEY_LEFT),
3641 KEY(11, 7, KEY_RIGHTSHIFT),
3642 KEY(0, 0, KEY_VOLUMEUP),
3643 KEY(0, 1, KEY_VOLUMEDOWN),
3644 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3645 KEY(0, 3, KEY_CAMERA_FOCUS),
3646};
3647
3648static struct matrix_keymap_data keymap_data_sim = {
3649 .keymap_size = ARRAY_SIZE(keymap_sim),
3650 .keymap = keymap_sim,
3651};
3652
3653static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3654 .input_name = "keypad_8960",
3655 .input_phys_device = "keypad_8960/input0",
3656 .num_rows = 12,
3657 .num_cols = 8,
3658 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3659 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3660 .debounce_ms = 15,
3661 .scan_delay_ms = 32,
3662 .row_hold_ns = 91500,
3663 .wakeup = 1,
3664 .keymap_data = &keymap_data_sim,
3665};
3666
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003667static int pm8921_therm_mitigation[] = {
3668 1100,
3669 700,
3670 600,
3671 325,
3672};
3673
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003674static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003675 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003676 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003677 .max_voltage = 4200,
3678 .min_voltage = 3200,
3679 .resume_voltage = 4100,
3680 .term_current = 100,
3681 .cool_temp = 10,
3682 .warm_temp = 40,
3683 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003684 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003685 .cool_bat_chg_current = 350,
3686 .warm_bat_chg_current = 350,
3687 .cool_bat_voltage = 4100,
3688 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003689 .thermal_mitigation = pm8921_therm_mitigation,
3690 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003691};
3692
3693static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3694 .priority = 0,
3695};
3696
3697static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3698 .r_sense = 10,
3699 .i_test = 2500,
3700 .v_failure = 3000,
3701 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003702};
3703
Jay Chokshide4cefb2011-08-04 18:10:44 -07003704#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3705
3706/**
3707 * 'flag' stores three values; led id, led mode, and max current of led.
3708 * The bit packing format is as follow,
3709 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3710 * led_id (1 nibble)
3711 */
3712#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3713 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3714 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3715 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3716 PM8XXX_LED_MAX_CURRENT_MASK))
3717
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003718static struct led_info pm8921_led_info[] = {
3719 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003720 .name = "led:usb",
3721 .default_trigger = "usb-online",
3722 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3723 PM8XXX_LED_MODE_MANUAL,
3724 PM8921_LC_LED_MAX_CURRENT),
3725 },
3726 [1] = {
3727 .name = "led:ac",
3728 .default_trigger = "ac-online",
3729 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3730 PM8XXX_LED_MODE_MANUAL,
3731 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003732 },
3733};
3734
3735static struct led_platform_data pm8xxx_leds_pdata = {
3736 .num_leds = ARRAY_SIZE(pm8921_led_info),
3737 .leds = pm8921_led_info,
3738};
3739
3740static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3741 .irq_pdata = &pm8xxx_irq_pdata,
3742 .gpio_pdata = &pm8xxx_gpio_pdata,
3743 .mpp_pdata = &pm8xxx_mpp_pdata,
3744 .rtc_pdata = &pm8xxx_rtc_pdata,
3745 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3746 .keypad_pdata = &keypad_data,
3747 .misc_pdata = &pm8xxx_misc_pdata,
3748 .regulator_pdatas = msm_pm8921_regulator_pdata,
3749 .charger_pdata = &pm8921_chg_pdata,
3750 .bms_pdata = &pm8921_bms_pdata,
3751 .adc_pdata = &pm8921_adc_pdata,
3752 .leds_pdata = &pm8xxx_leds_pdata,
3753};
3754
3755static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3756 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3757 .slave = {
3758 .name = "pm8921-core",
3759 .platform_data = &pm8921_platform_data,
3760 },
3761};
3762
3763static void msm8960_wcnss_init(void)
3764{
3765 int i, ret, j;
3766
3767 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3768 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3769 "wcnss_5_wire");
3770 if (ret) {
3771 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3772 wcnss_5wire_interface[i].gpio, ret);
3773 goto fail;
3774 }
3775 }
3776
3777 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3778
3779 return;
3780
3781fail:
3782 for (j = 0; j < i; j++)
3783 gpio_free(wcnss_5wire_interface[j].gpio);
3784}
3785
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003786#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003787static int ethernet_init(void)
3788{
3789 int ret;
3790 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3791 if (ret) {
3792 pr_err("ks8851 gpio_request failed: %d\n", ret);
3793 goto fail;
3794 }
3795
3796 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3797 if (ret) {
3798 pr_err("ks8851 gpio_request failed: %d\n", ret);
3799 goto fail_rst;
3800 }
3801
3802 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3803 if (ret) {
3804 pr_err("ks8851 gpio_request failed: %d\n", ret);
3805 goto fail_cs;
3806 }
3807
3808 gpio_direction_output(FPGA_CS_GPIO, 1);
3809 gpio_direction_output(KS8851_RST_GPIO, 1);
3810 return 0;
3811fail_cs:
3812 gpio_free(KS8851_RST_GPIO);
3813fail_rst:
3814 gpio_free(KS8851_IRQ_GPIO);
3815fail:
3816 return ret;
3817}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003818#else
3819static int ethernet_init(void)
3820{
3821 return 0;
3822}
3823#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003824
3825static struct msm_cpuidle_state msm_cstates[] __initdata = {
3826 {0, 0, "C0", "WFI",
3827 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3828
3829 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3830 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3831
3832 {0, 2, "C2", "POWER_COLLAPSE",
3833 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3834
3835 {1, 0, "C0", "WFI",
3836 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3837
3838 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3839 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3840};
3841
3842static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3843 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3844 .idle_supported = 1,
3845 .suspend_supported = 1,
3846 .idle_enabled = 0,
3847 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003848 },
3849
3850 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3851 .idle_supported = 1,
3852 .suspend_supported = 1,
3853 .idle_enabled = 0,
3854 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003855 },
3856
3857 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3858 .idle_supported = 1,
3859 .suspend_supported = 1,
3860 .idle_enabled = 1,
3861 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003862 },
3863
3864 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3865 .idle_supported = 0,
3866 .suspend_supported = 1,
3867 .idle_enabled = 0,
3868 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003869 },
3870
3871 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3872 .idle_supported = 1,
3873 .suspend_supported = 1,
3874 .idle_enabled = 0,
3875 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003876 },
3877
3878 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3879 .idle_supported = 1,
3880 .suspend_supported = 0,
3881 .idle_enabled = 1,
3882 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003883 },
3884};
3885
3886static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3887 {
3888 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3889 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3890 true,
3891 1, 8000, 100000, 1,
3892 },
3893
3894 {
3895 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3896 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3897 true,
3898 1500, 5000, 60100000, 3000,
3899 },
3900
3901 {
3902 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3903 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3904 false,
3905 1800, 5000, 60350000, 3500,
3906 },
3907
3908 {
3909 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3910 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3911 false,
3912 2800, 2500, 65350000, 4800,
3913 },
3914
3915 {
3916 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3917 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3918 false,
3919 3800, 4500, 67850000, 5500,
3920 },
3921
3922 {
3923 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3924 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3925 false,
3926 4800, 2000, 71850000, 6800,
3927 },
3928
3929 {
3930 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3931 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3932 false,
3933 6800, 500, 75850000, 8800,
3934 },
3935
3936 {
3937 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3938 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3939 false,
3940 7800, 0, 76350000, 9800,
3941 },
3942};
3943
3944#ifdef CONFIG_I2C
3945#define I2C_SURF 1
3946#define I2C_FFA (1 << 1)
3947#define I2C_RUMI (1 << 2)
3948#define I2C_SIM (1 << 3)
3949#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003950#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003951
3952struct i2c_registry {
3953 u8 machs;
3954 int bus;
3955 struct i2c_board_info *info;
3956 int len;
3957};
3958
3959#ifdef CONFIG_MSM_CAMERA
3960static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3961#ifdef CONFIG_IMX074
3962 {
3963 I2C_BOARD_INFO("imx074", 0x1A),
3964 },
3965#endif
3966#ifdef CONFIG_OV2720
3967 {
3968 I2C_BOARD_INFO("ov2720", 0x6C),
3969 },
3970#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003971 {
3972 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3973 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303974#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3975 {
3976 I2C_BOARD_INFO("sc628a", 0x6E),
3977 },
3978#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003979};
3980#endif
3981
3982/* Sensors DSPS platform data */
3983#ifdef CONFIG_MSM_DSPS
3984#define DSPS_PIL_GENERIC_NAME "dsps"
3985#endif /* CONFIG_MSM_DSPS */
3986
3987static void __init msm8960_init_dsps(void)
3988{
3989#ifdef CONFIG_MSM_DSPS
3990 struct msm_dsps_platform_data *pdata =
3991 msm_dsps_device.dev.platform_data;
3992 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3993 pdata->gpios = NULL;
3994 pdata->gpios_num = 0;
3995
3996 platform_device_register(&msm_dsps_device);
3997#endif /* CONFIG_MSM_DSPS */
3998}
3999
Amir Samuelov5137e392011-09-21 17:31:25 +03004000#ifdef CONFIG_ISL9519_CHARGER
4001static struct isl_platform_data isl_data __initdata = {
4002 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4003 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4004 .max_system_voltage = 4200,
4005 .min_system_voltage = 3200,
4006 .chgcurrent = 1000, /* 1900, */
4007 .term_current = 400, /* Need fine tuning */
4008 .input_current = 2048,
4009};
4010
4011static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4012 {
4013 I2C_BOARD_INFO("isl9519q", 0x9),
4014 .irq = 0, /* Not required when notify-by-pmic */
4015 .platform_data = &isl_data,
4016 },
4017};
4018#endif /* CONFIG_ISL9519_CHARGER */
4019
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004020static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4021#ifdef CONFIG_MSM_CAMERA
4022 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004023 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004024 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4025 msm_camera_boardinfo,
4026 ARRAY_SIZE(msm_camera_boardinfo),
4027 },
4028#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004029#ifdef CONFIG_ISL9519_CHARGER
4030 {
4031 I2C_LIQUID,
4032 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4033 isl_charger_i2c_info,
4034 ARRAY_SIZE(isl_charger_i2c_info),
4035 },
4036#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004037 {
4038 I2C_SURF | I2C_FFA | I2C_FLUID,
4039 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4040 cyttsp_info,
4041 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004042 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304043 {
4044 I2C_LIQUID,
4045 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4046 mxt_device_info,
4047 ARRAY_SIZE(mxt_device_info),
4048 },
4049
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004050};
4051#endif /* CONFIG_I2C */
4052
4053static void __init register_i2c_devices(void)
4054{
4055#ifdef CONFIG_I2C
4056 u8 mach_mask = 0;
4057 int i;
4058
4059 /* Build the matching 'supported_machs' bitmask */
4060 if (machine_is_msm8960_cdp())
4061 mach_mask = I2C_SURF;
4062 else if (machine_is_msm8960_rumi3())
4063 mach_mask = I2C_RUMI;
4064 else if (machine_is_msm8960_sim())
4065 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004066 else if (machine_is_msm8960_fluid())
4067 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004068 else if (machine_is_msm8960_liquid())
4069 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004070 else if (machine_is_msm8960_mtp())
4071 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004072 else
4073 pr_err("unmatched machine ID in register_i2c_devices\n");
4074
4075 /* Run the array and install devices as appropriate */
4076 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4077 if (msm8960_i2c_devices[i].machs & mach_mask)
4078 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4079 msm8960_i2c_devices[i].info,
4080 msm8960_i2c_devices[i].len);
4081 }
4082#endif
4083}
4084
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004085static void __init msm8960_sim_init(void)
4086{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004087 if (socinfo_init() < 0)
4088 pr_err("socinfo_init() failed!\n");
4089
4090 BUG_ON(msm_rpm_init(&msm_rpm_data));
4091 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4092 ARRAY_SIZE(msm_rpmrs_levels)));
4093 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004094 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004095 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004096 msm8960_device_ssbi_pm8921.dev.platform_data =
4097 &msm8960_ssbi_pm8921_pdata;
4098 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004099
4100 /* Simulator supports a QWERTY keypad */
4101 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4102
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004103 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4104 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4105 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004106 gpiomux_init();
4107 ethernet_init();
4108 msm8960_i2c_init();
4109 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4110 msm_spm_l2_init(msm_spm_l2_data);
4111 msm8960_init_buses();
4112 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4113 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004114 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004115 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004116
4117 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4118 &msm8960_qup_spi_gsbi1_pdata;
4119 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4120
4121 msm8960_init_mmc();
4122 msm_fb_add_devices();
4123 slim_register_board_info(msm_slim_devices,
4124 ARRAY_SIZE(msm_slim_devices));
4125 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4126 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4127 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4128 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004129}
4130
4131static void __init msm8960_rumi3_init(void)
4132{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004133 if (socinfo_init() < 0)
4134 pr_err("socinfo_init() failed!\n");
4135
4136 BUG_ON(msm_rpm_init(&msm_rpm_data));
4137 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4138 ARRAY_SIZE(msm_rpmrs_levels)));
4139 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004140 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004141 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004142 gpiomux_init();
4143 ethernet_init();
4144 msm8960_device_ssbi_pm8921.dev.platform_data =
4145 &msm8960_ssbi_pm8921_pdata;
4146 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4147 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4148 &msm8960_qup_spi_gsbi1_pdata;
4149 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4150 msm8960_i2c_init();
4151 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4152 msm_spm_l2_init(msm_spm_l2_data);
4153 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4154 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004155 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004156 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004157 register_i2c_devices();
4158 msm_fb_add_devices();
4159 slim_register_board_info(msm_slim_devices,
4160 ARRAY_SIZE(msm_slim_devices));
4161 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4162 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4163 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4164 msm_pm_data);
4165}
4166
4167static void __init msm8960_cdp_init(void)
4168{
4169 if (socinfo_init() < 0)
4170 pr_err("socinfo_init() failed!\n");
4171
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004172 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4173 pr_err("meminfo_init() failed!\n");
4174
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004175 BUG_ON(msm_rpm_init(&msm_rpm_data));
4176 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4177 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004178
4179 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004180 regulator_suppress_info_printing();
4181 if (msm_xo_init())
4182 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004183 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004184 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004185 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4186 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4187 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004188 gpiomux_init();
4189 ethernet_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304190 if (machine_is_msm8960_liquid())
4191 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004192 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4193 &msm8960_qup_spi_gsbi1_pdata;
4194 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4195 msm8960_device_ssbi_pm8921.dev.platform_data =
4196 &msm8960_ssbi_pm8921_pdata;
4197 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4198 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004199 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004200 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4201 msm_spm_l2_init(msm_spm_l2_data);
4202 msm8960_init_buses();
4203 platform_add_devices(msm_footswitch_devices,
4204 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004205 if (machine_is_msm8960_liquid())
4206 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004207 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4208 pm8921_gpio_mpp_init();
4209 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4210 msm8960_init_cam();
4211 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004212 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304213 if (machine_is_msm8960_liquid())
4214 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004215 register_i2c_devices();
4216 msm8960_wcnss_init();
4217 msm_fb_add_devices();
4218 slim_register_board_info(msm_slim_devices,
4219 ARRAY_SIZE(msm_slim_devices));
4220 msm8960_init_dsps();
4221 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4222 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4223 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4224 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004225 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004226}
4227
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004228MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4229 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004230 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004231 .init_irq = msm8960_init_irq,
4232 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004233 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004234 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004235MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004236
4237MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4238 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004239 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004240 .init_irq = msm8960_init_irq,
4241 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004242 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004243 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004244MACHINE_END
4245
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004246MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4247 .map_io = msm8960_map_io,
4248 .reserve = msm8960_reserve,
4249 .init_irq = msm8960_init_irq,
4250 .timer = &msm_timer,
4251 .init_machine = msm8960_cdp_init,
4252 .init_early = msm8960_allocate_memory_regions,
4253MACHINE_END
4254
4255MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4256 .map_io = msm8960_map_io,
4257 .reserve = msm8960_reserve,
4258 .init_irq = msm8960_init_irq,
4259 .timer = &msm_timer,
4260 .init_machine = msm8960_cdp_init,
4261 .init_early = msm8960_allocate_memory_regions,
4262MACHINE_END
4263
4264MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4265 .map_io = msm8960_map_io,
4266 .reserve = msm8960_reserve,
4267 .init_irq = msm8960_init_irq,
4268 .timer = &msm_timer,
4269 .init_machine = msm8960_cdp_init,
4270 .init_early = msm8960_allocate_memory_regions,
4271MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004272
4273MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4274 .map_io = msm8960_map_io,
4275 .reserve = msm8960_reserve,
4276 .init_irq = msm8960_init_irq,
4277 .timer = &msm_timer,
4278 .init_machine = msm8960_cdp_init,
4279 .init_early = msm8960_allocate_memory_regions,
4280MACHINE_END