blob: 5151d391c22c0bd620a4bbb277c50b80cf3a7be8 [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),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302548 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002549 .nonremovable = 1,
2550 .sdcc_v4_sup = true,
2551 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302552 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002553};
2554#endif
2555
2556#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2557static struct mmc_platform_data msm8960_sdc3_data = {
2558 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2559 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2560 .sup_clk_table = sdc3_sup_clk_rates,
2561 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302562 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302563#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002564 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302565#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002566 .sdcc_v4_sup = true,
2567 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2568 .pin_data = &mmc_slot_pin_data[SDCC3],
2569#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2570 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2571 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2572 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2573#endif
2574 .xpc_cap = 1,
2575 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2576 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302577 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002578};
2579#endif
2580
2581static void __init msm8960_init_mmc(void)
2582{
2583#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2584 /* SDC1 : eMMC card connected */
2585 msm_add_sdcc(1, &msm8960_sdc1_data);
2586#endif
2587#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2588 /* SDC3: External card slot */
2589 msm_add_sdcc(3, &msm8960_sdc3_data);
2590#endif
2591}
2592
2593static void __init msm8960_init_buses(void)
2594{
2595#ifdef CONFIG_MSM_BUS_SCALING
2596 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2597 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2598 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2599 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2600 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2601 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2602 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2603 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2604 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2605 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2606#endif
2607}
2608
2609static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2610 .max_clock_speed = 15060000,
2611};
2612
2613#ifdef CONFIG_USB_MSM_OTG_72K
2614static struct msm_otg_platform_data msm_otg_pdata;
2615#else
2616#define USB_5V_EN 42
2617static void msm_hsusb_vbus_power(bool on)
2618{
2619 int rc;
2620 static bool vbus_is_on;
2621 static struct regulator *mvs_otg_switch;
2622 struct pm_gpio param = {
2623 .direction = PM_GPIO_DIR_OUT,
2624 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2625 .output_value = 1,
2626 .pull = PM_GPIO_PULL_NO,
2627 .vin_sel = PM_GPIO_VIN_S4,
2628 .out_strength = PM_GPIO_STRENGTH_MED,
2629 .function = PM_GPIO_FUNC_NORMAL,
2630 };
2631
2632 if (vbus_is_on == on)
2633 return;
2634
2635 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002636 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2637 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002638 if (IS_ERR(mvs_otg_switch)) {
2639 pr_err("Unable to get mvs_otg_switch\n");
2640 return;
2641 }
2642
2643 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2644 "usb_5v_en");
2645 if (rc < 0) {
2646 pr_err("failed to request usb_5v_en gpio\n");
2647 goto put_mvs_otg;
2648 }
2649
2650 if (regulator_enable(mvs_otg_switch)) {
2651 pr_err("unable to enable mvs_otg_switch\n");
2652 goto free_usb_5v_en;
2653 }
2654
2655 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2656 &param);
2657 if (rc < 0) {
2658 pr_err("failed to configure usb_5v_en gpio\n");
2659 goto disable_mvs_otg;
2660 }
2661 vbus_is_on = true;
2662 return;
2663 }
2664disable_mvs_otg:
2665 regulator_disable(mvs_otg_switch);
2666free_usb_5v_en:
2667 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2668put_mvs_otg:
2669 regulator_put(mvs_otg_switch);
2670 vbus_is_on = false;
2671}
2672
2673static struct msm_otg_platform_data msm_otg_pdata = {
2674 .mode = USB_OTG,
2675 .otg_control = OTG_PMIC_CONTROL,
2676 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2677 .pclk_src_name = "dfab_usb_hs_clk",
2678 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2679 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302680 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002681};
2682#endif
2683
2684#define PID_MAGIC_ID 0x71432909
2685#define SERIAL_NUM_MAGIC_ID 0x61945374
2686#define SERIAL_NUMBER_LENGTH 127
2687#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2688
2689struct magic_num_struct {
2690 uint32_t pid;
2691 uint32_t serial_num;
2692};
2693
2694struct dload_struct {
2695 uint32_t reserved1;
2696 uint32_t reserved2;
2697 uint32_t reserved3;
2698 uint16_t reserved4;
2699 uint16_t pid;
2700 char serial_number[SERIAL_NUMBER_LENGTH];
2701 uint16_t reserved5;
2702 struct magic_num_struct magic_struct;
2703};
2704
2705static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2706{
2707 struct dload_struct __iomem *dload = 0;
2708
2709 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2710 if (!dload) {
2711 pr_err("%s: cannot remap I/O memory region: %08x\n",
2712 __func__, DLOAD_USB_BASE_ADD);
2713 return -ENXIO;
2714 }
2715
2716 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2717 __func__, dload, pid, snum);
2718 /* update pid */
2719 dload->magic_struct.pid = PID_MAGIC_ID;
2720 dload->pid = pid;
2721
2722 /* update serial number */
2723 dload->magic_struct.serial_num = 0;
2724 if (!snum) {
2725 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2726 goto out;
2727 }
2728
2729 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2730 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2731 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2732out:
2733 iounmap(dload);
2734 return 0;
2735}
2736
2737static struct android_usb_platform_data android_usb_pdata = {
2738 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2739};
2740
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002741static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002742 .name = "android_usb",
2743 .id = -1,
2744 .dev = {
2745 .platform_data = &android_usb_pdata,
2746 },
2747};
2748
2749static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2750 0x03, 0x0f,
2751};
2752
2753static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2754 0x00, 0x24, 0x54, 0x10,
2755 0x09, 0x03, 0x01,
2756 0x10, 0x54, 0x30, 0x0C,
2757 0x24, 0x30, 0x0f,
2758};
2759
2760static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2761 0x00, 0x24, 0x54, 0x10,
2762 0x09, 0x07, 0x01, 0x0B,
2763 0x10, 0x54, 0x30, 0x0C,
2764 0x24, 0x30, 0x0f,
2765};
2766
2767static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2768 [0] = {
2769 .mode = MSM_SPM_MODE_CLOCK_GATING,
2770 .notify_rpm = false,
2771 .cmd = spm_wfi_cmd_sequence,
2772 },
2773 [1] = {
2774 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2775 .notify_rpm = false,
2776 .cmd = spm_power_collapse_without_rpm,
2777 },
2778 [2] = {
2779 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2780 .notify_rpm = true,
2781 .cmd = spm_power_collapse_with_rpm,
2782 },
2783};
2784
2785static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2786 [0] = {
2787 .reg_base_addr = MSM_SAW0_BASE,
2788 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2789 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2790 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2791#if defined(CONFIG_MSM_AVS_HW)
2792 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2793 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2794#endif
2795 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2796 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2797 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2798 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2799 .vctl_timeout_us = 50,
2800 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2801 .modes = msm_spm_seq_list,
2802 },
2803 [1] = {
2804 .reg_base_addr = MSM_SAW1_BASE,
2805 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2806 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2807 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2808#if defined(CONFIG_MSM_AVS_HW)
2809 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2810 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2811#endif
2812 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2813 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2814 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2815 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2816 .vctl_timeout_us = 50,
2817 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2818 .modes = msm_spm_seq_list,
2819 },
2820};
2821
2822static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2823 0x00, 0x20, 0x03, 0x20,
2824 0x00, 0x0f,
2825};
2826
2827static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2828 0x00, 0x20, 0x34, 0x64,
2829 0x48, 0x07, 0x48, 0x20,
2830 0x50, 0x64, 0x04, 0x34,
2831 0x50, 0x0f,
2832};
2833static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2834 0x00, 0x10, 0x34, 0x64,
2835 0x48, 0x07, 0x48, 0x10,
2836 0x50, 0x64, 0x04, 0x34,
2837 0x50, 0x0F,
2838};
2839
2840static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2841 [0] = {
2842 .mode = MSM_SPM_L2_MODE_RETENTION,
2843 .notify_rpm = false,
2844 .cmd = l2_spm_wfi_cmd_sequence,
2845 },
2846 [1] = {
2847 .mode = MSM_SPM_L2_MODE_GDHS,
2848 .notify_rpm = true,
2849 .cmd = l2_spm_gdhs_cmd_sequence,
2850 },
2851 [2] = {
2852 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2853 .notify_rpm = true,
2854 .cmd = l2_spm_power_off_cmd_sequence,
2855 },
2856};
2857
2858
2859static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2860 [0] = {
2861 .reg_base_addr = MSM_SAW_L2_BASE,
2862 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2863 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2864 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2865 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2866 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2867 .modes = msm_spm_l2_seq_list,
2868 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2869 },
2870};
2871
2872#define CYTTSP_TS_GPIO_IRQ 11
2873#define CYTTSP_TS_SLEEP_GPIO 50
2874#define CYTTSP_TS_RESOUT_N_GPIO 52
2875
2876/*virtual key support */
2877static ssize_t tma340_vkeys_show(struct kobject *kobj,
2878 struct kobj_attribute *attr, char *buf)
2879{
2880 return snprintf(buf, 200,
2881 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2882 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2883 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2884 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2885 "\n");
2886}
2887
2888static struct kobj_attribute tma340_vkeys_attr = {
2889 .attr = {
2890 .mode = S_IRUGO,
2891 },
2892 .show = &tma340_vkeys_show,
2893};
2894
2895static struct attribute *tma340_properties_attrs[] = {
2896 &tma340_vkeys_attr.attr,
2897 NULL
2898};
2899
2900static struct attribute_group tma340_properties_attr_group = {
2901 .attrs = tma340_properties_attrs,
2902};
2903
2904
2905static int cyttsp_platform_init(struct i2c_client *client)
2906{
2907 int rc = 0;
2908 static struct kobject *tma340_properties_kobj;
2909
2910 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2911 tma340_properties_kobj = kobject_create_and_add("board_properties",
2912 NULL);
2913 if (tma340_properties_kobj)
2914 rc = sysfs_create_group(tma340_properties_kobj,
2915 &tma340_properties_attr_group);
2916 if (!tma340_properties_kobj || rc)
2917 pr_err("%s: failed to create board_properties\n",
2918 __func__);
2919
2920 return 0;
2921}
2922
2923static struct cyttsp_regulator regulator_data[] = {
2924 {
2925 .name = "vdd",
2926 .min_uV = CY_TMA300_VTG_MIN_UV,
2927 .max_uV = CY_TMA300_VTG_MAX_UV,
2928 .load_uA = CY_TMA300_CURR_24HZ_UA,
2929 },
2930 /* TODO: Remove after runtime PM is enabled in I2C driver */
2931 {
2932 .name = "vcc_i2c",
2933 .min_uV = CY_I2C_VTG_MIN_UV,
2934 .max_uV = CY_I2C_VTG_MAX_UV,
2935 .load_uA = CY_I2C_CURR_UA,
2936 },
2937};
2938
2939static struct cyttsp_platform_data cyttsp_pdata = {
2940 .panel_maxx = 634,
2941 .panel_maxy = 1166,
2942 .disp_maxx = 616,
2943 .disp_maxy = 1023,
2944 .disp_minx = 0,
2945 .disp_miny = 16,
2946 .flags = 0x01,
2947 .gen = CY_GEN3, /* or */
2948 .use_st = CY_USE_ST,
2949 .use_mt = CY_USE_MT,
2950 .use_hndshk = CY_SEND_HNDSHK,
2951 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302952 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002953 .use_gestures = CY_USE_GESTURES,
2954 .fw_fname = "cyttsp_8960_cdp.hex",
2955 /* activate up to 4 groups
2956 * and set active distance
2957 */
2958 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2959 CY_GEST_GRP3 | CY_GEST_GRP4 |
2960 CY_ACT_DIST,
2961 /* change act_intrvl to customize the Active power state
2962 * scanning/processing refresh interval for Operating mode
2963 */
2964 .act_intrvl = CY_ACT_INTRVL_DFLT,
2965 /* change tch_tmout to customize the touch timeout for the
2966 * Active power state for Operating mode
2967 */
2968 .tch_tmout = CY_TCH_TMOUT_DFLT,
2969 /* change lp_intrvl to customize the Low Power power state
2970 * scanning/processing refresh interval for Operating mode
2971 */
2972 .lp_intrvl = CY_LP_INTRVL_DFLT,
2973 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2974 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2975 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2976 .regulator_info = regulator_data,
2977 .num_regulators = ARRAY_SIZE(regulator_data),
2978 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302979 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002980};
2981
2982static struct i2c_board_info cyttsp_info[] __initdata = {
2983 {
2984 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2985 .platform_data = &cyttsp_pdata,
2986#ifndef CY_USE_TIMER
2987 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2988#endif /* CY_USE_TIMER */
2989 },
2990};
2991
Mohan Pallaka50837382011-09-07 11:00:57 +05302992/* configuration data */
2993static const u8 mxt_config_data[] = {
2994 /* T6 Object */
2995 0, 0, 0, 0, 0, 0,
2996 /* T38 Object */
2997 11, 0, 0, 6, 9, 11, 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, 0, 0, 0, 0, 0, 0,
3002 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3003 0, 0, 0, 0,
3004 /* T7 Object */
3005 10, 10, 50,
3006 /* T8 Object */
3007 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3008 /* T9 Object */
3009 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3010 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3011 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3012 0, 5, 45, 46,
3013 /* T15 Object */
3014 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3015 0,
3016 /* T22 Object */
3017 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3018 0, 0, 255, 255, 255, 255, 0,
3019 /* T24 Object */
3020 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3021 0, 0, 0, 0, 0, 0, 0, 0, 0,
3022 /* T25 Object */
3023 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3024 0, 0, 0, 0,
3025 /* T27 Object */
3026 0, 0, 0, 0, 0, 0, 0,
3027 /* T28 Object */
3028 0, 0, 0, 8, 8, 8,
3029 /* T40 Object */
3030 0, 0, 0, 0, 0,
3031 /* T41 Object */
3032 0, 0, 0, 0, 0, 0,
3033 /* T43 Object */
3034 0, 0, 0, 0, 0, 0,
3035};
3036
3037#define MXT_TS_GPIO_IRQ 11
3038#define MXT_TS_LDO_EN_GPIO 50
3039#define MXT_TS_RESET_GPIO 52
3040
3041static void mxt_init_hw_liquid(void)
3042{
3043 int rc;
3044
3045 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3046 if (rc) {
3047 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3048 __func__, MXT_TS_GPIO_IRQ);
3049 return;
3050 }
3051
3052 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3053 if (rc) {
3054 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3055 __func__, MXT_TS_GPIO_IRQ);
3056 goto err_irq_gpio_req;
3057 }
3058
3059 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3060 if (rc) {
3061 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3062 __func__, MXT_TS_LDO_EN_GPIO);
3063 goto err_irq_gpio_req;
3064 }
3065
3066 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3067 if (rc) {
3068 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3069 __func__, MXT_TS_LDO_EN_GPIO);
3070 goto err_ldo_gpio_req;
3071 }
3072
3073 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3074 if (rc) {
3075 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3076 __func__, MXT_TS_RESET_GPIO);
3077 goto err_ldo_gpio_set_dir;
3078 }
3079
3080 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3081 if (rc) {
3082 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3083 __func__, MXT_TS_RESET_GPIO);
3084 goto err_reset_gpio_req;
3085 }
3086
3087 return;
3088
3089err_reset_gpio_req:
3090 gpio_free(MXT_TS_RESET_GPIO);
3091err_ldo_gpio_set_dir:
3092 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3093err_ldo_gpio_req:
3094 gpio_free(MXT_TS_LDO_EN_GPIO);
3095err_irq_gpio_req:
3096 gpio_free(MXT_TS_GPIO_IRQ);
3097}
3098
3099static struct mxt_platform_data mxt_platform_data = {
3100 .config = mxt_config_data,
3101 .config_length = ARRAY_SIZE(mxt_config_data),
3102 .x_line = 26,
3103 .y_line = 42,
3104 .x_size = 767,
3105 .y_size = 1365,
3106 .blen = 32,
3107 .threshold = 40,
3108 .voltage = 3300000, /* 3.3V */
3109 .orient = MXT_ROTATED_90,
3110 .irqflags = IRQF_TRIGGER_FALLING,
3111};
3112
3113static struct i2c_board_info mxt_device_info[] __initdata = {
3114 {
3115 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3116 .platform_data = &mxt_platform_data,
3117 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3118 },
3119};
3120
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003121static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3122{
3123}
3124
3125static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3126 .clk_freq = 100000,
3127 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003128 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3129};
3130
3131static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3132 .clk_freq = 100000,
3133 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003134 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3135};
3136
3137static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3138 .clk_freq = 100000,
3139 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003140 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3141};
3142
3143static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3144 .clk_freq = 100000,
3145 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003146 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3147};
3148
3149static struct msm_rpm_platform_data msm_rpm_data = {
3150 .reg_base_addrs = {
3151 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3152 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3153 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3154 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3155 },
3156
3157 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3158 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3159 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3160 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3161 .msm_apps_ipc_rpm_val = 4,
3162};
3163
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003164static struct platform_device msm_rpm_device = {
3165 .name = "msm_rpm",
3166 .id = -1,
3167};
3168
3169
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003170static struct spi_board_info spi_board_info[] __initdata = {
3171 {
3172 .modalias = "ks8851",
3173 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3174 .max_speed_hz = 19200000,
3175 .bus_num = 0,
3176 .chip_select = 0,
3177 .mode = SPI_MODE_0,
3178 },
3179};
3180
3181static struct platform_device msm_device_saw_core0 = {
3182 .name = "saw-regulator",
3183 .id = 0,
3184 .dev = {
3185 .platform_data = &msm_saw_regulator_pdata_s5,
3186 },
3187};
3188
3189static struct platform_device msm_device_saw_core1 = {
3190 .name = "saw-regulator",
3191 .id = 1,
3192 .dev = {
3193 .platform_data = &msm_saw_regulator_pdata_s6,
3194 },
3195};
3196
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003197static struct tsens_platform_data msm_tsens_pdata = {
3198 .slope = 910,
3199 .tsens_factor = 1000,
3200 .hw_type = MSM_8960,
3201 .tsens_num_sensor = 5,
3202};
3203
3204static struct platform_device msm_tsens_device = {
3205 .name = "tsens8960-tm",
3206 .id = -1,
3207 .dev = {
3208 .platform_data = &msm_tsens_pdata,
3209 },
3210};
3211
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003212#ifdef CONFIG_MSM_FAKE_BATTERY
3213static struct platform_device fish_battery_device = {
3214 .name = "fish_battery",
3215};
3216#endif
3217
David Collins26f05562011-06-20 09:56:28 -07003218static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003219 .name = GPIO_REGULATOR_DEV_NAME,
3220 .id = PM8921_MPP_PM_TO_SYS(7),
3221 .dev = {
3222 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3223 },
3224};
3225
David Collins26f05562011-06-20 09:56:28 -07003226static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003227 .name = GPIO_REGULATOR_DEV_NAME,
3228 .id = 91,
3229 .dev = {
3230 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3231 },
3232};
3233
David Collinsb10be1d2011-09-02 10:29:31 -07003234static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3235 .name = GPIO_REGULATOR_DEV_NAME,
3236 .id = PM8921_GPIO_PM_TO_SYS(17),
3237 .dev = {
3238 .platform_data =
3239 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3240 },
3241};
3242
David Collins26f05562011-06-20 09:56:28 -07003243static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3244 .name = "rpm-regulator",
3245 .id = -1,
3246 .dev = {
3247 .platform_data = &msm_rpm_regulator_pdata,
3248 },
3249};
3250
David Collins4c31a872011-08-31 10:07:10 -07003251static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3252 .phys_addr_base = 0x0010C000,
3253 .reg_offsets = {
3254 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3255 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3256 },
3257 .phys_size = SZ_8K,
3258 .log_len = 4096, /* log's buffer length in bytes */
3259 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3260};
3261
3262static struct platform_device msm_rpm_log_device = {
3263 .name = "msm_rpm_log",
3264 .id = -1,
3265 .dev = {
3266 .platform_data = &msm_rpm_log_pdata,
3267 },
3268};
3269
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003270static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003271 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003272 &msm_device_smd,
3273 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303274 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003275 &msm_device_saw_core0,
3276 &msm_device_saw_core1,
3277 &msm8960_device_ext_5v_vreg,
3278 &msm8960_device_ext_l2_vreg,
3279 &msm8960_device_ssbi_pm8921,
3280 &msm8960_device_qup_spi_gsbi1,
3281 &msm8960_device_qup_i2c_gsbi3,
3282 &msm8960_device_qup_i2c_gsbi4,
3283 &msm8960_device_qup_i2c_gsbi10,
3284#ifndef CONFIG_MSM_DSPS
3285 &msm8960_device_qup_i2c_gsbi12,
3286#endif
3287 &msm_slim_ctrl,
3288 &msm_device_wcnss_wlan,
3289#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3290 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3291 &qcrypto_device,
3292#endif
3293
3294#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3295 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3296 &qcedev_device,
3297#endif
3298#ifdef CONFIG_MSM_ROTATOR
3299 &msm_rotator_device,
3300#endif
3301 &msm_device_sps,
3302#ifdef CONFIG_MSM_FAKE_BATTERY
3303 &fish_battery_device,
3304#endif
3305#ifdef CONFIG_ANDROID_PMEM
3306 &android_pmem_device,
3307 &android_pmem_adsp_device,
3308 &android_pmem_audio_device,
3309#endif
3310 &msm_fb_device,
3311 &msm_device_vidc,
3312 &msm_device_bam_dmux,
3313 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003314
3315#ifdef CONFIG_HW_RANDOM_MSM
3316 &msm_device_rng,
3317#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003318 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003319#ifdef CONFIG_ION_MSM
3320 &ion_dev,
3321#endif
David Collins4c31a872011-08-31 10:07:10 -07003322 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003323#ifdef CONFIG_MSM_QDSS
3324 &msm_etb_device,
3325 &msm_tpiu_device,
3326 &msm_funnel_device,
3327 &msm_ptm_device,
3328#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003329};
3330
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003331static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003332 &msm8960_device_otg,
3333 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003334 &msm_device_hsusb_host,
3335 &android_usb_device,
3336 &msm_device_vidc,
3337 &mipi_dsi_simulator_panel_device,
3338 &msm_bus_apps_fabric,
3339 &msm_bus_sys_fabric,
3340 &msm_bus_mm_fabric,
3341 &msm_bus_sys_fpb,
3342 &msm_bus_cpss_fpb,
3343 &msm_pcm,
3344 &msm_pcm_routing,
3345 &msm_cpudai0,
3346 &msm_cpudai1,
3347 &msm_cpudai_hdmi_rx,
3348 &msm_cpudai_bt_rx,
3349 &msm_cpudai_bt_tx,
3350 &msm_cpudai_fm_rx,
3351 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003352 &msm_cpudai_auxpcm_rx,
3353 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003354 &msm_cpu_fe,
3355 &msm_stub_codec,
3356 &msm_voice,
3357 &msm_voip,
3358 &msm_lpa_pcm,
3359
3360#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3361 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3362 &qcrypto_device,
3363#endif
3364
3365#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3366 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3367 &qcedev_device,
3368#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003369};
3370
3371static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003372 &msm_kgsl_3d0,
3373 &msm_kgsl_2d0,
3374 &msm_kgsl_2d1,
3375 &mipi_dsi_renesas_panel_device,
3376#ifdef CONFIG_MSM_GEMINI
3377 &msm8960_gemini_device,
3378#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003379};
3380
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003381static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003382 &msm8960_device_otg,
3383 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003384 &msm_device_hsusb_host,
3385 &android_usb_device,
3386 &msm_pcm,
3387 &msm_pcm_routing,
3388 &msm_cpudai0,
3389 &msm_cpudai1,
3390 &msm_cpudai_hdmi_rx,
3391 &msm_cpudai_bt_rx,
3392 &msm_cpudai_bt_tx,
3393 &msm_cpudai_fm_rx,
3394 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003395 &msm_cpudai_auxpcm_rx,
3396 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003397 &msm_cpu_fe,
3398 &msm_stub_codec,
3399 &msm_kgsl_3d0,
3400#ifdef CONFIG_MSM_KGSL_2D
3401 &msm_kgsl_2d0,
3402 &msm_kgsl_2d1,
3403#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003404 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003405#ifdef CONFIG_MSM_GEMINI
3406 &msm8960_gemini_device,
3407#endif
3408 &msm_voice,
3409 &msm_voip,
3410 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303411 &msm_cpudai_afe_01_rx,
3412 &msm_cpudai_afe_01_tx,
3413 &msm_cpudai_afe_02_rx,
3414 &msm_cpudai_afe_02_tx,
3415 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003416#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3417 &hdmi_msm_device,
3418#endif
3419 &msm_pcm_hostless,
3420 &msm_bus_apps_fabric,
3421 &msm_bus_sys_fabric,
3422 &msm_bus_mm_fabric,
3423 &msm_bus_sys_fpb,
3424 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003425 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003426};
3427
3428static void __init msm8960_i2c_init(void)
3429{
3430 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3431 &msm8960_i2c_qup_gsbi4_pdata;
3432
3433 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3434 &msm8960_i2c_qup_gsbi3_pdata;
3435
3436 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3437 &msm8960_i2c_qup_gsbi10_pdata;
3438
3439 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3440 &msm8960_i2c_qup_gsbi12_pdata;
3441}
3442
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003443static void __init msm8960_gfx_init(void)
3444{
3445 uint32_t soc_platform_version = socinfo_get_platform_version();
3446 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3447 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3448 msm_kgsl_3d0.dev.platform_data;
3449 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3450 320000000;
3451 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3452 266667000;
3453 }
3454}
3455
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003456static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3457 .irq_base = PM8921_IRQ_BASE,
3458 .devirq = MSM_GPIO_TO_INT(104),
3459 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3460};
3461
3462static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3463 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3464};
3465
3466static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3467 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3468};
3469
3470static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3471 .rtc_write_enable = false,
3472};
3473
3474static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3475 .pull_up = 1,
3476 .kpd_trigger_delay_us = 970,
3477 .wakeup = 1,
3478};
3479
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303480/* Rotate lock key is not available so use F1 */
3481#define KEY_ROTATE_LOCK KEY_F1
3482
3483static const unsigned int keymap_liquid[] = {
3484 KEY(0, 0, KEY_VOLUMEUP),
3485 KEY(0, 1, KEY_VOLUMEDOWN),
3486 KEY(1, 3, KEY_ROTATE_LOCK),
3487 KEY(1, 4, KEY_HOME),
3488};
3489
3490static struct matrix_keymap_data keymap_data_liquid = {
3491 .keymap_size = ARRAY_SIZE(keymap_liquid),
3492 .keymap = keymap_liquid,
3493};
3494
3495static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3496 .input_name = "keypad_8960_liquid",
3497 .input_phys_device = "keypad_8960/input0",
3498 .num_rows = 2,
3499 .num_cols = 5,
3500 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3501 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3502 .debounce_ms = 15,
3503 .scan_delay_ms = 32,
3504 .row_hold_ns = 91500,
3505 .wakeup = 1,
3506 .keymap_data = &keymap_data_liquid,
3507};
3508
3509
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003510static const unsigned int keymap[] = {
3511 KEY(0, 0, KEY_VOLUMEUP),
3512 KEY(0, 1, KEY_VOLUMEDOWN),
3513 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3514 KEY(0, 3, KEY_CAMERA_FOCUS),
3515};
3516
3517static struct matrix_keymap_data keymap_data = {
3518 .keymap_size = ARRAY_SIZE(keymap),
3519 .keymap = keymap,
3520};
3521
3522static struct pm8xxx_keypad_platform_data keypad_data = {
3523 .input_name = "keypad_8960",
3524 .input_phys_device = "keypad_8960/input0",
3525 .num_rows = 1,
3526 .num_cols = 5,
3527 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3528 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3529 .debounce_ms = 15,
3530 .scan_delay_ms = 32,
3531 .row_hold_ns = 91500,
3532 .wakeup = 1,
3533 .keymap_data = &keymap_data,
3534};
3535
3536static const unsigned int keymap_sim[] = {
3537 KEY(0, 0, KEY_7),
3538 KEY(0, 1, KEY_DOWN),
3539 KEY(0, 2, KEY_UP),
3540 KEY(0, 3, KEY_RIGHT),
3541 KEY(0, 4, KEY_ENTER),
3542 KEY(0, 5, KEY_L),
3543 KEY(0, 6, KEY_BACK),
3544 KEY(0, 7, KEY_M),
3545
3546 KEY(1, 0, KEY_LEFT),
3547 KEY(1, 1, KEY_SEND),
3548 KEY(1, 2, KEY_1),
3549 KEY(1, 3, KEY_4),
3550 KEY(1, 4, KEY_CLEAR),
3551 KEY(1, 5, KEY_MSDOS),
3552 KEY(1, 6, KEY_SPACE),
3553 KEY(1, 7, KEY_COMMA),
3554
3555 KEY(2, 0, KEY_6),
3556 KEY(2, 1, KEY_5),
3557 KEY(2, 2, KEY_8),
3558 KEY(2, 3, KEY_3),
3559 KEY(2, 4, KEY_NUMERIC_STAR),
3560 KEY(2, 5, KEY_UP),
3561 KEY(2, 6, KEY_DOWN),
3562 KEY(2, 7, KEY_LEFTSHIFT),
3563
3564 KEY(3, 0, KEY_9),
3565 KEY(3, 1, KEY_NUMERIC_POUND),
3566 KEY(3, 2, KEY_0),
3567 KEY(3, 3, KEY_2),
3568 KEY(3, 4, KEY_SLEEP),
3569 KEY(3, 5, KEY_F1),
3570 KEY(3, 6, KEY_F2),
3571 KEY(3, 7, KEY_F3),
3572
3573 KEY(4, 0, KEY_BACK),
3574 KEY(4, 1, KEY_HOME),
3575 KEY(4, 2, KEY_MENU),
3576 KEY(4, 3, KEY_VOLUMEUP),
3577 KEY(4, 4, KEY_VOLUMEDOWN),
3578 KEY(4, 5, KEY_F4),
3579 KEY(4, 6, KEY_F5),
3580 KEY(4, 7, KEY_F6),
3581
3582 KEY(5, 0, KEY_R),
3583 KEY(5, 1, KEY_T),
3584 KEY(5, 2, KEY_Y),
3585 KEY(5, 3, KEY_LEFTALT),
3586 KEY(5, 4, KEY_KPENTER),
3587 KEY(5, 5, KEY_Q),
3588 KEY(5, 6, KEY_W),
3589 KEY(5, 7, KEY_E),
3590
3591 KEY(6, 0, KEY_F),
3592 KEY(6, 1, KEY_G),
3593 KEY(6, 2, KEY_H),
3594 KEY(6, 3, KEY_CAPSLOCK),
3595 KEY(6, 4, KEY_PAGEUP),
3596 KEY(6, 5, KEY_A),
3597 KEY(6, 6, KEY_S),
3598 KEY(6, 7, KEY_D),
3599
3600 KEY(7, 0, KEY_V),
3601 KEY(7, 1, KEY_B),
3602 KEY(7, 2, KEY_N),
3603 KEY(7, 3, KEY_MENU),
3604 KEY(7, 4, KEY_PAGEDOWN),
3605 KEY(7, 5, KEY_Z),
3606 KEY(7, 6, KEY_X),
3607 KEY(7, 7, KEY_C),
3608
3609 KEY(8, 0, KEY_P),
3610 KEY(8, 1, KEY_J),
3611 KEY(8, 2, KEY_K),
3612 KEY(8, 3, KEY_INSERT),
3613 KEY(8, 4, KEY_LINEFEED),
3614 KEY(8, 5, KEY_U),
3615 KEY(8, 6, KEY_I),
3616 KEY(8, 7, KEY_O),
3617
3618 KEY(9, 0, KEY_4),
3619 KEY(9, 1, KEY_5),
3620 KEY(9, 2, KEY_6),
3621 KEY(9, 3, KEY_7),
3622 KEY(9, 4, KEY_8),
3623 KEY(9, 5, KEY_1),
3624 KEY(9, 6, KEY_2),
3625 KEY(9, 7, KEY_3),
3626
3627 KEY(10, 0, KEY_F7),
3628 KEY(10, 1, KEY_F8),
3629 KEY(10, 2, KEY_F9),
3630 KEY(10, 3, KEY_F10),
3631 KEY(10, 4, KEY_FN),
3632 KEY(10, 5, KEY_9),
3633 KEY(10, 6, KEY_0),
3634 KEY(10, 7, KEY_DOT),
3635
3636 KEY(11, 0, KEY_LEFTCTRL),
3637 KEY(11, 1, KEY_F11),
3638 KEY(11, 2, KEY_ENTER),
3639 KEY(11, 3, KEY_SEARCH),
3640 KEY(11, 4, KEY_DELETE),
3641 KEY(11, 5, KEY_RIGHT),
3642 KEY(11, 6, KEY_LEFT),
3643 KEY(11, 7, KEY_RIGHTSHIFT),
3644 KEY(0, 0, KEY_VOLUMEUP),
3645 KEY(0, 1, KEY_VOLUMEDOWN),
3646 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3647 KEY(0, 3, KEY_CAMERA_FOCUS),
3648};
3649
3650static struct matrix_keymap_data keymap_data_sim = {
3651 .keymap_size = ARRAY_SIZE(keymap_sim),
3652 .keymap = keymap_sim,
3653};
3654
3655static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3656 .input_name = "keypad_8960",
3657 .input_phys_device = "keypad_8960/input0",
3658 .num_rows = 12,
3659 .num_cols = 8,
3660 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3661 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3662 .debounce_ms = 15,
3663 .scan_delay_ms = 32,
3664 .row_hold_ns = 91500,
3665 .wakeup = 1,
3666 .keymap_data = &keymap_data_sim,
3667};
3668
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003669static int pm8921_therm_mitigation[] = {
3670 1100,
3671 700,
3672 600,
3673 325,
3674};
3675
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003676static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003677 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003678 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003679 .max_voltage = 4200,
3680 .min_voltage = 3200,
3681 .resume_voltage = 4100,
3682 .term_current = 100,
3683 .cool_temp = 10,
3684 .warm_temp = 40,
3685 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003686 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003687 .cool_bat_chg_current = 350,
3688 .warm_bat_chg_current = 350,
3689 .cool_bat_voltage = 4100,
3690 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003691 .thermal_mitigation = pm8921_therm_mitigation,
3692 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003693};
3694
3695static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3696 .priority = 0,
3697};
3698
3699static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3700 .r_sense = 10,
3701 .i_test = 2500,
3702 .v_failure = 3000,
3703 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003704};
3705
Jay Chokshide4cefb2011-08-04 18:10:44 -07003706#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3707
3708/**
3709 * 'flag' stores three values; led id, led mode, and max current of led.
3710 * The bit packing format is as follow,
3711 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3712 * led_id (1 nibble)
3713 */
3714#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3715 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3716 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3717 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3718 PM8XXX_LED_MAX_CURRENT_MASK))
3719
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003720static struct led_info pm8921_led_info[] = {
3721 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003722 .name = "led:usb",
3723 .default_trigger = "usb-online",
3724 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3725 PM8XXX_LED_MODE_MANUAL,
3726 PM8921_LC_LED_MAX_CURRENT),
3727 },
3728 [1] = {
3729 .name = "led:ac",
3730 .default_trigger = "ac-online",
3731 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3732 PM8XXX_LED_MODE_MANUAL,
3733 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003734 },
3735};
3736
3737static struct led_platform_data pm8xxx_leds_pdata = {
3738 .num_leds = ARRAY_SIZE(pm8921_led_info),
3739 .leds = pm8921_led_info,
3740};
3741
3742static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3743 .irq_pdata = &pm8xxx_irq_pdata,
3744 .gpio_pdata = &pm8xxx_gpio_pdata,
3745 .mpp_pdata = &pm8xxx_mpp_pdata,
3746 .rtc_pdata = &pm8xxx_rtc_pdata,
3747 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3748 .keypad_pdata = &keypad_data,
3749 .misc_pdata = &pm8xxx_misc_pdata,
3750 .regulator_pdatas = msm_pm8921_regulator_pdata,
3751 .charger_pdata = &pm8921_chg_pdata,
3752 .bms_pdata = &pm8921_bms_pdata,
3753 .adc_pdata = &pm8921_adc_pdata,
3754 .leds_pdata = &pm8xxx_leds_pdata,
3755};
3756
3757static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3758 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3759 .slave = {
3760 .name = "pm8921-core",
3761 .platform_data = &pm8921_platform_data,
3762 },
3763};
3764
3765static void msm8960_wcnss_init(void)
3766{
3767 int i, ret, j;
3768
3769 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3770 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3771 "wcnss_5_wire");
3772 if (ret) {
3773 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3774 wcnss_5wire_interface[i].gpio, ret);
3775 goto fail;
3776 }
3777 }
3778
3779 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3780
3781 return;
3782
3783fail:
3784 for (j = 0; j < i; j++)
3785 gpio_free(wcnss_5wire_interface[j].gpio);
3786}
3787
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003788#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003789static int ethernet_init(void)
3790{
3791 int ret;
3792 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3793 if (ret) {
3794 pr_err("ks8851 gpio_request failed: %d\n", ret);
3795 goto fail;
3796 }
3797
3798 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3799 if (ret) {
3800 pr_err("ks8851 gpio_request failed: %d\n", ret);
3801 goto fail_rst;
3802 }
3803
3804 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3805 if (ret) {
3806 pr_err("ks8851 gpio_request failed: %d\n", ret);
3807 goto fail_cs;
3808 }
3809
3810 gpio_direction_output(FPGA_CS_GPIO, 1);
3811 gpio_direction_output(KS8851_RST_GPIO, 1);
3812 return 0;
3813fail_cs:
3814 gpio_free(KS8851_RST_GPIO);
3815fail_rst:
3816 gpio_free(KS8851_IRQ_GPIO);
3817fail:
3818 return ret;
3819}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003820#else
3821static int ethernet_init(void)
3822{
3823 return 0;
3824}
3825#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003826
3827static struct msm_cpuidle_state msm_cstates[] __initdata = {
3828 {0, 0, "C0", "WFI",
3829 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3830
3831 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3832 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3833
3834 {0, 2, "C2", "POWER_COLLAPSE",
3835 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3836
3837 {1, 0, "C0", "WFI",
3838 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3839
3840 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3841 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3842};
3843
3844static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3845 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3846 .idle_supported = 1,
3847 .suspend_supported = 1,
3848 .idle_enabled = 0,
3849 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003850 },
3851
3852 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3853 .idle_supported = 1,
3854 .suspend_supported = 1,
3855 .idle_enabled = 0,
3856 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003857 },
3858
3859 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3860 .idle_supported = 1,
3861 .suspend_supported = 1,
3862 .idle_enabled = 1,
3863 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003864 },
3865
3866 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3867 .idle_supported = 0,
3868 .suspend_supported = 1,
3869 .idle_enabled = 0,
3870 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003871 },
3872
3873 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3874 .idle_supported = 1,
3875 .suspend_supported = 1,
3876 .idle_enabled = 0,
3877 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003878 },
3879
3880 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3881 .idle_supported = 1,
3882 .suspend_supported = 0,
3883 .idle_enabled = 1,
3884 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003885 },
3886};
3887
3888static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3889 {
3890 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3891 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3892 true,
3893 1, 8000, 100000, 1,
3894 },
3895
3896 {
3897 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3898 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3899 true,
3900 1500, 5000, 60100000, 3000,
3901 },
3902
3903 {
3904 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3905 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3906 false,
3907 1800, 5000, 60350000, 3500,
3908 },
3909
3910 {
3911 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3912 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3913 false,
3914 2800, 2500, 65350000, 4800,
3915 },
3916
3917 {
3918 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3919 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3920 false,
3921 3800, 4500, 67850000, 5500,
3922 },
3923
3924 {
3925 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3926 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3927 false,
3928 4800, 2000, 71850000, 6800,
3929 },
3930
3931 {
3932 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3933 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3934 false,
3935 6800, 500, 75850000, 8800,
3936 },
3937
3938 {
3939 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3940 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3941 false,
3942 7800, 0, 76350000, 9800,
3943 },
3944};
3945
3946#ifdef CONFIG_I2C
3947#define I2C_SURF 1
3948#define I2C_FFA (1 << 1)
3949#define I2C_RUMI (1 << 2)
3950#define I2C_SIM (1 << 3)
3951#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003952#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003953
3954struct i2c_registry {
3955 u8 machs;
3956 int bus;
3957 struct i2c_board_info *info;
3958 int len;
3959};
3960
3961#ifdef CONFIG_MSM_CAMERA
3962static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3963#ifdef CONFIG_IMX074
3964 {
3965 I2C_BOARD_INFO("imx074", 0x1A),
3966 },
3967#endif
3968#ifdef CONFIG_OV2720
3969 {
3970 I2C_BOARD_INFO("ov2720", 0x6C),
3971 },
3972#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003973 {
3974 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3975 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303976#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3977 {
3978 I2C_BOARD_INFO("sc628a", 0x6E),
3979 },
3980#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003981};
3982#endif
3983
3984/* Sensors DSPS platform data */
3985#ifdef CONFIG_MSM_DSPS
3986#define DSPS_PIL_GENERIC_NAME "dsps"
3987#endif /* CONFIG_MSM_DSPS */
3988
3989static void __init msm8960_init_dsps(void)
3990{
3991#ifdef CONFIG_MSM_DSPS
3992 struct msm_dsps_platform_data *pdata =
3993 msm_dsps_device.dev.platform_data;
3994 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3995 pdata->gpios = NULL;
3996 pdata->gpios_num = 0;
3997
3998 platform_device_register(&msm_dsps_device);
3999#endif /* CONFIG_MSM_DSPS */
4000}
4001
Amir Samuelov5137e392011-09-21 17:31:25 +03004002#ifdef CONFIG_ISL9519_CHARGER
4003static struct isl_platform_data isl_data __initdata = {
4004 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4005 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4006 .max_system_voltage = 4200,
4007 .min_system_voltage = 3200,
4008 .chgcurrent = 1000, /* 1900, */
4009 .term_current = 400, /* Need fine tuning */
4010 .input_current = 2048,
4011};
4012
4013static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4014 {
4015 I2C_BOARD_INFO("isl9519q", 0x9),
4016 .irq = 0, /* Not required when notify-by-pmic */
4017 .platform_data = &isl_data,
4018 },
4019};
4020#endif /* CONFIG_ISL9519_CHARGER */
4021
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004022static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4023#ifdef CONFIG_MSM_CAMERA
4024 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004025 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004026 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4027 msm_camera_boardinfo,
4028 ARRAY_SIZE(msm_camera_boardinfo),
4029 },
4030#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004031#ifdef CONFIG_ISL9519_CHARGER
4032 {
4033 I2C_LIQUID,
4034 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4035 isl_charger_i2c_info,
4036 ARRAY_SIZE(isl_charger_i2c_info),
4037 },
4038#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004039 {
4040 I2C_SURF | I2C_FFA | I2C_FLUID,
4041 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4042 cyttsp_info,
4043 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004044 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304045 {
4046 I2C_LIQUID,
4047 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4048 mxt_device_info,
4049 ARRAY_SIZE(mxt_device_info),
4050 },
4051
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004052};
4053#endif /* CONFIG_I2C */
4054
4055static void __init register_i2c_devices(void)
4056{
4057#ifdef CONFIG_I2C
4058 u8 mach_mask = 0;
4059 int i;
4060
4061 /* Build the matching 'supported_machs' bitmask */
4062 if (machine_is_msm8960_cdp())
4063 mach_mask = I2C_SURF;
4064 else if (machine_is_msm8960_rumi3())
4065 mach_mask = I2C_RUMI;
4066 else if (machine_is_msm8960_sim())
4067 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004068 else if (machine_is_msm8960_fluid())
4069 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004070 else if (machine_is_msm8960_liquid())
4071 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004072 else if (machine_is_msm8960_mtp())
4073 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004074 else
4075 pr_err("unmatched machine ID in register_i2c_devices\n");
4076
4077 /* Run the array and install devices as appropriate */
4078 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4079 if (msm8960_i2c_devices[i].machs & mach_mask)
4080 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4081 msm8960_i2c_devices[i].info,
4082 msm8960_i2c_devices[i].len);
4083 }
4084#endif
4085}
4086
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004087static void __init msm8960_sim_init(void)
4088{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004089 if (socinfo_init() < 0)
4090 pr_err("socinfo_init() failed!\n");
4091
4092 BUG_ON(msm_rpm_init(&msm_rpm_data));
4093 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4094 ARRAY_SIZE(msm_rpmrs_levels)));
4095 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004096 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004097 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004098 msm8960_device_ssbi_pm8921.dev.platform_data =
4099 &msm8960_ssbi_pm8921_pdata;
4100 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004101
4102 /* Simulator supports a QWERTY keypad */
4103 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4104
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004105 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4106 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4107 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004108 gpiomux_init();
4109 ethernet_init();
4110 msm8960_i2c_init();
4111 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4112 msm_spm_l2_init(msm_spm_l2_data);
4113 msm8960_init_buses();
4114 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4115 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004116 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004117 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004118
4119 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4120 &msm8960_qup_spi_gsbi1_pdata;
4121 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4122
4123 msm8960_init_mmc();
4124 msm_fb_add_devices();
4125 slim_register_board_info(msm_slim_devices,
4126 ARRAY_SIZE(msm_slim_devices));
4127 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4128 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4129 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4130 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004131}
4132
4133static void __init msm8960_rumi3_init(void)
4134{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004135 if (socinfo_init() < 0)
4136 pr_err("socinfo_init() failed!\n");
4137
4138 BUG_ON(msm_rpm_init(&msm_rpm_data));
4139 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4140 ARRAY_SIZE(msm_rpmrs_levels)));
4141 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004142 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004143 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004144 gpiomux_init();
4145 ethernet_init();
4146 msm8960_device_ssbi_pm8921.dev.platform_data =
4147 &msm8960_ssbi_pm8921_pdata;
4148 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4149 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4150 &msm8960_qup_spi_gsbi1_pdata;
4151 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4152 msm8960_i2c_init();
4153 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4154 msm_spm_l2_init(msm_spm_l2_data);
4155 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4156 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004157 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004158 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004159 register_i2c_devices();
4160 msm_fb_add_devices();
4161 slim_register_board_info(msm_slim_devices,
4162 ARRAY_SIZE(msm_slim_devices));
4163 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4164 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4165 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4166 msm_pm_data);
4167}
4168
4169static void __init msm8960_cdp_init(void)
4170{
4171 if (socinfo_init() < 0)
4172 pr_err("socinfo_init() failed!\n");
4173
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004174 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4175 pr_err("meminfo_init() failed!\n");
4176
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004177 BUG_ON(msm_rpm_init(&msm_rpm_data));
4178 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4179 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004180
4181 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004182 regulator_suppress_info_printing();
4183 if (msm_xo_init())
4184 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004185 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004186 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004187 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4188 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4189 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004190 gpiomux_init();
4191 ethernet_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304192 if (machine_is_msm8960_liquid())
4193 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004194 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4195 &msm8960_qup_spi_gsbi1_pdata;
4196 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4197 msm8960_device_ssbi_pm8921.dev.platform_data =
4198 &msm8960_ssbi_pm8921_pdata;
4199 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4200 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004201 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004202 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4203 msm_spm_l2_init(msm_spm_l2_data);
4204 msm8960_init_buses();
4205 platform_add_devices(msm_footswitch_devices,
4206 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004207 if (machine_is_msm8960_liquid())
4208 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004209 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4210 pm8921_gpio_mpp_init();
4211 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4212 msm8960_init_cam();
4213 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004214 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304215 if (machine_is_msm8960_liquid())
4216 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004217 register_i2c_devices();
4218 msm8960_wcnss_init();
4219 msm_fb_add_devices();
4220 slim_register_board_info(msm_slim_devices,
4221 ARRAY_SIZE(msm_slim_devices));
4222 msm8960_init_dsps();
4223 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4224 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4225 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4226 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004227 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004228}
4229
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004230MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4231 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004232 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004233 .init_irq = msm8960_init_irq,
4234 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004235 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004236 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004237MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004238
4239MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4240 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004241 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004242 .init_irq = msm8960_init_irq,
4243 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004244 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004245 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004246MACHINE_END
4247
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004248MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4249 .map_io = msm8960_map_io,
4250 .reserve = msm8960_reserve,
4251 .init_irq = msm8960_init_irq,
4252 .timer = &msm_timer,
4253 .init_machine = msm8960_cdp_init,
4254 .init_early = msm8960_allocate_memory_regions,
4255MACHINE_END
4256
4257MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4258 .map_io = msm8960_map_io,
4259 .reserve = msm8960_reserve,
4260 .init_irq = msm8960_init_irq,
4261 .timer = &msm_timer,
4262 .init_machine = msm8960_cdp_init,
4263 .init_early = msm8960_allocate_memory_regions,
4264MACHINE_END
4265
4266MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4267 .map_io = msm8960_map_io,
4268 .reserve = msm8960_reserve,
4269 .init_irq = msm8960_init_irq,
4270 .timer = &msm_timer,
4271 .init_machine = msm8960_cdp_init,
4272 .init_early = msm8960_allocate_memory_regions,
4273MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004274
4275MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4276 .map_io = msm8960_map_io,
4277 .reserve = msm8960_reserve,
4278 .init_irq = msm8960_init_irq,
4279 .timer = &msm_timer,
4280 .init_machine = msm8960_cdp_init,
4281 .init_early = msm8960_allocate_memory_regions,
4282MACHINE_END