blob: 47f1592f5ace46870c3e4fc64468fcc11ee2cfd2 [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>
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -070024#include <linux/mfd/pm8xxx/pm8921-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080042
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070045#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048
49#include <mach/board.h>
50#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <mach/msm_spi.h>
52#ifdef CONFIG_USB_MSM_OTG_72K
53#include <mach/msm_hsusb.h>
54#else
55#include <linux/usb/msm_hsusb.h>
56#endif
57#include <linux/usb/android.h>
58#include <mach/usbdiag.h>
59#include <mach/socinfo.h>
60#include <mach/rpm.h>
61#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070062#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#include <mach/msm_bus_board.h>
64#include <mach/msm_memtypes.h>
65#include <mach/dma.h>
66#include <mach/msm_dsps.h>
67#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070068#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#ifdef CONFIG_WCD9310_CODEC
71#include <linux/slimbus/slimbus.h>
72#include <linux/mfd/wcd9310/core.h>
73#include <linux/mfd/wcd9310/pdata.h>
74#endif
75
Laura Abbottd6183792011-08-19 13:42:24 -070076#include <linux/ion.h>
77#include <mach/ion.h>
78
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080080#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "spm.h"
83#include "board-msm8960.h"
84#include "pm.h"
85#include "cpuidle.h"
86#include "rpm_resources.h"
87#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070088#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070089#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070090#include "smd_private.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091
92static struct platform_device msm_fm_platform_init = {
93 .name = "iris_fm",
94 .id = -1,
95};
96
97struct pm8xxx_gpio_init {
98 unsigned gpio;
99 struct pm_gpio config;
100};
101
102struct pm8xxx_mpp_init {
103 unsigned mpp;
104 struct pm8xxx_mpp_config_data config;
105};
106
107#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
108 _func, _inv, _disable) \
109{ \
110 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
111 .config = { \
112 .direction = _dir, \
113 .output_buffer = _buf, \
114 .output_value = _val, \
115 .pull = _pull, \
116 .vin_sel = _vin, \
117 .out_strength = _out_strength, \
118 .function = _func, \
119 .inv_int_pol = _inv, \
120 .disable_pin = _disable, \
121 } \
122}
123
124#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
125{ \
126 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
127 .config = { \
128 .type = PM8XXX_MPP_TYPE_##_type, \
129 .level = _level, \
130 .control = PM8XXX_MPP_##_control, \
131 } \
132}
133
134#define PM8XXX_GPIO_DISABLE(_gpio) \
135 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
136 0, 0, 0, 1)
137
138#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
139 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
140 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
141 PM_GPIO_STRENGTH_HIGH, \
142 PM_GPIO_FUNC_NORMAL, 0, 0)
143
144#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
145 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
146 _pull, PM_GPIO_VIN_S4, \
147 PM_GPIO_STRENGTH_NO, \
148 PM_GPIO_FUNC_NORMAL, 0, 0)
149
150#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
151 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
152 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
153 PM_GPIO_STRENGTH_HIGH, \
154 _func, 0, 0)
155
156/* Initial PM8921 GPIO configurations */
157static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
158 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
159 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
160 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300161 /* External regulator shared by display and touchscreen on LiQUID */
162 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
163 PM8XXX_GPIO_OUTPUT(21, 1), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700165 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700167 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700168};
169
170/* Initial PM8921 MPP configurations */
171static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
172 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
173 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700174 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
175 DOUT_CTRL_LOW),
176};
177
178static void __init pm8921_gpio_mpp_init(void)
179{
180 int i, rc;
181
182 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
183 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
184 &pm8921_gpios[i].config);
185 if (rc) {
186 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
187 break;
188 }
189 }
190
191 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
192 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
193 &pm8921_mpps[i].config);
194 if (rc) {
195 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
196 break;
197 }
198 }
199}
200
201#define FPGA_CS_GPIO 14
202#define KS8851_RST_GPIO 89
203#define KS8851_IRQ_GPIO 90
204
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700205#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
206enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700207 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700208 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
209 /* CAM Expander */
210 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
211 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
212 GPIO_CAM_GP_AFBUSY,
213 GPIO_CAM_GP_STROBE_CE,
214 GPIO_CAM_GP_CAM1MP_XCLR,
215 GPIO_CAM_GP_CAMIF_RESET_N,
216 GPIO_CAM_GP_XMT_FLASH_INT,
217 GPIO_CAM_GP_LED_EN1,
218 GPIO_CAM_GP_LED_EN2,
219
220};
221#endif
222
Harini Jayaraman608d0462011-08-09 19:10:03 -0600223/* The SPI configurations apply to GSBI 1*/
224static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700225 .func = GPIOMUX_FUNC_1,
226 .drv = GPIOMUX_DRV_8MA,
227 .pull = GPIOMUX_PULL_NONE,
228};
229
Harini Jayaraman608d0462011-08-09 19:10:03 -0600230static struct gpiomux_setting spi_suspended_config = {
231 .func = GPIOMUX_FUNC_GPIO,
232 .drv = GPIOMUX_DRV_2MA,
233 .pull = GPIOMUX_PULL_DOWN,
234};
235
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236static struct gpiomux_setting gsbi3 = {
237 .func = GPIOMUX_FUNC_1,
238 .drv = GPIOMUX_DRV_8MA,
239 .pull = GPIOMUX_PULL_NONE,
240};
241
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700242static struct gpiomux_setting gsbi5 = {
243 .func = GPIOMUX_FUNC_1,
244 .drv = GPIOMUX_DRV_8MA,
245 .pull = GPIOMUX_PULL_NONE,
246};
247
248static struct gpiomux_setting gsbi10 = {
249 .func = GPIOMUX_FUNC_2,
250 .drv = GPIOMUX_DRV_8MA,
251 .pull = GPIOMUX_PULL_NONE,
252};
253
254static struct gpiomux_setting gsbi12 = {
255 .func = GPIOMUX_FUNC_1,
256 .drv = GPIOMUX_DRV_8MA,
257 .pull = GPIOMUX_PULL_NONE,
258};
259
260static struct gpiomux_setting cdc_mclk = {
261 .func = GPIOMUX_FUNC_1,
262 .drv = GPIOMUX_DRV_8MA,
263 .pull = GPIOMUX_PULL_NONE,
264};
265
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700266static struct gpiomux_setting audio_auxpcm[] = {
267 /* Suspended state */
268 {
269 .func = GPIOMUX_FUNC_GPIO,
270 .drv = GPIOMUX_DRV_2MA,
271 .pull = GPIOMUX_PULL_NONE,
272 },
273 /* Active state */
274 {
275 .func = GPIOMUX_FUNC_1,
276 .drv = GPIOMUX_DRV_2MA,
277 .pull = GPIOMUX_PULL_NONE,
278 },
279};
280
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700281#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700282static struct gpiomux_setting gpio_eth_config = {
283 .pull = GPIOMUX_PULL_NONE,
284 .drv = GPIOMUX_DRV_8MA,
285 .func = GPIOMUX_FUNC_GPIO,
286};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700287#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288
289static struct gpiomux_setting slimbus = {
290 .func = GPIOMUX_FUNC_1,
291 .drv = GPIOMUX_DRV_8MA,
292 .pull = GPIOMUX_PULL_KEEPER,
293};
294
295struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700296#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700297 {
298 .gpio = KS8851_IRQ_GPIO,
299 .settings = {
300 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
301 }
302 },
303 {
304 .gpio = KS8851_RST_GPIO,
305 .settings = {
306 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
307 }
308 },
309 {
310 .gpio = FPGA_CS_GPIO,
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
313 }
314 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700315#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316};
317
318static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
319 {
320 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
321 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600322 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
323 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324 },
325 },
326 {
327 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
328 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600329 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
330 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331 },
332 },
333 {
334 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
335 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600336 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
337 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700338 },
339 },
340 {
341 .gpio = 9, /* GSBI1 QUP SPI_CLK */
342 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600343 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
344 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 },
346 },
347 {
348 .gpio = 16, /* GSBI3 I2C QUP SDA */
349 .settings = {
350 [GPIOMUX_SUSPENDED] = &gsbi3,
351 },
352 },
353 {
354 .gpio = 17, /* GSBI3 I2C QUP SCL */
355 .settings = {
356 [GPIOMUX_SUSPENDED] = &gsbi3,
357 },
358 },
359 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700360 .gpio = 22, /* GSBI5 UART2 */
361 .settings = {
362 [GPIOMUX_SUSPENDED] = &gsbi5,
363 },
364 },
365 {
366 .gpio = 23, /* GSBI5 UART2 */
367 .settings = {
368 [GPIOMUX_SUSPENDED] = &gsbi5,
369 },
370 },
371 {
372 .gpio = 24, /* GSBI5 UART2 */
373 .settings = {
374 [GPIOMUX_SUSPENDED] = &gsbi5,
375 },
376 },
377 {
378 .gpio = 25, /* GSBI5 UART2 */
379 .settings = {
380 [GPIOMUX_SUSPENDED] = &gsbi5,
381 },
382 },
383 {
384 .gpio = 44, /* GSBI12 I2C QUP SDA */
385 .settings = {
386 [GPIOMUX_SUSPENDED] = &gsbi12,
387 },
388 },
389 {
390 .gpio = 45, /* GSBI12 I2C QUP SCL */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi12,
393 },
394 },
395 {
396 .gpio = 73, /* GSBI10 I2C QUP SDA */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi10,
399 },
400 },
401 {
402 .gpio = 74, /* GSBI10 I2C QUP SCL */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi10,
405 },
406 },
407};
408
409static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
410 {
411 .gpio = 60, /* slimbus data */
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &slimbus,
414 },
415 },
416 {
417 .gpio = 61, /* slimbus clk */
418 .settings = {
419 [GPIOMUX_SUSPENDED] = &slimbus,
420 },
421 },
422};
423
424static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
425 {
426 .gpio = 59,
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &cdc_mclk,
429 },
430 },
431};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700432
433static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
434 {
435 .gpio = 63,
436 .settings = {
437 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
438 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
439 },
440 },
441 {
442 .gpio = 64,
443 .settings = {
444 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
445 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
446 },
447 },
448 {
449 .gpio = 65,
450 .settings = {
451 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
452 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
453 },
454 },
455 {
456 .gpio = 66,
457 .settings = {
458 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
459 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
460 },
461 },
462};
463
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700464static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
465 .func = GPIOMUX_FUNC_GPIO,
466 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700467 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700468};
469
470static struct gpiomux_setting wcnss_5wire_active_cfg = {
471 .func = GPIOMUX_FUNC_1,
472 .drv = GPIOMUX_DRV_6MA,
473 .pull = GPIOMUX_PULL_DOWN,
474};
475
476static struct msm_gpiomux_config wcnss_5wire_interface[] = {
477 {
478 .gpio = 84,
479 .settings = {
480 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
481 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
482 },
483 },
484 {
485 .gpio = 85,
486 .settings = {
487 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
488 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
489 },
490 },
491 {
492 .gpio = 86,
493 .settings = {
494 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
495 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
496 },
497 },
498 {
499 .gpio = 87,
500 .settings = {
501 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
502 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
503 },
504 },
505 {
506 .gpio = 88,
507 .settings = {
508 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
509 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
510 },
511 },
512};
Nishant Pandit24153d82011-08-27 16:05:13 +0530513static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530514 {
515 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
516 .drv = GPIOMUX_DRV_2MA,
517 .pull = GPIOMUX_PULL_DOWN,
518 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700519
Nishant Pandit474f2252011-07-23 23:17:56 +0530520 {
521 .func = GPIOMUX_FUNC_1, /*active 1*/
522 .drv = GPIOMUX_DRV_2MA,
523 .pull = GPIOMUX_PULL_NONE,
524 },
525
526 {
527 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
528 .drv = GPIOMUX_DRV_2MA,
529 .pull = GPIOMUX_PULL_NONE,
530 },
531
532 {
533 .func = GPIOMUX_FUNC_1, /*active 3*/
534 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700535 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530536 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530537
538 {
539 .func = GPIOMUX_FUNC_5, /*active 4*/
540 .drv = GPIOMUX_DRV_8MA,
541 .pull = GPIOMUX_PULL_UP,
542 },
543
544 {
545 .func = GPIOMUX_FUNC_6, /*active 5*/
546 .drv = GPIOMUX_DRV_8MA,
547 .pull = GPIOMUX_PULL_UP,
548 },
549
550 {
551 .func = GPIOMUX_FUNC_2, /*active 6*/
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_UP,
554 },
555
556 {
557 .func = GPIOMUX_FUNC_3, /*active 7*/
558 .drv = GPIOMUX_DRV_8MA,
559 .pull = GPIOMUX_PULL_UP,
560 },
561
Kevin Chan4c58d292011-09-13 11:03:25 -0700562 {
563 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
564 .drv = GPIOMUX_DRV_2MA,
565 .pull = GPIOMUX_PULL_KEEPER,
566 },
567
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568};
569
Nishant Pandit24153d82011-08-27 16:05:13 +0530570static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700571 {
572 .gpio = 2,
573 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530574 [GPIOMUX_ACTIVE] = &cam_settings[2],
575 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576 },
577 },
578 {
579 .gpio = 3,
580 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530581 [GPIOMUX_ACTIVE] = &cam_settings[1],
582 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700583 },
584 },
585 {
586 .gpio = 4,
587 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530588 [GPIOMUX_ACTIVE] = &cam_settings[1],
589 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700590 },
591 },
592 {
593 .gpio = 5,
594 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530595 [GPIOMUX_ACTIVE] = &cam_settings[1],
596 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597 },
598 },
599 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530600 .gpio = 76,
601 .settings = {
602 [GPIOMUX_ACTIVE] = &cam_settings[2],
603 [GPIOMUX_SUSPENDED] = &cam_settings[0],
604 },
605 },
606 {
607 .gpio = 107,
608 .settings = {
609 [GPIOMUX_ACTIVE] = &cam_settings[2],
610 [GPIOMUX_SUSPENDED] = &cam_settings[0],
611 },
612 },
613};
614
615static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
616 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700617 .gpio = 18,
618 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530619 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700620 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700621 },
622 },
623 {
624 .gpio = 19,
625 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530626 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700627 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700628 },
629 },
630 {
631 .gpio = 20,
632 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530633 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700634 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700635 },
636 },
637 {
638 .gpio = 21,
639 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530640 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700641 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700642 },
643 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700644};
645
646static struct gpiomux_setting cyts_resout_sus_cfg = {
647 .func = GPIOMUX_FUNC_GPIO,
648 .drv = GPIOMUX_DRV_6MA,
649 .pull = GPIOMUX_PULL_UP,
650};
651
652static struct gpiomux_setting cyts_resout_act_cfg = {
653 .func = GPIOMUX_FUNC_GPIO,
654 .drv = GPIOMUX_DRV_6MA,
655 .pull = GPIOMUX_PULL_UP,
656};
657
658static struct gpiomux_setting cyts_sleep_sus_cfg = {
659 .func = GPIOMUX_FUNC_GPIO,
660 .drv = GPIOMUX_DRV_6MA,
661 .pull = GPIOMUX_PULL_DOWN,
662};
663
664static struct gpiomux_setting cyts_sleep_act_cfg = {
665 .func = GPIOMUX_FUNC_GPIO,
666 .drv = GPIOMUX_DRV_6MA,
667 .pull = GPIOMUX_PULL_DOWN,
668};
669
670static struct gpiomux_setting cyts_int_act_cfg = {
671 .func = GPIOMUX_FUNC_GPIO,
672 .drv = GPIOMUX_DRV_8MA,
673 .pull = GPIOMUX_PULL_UP,
674};
675
676static struct gpiomux_setting cyts_int_sus_cfg = {
677 .func = GPIOMUX_FUNC_GPIO,
678 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530679 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700680};
681
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700682static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
683 { /* TS INTERRUPT */
684 .gpio = 11,
685 .settings = {
686 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
687 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
688 },
689 },
690 { /* TS SLEEP */
691 .gpio = 50,
692 .settings = {
693 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
694 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
695 },
696 },
697 { /* TS RESOUT */
698 .gpio = 52,
699 .settings = {
700 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
701 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
702 },
703 },
704};
705
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700706#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
707enum {
708 SX150X_CAM,
709};
710
Nishant Pandit474f2252011-07-23 23:17:56 +0530711static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700712 [SX150X_CAM] = {
713 .gpio_base = GPIO_CAM_EXPANDER_BASE,
714 .oscio_is_gpo = false,
715 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530716 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700717 .io_open_drain_ena = 0x0,
718 .irq_summary = -1,
719 },
720};
Nishant Pandit474f2252011-07-23 23:17:56 +0530721
722#endif
723
724#ifdef CONFIG_I2C
725
726#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
727#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300728#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530729
730#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
731
732static struct i2c_board_info cam_expander_i2c_info[] = {
733 {
734 I2C_BOARD_INFO("sx1508q", 0x22),
735 .platform_data = &sx150x_data[SX150X_CAM]
736 },
737};
738
739static struct msm_cam_expander_info cam_expander_info[] = {
740 {
741 cam_expander_i2c_info,
742 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
743 },
744};
745#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700746#endif
747
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700748#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
749#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700750#define MSM_PMEM_AUDIO_SIZE 0x28B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700751#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
752
Laura Abbottd6183792011-08-19 13:42:24 -0700753#define MSM_ION_EBI_SIZE SZ_8M
754
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700755#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
756static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
757static int __init pmem_kernel_ebi1_size_setup(char *p)
758{
759 pmem_kernel_ebi1_size = memparse(p, NULL);
760 return 0;
761}
762early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
763#endif
764
765#ifdef CONFIG_ANDROID_PMEM
766static unsigned pmem_size = MSM_PMEM_SIZE;
767static int __init pmem_size_setup(char *p)
768{
769 pmem_size = memparse(p, NULL);
770 return 0;
771}
772early_param("pmem_size", pmem_size_setup);
773
774static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
775
776static int __init pmem_adsp_size_setup(char *p)
777{
778 pmem_adsp_size = memparse(p, NULL);
779 return 0;
780}
781early_param("pmem_adsp_size", pmem_adsp_size_setup);
782
783static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
784
785static int __init pmem_audio_size_setup(char *p)
786{
787 pmem_audio_size = memparse(p, NULL);
788 return 0;
789}
790early_param("pmem_audio_size", pmem_audio_size_setup);
791#endif
792
793#ifdef CONFIG_ANDROID_PMEM
794static struct android_pmem_platform_data android_pmem_pdata = {
795 .name = "pmem",
796 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
797 .cached = 1,
798 .memory_type = MEMTYPE_EBI1,
799};
800
801static struct platform_device android_pmem_device = {
802 .name = "android_pmem",
803 .id = 0,
804 .dev = {.platform_data = &android_pmem_pdata},
805};
806
807static struct android_pmem_platform_data android_pmem_adsp_pdata = {
808 .name = "pmem_adsp",
809 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
810 .cached = 0,
811 .memory_type = MEMTYPE_EBI1,
812};
813static struct platform_device android_pmem_adsp_device = {
814 .name = "android_pmem",
815 .id = 2,
816 .dev = { .platform_data = &android_pmem_adsp_pdata },
817};
818
819static struct android_pmem_platform_data android_pmem_audio_pdata = {
820 .name = "pmem_audio",
821 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
822 .cached = 0,
823 .memory_type = MEMTYPE_EBI1,
824};
825
826static struct platform_device android_pmem_audio_device = {
827 .name = "android_pmem",
828 .id = 4,
829 .dev = { .platform_data = &android_pmem_audio_pdata },
830};
831#endif
832
833static struct memtype_reserve msm8960_reserve_table[] __initdata = {
834 [MEMTYPE_SMI] = {
835 },
836 [MEMTYPE_EBI0] = {
837 .flags = MEMTYPE_FLAGS_1M_ALIGN,
838 },
839 [MEMTYPE_EBI1] = {
840 .flags = MEMTYPE_FLAGS_1M_ALIGN,
841 },
842};
843
844static void __init size_pmem_devices(void)
845{
846#ifdef CONFIG_ANDROID_PMEM
847 android_pmem_adsp_pdata.size = pmem_adsp_size;
848 android_pmem_pdata.size = pmem_size;
849 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
850#endif
851}
852
853static void __init reserve_memory_for(struct android_pmem_platform_data *p)
854{
855 msm8960_reserve_table[p->memory_type].size += p->size;
856}
857
858static void __init reserve_pmem_memory(void)
859{
860#ifdef CONFIG_ANDROID_PMEM
861 reserve_memory_for(&android_pmem_adsp_pdata);
862 reserve_memory_for(&android_pmem_pdata);
863 reserve_memory_for(&android_pmem_audio_pdata);
864 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
865#endif
866}
867
Larry Basselb4126da2011-07-18 14:31:33 -0700868static int msm8960_paddr_to_memtype(unsigned int paddr)
869{
870 return MEMTYPE_EBI1;
871}
872
Laura Abbottd6183792011-08-19 13:42:24 -0700873#ifdef CONFIG_ION_MSM
874struct ion_platform_data ion_pdata = {
875 .nr = 3,
876 .heaps = {
877 {
878 .id = ION_HEAP_SYSTEM_ID,
879 .type = ION_HEAP_TYPE_SYSTEM,
880 .name = ION_KMALLOC_HEAP_NAME,
881 },
882 {
883 .id = ION_HEAP_SYSTEM_CONTIG_ID,
884 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
885 .name = ION_VMALLOC_HEAP_NAME,
886 },
887 {
888 .id = ION_HEAP_EBI_ID,
889 .type = ION_HEAP_TYPE_CARVEOUT,
890 .name = ION_EBI1_HEAP_NAME,
891 .size = MSM_ION_EBI_SIZE,
892 .memory_type = ION_EBI_TYPE,
893 },
894 }
895};
896
897struct platform_device ion_dev = {
898 .name = "ion-msm",
899 .id = 1,
900 .dev = { .platform_data = &ion_pdata },
901};
902#endif
903
904static void reserve_ion_memory(void)
905{
906#ifdef CONFIG_ION_MSM
907 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
908#endif
909}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700910static void __init msm8960_calculate_reserve_sizes(void)
911{
912 size_pmem_devices();
913 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700914 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700915}
916
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700917static struct reserve_info msm8960_reserve_info __initdata = {
918 .memtype_reserve_table = msm8960_reserve_table,
919 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
920 .paddr_to_memtype = msm8960_paddr_to_memtype,
921};
922
Larry Basselb4126da2011-07-18 14:31:33 -0700923static int msm8960_memory_bank_size(void)
924{
925 return 1<<29;
926}
927
928static void __init locate_unstable_memory(void)
929{
930 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
931 unsigned long bank_size;
932 unsigned long low, high;
933
934 bank_size = msm8960_memory_bank_size();
935 low = meminfo.bank[0].start;
936 high = mb->start + mb->size;
937 low &= ~(bank_size - 1);
938
939 if (high - low <= bank_size)
940 return;
941 msm8960_reserve_info.low_unstable_address = low + bank_size;
942 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
943 msm8960_reserve_info.bank_size = bank_size;
944 pr_info("low unstable address %lx max size %lx bank size %lx\n",
945 msm8960_reserve_info.low_unstable_address,
946 msm8960_reserve_info.max_unstable_size,
947 msm8960_reserve_info.bank_size);
948}
949
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700950static void __init msm8960_reserve(void)
951{
952 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700953 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700954 msm_reserve();
955}
956
Larry Bassela4414b12011-08-04 11:11:02 -0700957static int msm8960_change_memory_power(u64 start, u64 size,
958 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700959{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700960 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700961}
962
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700963#ifdef CONFIG_MSM_CAMERA
964
Nishant Pandit24153d82011-08-27 16:05:13 +0530965static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700966 5, /*CAMIF_MCLK*/
967 20, /*CAMIF_I2C_DATA*/
968 21, /*CAMIF_I2C_CLK*/
969};
970
Nishant Pandit24153d82011-08-27 16:05:13 +0530971static struct msm_camera_gpio_conf gpio_conf = {
972 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
973 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
974 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
975 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
976};
977
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700978#define VFE_CAMIF_TIMER1_GPIO 2
979#define VFE_CAMIF_TIMER2_GPIO 3
980#define VFE_CAMIF_TIMER3_GPIO_INT 4
981struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
982 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
983 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
984 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
985 .flash_recharge_duration = 50000,
986 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
987};
988
Nishant Pandit474f2252011-07-23 23:17:56 +0530989#ifdef CONFIG_MSM_CAMERA_FLASH
990static struct msm_camera_sensor_flash_src msm_flash_src = {
991 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
992 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
993 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
994#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
995 defined(CONFIG_GPIO_SX150X_MODULE))
996 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
997#endif
998};
999#endif
1000
Nishant Pandit24153d82011-08-27 16:05:13 +05301001struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1002 {
1003 .ioclk.mclk_clk_rate = 24000000,
1004 .ioclk.vfe_clk_rate = 228570000,
1005 .csid_core = 0,
1006 },
1007 {
1008 .ioclk.mclk_clk_rate = 24000000,
1009 .ioclk.vfe_clk_rate = 228570000,
1010 .csid_core = 1,
1011 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001012};
1013
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001014#ifdef CONFIG_IMX074_ACT
1015static struct i2c_board_info imx074_actuator_i2c_info = {
1016 I2C_BOARD_INFO("imx074_act", 0x11),
1017};
1018
1019static struct msm_actuator_info imx074_actuator_info = {
1020 .board_info = &imx074_actuator_i2c_info,
1021 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1022 .vcm_pwd = 0,
1023 .vcm_enable = 1,
1024};
1025#endif
1026
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001027#ifdef CONFIG_IMX074
1028static struct msm_camera_sensor_flash_data flash_imx074 = {
1029 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301030#ifdef CONFIG_MSM_CAMERA_FLASH
1031 .flash_src = &msm_flash_src
1032#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001033};
1034
Nishant Pandit24153d82011-08-27 16:05:13 +05301035static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1036 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001037 .sensor_reset = 107,
1038 .sensor_pwd = 85,
1039 .vcm_pwd = 0,
1040 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301041};
1042
1043static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1044 .sensor_name = "imx074",
1045 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001046 .flash_data = &flash_imx074,
1047 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301048 .sensor_platform_info = &sensor_board_info_imx074,
1049 .gpio_conf = &gpio_conf,
1050 .csi_if = 1,
1051 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001052#ifdef CONFIG_IMX074_ACT
1053 .actuator_info = &imx074_actuator_info
1054#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001055};
1056
1057struct platform_device msm8960_camera_sensor_imx074 = {
1058 .name = "msm_camera_imx074",
1059 .dev = {
1060 .platform_data = &msm_camera_sensor_imx074_data,
1061 },
1062};
1063#endif
1064#ifdef CONFIG_OV2720
1065static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001066 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001067};
1068
Nishant Pandit24153d82011-08-27 16:05:13 +05301069static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1070 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001071 .sensor_reset = 76,
1072 .sensor_pwd = 85,
1073 .vcm_pwd = 0,
1074 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301075};
1076
1077static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1078 .sensor_name = "ov2720",
1079 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001080 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301081 .sensor_platform_info = &sensor_board_info_ov2720,
1082 .gpio_conf = &gpio_conf,
1083 .csi_if = 1,
1084 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001085};
1086
1087struct platform_device msm8960_camera_sensor_ov2720 = {
1088 .name = "msm_camera_ov2720",
1089 .dev = {
1090 .platform_data = &msm_camera_sensor_ov2720_data,
1091 },
1092};
1093#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001094
1095static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1096 .flash_type = MSM_CAMERA_FLASH_LED,
1097};
1098
Nishant Pandit24153d82011-08-27 16:05:13 +05301099static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1100 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001101 .sensor_reset = 107,
1102 .sensor_pwd = 85,
1103 .vcm_pwd = 0,
1104 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301105};
1106
1107static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1108 .sensor_name = "qs_mt9p017",
1109 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001110 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301111 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1112 .gpio_conf = &gpio_conf,
1113 .csi_if = 1,
1114 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001115};
1116
1117struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1118 .name = "msm_camera_qs_mt9p017",
1119 .dev = {
1120 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1121 },
1122};
1123
Kevin Chan8b0d2322011-09-10 21:06:31 -07001124static struct msm8960_privacy_light_cfg privacy_light_info = {
1125 .mpp = PM8921_MPP_PM_TO_SYS(12),
1126};
1127
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001128static void __init msm8960_init_cam(void)
1129{
1130 int i;
1131 struct platform_device *cam_dev[] = {
1132 &msm8960_camera_sensor_imx074,
1133 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001134 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001135 };
1136
Kevin Chan8b0d2322011-09-10 21:06:31 -07001137 if (machine_is_msm8960_liquid()) {
1138 struct msm_camera_sensor_info *s_info;
1139 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1140 s_info->sensor_platform_info->mount_angle = 180;
1141 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1142 s_info->sensor_platform_info->privacy_light = 1;
1143 s_info->sensor_platform_info->privacy_light_info =
1144 &privacy_light_info;
1145 }
1146
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001147 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1148 struct msm_camera_sensor_info *s_info;
1149 s_info = cam_dev[i]->dev.platform_data;
1150 msm_get_cam_resources(s_info);
1151 platform_device_register(cam_dev[i]);
1152 }
1153}
1154#endif
1155
1156#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001157#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001158#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001159#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001160#endif
1161
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001162
1163#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001164#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001165#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001166#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1167#else
1168#define MSM_FB_EXT_BUF_SIZE 0
1169#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001170
kuogee hsieh3830eb92011-09-12 15:25:57 -07001171#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1172/* width x height x 3 bpp x 2 frame buffer */
1173#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1174#define MSM_FB_WRITEBACK_OFFSET \
1175 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1176#else
1177#define MSM_FB_WRITEBACK_SIZE 0
1178#define MSM_FB_WRITEBACK_OFFSET 0
1179#endif
1180
1181
1182/* Note: must be multiple of 4096 */
1183#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1184 MSM_FB_WRITEBACK_SIZE, 4096)
1185
1186static int writeback_offset(void)
1187{
1188 return MSM_FB_WRITEBACK_OFFSET;
1189}
1190
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001191
1192#define MDP_VSYNC_GPIO 0
1193
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001194#define TOSHIBA_PANEL_NAME "mipi_video_toshiba_wsvga"
1195#define TOSHIBA_PANEL_NAME_LEN 24
1196#define CHIMEI_PANEL_NAME "mipi_chimei_wxga"
1197#define CHIMEI_PANEL_NAME_LEN 16
1198
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001199static struct resource msm_fb_resources[] = {
1200 {
1201 .flags = IORESOURCE_DMA,
1202 }
1203};
1204
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001205#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1206static int msm_fb_detect_panel(const char *name)
1207{
1208 if (machine_is_msm8960_liquid()) {
1209 if (!strncmp(name, CHIMEI_PANEL_NAME, CHIMEI_PANEL_NAME_LEN))
1210 return 0;
1211 } else {
1212 if (!strncmp(name, TOSHIBA_PANEL_NAME, TOSHIBA_PANEL_NAME_LEN))
1213 return 0;
1214 }
1215
1216 pr_warning("%s: not supported '%s'", __func__, name);
1217
1218 return -ENODEV;
1219}
1220
1221static struct msm_fb_platform_data msm_fb_pdata = {
1222 .detect_client = msm_fb_detect_panel,
1223};
1224#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
1225
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001226static struct platform_device msm_fb_device = {
1227 .name = "msm_fb",
1228 .id = 0,
1229 .num_resources = ARRAY_SIZE(msm_fb_resources),
1230 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001231#ifdef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1232 .dev.platform_data = &msm_fb_pdata,
1233#endif /* CONFIG_FB_MSM_MIPI_PANEL_DETECT */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001234};
1235
1236static bool dsi_power_on;
1237
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001238/**
1239 * LiQUID panel on/off
1240 *
1241 * @param on
1242 *
1243 * @return int
1244 */
1245static int mipi_dsi_liquid_panel_power(int on)
1246{
1247 static struct regulator *reg_l2, *reg_ext_3p3v;
1248 static int gpio21, gpio24, gpio43;
1249 int rc;
1250
1251 pr_info("%s: on=%d\n", __func__, on);
1252
1253 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1254 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1255 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1256
1257 if (!dsi_power_on) {
1258
1259 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1260 "dsi_vdda");
1261 if (IS_ERR(reg_l2)) {
1262 pr_err("could not get 8921_l2, rc = %ld\n",
1263 PTR_ERR(reg_l2));
1264 return -ENODEV;
1265 }
1266
1267 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1268 if (rc) {
1269 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1270 return -EINVAL;
1271 }
1272
1273 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1274 "vdd_lvds_3p3v");
1275 if (IS_ERR(reg_ext_3p3v)) {
1276 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1277 PTR_ERR(reg_ext_3p3v));
1278 return -ENODEV;
1279 }
1280
1281 rc = gpio_request(gpio21, "disp_pwr_en_n");
1282 if (rc) {
1283 pr_err("request gpio 21 failed, rc=%d\n", rc);
1284 return -ENODEV;
1285 }
1286
1287 rc = gpio_request(gpio43, "disp_rst_n");
1288 if (rc) {
1289 pr_err("request gpio 43 failed, rc=%d\n", rc);
1290 return -ENODEV;
1291 }
1292
1293 rc = gpio_request(gpio24, "disp_backlight_pwm");
1294 if (rc) {
1295 pr_err("request gpio 24 failed, rc=%d\n", rc);
1296 return -ENODEV;
1297 }
1298
1299 dsi_power_on = true;
1300 }
1301
1302 if (on) {
1303 rc = regulator_set_optimum_mode(reg_l2, 100000);
1304 if (rc < 0) {
1305 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1306 return -EINVAL;
1307 }
1308 rc = regulator_enable(reg_l2);
1309 if (rc) {
1310 pr_err("enable l2 failed, rc=%d\n", rc);
1311 return -ENODEV;
1312 }
1313
1314 rc = regulator_enable(reg_ext_3p3v);
1315 if (rc) {
1316 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1317 return -ENODEV;
1318 }
1319
1320 /* set reset pin before power enable */
1321 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1322
1323 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1324 msleep(20);
1325 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1326 msleep(20);
1327 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1328 msleep(20);
1329 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1330 msleep(20);
1331 } else {
1332 gpio_set_value_cansleep(gpio43, 0);
1333 gpio_set_value_cansleep(gpio21, 1);
1334
1335 rc = regulator_disable(reg_l2);
1336 if (rc) {
1337 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1338 return -ENODEV;
1339 }
1340 rc = regulator_disable(reg_ext_3p3v);
1341 if (rc) {
1342 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1343 return -ENODEV;
1344 }
1345 rc = regulator_set_optimum_mode(reg_l2, 100);
1346 if (rc < 0) {
1347 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1348 return -EINVAL;
1349 }
1350 }
1351
1352 return 0;
1353}
1354
1355static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001356{
1357 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001358 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001359 int rc;
1360
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361 pr_info("%s: state : %d\n", __func__, on);
1362
1363 if (!dsi_power_on) {
1364
1365 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1366 "dsi_vdc");
1367 if (IS_ERR(reg_l8)) {
1368 pr_err("could not get 8921_l8, rc = %ld\n",
1369 PTR_ERR(reg_l8));
1370 return -ENODEV;
1371 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001372 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1373 "dsi_vddio");
1374 if (IS_ERR(reg_l23)) {
1375 pr_err("could not get 8921_l23, rc = %ld\n",
1376 PTR_ERR(reg_l23));
1377 return -ENODEV;
1378 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001379 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1380 "dsi_vdda");
1381 if (IS_ERR(reg_l2)) {
1382 pr_err("could not get 8921_l2, rc = %ld\n",
1383 PTR_ERR(reg_l2));
1384 return -ENODEV;
1385 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001386 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1387 if (rc) {
1388 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1389 return -EINVAL;
1390 }
1391 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1392 if (rc) {
1393 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1394 return -EINVAL;
1395 }
1396 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1397 if (rc) {
1398 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1399 return -EINVAL;
1400 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001401 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1402 rc = gpio_request(gpio43, "disp_rst_n");
1403 if (rc) {
1404 pr_err("request gpio 43 failed, rc=%d\n", rc);
1405 return -ENODEV;
1406 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001407 dsi_power_on = true;
1408 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001409 if (on) {
1410 rc = regulator_set_optimum_mode(reg_l8, 100000);
1411 if (rc < 0) {
1412 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1413 return -EINVAL;
1414 }
1415 rc = regulator_set_optimum_mode(reg_l23, 100000);
1416 if (rc < 0) {
1417 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1418 return -EINVAL;
1419 }
1420 rc = regulator_set_optimum_mode(reg_l2, 100000);
1421 if (rc < 0) {
1422 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1423 return -EINVAL;
1424 }
1425 rc = regulator_enable(reg_l8);
1426 if (rc) {
1427 pr_err("enable l8 failed, rc=%d\n", rc);
1428 return -ENODEV;
1429 }
1430 rc = regulator_enable(reg_l23);
1431 if (rc) {
1432 pr_err("enable l8 failed, rc=%d\n", rc);
1433 return -ENODEV;
1434 }
1435 rc = regulator_enable(reg_l2);
1436 if (rc) {
1437 pr_err("enable l2 failed, rc=%d\n", rc);
1438 return -ENODEV;
1439 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001440 gpio_set_value_cansleep(gpio43, 1);
1441 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001442 rc = regulator_disable(reg_l2);
1443 if (rc) {
1444 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1445 return -ENODEV;
1446 }
1447 rc = regulator_disable(reg_l8);
1448 if (rc) {
1449 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1450 return -ENODEV;
1451 }
1452 rc = regulator_disable(reg_l23);
1453 if (rc) {
1454 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1455 return -ENODEV;
1456 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001457 rc = regulator_set_optimum_mode(reg_l8, 100);
1458 if (rc < 0) {
1459 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1460 return -EINVAL;
1461 }
1462 rc = regulator_set_optimum_mode(reg_l23, 100);
1463 if (rc < 0) {
1464 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1465 return -EINVAL;
1466 }
1467 rc = regulator_set_optimum_mode(reg_l2, 100);
1468 if (rc < 0) {
1469 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1470 return -EINVAL;
1471 }
1472 gpio_set_value_cansleep(gpio43, 0);
1473 }
1474 return 0;
1475}
1476
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001477static int mipi_dsi_panel_power(int on)
1478{
1479 int ret;
1480
1481 pr_info("%s: on=%d\n", __func__, on);
1482
1483 if (machine_is_msm8960_liquid())
1484 ret = mipi_dsi_liquid_panel_power(on);
1485 else
1486 ret = mipi_dsi_cdp_panel_power(on);
1487
1488 return ret;
1489}
1490
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001491static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1492 .vsync_gpio = MDP_VSYNC_GPIO,
1493 .dsi_power_save = mipi_dsi_panel_power,
1494};
1495
1496#ifdef CONFIG_MSM_BUS_SCALING
1497
1498static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001499 {
1500 .src = MSM_BUS_MASTER_MDP_PORT0,
1501 .dst = MSM_BUS_SLAVE_EBI_CH0,
1502 .ab = 0,
1503 .ib = 0,
1504 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001505};
1506
1507static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001508 {
1509 .src = MSM_BUS_MASTER_MDP_PORT0,
1510 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001511 .ab = 216000000 * 2,
1512 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001513 },
1514};
1515
1516static struct msm_bus_vectors mdp_vga_vectors[] = {
1517 /* VGA and less video */
1518 {
1519 .src = MSM_BUS_MASTER_MDP_PORT0,
1520 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001521 .ab = 216000000 * 2,
1522 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001523 },
1524};
1525
1526static struct msm_bus_vectors mdp_720p_vectors[] = {
1527 /* 720p and less video */
1528 {
1529 .src = MSM_BUS_MASTER_MDP_PORT0,
1530 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001531 .ab = 230400000 * 2,
1532 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001533 },
1534};
1535
1536static struct msm_bus_vectors mdp_1080p_vectors[] = {
1537 /* 1080p and less video */
1538 {
1539 .src = MSM_BUS_MASTER_MDP_PORT0,
1540 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001541 .ab = 334080000 * 2,
1542 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001543 },
1544};
1545
1546static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1547 {
1548 ARRAY_SIZE(mdp_init_vectors),
1549 mdp_init_vectors,
1550 },
1551 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001552 ARRAY_SIZE(mdp_ui_vectors),
1553 mdp_ui_vectors,
1554 },
1555 {
1556 ARRAY_SIZE(mdp_ui_vectors),
1557 mdp_ui_vectors,
1558 },
1559 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001560 ARRAY_SIZE(mdp_vga_vectors),
1561 mdp_vga_vectors,
1562 },
1563 {
1564 ARRAY_SIZE(mdp_720p_vectors),
1565 mdp_720p_vectors,
1566 },
1567 {
1568 ARRAY_SIZE(mdp_1080p_vectors),
1569 mdp_1080p_vectors,
1570 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001571};
1572
1573static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1574 mdp_bus_scale_usecases,
1575 ARRAY_SIZE(mdp_bus_scale_usecases),
1576 .name = "mdp",
1577};
1578
1579#endif
1580
1581int mdp_core_clk_rate_table[] = {
1582 85330000,
1583 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001584 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001585 200000000,
1586};
1587
1588static struct msm_panel_common_pdata mdp_pdata = {
1589 .gpio = MDP_VSYNC_GPIO,
1590 .mdp_core_clk_rate = 85330000,
1591 .mdp_core_clk_table = mdp_core_clk_rate_table,
1592 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1593#ifdef CONFIG_MSM_BUS_SCALING
1594 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1595#endif
1596 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001597 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001598};
1599
1600static struct platform_device mipi_dsi_renesas_panel_device = {
1601 .name = "mipi_renesas",
1602 .id = 0,
1603};
1604
1605static struct platform_device mipi_dsi_simulator_panel_device = {
1606 .name = "mipi_simulator",
1607 .id = 0,
1608};
1609
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001610#define LPM_CHANNEL0 0
1611static int toshiba_gpio[] = {LPM_CHANNEL0};
1612
1613static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1614 .gpio = toshiba_gpio,
1615};
1616
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001617static struct platform_device mipi_dsi_toshiba_panel_device = {
1618 .name = "mipi_toshiba",
1619 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001620 .dev = {
1621 .platform_data = &toshiba_pdata,
1622 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001623};
1624
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001625static int dsi2lvds_gpio[2] = {
1626 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1627 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1628 };
1629
1630static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1631 .gpio_num = dsi2lvds_gpio,
1632};
1633
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001634static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1635
1636/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1637 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1638 /* timing */
1639 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
1640 0x0c, 0x03, 0x04, 0xa0},
1641 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
1642 {0xff, 0x00, 0x06, 0x00}, /* strength */
1643 /* pll control */
1644 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
1645 0x40, 0x07, 0x03,
1646 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
1647};
1648
1649static struct mipi_dsi_panel_platform_data novatek_pdata = {
1650 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
1651};
1652
1653static struct platform_device mipi_dsi_novatek_panel_device = {
1654 .name = "mipi_novatek",
1655 .id = 0,
1656 .dev = {
1657 .platform_data = &novatek_pdata,
1658 }
1659};
1660
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001661static struct platform_device mipi_dsi2lvds_bridge_device = {
1662 .name = "mipi_tc358764",
1663 .id = 0,
1664 .dev.platform_data = &mipi_dsi2lvds_pdata,
1665};
1666
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001667#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1668static struct resource hdmi_msm_resources[] = {
1669 {
1670 .name = "hdmi_msm_qfprom_addr",
1671 .start = 0x00700000,
1672 .end = 0x007060FF,
1673 .flags = IORESOURCE_MEM,
1674 },
1675 {
1676 .name = "hdmi_msm_hdmi_addr",
1677 .start = 0x04A00000,
1678 .end = 0x04A00FFF,
1679 .flags = IORESOURCE_MEM,
1680 },
1681 {
1682 .name = "hdmi_msm_irq",
1683 .start = HDMI_IRQ,
1684 .end = HDMI_IRQ,
1685 .flags = IORESOURCE_IRQ,
1686 },
1687};
1688
1689static int hdmi_enable_5v(int on);
1690static int hdmi_core_power(int on, int show);
1691static int hdmi_cec_power(int on);
1692
1693static struct msm_hdmi_platform_data hdmi_msm_data = {
1694 .irq = HDMI_IRQ,
1695 .enable_5v = hdmi_enable_5v,
1696 .core_power = hdmi_core_power,
1697 .cec_power = hdmi_cec_power,
1698};
1699
1700static struct platform_device hdmi_msm_device = {
1701 .name = "hdmi_msm",
1702 .id = 0,
1703 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1704 .resource = hdmi_msm_resources,
1705 .dev.platform_data = &hdmi_msm_data,
1706};
1707#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1708
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001709#ifdef CONFIG_MSM_BUS_SCALING
1710static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1711 {
1712 .src = MSM_BUS_MASTER_MDP_PORT0,
1713 .dst = MSM_BUS_SLAVE_EBI_CH0,
1714 .ab = 0,
1715 .ib = 0,
1716 },
1717};
1718static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1719 {
1720 .src = MSM_BUS_MASTER_MDP_PORT0,
1721 .dst = MSM_BUS_SLAVE_EBI_CH0,
1722 .ab = 566092800 * 2,
1723 .ib = 707616000 * 2,
1724 },
1725};
1726static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1727 {
1728 ARRAY_SIZE(dtv_bus_init_vectors),
1729 dtv_bus_init_vectors,
1730 },
1731 {
1732 ARRAY_SIZE(dtv_bus_def_vectors),
1733 dtv_bus_def_vectors,
1734 },
1735};
1736static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1737 dtv_bus_scale_usecases,
1738 ARRAY_SIZE(dtv_bus_scale_usecases),
1739 .name = "dtv",
1740};
1741
1742static struct lcdc_platform_data dtv_pdata = {
1743 .bus_scale_table = &dtv_bus_scale_pdata,
1744};
1745#endif
1746
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001747static void __init msm_fb_add_devices(void)
1748{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001749 struct platform_device *ptr = NULL;
1750
1751 if (machine_is_msm8960_liquid())
1752 ptr = &mipi_dsi2lvds_bridge_device;
1753 else
1754 ptr = &mipi_dsi_toshiba_panel_device;
1755 platform_add_devices(&ptr, 1);
1756
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001757 if (machine_is_msm8x60_rumi3()) {
1758 msm_fb_register_device("mdp", NULL);
1759 mipi_dsi_pdata.target_type = 1;
1760 } else
1761 msm_fb_register_device("mdp", &mdp_pdata);
1762 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001763#ifdef CONFIG_MSM_BUS_SCALING
1764 msm_fb_register_device("dtv", &dtv_pdata);
1765#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001766}
1767
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001768static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1769 .func = GPIOMUX_FUNC_GPIO,
1770 .drv = GPIOMUX_DRV_2MA,
1771 .pull = GPIOMUX_PULL_DOWN,
1772};
1773
1774static struct gpiomux_setting mdp_vsync_active_cfg = {
1775 .func = GPIOMUX_FUNC_1,
1776 .drv = GPIOMUX_DRV_2MA,
1777 .pull = GPIOMUX_PULL_DOWN,
1778};
1779
1780static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1781 {
1782 .gpio = MDP_VSYNC_GPIO,
1783 .settings = {
1784 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1785 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1786 },
1787 }
1788};
1789
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001790#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1791static struct gpiomux_setting hdmi_suspend_cfg = {
1792 .func = GPIOMUX_FUNC_GPIO,
1793 .drv = GPIOMUX_DRV_2MA,
1794 .pull = GPIOMUX_PULL_DOWN,
1795};
1796
1797static struct gpiomux_setting hdmi_active_1_cfg = {
1798 .func = GPIOMUX_FUNC_1,
1799 .drv = GPIOMUX_DRV_2MA,
1800 .pull = GPIOMUX_PULL_UP,
1801};
1802
1803static struct gpiomux_setting hdmi_active_2_cfg = {
1804 .func = GPIOMUX_FUNC_1,
1805 .drv = GPIOMUX_DRV_2MA,
1806 .pull = GPIOMUX_PULL_DOWN,
1807};
1808
1809static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1810 {
1811 .gpio = 99,
1812 .settings = {
1813 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1814 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1815 },
1816 },
1817 {
1818 .gpio = 100,
1819 .settings = {
1820 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1821 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1822 },
1823 },
1824 {
1825 .gpio = 101,
1826 .settings = {
1827 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1828 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1829 },
1830 },
1831 {
1832 .gpio = 102,
1833 .settings = {
1834 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1835 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1836 },
1837 },
1838};
1839
1840static int hdmi_enable_5v(int on)
1841{
1842 /* TBD: PM8921 regulator instead of 8901 */
1843 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1844 static int prev_on;
1845 int rc;
1846
1847 if (on == prev_on)
1848 return 0;
1849
1850 if (!reg_8921_hdmi_mvs)
1851 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1852 "hdmi_mvs");
1853
1854 if (on) {
1855 rc = regulator_enable(reg_8921_hdmi_mvs);
1856 if (rc) {
1857 pr_err("'%s' regulator enable failed, rc=%d\n",
1858 "8921_hdmi_mvs", rc);
1859 return rc;
1860 }
1861 pr_debug("%s(on): success\n", __func__);
1862 } else {
1863 rc = regulator_disable(reg_8921_hdmi_mvs);
1864 if (rc)
1865 pr_warning("'%s' regulator disable failed, rc=%d\n",
1866 "8921_hdmi_mvs", rc);
1867 pr_debug("%s(off): success\n", __func__);
1868 }
1869
1870 prev_on = on;
1871
1872 return 0;
1873}
1874
1875static int hdmi_core_power(int on, int show)
1876{
1877 static struct regulator *reg_8921_l23, *reg_8921_s4;
1878 static int prev_on;
1879 int rc;
1880
1881 if (on == prev_on)
1882 return 0;
1883
1884 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001885 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001886 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001887 if (IS_ERR(reg_8921_l23)) {
1888 pr_err("could not get reg_8921_l23, rc = %ld\n",
1889 PTR_ERR(reg_8921_l23));
1890 return -ENODEV;
1891 }
1892 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1893 if (rc) {
1894 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
1895 return -EINVAL;
1896 }
1897 }
1898 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001899 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001900 if (IS_ERR(reg_8921_s4)) {
1901 pr_err("could not get reg_8921_s4, rc = %ld\n",
1902 PTR_ERR(reg_8921_s4));
1903 return -ENODEV;
1904 }
1905 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1906 if (rc) {
1907 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
1908 return -EINVAL;
1909 }
1910 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001911
1912 if (on) {
1913 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1914 if (rc < 0) {
1915 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1916 return -EINVAL;
1917 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001918 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001919 if (rc) {
1920 pr_err("'%s' regulator enable failed, rc=%d\n",
1921 "hdmi_avdd", rc);
1922 return rc;
1923 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001924 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001925 if (rc) {
1926 pr_err("'%s' regulator enable failed, rc=%d\n",
1927 "hdmi_vcc", rc);
1928 return rc;
1929 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001930 rc = gpio_request(100, "HDMI_DDC_CLK");
1931 if (rc) {
1932 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1933 "HDMI_DDC_CLK", 100, rc);
1934 goto error1;
1935 }
1936 rc = gpio_request(101, "HDMI_DDC_DATA");
1937 if (rc) {
1938 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1939 "HDMI_DDC_DATA", 101, rc);
1940 goto error2;
1941 }
1942 rc = gpio_request(102, "HDMI_HPD");
1943 if (rc) {
1944 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1945 "HDMI_HPD", 102, rc);
1946 goto error3;
1947 }
1948 pr_debug("%s(on): success\n", __func__);
1949 } else {
1950 gpio_free(100);
1951 gpio_free(101);
1952 gpio_free(102);
1953
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001954 rc = regulator_disable(reg_8921_l23);
1955 if (rc) {
1956 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
1957 return -ENODEV;
1958 }
1959 rc = regulator_disable(reg_8921_s4);
1960 if (rc) {
1961 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
1962 return -ENODEV;
1963 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001964 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1965 if (rc < 0) {
1966 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1967 return -EINVAL;
1968 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001969 pr_debug("%s(off): success\n", __func__);
1970 }
1971
1972 prev_on = on;
1973
1974 return 0;
1975
1976error3:
1977 gpio_free(101);
1978error2:
1979 gpio_free(100);
1980error1:
1981 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001982 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001983 return rc;
1984}
1985
1986static int hdmi_cec_power(int on)
1987{
1988 static int prev_on;
1989 int rc;
1990
1991 if (on == prev_on)
1992 return 0;
1993
1994 if (on) {
1995 rc = gpio_request(99, "HDMI_CEC_VAR");
1996 if (rc) {
1997 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1998 "HDMI_CEC_VAR", 99, rc);
1999 goto error;
2000 }
2001 pr_debug("%s(on): success\n", __func__);
2002 } else {
2003 gpio_free(99);
2004 pr_debug("%s(off): success\n", __func__);
2005 }
2006
2007 prev_on = on;
2008
2009 return 0;
2010error:
2011 return rc;
2012}
2013#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2014
2015static void __init msm8960_allocate_memory_regions(void)
2016{
2017 void *addr;
2018 unsigned long size;
2019
2020 size = MSM_FB_SIZE;
2021 addr = alloc_bootmem_align(size, 0x1000);
2022 msm_fb_resources[0].start = __pa(addr);
2023 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2024 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2025 size, addr, __pa(addr));
2026
2027}
2028#ifdef CONFIG_WCD9310_CODEC
2029
2030#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2031
Patrick Lai3043fba2011-08-01 14:15:57 -07002032/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2033 * 4 micbiases are used to power various analog and digital
2034 * microphones operating at 1800 mV. Technically, all micbiases
2035 * can source from single cfilter since all microphones operate
2036 * at the same voltage level. The arrangement below is to make
2037 * sure all cfilters are exercised. LDO_H regulator ouput level
2038 * does not need to be as high as 2.85V. It is choosen for
2039 * microphone sensitivity purpose.
2040 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002041static struct tabla_pdata tabla_platform_data = {
2042 .slimbus_slave_device = {
2043 .name = "tabla-slave",
2044 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2045 },
2046 .irq = MSM_GPIO_TO_INT(62),
2047 .irq_base = TABLA_INTERRUPT_BASE,
2048 .num_irqs = NR_TABLA_IRQS,
2049 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002050 .micbias = {
2051 .ldoh_v = TABLA_LDOH_2P85_V,
2052 .cfilt1_mv = 1800,
2053 .cfilt2_mv = 1800,
2054 .cfilt3_mv = 1800,
2055 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2056 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2057 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2058 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2059 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002060};
2061
2062static struct slim_device msm_slim_tabla = {
2063 .name = "tabla-slim",
2064 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2065 .dev = {
2066 .platform_data = &tabla_platform_data,
2067 },
2068};
2069#endif
2070
2071static struct slim_boardinfo msm_slim_devices[] = {
2072#ifdef CONFIG_WCD9310_CODEC
2073 {
2074 .bus_num = 1,
2075 .slim_slave = &msm_slim_tabla,
2076 },
2077#endif
2078 /* add more slimbus slaves as needed */
2079};
2080
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002081#define MSM_WCNSS_PHYS 0x03000000
2082#define MSM_WCNSS_SIZE 0x280000
2083
2084static struct resource resources_wcnss_wlan[] = {
2085 {
2086 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2087 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2088 .name = "wcnss_wlanrx_irq",
2089 .flags = IORESOURCE_IRQ,
2090 },
2091 {
2092 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2093 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2094 .name = "wcnss_wlantx_irq",
2095 .flags = IORESOURCE_IRQ,
2096 },
2097 {
2098 .start = MSM_WCNSS_PHYS,
2099 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2100 .name = "wcnss_mmio",
2101 .flags = IORESOURCE_MEM,
2102 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002103 {
2104 .start = 84,
2105 .end = 88,
2106 .name = "wcnss_gpios_5wire",
2107 .flags = IORESOURCE_IO,
2108 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002109};
2110
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002111static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2112 .has_48mhz_xo = 1,
2113};
2114
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002115static struct platform_device msm_device_wcnss_wlan = {
2116 .name = "wcnss_wlan",
2117 .id = 0,
2118 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2119 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002120 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002121};
2122
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002123#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2124 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2125 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2126 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2127
2128#define QCE_SIZE 0x10000
2129#define QCE_0_BASE 0x18500000
2130
2131#define QCE_HW_KEY_SUPPORT 0
2132#define QCE_SHA_HMAC_SUPPORT 1
2133#define QCE_SHARE_CE_RESOURCE 1
2134#define QCE_CE_SHARED 0
2135
2136static struct resource qcrypto_resources[] = {
2137 [0] = {
2138 .start = QCE_0_BASE,
2139 .end = QCE_0_BASE + QCE_SIZE - 1,
2140 .flags = IORESOURCE_MEM,
2141 },
2142 [1] = {
2143 .name = "crypto_channels",
2144 .start = DMOV_CE_IN_CHAN,
2145 .end = DMOV_CE_OUT_CHAN,
2146 .flags = IORESOURCE_DMA,
2147 },
2148 [2] = {
2149 .name = "crypto_crci_in",
2150 .start = DMOV_CE_IN_CRCI,
2151 .end = DMOV_CE_IN_CRCI,
2152 .flags = IORESOURCE_DMA,
2153 },
2154 [3] = {
2155 .name = "crypto_crci_out",
2156 .start = DMOV_CE_OUT_CRCI,
2157 .end = DMOV_CE_OUT_CRCI,
2158 .flags = IORESOURCE_DMA,
2159 },
2160};
2161
2162static struct resource qcedev_resources[] = {
2163 [0] = {
2164 .start = QCE_0_BASE,
2165 .end = QCE_0_BASE + QCE_SIZE - 1,
2166 .flags = IORESOURCE_MEM,
2167 },
2168 [1] = {
2169 .name = "crypto_channels",
2170 .start = DMOV_CE_IN_CHAN,
2171 .end = DMOV_CE_OUT_CHAN,
2172 .flags = IORESOURCE_DMA,
2173 },
2174 [2] = {
2175 .name = "crypto_crci_in",
2176 .start = DMOV_CE_IN_CRCI,
2177 .end = DMOV_CE_IN_CRCI,
2178 .flags = IORESOURCE_DMA,
2179 },
2180 [3] = {
2181 .name = "crypto_crci_out",
2182 .start = DMOV_CE_OUT_CRCI,
2183 .end = DMOV_CE_OUT_CRCI,
2184 .flags = IORESOURCE_DMA,
2185 },
2186};
2187
2188#endif
2189
2190#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2191 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2192
2193static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2194 .ce_shared = QCE_CE_SHARED,
2195 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2196 .hw_key_support = QCE_HW_KEY_SUPPORT,
2197 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2198};
2199
2200static struct platform_device qcrypto_device = {
2201 .name = "qcrypto",
2202 .id = 0,
2203 .num_resources = ARRAY_SIZE(qcrypto_resources),
2204 .resource = qcrypto_resources,
2205 .dev = {
2206 .coherent_dma_mask = DMA_BIT_MASK(32),
2207 .platform_data = &qcrypto_ce_hw_suppport,
2208 },
2209};
2210#endif
2211
2212#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2213 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2214
2215static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2216 .ce_shared = QCE_CE_SHARED,
2217 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2218 .hw_key_support = QCE_HW_KEY_SUPPORT,
2219 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2220};
2221
2222static struct platform_device qcedev_device = {
2223 .name = "qce",
2224 .id = 0,
2225 .num_resources = ARRAY_SIZE(qcedev_resources),
2226 .resource = qcedev_resources,
2227 .dev = {
2228 .coherent_dma_mask = DMA_BIT_MASK(32),
2229 .platform_data = &qcedev_ce_hw_suppport,
2230 },
2231};
2232#endif
2233
2234
2235static int __init gpiomux_init(void)
2236{
2237 int rc;
2238
2239 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2240 if (rc) {
2241 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2242 return rc;
2243 }
2244
Nishant Pandit24153d82011-08-27 16:05:13 +05302245 msm_gpiomux_install(msm8960_cam_common_configs,
2246 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002247
2248 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002249 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002250
2251 msm_gpiomux_install(msm8960_gsbi_configs,
2252 ARRAY_SIZE(msm8960_gsbi_configs));
2253
2254 msm_gpiomux_install(msm8960_cyts_configs,
2255 ARRAY_SIZE(msm8960_cyts_configs));
2256
2257 msm_gpiomux_install(msm8960_slimbus_config,
2258 ARRAY_SIZE(msm8960_slimbus_config));
2259
2260 msm_gpiomux_install(msm8960_audio_codec_configs,
2261 ARRAY_SIZE(msm8960_audio_codec_configs));
2262
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002263 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2264 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2265
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002266#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2267 msm_gpiomux_install(msm8960_hdmi_configs,
2268 ARRAY_SIZE(msm8960_hdmi_configs));
2269#endif
2270
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002271 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2272 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2273
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002274 msm_gpiomux_install(wcnss_5wire_interface,
2275 ARRAY_SIZE(wcnss_5wire_interface));
2276
2277 return 0;
2278}
2279
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002280#define MSM_SHARED_RAM_PHYS 0x80000000
2281
2282static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2283 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2284 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2285 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2286 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2287 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2288 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2289 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2290 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2291 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2292 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2293 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2294 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002295 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2296 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2297 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2298 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2299 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2300 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2301 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2302 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2303 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2304 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2305 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2306 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2307 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2308 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002309 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002310 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2311 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2312 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002313 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2314 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002315};
2316
2317static struct pm8921_adc_properties pm8921_adc_data = {
2318 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2319 .bitresolution = 15,
2320 .bipolar = 0,
2321};
2322
2323static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2324 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002325 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002326 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002327 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002328};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002329
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002330static void __init msm8960_map_io(void)
2331{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002332 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002333 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002334
2335 if (socinfo_init() < 0)
2336 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002337}
2338
2339static void __init msm8960_init_irq(void)
2340{
2341 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002342
2343 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002344 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002345 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002346
2347 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002348 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002349
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002350 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2351 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002352
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002353 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2354 * as they are configured as level, which does not play nice with
2355 * handle_percpu_irq.
2356 */
2357 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2358 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002359 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002360 }
2361}
2362
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002363/* MSM8960 have 5 SDCC controllers */
2364enum sdcc_controllers {
2365 SDCC1,
2366 SDCC2,
2367 SDCC3,
2368 SDCC4,
2369 SDCC5,
2370 MAX_SDCC_CONTROLLER
2371};
2372
2373/* All SDCC controllers requires VDD/VCC voltage */
2374static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2375 /* SDCC1 : eMMC card connected */
2376 [SDCC1] = {
2377 .name = "sdc_vdd",
2378 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302379 .high_vol_level = 2950000,
2380 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302381 .always_on = 1,
2382 .lpm_sup = 1,
2383 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002384 .hpm_uA = 200000, /* 200mA */
2385 },
2386 /* SDCC3 : External card slot connected */
2387 [SDCC3] = {
2388 .name = "sdc_vdd",
2389 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302390 .high_vol_level = 2950000,
2391 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002392 .hpm_uA = 600000, /* 600mA */
2393 }
2394};
2395
2396/* Only slots having eMMC card will require VCCQ voltage */
2397static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2398 /* SDCC1 : eMMC card connected */
2399 [SDCC1] = {
2400 .name = "sdc_vccq",
2401 .set_voltage_sup = 1,
2402 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302403 .high_vol_level = 1800000,
2404 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002405 .hpm_uA = 200000, /* 200mA */
2406 }
2407};
2408
2409/* All SDCC controllers may require voting for VDD PAD voltage */
2410static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2411 /* SDCC3 : External card slot connected */
2412 [SDCC3] = {
2413 .name = "sdc_vddp",
2414 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302415 .high_vol_level = 2950000,
2416 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002417 .always_on = 1,
2418 .lpm_sup = 1,
2419 /* Max. Active current required is 16 mA */
2420 .hpm_uA = 16000,
2421 /*
2422 * Sleep current required is ~300 uA. But min. vote can be
2423 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2424 * during sleep.
2425 */
2426 .lpm_uA = 2000,
2427 }
2428};
2429
2430static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2431 /* SDCC1 : eMMC card connected */
2432 [SDCC1] = {
2433 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2434 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2435 },
2436 /* SDCC3 : External card slot connected */
2437 [SDCC3] = {
2438 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2439 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2440 }
2441};
2442
2443/* SDC1 pad data */
2444static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2445 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302446 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2447 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002448};
2449
2450static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2451 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2452 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2453 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2454};
2455
2456static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302457 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002458 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2459 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2460};
2461
2462static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302463 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002464 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2465 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2466};
2467
2468/* SDC3 pad data */
2469static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2470 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2471 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2472 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2473};
2474
2475static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2476 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2477 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2478 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2479};
2480
2481static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302482 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002483 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2484 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2485};
2486
2487static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302488 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002489 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2490 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2491};
2492
2493struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2494 [SDCC1] = {
2495 .on = sdc1_pad_pull_on_cfg,
2496 .off = sdc1_pad_pull_off_cfg,
2497 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2498 },
2499 [SDCC3] = {
2500 .on = sdc3_pad_pull_on_cfg,
2501 .off = sdc3_pad_pull_off_cfg,
2502 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2503 },
2504};
2505
2506struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2507 [SDCC1] = {
2508 .on = sdc1_pad_drv_on_cfg,
2509 .off = sdc1_pad_drv_off_cfg,
2510 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2511 },
2512 [SDCC3] = {
2513 .on = sdc3_pad_drv_on_cfg,
2514 .off = sdc3_pad_drv_off_cfg,
2515 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2516 },
2517};
2518
2519struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2520 [SDCC1] = {
2521 .pull = &mmc_pad_pull_data[SDCC1],
2522 .drv = &mmc_pad_drv_data[SDCC1]
2523 },
2524 [SDCC3] = {
2525 .pull = &mmc_pad_pull_data[SDCC3],
2526 .drv = &mmc_pad_drv_data[SDCC3]
2527 },
2528};
2529
2530struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2531 [SDCC1] = {
2532 .pad_data = &mmc_pad_data[SDCC1],
2533 },
2534 [SDCC3] = {
2535 .pad_data = &mmc_pad_data[SDCC3],
2536 },
2537};
2538
2539static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302540 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002541};
2542
2543static unsigned int sdc3_sup_clk_rates[] = {
2544 400000, 24000000, 48000000, 96000000
2545};
2546
2547#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2548static struct mmc_platform_data msm8960_sdc1_data = {
2549 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2550#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2551 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2552#else
2553 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2554#endif
2555 .sup_clk_table = sdc1_sup_clk_rates,
2556 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302557 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002558 .nonremovable = 1,
2559 .sdcc_v4_sup = true,
2560 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302561 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002562};
2563#endif
2564
2565#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2566static struct mmc_platform_data msm8960_sdc3_data = {
2567 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2568 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2569 .sup_clk_table = sdc3_sup_clk_rates,
2570 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302571 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302572#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002573 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05302574#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002575 .sdcc_v4_sup = true,
2576 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2577 .pin_data = &mmc_slot_pin_data[SDCC3],
2578#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2579 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2580 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2581 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2582#endif
2583 .xpc_cap = 1,
2584 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2585 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302586 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002587};
2588#endif
2589
2590static void __init msm8960_init_mmc(void)
2591{
2592#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2593 /* SDC1 : eMMC card connected */
2594 msm_add_sdcc(1, &msm8960_sdc1_data);
2595#endif
2596#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2597 /* SDC3: External card slot */
2598 msm_add_sdcc(3, &msm8960_sdc3_data);
2599#endif
2600}
2601
2602static void __init msm8960_init_buses(void)
2603{
2604#ifdef CONFIG_MSM_BUS_SCALING
2605 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2606 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2607 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2608 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2609 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2610 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2611 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2612 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2613 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2614 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
Gagan Macdc1dc142011-09-16 15:13:35 -06002615 msm_bus_rpm_set_mt_mask();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002616#endif
2617}
2618
2619static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2620 .max_clock_speed = 15060000,
2621};
2622
2623#ifdef CONFIG_USB_MSM_OTG_72K
2624static struct msm_otg_platform_data msm_otg_pdata;
2625#else
2626#define USB_5V_EN 42
2627static void msm_hsusb_vbus_power(bool on)
2628{
2629 int rc;
2630 static bool vbus_is_on;
2631 static struct regulator *mvs_otg_switch;
2632 struct pm_gpio param = {
2633 .direction = PM_GPIO_DIR_OUT,
2634 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2635 .output_value = 1,
2636 .pull = PM_GPIO_PULL_NO,
2637 .vin_sel = PM_GPIO_VIN_S4,
2638 .out_strength = PM_GPIO_STRENGTH_MED,
2639 .function = PM_GPIO_FUNC_NORMAL,
2640 };
2641
2642 if (vbus_is_on == on)
2643 return;
2644
2645 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002646 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2647 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002648 if (IS_ERR(mvs_otg_switch)) {
2649 pr_err("Unable to get mvs_otg_switch\n");
2650 return;
2651 }
2652
2653 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2654 "usb_5v_en");
2655 if (rc < 0) {
2656 pr_err("failed to request usb_5v_en gpio\n");
2657 goto put_mvs_otg;
2658 }
2659
2660 if (regulator_enable(mvs_otg_switch)) {
2661 pr_err("unable to enable mvs_otg_switch\n");
2662 goto free_usb_5v_en;
2663 }
2664
2665 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2666 &param);
2667 if (rc < 0) {
2668 pr_err("failed to configure usb_5v_en gpio\n");
2669 goto disable_mvs_otg;
2670 }
2671 vbus_is_on = true;
2672 return;
2673 }
2674disable_mvs_otg:
2675 regulator_disable(mvs_otg_switch);
2676free_usb_5v_en:
2677 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2678put_mvs_otg:
2679 regulator_put(mvs_otg_switch);
2680 vbus_is_on = false;
2681}
2682
2683static struct msm_otg_platform_data msm_otg_pdata = {
2684 .mode = USB_OTG,
2685 .otg_control = OTG_PMIC_CONTROL,
2686 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2687 .pclk_src_name = "dfab_usb_hs_clk",
2688 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2689 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05302690 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691};
2692#endif
2693
2694#define PID_MAGIC_ID 0x71432909
2695#define SERIAL_NUM_MAGIC_ID 0x61945374
2696#define SERIAL_NUMBER_LENGTH 127
2697#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2698
2699struct magic_num_struct {
2700 uint32_t pid;
2701 uint32_t serial_num;
2702};
2703
2704struct dload_struct {
2705 uint32_t reserved1;
2706 uint32_t reserved2;
2707 uint32_t reserved3;
2708 uint16_t reserved4;
2709 uint16_t pid;
2710 char serial_number[SERIAL_NUMBER_LENGTH];
2711 uint16_t reserved5;
2712 struct magic_num_struct magic_struct;
2713};
2714
2715static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2716{
2717 struct dload_struct __iomem *dload = 0;
2718
2719 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2720 if (!dload) {
2721 pr_err("%s: cannot remap I/O memory region: %08x\n",
2722 __func__, DLOAD_USB_BASE_ADD);
2723 return -ENXIO;
2724 }
2725
2726 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2727 __func__, dload, pid, snum);
2728 /* update pid */
2729 dload->magic_struct.pid = PID_MAGIC_ID;
2730 dload->pid = pid;
2731
2732 /* update serial number */
2733 dload->magic_struct.serial_num = 0;
2734 if (!snum) {
2735 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2736 goto out;
2737 }
2738
2739 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2740 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2741 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2742out:
2743 iounmap(dload);
2744 return 0;
2745}
2746
2747static struct android_usb_platform_data android_usb_pdata = {
2748 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2749};
2750
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002751static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002752 .name = "android_usb",
2753 .id = -1,
2754 .dev = {
2755 .platform_data = &android_usb_pdata,
2756 },
2757};
2758
2759static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2760 0x03, 0x0f,
2761};
2762
2763static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2764 0x00, 0x24, 0x54, 0x10,
2765 0x09, 0x03, 0x01,
2766 0x10, 0x54, 0x30, 0x0C,
2767 0x24, 0x30, 0x0f,
2768};
2769
2770static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2771 0x00, 0x24, 0x54, 0x10,
2772 0x09, 0x07, 0x01, 0x0B,
2773 0x10, 0x54, 0x30, 0x0C,
2774 0x24, 0x30, 0x0f,
2775};
2776
2777static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2778 [0] = {
2779 .mode = MSM_SPM_MODE_CLOCK_GATING,
2780 .notify_rpm = false,
2781 .cmd = spm_wfi_cmd_sequence,
2782 },
2783 [1] = {
2784 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2785 .notify_rpm = false,
2786 .cmd = spm_power_collapse_without_rpm,
2787 },
2788 [2] = {
2789 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2790 .notify_rpm = true,
2791 .cmd = spm_power_collapse_with_rpm,
2792 },
2793};
2794
2795static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2796 [0] = {
2797 .reg_base_addr = MSM_SAW0_BASE,
2798 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2799 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2800 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2801#if defined(CONFIG_MSM_AVS_HW)
2802 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2803 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2804#endif
2805 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2806 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2807 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2808 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2809 .vctl_timeout_us = 50,
2810 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2811 .modes = msm_spm_seq_list,
2812 },
2813 [1] = {
2814 .reg_base_addr = MSM_SAW1_BASE,
2815 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2816 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2817 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2818#if defined(CONFIG_MSM_AVS_HW)
2819 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2820 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2821#endif
2822 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2823 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2824 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2825 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2826 .vctl_timeout_us = 50,
2827 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2828 .modes = msm_spm_seq_list,
2829 },
2830};
2831
2832static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2833 0x00, 0x20, 0x03, 0x20,
2834 0x00, 0x0f,
2835};
2836
2837static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2838 0x00, 0x20, 0x34, 0x64,
2839 0x48, 0x07, 0x48, 0x20,
2840 0x50, 0x64, 0x04, 0x34,
2841 0x50, 0x0f,
2842};
2843static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2844 0x00, 0x10, 0x34, 0x64,
2845 0x48, 0x07, 0x48, 0x10,
2846 0x50, 0x64, 0x04, 0x34,
2847 0x50, 0x0F,
2848};
2849
2850static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2851 [0] = {
2852 .mode = MSM_SPM_L2_MODE_RETENTION,
2853 .notify_rpm = false,
2854 .cmd = l2_spm_wfi_cmd_sequence,
2855 },
2856 [1] = {
2857 .mode = MSM_SPM_L2_MODE_GDHS,
2858 .notify_rpm = true,
2859 .cmd = l2_spm_gdhs_cmd_sequence,
2860 },
2861 [2] = {
2862 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2863 .notify_rpm = true,
2864 .cmd = l2_spm_power_off_cmd_sequence,
2865 },
2866};
2867
2868
2869static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2870 [0] = {
2871 .reg_base_addr = MSM_SAW_L2_BASE,
2872 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2873 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2874 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2875 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2876 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2877 .modes = msm_spm_l2_seq_list,
2878 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2879 },
2880};
2881
2882#define CYTTSP_TS_GPIO_IRQ 11
2883#define CYTTSP_TS_SLEEP_GPIO 50
2884#define CYTTSP_TS_RESOUT_N_GPIO 52
2885
2886/*virtual key support */
2887static ssize_t tma340_vkeys_show(struct kobject *kobj,
2888 struct kobj_attribute *attr, char *buf)
2889{
2890 return snprintf(buf, 200,
2891 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2892 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2893 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2894 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2895 "\n");
2896}
2897
2898static struct kobj_attribute tma340_vkeys_attr = {
2899 .attr = {
2900 .mode = S_IRUGO,
2901 },
2902 .show = &tma340_vkeys_show,
2903};
2904
2905static struct attribute *tma340_properties_attrs[] = {
2906 &tma340_vkeys_attr.attr,
2907 NULL
2908};
2909
2910static struct attribute_group tma340_properties_attr_group = {
2911 .attrs = tma340_properties_attrs,
2912};
2913
2914
2915static int cyttsp_platform_init(struct i2c_client *client)
2916{
2917 int rc = 0;
2918 static struct kobject *tma340_properties_kobj;
2919
2920 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2921 tma340_properties_kobj = kobject_create_and_add("board_properties",
2922 NULL);
2923 if (tma340_properties_kobj)
2924 rc = sysfs_create_group(tma340_properties_kobj,
2925 &tma340_properties_attr_group);
2926 if (!tma340_properties_kobj || rc)
2927 pr_err("%s: failed to create board_properties\n",
2928 __func__);
2929
2930 return 0;
2931}
2932
2933static struct cyttsp_regulator regulator_data[] = {
2934 {
2935 .name = "vdd",
2936 .min_uV = CY_TMA300_VTG_MIN_UV,
2937 .max_uV = CY_TMA300_VTG_MAX_UV,
2938 .load_uA = CY_TMA300_CURR_24HZ_UA,
2939 },
2940 /* TODO: Remove after runtime PM is enabled in I2C driver */
2941 {
2942 .name = "vcc_i2c",
2943 .min_uV = CY_I2C_VTG_MIN_UV,
2944 .max_uV = CY_I2C_VTG_MAX_UV,
2945 .load_uA = CY_I2C_CURR_UA,
2946 },
2947};
2948
2949static struct cyttsp_platform_data cyttsp_pdata = {
2950 .panel_maxx = 634,
2951 .panel_maxy = 1166,
2952 .disp_maxx = 616,
2953 .disp_maxy = 1023,
2954 .disp_minx = 0,
2955 .disp_miny = 16,
2956 .flags = 0x01,
2957 .gen = CY_GEN3, /* or */
2958 .use_st = CY_USE_ST,
2959 .use_mt = CY_USE_MT,
2960 .use_hndshk = CY_SEND_HNDSHK,
2961 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302962 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002963 .use_gestures = CY_USE_GESTURES,
2964 .fw_fname = "cyttsp_8960_cdp.hex",
2965 /* activate up to 4 groups
2966 * and set active distance
2967 */
2968 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2969 CY_GEST_GRP3 | CY_GEST_GRP4 |
2970 CY_ACT_DIST,
2971 /* change act_intrvl to customize the Active power state
2972 * scanning/processing refresh interval for Operating mode
2973 */
2974 .act_intrvl = CY_ACT_INTRVL_DFLT,
2975 /* change tch_tmout to customize the touch timeout for the
2976 * Active power state for Operating mode
2977 */
2978 .tch_tmout = CY_TCH_TMOUT_DFLT,
2979 /* change lp_intrvl to customize the Low Power power state
2980 * scanning/processing refresh interval for Operating mode
2981 */
2982 .lp_intrvl = CY_LP_INTRVL_DFLT,
2983 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2984 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2985 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2986 .regulator_info = regulator_data,
2987 .num_regulators = ARRAY_SIZE(regulator_data),
2988 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302989 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002990};
2991
2992static struct i2c_board_info cyttsp_info[] __initdata = {
2993 {
2994 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2995 .platform_data = &cyttsp_pdata,
2996#ifndef CY_USE_TIMER
2997 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2998#endif /* CY_USE_TIMER */
2999 },
3000};
3001
Mohan Pallaka50837382011-09-07 11:00:57 +05303002/* configuration data */
3003static const u8 mxt_config_data[] = {
3004 /* T6 Object */
3005 0, 0, 0, 0, 0, 0,
3006 /* T38 Object */
3007 11, 0, 0, 6, 9, 11, 0, 0, 0, 0,
3008 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3009 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3010 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3011 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3012 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3013 0, 0, 0, 0,
3014 /* T7 Object */
3015 10, 10, 50,
3016 /* T8 Object */
3017 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3018 /* T9 Object */
3019 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3020 0, 5, 5, 34, 10, 10, 10, 10, 85, 5,
3021 255, 2, 8, 9, 9, 9, 0, 0, 5, 20,
3022 0, 5, 45, 46,
3023 /* T15 Object */
3024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3025 0,
3026 /* T22 Object */
3027 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3028 0, 0, 255, 255, 255, 255, 0,
3029 /* T24 Object */
3030 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3031 0, 0, 0, 0, 0, 0, 0, 0, 0,
3032 /* T25 Object */
3033 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3034 0, 0, 0, 0,
3035 /* T27 Object */
3036 0, 0, 0, 0, 0, 0, 0,
3037 /* T28 Object */
3038 0, 0, 0, 8, 8, 8,
3039 /* T40 Object */
3040 0, 0, 0, 0, 0,
3041 /* T41 Object */
3042 0, 0, 0, 0, 0, 0,
3043 /* T43 Object */
3044 0, 0, 0, 0, 0, 0,
3045};
3046
3047#define MXT_TS_GPIO_IRQ 11
3048#define MXT_TS_LDO_EN_GPIO 50
3049#define MXT_TS_RESET_GPIO 52
3050
3051static void mxt_init_hw_liquid(void)
3052{
3053 int rc;
3054
3055 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3056 if (rc) {
3057 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3058 __func__, MXT_TS_GPIO_IRQ);
3059 return;
3060 }
3061
3062 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3063 if (rc) {
3064 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3065 __func__, MXT_TS_GPIO_IRQ);
3066 goto err_irq_gpio_req;
3067 }
3068
3069 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3070 if (rc) {
3071 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3072 __func__, MXT_TS_LDO_EN_GPIO);
3073 goto err_irq_gpio_req;
3074 }
3075
3076 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3077 if (rc) {
3078 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3079 __func__, MXT_TS_LDO_EN_GPIO);
3080 goto err_ldo_gpio_req;
3081 }
3082
3083 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3084 if (rc) {
3085 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3086 __func__, MXT_TS_RESET_GPIO);
3087 goto err_ldo_gpio_set_dir;
3088 }
3089
3090 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3091 if (rc) {
3092 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3093 __func__, MXT_TS_RESET_GPIO);
3094 goto err_reset_gpio_req;
3095 }
3096
3097 return;
3098
3099err_reset_gpio_req:
3100 gpio_free(MXT_TS_RESET_GPIO);
3101err_ldo_gpio_set_dir:
3102 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3103err_ldo_gpio_req:
3104 gpio_free(MXT_TS_LDO_EN_GPIO);
3105err_irq_gpio_req:
3106 gpio_free(MXT_TS_GPIO_IRQ);
3107}
3108
3109static struct mxt_platform_data mxt_platform_data = {
3110 .config = mxt_config_data,
3111 .config_length = ARRAY_SIZE(mxt_config_data),
3112 .x_line = 26,
3113 .y_line = 42,
3114 .x_size = 767,
3115 .y_size = 1365,
3116 .blen = 32,
3117 .threshold = 40,
3118 .voltage = 3300000, /* 3.3V */
3119 .orient = MXT_ROTATED_90,
3120 .irqflags = IRQF_TRIGGER_FALLING,
3121};
3122
3123static struct i2c_board_info mxt_device_info[] __initdata = {
3124 {
3125 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3126 .platform_data = &mxt_platform_data,
3127 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3128 },
3129};
3130
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003131static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3132{
3133}
3134
3135static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3136 .clk_freq = 100000,
3137 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003138 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3139};
3140
3141static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3142 .clk_freq = 100000,
3143 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003144 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3145};
3146
3147static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3148 .clk_freq = 100000,
3149 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003150 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3151};
3152
3153static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3154 .clk_freq = 100000,
3155 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003156 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3157};
3158
3159static struct msm_rpm_platform_data msm_rpm_data = {
3160 .reg_base_addrs = {
3161 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3162 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3163 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3164 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3165 },
3166
3167 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3168 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3169 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3170 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3171 .msm_apps_ipc_rpm_val = 4,
3172};
3173
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003174static struct ks8851_pdata spi_eth_pdata = {
3175 .irq_gpio = KS8851_IRQ_GPIO,
3176 .rst_gpio = KS8851_RST_GPIO,
3177};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003178
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003179static struct spi_board_info spi_board_info[] __initdata = {
3180 {
3181 .modalias = "ks8851",
3182 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3183 .max_speed_hz = 19200000,
3184 .bus_num = 0,
3185 .chip_select = 0,
3186 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003187 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003188 },
3189};
3190
3191static struct platform_device msm_device_saw_core0 = {
3192 .name = "saw-regulator",
3193 .id = 0,
3194 .dev = {
3195 .platform_data = &msm_saw_regulator_pdata_s5,
3196 },
3197};
3198
3199static struct platform_device msm_device_saw_core1 = {
3200 .name = "saw-regulator",
3201 .id = 1,
3202 .dev = {
3203 .platform_data = &msm_saw_regulator_pdata_s6,
3204 },
3205};
3206
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003207static struct tsens_platform_data msm_tsens_pdata = {
3208 .slope = 910,
3209 .tsens_factor = 1000,
3210 .hw_type = MSM_8960,
3211 .tsens_num_sensor = 5,
3212};
3213
3214static struct platform_device msm_tsens_device = {
3215 .name = "tsens8960-tm",
3216 .id = -1,
3217 .dev = {
3218 .platform_data = &msm_tsens_pdata,
3219 },
3220};
3221
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003222#ifdef CONFIG_MSM_FAKE_BATTERY
3223static struct platform_device fish_battery_device = {
3224 .name = "fish_battery",
3225};
3226#endif
3227
David Collins26f05562011-06-20 09:56:28 -07003228static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003229 .name = GPIO_REGULATOR_DEV_NAME,
3230 .id = PM8921_MPP_PM_TO_SYS(7),
3231 .dev = {
3232 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3233 },
3234};
3235
David Collins26f05562011-06-20 09:56:28 -07003236static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003237 .name = GPIO_REGULATOR_DEV_NAME,
3238 .id = 91,
3239 .dev = {
3240 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3241 },
3242};
3243
David Collinsb10be1d2011-09-02 10:29:31 -07003244static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3245 .name = GPIO_REGULATOR_DEV_NAME,
3246 .id = PM8921_GPIO_PM_TO_SYS(17),
3247 .dev = {
3248 .platform_data =
3249 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3250 },
3251};
3252
David Collins26f05562011-06-20 09:56:28 -07003253static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3254 .name = "rpm-regulator",
3255 .id = -1,
3256 .dev = {
3257 .platform_data = &msm_rpm_regulator_pdata,
3258 },
3259};
3260
David Collins4c31a872011-08-31 10:07:10 -07003261static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3262 .phys_addr_base = 0x0010C000,
3263 .reg_offsets = {
3264 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3265 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3266 },
3267 .phys_size = SZ_8K,
3268 .log_len = 4096, /* log's buffer length in bytes */
3269 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3270};
3271
3272static struct platform_device msm_rpm_log_device = {
3273 .name = "msm_rpm_log",
3274 .id = -1,
3275 .dev = {
3276 .platform_data = &msm_rpm_log_pdata,
3277 },
3278};
3279
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003280static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003281 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003282 &msm_device_smd,
3283 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303284 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003285 &msm_device_saw_core0,
3286 &msm_device_saw_core1,
3287 &msm8960_device_ext_5v_vreg,
3288 &msm8960_device_ext_l2_vreg,
3289 &msm8960_device_ssbi_pm8921,
3290 &msm8960_device_qup_spi_gsbi1,
3291 &msm8960_device_qup_i2c_gsbi3,
3292 &msm8960_device_qup_i2c_gsbi4,
3293 &msm8960_device_qup_i2c_gsbi10,
3294#ifndef CONFIG_MSM_DSPS
3295 &msm8960_device_qup_i2c_gsbi12,
3296#endif
3297 &msm_slim_ctrl,
3298 &msm_device_wcnss_wlan,
3299#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3300 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3301 &qcrypto_device,
3302#endif
3303
3304#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3305 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3306 &qcedev_device,
3307#endif
3308#ifdef CONFIG_MSM_ROTATOR
3309 &msm_rotator_device,
3310#endif
3311 &msm_device_sps,
3312#ifdef CONFIG_MSM_FAKE_BATTERY
3313 &fish_battery_device,
3314#endif
3315#ifdef CONFIG_ANDROID_PMEM
3316 &android_pmem_device,
3317 &android_pmem_adsp_device,
3318 &android_pmem_audio_device,
3319#endif
3320 &msm_fb_device,
3321 &msm_device_vidc,
3322 &msm_device_bam_dmux,
3323 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003324
3325#ifdef CONFIG_HW_RANDOM_MSM
3326 &msm_device_rng,
3327#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003328 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003329#ifdef CONFIG_ION_MSM
3330 &ion_dev,
3331#endif
David Collins4c31a872011-08-31 10:07:10 -07003332 &msm_rpm_log_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003333#ifdef CONFIG_MSM_QDSS
3334 &msm_etb_device,
3335 &msm_tpiu_device,
3336 &msm_funnel_device,
3337 &msm_ptm_device,
3338#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003339};
3340
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003341static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003342 &msm8960_device_otg,
3343 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003344 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303345 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003346 &android_usb_device,
3347 &msm_device_vidc,
3348 &mipi_dsi_simulator_panel_device,
3349 &msm_bus_apps_fabric,
3350 &msm_bus_sys_fabric,
3351 &msm_bus_mm_fabric,
3352 &msm_bus_sys_fpb,
3353 &msm_bus_cpss_fpb,
3354 &msm_pcm,
3355 &msm_pcm_routing,
3356 &msm_cpudai0,
3357 &msm_cpudai1,
3358 &msm_cpudai_hdmi_rx,
3359 &msm_cpudai_bt_rx,
3360 &msm_cpudai_bt_tx,
3361 &msm_cpudai_fm_rx,
3362 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003363 &msm_cpudai_auxpcm_rx,
3364 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003365 &msm_cpu_fe,
3366 &msm_stub_codec,
3367 &msm_voice,
3368 &msm_voip,
3369 &msm_lpa_pcm,
3370
3371#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3372 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3373 &qcrypto_device,
3374#endif
3375
3376#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3377 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3378 &qcedev_device,
3379#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003380};
3381
3382static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003383 &msm_kgsl_3d0,
3384 &msm_kgsl_2d0,
3385 &msm_kgsl_2d1,
3386 &mipi_dsi_renesas_panel_device,
3387#ifdef CONFIG_MSM_GEMINI
3388 &msm8960_gemini_device,
3389#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003390};
3391
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003392static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003393 &msm8960_device_otg,
3394 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003395 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303396 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003397 &android_usb_device,
3398 &msm_pcm,
3399 &msm_pcm_routing,
3400 &msm_cpudai0,
3401 &msm_cpudai1,
3402 &msm_cpudai_hdmi_rx,
3403 &msm_cpudai_bt_rx,
3404 &msm_cpudai_bt_tx,
3405 &msm_cpudai_fm_rx,
3406 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003407 &msm_cpudai_auxpcm_rx,
3408 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003409 &msm_cpu_fe,
3410 &msm_stub_codec,
3411 &msm_kgsl_3d0,
3412#ifdef CONFIG_MSM_KGSL_2D
3413 &msm_kgsl_2d0,
3414 &msm_kgsl_2d1,
3415#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003416 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003417#ifdef CONFIG_MSM_GEMINI
3418 &msm8960_gemini_device,
3419#endif
3420 &msm_voice,
3421 &msm_voip,
3422 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303423 &msm_cpudai_afe_01_rx,
3424 &msm_cpudai_afe_01_tx,
3425 &msm_cpudai_afe_02_rx,
3426 &msm_cpudai_afe_02_tx,
3427 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003428#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3429 &hdmi_msm_device,
3430#endif
3431 &msm_pcm_hostless,
3432 &msm_bus_apps_fabric,
3433 &msm_bus_sys_fabric,
3434 &msm_bus_mm_fabric,
3435 &msm_bus_sys_fpb,
3436 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003437 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003438};
3439
3440static void __init msm8960_i2c_init(void)
3441{
3442 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3443 &msm8960_i2c_qup_gsbi4_pdata;
3444
3445 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3446 &msm8960_i2c_qup_gsbi3_pdata;
3447
3448 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3449 &msm8960_i2c_qup_gsbi10_pdata;
3450
3451 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3452 &msm8960_i2c_qup_gsbi12_pdata;
3453}
3454
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003455static void __init msm8960_gfx_init(void)
3456{
3457 uint32_t soc_platform_version = socinfo_get_platform_version();
3458 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3459 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3460 msm_kgsl_3d0.dev.platform_data;
3461 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3462 320000000;
3463 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3464 266667000;
3465 }
3466}
3467
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003468static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3469 .irq_base = PM8921_IRQ_BASE,
3470 .devirq = MSM_GPIO_TO_INT(104),
3471 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3472};
3473
3474static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3475 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3476};
3477
3478static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3479 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3480};
3481
3482static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3483 .rtc_write_enable = false,
3484};
3485
3486static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3487 .pull_up = 1,
3488 .kpd_trigger_delay_us = 970,
3489 .wakeup = 1,
3490};
3491
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303492/* Rotate lock key is not available so use F1 */
3493#define KEY_ROTATE_LOCK KEY_F1
3494
3495static const unsigned int keymap_liquid[] = {
3496 KEY(0, 0, KEY_VOLUMEUP),
3497 KEY(0, 1, KEY_VOLUMEDOWN),
3498 KEY(1, 3, KEY_ROTATE_LOCK),
3499 KEY(1, 4, KEY_HOME),
3500};
3501
3502static struct matrix_keymap_data keymap_data_liquid = {
3503 .keymap_size = ARRAY_SIZE(keymap_liquid),
3504 .keymap = keymap_liquid,
3505};
3506
3507static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3508 .input_name = "keypad_8960_liquid",
3509 .input_phys_device = "keypad_8960/input0",
3510 .num_rows = 2,
3511 .num_cols = 5,
3512 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3513 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3514 .debounce_ms = 15,
3515 .scan_delay_ms = 32,
3516 .row_hold_ns = 91500,
3517 .wakeup = 1,
3518 .keymap_data = &keymap_data_liquid,
3519};
3520
3521
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003522static const unsigned int keymap[] = {
3523 KEY(0, 0, KEY_VOLUMEUP),
3524 KEY(0, 1, KEY_VOLUMEDOWN),
3525 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3526 KEY(0, 3, KEY_CAMERA_FOCUS),
3527};
3528
3529static struct matrix_keymap_data keymap_data = {
3530 .keymap_size = ARRAY_SIZE(keymap),
3531 .keymap = keymap,
3532};
3533
3534static struct pm8xxx_keypad_platform_data keypad_data = {
3535 .input_name = "keypad_8960",
3536 .input_phys_device = "keypad_8960/input0",
3537 .num_rows = 1,
3538 .num_cols = 5,
3539 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3540 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3541 .debounce_ms = 15,
3542 .scan_delay_ms = 32,
3543 .row_hold_ns = 91500,
3544 .wakeup = 1,
3545 .keymap_data = &keymap_data,
3546};
3547
3548static const unsigned int keymap_sim[] = {
3549 KEY(0, 0, KEY_7),
3550 KEY(0, 1, KEY_DOWN),
3551 KEY(0, 2, KEY_UP),
3552 KEY(0, 3, KEY_RIGHT),
3553 KEY(0, 4, KEY_ENTER),
3554 KEY(0, 5, KEY_L),
3555 KEY(0, 6, KEY_BACK),
3556 KEY(0, 7, KEY_M),
3557
3558 KEY(1, 0, KEY_LEFT),
3559 KEY(1, 1, KEY_SEND),
3560 KEY(1, 2, KEY_1),
3561 KEY(1, 3, KEY_4),
3562 KEY(1, 4, KEY_CLEAR),
3563 KEY(1, 5, KEY_MSDOS),
3564 KEY(1, 6, KEY_SPACE),
3565 KEY(1, 7, KEY_COMMA),
3566
3567 KEY(2, 0, KEY_6),
3568 KEY(2, 1, KEY_5),
3569 KEY(2, 2, KEY_8),
3570 KEY(2, 3, KEY_3),
3571 KEY(2, 4, KEY_NUMERIC_STAR),
3572 KEY(2, 5, KEY_UP),
3573 KEY(2, 6, KEY_DOWN),
3574 KEY(2, 7, KEY_LEFTSHIFT),
3575
3576 KEY(3, 0, KEY_9),
3577 KEY(3, 1, KEY_NUMERIC_POUND),
3578 KEY(3, 2, KEY_0),
3579 KEY(3, 3, KEY_2),
3580 KEY(3, 4, KEY_SLEEP),
3581 KEY(3, 5, KEY_F1),
3582 KEY(3, 6, KEY_F2),
3583 KEY(3, 7, KEY_F3),
3584
3585 KEY(4, 0, KEY_BACK),
3586 KEY(4, 1, KEY_HOME),
3587 KEY(4, 2, KEY_MENU),
3588 KEY(4, 3, KEY_VOLUMEUP),
3589 KEY(4, 4, KEY_VOLUMEDOWN),
3590 KEY(4, 5, KEY_F4),
3591 KEY(4, 6, KEY_F5),
3592 KEY(4, 7, KEY_F6),
3593
3594 KEY(5, 0, KEY_R),
3595 KEY(5, 1, KEY_T),
3596 KEY(5, 2, KEY_Y),
3597 KEY(5, 3, KEY_LEFTALT),
3598 KEY(5, 4, KEY_KPENTER),
3599 KEY(5, 5, KEY_Q),
3600 KEY(5, 6, KEY_W),
3601 KEY(5, 7, KEY_E),
3602
3603 KEY(6, 0, KEY_F),
3604 KEY(6, 1, KEY_G),
3605 KEY(6, 2, KEY_H),
3606 KEY(6, 3, KEY_CAPSLOCK),
3607 KEY(6, 4, KEY_PAGEUP),
3608 KEY(6, 5, KEY_A),
3609 KEY(6, 6, KEY_S),
3610 KEY(6, 7, KEY_D),
3611
3612 KEY(7, 0, KEY_V),
3613 KEY(7, 1, KEY_B),
3614 KEY(7, 2, KEY_N),
3615 KEY(7, 3, KEY_MENU),
3616 KEY(7, 4, KEY_PAGEDOWN),
3617 KEY(7, 5, KEY_Z),
3618 KEY(7, 6, KEY_X),
3619 KEY(7, 7, KEY_C),
3620
3621 KEY(8, 0, KEY_P),
3622 KEY(8, 1, KEY_J),
3623 KEY(8, 2, KEY_K),
3624 KEY(8, 3, KEY_INSERT),
3625 KEY(8, 4, KEY_LINEFEED),
3626 KEY(8, 5, KEY_U),
3627 KEY(8, 6, KEY_I),
3628 KEY(8, 7, KEY_O),
3629
3630 KEY(9, 0, KEY_4),
3631 KEY(9, 1, KEY_5),
3632 KEY(9, 2, KEY_6),
3633 KEY(9, 3, KEY_7),
3634 KEY(9, 4, KEY_8),
3635 KEY(9, 5, KEY_1),
3636 KEY(9, 6, KEY_2),
3637 KEY(9, 7, KEY_3),
3638
3639 KEY(10, 0, KEY_F7),
3640 KEY(10, 1, KEY_F8),
3641 KEY(10, 2, KEY_F9),
3642 KEY(10, 3, KEY_F10),
3643 KEY(10, 4, KEY_FN),
3644 KEY(10, 5, KEY_9),
3645 KEY(10, 6, KEY_0),
3646 KEY(10, 7, KEY_DOT),
3647
3648 KEY(11, 0, KEY_LEFTCTRL),
3649 KEY(11, 1, KEY_F11),
3650 KEY(11, 2, KEY_ENTER),
3651 KEY(11, 3, KEY_SEARCH),
3652 KEY(11, 4, KEY_DELETE),
3653 KEY(11, 5, KEY_RIGHT),
3654 KEY(11, 6, KEY_LEFT),
3655 KEY(11, 7, KEY_RIGHTSHIFT),
3656 KEY(0, 0, KEY_VOLUMEUP),
3657 KEY(0, 1, KEY_VOLUMEDOWN),
3658 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3659 KEY(0, 3, KEY_CAMERA_FOCUS),
3660};
3661
3662static struct matrix_keymap_data keymap_data_sim = {
3663 .keymap_size = ARRAY_SIZE(keymap_sim),
3664 .keymap = keymap_sim,
3665};
3666
3667static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3668 .input_name = "keypad_8960",
3669 .input_phys_device = "keypad_8960/input0",
3670 .num_rows = 12,
3671 .num_cols = 8,
3672 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3673 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3674 .debounce_ms = 15,
3675 .scan_delay_ms = 32,
3676 .row_hold_ns = 91500,
3677 .wakeup = 1,
3678 .keymap_data = &keymap_data_sim,
3679};
3680
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003681static int pm8921_therm_mitigation[] = {
3682 1100,
3683 700,
3684 600,
3685 325,
3686};
3687
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003688static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003689 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07003690 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003691 .max_voltage = 4200,
3692 .min_voltage = 3200,
3693 .resume_voltage = 4100,
3694 .term_current = 100,
3695 .cool_temp = 10,
3696 .warm_temp = 40,
3697 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003698 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07003699 .cool_bat_chg_current = 350,
3700 .warm_bat_chg_current = 350,
3701 .cool_bat_voltage = 4100,
3702 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07003703 .thermal_mitigation = pm8921_therm_mitigation,
3704 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003705};
3706
3707static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3708 .priority = 0,
3709};
3710
3711static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3712 .r_sense = 10,
3713 .i_test = 2500,
3714 .v_failure = 3000,
3715 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003716};
3717
Jay Chokshide4cefb2011-08-04 18:10:44 -07003718#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
3719
3720/**
3721 * 'flag' stores three values; led id, led mode, and max current of led.
3722 * The bit packing format is as follow,
3723 * reserved (1 byte) | max_current (2 bytes) | led_mode (1 nibble) |
3724 * led_id (1 nibble)
3725 */
3726#define PM8XXX_SET_FLAG(led_id, led_mode, led_max_current) \
3727 (((led_id << PM8XXX_LED_ID_SHIFT) & PM8XXX_LED_ID_MASK) |\
3728 ((led_mode << PM8XXX_LED_MODE_SHIFT) & PM8XXX_LED_MODE_MASK) |\
3729 ((led_max_current << PM8XXX_LED_MAX_CURRENT_SHIFT) & \
3730 PM8XXX_LED_MAX_CURRENT_MASK))
3731
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003732static struct led_info pm8921_led_info[] = {
3733 [0] = {
Jay Chokshide4cefb2011-08-04 18:10:44 -07003734 .name = "led:usb",
3735 .default_trigger = "usb-online",
3736 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_0,
3737 PM8XXX_LED_MODE_MANUAL,
3738 PM8921_LC_LED_MAX_CURRENT),
3739 },
3740 [1] = {
3741 .name = "led:ac",
3742 .default_trigger = "ac-online",
3743 .flags = PM8XXX_SET_FLAG(PM8XXX_ID_LED_1,
3744 PM8XXX_LED_MODE_MANUAL,
3745 PM8921_LC_LED_MAX_CURRENT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003746 },
3747};
3748
3749static struct led_platform_data pm8xxx_leds_pdata = {
3750 .num_leds = ARRAY_SIZE(pm8921_led_info),
3751 .leds = pm8921_led_info,
3752};
3753
3754static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3755 .irq_pdata = &pm8xxx_irq_pdata,
3756 .gpio_pdata = &pm8xxx_gpio_pdata,
3757 .mpp_pdata = &pm8xxx_mpp_pdata,
3758 .rtc_pdata = &pm8xxx_rtc_pdata,
3759 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3760 .keypad_pdata = &keypad_data,
3761 .misc_pdata = &pm8xxx_misc_pdata,
3762 .regulator_pdatas = msm_pm8921_regulator_pdata,
3763 .charger_pdata = &pm8921_chg_pdata,
3764 .bms_pdata = &pm8921_bms_pdata,
3765 .adc_pdata = &pm8921_adc_pdata,
3766 .leds_pdata = &pm8xxx_leds_pdata,
3767};
3768
3769static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3770 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3771 .slave = {
3772 .name = "pm8921-core",
3773 .platform_data = &pm8921_platform_data,
3774 },
3775};
3776
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003777#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
3778static int fpga_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003779{
3780 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003781
3782 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3783 if (ret) {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003784 pr_err("FPGA CS gpio_request failed: %d\n", ret);
3785 goto fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003786 }
3787
3788 gpio_direction_output(FPGA_CS_GPIO, 1);
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003789
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003790 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003791fail:
3792 return ret;
3793}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003794#else
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003795static int fpga_init(void)
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003796{
3797 return 0;
3798}
3799#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003800
3801static struct msm_cpuidle_state msm_cstates[] __initdata = {
3802 {0, 0, "C0", "WFI",
3803 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3804
3805 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3806 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3807
3808 {0, 2, "C2", "POWER_COLLAPSE",
3809 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3810
3811 {1, 0, "C0", "WFI",
3812 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3813
3814 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3815 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3816};
3817
3818static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3819 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3820 .idle_supported = 1,
3821 .suspend_supported = 1,
3822 .idle_enabled = 0,
3823 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003824 },
3825
3826 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3827 .idle_supported = 1,
3828 .suspend_supported = 1,
3829 .idle_enabled = 0,
3830 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003831 },
3832
3833 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3834 .idle_supported = 1,
3835 .suspend_supported = 1,
3836 .idle_enabled = 1,
3837 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003838 },
3839
3840 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3841 .idle_supported = 0,
3842 .suspend_supported = 1,
3843 .idle_enabled = 0,
3844 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003845 },
3846
3847 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3848 .idle_supported = 1,
3849 .suspend_supported = 1,
3850 .idle_enabled = 0,
3851 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003852 },
3853
3854 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3855 .idle_supported = 1,
3856 .suspend_supported = 0,
3857 .idle_enabled = 1,
3858 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003859 },
3860};
3861
3862static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3863 {
3864 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3865 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3866 true,
3867 1, 8000, 100000, 1,
3868 },
3869
3870 {
3871 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3872 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3873 true,
3874 1500, 5000, 60100000, 3000,
3875 },
3876
3877 {
3878 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3879 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3880 false,
3881 1800, 5000, 60350000, 3500,
3882 },
3883
3884 {
3885 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3886 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3887 false,
3888 2800, 2500, 65350000, 4800,
3889 },
3890
3891 {
3892 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3893 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3894 false,
3895 3800, 4500, 67850000, 5500,
3896 },
3897
3898 {
3899 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3900 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3901 false,
3902 4800, 2000, 71850000, 6800,
3903 },
3904
3905 {
3906 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3907 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3908 false,
3909 6800, 500, 75850000, 8800,
3910 },
3911
3912 {
3913 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3914 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3915 false,
3916 7800, 0, 76350000, 9800,
3917 },
3918};
3919
3920#ifdef CONFIG_I2C
3921#define I2C_SURF 1
3922#define I2C_FFA (1 << 1)
3923#define I2C_RUMI (1 << 2)
3924#define I2C_SIM (1 << 3)
3925#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03003926#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003927
3928struct i2c_registry {
3929 u8 machs;
3930 int bus;
3931 struct i2c_board_info *info;
3932 int len;
3933};
3934
3935#ifdef CONFIG_MSM_CAMERA
3936static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3937#ifdef CONFIG_IMX074
3938 {
3939 I2C_BOARD_INFO("imx074", 0x1A),
3940 },
3941#endif
3942#ifdef CONFIG_OV2720
3943 {
3944 I2C_BOARD_INFO("ov2720", 0x6C),
3945 },
3946#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003947 {
3948 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3949 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303950#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3951 {
3952 I2C_BOARD_INFO("sc628a", 0x6E),
3953 },
3954#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003955};
3956#endif
3957
3958/* Sensors DSPS platform data */
3959#ifdef CONFIG_MSM_DSPS
3960#define DSPS_PIL_GENERIC_NAME "dsps"
3961#endif /* CONFIG_MSM_DSPS */
3962
3963static void __init msm8960_init_dsps(void)
3964{
3965#ifdef CONFIG_MSM_DSPS
3966 struct msm_dsps_platform_data *pdata =
3967 msm_dsps_device.dev.platform_data;
3968 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3969 pdata->gpios = NULL;
3970 pdata->gpios_num = 0;
3971
3972 platform_device_register(&msm_dsps_device);
3973#endif /* CONFIG_MSM_DSPS */
3974}
3975
Amir Samuelov5137e392011-09-21 17:31:25 +03003976#ifdef CONFIG_ISL9519_CHARGER
3977static struct isl_platform_data isl_data __initdata = {
3978 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
3979 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
3980 .max_system_voltage = 4200,
3981 .min_system_voltage = 3200,
3982 .chgcurrent = 1000, /* 1900, */
3983 .term_current = 400, /* Need fine tuning */
3984 .input_current = 2048,
3985};
3986
3987static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
3988 {
3989 I2C_BOARD_INFO("isl9519q", 0x9),
3990 .irq = 0, /* Not required when notify-by-pmic */
3991 .platform_data = &isl_data,
3992 },
3993};
3994#endif /* CONFIG_ISL9519_CHARGER */
3995
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003996static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3997#ifdef CONFIG_MSM_CAMERA
3998 {
Amir Samuelov05f87802011-08-27 18:30:12 +03003999 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004000 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4001 msm_camera_boardinfo,
4002 ARRAY_SIZE(msm_camera_boardinfo),
4003 },
4004#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004005#ifdef CONFIG_ISL9519_CHARGER
4006 {
4007 I2C_LIQUID,
4008 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4009 isl_charger_i2c_info,
4010 ARRAY_SIZE(isl_charger_i2c_info),
4011 },
4012#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004013 {
4014 I2C_SURF | I2C_FFA | I2C_FLUID,
4015 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4016 cyttsp_info,
4017 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004018 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304019 {
4020 I2C_LIQUID,
4021 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4022 mxt_device_info,
4023 ARRAY_SIZE(mxt_device_info),
4024 },
4025
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004026};
4027#endif /* CONFIG_I2C */
4028
4029static void __init register_i2c_devices(void)
4030{
4031#ifdef CONFIG_I2C
4032 u8 mach_mask = 0;
4033 int i;
4034
4035 /* Build the matching 'supported_machs' bitmask */
4036 if (machine_is_msm8960_cdp())
4037 mach_mask = I2C_SURF;
4038 else if (machine_is_msm8960_rumi3())
4039 mach_mask = I2C_RUMI;
4040 else if (machine_is_msm8960_sim())
4041 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004042 else if (machine_is_msm8960_fluid())
4043 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004044 else if (machine_is_msm8960_liquid())
4045 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004046 else if (machine_is_msm8960_mtp())
4047 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004048 else
4049 pr_err("unmatched machine ID in register_i2c_devices\n");
4050
4051 /* Run the array and install devices as appropriate */
4052 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4053 if (msm8960_i2c_devices[i].machs & mach_mask)
4054 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4055 msm8960_i2c_devices[i].info,
4056 msm8960_i2c_devices[i].len);
4057 }
4058#endif
4059}
4060
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004061static void __init msm8960_sim_init(void)
4062{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004063 BUG_ON(msm_rpm_init(&msm_rpm_data));
4064 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4065 ARRAY_SIZE(msm_rpmrs_levels)));
4066 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004067 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004068 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004069 msm8960_device_ssbi_pm8921.dev.platform_data =
4070 &msm8960_ssbi_pm8921_pdata;
4071 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004072
4073 /* Simulator supports a QWERTY keypad */
4074 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4075
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004076 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4077 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4078 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004079 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004080 msm8960_i2c_init();
4081 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4082 msm_spm_l2_init(msm_spm_l2_data);
4083 msm8960_init_buses();
4084 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4085 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004086 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004087 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004088
4089 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4090 &msm8960_qup_spi_gsbi1_pdata;
4091 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4092
4093 msm8960_init_mmc();
4094 msm_fb_add_devices();
4095 slim_register_board_info(msm_slim_devices,
4096 ARRAY_SIZE(msm_slim_devices));
4097 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4098 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4099 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4100 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004101}
4102
4103static void __init msm8960_rumi3_init(void)
4104{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004105 BUG_ON(msm_rpm_init(&msm_rpm_data));
4106 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4107 ARRAY_SIZE(msm_rpmrs_levels)));
4108 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004109 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004110 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004111 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004112 msm8960_device_ssbi_pm8921.dev.platform_data =
4113 &msm8960_ssbi_pm8921_pdata;
4114 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4115 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4116 &msm8960_qup_spi_gsbi1_pdata;
4117 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4118 msm8960_i2c_init();
4119 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4120 msm_spm_l2_init(msm_spm_l2_data);
4121 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4122 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004123 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004124 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004125 register_i2c_devices();
4126 msm_fb_add_devices();
4127 slim_register_board_info(msm_slim_devices,
4128 ARRAY_SIZE(msm_slim_devices));
4129 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4130 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4131 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4132 msm_pm_data);
4133}
4134
4135static void __init msm8960_cdp_init(void)
4136{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004137 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4138 pr_err("meminfo_init() failed!\n");
4139
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004140 BUG_ON(msm_rpm_init(&msm_rpm_data));
4141 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4142 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004143
4144 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004145 regulator_suppress_info_printing();
4146 if (msm_xo_init())
4147 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004148 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004149 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004150 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4151 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4152 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004153 gpiomux_init();
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07004154 if (machine_is_msm8960_cdp())
4155 fpga_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304156 if (machine_is_msm8960_liquid())
4157 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004158 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4159 &msm8960_qup_spi_gsbi1_pdata;
4160 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4161 msm8960_device_ssbi_pm8921.dev.platform_data =
4162 &msm8960_ssbi_pm8921_pdata;
4163 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4164 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004165 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004166 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4167 msm_spm_l2_init(msm_spm_l2_data);
4168 msm8960_init_buses();
4169 platform_add_devices(msm_footswitch_devices,
4170 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004171 if (machine_is_msm8960_liquid())
4172 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004173 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4174 pm8921_gpio_mpp_init();
4175 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
4176 msm8960_init_cam();
4177 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004178 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304179 if (machine_is_msm8960_liquid())
4180 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004181 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004182 msm_fb_add_devices();
4183 slim_register_board_info(msm_slim_devices,
4184 ARRAY_SIZE(msm_slim_devices));
4185 msm8960_init_dsps();
4186 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4187 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4188 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4189 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004190 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004191}
4192
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004193MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4194 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004195 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004196 .init_irq = msm8960_init_irq,
4197 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004198 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004199 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004200MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004201
4202MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4203 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004204 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004205 .init_irq = msm8960_init_irq,
4206 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004207 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004208 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004209MACHINE_END
4210
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004211MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4212 .map_io = msm8960_map_io,
4213 .reserve = msm8960_reserve,
4214 .init_irq = msm8960_init_irq,
4215 .timer = &msm_timer,
4216 .init_machine = msm8960_cdp_init,
4217 .init_early = msm8960_allocate_memory_regions,
4218MACHINE_END
4219
4220MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4221 .map_io = msm8960_map_io,
4222 .reserve = msm8960_reserve,
4223 .init_irq = msm8960_init_irq,
4224 .timer = &msm_timer,
4225 .init_machine = msm8960_cdp_init,
4226 .init_early = msm8960_allocate_memory_regions,
4227MACHINE_END
4228
4229MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4230 .map_io = msm8960_map_io,
4231 .reserve = msm8960_reserve,
4232 .init_irq = msm8960_init_irq,
4233 .timer = &msm_timer,
4234 .init_machine = msm8960_cdp_init,
4235 .init_early = msm8960_allocate_memory_regions,
4236MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004237
4238MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4239 .map_io = msm8960_map_io,
4240 .reserve = msm8960_reserve,
4241 .init_irq = msm8960_init_irq,
4242 .timer = &msm_timer,
4243 .init_machine = msm8960_cdp_init,
4244 .init_early = msm8960_allocate_memory_regions,
4245MACHINE_END