blob: 41f887989aa22db65de4ea84a2336317938c006a [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"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060091#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070092#include "msm_watchdog.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093
94static struct platform_device msm_fm_platform_init = {
95 .name = "iris_fm",
96 .id = -1,
97};
98
99struct pm8xxx_gpio_init {
100 unsigned gpio;
101 struct pm_gpio config;
102};
103
104struct pm8xxx_mpp_init {
105 unsigned mpp;
106 struct pm8xxx_mpp_config_data config;
107};
108
109#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
110 _func, _inv, _disable) \
111{ \
112 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
113 .config = { \
114 .direction = _dir, \
115 .output_buffer = _buf, \
116 .output_value = _val, \
117 .pull = _pull, \
118 .vin_sel = _vin, \
119 .out_strength = _out_strength, \
120 .function = _func, \
121 .inv_int_pol = _inv, \
122 .disable_pin = _disable, \
123 } \
124}
125
126#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
127{ \
128 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
129 .config = { \
130 .type = PM8XXX_MPP_TYPE_##_type, \
131 .level = _level, \
132 .control = PM8XXX_MPP_##_control, \
133 } \
134}
135
136#define PM8XXX_GPIO_DISABLE(_gpio) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
138 0, 0, 0, 1)
139
140#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
141 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
142 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
143 PM_GPIO_STRENGTH_HIGH, \
144 PM_GPIO_FUNC_NORMAL, 0, 0)
145
146#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
147 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
148 _pull, PM_GPIO_VIN_S4, \
149 PM_GPIO_STRENGTH_NO, \
150 PM_GPIO_FUNC_NORMAL, 0, 0)
151
152#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
153 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
154 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
155 PM_GPIO_STRENGTH_HIGH, \
156 _func, 0, 0)
157
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200158#define PM8XXX_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
159 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
160 PM_GPIO_PULL_NO, _vin, \
161 PM_GPIO_STRENGTH_HIGH, \
162 PM_GPIO_FUNC_NORMAL, 0, 0)
163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164/* Initial PM8921 GPIO configurations */
165static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
166 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
167 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
168 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300169 /* External regulator shared by display and touchscreen on LiQUID */
170 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200171 PM8XXX_GPIO_OUTPUT_VIN(21, 1, PM_GPIO_VIN_VPH), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700172 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700173 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700174 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700175 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Anji jonnala2936fd92011-11-09 15:39:22 +0530176 PM8XXX_GPIO_OUTPUT(42, 0), /* USB 5V reg enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700177};
178
179/* Initial PM8921 MPP configurations */
180static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
181 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
182 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700183 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
184 DOUT_CTRL_LOW),
185};
186
187static void __init pm8921_gpio_mpp_init(void)
188{
189 int i, rc;
190
191 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
192 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
193 &pm8921_gpios[i].config);
194 if (rc) {
195 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
196 break;
197 }
198 }
199
200 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
201 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
202 &pm8921_mpps[i].config);
203 if (rc) {
204 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
205 break;
206 }
207 }
208}
209
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700210#define KS8851_RST_GPIO 89
211#define KS8851_IRQ_GPIO 90
212
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700213#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
214enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700215 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700216 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
217 /* CAM Expander */
218 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
219 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
220 GPIO_CAM_GP_AFBUSY,
221 GPIO_CAM_GP_STROBE_CE,
222 GPIO_CAM_GP_CAM1MP_XCLR,
223 GPIO_CAM_GP_CAMIF_RESET_N,
224 GPIO_CAM_GP_XMT_FLASH_INT,
225 GPIO_CAM_GP_LED_EN1,
226 GPIO_CAM_GP_LED_EN2,
227
228};
229#endif
230
Harini Jayaraman608d0462011-08-09 19:10:03 -0600231/* The SPI configurations apply to GSBI 1*/
232static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700233 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700234 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700235 .pull = GPIOMUX_PULL_NONE,
236};
237
Harini Jayaraman608d0462011-08-09 19:10:03 -0600238static struct gpiomux_setting spi_suspended_config = {
239 .func = GPIOMUX_FUNC_GPIO,
240 .drv = GPIOMUX_DRV_2MA,
241 .pull = GPIOMUX_PULL_DOWN,
242};
243
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700244static struct gpiomux_setting spi_active_config2 = {
245 .func = GPIOMUX_FUNC_2,
246 .drv = GPIOMUX_DRV_8MA,
247 .pull = GPIOMUX_PULL_NONE,
248};
249
250static struct gpiomux_setting spi_suspended_config2 = {
251 .func = GPIOMUX_FUNC_GPIO,
252 .drv = GPIOMUX_DRV_2MA,
253 .pull = GPIOMUX_PULL_UP,
254};
255
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530256static struct gpiomux_setting gsbi3_suspended_cfg = {
257 .func = GPIOMUX_FUNC_1,
258 .drv = GPIOMUX_DRV_2MA,
259 .pull = GPIOMUX_PULL_KEEPER,
260};
261
262static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700263 .func = GPIOMUX_FUNC_1,
264 .drv = GPIOMUX_DRV_8MA,
265 .pull = GPIOMUX_PULL_NONE,
266};
267
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700268static struct gpiomux_setting gsbi5 = {
269 .func = GPIOMUX_FUNC_1,
270 .drv = GPIOMUX_DRV_8MA,
271 .pull = GPIOMUX_PULL_NONE,
272};
273
274static struct gpiomux_setting gsbi10 = {
275 .func = GPIOMUX_FUNC_2,
276 .drv = GPIOMUX_DRV_8MA,
277 .pull = GPIOMUX_PULL_NONE,
278};
279
280static struct gpiomux_setting gsbi12 = {
281 .func = GPIOMUX_FUNC_1,
282 .drv = GPIOMUX_DRV_8MA,
283 .pull = GPIOMUX_PULL_NONE,
284};
285
286static struct gpiomux_setting cdc_mclk = {
287 .func = GPIOMUX_FUNC_1,
288 .drv = GPIOMUX_DRV_8MA,
289 .pull = GPIOMUX_PULL_NONE,
290};
291
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700292static struct gpiomux_setting audio_auxpcm[] = {
293 /* Suspended state */
294 {
295 .func = GPIOMUX_FUNC_GPIO,
296 .drv = GPIOMUX_DRV_2MA,
297 .pull = GPIOMUX_PULL_NONE,
298 },
299 /* Active state */
300 {
301 .func = GPIOMUX_FUNC_1,
302 .drv = GPIOMUX_DRV_2MA,
303 .pull = GPIOMUX_PULL_NONE,
304 },
305};
306
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700307#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308static struct gpiomux_setting gpio_eth_config = {
309 .pull = GPIOMUX_PULL_NONE,
310 .drv = GPIOMUX_DRV_8MA,
311 .func = GPIOMUX_FUNC_GPIO,
312};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700313#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314
315static struct gpiomux_setting slimbus = {
316 .func = GPIOMUX_FUNC_1,
317 .drv = GPIOMUX_DRV_8MA,
318 .pull = GPIOMUX_PULL_KEEPER,
319};
320
321struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700322#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323 {
324 .gpio = KS8851_IRQ_GPIO,
325 .settings = {
326 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
327 }
328 },
329 {
330 .gpio = KS8851_RST_GPIO,
331 .settings = {
332 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
333 }
334 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700335#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336};
337
338static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
339 {
340 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
341 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600342 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
343 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700344 },
345 },
346 {
347 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
348 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600349 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
350 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700351 },
352 },
353 {
354 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
355 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600356 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
357 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358 },
359 },
360 {
361 .gpio = 9, /* GSBI1 QUP SPI_CLK */
362 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600363 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
364 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700365 },
366 },
367 {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700368 .gpio = 14, /* GSBI1 SPI_CS_1 */
369 .settings = {
370 [GPIOMUX_SUSPENDED] = &spi_suspended_config2,
371 [GPIOMUX_ACTIVE] = &spi_active_config2,
372 },
373 },
374 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700375 .gpio = 16, /* GSBI3 I2C QUP SDA */
376 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530377 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
378 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700379 },
380 },
381 {
382 .gpio = 17, /* GSBI3 I2C QUP SCL */
383 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530384 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
385 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700386 },
387 },
388 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700389 .gpio = 22, /* GSBI5 UART2 */
390 .settings = {
391 [GPIOMUX_SUSPENDED] = &gsbi5,
392 },
393 },
394 {
395 .gpio = 23, /* GSBI5 UART2 */
396 .settings = {
397 [GPIOMUX_SUSPENDED] = &gsbi5,
398 },
399 },
400 {
401 .gpio = 24, /* GSBI5 UART2 */
402 .settings = {
403 [GPIOMUX_SUSPENDED] = &gsbi5,
404 },
405 },
406 {
407 .gpio = 25, /* GSBI5 UART2 */
408 .settings = {
409 [GPIOMUX_SUSPENDED] = &gsbi5,
410 },
411 },
412 {
413 .gpio = 44, /* GSBI12 I2C QUP SDA */
414 .settings = {
415 [GPIOMUX_SUSPENDED] = &gsbi12,
416 },
417 },
418 {
419 .gpio = 45, /* GSBI12 I2C QUP SCL */
420 .settings = {
421 [GPIOMUX_SUSPENDED] = &gsbi12,
422 },
423 },
424 {
425 .gpio = 73, /* GSBI10 I2C QUP SDA */
426 .settings = {
427 [GPIOMUX_SUSPENDED] = &gsbi10,
428 },
429 },
430 {
431 .gpio = 74, /* GSBI10 I2C QUP SCL */
432 .settings = {
433 [GPIOMUX_SUSPENDED] = &gsbi10,
434 },
435 },
436};
437
438static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
439 {
440 .gpio = 60, /* slimbus data */
441 .settings = {
442 [GPIOMUX_SUSPENDED] = &slimbus,
443 },
444 },
445 {
446 .gpio = 61, /* slimbus clk */
447 .settings = {
448 [GPIOMUX_SUSPENDED] = &slimbus,
449 },
450 },
451};
452
453static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
454 {
455 .gpio = 59,
456 .settings = {
457 [GPIOMUX_SUSPENDED] = &cdc_mclk,
458 },
459 },
460};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700461
462static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
463 {
464 .gpio = 63,
465 .settings = {
466 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
467 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
468 },
469 },
470 {
471 .gpio = 64,
472 .settings = {
473 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
474 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
475 },
476 },
477 {
478 .gpio = 65,
479 .settings = {
480 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
481 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
482 },
483 },
484 {
485 .gpio = 66,
486 .settings = {
487 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
488 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
489 },
490 },
491};
492
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700493static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
494 .func = GPIOMUX_FUNC_GPIO,
495 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700496 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700497};
498
499static struct gpiomux_setting wcnss_5wire_active_cfg = {
500 .func = GPIOMUX_FUNC_1,
501 .drv = GPIOMUX_DRV_6MA,
502 .pull = GPIOMUX_PULL_DOWN,
503};
504
505static struct msm_gpiomux_config wcnss_5wire_interface[] = {
506 {
507 .gpio = 84,
508 .settings = {
509 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
510 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
511 },
512 },
513 {
514 .gpio = 85,
515 .settings = {
516 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
517 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
518 },
519 },
520 {
521 .gpio = 86,
522 .settings = {
523 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
524 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
525 },
526 },
527 {
528 .gpio = 87,
529 .settings = {
530 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
531 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
532 },
533 },
534 {
535 .gpio = 88,
536 .settings = {
537 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
538 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
539 },
540 },
541};
Nishant Pandit24153d82011-08-27 16:05:13 +0530542static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530543 {
544 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
545 .drv = GPIOMUX_DRV_2MA,
546 .pull = GPIOMUX_PULL_DOWN,
547 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700548
Nishant Pandit474f2252011-07-23 23:17:56 +0530549 {
550 .func = GPIOMUX_FUNC_1, /*active 1*/
551 .drv = GPIOMUX_DRV_2MA,
552 .pull = GPIOMUX_PULL_NONE,
553 },
554
555 {
556 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
557 .drv = GPIOMUX_DRV_2MA,
558 .pull = GPIOMUX_PULL_NONE,
559 },
560
561 {
562 .func = GPIOMUX_FUNC_1, /*active 3*/
563 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700564 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530565 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530566
567 {
568 .func = GPIOMUX_FUNC_5, /*active 4*/
569 .drv = GPIOMUX_DRV_8MA,
570 .pull = GPIOMUX_PULL_UP,
571 },
572
573 {
574 .func = GPIOMUX_FUNC_6, /*active 5*/
575 .drv = GPIOMUX_DRV_8MA,
576 .pull = GPIOMUX_PULL_UP,
577 },
578
579 {
580 .func = GPIOMUX_FUNC_2, /*active 6*/
581 .drv = GPIOMUX_DRV_2MA,
582 .pull = GPIOMUX_PULL_UP,
583 },
584
585 {
586 .func = GPIOMUX_FUNC_3, /*active 7*/
587 .drv = GPIOMUX_DRV_8MA,
588 .pull = GPIOMUX_PULL_UP,
589 },
590
Kevin Chan4c58d292011-09-13 11:03:25 -0700591 {
592 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
593 .drv = GPIOMUX_DRV_2MA,
594 .pull = GPIOMUX_PULL_KEEPER,
595 },
596
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597};
598
Nishant Pandit24153d82011-08-27 16:05:13 +0530599static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700600 {
601 .gpio = 2,
602 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530603 [GPIOMUX_ACTIVE] = &cam_settings[2],
604 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700605 },
606 },
607 {
608 .gpio = 3,
609 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530610 [GPIOMUX_ACTIVE] = &cam_settings[1],
611 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700612 },
613 },
614 {
615 .gpio = 4,
616 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530617 [GPIOMUX_ACTIVE] = &cam_settings[1],
618 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700619 },
620 },
621 {
622 .gpio = 5,
623 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530624 [GPIOMUX_ACTIVE] = &cam_settings[1],
625 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700626 },
627 },
628 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530629 .gpio = 76,
630 .settings = {
631 [GPIOMUX_ACTIVE] = &cam_settings[2],
632 [GPIOMUX_SUSPENDED] = &cam_settings[0],
633 },
634 },
635 {
636 .gpio = 107,
637 .settings = {
638 [GPIOMUX_ACTIVE] = &cam_settings[2],
639 [GPIOMUX_SUSPENDED] = &cam_settings[0],
640 },
641 },
642};
643
644static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
645 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700646 .gpio = 18,
647 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530648 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700649 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700650 },
651 },
652 {
653 .gpio = 19,
654 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530655 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700656 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700657 },
658 },
659 {
660 .gpio = 20,
661 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530662 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700663 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700664 },
665 },
666 {
667 .gpio = 21,
668 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530669 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700670 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700671 },
672 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700673};
674
675static struct gpiomux_setting cyts_resout_sus_cfg = {
676 .func = GPIOMUX_FUNC_GPIO,
677 .drv = GPIOMUX_DRV_6MA,
678 .pull = GPIOMUX_PULL_UP,
679};
680
681static struct gpiomux_setting cyts_resout_act_cfg = {
682 .func = GPIOMUX_FUNC_GPIO,
683 .drv = GPIOMUX_DRV_6MA,
684 .pull = GPIOMUX_PULL_UP,
685};
686
687static struct gpiomux_setting cyts_sleep_sus_cfg = {
688 .func = GPIOMUX_FUNC_GPIO,
689 .drv = GPIOMUX_DRV_6MA,
690 .pull = GPIOMUX_PULL_DOWN,
691};
692
693static struct gpiomux_setting cyts_sleep_act_cfg = {
694 .func = GPIOMUX_FUNC_GPIO,
695 .drv = GPIOMUX_DRV_6MA,
696 .pull = GPIOMUX_PULL_DOWN,
697};
698
699static struct gpiomux_setting cyts_int_act_cfg = {
700 .func = GPIOMUX_FUNC_GPIO,
701 .drv = GPIOMUX_DRV_8MA,
702 .pull = GPIOMUX_PULL_UP,
703};
704
705static struct gpiomux_setting cyts_int_sus_cfg = {
706 .func = GPIOMUX_FUNC_GPIO,
707 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530708 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700709};
710
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700711static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
712 { /* TS INTERRUPT */
713 .gpio = 11,
714 .settings = {
715 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
716 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
717 },
718 },
719 { /* TS SLEEP */
720 .gpio = 50,
721 .settings = {
722 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
723 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
724 },
725 },
726 { /* TS RESOUT */
727 .gpio = 52,
728 .settings = {
729 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
730 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
731 },
732 },
733};
734
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530735#ifdef CONFIG_USB_EHCI_MSM_HSIC
736static struct gpiomux_setting hsic_act_cfg = {
737 .func = GPIOMUX_FUNC_1,
738 .drv = GPIOMUX_DRV_12MA,
739 .pull = GPIOMUX_PULL_NONE,
740};
741
742static struct gpiomux_setting hsic_sus_cfg = {
743 .func = GPIOMUX_FUNC_GPIO,
744 .drv = GPIOMUX_DRV_2MA,
745 .pull = GPIOMUX_PULL_DOWN,
746};
747
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530748static struct gpiomux_setting hsic_hub_act_cfg = {
749 .func = GPIOMUX_FUNC_GPIO,
750 .drv = GPIOMUX_DRV_2MA,
751 .pull = GPIOMUX_PULL_NONE,
752};
753
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530754static struct msm_gpiomux_config msm8960_hsic_configs[] = {
755 {
756 .gpio = 150, /*HSIC_STROBE */
757 .settings = {
758 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
759 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
760 },
761 },
762 {
763 .gpio = 151, /* HSIC_DATA */
764 .settings = {
765 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
766 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
767 },
768 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530769 {
770 .gpio = 91, /* HSIC_HUB_RESET */
771 .settings = {
772 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
773 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
774 },
775 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530776};
777#endif
778
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700779#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
780enum {
781 SX150X_CAM,
782};
783
Nishant Pandit474f2252011-07-23 23:17:56 +0530784static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700785 [SX150X_CAM] = {
786 .gpio_base = GPIO_CAM_EXPANDER_BASE,
787 .oscio_is_gpo = false,
788 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530789 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700790 .io_open_drain_ena = 0x0,
791 .irq_summary = -1,
792 },
793};
Nishant Pandit474f2252011-07-23 23:17:56 +0530794
795#endif
796
797#ifdef CONFIG_I2C
798
799#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
800#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300801#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530802
803#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
804
805static struct i2c_board_info cam_expander_i2c_info[] = {
806 {
807 I2C_BOARD_INFO("sx1508q", 0x22),
808 .platform_data = &sx150x_data[SX150X_CAM]
809 },
810};
811
812static struct msm_cam_expander_info cam_expander_info[] = {
813 {
814 cam_expander_i2c_info,
815 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
816 },
817};
818#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700819#endif
820
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700821#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
822#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700823#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700824#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
825#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
826#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700827#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700828#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700829
830
831#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
832#define MSM_ION_EBI_SIZE MSM_PMEM_SIZE
833#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
834#define MSM_ION_HEAP_NUM 4
835#else
836#define MSM_ION_HEAP_NUM 2
837#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700838
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700839#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
840static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
841static int __init pmem_kernel_ebi1_size_setup(char *p)
842{
843 pmem_kernel_ebi1_size = memparse(p, NULL);
844 return 0;
845}
846early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
847#endif
848
849#ifdef CONFIG_ANDROID_PMEM
850static unsigned pmem_size = MSM_PMEM_SIZE;
851static int __init pmem_size_setup(char *p)
852{
853 pmem_size = memparse(p, NULL);
854 return 0;
855}
856early_param("pmem_size", pmem_size_setup);
857
858static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
859
860static int __init pmem_adsp_size_setup(char *p)
861{
862 pmem_adsp_size = memparse(p, NULL);
863 return 0;
864}
865early_param("pmem_adsp_size", pmem_adsp_size_setup);
866
867static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
868
869static int __init pmem_audio_size_setup(char *p)
870{
871 pmem_audio_size = memparse(p, NULL);
872 return 0;
873}
874early_param("pmem_audio_size", pmem_audio_size_setup);
875#endif
876
877#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700878#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700879static struct android_pmem_platform_data android_pmem_pdata = {
880 .name = "pmem",
881 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
882 .cached = 1,
883 .memory_type = MEMTYPE_EBI1,
884};
885
886static struct platform_device android_pmem_device = {
887 .name = "android_pmem",
888 .id = 0,
889 .dev = {.platform_data = &android_pmem_pdata},
890};
891
892static struct android_pmem_platform_data android_pmem_adsp_pdata = {
893 .name = "pmem_adsp",
894 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
895 .cached = 0,
896 .memory_type = MEMTYPE_EBI1,
897};
898static struct platform_device android_pmem_adsp_device = {
899 .name = "android_pmem",
900 .id = 2,
901 .dev = { .platform_data = &android_pmem_adsp_pdata },
902};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700903#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700904
905static struct android_pmem_platform_data android_pmem_audio_pdata = {
906 .name = "pmem_audio",
907 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
908 .cached = 0,
909 .memory_type = MEMTYPE_EBI1,
910};
911
912static struct platform_device android_pmem_audio_device = {
913 .name = "android_pmem",
914 .id = 4,
915 .dev = { .platform_data = &android_pmem_audio_pdata },
916};
917#endif
918
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700919#define DSP_RAM_BASE_8960 0x8da00000
920#define DSP_RAM_SIZE_8960 0x1800000
921static int dspcrashd_pdata_8960 = 0xDEADDEAD;
922
923static struct resource resources_dspcrashd_8960[] = {
924 {
925 .name = "msm_dspcrashd",
926 .start = DSP_RAM_BASE_8960,
927 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
928 .flags = IORESOURCE_DMA,
929 },
930};
931
932struct platform_device msm_device_dspcrashd_8960 = {
933 .name = "msm_dspcrashd",
934 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
935 .resource = resources_dspcrashd_8960,
936 .dev = { .platform_data = &dspcrashd_pdata_8960 },
937};
938
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700939static struct memtype_reserve msm8960_reserve_table[] __initdata = {
940 [MEMTYPE_SMI] = {
941 },
942 [MEMTYPE_EBI0] = {
943 .flags = MEMTYPE_FLAGS_1M_ALIGN,
944 },
945 [MEMTYPE_EBI1] = {
946 .flags = MEMTYPE_FLAGS_1M_ALIGN,
947 },
948};
949
950static void __init size_pmem_devices(void)
951{
952#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700953#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700954 android_pmem_adsp_pdata.size = pmem_adsp_size;
955 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700956#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700957 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
958#endif
959}
960
961static void __init reserve_memory_for(struct android_pmem_platform_data *p)
962{
963 msm8960_reserve_table[p->memory_type].size += p->size;
964}
965
966static void __init reserve_pmem_memory(void)
967{
968#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700969#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970 reserve_memory_for(&android_pmem_adsp_pdata);
971 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700972#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700973 reserve_memory_for(&android_pmem_audio_pdata);
974 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
975#endif
976}
977
Larry Basselb4126da2011-07-18 14:31:33 -0700978static int msm8960_paddr_to_memtype(unsigned int paddr)
979{
980 return MEMTYPE_EBI1;
981}
982
Laura Abbottd6183792011-08-19 13:42:24 -0700983#ifdef CONFIG_ION_MSM
984struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700985 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700986 .heaps = {
987 {
988 .id = ION_HEAP_SYSTEM_ID,
989 .type = ION_HEAP_TYPE_SYSTEM,
990 .name = ION_KMALLOC_HEAP_NAME,
991 },
992 {
993 .id = ION_HEAP_SYSTEM_CONTIG_ID,
994 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
995 .name = ION_VMALLOC_HEAP_NAME,
996 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700997#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700998 {
999 .id = ION_HEAP_EBI_ID,
1000 .type = ION_HEAP_TYPE_CARVEOUT,
1001 .name = ION_EBI1_HEAP_NAME,
1002 .size = MSM_ION_EBI_SIZE,
1003 .memory_type = ION_EBI_TYPE,
1004 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001005 {
1006 .id = ION_HEAP_ADSP_ID,
1007 .type = ION_HEAP_TYPE_CARVEOUT,
1008 .name = ION_ADSP_HEAP_NAME,
1009 .size = MSM_ION_ADSP_SIZE,
1010 .memory_type = ION_EBI_TYPE,
1011 },
1012#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001013 }
1014};
1015
1016struct platform_device ion_dev = {
1017 .name = "ion-msm",
1018 .id = 1,
1019 .dev = { .platform_data = &ion_pdata },
1020};
1021#endif
1022
1023static void reserve_ion_memory(void)
1024{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001025#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001026 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001027 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001028#endif
1029}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001030static void __init msm8960_calculate_reserve_sizes(void)
1031{
1032 size_pmem_devices();
1033 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001034 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001035}
1036
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001037static struct reserve_info msm8960_reserve_info __initdata = {
1038 .memtype_reserve_table = msm8960_reserve_table,
1039 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1040 .paddr_to_memtype = msm8960_paddr_to_memtype,
1041};
1042
Larry Basselb4126da2011-07-18 14:31:33 -07001043static int msm8960_memory_bank_size(void)
1044{
1045 return 1<<29;
1046}
1047
1048static void __init locate_unstable_memory(void)
1049{
1050 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1051 unsigned long bank_size;
1052 unsigned long low, high;
1053
1054 bank_size = msm8960_memory_bank_size();
1055 low = meminfo.bank[0].start;
1056 high = mb->start + mb->size;
1057 low &= ~(bank_size - 1);
1058
1059 if (high - low <= bank_size)
1060 return;
1061 msm8960_reserve_info.low_unstable_address = low + bank_size;
1062 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
1063 msm8960_reserve_info.bank_size = bank_size;
1064 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1065 msm8960_reserve_info.low_unstable_address,
1066 msm8960_reserve_info.max_unstable_size,
1067 msm8960_reserve_info.bank_size);
1068}
1069
Larry Basselb830e182011-10-14 10:46:55 -07001070static void __init place_movable_zone(void)
1071{
1072 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1073 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1074 pr_info("movable zone start %lx size %lx\n",
1075 movable_reserved_start, movable_reserved_size);
1076}
1077
1078static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001079{
1080 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001081 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001082 place_movable_zone();
1083}
1084
1085static void __init msm8960_reserve(void)
1086{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001087 msm_reserve();
1088}
1089
Larry Bassela4414b12011-08-04 11:11:02 -07001090static int msm8960_change_memory_power(u64 start, u64 size,
1091 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001092{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001093 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001094}
1095
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001096#ifdef CONFIG_MSM_CAMERA
1097
Nishant Pandit24153d82011-08-27 16:05:13 +05301098static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001099 5, /*CAMIF_MCLK*/
1100 20, /*CAMIF_I2C_DATA*/
1101 21, /*CAMIF_I2C_CLK*/
1102};
1103
Nishant Pandit24153d82011-08-27 16:05:13 +05301104static struct msm_camera_gpio_conf gpio_conf = {
1105 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1106 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1107 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1108 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1109};
1110
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001111#define VFE_CAMIF_TIMER1_GPIO 2
1112#define VFE_CAMIF_TIMER2_GPIO 3
1113#define VFE_CAMIF_TIMER3_GPIO_INT 4
1114struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1115 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1116 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1117 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1118 .flash_recharge_duration = 50000,
1119 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1120};
1121
Nishant Pandit474f2252011-07-23 23:17:56 +05301122#ifdef CONFIG_MSM_CAMERA_FLASH
1123static struct msm_camera_sensor_flash_src msm_flash_src = {
1124 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1125 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1126 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1127#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1128 defined(CONFIG_GPIO_SX150X_MODULE))
1129 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1130#endif
1131};
1132#endif
1133
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001134static struct msm_bus_vectors cam_init_vectors[] = {
1135 {
1136 .src = MSM_BUS_MASTER_VFE,
1137 .dst = MSM_BUS_SLAVE_EBI_CH0,
1138 .ab = 0,
1139 .ib = 0,
1140 },
1141 {
1142 .src = MSM_BUS_MASTER_VPE,
1143 .dst = MSM_BUS_SLAVE_EBI_CH0,
1144 .ab = 0,
1145 .ib = 0,
1146 },
1147 {
1148 .src = MSM_BUS_MASTER_JPEG_ENC,
1149 .dst = MSM_BUS_SLAVE_EBI_CH0,
1150 .ab = 0,
1151 .ib = 0,
1152 },
1153};
1154
1155static struct msm_bus_vectors cam_preview_vectors[] = {
1156 {
1157 .src = MSM_BUS_MASTER_VFE,
1158 .dst = MSM_BUS_SLAVE_EBI_CH0,
1159 .ab = 27648000,
1160 .ib = 110592000,
1161 },
1162 {
1163 .src = MSM_BUS_MASTER_VPE,
1164 .dst = MSM_BUS_SLAVE_EBI_CH0,
1165 .ab = 0,
1166 .ib = 0,
1167 },
1168 {
1169 .src = MSM_BUS_MASTER_JPEG_ENC,
1170 .dst = MSM_BUS_SLAVE_EBI_CH0,
1171 .ab = 0,
1172 .ib = 0,
1173 },
1174};
1175
1176static struct msm_bus_vectors cam_video_vectors[] = {
1177 {
1178 .src = MSM_BUS_MASTER_VFE,
1179 .dst = MSM_BUS_SLAVE_EBI_CH0,
1180 .ab = 140451840,
1181 .ib = 561807360,
1182 },
1183 {
1184 .src = MSM_BUS_MASTER_VPE,
1185 .dst = MSM_BUS_SLAVE_EBI_CH0,
1186 .ab = 206807040,
1187 .ib = 488816640,
1188 },
1189 {
1190 .src = MSM_BUS_MASTER_JPEG_ENC,
1191 .dst = MSM_BUS_SLAVE_EBI_CH0,
1192 .ab = 0,
1193 .ib = 0,
1194 },
1195};
1196
1197static struct msm_bus_vectors cam_snapshot_vectors[] = {
1198 {
1199 .src = MSM_BUS_MASTER_VFE,
1200 .dst = MSM_BUS_SLAVE_EBI_CH0,
1201 .ab = 274423680,
1202 .ib = 1097694720,
1203 },
1204 {
1205 .src = MSM_BUS_MASTER_VPE,
1206 .dst = MSM_BUS_SLAVE_EBI_CH0,
1207 .ab = 0,
1208 .ib = 0,
1209 },
1210 {
1211 .src = MSM_BUS_MASTER_JPEG_ENC,
1212 .dst = MSM_BUS_SLAVE_EBI_CH0,
1213 .ab = 540000000,
1214 .ib = 1350000000,
1215 },
1216};
1217
1218static struct msm_bus_vectors cam_zsl_vectors[] = {
1219 {
1220 .src = MSM_BUS_MASTER_VFE,
1221 .dst = MSM_BUS_SLAVE_EBI_CH0,
1222 .ab = 302071680,
1223 .ib = 1208286720,
1224 },
1225 {
1226 .src = MSM_BUS_MASTER_VPE,
1227 .dst = MSM_BUS_SLAVE_EBI_CH0,
1228 .ab = 0,
1229 .ib = 0,
1230 },
1231 {
1232 .src = MSM_BUS_MASTER_JPEG_ENC,
1233 .dst = MSM_BUS_SLAVE_EBI_CH0,
1234 .ab = 540000000,
1235 .ib = 1350000000,
1236 },
1237};
1238
1239static struct msm_bus_paths cam_bus_client_config[] = {
1240 {
1241 ARRAY_SIZE(cam_init_vectors),
1242 cam_init_vectors,
1243 },
1244 {
1245 ARRAY_SIZE(cam_preview_vectors),
1246 cam_preview_vectors,
1247 },
1248 {
1249 ARRAY_SIZE(cam_video_vectors),
1250 cam_video_vectors,
1251 },
1252 {
1253 ARRAY_SIZE(cam_snapshot_vectors),
1254 cam_snapshot_vectors,
1255 },
1256 {
1257 ARRAY_SIZE(cam_zsl_vectors),
1258 cam_zsl_vectors,
1259 },
1260};
1261
1262static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1263 cam_bus_client_config,
1264 ARRAY_SIZE(cam_bus_client_config),
1265 .name = "msm_camera",
1266};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001267
Nishant Pandit24153d82011-08-27 16:05:13 +05301268struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1269 {
1270 .ioclk.mclk_clk_rate = 24000000,
1271 .ioclk.vfe_clk_rate = 228570000,
1272 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001273 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301274 },
1275 {
1276 .ioclk.mclk_clk_rate = 24000000,
1277 .ioclk.vfe_clk_rate = 228570000,
1278 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001279 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301280 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001281};
1282
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001283#ifdef CONFIG_IMX074_ACT
1284static struct i2c_board_info imx074_actuator_i2c_info = {
1285 I2C_BOARD_INFO("imx074_act", 0x11),
1286};
1287
1288static struct msm_actuator_info imx074_actuator_info = {
1289 .board_info = &imx074_actuator_i2c_info,
1290 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1291 .vcm_pwd = 0,
1292 .vcm_enable = 1,
1293};
1294#endif
1295
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001296#ifdef CONFIG_IMX074
1297static struct msm_camera_sensor_flash_data flash_imx074 = {
1298 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301299#ifdef CONFIG_MSM_CAMERA_FLASH
1300 .flash_src = &msm_flash_src
1301#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302};
1303
Nishant Pandit24153d82011-08-27 16:05:13 +05301304static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1305 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306 .sensor_reset = 107,
1307 .sensor_pwd = 85,
1308 .vcm_pwd = 0,
1309 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301310};
1311
1312static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1313 .sensor_name = "imx074",
1314 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001315 .flash_data = &flash_imx074,
1316 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301317 .sensor_platform_info = &sensor_board_info_imx074,
1318 .gpio_conf = &gpio_conf,
1319 .csi_if = 1,
1320 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001321#ifdef CONFIG_IMX074_ACT
1322 .actuator_info = &imx074_actuator_info
1323#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001324};
1325
1326struct platform_device msm8960_camera_sensor_imx074 = {
1327 .name = "msm_camera_imx074",
1328 .dev = {
1329 .platform_data = &msm_camera_sensor_imx074_data,
1330 },
1331};
1332#endif
1333#ifdef CONFIG_OV2720
1334static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001335 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001336};
1337
Nishant Pandit24153d82011-08-27 16:05:13 +05301338static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1339 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001340 .sensor_reset = 76,
1341 .sensor_pwd = 85,
1342 .vcm_pwd = 0,
1343 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301344};
1345
1346static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1347 .sensor_name = "ov2720",
1348 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001349 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301350 .sensor_platform_info = &sensor_board_info_ov2720,
1351 .gpio_conf = &gpio_conf,
1352 .csi_if = 1,
1353 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001354};
1355
1356struct platform_device msm8960_camera_sensor_ov2720 = {
1357 .name = "msm_camera_ov2720",
1358 .dev = {
1359 .platform_data = &msm_camera_sensor_ov2720_data,
1360 },
1361};
1362#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001363
1364static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1365 .flash_type = MSM_CAMERA_FLASH_LED,
1366};
1367
Nishant Pandit24153d82011-08-27 16:05:13 +05301368static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1369 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001370 .sensor_reset = 107,
1371 .sensor_pwd = 85,
1372 .vcm_pwd = 0,
1373 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301374};
1375
1376static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1377 .sensor_name = "qs_mt9p017",
1378 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001379 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301380 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1381 .gpio_conf = &gpio_conf,
1382 .csi_if = 1,
1383 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001384};
1385
1386struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1387 .name = "msm_camera_qs_mt9p017",
1388 .dev = {
1389 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1390 },
1391};
1392
Kevin Chan8b0d2322011-09-10 21:06:31 -07001393static struct msm8960_privacy_light_cfg privacy_light_info = {
1394 .mpp = PM8921_MPP_PM_TO_SYS(12),
1395};
1396
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001397static void __init msm8960_init_cam(void)
1398{
1399 int i;
1400 struct platform_device *cam_dev[] = {
1401 &msm8960_camera_sensor_imx074,
1402 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001403 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001404 };
1405
Kevin Chan8b0d2322011-09-10 21:06:31 -07001406 if (machine_is_msm8960_liquid()) {
1407 struct msm_camera_sensor_info *s_info;
1408 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1409 s_info->sensor_platform_info->mount_angle = 180;
1410 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1411 s_info->sensor_platform_info->privacy_light = 1;
1412 s_info->sensor_platform_info->privacy_light_info =
1413 &privacy_light_info;
1414 }
1415
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001416 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1417 struct msm_camera_sensor_info *s_info;
1418 s_info = cam_dev[i]->dev.platform_data;
1419 msm_get_cam_resources(s_info);
1420 platform_device_register(cam_dev[i]);
1421 }
Kevin Chanf6216f22011-10-25 18:40:11 -07001422
1423 platform_device_register(&msm8960_device_csiphy0);
1424 platform_device_register(&msm8960_device_csiphy1);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001425}
1426#endif
1427
1428#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001429#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001430#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001431#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001432#endif
1433
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001434
1435#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001436#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001437#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001438#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1439#else
1440#define MSM_FB_EXT_BUF_SIZE 0
1441#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001442
kuogee hsieh3830eb92011-09-12 15:25:57 -07001443#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1444/* width x height x 3 bpp x 2 frame buffer */
1445#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1446#define MSM_FB_WRITEBACK_OFFSET \
1447 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1448#else
1449#define MSM_FB_WRITEBACK_SIZE 0
1450#define MSM_FB_WRITEBACK_OFFSET 0
1451#endif
1452
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001453#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1454/* 4 bpp x 2 page HDMI case */
1455#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1456#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001457/* Note: must be multiple of 4096 */
1458#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1459 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001460#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001461
1462static int writeback_offset(void)
1463{
1464 return MSM_FB_WRITEBACK_OFFSET;
1465}
1466
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001467
1468#define MDP_VSYNC_GPIO 0
1469
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001470#define PANEL_NAME_MAX_LEN 30
1471#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1472#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1473#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1474#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1475#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1476#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1477#define HDMI_PANEL_NAME "hdmi_msm"
1478#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001479
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001480static struct resource msm_fb_resources[] = {
1481 {
1482 .flags = IORESOURCE_DMA,
1483 }
1484};
1485
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001486static int msm_fb_detect_panel(const char *name)
1487{
1488 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001489 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1490 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1491 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001492 return 0;
1493 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001494 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1495 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1496 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001497 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001498
1499#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1500 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1501 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1502 PANEL_NAME_MAX_LEN)))
1503 return 0;
1504
1505 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1506 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1507 PANEL_NAME_MAX_LEN)))
1508 return 0;
1509
1510 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1511 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1512 PANEL_NAME_MAX_LEN)))
1513 return 0;
1514
1515 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1516 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1517 PANEL_NAME_MAX_LEN)))
1518 return 0;
1519#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001520 }
1521
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001522 if (!strncmp(name, HDMI_PANEL_NAME,
1523 strnlen(HDMI_PANEL_NAME,
1524 PANEL_NAME_MAX_LEN)))
1525 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001526
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001527 if (!strncmp(name, TVOUT_PANEL_NAME,
1528 strnlen(TVOUT_PANEL_NAME,
1529 PANEL_NAME_MAX_LEN)))
1530 return 0;
1531
1532 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001533 return -ENODEV;
1534}
1535
1536static struct msm_fb_platform_data msm_fb_pdata = {
1537 .detect_client = msm_fb_detect_panel,
1538};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001539
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001540static struct platform_device msm_fb_device = {
1541 .name = "msm_fb",
1542 .id = 0,
1543 .num_resources = ARRAY_SIZE(msm_fb_resources),
1544 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001545 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001546};
1547
1548static bool dsi_power_on;
1549
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001550/**
1551 * LiQUID panel on/off
1552 *
1553 * @param on
1554 *
1555 * @return int
1556 */
1557static int mipi_dsi_liquid_panel_power(int on)
1558{
1559 static struct regulator *reg_l2, *reg_ext_3p3v;
1560 static int gpio21, gpio24, gpio43;
1561 int rc;
1562
1563 pr_info("%s: on=%d\n", __func__, on);
1564
1565 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1566 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1567 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1568
1569 if (!dsi_power_on) {
1570
1571 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1572 "dsi_vdda");
1573 if (IS_ERR(reg_l2)) {
1574 pr_err("could not get 8921_l2, rc = %ld\n",
1575 PTR_ERR(reg_l2));
1576 return -ENODEV;
1577 }
1578
1579 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1580 if (rc) {
1581 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1582 return -EINVAL;
1583 }
1584
1585 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1586 "vdd_lvds_3p3v");
1587 if (IS_ERR(reg_ext_3p3v)) {
1588 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1589 PTR_ERR(reg_ext_3p3v));
1590 return -ENODEV;
1591 }
1592
1593 rc = gpio_request(gpio21, "disp_pwr_en_n");
1594 if (rc) {
1595 pr_err("request gpio 21 failed, rc=%d\n", rc);
1596 return -ENODEV;
1597 }
1598
1599 rc = gpio_request(gpio43, "disp_rst_n");
1600 if (rc) {
1601 pr_err("request gpio 43 failed, rc=%d\n", rc);
1602 return -ENODEV;
1603 }
1604
1605 rc = gpio_request(gpio24, "disp_backlight_pwm");
1606 if (rc) {
1607 pr_err("request gpio 24 failed, rc=%d\n", rc);
1608 return -ENODEV;
1609 }
1610
1611 dsi_power_on = true;
1612 }
1613
1614 if (on) {
1615 rc = regulator_set_optimum_mode(reg_l2, 100000);
1616 if (rc < 0) {
1617 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1618 return -EINVAL;
1619 }
1620 rc = regulator_enable(reg_l2);
1621 if (rc) {
1622 pr_err("enable l2 failed, rc=%d\n", rc);
1623 return -ENODEV;
1624 }
1625
1626 rc = regulator_enable(reg_ext_3p3v);
1627 if (rc) {
1628 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1629 return -ENODEV;
1630 }
1631
1632 /* set reset pin before power enable */
1633 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1634
1635 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1636 msleep(20);
1637 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1638 msleep(20);
1639 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1640 msleep(20);
1641 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1642 msleep(20);
1643 } else {
1644 gpio_set_value_cansleep(gpio43, 0);
1645 gpio_set_value_cansleep(gpio21, 1);
1646
1647 rc = regulator_disable(reg_l2);
1648 if (rc) {
1649 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1650 return -ENODEV;
1651 }
1652 rc = regulator_disable(reg_ext_3p3v);
1653 if (rc) {
1654 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1655 return -ENODEV;
1656 }
1657 rc = regulator_set_optimum_mode(reg_l2, 100);
1658 if (rc < 0) {
1659 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1660 return -EINVAL;
1661 }
1662 }
1663
1664 return 0;
1665}
1666
1667static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001668{
1669 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001670 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001671 int rc;
1672
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001673 pr_info("%s: state : %d\n", __func__, on);
1674
1675 if (!dsi_power_on) {
1676
1677 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1678 "dsi_vdc");
1679 if (IS_ERR(reg_l8)) {
1680 pr_err("could not get 8921_l8, rc = %ld\n",
1681 PTR_ERR(reg_l8));
1682 return -ENODEV;
1683 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001684 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1685 "dsi_vddio");
1686 if (IS_ERR(reg_l23)) {
1687 pr_err("could not get 8921_l23, rc = %ld\n",
1688 PTR_ERR(reg_l23));
1689 return -ENODEV;
1690 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001691 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1692 "dsi_vdda");
1693 if (IS_ERR(reg_l2)) {
1694 pr_err("could not get 8921_l2, rc = %ld\n",
1695 PTR_ERR(reg_l2));
1696 return -ENODEV;
1697 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1699 if (rc) {
1700 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1701 return -EINVAL;
1702 }
1703 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1704 if (rc) {
1705 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1706 return -EINVAL;
1707 }
1708 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1709 if (rc) {
1710 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1711 return -EINVAL;
1712 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001713 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1714 rc = gpio_request(gpio43, "disp_rst_n");
1715 if (rc) {
1716 pr_err("request gpio 43 failed, rc=%d\n", rc);
1717 return -ENODEV;
1718 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001719 dsi_power_on = true;
1720 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001721 if (on) {
1722 rc = regulator_set_optimum_mode(reg_l8, 100000);
1723 if (rc < 0) {
1724 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1725 return -EINVAL;
1726 }
1727 rc = regulator_set_optimum_mode(reg_l23, 100000);
1728 if (rc < 0) {
1729 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1730 return -EINVAL;
1731 }
1732 rc = regulator_set_optimum_mode(reg_l2, 100000);
1733 if (rc < 0) {
1734 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1735 return -EINVAL;
1736 }
1737 rc = regulator_enable(reg_l8);
1738 if (rc) {
1739 pr_err("enable l8 failed, rc=%d\n", rc);
1740 return -ENODEV;
1741 }
1742 rc = regulator_enable(reg_l23);
1743 if (rc) {
1744 pr_err("enable l8 failed, rc=%d\n", rc);
1745 return -ENODEV;
1746 }
1747 rc = regulator_enable(reg_l2);
1748 if (rc) {
1749 pr_err("enable l2 failed, rc=%d\n", rc);
1750 return -ENODEV;
1751 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001752 gpio_set_value_cansleep(gpio43, 1);
1753 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001754 rc = regulator_disable(reg_l2);
1755 if (rc) {
1756 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1757 return -ENODEV;
1758 }
1759 rc = regulator_disable(reg_l8);
1760 if (rc) {
1761 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1762 return -ENODEV;
1763 }
1764 rc = regulator_disable(reg_l23);
1765 if (rc) {
1766 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1767 return -ENODEV;
1768 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001769 rc = regulator_set_optimum_mode(reg_l8, 100);
1770 if (rc < 0) {
1771 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1772 return -EINVAL;
1773 }
1774 rc = regulator_set_optimum_mode(reg_l23, 100);
1775 if (rc < 0) {
1776 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1777 return -EINVAL;
1778 }
1779 rc = regulator_set_optimum_mode(reg_l2, 100);
1780 if (rc < 0) {
1781 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1782 return -EINVAL;
1783 }
1784 gpio_set_value_cansleep(gpio43, 0);
1785 }
1786 return 0;
1787}
1788
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001789static int mipi_dsi_panel_power(int on)
1790{
1791 int ret;
1792
1793 pr_info("%s: on=%d\n", __func__, on);
1794
1795 if (machine_is_msm8960_liquid())
1796 ret = mipi_dsi_liquid_panel_power(on);
1797 else
1798 ret = mipi_dsi_cdp_panel_power(on);
1799
1800 return ret;
1801}
1802
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001803static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1804 .vsync_gpio = MDP_VSYNC_GPIO,
1805 .dsi_power_save = mipi_dsi_panel_power,
1806};
1807
1808#ifdef CONFIG_MSM_BUS_SCALING
1809
1810static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001811 {
1812 .src = MSM_BUS_MASTER_MDP_PORT0,
1813 .dst = MSM_BUS_SLAVE_EBI_CH0,
1814 .ab = 0,
1815 .ib = 0,
1816 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001817};
1818
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001819#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1820static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1821 /* If HDMI is used as primary */
1822 {
1823 .src = MSM_BUS_MASTER_MDP_PORT0,
1824 .dst = MSM_BUS_SLAVE_EBI_CH0,
1825 .ab = 2000000000,
1826 .ib = 2000000000,
1827 },
1828};
1829static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1830 {
1831 ARRAY_SIZE(mdp_init_vectors),
1832 mdp_init_vectors,
1833 },
1834 {
1835 ARRAY_SIZE(hdmi_as_primary_vectors),
1836 hdmi_as_primary_vectors,
1837 },
1838 {
1839 ARRAY_SIZE(hdmi_as_primary_vectors),
1840 hdmi_as_primary_vectors,
1841 },
1842 {
1843 ARRAY_SIZE(hdmi_as_primary_vectors),
1844 hdmi_as_primary_vectors,
1845 },
1846 {
1847 ARRAY_SIZE(hdmi_as_primary_vectors),
1848 hdmi_as_primary_vectors,
1849 },
1850 {
1851 ARRAY_SIZE(hdmi_as_primary_vectors),
1852 hdmi_as_primary_vectors,
1853 },
1854};
1855#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001856static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001857 {
1858 .src = MSM_BUS_MASTER_MDP_PORT0,
1859 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001860 .ab = 216000000 * 2,
1861 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001862 },
1863};
1864
1865static struct msm_bus_vectors mdp_vga_vectors[] = {
1866 /* VGA and less video */
1867 {
1868 .src = MSM_BUS_MASTER_MDP_PORT0,
1869 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001870 .ab = 216000000 * 2,
1871 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001872 },
1873};
1874
1875static struct msm_bus_vectors mdp_720p_vectors[] = {
1876 /* 720p and less video */
1877 {
1878 .src = MSM_BUS_MASTER_MDP_PORT0,
1879 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001880 .ab = 230400000 * 2,
1881 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001882 },
1883};
1884
1885static struct msm_bus_vectors mdp_1080p_vectors[] = {
1886 /* 1080p and less video */
1887 {
1888 .src = MSM_BUS_MASTER_MDP_PORT0,
1889 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001890 .ab = 334080000 * 2,
1891 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001892 },
1893};
1894
1895static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1896 {
1897 ARRAY_SIZE(mdp_init_vectors),
1898 mdp_init_vectors,
1899 },
1900 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001901 ARRAY_SIZE(mdp_ui_vectors),
1902 mdp_ui_vectors,
1903 },
1904 {
1905 ARRAY_SIZE(mdp_ui_vectors),
1906 mdp_ui_vectors,
1907 },
1908 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001909 ARRAY_SIZE(mdp_vga_vectors),
1910 mdp_vga_vectors,
1911 },
1912 {
1913 ARRAY_SIZE(mdp_720p_vectors),
1914 mdp_720p_vectors,
1915 },
1916 {
1917 ARRAY_SIZE(mdp_1080p_vectors),
1918 mdp_1080p_vectors,
1919 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001920};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001921#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001922
1923static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1924 mdp_bus_scale_usecases,
1925 ARRAY_SIZE(mdp_bus_scale_usecases),
1926 .name = "mdp",
1927};
1928
1929#endif
1930
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001931#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1932int mdp_core_clk_rate_table[] = {
1933 200000000,
1934 200000000,
1935 200000000,
1936 200000000,
1937};
1938#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001939int mdp_core_clk_rate_table[] = {
1940 85330000,
1941 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001942 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001943 200000000,
1944};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001945#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001946
1947static struct msm_panel_common_pdata mdp_pdata = {
1948 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001949#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1950 .mdp_core_clk_rate = 200000000,
1951#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001952 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001953#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001954 .mdp_core_clk_table = mdp_core_clk_rate_table,
1955 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1956#ifdef CONFIG_MSM_BUS_SCALING
1957 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1958#endif
1959 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001960 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001961};
1962
1963static struct platform_device mipi_dsi_renesas_panel_device = {
1964 .name = "mipi_renesas",
1965 .id = 0,
1966};
1967
1968static struct platform_device mipi_dsi_simulator_panel_device = {
1969 .name = "mipi_simulator",
1970 .id = 0,
1971};
1972
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001973#define LPM_CHANNEL0 0
1974static int toshiba_gpio[] = {LPM_CHANNEL0};
1975
1976static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1977 .gpio = toshiba_gpio,
1978};
1979
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001980static struct platform_device mipi_dsi_toshiba_panel_device = {
1981 .name = "mipi_toshiba",
1982 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001983 .dev = {
1984 .platform_data = &toshiba_pdata,
1985 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001986};
1987
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001988#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001989static int dsi2lvds_gpio[2] = {
1990 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1991 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1992 };
1993
1994static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1995 .gpio_num = dsi2lvds_gpio,
1996};
1997
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001998static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1999
2000/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
2001 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
2002 /* timing */
2003 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2004 0x0c, 0x03, 0x04, 0xa0},
2005 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2006 {0xff, 0x00, 0x06, 0x00}, /* strength */
2007 /* pll control */
2008 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2009 0x40, 0x07, 0x03,
2010 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2011};
2012
2013static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002014 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2015 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002016 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2017};
2018
2019static struct platform_device mipi_dsi_novatek_panel_device = {
2020 .name = "mipi_novatek",
2021 .id = 0,
2022 .dev = {
2023 .platform_data = &novatek_pdata,
2024 }
2025};
2026
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002027static struct platform_device mipi_dsi2lvds_bridge_device = {
2028 .name = "mipi_tc358764",
2029 .id = 0,
2030 .dev.platform_data = &mipi_dsi2lvds_pdata,
2031};
2032
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002033#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2034static struct resource hdmi_msm_resources[] = {
2035 {
2036 .name = "hdmi_msm_qfprom_addr",
2037 .start = 0x00700000,
2038 .end = 0x007060FF,
2039 .flags = IORESOURCE_MEM,
2040 },
2041 {
2042 .name = "hdmi_msm_hdmi_addr",
2043 .start = 0x04A00000,
2044 .end = 0x04A00FFF,
2045 .flags = IORESOURCE_MEM,
2046 },
2047 {
2048 .name = "hdmi_msm_irq",
2049 .start = HDMI_IRQ,
2050 .end = HDMI_IRQ,
2051 .flags = IORESOURCE_IRQ,
2052 },
2053};
2054
2055static int hdmi_enable_5v(int on);
2056static int hdmi_core_power(int on, int show);
2057static int hdmi_cec_power(int on);
2058
2059static struct msm_hdmi_platform_data hdmi_msm_data = {
2060 .irq = HDMI_IRQ,
2061 .enable_5v = hdmi_enable_5v,
2062 .core_power = hdmi_core_power,
2063 .cec_power = hdmi_cec_power,
2064};
2065
2066static struct platform_device hdmi_msm_device = {
2067 .name = "hdmi_msm",
2068 .id = 0,
2069 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2070 .resource = hdmi_msm_resources,
2071 .dev.platform_data = &hdmi_msm_data,
2072};
2073#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2074
Vinay Kalia291263e2011-11-01 17:07:05 -07002075#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2076static struct platform_device wfd_panel_device = {
2077 .name = "wfd_panel",
2078 .id = 0,
2079 .dev.platform_data = NULL,
2080};
2081#endif
2082
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002083#ifdef CONFIG_MSM_BUS_SCALING
2084static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2085 {
2086 .src = MSM_BUS_MASTER_MDP_PORT0,
2087 .dst = MSM_BUS_SLAVE_EBI_CH0,
2088 .ab = 0,
2089 .ib = 0,
2090 },
2091};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002092
2093#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2094static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2095 {
2096 .src = MSM_BUS_MASTER_MDP_PORT0,
2097 .dst = MSM_BUS_SLAVE_EBI_CH0,
2098 .ab = 2000000000,
2099 .ib = 2000000000,
2100 },
2101};
2102#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002103static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2104 {
2105 .src = MSM_BUS_MASTER_MDP_PORT0,
2106 .dst = MSM_BUS_SLAVE_EBI_CH0,
2107 .ab = 566092800 * 2,
2108 .ib = 707616000 * 2,
2109 },
2110};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002111#endif
2112
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002113static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2114 {
2115 ARRAY_SIZE(dtv_bus_init_vectors),
2116 dtv_bus_init_vectors,
2117 },
2118 {
2119 ARRAY_SIZE(dtv_bus_def_vectors),
2120 dtv_bus_def_vectors,
2121 },
2122};
2123static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2124 dtv_bus_scale_usecases,
2125 ARRAY_SIZE(dtv_bus_scale_usecases),
2126 .name = "dtv",
2127};
2128
2129static struct lcdc_platform_data dtv_pdata = {
2130 .bus_scale_table = &dtv_bus_scale_pdata,
2131};
2132#endif
2133
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002134static void __init msm_fb_add_devices(void)
2135{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002136 struct platform_device *ptr = NULL;
2137
2138 if (machine_is_msm8960_liquid())
2139 ptr = &mipi_dsi2lvds_bridge_device;
2140 else
2141 ptr = &mipi_dsi_toshiba_panel_device;
2142 platform_add_devices(&ptr, 1);
2143
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002144 if (machine_is_msm8x60_rumi3()) {
2145 msm_fb_register_device("mdp", NULL);
2146 mipi_dsi_pdata.target_type = 1;
2147 } else
2148 msm_fb_register_device("mdp", &mdp_pdata);
2149 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002150#ifdef CONFIG_MSM_BUS_SCALING
2151 msm_fb_register_device("dtv", &dtv_pdata);
2152#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002153}
2154
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002155static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2156 .func = GPIOMUX_FUNC_GPIO,
2157 .drv = GPIOMUX_DRV_2MA,
2158 .pull = GPIOMUX_PULL_DOWN,
2159};
2160
2161static struct gpiomux_setting mdp_vsync_active_cfg = {
2162 .func = GPIOMUX_FUNC_1,
2163 .drv = GPIOMUX_DRV_2MA,
2164 .pull = GPIOMUX_PULL_DOWN,
2165};
2166
2167static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2168 {
2169 .gpio = MDP_VSYNC_GPIO,
2170 .settings = {
2171 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2172 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2173 },
2174 }
2175};
2176
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002177#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2178static struct gpiomux_setting hdmi_suspend_cfg = {
2179 .func = GPIOMUX_FUNC_GPIO,
2180 .drv = GPIOMUX_DRV_2MA,
2181 .pull = GPIOMUX_PULL_DOWN,
2182};
2183
2184static struct gpiomux_setting hdmi_active_1_cfg = {
2185 .func = GPIOMUX_FUNC_1,
2186 .drv = GPIOMUX_DRV_2MA,
2187 .pull = GPIOMUX_PULL_UP,
2188};
2189
2190static struct gpiomux_setting hdmi_active_2_cfg = {
2191 .func = GPIOMUX_FUNC_1,
2192 .drv = GPIOMUX_DRV_2MA,
2193 .pull = GPIOMUX_PULL_DOWN,
2194};
2195
2196static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2197 {
2198 .gpio = 99,
2199 .settings = {
2200 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2201 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2202 },
2203 },
2204 {
2205 .gpio = 100,
2206 .settings = {
2207 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2208 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2209 },
2210 },
2211 {
2212 .gpio = 101,
2213 .settings = {
2214 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2215 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2216 },
2217 },
2218 {
2219 .gpio = 102,
2220 .settings = {
2221 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2222 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2223 },
2224 },
2225};
2226
2227static int hdmi_enable_5v(int on)
2228{
2229 /* TBD: PM8921 regulator instead of 8901 */
2230 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2231 static int prev_on;
2232 int rc;
2233
2234 if (on == prev_on)
2235 return 0;
2236
2237 if (!reg_8921_hdmi_mvs)
2238 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2239 "hdmi_mvs");
2240
2241 if (on) {
2242 rc = regulator_enable(reg_8921_hdmi_mvs);
2243 if (rc) {
2244 pr_err("'%s' regulator enable failed, rc=%d\n",
2245 "8921_hdmi_mvs", rc);
2246 return rc;
2247 }
2248 pr_debug("%s(on): success\n", __func__);
2249 } else {
2250 rc = regulator_disable(reg_8921_hdmi_mvs);
2251 if (rc)
2252 pr_warning("'%s' regulator disable failed, rc=%d\n",
2253 "8921_hdmi_mvs", rc);
2254 pr_debug("%s(off): success\n", __func__);
2255 }
2256
2257 prev_on = on;
2258
2259 return 0;
2260}
2261
2262static int hdmi_core_power(int on, int show)
2263{
2264 static struct regulator *reg_8921_l23, *reg_8921_s4;
2265 static int prev_on;
2266 int rc;
2267
2268 if (on == prev_on)
2269 return 0;
2270
2271 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002272 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002273 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002274 if (IS_ERR(reg_8921_l23)) {
2275 pr_err("could not get reg_8921_l23, rc = %ld\n",
2276 PTR_ERR(reg_8921_l23));
2277 return -ENODEV;
2278 }
2279 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2280 if (rc) {
2281 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2282 return -EINVAL;
2283 }
2284 }
2285 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002286 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002287 if (IS_ERR(reg_8921_s4)) {
2288 pr_err("could not get reg_8921_s4, rc = %ld\n",
2289 PTR_ERR(reg_8921_s4));
2290 return -ENODEV;
2291 }
2292 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2293 if (rc) {
2294 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2295 return -EINVAL;
2296 }
2297 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002298
2299 if (on) {
2300 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2301 if (rc < 0) {
2302 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2303 return -EINVAL;
2304 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002305 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002306 if (rc) {
2307 pr_err("'%s' regulator enable failed, rc=%d\n",
2308 "hdmi_avdd", rc);
2309 return rc;
2310 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002311 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002312 if (rc) {
2313 pr_err("'%s' regulator enable failed, rc=%d\n",
2314 "hdmi_vcc", rc);
2315 return rc;
2316 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002317 rc = gpio_request(100, "HDMI_DDC_CLK");
2318 if (rc) {
2319 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2320 "HDMI_DDC_CLK", 100, rc);
2321 goto error1;
2322 }
2323 rc = gpio_request(101, "HDMI_DDC_DATA");
2324 if (rc) {
2325 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2326 "HDMI_DDC_DATA", 101, rc);
2327 goto error2;
2328 }
2329 rc = gpio_request(102, "HDMI_HPD");
2330 if (rc) {
2331 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2332 "HDMI_HPD", 102, rc);
2333 goto error3;
2334 }
2335 pr_debug("%s(on): success\n", __func__);
2336 } else {
2337 gpio_free(100);
2338 gpio_free(101);
2339 gpio_free(102);
2340
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002341 rc = regulator_disable(reg_8921_l23);
2342 if (rc) {
2343 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2344 return -ENODEV;
2345 }
2346 rc = regulator_disable(reg_8921_s4);
2347 if (rc) {
2348 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2349 return -ENODEV;
2350 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002351 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2352 if (rc < 0) {
2353 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2354 return -EINVAL;
2355 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002356 pr_debug("%s(off): success\n", __func__);
2357 }
2358
2359 prev_on = on;
2360
2361 return 0;
2362
2363error3:
2364 gpio_free(101);
2365error2:
2366 gpio_free(100);
2367error1:
2368 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002369 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002370 return rc;
2371}
2372
2373static int hdmi_cec_power(int on)
2374{
2375 static int prev_on;
2376 int rc;
2377
2378 if (on == prev_on)
2379 return 0;
2380
2381 if (on) {
2382 rc = gpio_request(99, "HDMI_CEC_VAR");
2383 if (rc) {
2384 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2385 "HDMI_CEC_VAR", 99, rc);
2386 goto error;
2387 }
2388 pr_debug("%s(on): success\n", __func__);
2389 } else {
2390 gpio_free(99);
2391 pr_debug("%s(off): success\n", __func__);
2392 }
2393
2394 prev_on = on;
2395
2396 return 0;
2397error:
2398 return rc;
2399}
2400#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2401
2402static void __init msm8960_allocate_memory_regions(void)
2403{
2404 void *addr;
2405 unsigned long size;
2406
2407 size = MSM_FB_SIZE;
2408 addr = alloc_bootmem_align(size, 0x1000);
2409 msm_fb_resources[0].start = __pa(addr);
2410 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2411 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2412 size, addr, __pa(addr));
2413
2414}
2415#ifdef CONFIG_WCD9310_CODEC
2416
2417#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2418
Patrick Lai3043fba2011-08-01 14:15:57 -07002419/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2420 * 4 micbiases are used to power various analog and digital
2421 * microphones operating at 1800 mV. Technically, all micbiases
2422 * can source from single cfilter since all microphones operate
2423 * at the same voltage level. The arrangement below is to make
2424 * sure all cfilters are exercised. LDO_H regulator ouput level
2425 * does not need to be as high as 2.85V. It is choosen for
2426 * microphone sensitivity purpose.
2427 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002428static struct tabla_pdata tabla_platform_data = {
2429 .slimbus_slave_device = {
2430 .name = "tabla-slave",
2431 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2432 },
2433 .irq = MSM_GPIO_TO_INT(62),
2434 .irq_base = TABLA_INTERRUPT_BASE,
2435 .num_irqs = NR_TABLA_IRQS,
2436 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002437 .micbias = {
2438 .ldoh_v = TABLA_LDOH_2P85_V,
2439 .cfilt1_mv = 1800,
2440 .cfilt2_mv = 1800,
2441 .cfilt3_mv = 1800,
2442 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2443 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2444 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2445 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2446 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002447};
2448
2449static struct slim_device msm_slim_tabla = {
2450 .name = "tabla-slim",
2451 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2452 .dev = {
2453 .platform_data = &tabla_platform_data,
2454 },
2455};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302456
2457static struct tabla_pdata tabla20_platform_data = {
2458 .slimbus_slave_device = {
2459 .name = "tabla-slave",
2460 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2461 },
2462 .irq = MSM_GPIO_TO_INT(62),
2463 .irq_base = TABLA_INTERRUPT_BASE,
2464 .num_irqs = NR_TABLA_IRQS,
2465 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2466 .micbias = {
2467 .ldoh_v = TABLA_LDOH_2P85_V,
2468 .cfilt1_mv = 1800,
2469 .cfilt2_mv = 1800,
2470 .cfilt3_mv = 1800,
2471 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2472 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2473 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2474 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2475 }
2476};
2477
2478static struct slim_device msm_slim_tabla20 = {
2479 .name = "tabla2x-slim",
2480 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2481 .dev = {
2482 .platform_data = &tabla20_platform_data,
2483 },
2484};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002485#endif
2486
2487static struct slim_boardinfo msm_slim_devices[] = {
2488#ifdef CONFIG_WCD9310_CODEC
2489 {
2490 .bus_num = 1,
2491 .slim_slave = &msm_slim_tabla,
2492 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302493 {
2494 .bus_num = 1,
2495 .slim_slave = &msm_slim_tabla20,
2496 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002497#endif
2498 /* add more slimbus slaves as needed */
2499};
2500
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002501#define MSM_WCNSS_PHYS 0x03000000
2502#define MSM_WCNSS_SIZE 0x280000
2503
2504static struct resource resources_wcnss_wlan[] = {
2505 {
2506 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2507 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2508 .name = "wcnss_wlanrx_irq",
2509 .flags = IORESOURCE_IRQ,
2510 },
2511 {
2512 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2513 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2514 .name = "wcnss_wlantx_irq",
2515 .flags = IORESOURCE_IRQ,
2516 },
2517 {
2518 .start = MSM_WCNSS_PHYS,
2519 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2520 .name = "wcnss_mmio",
2521 .flags = IORESOURCE_MEM,
2522 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002523 {
2524 .start = 84,
2525 .end = 88,
2526 .name = "wcnss_gpios_5wire",
2527 .flags = IORESOURCE_IO,
2528 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002529};
2530
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002531static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2532 .has_48mhz_xo = 1,
2533};
2534
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002535static struct platform_device msm_device_wcnss_wlan = {
2536 .name = "wcnss_wlan",
2537 .id = 0,
2538 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2539 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002540 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002541};
2542
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002543#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2544 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2545 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2546 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2547
2548#define QCE_SIZE 0x10000
2549#define QCE_0_BASE 0x18500000
2550
2551#define QCE_HW_KEY_SUPPORT 0
2552#define QCE_SHA_HMAC_SUPPORT 1
2553#define QCE_SHARE_CE_RESOURCE 1
2554#define QCE_CE_SHARED 0
2555
2556static struct resource qcrypto_resources[] = {
2557 [0] = {
2558 .start = QCE_0_BASE,
2559 .end = QCE_0_BASE + QCE_SIZE - 1,
2560 .flags = IORESOURCE_MEM,
2561 },
2562 [1] = {
2563 .name = "crypto_channels",
2564 .start = DMOV_CE_IN_CHAN,
2565 .end = DMOV_CE_OUT_CHAN,
2566 .flags = IORESOURCE_DMA,
2567 },
2568 [2] = {
2569 .name = "crypto_crci_in",
2570 .start = DMOV_CE_IN_CRCI,
2571 .end = DMOV_CE_IN_CRCI,
2572 .flags = IORESOURCE_DMA,
2573 },
2574 [3] = {
2575 .name = "crypto_crci_out",
2576 .start = DMOV_CE_OUT_CRCI,
2577 .end = DMOV_CE_OUT_CRCI,
2578 .flags = IORESOURCE_DMA,
2579 },
2580};
2581
2582static struct resource qcedev_resources[] = {
2583 [0] = {
2584 .start = QCE_0_BASE,
2585 .end = QCE_0_BASE + QCE_SIZE - 1,
2586 .flags = IORESOURCE_MEM,
2587 },
2588 [1] = {
2589 .name = "crypto_channels",
2590 .start = DMOV_CE_IN_CHAN,
2591 .end = DMOV_CE_OUT_CHAN,
2592 .flags = IORESOURCE_DMA,
2593 },
2594 [2] = {
2595 .name = "crypto_crci_in",
2596 .start = DMOV_CE_IN_CRCI,
2597 .end = DMOV_CE_IN_CRCI,
2598 .flags = IORESOURCE_DMA,
2599 },
2600 [3] = {
2601 .name = "crypto_crci_out",
2602 .start = DMOV_CE_OUT_CRCI,
2603 .end = DMOV_CE_OUT_CRCI,
2604 .flags = IORESOURCE_DMA,
2605 },
2606};
2607
2608#endif
2609
2610#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2611 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2612
2613static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2614 .ce_shared = QCE_CE_SHARED,
2615 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2616 .hw_key_support = QCE_HW_KEY_SUPPORT,
2617 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2618};
2619
2620static struct platform_device qcrypto_device = {
2621 .name = "qcrypto",
2622 .id = 0,
2623 .num_resources = ARRAY_SIZE(qcrypto_resources),
2624 .resource = qcrypto_resources,
2625 .dev = {
2626 .coherent_dma_mask = DMA_BIT_MASK(32),
2627 .platform_data = &qcrypto_ce_hw_suppport,
2628 },
2629};
2630#endif
2631
2632#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2633 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2634
2635static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2636 .ce_shared = QCE_CE_SHARED,
2637 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2638 .hw_key_support = QCE_HW_KEY_SUPPORT,
2639 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2640};
2641
2642static struct platform_device qcedev_device = {
2643 .name = "qce",
2644 .id = 0,
2645 .num_resources = ARRAY_SIZE(qcedev_resources),
2646 .resource = qcedev_resources,
2647 .dev = {
2648 .coherent_dma_mask = DMA_BIT_MASK(32),
2649 .platform_data = &qcedev_ce_hw_suppport,
2650 },
2651};
2652#endif
2653
2654
2655static int __init gpiomux_init(void)
2656{
2657 int rc;
2658
2659 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2660 if (rc) {
2661 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2662 return rc;
2663 }
2664
Nishant Pandit24153d82011-08-27 16:05:13 +05302665 msm_gpiomux_install(msm8960_cam_common_configs,
2666 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002667
2668 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002669 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002670
2671 msm_gpiomux_install(msm8960_gsbi_configs,
2672 ARRAY_SIZE(msm8960_gsbi_configs));
2673
2674 msm_gpiomux_install(msm8960_cyts_configs,
2675 ARRAY_SIZE(msm8960_cyts_configs));
2676
2677 msm_gpiomux_install(msm8960_slimbus_config,
2678 ARRAY_SIZE(msm8960_slimbus_config));
2679
2680 msm_gpiomux_install(msm8960_audio_codec_configs,
2681 ARRAY_SIZE(msm8960_audio_codec_configs));
2682
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002683 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2684 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2685
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002686#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2687 msm_gpiomux_install(msm8960_hdmi_configs,
2688 ARRAY_SIZE(msm8960_hdmi_configs));
2689#endif
2690
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002691 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2692 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2693
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002694 msm_gpiomux_install(wcnss_5wire_interface,
2695 ARRAY_SIZE(wcnss_5wire_interface));
2696
2697 return 0;
2698}
2699
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002700#define MSM_SHARED_RAM_PHYS 0x80000000
2701
2702static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2703 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2704 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2705 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2706 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2707 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2708 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2709 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2710 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2711 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2712 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2713 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2714 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002715 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2716 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2717 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2718 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2719 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2720 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2721 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2722 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2723 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2724 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2725 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2726 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2727 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2728 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002729 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002730 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2731 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2732 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002733 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2734 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002735};
2736
2737static struct pm8921_adc_properties pm8921_adc_data = {
2738 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2739 .bitresolution = 15,
2740 .bipolar = 0,
2741};
2742
2743static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2744 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002745 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002746 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002747 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002748};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002749
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002750static void __init msm8960_map_io(void)
2751{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002752 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002753 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002754
2755 if (socinfo_init() < 0)
2756 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002757}
2758
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002759#ifdef CONFIG_ARCH_MSM8930
2760static void __init msm8930_map_io(void)
2761{
2762 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2763 msm_map_msm8930_io();
2764
2765 if (socinfo_init() < 0)
2766 pr_err("socinfo_init() failed!\n");
2767}
2768#endif
2769
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002770static void __init msm8960_init_irq(void)
2771{
2772 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002773
2774 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002775 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002777
2778 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002779 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002780
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002781 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2782 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002783
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002784 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2785 * as they are configured as level, which does not play nice with
2786 * handle_percpu_irq.
2787 */
2788 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2789 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002790 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002791 }
2792}
2793
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002794/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002795enum sdcc_controllers {
2796 SDCC1,
2797 SDCC2,
2798 SDCC3,
2799 SDCC4,
2800 SDCC5,
2801 MAX_SDCC_CONTROLLER
2802};
2803
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002804/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002805static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2806 /* SDCC1 : eMMC card connected */
2807 [SDCC1] = {
2808 .name = "sdc_vdd",
2809 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302810 .high_vol_level = 2950000,
2811 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302812 .always_on = 1,
2813 .lpm_sup = 1,
2814 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002815 .hpm_uA = 200000, /* 200mA */
2816 },
2817 /* SDCC3 : External card slot connected */
2818 [SDCC3] = {
2819 .name = "sdc_vdd",
2820 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302821 .high_vol_level = 2950000,
2822 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002823 .hpm_uA = 600000, /* 600mA */
2824 }
2825};
2826
2827/* Only slots having eMMC card will require VCCQ voltage */
2828static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2829 /* SDCC1 : eMMC card connected */
2830 [SDCC1] = {
2831 .name = "sdc_vccq",
2832 .set_voltage_sup = 1,
2833 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302834 .high_vol_level = 1800000,
2835 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002836 .hpm_uA = 200000, /* 200mA */
2837 }
2838};
2839
2840/* All SDCC controllers may require voting for VDD PAD voltage */
2841static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2842 /* SDCC3 : External card slot connected */
2843 [SDCC3] = {
2844 .name = "sdc_vddp",
2845 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302846 .high_vol_level = 2950000,
2847 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002848 .always_on = 1,
2849 .lpm_sup = 1,
2850 /* Max. Active current required is 16 mA */
2851 .hpm_uA = 16000,
2852 /*
2853 * Sleep current required is ~300 uA. But min. vote can be
2854 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2855 * during sleep.
2856 */
2857 .lpm_uA = 2000,
2858 }
2859};
2860
2861static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2862 /* SDCC1 : eMMC card connected */
2863 [SDCC1] = {
2864 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2865 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2866 },
2867 /* SDCC3 : External card slot connected */
2868 [SDCC3] = {
2869 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2870 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2871 }
2872};
2873
2874/* SDC1 pad data */
2875static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2876 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302877 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2878 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002879};
2880
2881static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2882 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2883 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2884 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2885};
2886
2887static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302888 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002889 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2890 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2891};
2892
2893static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302894 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002895 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2896 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2897};
2898
2899/* SDC3 pad data */
2900static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2901 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2902 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2903 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2904};
2905
2906static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2907 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2908 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2909 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2910};
2911
2912static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302913 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002914 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2915 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2916};
2917
2918static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302919 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302920 /*
2921 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2922 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2923 * which would result in false card detection interrupts.
2924 */
2925 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2926 /*
2927 * Keeping DATA lines status to PULL UP will make sure that
2928 * there is no current leak during sleep if external pull up
2929 * is connected to DATA lines.
2930 */
2931 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002932};
2933
2934struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2935 [SDCC1] = {
2936 .on = sdc1_pad_pull_on_cfg,
2937 .off = sdc1_pad_pull_off_cfg,
2938 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2939 },
2940 [SDCC3] = {
2941 .on = sdc3_pad_pull_on_cfg,
2942 .off = sdc3_pad_pull_off_cfg,
2943 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2944 },
2945};
2946
2947struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2948 [SDCC1] = {
2949 .on = sdc1_pad_drv_on_cfg,
2950 .off = sdc1_pad_drv_off_cfg,
2951 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2952 },
2953 [SDCC3] = {
2954 .on = sdc3_pad_drv_on_cfg,
2955 .off = sdc3_pad_drv_off_cfg,
2956 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2957 },
2958};
2959
2960struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2961 [SDCC1] = {
2962 .pull = &mmc_pad_pull_data[SDCC1],
2963 .drv = &mmc_pad_drv_data[SDCC1]
2964 },
2965 [SDCC3] = {
2966 .pull = &mmc_pad_pull_data[SDCC3],
2967 .drv = &mmc_pad_drv_data[SDCC3]
2968 },
2969};
2970
2971struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2972 [SDCC1] = {
2973 .pad_data = &mmc_pad_data[SDCC1],
2974 },
2975 [SDCC3] = {
2976 .pad_data = &mmc_pad_data[SDCC3],
2977 },
2978};
2979
2980static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302981 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002982};
2983
2984static unsigned int sdc3_sup_clk_rates[] = {
2985 400000, 24000000, 48000000, 96000000
2986};
2987
2988#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2989static struct mmc_platform_data msm8960_sdc1_data = {
2990 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2991#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2992 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2993#else
2994 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2995#endif
2996 .sup_clk_table = sdc1_sup_clk_rates,
2997 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302998 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002999 .nonremovable = 1,
3000 .sdcc_v4_sup = true,
3001 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303002 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003003};
3004#endif
3005
3006#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3007static struct mmc_platform_data msm8960_sdc3_data = {
3008 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3009 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3010 .sup_clk_table = sdc3_sup_clk_rates,
3011 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303012 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303013#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003014 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303015#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003016 .sdcc_v4_sup = true,
3017 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3018 .pin_data = &mmc_slot_pin_data[SDCC3],
3019#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3020 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3021 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3022 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3023#endif
3024 .xpc_cap = 1,
3025 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3026 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303027 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003028};
3029#endif
3030
3031static void __init msm8960_init_mmc(void)
3032{
3033#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3034 /* SDC1 : eMMC card connected */
3035 msm_add_sdcc(1, &msm8960_sdc1_data);
3036#endif
3037#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3038 /* SDC3: External card slot */
3039 msm_add_sdcc(3, &msm8960_sdc3_data);
3040#endif
3041}
3042
3043static void __init msm8960_init_buses(void)
3044{
3045#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003046 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003047 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3048 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3049 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3050 msm_bus_apps_fabric.dev.platform_data =
3051 &msm_bus_8960_apps_fabric_pdata;
3052 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3053 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3054 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3055 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003056#endif
3057}
3058
3059static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3060 .max_clock_speed = 15060000,
3061};
3062
3063#ifdef CONFIG_USB_MSM_OTG_72K
3064static struct msm_otg_platform_data msm_otg_pdata;
3065#else
3066#define USB_5V_EN 42
3067static void msm_hsusb_vbus_power(bool on)
3068{
3069 int rc;
3070 static bool vbus_is_on;
3071 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003072
3073 if (vbus_is_on == on)
3074 return;
3075
3076 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003077 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3078 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003079 if (IS_ERR(mvs_otg_switch)) {
3080 pr_err("Unable to get mvs_otg_switch\n");
3081 return;
3082 }
3083
3084 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3085 "usb_5v_en");
3086 if (rc < 0) {
3087 pr_err("failed to request usb_5v_en gpio\n");
3088 goto put_mvs_otg;
3089 }
3090
Anji jonnala2936fd92011-11-09 15:39:22 +05303091 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3092 if (rc) {
3093 pr_err("%s: unable to set_direction for gpio [%d]\n",
3094 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003095 goto free_usb_5v_en;
3096 }
3097
Anji jonnala2936fd92011-11-09 15:39:22 +05303098 if (regulator_enable(mvs_otg_switch)) {
3099 pr_err("unable to enable mvs_otg_switch\n");
3100 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003101 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303102
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003103 vbus_is_on = true;
3104 return;
3105 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303106 regulator_disable(mvs_otg_switch);
3107err_ldo_gpio_set_dir:
3108 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003109free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303110 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003111put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303112 regulator_put(mvs_otg_switch);
3113 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003114}
3115
3116static struct msm_otg_platform_data msm_otg_pdata = {
3117 .mode = USB_OTG,
3118 .otg_control = OTG_PMIC_CONTROL,
3119 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3120 .pclk_src_name = "dfab_usb_hs_clk",
3121 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3122 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303123 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003124};
3125#endif
3126
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303127#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303128#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303129static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3130 .strobe = 150,
3131 .data = 151,
3132};
3133#else
3134static struct msm_hsic_host_platform_data msm_hsic_pdata;
3135#endif
3136
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003137#define PID_MAGIC_ID 0x71432909
3138#define SERIAL_NUM_MAGIC_ID 0x61945374
3139#define SERIAL_NUMBER_LENGTH 127
3140#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3141
3142struct magic_num_struct {
3143 uint32_t pid;
3144 uint32_t serial_num;
3145};
3146
3147struct dload_struct {
3148 uint32_t reserved1;
3149 uint32_t reserved2;
3150 uint32_t reserved3;
3151 uint16_t reserved4;
3152 uint16_t pid;
3153 char serial_number[SERIAL_NUMBER_LENGTH];
3154 uint16_t reserved5;
3155 struct magic_num_struct magic_struct;
3156};
3157
3158static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3159{
3160 struct dload_struct __iomem *dload = 0;
3161
3162 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3163 if (!dload) {
3164 pr_err("%s: cannot remap I/O memory region: %08x\n",
3165 __func__, DLOAD_USB_BASE_ADD);
3166 return -ENXIO;
3167 }
3168
3169 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3170 __func__, dload, pid, snum);
3171 /* update pid */
3172 dload->magic_struct.pid = PID_MAGIC_ID;
3173 dload->pid = pid;
3174
3175 /* update serial number */
3176 dload->magic_struct.serial_num = 0;
3177 if (!snum) {
3178 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3179 goto out;
3180 }
3181
3182 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003183 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003184out:
3185 iounmap(dload);
3186 return 0;
3187}
3188
3189static struct android_usb_platform_data android_usb_pdata = {
3190 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3191};
3192
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003193static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003194 .name = "android_usb",
3195 .id = -1,
3196 .dev = {
3197 .platform_data = &android_usb_pdata,
3198 },
3199};
3200
3201static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3202 0x03, 0x0f,
3203};
3204
3205static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3206 0x00, 0x24, 0x54, 0x10,
3207 0x09, 0x03, 0x01,
3208 0x10, 0x54, 0x30, 0x0C,
3209 0x24, 0x30, 0x0f,
3210};
3211
3212static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3213 0x00, 0x24, 0x54, 0x10,
3214 0x09, 0x07, 0x01, 0x0B,
3215 0x10, 0x54, 0x30, 0x0C,
3216 0x24, 0x30, 0x0f,
3217};
3218
3219static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3220 [0] = {
3221 .mode = MSM_SPM_MODE_CLOCK_GATING,
3222 .notify_rpm = false,
3223 .cmd = spm_wfi_cmd_sequence,
3224 },
3225 [1] = {
3226 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3227 .notify_rpm = false,
3228 .cmd = spm_power_collapse_without_rpm,
3229 },
3230 [2] = {
3231 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3232 .notify_rpm = true,
3233 .cmd = spm_power_collapse_with_rpm,
3234 },
3235};
3236
3237static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3238 [0] = {
3239 .reg_base_addr = MSM_SAW0_BASE,
3240 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3241 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3242 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3243#if defined(CONFIG_MSM_AVS_HW)
3244 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3245 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3246#endif
3247 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3248 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3249 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3250 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3251 .vctl_timeout_us = 50,
3252 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3253 .modes = msm_spm_seq_list,
3254 },
3255 [1] = {
3256 .reg_base_addr = MSM_SAW1_BASE,
3257 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3258 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3259 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3260#if defined(CONFIG_MSM_AVS_HW)
3261 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3262 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3263#endif
3264 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3265 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3266 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3267 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3268 .vctl_timeout_us = 50,
3269 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3270 .modes = msm_spm_seq_list,
3271 },
3272};
3273
3274static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3275 0x00, 0x20, 0x03, 0x20,
3276 0x00, 0x0f,
3277};
3278
3279static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3280 0x00, 0x20, 0x34, 0x64,
3281 0x48, 0x07, 0x48, 0x20,
3282 0x50, 0x64, 0x04, 0x34,
3283 0x50, 0x0f,
3284};
3285static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3286 0x00, 0x10, 0x34, 0x64,
3287 0x48, 0x07, 0x48, 0x10,
3288 0x50, 0x64, 0x04, 0x34,
3289 0x50, 0x0F,
3290};
3291
3292static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3293 [0] = {
3294 .mode = MSM_SPM_L2_MODE_RETENTION,
3295 .notify_rpm = false,
3296 .cmd = l2_spm_wfi_cmd_sequence,
3297 },
3298 [1] = {
3299 .mode = MSM_SPM_L2_MODE_GDHS,
3300 .notify_rpm = true,
3301 .cmd = l2_spm_gdhs_cmd_sequence,
3302 },
3303 [2] = {
3304 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3305 .notify_rpm = true,
3306 .cmd = l2_spm_power_off_cmd_sequence,
3307 },
3308};
3309
3310
3311static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3312 [0] = {
3313 .reg_base_addr = MSM_SAW_L2_BASE,
3314 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3315 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3316 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3317 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3318 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3319 .modes = msm_spm_l2_seq_list,
3320 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3321 },
3322};
3323
3324#define CYTTSP_TS_GPIO_IRQ 11
3325#define CYTTSP_TS_SLEEP_GPIO 50
3326#define CYTTSP_TS_RESOUT_N_GPIO 52
3327
3328/*virtual key support */
3329static ssize_t tma340_vkeys_show(struct kobject *kobj,
3330 struct kobj_attribute *attr, char *buf)
3331{
3332 return snprintf(buf, 200,
3333 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3334 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3335 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3336 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3337 "\n");
3338}
3339
3340static struct kobj_attribute tma340_vkeys_attr = {
3341 .attr = {
3342 .mode = S_IRUGO,
3343 },
3344 .show = &tma340_vkeys_show,
3345};
3346
3347static struct attribute *tma340_properties_attrs[] = {
3348 &tma340_vkeys_attr.attr,
3349 NULL
3350};
3351
3352static struct attribute_group tma340_properties_attr_group = {
3353 .attrs = tma340_properties_attrs,
3354};
3355
3356
3357static int cyttsp_platform_init(struct i2c_client *client)
3358{
3359 int rc = 0;
3360 static struct kobject *tma340_properties_kobj;
3361
3362 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3363 tma340_properties_kobj = kobject_create_and_add("board_properties",
3364 NULL);
3365 if (tma340_properties_kobj)
3366 rc = sysfs_create_group(tma340_properties_kobj,
3367 &tma340_properties_attr_group);
3368 if (!tma340_properties_kobj || rc)
3369 pr_err("%s: failed to create board_properties\n",
3370 __func__);
3371
3372 return 0;
3373}
3374
3375static struct cyttsp_regulator regulator_data[] = {
3376 {
3377 .name = "vdd",
3378 .min_uV = CY_TMA300_VTG_MIN_UV,
3379 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303380 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3381 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003382 },
3383 /* TODO: Remove after runtime PM is enabled in I2C driver */
3384 {
3385 .name = "vcc_i2c",
3386 .min_uV = CY_I2C_VTG_MIN_UV,
3387 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303388 .hpm_load_uA = CY_I2C_CURR_UA,
3389 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003390 },
3391};
3392
3393static struct cyttsp_platform_data cyttsp_pdata = {
3394 .panel_maxx = 634,
3395 .panel_maxy = 1166,
3396 .disp_maxx = 616,
3397 .disp_maxy = 1023,
3398 .disp_minx = 0,
3399 .disp_miny = 16,
3400 .flags = 0x01,
3401 .gen = CY_GEN3, /* or */
3402 .use_st = CY_USE_ST,
3403 .use_mt = CY_USE_MT,
3404 .use_hndshk = CY_SEND_HNDSHK,
3405 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303406 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003407 .use_gestures = CY_USE_GESTURES,
3408 .fw_fname = "cyttsp_8960_cdp.hex",
3409 /* activate up to 4 groups
3410 * and set active distance
3411 */
3412 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3413 CY_GEST_GRP3 | CY_GEST_GRP4 |
3414 CY_ACT_DIST,
3415 /* change act_intrvl to customize the Active power state
3416 * scanning/processing refresh interval for Operating mode
3417 */
3418 .act_intrvl = CY_ACT_INTRVL_DFLT,
3419 /* change tch_tmout to customize the touch timeout for the
3420 * Active power state for Operating mode
3421 */
3422 .tch_tmout = CY_TCH_TMOUT_DFLT,
3423 /* change lp_intrvl to customize the Low Power power state
3424 * scanning/processing refresh interval for Operating mode
3425 */
3426 .lp_intrvl = CY_LP_INTRVL_DFLT,
3427 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3428 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3429 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3430 .regulator_info = regulator_data,
3431 .num_regulators = ARRAY_SIZE(regulator_data),
3432 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303433 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003434};
3435
3436static struct i2c_board_info cyttsp_info[] __initdata = {
3437 {
3438 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3439 .platform_data = &cyttsp_pdata,
3440#ifndef CY_USE_TIMER
3441 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3442#endif /* CY_USE_TIMER */
3443 },
3444};
3445
Mohan Pallaka50837382011-09-07 11:00:57 +05303446/* configuration data */
3447static const u8 mxt_config_data[] = {
3448 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003449 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303450 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003451 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3452 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3453 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3454 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3455 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3456 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3457 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303458 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003459 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303460 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003461 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303462 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003463 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3464 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3465 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3466 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303467 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003468 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3469 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303470 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003471 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3472 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303473 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003474 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3475 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303476 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003477 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3478 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303479 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003480 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303481 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003482 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303483 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003484 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303485 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003486 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303487 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003488 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303489};
3490
3491#define MXT_TS_GPIO_IRQ 11
3492#define MXT_TS_LDO_EN_GPIO 50
3493#define MXT_TS_RESET_GPIO 52
3494
3495static void mxt_init_hw_liquid(void)
3496{
3497 int rc;
3498
3499 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3500 if (rc) {
3501 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3502 __func__, MXT_TS_GPIO_IRQ);
3503 return;
3504 }
3505
3506 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3507 if (rc) {
3508 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3509 __func__, MXT_TS_GPIO_IRQ);
3510 goto err_irq_gpio_req;
3511 }
3512
3513 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3514 if (rc) {
3515 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3516 __func__, MXT_TS_LDO_EN_GPIO);
3517 goto err_irq_gpio_req;
3518 }
3519
3520 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3521 if (rc) {
3522 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3523 __func__, MXT_TS_LDO_EN_GPIO);
3524 goto err_ldo_gpio_req;
3525 }
3526
3527 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3528 if (rc) {
3529 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3530 __func__, MXT_TS_RESET_GPIO);
3531 goto err_ldo_gpio_set_dir;
3532 }
3533
3534 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3535 if (rc) {
3536 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3537 __func__, MXT_TS_RESET_GPIO);
3538 goto err_reset_gpio_req;
3539 }
3540
3541 return;
3542
3543err_reset_gpio_req:
3544 gpio_free(MXT_TS_RESET_GPIO);
3545err_ldo_gpio_set_dir:
3546 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3547err_ldo_gpio_req:
3548 gpio_free(MXT_TS_LDO_EN_GPIO);
3549err_irq_gpio_req:
3550 gpio_free(MXT_TS_GPIO_IRQ);
3551}
3552
3553static struct mxt_platform_data mxt_platform_data = {
3554 .config = mxt_config_data,
3555 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003556 .x_size = 1365,
3557 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303558 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003559 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303560};
3561
3562static struct i2c_board_info mxt_device_info[] __initdata = {
3563 {
3564 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3565 .platform_data = &mxt_platform_data,
3566 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3567 },
3568};
3569
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003570static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3571{
3572}
3573
3574static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3575 .clk_freq = 100000,
3576 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003577 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3578};
3579
3580static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3581 .clk_freq = 100000,
3582 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003583 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3584};
3585
3586static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3587 .clk_freq = 100000,
3588 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003589 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3590};
3591
3592static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3593 .clk_freq = 100000,
3594 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003595 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3596};
3597
3598static struct msm_rpm_platform_data msm_rpm_data = {
3599 .reg_base_addrs = {
3600 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3601 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3602 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3603 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3604 },
3605
3606 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3607 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3608 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3609 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3610 .msm_apps_ipc_rpm_val = 4,
3611};
3612
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003613static struct ks8851_pdata spi_eth_pdata = {
3614 .irq_gpio = KS8851_IRQ_GPIO,
3615 .rst_gpio = KS8851_RST_GPIO,
3616};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003617
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003618static struct spi_board_info spi_board_info[] __initdata = {
3619 {
3620 .modalias = "ks8851",
3621 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3622 .max_speed_hz = 19200000,
3623 .bus_num = 0,
3624 .chip_select = 0,
3625 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003626 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003627 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003628 {
3629 .modalias = "dsi_novatek_3d_panel_spi",
3630 .max_speed_hz = 10800000,
3631 .bus_num = 0,
3632 .chip_select = 1,
3633 .mode = SPI_MODE_0,
3634 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003635};
3636
3637static struct platform_device msm_device_saw_core0 = {
3638 .name = "saw-regulator",
3639 .id = 0,
3640 .dev = {
3641 .platform_data = &msm_saw_regulator_pdata_s5,
3642 },
3643};
3644
3645static struct platform_device msm_device_saw_core1 = {
3646 .name = "saw-regulator",
3647 .id = 1,
3648 .dev = {
3649 .platform_data = &msm_saw_regulator_pdata_s6,
3650 },
3651};
3652
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003653#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3654static struct platform_device wfd_device = {
3655 .name = "msm_wfd",
3656 .id = -1,
3657};
3658#endif
3659
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003660static struct tsens_platform_data msm_tsens_pdata = {
3661 .slope = 910,
3662 .tsens_factor = 1000,
3663 .hw_type = MSM_8960,
3664 .tsens_num_sensor = 5,
3665};
3666
3667static struct platform_device msm_tsens_device = {
3668 .name = "tsens8960-tm",
3669 .id = -1,
3670 .dev = {
3671 .platform_data = &msm_tsens_pdata,
3672 },
3673};
3674
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003675#ifdef CONFIG_MSM_FAKE_BATTERY
3676static struct platform_device fish_battery_device = {
3677 .name = "fish_battery",
3678};
3679#endif
3680
David Collins26f05562011-06-20 09:56:28 -07003681static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003682 .name = GPIO_REGULATOR_DEV_NAME,
3683 .id = PM8921_MPP_PM_TO_SYS(7),
3684 .dev = {
3685 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3686 },
3687};
3688
David Collins26f05562011-06-20 09:56:28 -07003689static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003690 .name = GPIO_REGULATOR_DEV_NAME,
3691 .id = 91,
3692 .dev = {
3693 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3694 },
3695};
3696
David Collinsb10be1d2011-09-02 10:29:31 -07003697static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3698 .name = GPIO_REGULATOR_DEV_NAME,
3699 .id = PM8921_GPIO_PM_TO_SYS(17),
3700 .dev = {
3701 .platform_data =
3702 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3703 },
3704};
3705
David Collins26f05562011-06-20 09:56:28 -07003706static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3707 .name = "rpm-regulator",
3708 .id = -1,
3709 .dev = {
3710 .platform_data = &msm_rpm_regulator_pdata,
3711 },
3712};
3713
David Collins4c31a872011-08-31 10:07:10 -07003714static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3715 .phys_addr_base = 0x0010C000,
3716 .reg_offsets = {
3717 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3718 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3719 },
3720 .phys_size = SZ_8K,
3721 .log_len = 4096, /* log's buffer length in bytes */
3722 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3723};
3724
3725static struct platform_device msm_rpm_log_device = {
3726 .name = "msm_rpm_log",
3727 .id = -1,
3728 .dev = {
3729 .platform_data = &msm_rpm_log_pdata,
3730 },
3731};
3732
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003733static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003734 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003735 &msm_device_smd,
3736 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303737 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003738 &msm_device_saw_core0,
3739 &msm_device_saw_core1,
3740 &msm8960_device_ext_5v_vreg,
3741 &msm8960_device_ext_l2_vreg,
3742 &msm8960_device_ssbi_pm8921,
3743 &msm8960_device_qup_spi_gsbi1,
3744 &msm8960_device_qup_i2c_gsbi3,
3745 &msm8960_device_qup_i2c_gsbi4,
3746 &msm8960_device_qup_i2c_gsbi10,
3747#ifndef CONFIG_MSM_DSPS
3748 &msm8960_device_qup_i2c_gsbi12,
3749#endif
3750 &msm_slim_ctrl,
3751 &msm_device_wcnss_wlan,
3752#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3753 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3754 &qcrypto_device,
3755#endif
3756
3757#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3758 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3759 &qcedev_device,
3760#endif
3761#ifdef CONFIG_MSM_ROTATOR
3762 &msm_rotator_device,
3763#endif
3764 &msm_device_sps,
3765#ifdef CONFIG_MSM_FAKE_BATTERY
3766 &fish_battery_device,
3767#endif
3768#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003769#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003770 &android_pmem_device,
3771 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003772#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003773 &android_pmem_audio_device,
3774#endif
3775 &msm_fb_device,
3776 &msm_device_vidc,
3777 &msm_device_bam_dmux,
3778 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003779
3780#ifdef CONFIG_HW_RANDOM_MSM
3781 &msm_device_rng,
3782#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003783 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003784#ifdef CONFIG_ION_MSM
3785 &ion_dev,
3786#endif
David Collins4c31a872011-08-31 10:07:10 -07003787 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003788 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003789#ifdef CONFIG_MSM_QDSS
3790 &msm_etb_device,
3791 &msm_tpiu_device,
3792 &msm_funnel_device,
3793 &msm_ptm_device,
3794#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003795 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003796 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003797#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3798 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003799 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003800#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003801};
3802
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003803static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003804 &msm8960_device_otg,
3805 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003806 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303807 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003808 &android_usb_device,
3809 &msm_device_vidc,
3810 &mipi_dsi_simulator_panel_device,
3811 &msm_bus_apps_fabric,
3812 &msm_bus_sys_fabric,
3813 &msm_bus_mm_fabric,
3814 &msm_bus_sys_fpb,
3815 &msm_bus_cpss_fpb,
3816 &msm_pcm,
3817 &msm_pcm_routing,
3818 &msm_cpudai0,
3819 &msm_cpudai1,
3820 &msm_cpudai_hdmi_rx,
3821 &msm_cpudai_bt_rx,
3822 &msm_cpudai_bt_tx,
3823 &msm_cpudai_fm_rx,
3824 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003825 &msm_cpudai_auxpcm_rx,
3826 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003827 &msm_cpu_fe,
3828 &msm_stub_codec,
3829 &msm_voice,
3830 &msm_voip,
3831 &msm_lpa_pcm,
3832
3833#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3834 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3835 &qcrypto_device,
3836#endif
3837
3838#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3839 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3840 &qcedev_device,
3841#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003842};
3843
3844static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003845 &msm_kgsl_3d0,
3846 &msm_kgsl_2d0,
3847 &msm_kgsl_2d1,
3848 &mipi_dsi_renesas_panel_device,
3849#ifdef CONFIG_MSM_GEMINI
3850 &msm8960_gemini_device,
3851#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003852};
3853
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003854static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003855 &msm8960_device_otg,
3856 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003857 &msm_device_hsusb_host,
3858 &android_usb_device,
3859 &msm_pcm,
3860 &msm_pcm_routing,
3861 &msm_cpudai0,
3862 &msm_cpudai1,
3863 &msm_cpudai_hdmi_rx,
3864 &msm_cpudai_bt_rx,
3865 &msm_cpudai_bt_tx,
3866 &msm_cpudai_fm_rx,
3867 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003868 &msm_cpudai_auxpcm_rx,
3869 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003870 &msm_cpu_fe,
3871 &msm_stub_codec,
3872 &msm_kgsl_3d0,
3873#ifdef CONFIG_MSM_KGSL_2D
3874 &msm_kgsl_2d0,
3875 &msm_kgsl_2d1,
3876#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003877 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003878#ifdef CONFIG_MSM_GEMINI
3879 &msm8960_gemini_device,
3880#endif
3881 &msm_voice,
3882 &msm_voip,
3883 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303884 &msm_cpudai_afe_01_rx,
3885 &msm_cpudai_afe_01_tx,
3886 &msm_cpudai_afe_02_rx,
3887 &msm_cpudai_afe_02_tx,
3888 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003889#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3890 &hdmi_msm_device,
3891#endif
3892 &msm_pcm_hostless,
3893 &msm_bus_apps_fabric,
3894 &msm_bus_sys_fabric,
3895 &msm_bus_mm_fabric,
3896 &msm_bus_sys_fpb,
3897 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003898 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003899};
3900
3901static void __init msm8960_i2c_init(void)
3902{
3903 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3904 &msm8960_i2c_qup_gsbi4_pdata;
3905
3906 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3907 &msm8960_i2c_qup_gsbi3_pdata;
3908
3909 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3910 &msm8960_i2c_qup_gsbi10_pdata;
3911
3912 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3913 &msm8960_i2c_qup_gsbi12_pdata;
3914}
3915
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003916static void __init msm8960_gfx_init(void)
3917{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003918 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003919 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3920 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3921 msm_kgsl_3d0.dev.platform_data;
3922 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3923 320000000;
3924 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3925 266667000;
3926 }
3927}
3928
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003929static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3930 .irq_base = PM8921_IRQ_BASE,
3931 .devirq = MSM_GPIO_TO_INT(104),
3932 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3933};
3934
3935static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3936 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3937};
3938
3939static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3940 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3941};
3942
3943static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3944 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303945 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003946};
3947
3948static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3949 .pull_up = 1,
3950 .kpd_trigger_delay_us = 970,
3951 .wakeup = 1,
3952};
3953
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303954/* Rotate lock key is not available so use F1 */
3955#define KEY_ROTATE_LOCK KEY_F1
3956
3957static const unsigned int keymap_liquid[] = {
3958 KEY(0, 0, KEY_VOLUMEUP),
3959 KEY(0, 1, KEY_VOLUMEDOWN),
3960 KEY(1, 3, KEY_ROTATE_LOCK),
3961 KEY(1, 4, KEY_HOME),
3962};
3963
3964static struct matrix_keymap_data keymap_data_liquid = {
3965 .keymap_size = ARRAY_SIZE(keymap_liquid),
3966 .keymap = keymap_liquid,
3967};
3968
3969static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3970 .input_name = "keypad_8960_liquid",
3971 .input_phys_device = "keypad_8960/input0",
3972 .num_rows = 2,
3973 .num_cols = 5,
3974 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3975 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3976 .debounce_ms = 15,
3977 .scan_delay_ms = 32,
3978 .row_hold_ns = 91500,
3979 .wakeup = 1,
3980 .keymap_data = &keymap_data_liquid,
3981};
3982
3983
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003984static const unsigned int keymap[] = {
3985 KEY(0, 0, KEY_VOLUMEUP),
3986 KEY(0, 1, KEY_VOLUMEDOWN),
3987 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3988 KEY(0, 3, KEY_CAMERA_FOCUS),
3989};
3990
3991static struct matrix_keymap_data keymap_data = {
3992 .keymap_size = ARRAY_SIZE(keymap),
3993 .keymap = keymap,
3994};
3995
3996static struct pm8xxx_keypad_platform_data keypad_data = {
3997 .input_name = "keypad_8960",
3998 .input_phys_device = "keypad_8960/input0",
3999 .num_rows = 1,
4000 .num_cols = 5,
4001 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4002 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4003 .debounce_ms = 15,
4004 .scan_delay_ms = 32,
4005 .row_hold_ns = 91500,
4006 .wakeup = 1,
4007 .keymap_data = &keymap_data,
4008};
4009
4010static const unsigned int keymap_sim[] = {
4011 KEY(0, 0, KEY_7),
4012 KEY(0, 1, KEY_DOWN),
4013 KEY(0, 2, KEY_UP),
4014 KEY(0, 3, KEY_RIGHT),
4015 KEY(0, 4, KEY_ENTER),
4016 KEY(0, 5, KEY_L),
4017 KEY(0, 6, KEY_BACK),
4018 KEY(0, 7, KEY_M),
4019
4020 KEY(1, 0, KEY_LEFT),
4021 KEY(1, 1, KEY_SEND),
4022 KEY(1, 2, KEY_1),
4023 KEY(1, 3, KEY_4),
4024 KEY(1, 4, KEY_CLEAR),
4025 KEY(1, 5, KEY_MSDOS),
4026 KEY(1, 6, KEY_SPACE),
4027 KEY(1, 7, KEY_COMMA),
4028
4029 KEY(2, 0, KEY_6),
4030 KEY(2, 1, KEY_5),
4031 KEY(2, 2, KEY_8),
4032 KEY(2, 3, KEY_3),
4033 KEY(2, 4, KEY_NUMERIC_STAR),
4034 KEY(2, 5, KEY_UP),
4035 KEY(2, 6, KEY_DOWN),
4036 KEY(2, 7, KEY_LEFTSHIFT),
4037
4038 KEY(3, 0, KEY_9),
4039 KEY(3, 1, KEY_NUMERIC_POUND),
4040 KEY(3, 2, KEY_0),
4041 KEY(3, 3, KEY_2),
4042 KEY(3, 4, KEY_SLEEP),
4043 KEY(3, 5, KEY_F1),
4044 KEY(3, 6, KEY_F2),
4045 KEY(3, 7, KEY_F3),
4046
4047 KEY(4, 0, KEY_BACK),
4048 KEY(4, 1, KEY_HOME),
4049 KEY(4, 2, KEY_MENU),
4050 KEY(4, 3, KEY_VOLUMEUP),
4051 KEY(4, 4, KEY_VOLUMEDOWN),
4052 KEY(4, 5, KEY_F4),
4053 KEY(4, 6, KEY_F5),
4054 KEY(4, 7, KEY_F6),
4055
4056 KEY(5, 0, KEY_R),
4057 KEY(5, 1, KEY_T),
4058 KEY(5, 2, KEY_Y),
4059 KEY(5, 3, KEY_LEFTALT),
4060 KEY(5, 4, KEY_KPENTER),
4061 KEY(5, 5, KEY_Q),
4062 KEY(5, 6, KEY_W),
4063 KEY(5, 7, KEY_E),
4064
4065 KEY(6, 0, KEY_F),
4066 KEY(6, 1, KEY_G),
4067 KEY(6, 2, KEY_H),
4068 KEY(6, 3, KEY_CAPSLOCK),
4069 KEY(6, 4, KEY_PAGEUP),
4070 KEY(6, 5, KEY_A),
4071 KEY(6, 6, KEY_S),
4072 KEY(6, 7, KEY_D),
4073
4074 KEY(7, 0, KEY_V),
4075 KEY(7, 1, KEY_B),
4076 KEY(7, 2, KEY_N),
4077 KEY(7, 3, KEY_MENU),
4078 KEY(7, 4, KEY_PAGEDOWN),
4079 KEY(7, 5, KEY_Z),
4080 KEY(7, 6, KEY_X),
4081 KEY(7, 7, KEY_C),
4082
4083 KEY(8, 0, KEY_P),
4084 KEY(8, 1, KEY_J),
4085 KEY(8, 2, KEY_K),
4086 KEY(8, 3, KEY_INSERT),
4087 KEY(8, 4, KEY_LINEFEED),
4088 KEY(8, 5, KEY_U),
4089 KEY(8, 6, KEY_I),
4090 KEY(8, 7, KEY_O),
4091
4092 KEY(9, 0, KEY_4),
4093 KEY(9, 1, KEY_5),
4094 KEY(9, 2, KEY_6),
4095 KEY(9, 3, KEY_7),
4096 KEY(9, 4, KEY_8),
4097 KEY(9, 5, KEY_1),
4098 KEY(9, 6, KEY_2),
4099 KEY(9, 7, KEY_3),
4100
4101 KEY(10, 0, KEY_F7),
4102 KEY(10, 1, KEY_F8),
4103 KEY(10, 2, KEY_F9),
4104 KEY(10, 3, KEY_F10),
4105 KEY(10, 4, KEY_FN),
4106 KEY(10, 5, KEY_9),
4107 KEY(10, 6, KEY_0),
4108 KEY(10, 7, KEY_DOT),
4109
4110 KEY(11, 0, KEY_LEFTCTRL),
4111 KEY(11, 1, KEY_F11),
4112 KEY(11, 2, KEY_ENTER),
4113 KEY(11, 3, KEY_SEARCH),
4114 KEY(11, 4, KEY_DELETE),
4115 KEY(11, 5, KEY_RIGHT),
4116 KEY(11, 6, KEY_LEFT),
4117 KEY(11, 7, KEY_RIGHTSHIFT),
4118 KEY(0, 0, KEY_VOLUMEUP),
4119 KEY(0, 1, KEY_VOLUMEDOWN),
4120 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4121 KEY(0, 3, KEY_CAMERA_FOCUS),
4122};
4123
4124static struct matrix_keymap_data keymap_data_sim = {
4125 .keymap_size = ARRAY_SIZE(keymap_sim),
4126 .keymap = keymap_sim,
4127};
4128
4129static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4130 .input_name = "keypad_8960",
4131 .input_phys_device = "keypad_8960/input0",
4132 .num_rows = 12,
4133 .num_cols = 8,
4134 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4135 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4136 .debounce_ms = 15,
4137 .scan_delay_ms = 32,
4138 .row_hold_ns = 91500,
4139 .wakeup = 1,
4140 .keymap_data = &keymap_data_sim,
4141};
4142
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004143static int pm8921_therm_mitigation[] = {
4144 1100,
4145 700,
4146 600,
4147 325,
4148};
4149
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004150static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004151 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004152 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004153 .max_voltage = 4200,
4154 .min_voltage = 3200,
4155 .resume_voltage = 4100,
4156 .term_current = 100,
4157 .cool_temp = 10,
4158 .warm_temp = 40,
4159 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004160 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004161 .cool_bat_chg_current = 350,
4162 .warm_bat_chg_current = 350,
4163 .cool_bat_voltage = 4100,
4164 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004165 .thermal_mitigation = pm8921_therm_mitigation,
4166 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004167};
4168
4169static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4170 .priority = 0,
4171};
4172
4173static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4174 .r_sense = 10,
4175 .i_test = 2500,
4176 .v_failure = 3000,
4177 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004178};
4179
Jay Chokshide4cefb2011-08-04 18:10:44 -07004180#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004181#define PM8XXX_LED_PWM_PERIOD 1000
4182#define PM8XXX_LED_PWM_DUTY_MS 20
4183/**
4184 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4185 * driven using PWM feature.
4186 */
4187#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004188
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004189static struct led_info pm8921_led_info[] = {
4190 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004191 .name = "led:battery_charging",
4192 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004193 },
4194 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004195 .name = "led:battery_full",
4196 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004197 },
4198};
4199
Jay Chokshi8994e392011-09-14 18:20:39 -07004200static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004201 .num_leds = ARRAY_SIZE(pm8921_led_info),
4202 .leds = pm8921_led_info,
4203};
4204
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004205static int pm8921_led0_pwm_duty_pcts[56] = {
4206 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4207 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4208 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4209 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4210 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4211 14, 10, 6, 4, 1
4212};
4213
4214static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4215 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4216 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4217 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4218 .start_idx = 0,
4219};
4220
Jay Chokshi8994e392011-09-14 18:20:39 -07004221static struct pm8xxx_led_config pm8921_led_configs[] = {
4222 [0] = {
4223 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004224 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004225 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004226 .pwm_channel = 5,
4227 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4228 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004229 },
4230 [1] = {
4231 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004232 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004233 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004234 .pwm_channel = 4,
4235 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004236 },
4237};
4238
4239static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4240 .led_core = &pm8921_led_core_pdata,
4241 .configs = pm8921_led_configs,
4242 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4243};
4244
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004245static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4246 .irq_pdata = &pm8xxx_irq_pdata,
4247 .gpio_pdata = &pm8xxx_gpio_pdata,
4248 .mpp_pdata = &pm8xxx_mpp_pdata,
4249 .rtc_pdata = &pm8xxx_rtc_pdata,
4250 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4251 .keypad_pdata = &keypad_data,
4252 .misc_pdata = &pm8xxx_misc_pdata,
4253 .regulator_pdatas = msm_pm8921_regulator_pdata,
4254 .charger_pdata = &pm8921_chg_pdata,
4255 .bms_pdata = &pm8921_bms_pdata,
4256 .adc_pdata = &pm8921_adc_pdata,
4257 .leds_pdata = &pm8xxx_leds_pdata,
4258};
4259
4260static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4261 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4262 .slave = {
4263 .name = "pm8921-core",
4264 .platform_data = &pm8921_platform_data,
4265 },
4266};
4267
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004268static struct msm_cpuidle_state msm_cstates[] __initdata = {
4269 {0, 0, "C0", "WFI",
4270 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4271
4272 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4273 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4274
4275 {0, 2, "C2", "POWER_COLLAPSE",
4276 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4277
4278 {1, 0, "C0", "WFI",
4279 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4280
4281 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4282 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4283};
4284
4285static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4286 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4287 .idle_supported = 1,
4288 .suspend_supported = 1,
4289 .idle_enabled = 0,
4290 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004291 },
4292
4293 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4294 .idle_supported = 1,
4295 .suspend_supported = 1,
4296 .idle_enabled = 0,
4297 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004298 },
4299
4300 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4301 .idle_supported = 1,
4302 .suspend_supported = 1,
4303 .idle_enabled = 1,
4304 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004305 },
4306
4307 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4308 .idle_supported = 0,
4309 .suspend_supported = 1,
4310 .idle_enabled = 0,
4311 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004312 },
4313
4314 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4315 .idle_supported = 1,
4316 .suspend_supported = 1,
4317 .idle_enabled = 0,
4318 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004319 },
4320
4321 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4322 .idle_supported = 1,
4323 .suspend_supported = 0,
4324 .idle_enabled = 1,
4325 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004326 },
4327};
4328
4329static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4330 {
4331 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4332 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4333 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004334 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004335 },
4336
4337 {
4338 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4339 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4340 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004341 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004342 },
4343
4344 {
4345 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4346 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4347 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004348 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004349 },
4350
4351 {
4352 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4353 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4354 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004355 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004356 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004357 {
4358 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4359 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4360 false,
4361 7000, 3500, 66600000, 5150,
4362 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004363
4364 {
4365 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4366 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4367 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004368 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004369 },
4370
4371 {
4372 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4373 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4374 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004375 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004376 },
4377
4378 {
4379 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4380 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4381 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004382 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004383 },
4384
4385 {
4386 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4387 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4388 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004389 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004390 },
4391};
4392
4393#ifdef CONFIG_I2C
4394#define I2C_SURF 1
4395#define I2C_FFA (1 << 1)
4396#define I2C_RUMI (1 << 2)
4397#define I2C_SIM (1 << 3)
4398#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004399#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004400
4401struct i2c_registry {
4402 u8 machs;
4403 int bus;
4404 struct i2c_board_info *info;
4405 int len;
4406};
4407
4408#ifdef CONFIG_MSM_CAMERA
4409static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4410#ifdef CONFIG_IMX074
4411 {
4412 I2C_BOARD_INFO("imx074", 0x1A),
4413 },
4414#endif
4415#ifdef CONFIG_OV2720
4416 {
4417 I2C_BOARD_INFO("ov2720", 0x6C),
4418 },
4419#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004420 {
4421 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4422 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304423#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4424 {
4425 I2C_BOARD_INFO("sc628a", 0x6E),
4426 },
4427#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004428};
4429#endif
4430
4431/* Sensors DSPS platform data */
4432#ifdef CONFIG_MSM_DSPS
4433#define DSPS_PIL_GENERIC_NAME "dsps"
4434#endif /* CONFIG_MSM_DSPS */
4435
4436static void __init msm8960_init_dsps(void)
4437{
4438#ifdef CONFIG_MSM_DSPS
4439 struct msm_dsps_platform_data *pdata =
4440 msm_dsps_device.dev.platform_data;
4441 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4442 pdata->gpios = NULL;
4443 pdata->gpios_num = 0;
4444
4445 platform_device_register(&msm_dsps_device);
4446#endif /* CONFIG_MSM_DSPS */
4447}
4448
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004449static void __init msm8960_init_hsic(void)
4450{
4451#ifdef CONFIG_USB_EHCI_MSM_HSIC
4452 uint32_t version = socinfo_get_version();
4453
4454 pr_info("%s: version:%d mtp:%d\n", __func__,
4455 SOCINFO_VERSION_MAJOR(version),
4456 machine_is_msm8960_mtp());
4457
4458 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4459 machine_is_msm8960_mtp() ||
4460 machine_is_msm8960_fluid())
4461 return;
4462
4463 msm_gpiomux_install(msm8960_hsic_configs,
4464 ARRAY_SIZE(msm8960_hsic_configs));
4465
4466 platform_device_register(&msm_device_hsic_host);
4467#endif
4468}
4469
4470
Amir Samuelov5137e392011-09-21 17:31:25 +03004471#ifdef CONFIG_ISL9519_CHARGER
4472static struct isl_platform_data isl_data __initdata = {
4473 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4474 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4475 .max_system_voltage = 4200,
4476 .min_system_voltage = 3200,
4477 .chgcurrent = 1000, /* 1900, */
4478 .term_current = 400, /* Need fine tuning */
4479 .input_current = 2048,
4480};
4481
4482static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4483 {
4484 I2C_BOARD_INFO("isl9519q", 0x9),
4485 .irq = 0, /* Not required when notify-by-pmic */
4486 .platform_data = &isl_data,
4487 },
4488};
4489#endif /* CONFIG_ISL9519_CHARGER */
4490
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004491static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4492#ifdef CONFIG_MSM_CAMERA
4493 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004494 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004495 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4496 msm_camera_boardinfo,
4497 ARRAY_SIZE(msm_camera_boardinfo),
4498 },
4499#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004500#ifdef CONFIG_ISL9519_CHARGER
4501 {
4502 I2C_LIQUID,
4503 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4504 isl_charger_i2c_info,
4505 ARRAY_SIZE(isl_charger_i2c_info),
4506 },
4507#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004508 {
4509 I2C_SURF | I2C_FFA | I2C_FLUID,
4510 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4511 cyttsp_info,
4512 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004513 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304514 {
4515 I2C_LIQUID,
4516 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4517 mxt_device_info,
4518 ARRAY_SIZE(mxt_device_info),
4519 },
4520
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004521};
4522#endif /* CONFIG_I2C */
4523
4524static void __init register_i2c_devices(void)
4525{
4526#ifdef CONFIG_I2C
4527 u8 mach_mask = 0;
4528 int i;
4529
4530 /* Build the matching 'supported_machs' bitmask */
4531 if (machine_is_msm8960_cdp())
4532 mach_mask = I2C_SURF;
4533 else if (machine_is_msm8960_rumi3())
4534 mach_mask = I2C_RUMI;
4535 else if (machine_is_msm8960_sim())
4536 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004537 else if (machine_is_msm8960_fluid())
4538 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004539 else if (machine_is_msm8960_liquid())
4540 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004541 else if (machine_is_msm8960_mtp())
4542 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004543 else
4544 pr_err("unmatched machine ID in register_i2c_devices\n");
4545
4546 /* Run the array and install devices as appropriate */
4547 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4548 if (msm8960_i2c_devices[i].machs & mach_mask)
4549 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4550 msm8960_i2c_devices[i].info,
4551 msm8960_i2c_devices[i].len);
4552 }
4553#endif
4554}
4555
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004556static void __init msm8960_sim_init(void)
4557{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004558 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4559 &msm8960_device_watchdog.dev.platform_data;
4560
4561 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004562 BUG_ON(msm_rpm_init(&msm_rpm_data));
4563 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4564 ARRAY_SIZE(msm_rpmrs_levels)));
4565 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004566 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004567 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004568 msm8960_device_ssbi_pm8921.dev.platform_data =
4569 &msm8960_ssbi_pm8921_pdata;
4570 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004571
4572 /* Simulator supports a QWERTY keypad */
4573 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4574
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004575 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4576 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4577 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004578 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004579 msm8960_i2c_init();
4580 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4581 msm_spm_l2_init(msm_spm_l2_data);
4582 msm8960_init_buses();
4583 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4584 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004585 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004586 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004587
4588 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4589 &msm8960_qup_spi_gsbi1_pdata;
4590 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4591
4592 msm8960_init_mmc();
4593 msm_fb_add_devices();
4594 slim_register_board_info(msm_slim_devices,
4595 ARRAY_SIZE(msm_slim_devices));
4596 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4597 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4598 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4599 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004600 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004601}
4602
4603static void __init msm8960_rumi3_init(void)
4604{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004605 BUG_ON(msm_rpm_init(&msm_rpm_data));
4606 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4607 ARRAY_SIZE(msm_rpmrs_levels)));
4608 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004609 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004610 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004611 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004612 msm8960_device_ssbi_pm8921.dev.platform_data =
4613 &msm8960_ssbi_pm8921_pdata;
4614 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4615 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4616 &msm8960_qup_spi_gsbi1_pdata;
4617 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4618 msm8960_i2c_init();
4619 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4620 msm_spm_l2_init(msm_spm_l2_data);
4621 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4622 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004623 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004624 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004625 register_i2c_devices();
4626 msm_fb_add_devices();
4627 slim_register_board_info(msm_slim_devices,
4628 ARRAY_SIZE(msm_slim_devices));
4629 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4630 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4631 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4632 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004633 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004634}
4635
4636static void __init msm8960_cdp_init(void)
4637{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004638 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4639 pr_err("meminfo_init() failed!\n");
4640
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004641 BUG_ON(msm_rpm_init(&msm_rpm_data));
4642 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4643 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004644
4645 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004646 regulator_suppress_info_printing();
4647 if (msm_xo_init())
4648 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004649 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004650 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304651 if (machine_is_msm8960_liquid())
4652 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004653 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4654 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4655 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304656#ifdef CONFIG_USB_EHCI_MSM_HSIC
4657 if (machine_is_msm8960_liquid()) {
4658 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4659 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4660 }
4661#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304662 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004663 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304664 if (machine_is_msm8960_liquid())
4665 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004666 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4667 &msm8960_qup_spi_gsbi1_pdata;
4668 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4669 msm8960_device_ssbi_pm8921.dev.platform_data =
4670 &msm8960_ssbi_pm8921_pdata;
4671 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4672 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004673 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004674 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4675 msm_spm_l2_init(msm_spm_l2_data);
4676 msm8960_init_buses();
4677 platform_add_devices(msm_footswitch_devices,
4678 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004679 if (machine_is_msm8960_liquid())
4680 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004681 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4682 pm8921_gpio_mpp_init();
4683 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004684 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004685 msm8960_init_cam();
4686 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004687 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304688 if (machine_is_msm8960_liquid())
4689 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004690 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004691 msm_fb_add_devices();
4692 slim_register_board_info(msm_slim_devices,
4693 ARRAY_SIZE(msm_slim_devices));
4694 msm8960_init_dsps();
4695 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4696 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4697 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4698 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004699 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004700 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004701}
4702
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004703MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4704 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004705 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004706 .init_irq = msm8960_init_irq,
4707 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004708 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004709 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004710 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004711MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004712
4713MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4714 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004715 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004716 .init_irq = msm8960_init_irq,
4717 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004718 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004719 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004720 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004721MACHINE_END
4722
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004723MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4724 .map_io = msm8960_map_io,
4725 .reserve = msm8960_reserve,
4726 .init_irq = msm8960_init_irq,
4727 .timer = &msm_timer,
4728 .init_machine = msm8960_cdp_init,
4729 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004730 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004731MACHINE_END
4732
4733MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4734 .map_io = msm8960_map_io,
4735 .reserve = msm8960_reserve,
4736 .init_irq = msm8960_init_irq,
4737 .timer = &msm_timer,
4738 .init_machine = msm8960_cdp_init,
4739 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004740 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004741MACHINE_END
4742
4743MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4744 .map_io = msm8960_map_io,
4745 .reserve = msm8960_reserve,
4746 .init_irq = msm8960_init_irq,
4747 .timer = &msm_timer,
4748 .init_machine = msm8960_cdp_init,
4749 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004750 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004751MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004752
4753MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4754 .map_io = msm8960_map_io,
4755 .reserve = msm8960_reserve,
4756 .init_irq = msm8960_init_irq,
4757 .timer = &msm_timer,
4758 .init_machine = msm8960_cdp_init,
4759 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004760 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004761MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004762
4763#ifdef CONFIG_ARCH_MSM8930
4764MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4765 .map_io = msm8930_map_io,
4766 .reserve = msm8960_reserve,
4767 .init_irq = msm8960_init_irq,
4768 .timer = &msm_timer,
4769 .init_machine = msm8960_cdp_init,
4770 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004771 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004772MACHINE_END
4773
4774MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4775 .map_io = msm8930_map_io,
4776 .reserve = msm8960_reserve,
4777 .init_irq = msm8960_init_irq,
4778 .timer = &msm_timer,
4779 .init_machine = msm8960_cdp_init,
4780 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004781 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004782MACHINE_END
4783
4784MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4785 .map_io = msm8930_map_io,
4786 .reserve = msm8960_reserve,
4787 .init_irq = msm8960_init_irq,
4788 .timer = &msm_timer,
4789 .init_machine = msm8960_cdp_init,
4790 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004791 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004792MACHINE_END
4793#endif