blob: 3636963a3db62555027c88ac91ca1d51fe5e8a77 [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 }
1422}
1423#endif
1424
1425#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001426#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001427#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001428#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001429#endif
1430
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001431
1432#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001433#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001434#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001435#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1436#else
1437#define MSM_FB_EXT_BUF_SIZE 0
1438#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001439
kuogee hsieh3830eb92011-09-12 15:25:57 -07001440#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1441/* width x height x 3 bpp x 2 frame buffer */
1442#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1443#define MSM_FB_WRITEBACK_OFFSET \
1444 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1445#else
1446#define MSM_FB_WRITEBACK_SIZE 0
1447#define MSM_FB_WRITEBACK_OFFSET 0
1448#endif
1449
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001450#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1451/* 4 bpp x 2 page HDMI case */
1452#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1453#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001454/* Note: must be multiple of 4096 */
1455#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1456 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001457#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001458
1459static int writeback_offset(void)
1460{
1461 return MSM_FB_WRITEBACK_OFFSET;
1462}
1463
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001464
1465#define MDP_VSYNC_GPIO 0
1466
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001467#define PANEL_NAME_MAX_LEN 30
1468#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1469#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1470#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1471#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1472#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1473#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1474#define HDMI_PANEL_NAME "hdmi_msm"
1475#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001476
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001477static struct resource msm_fb_resources[] = {
1478 {
1479 .flags = IORESOURCE_DMA,
1480 }
1481};
1482
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001483static int msm_fb_detect_panel(const char *name)
1484{
1485 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001486 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1487 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1488 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001489 return 0;
1490 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001491 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1492 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1493 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001494 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001495
1496#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1497 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1498 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1499 PANEL_NAME_MAX_LEN)))
1500 return 0;
1501
1502 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1503 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1504 PANEL_NAME_MAX_LEN)))
1505 return 0;
1506
1507 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1508 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1509 PANEL_NAME_MAX_LEN)))
1510 return 0;
1511
1512 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1513 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1514 PANEL_NAME_MAX_LEN)))
1515 return 0;
1516#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001517 }
1518
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001519 if (!strncmp(name, HDMI_PANEL_NAME,
1520 strnlen(HDMI_PANEL_NAME,
1521 PANEL_NAME_MAX_LEN)))
1522 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001523
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001524 if (!strncmp(name, TVOUT_PANEL_NAME,
1525 strnlen(TVOUT_PANEL_NAME,
1526 PANEL_NAME_MAX_LEN)))
1527 return 0;
1528
1529 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001530 return -ENODEV;
1531}
1532
1533static struct msm_fb_platform_data msm_fb_pdata = {
1534 .detect_client = msm_fb_detect_panel,
1535};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001536
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001537static struct platform_device msm_fb_device = {
1538 .name = "msm_fb",
1539 .id = 0,
1540 .num_resources = ARRAY_SIZE(msm_fb_resources),
1541 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001542 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001543};
1544
1545static bool dsi_power_on;
1546
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001547/**
1548 * LiQUID panel on/off
1549 *
1550 * @param on
1551 *
1552 * @return int
1553 */
1554static int mipi_dsi_liquid_panel_power(int on)
1555{
1556 static struct regulator *reg_l2, *reg_ext_3p3v;
1557 static int gpio21, gpio24, gpio43;
1558 int rc;
1559
1560 pr_info("%s: on=%d\n", __func__, on);
1561
1562 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1563 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1564 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1565
1566 if (!dsi_power_on) {
1567
1568 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1569 "dsi_vdda");
1570 if (IS_ERR(reg_l2)) {
1571 pr_err("could not get 8921_l2, rc = %ld\n",
1572 PTR_ERR(reg_l2));
1573 return -ENODEV;
1574 }
1575
1576 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1577 if (rc) {
1578 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1579 return -EINVAL;
1580 }
1581
1582 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1583 "vdd_lvds_3p3v");
1584 if (IS_ERR(reg_ext_3p3v)) {
1585 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1586 PTR_ERR(reg_ext_3p3v));
1587 return -ENODEV;
1588 }
1589
1590 rc = gpio_request(gpio21, "disp_pwr_en_n");
1591 if (rc) {
1592 pr_err("request gpio 21 failed, rc=%d\n", rc);
1593 return -ENODEV;
1594 }
1595
1596 rc = gpio_request(gpio43, "disp_rst_n");
1597 if (rc) {
1598 pr_err("request gpio 43 failed, rc=%d\n", rc);
1599 return -ENODEV;
1600 }
1601
1602 rc = gpio_request(gpio24, "disp_backlight_pwm");
1603 if (rc) {
1604 pr_err("request gpio 24 failed, rc=%d\n", rc);
1605 return -ENODEV;
1606 }
1607
1608 dsi_power_on = true;
1609 }
1610
1611 if (on) {
1612 rc = regulator_set_optimum_mode(reg_l2, 100000);
1613 if (rc < 0) {
1614 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1615 return -EINVAL;
1616 }
1617 rc = regulator_enable(reg_l2);
1618 if (rc) {
1619 pr_err("enable l2 failed, rc=%d\n", rc);
1620 return -ENODEV;
1621 }
1622
1623 rc = regulator_enable(reg_ext_3p3v);
1624 if (rc) {
1625 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1626 return -ENODEV;
1627 }
1628
1629 /* set reset pin before power enable */
1630 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1631
1632 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1633 msleep(20);
1634 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1635 msleep(20);
1636 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1637 msleep(20);
1638 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1639 msleep(20);
1640 } else {
1641 gpio_set_value_cansleep(gpio43, 0);
1642 gpio_set_value_cansleep(gpio21, 1);
1643
1644 rc = regulator_disable(reg_l2);
1645 if (rc) {
1646 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1647 return -ENODEV;
1648 }
1649 rc = regulator_disable(reg_ext_3p3v);
1650 if (rc) {
1651 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1652 return -ENODEV;
1653 }
1654 rc = regulator_set_optimum_mode(reg_l2, 100);
1655 if (rc < 0) {
1656 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1657 return -EINVAL;
1658 }
1659 }
1660
1661 return 0;
1662}
1663
1664static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001665{
1666 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001667 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001668 int rc;
1669
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001670 pr_info("%s: state : %d\n", __func__, on);
1671
1672 if (!dsi_power_on) {
1673
1674 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1675 "dsi_vdc");
1676 if (IS_ERR(reg_l8)) {
1677 pr_err("could not get 8921_l8, rc = %ld\n",
1678 PTR_ERR(reg_l8));
1679 return -ENODEV;
1680 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001681 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1682 "dsi_vddio");
1683 if (IS_ERR(reg_l23)) {
1684 pr_err("could not get 8921_l23, rc = %ld\n",
1685 PTR_ERR(reg_l23));
1686 return -ENODEV;
1687 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001688 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1689 "dsi_vdda");
1690 if (IS_ERR(reg_l2)) {
1691 pr_err("could not get 8921_l2, rc = %ld\n",
1692 PTR_ERR(reg_l2));
1693 return -ENODEV;
1694 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001695 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1696 if (rc) {
1697 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1698 return -EINVAL;
1699 }
1700 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1701 if (rc) {
1702 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1703 return -EINVAL;
1704 }
1705 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1706 if (rc) {
1707 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1708 return -EINVAL;
1709 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001710 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1711 rc = gpio_request(gpio43, "disp_rst_n");
1712 if (rc) {
1713 pr_err("request gpio 43 failed, rc=%d\n", rc);
1714 return -ENODEV;
1715 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716 dsi_power_on = true;
1717 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001718 if (on) {
1719 rc = regulator_set_optimum_mode(reg_l8, 100000);
1720 if (rc < 0) {
1721 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1722 return -EINVAL;
1723 }
1724 rc = regulator_set_optimum_mode(reg_l23, 100000);
1725 if (rc < 0) {
1726 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1727 return -EINVAL;
1728 }
1729 rc = regulator_set_optimum_mode(reg_l2, 100000);
1730 if (rc < 0) {
1731 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1732 return -EINVAL;
1733 }
1734 rc = regulator_enable(reg_l8);
1735 if (rc) {
1736 pr_err("enable l8 failed, rc=%d\n", rc);
1737 return -ENODEV;
1738 }
1739 rc = regulator_enable(reg_l23);
1740 if (rc) {
1741 pr_err("enable l8 failed, rc=%d\n", rc);
1742 return -ENODEV;
1743 }
1744 rc = regulator_enable(reg_l2);
1745 if (rc) {
1746 pr_err("enable l2 failed, rc=%d\n", rc);
1747 return -ENODEV;
1748 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001749 gpio_set_value_cansleep(gpio43, 1);
1750 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001751 rc = regulator_disable(reg_l2);
1752 if (rc) {
1753 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1754 return -ENODEV;
1755 }
1756 rc = regulator_disable(reg_l8);
1757 if (rc) {
1758 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1759 return -ENODEV;
1760 }
1761 rc = regulator_disable(reg_l23);
1762 if (rc) {
1763 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1764 return -ENODEV;
1765 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001766 rc = regulator_set_optimum_mode(reg_l8, 100);
1767 if (rc < 0) {
1768 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1769 return -EINVAL;
1770 }
1771 rc = regulator_set_optimum_mode(reg_l23, 100);
1772 if (rc < 0) {
1773 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1774 return -EINVAL;
1775 }
1776 rc = regulator_set_optimum_mode(reg_l2, 100);
1777 if (rc < 0) {
1778 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1779 return -EINVAL;
1780 }
1781 gpio_set_value_cansleep(gpio43, 0);
1782 }
1783 return 0;
1784}
1785
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001786static int mipi_dsi_panel_power(int on)
1787{
1788 int ret;
1789
1790 pr_info("%s: on=%d\n", __func__, on);
1791
1792 if (machine_is_msm8960_liquid())
1793 ret = mipi_dsi_liquid_panel_power(on);
1794 else
1795 ret = mipi_dsi_cdp_panel_power(on);
1796
1797 return ret;
1798}
1799
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001800static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1801 .vsync_gpio = MDP_VSYNC_GPIO,
1802 .dsi_power_save = mipi_dsi_panel_power,
1803};
1804
1805#ifdef CONFIG_MSM_BUS_SCALING
1806
1807static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001808 {
1809 .src = MSM_BUS_MASTER_MDP_PORT0,
1810 .dst = MSM_BUS_SLAVE_EBI_CH0,
1811 .ab = 0,
1812 .ib = 0,
1813 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001814};
1815
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001816#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1817static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1818 /* If HDMI is used as primary */
1819 {
1820 .src = MSM_BUS_MASTER_MDP_PORT0,
1821 .dst = MSM_BUS_SLAVE_EBI_CH0,
1822 .ab = 2000000000,
1823 .ib = 2000000000,
1824 },
1825};
1826static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1827 {
1828 ARRAY_SIZE(mdp_init_vectors),
1829 mdp_init_vectors,
1830 },
1831 {
1832 ARRAY_SIZE(hdmi_as_primary_vectors),
1833 hdmi_as_primary_vectors,
1834 },
1835 {
1836 ARRAY_SIZE(hdmi_as_primary_vectors),
1837 hdmi_as_primary_vectors,
1838 },
1839 {
1840 ARRAY_SIZE(hdmi_as_primary_vectors),
1841 hdmi_as_primary_vectors,
1842 },
1843 {
1844 ARRAY_SIZE(hdmi_as_primary_vectors),
1845 hdmi_as_primary_vectors,
1846 },
1847 {
1848 ARRAY_SIZE(hdmi_as_primary_vectors),
1849 hdmi_as_primary_vectors,
1850 },
1851};
1852#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001853static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001854 {
1855 .src = MSM_BUS_MASTER_MDP_PORT0,
1856 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001857 .ab = 216000000 * 2,
1858 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001859 },
1860};
1861
1862static struct msm_bus_vectors mdp_vga_vectors[] = {
1863 /* VGA and less video */
1864 {
1865 .src = MSM_BUS_MASTER_MDP_PORT0,
1866 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001867 .ab = 216000000 * 2,
1868 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001869 },
1870};
1871
1872static struct msm_bus_vectors mdp_720p_vectors[] = {
1873 /* 720p and less video */
1874 {
1875 .src = MSM_BUS_MASTER_MDP_PORT0,
1876 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001877 .ab = 230400000 * 2,
1878 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001879 },
1880};
1881
1882static struct msm_bus_vectors mdp_1080p_vectors[] = {
1883 /* 1080p and less video */
1884 {
1885 .src = MSM_BUS_MASTER_MDP_PORT0,
1886 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001887 .ab = 334080000 * 2,
1888 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001889 },
1890};
1891
1892static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1893 {
1894 ARRAY_SIZE(mdp_init_vectors),
1895 mdp_init_vectors,
1896 },
1897 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001898 ARRAY_SIZE(mdp_ui_vectors),
1899 mdp_ui_vectors,
1900 },
1901 {
1902 ARRAY_SIZE(mdp_ui_vectors),
1903 mdp_ui_vectors,
1904 },
1905 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001906 ARRAY_SIZE(mdp_vga_vectors),
1907 mdp_vga_vectors,
1908 },
1909 {
1910 ARRAY_SIZE(mdp_720p_vectors),
1911 mdp_720p_vectors,
1912 },
1913 {
1914 ARRAY_SIZE(mdp_1080p_vectors),
1915 mdp_1080p_vectors,
1916 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001917};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001918#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001919
1920static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1921 mdp_bus_scale_usecases,
1922 ARRAY_SIZE(mdp_bus_scale_usecases),
1923 .name = "mdp",
1924};
1925
1926#endif
1927
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001928#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1929int mdp_core_clk_rate_table[] = {
1930 200000000,
1931 200000000,
1932 200000000,
1933 200000000,
1934};
1935#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001936int mdp_core_clk_rate_table[] = {
1937 85330000,
1938 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001939 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001940 200000000,
1941};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001942#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001943
1944static struct msm_panel_common_pdata mdp_pdata = {
1945 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001946#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1947 .mdp_core_clk_rate = 200000000,
1948#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001949 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001950#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001951 .mdp_core_clk_table = mdp_core_clk_rate_table,
1952 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1953#ifdef CONFIG_MSM_BUS_SCALING
1954 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1955#endif
1956 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001957 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001958};
1959
1960static struct platform_device mipi_dsi_renesas_panel_device = {
1961 .name = "mipi_renesas",
1962 .id = 0,
1963};
1964
1965static struct platform_device mipi_dsi_simulator_panel_device = {
1966 .name = "mipi_simulator",
1967 .id = 0,
1968};
1969
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001970#define LPM_CHANNEL0 0
1971static int toshiba_gpio[] = {LPM_CHANNEL0};
1972
1973static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1974 .gpio = toshiba_gpio,
1975};
1976
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001977static struct platform_device mipi_dsi_toshiba_panel_device = {
1978 .name = "mipi_toshiba",
1979 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001980 .dev = {
1981 .platform_data = &toshiba_pdata,
1982 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001983};
1984
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001985#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001986static int dsi2lvds_gpio[2] = {
1987 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1988 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1989 };
1990
1991static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1992 .gpio_num = dsi2lvds_gpio,
1993};
1994
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07001995static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
1996
1997/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
1998 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
1999 /* timing */
2000 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2001 0x0c, 0x03, 0x04, 0xa0},
2002 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2003 {0xff, 0x00, 0x06, 0x00}, /* strength */
2004 /* pll control */
2005 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2006 0x40, 0x07, 0x03,
2007 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2008};
2009
2010static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002011 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2012 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002013 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2014};
2015
2016static struct platform_device mipi_dsi_novatek_panel_device = {
2017 .name = "mipi_novatek",
2018 .id = 0,
2019 .dev = {
2020 .platform_data = &novatek_pdata,
2021 }
2022};
2023
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002024static struct platform_device mipi_dsi2lvds_bridge_device = {
2025 .name = "mipi_tc358764",
2026 .id = 0,
2027 .dev.platform_data = &mipi_dsi2lvds_pdata,
2028};
2029
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002030#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2031static struct resource hdmi_msm_resources[] = {
2032 {
2033 .name = "hdmi_msm_qfprom_addr",
2034 .start = 0x00700000,
2035 .end = 0x007060FF,
2036 .flags = IORESOURCE_MEM,
2037 },
2038 {
2039 .name = "hdmi_msm_hdmi_addr",
2040 .start = 0x04A00000,
2041 .end = 0x04A00FFF,
2042 .flags = IORESOURCE_MEM,
2043 },
2044 {
2045 .name = "hdmi_msm_irq",
2046 .start = HDMI_IRQ,
2047 .end = HDMI_IRQ,
2048 .flags = IORESOURCE_IRQ,
2049 },
2050};
2051
2052static int hdmi_enable_5v(int on);
2053static int hdmi_core_power(int on, int show);
2054static int hdmi_cec_power(int on);
2055
2056static struct msm_hdmi_platform_data hdmi_msm_data = {
2057 .irq = HDMI_IRQ,
2058 .enable_5v = hdmi_enable_5v,
2059 .core_power = hdmi_core_power,
2060 .cec_power = hdmi_cec_power,
2061};
2062
2063static struct platform_device hdmi_msm_device = {
2064 .name = "hdmi_msm",
2065 .id = 0,
2066 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2067 .resource = hdmi_msm_resources,
2068 .dev.platform_data = &hdmi_msm_data,
2069};
2070#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2071
Vinay Kalia291263e2011-11-01 17:07:05 -07002072#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2073static struct platform_device wfd_panel_device = {
2074 .name = "wfd_panel",
2075 .id = 0,
2076 .dev.platform_data = NULL,
2077};
2078#endif
2079
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002080#ifdef CONFIG_MSM_BUS_SCALING
2081static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2082 {
2083 .src = MSM_BUS_MASTER_MDP_PORT0,
2084 .dst = MSM_BUS_SLAVE_EBI_CH0,
2085 .ab = 0,
2086 .ib = 0,
2087 },
2088};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002089
2090#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2091static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2092 {
2093 .src = MSM_BUS_MASTER_MDP_PORT0,
2094 .dst = MSM_BUS_SLAVE_EBI_CH0,
2095 .ab = 2000000000,
2096 .ib = 2000000000,
2097 },
2098};
2099#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002100static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2101 {
2102 .src = MSM_BUS_MASTER_MDP_PORT0,
2103 .dst = MSM_BUS_SLAVE_EBI_CH0,
2104 .ab = 566092800 * 2,
2105 .ib = 707616000 * 2,
2106 },
2107};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002108#endif
2109
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002110static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2111 {
2112 ARRAY_SIZE(dtv_bus_init_vectors),
2113 dtv_bus_init_vectors,
2114 },
2115 {
2116 ARRAY_SIZE(dtv_bus_def_vectors),
2117 dtv_bus_def_vectors,
2118 },
2119};
2120static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2121 dtv_bus_scale_usecases,
2122 ARRAY_SIZE(dtv_bus_scale_usecases),
2123 .name = "dtv",
2124};
2125
2126static struct lcdc_platform_data dtv_pdata = {
2127 .bus_scale_table = &dtv_bus_scale_pdata,
2128};
2129#endif
2130
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002131static void __init msm_fb_add_devices(void)
2132{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002133 struct platform_device *ptr = NULL;
2134
2135 if (machine_is_msm8960_liquid())
2136 ptr = &mipi_dsi2lvds_bridge_device;
2137 else
2138 ptr = &mipi_dsi_toshiba_panel_device;
2139 platform_add_devices(&ptr, 1);
2140
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002141 if (machine_is_msm8x60_rumi3()) {
2142 msm_fb_register_device("mdp", NULL);
2143 mipi_dsi_pdata.target_type = 1;
2144 } else
2145 msm_fb_register_device("mdp", &mdp_pdata);
2146 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002147#ifdef CONFIG_MSM_BUS_SCALING
2148 msm_fb_register_device("dtv", &dtv_pdata);
2149#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002150}
2151
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002152static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2153 .func = GPIOMUX_FUNC_GPIO,
2154 .drv = GPIOMUX_DRV_2MA,
2155 .pull = GPIOMUX_PULL_DOWN,
2156};
2157
2158static struct gpiomux_setting mdp_vsync_active_cfg = {
2159 .func = GPIOMUX_FUNC_1,
2160 .drv = GPIOMUX_DRV_2MA,
2161 .pull = GPIOMUX_PULL_DOWN,
2162};
2163
2164static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2165 {
2166 .gpio = MDP_VSYNC_GPIO,
2167 .settings = {
2168 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2169 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2170 },
2171 }
2172};
2173
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002174#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2175static struct gpiomux_setting hdmi_suspend_cfg = {
2176 .func = GPIOMUX_FUNC_GPIO,
2177 .drv = GPIOMUX_DRV_2MA,
2178 .pull = GPIOMUX_PULL_DOWN,
2179};
2180
2181static struct gpiomux_setting hdmi_active_1_cfg = {
2182 .func = GPIOMUX_FUNC_1,
2183 .drv = GPIOMUX_DRV_2MA,
2184 .pull = GPIOMUX_PULL_UP,
2185};
2186
2187static struct gpiomux_setting hdmi_active_2_cfg = {
2188 .func = GPIOMUX_FUNC_1,
2189 .drv = GPIOMUX_DRV_2MA,
2190 .pull = GPIOMUX_PULL_DOWN,
2191};
2192
2193static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2194 {
2195 .gpio = 99,
2196 .settings = {
2197 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2198 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2199 },
2200 },
2201 {
2202 .gpio = 100,
2203 .settings = {
2204 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2205 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2206 },
2207 },
2208 {
2209 .gpio = 101,
2210 .settings = {
2211 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2212 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2213 },
2214 },
2215 {
2216 .gpio = 102,
2217 .settings = {
2218 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2219 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2220 },
2221 },
2222};
2223
2224static int hdmi_enable_5v(int on)
2225{
2226 /* TBD: PM8921 regulator instead of 8901 */
2227 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2228 static int prev_on;
2229 int rc;
2230
2231 if (on == prev_on)
2232 return 0;
2233
2234 if (!reg_8921_hdmi_mvs)
2235 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2236 "hdmi_mvs");
2237
2238 if (on) {
2239 rc = regulator_enable(reg_8921_hdmi_mvs);
2240 if (rc) {
2241 pr_err("'%s' regulator enable failed, rc=%d\n",
2242 "8921_hdmi_mvs", rc);
2243 return rc;
2244 }
2245 pr_debug("%s(on): success\n", __func__);
2246 } else {
2247 rc = regulator_disable(reg_8921_hdmi_mvs);
2248 if (rc)
2249 pr_warning("'%s' regulator disable failed, rc=%d\n",
2250 "8921_hdmi_mvs", rc);
2251 pr_debug("%s(off): success\n", __func__);
2252 }
2253
2254 prev_on = on;
2255
2256 return 0;
2257}
2258
2259static int hdmi_core_power(int on, int show)
2260{
2261 static struct regulator *reg_8921_l23, *reg_8921_s4;
2262 static int prev_on;
2263 int rc;
2264
2265 if (on == prev_on)
2266 return 0;
2267
2268 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002269 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002270 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002271 if (IS_ERR(reg_8921_l23)) {
2272 pr_err("could not get reg_8921_l23, rc = %ld\n",
2273 PTR_ERR(reg_8921_l23));
2274 return -ENODEV;
2275 }
2276 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2277 if (rc) {
2278 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2279 return -EINVAL;
2280 }
2281 }
2282 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002283 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002284 if (IS_ERR(reg_8921_s4)) {
2285 pr_err("could not get reg_8921_s4, rc = %ld\n",
2286 PTR_ERR(reg_8921_s4));
2287 return -ENODEV;
2288 }
2289 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2290 if (rc) {
2291 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2292 return -EINVAL;
2293 }
2294 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002295
2296 if (on) {
2297 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2298 if (rc < 0) {
2299 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2300 return -EINVAL;
2301 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002302 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002303 if (rc) {
2304 pr_err("'%s' regulator enable failed, rc=%d\n",
2305 "hdmi_avdd", rc);
2306 return rc;
2307 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002308 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309 if (rc) {
2310 pr_err("'%s' regulator enable failed, rc=%d\n",
2311 "hdmi_vcc", rc);
2312 return rc;
2313 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002314 rc = gpio_request(100, "HDMI_DDC_CLK");
2315 if (rc) {
2316 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2317 "HDMI_DDC_CLK", 100, rc);
2318 goto error1;
2319 }
2320 rc = gpio_request(101, "HDMI_DDC_DATA");
2321 if (rc) {
2322 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2323 "HDMI_DDC_DATA", 101, rc);
2324 goto error2;
2325 }
2326 rc = gpio_request(102, "HDMI_HPD");
2327 if (rc) {
2328 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2329 "HDMI_HPD", 102, rc);
2330 goto error3;
2331 }
2332 pr_debug("%s(on): success\n", __func__);
2333 } else {
2334 gpio_free(100);
2335 gpio_free(101);
2336 gpio_free(102);
2337
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002338 rc = regulator_disable(reg_8921_l23);
2339 if (rc) {
2340 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2341 return -ENODEV;
2342 }
2343 rc = regulator_disable(reg_8921_s4);
2344 if (rc) {
2345 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2346 return -ENODEV;
2347 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002348 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2349 if (rc < 0) {
2350 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2351 return -EINVAL;
2352 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002353 pr_debug("%s(off): success\n", __func__);
2354 }
2355
2356 prev_on = on;
2357
2358 return 0;
2359
2360error3:
2361 gpio_free(101);
2362error2:
2363 gpio_free(100);
2364error1:
2365 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002366 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002367 return rc;
2368}
2369
2370static int hdmi_cec_power(int on)
2371{
2372 static int prev_on;
2373 int rc;
2374
2375 if (on == prev_on)
2376 return 0;
2377
2378 if (on) {
2379 rc = gpio_request(99, "HDMI_CEC_VAR");
2380 if (rc) {
2381 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2382 "HDMI_CEC_VAR", 99, rc);
2383 goto error;
2384 }
2385 pr_debug("%s(on): success\n", __func__);
2386 } else {
2387 gpio_free(99);
2388 pr_debug("%s(off): success\n", __func__);
2389 }
2390
2391 prev_on = on;
2392
2393 return 0;
2394error:
2395 return rc;
2396}
2397#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2398
2399static void __init msm8960_allocate_memory_regions(void)
2400{
2401 void *addr;
2402 unsigned long size;
2403
2404 size = MSM_FB_SIZE;
2405 addr = alloc_bootmem_align(size, 0x1000);
2406 msm_fb_resources[0].start = __pa(addr);
2407 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2408 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2409 size, addr, __pa(addr));
2410
2411}
2412#ifdef CONFIG_WCD9310_CODEC
2413
2414#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2415
Patrick Lai3043fba2011-08-01 14:15:57 -07002416/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2417 * 4 micbiases are used to power various analog and digital
2418 * microphones operating at 1800 mV. Technically, all micbiases
2419 * can source from single cfilter since all microphones operate
2420 * at the same voltage level. The arrangement below is to make
2421 * sure all cfilters are exercised. LDO_H regulator ouput level
2422 * does not need to be as high as 2.85V. It is choosen for
2423 * microphone sensitivity purpose.
2424 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002425static struct tabla_pdata tabla_platform_data = {
2426 .slimbus_slave_device = {
2427 .name = "tabla-slave",
2428 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2429 },
2430 .irq = MSM_GPIO_TO_INT(62),
2431 .irq_base = TABLA_INTERRUPT_BASE,
2432 .num_irqs = NR_TABLA_IRQS,
2433 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002434 .micbias = {
2435 .ldoh_v = TABLA_LDOH_2P85_V,
2436 .cfilt1_mv = 1800,
2437 .cfilt2_mv = 1800,
2438 .cfilt3_mv = 1800,
2439 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2440 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2441 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2442 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2443 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002444};
2445
2446static struct slim_device msm_slim_tabla = {
2447 .name = "tabla-slim",
2448 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2449 .dev = {
2450 .platform_data = &tabla_platform_data,
2451 },
2452};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302453
2454static struct tabla_pdata tabla20_platform_data = {
2455 .slimbus_slave_device = {
2456 .name = "tabla-slave",
2457 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2458 },
2459 .irq = MSM_GPIO_TO_INT(62),
2460 .irq_base = TABLA_INTERRUPT_BASE,
2461 .num_irqs = NR_TABLA_IRQS,
2462 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2463 .micbias = {
2464 .ldoh_v = TABLA_LDOH_2P85_V,
2465 .cfilt1_mv = 1800,
2466 .cfilt2_mv = 1800,
2467 .cfilt3_mv = 1800,
2468 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2469 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2470 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2471 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2472 }
2473};
2474
2475static struct slim_device msm_slim_tabla20 = {
2476 .name = "tabla2x-slim",
2477 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2478 .dev = {
2479 .platform_data = &tabla20_platform_data,
2480 },
2481};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002482#endif
2483
2484static struct slim_boardinfo msm_slim_devices[] = {
2485#ifdef CONFIG_WCD9310_CODEC
2486 {
2487 .bus_num = 1,
2488 .slim_slave = &msm_slim_tabla,
2489 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302490 {
2491 .bus_num = 1,
2492 .slim_slave = &msm_slim_tabla20,
2493 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002494#endif
2495 /* add more slimbus slaves as needed */
2496};
2497
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002498#define MSM_WCNSS_PHYS 0x03000000
2499#define MSM_WCNSS_SIZE 0x280000
2500
2501static struct resource resources_wcnss_wlan[] = {
2502 {
2503 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2504 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2505 .name = "wcnss_wlanrx_irq",
2506 .flags = IORESOURCE_IRQ,
2507 },
2508 {
2509 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2510 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2511 .name = "wcnss_wlantx_irq",
2512 .flags = IORESOURCE_IRQ,
2513 },
2514 {
2515 .start = MSM_WCNSS_PHYS,
2516 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2517 .name = "wcnss_mmio",
2518 .flags = IORESOURCE_MEM,
2519 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002520 {
2521 .start = 84,
2522 .end = 88,
2523 .name = "wcnss_gpios_5wire",
2524 .flags = IORESOURCE_IO,
2525 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002526};
2527
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002528static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2529 .has_48mhz_xo = 1,
2530};
2531
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002532static struct platform_device msm_device_wcnss_wlan = {
2533 .name = "wcnss_wlan",
2534 .id = 0,
2535 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2536 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002537 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002538};
2539
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002540#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2541 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2542 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2543 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2544
2545#define QCE_SIZE 0x10000
2546#define QCE_0_BASE 0x18500000
2547
2548#define QCE_HW_KEY_SUPPORT 0
2549#define QCE_SHA_HMAC_SUPPORT 1
2550#define QCE_SHARE_CE_RESOURCE 1
2551#define QCE_CE_SHARED 0
2552
2553static struct resource qcrypto_resources[] = {
2554 [0] = {
2555 .start = QCE_0_BASE,
2556 .end = QCE_0_BASE + QCE_SIZE - 1,
2557 .flags = IORESOURCE_MEM,
2558 },
2559 [1] = {
2560 .name = "crypto_channels",
2561 .start = DMOV_CE_IN_CHAN,
2562 .end = DMOV_CE_OUT_CHAN,
2563 .flags = IORESOURCE_DMA,
2564 },
2565 [2] = {
2566 .name = "crypto_crci_in",
2567 .start = DMOV_CE_IN_CRCI,
2568 .end = DMOV_CE_IN_CRCI,
2569 .flags = IORESOURCE_DMA,
2570 },
2571 [3] = {
2572 .name = "crypto_crci_out",
2573 .start = DMOV_CE_OUT_CRCI,
2574 .end = DMOV_CE_OUT_CRCI,
2575 .flags = IORESOURCE_DMA,
2576 },
2577};
2578
2579static struct resource qcedev_resources[] = {
2580 [0] = {
2581 .start = QCE_0_BASE,
2582 .end = QCE_0_BASE + QCE_SIZE - 1,
2583 .flags = IORESOURCE_MEM,
2584 },
2585 [1] = {
2586 .name = "crypto_channels",
2587 .start = DMOV_CE_IN_CHAN,
2588 .end = DMOV_CE_OUT_CHAN,
2589 .flags = IORESOURCE_DMA,
2590 },
2591 [2] = {
2592 .name = "crypto_crci_in",
2593 .start = DMOV_CE_IN_CRCI,
2594 .end = DMOV_CE_IN_CRCI,
2595 .flags = IORESOURCE_DMA,
2596 },
2597 [3] = {
2598 .name = "crypto_crci_out",
2599 .start = DMOV_CE_OUT_CRCI,
2600 .end = DMOV_CE_OUT_CRCI,
2601 .flags = IORESOURCE_DMA,
2602 },
2603};
2604
2605#endif
2606
2607#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2608 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2609
2610static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2611 .ce_shared = QCE_CE_SHARED,
2612 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2613 .hw_key_support = QCE_HW_KEY_SUPPORT,
2614 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2615};
2616
2617static struct platform_device qcrypto_device = {
2618 .name = "qcrypto",
2619 .id = 0,
2620 .num_resources = ARRAY_SIZE(qcrypto_resources),
2621 .resource = qcrypto_resources,
2622 .dev = {
2623 .coherent_dma_mask = DMA_BIT_MASK(32),
2624 .platform_data = &qcrypto_ce_hw_suppport,
2625 },
2626};
2627#endif
2628
2629#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2630 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2631
2632static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2633 .ce_shared = QCE_CE_SHARED,
2634 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2635 .hw_key_support = QCE_HW_KEY_SUPPORT,
2636 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2637};
2638
2639static struct platform_device qcedev_device = {
2640 .name = "qce",
2641 .id = 0,
2642 .num_resources = ARRAY_SIZE(qcedev_resources),
2643 .resource = qcedev_resources,
2644 .dev = {
2645 .coherent_dma_mask = DMA_BIT_MASK(32),
2646 .platform_data = &qcedev_ce_hw_suppport,
2647 },
2648};
2649#endif
2650
2651
2652static int __init gpiomux_init(void)
2653{
2654 int rc;
2655
2656 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2657 if (rc) {
2658 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2659 return rc;
2660 }
2661
Nishant Pandit24153d82011-08-27 16:05:13 +05302662 msm_gpiomux_install(msm8960_cam_common_configs,
2663 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002664
2665 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002666 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002667
2668 msm_gpiomux_install(msm8960_gsbi_configs,
2669 ARRAY_SIZE(msm8960_gsbi_configs));
2670
2671 msm_gpiomux_install(msm8960_cyts_configs,
2672 ARRAY_SIZE(msm8960_cyts_configs));
2673
2674 msm_gpiomux_install(msm8960_slimbus_config,
2675 ARRAY_SIZE(msm8960_slimbus_config));
2676
2677 msm_gpiomux_install(msm8960_audio_codec_configs,
2678 ARRAY_SIZE(msm8960_audio_codec_configs));
2679
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002680 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2681 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2682
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002683#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2684 msm_gpiomux_install(msm8960_hdmi_configs,
2685 ARRAY_SIZE(msm8960_hdmi_configs));
2686#endif
2687
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002688 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2689 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2690
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002691 msm_gpiomux_install(wcnss_5wire_interface,
2692 ARRAY_SIZE(wcnss_5wire_interface));
2693
2694 return 0;
2695}
2696
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002697#define MSM_SHARED_RAM_PHYS 0x80000000
2698
2699static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2700 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2701 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2702 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2703 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2704 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2705 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2706 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2707 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2708 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2709 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2710 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2711 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002712 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2713 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2714 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2715 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2716 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2717 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2718 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2719 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2720 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2721 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2722 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2723 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2724 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2725 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002726 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002727 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2728 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2729 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002730 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2731 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002732};
2733
2734static struct pm8921_adc_properties pm8921_adc_data = {
2735 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2736 .bitresolution = 15,
2737 .bipolar = 0,
2738};
2739
2740static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2741 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002742 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002743 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002744 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002745};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002746
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002747static void __init msm8960_map_io(void)
2748{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002749 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002750 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002751
2752 if (socinfo_init() < 0)
2753 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002754}
2755
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002756#ifdef CONFIG_ARCH_MSM8930
2757static void __init msm8930_map_io(void)
2758{
2759 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2760 msm_map_msm8930_io();
2761
2762 if (socinfo_init() < 0)
2763 pr_err("socinfo_init() failed!\n");
2764}
2765#endif
2766
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002767static void __init msm8960_init_irq(void)
2768{
2769 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002770
2771 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002772 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002773 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002774
2775 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002777
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002778 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2779 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002780
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002781 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2782 * as they are configured as level, which does not play nice with
2783 * handle_percpu_irq.
2784 */
2785 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2786 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002787 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002788 }
2789}
2790
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002791/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002792enum sdcc_controllers {
2793 SDCC1,
2794 SDCC2,
2795 SDCC3,
2796 SDCC4,
2797 SDCC5,
2798 MAX_SDCC_CONTROLLER
2799};
2800
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002801/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002802static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2803 /* SDCC1 : eMMC card connected */
2804 [SDCC1] = {
2805 .name = "sdc_vdd",
2806 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302807 .high_vol_level = 2950000,
2808 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302809 .always_on = 1,
2810 .lpm_sup = 1,
2811 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002812 .hpm_uA = 200000, /* 200mA */
2813 },
2814 /* SDCC3 : External card slot connected */
2815 [SDCC3] = {
2816 .name = "sdc_vdd",
2817 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302818 .high_vol_level = 2950000,
2819 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002820 .hpm_uA = 600000, /* 600mA */
2821 }
2822};
2823
2824/* Only slots having eMMC card will require VCCQ voltage */
2825static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2826 /* SDCC1 : eMMC card connected */
2827 [SDCC1] = {
2828 .name = "sdc_vccq",
2829 .set_voltage_sup = 1,
2830 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302831 .high_vol_level = 1800000,
2832 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002833 .hpm_uA = 200000, /* 200mA */
2834 }
2835};
2836
2837/* All SDCC controllers may require voting for VDD PAD voltage */
2838static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2839 /* SDCC3 : External card slot connected */
2840 [SDCC3] = {
2841 .name = "sdc_vddp",
2842 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302843 .high_vol_level = 2950000,
2844 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002845 .always_on = 1,
2846 .lpm_sup = 1,
2847 /* Max. Active current required is 16 mA */
2848 .hpm_uA = 16000,
2849 /*
2850 * Sleep current required is ~300 uA. But min. vote can be
2851 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2852 * during sleep.
2853 */
2854 .lpm_uA = 2000,
2855 }
2856};
2857
2858static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2859 /* SDCC1 : eMMC card connected */
2860 [SDCC1] = {
2861 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2862 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2863 },
2864 /* SDCC3 : External card slot connected */
2865 [SDCC3] = {
2866 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2867 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2868 }
2869};
2870
2871/* SDC1 pad data */
2872static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2873 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302874 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2875 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002876};
2877
2878static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2879 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2880 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2881 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2882};
2883
2884static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302885 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002886 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2887 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2888};
2889
2890static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302891 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002892 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2893 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2894};
2895
2896/* SDC3 pad data */
2897static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2898 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2899 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2900 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2901};
2902
2903static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2904 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2905 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2906 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2907};
2908
2909static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302910 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002911 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2912 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2913};
2914
2915static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302916 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302917 /*
2918 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2919 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2920 * which would result in false card detection interrupts.
2921 */
2922 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2923 /*
2924 * Keeping DATA lines status to PULL UP will make sure that
2925 * there is no current leak during sleep if external pull up
2926 * is connected to DATA lines.
2927 */
2928 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002929};
2930
2931struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2932 [SDCC1] = {
2933 .on = sdc1_pad_pull_on_cfg,
2934 .off = sdc1_pad_pull_off_cfg,
2935 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2936 },
2937 [SDCC3] = {
2938 .on = sdc3_pad_pull_on_cfg,
2939 .off = sdc3_pad_pull_off_cfg,
2940 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2941 },
2942};
2943
2944struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2945 [SDCC1] = {
2946 .on = sdc1_pad_drv_on_cfg,
2947 .off = sdc1_pad_drv_off_cfg,
2948 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2949 },
2950 [SDCC3] = {
2951 .on = sdc3_pad_drv_on_cfg,
2952 .off = sdc3_pad_drv_off_cfg,
2953 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2954 },
2955};
2956
2957struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2958 [SDCC1] = {
2959 .pull = &mmc_pad_pull_data[SDCC1],
2960 .drv = &mmc_pad_drv_data[SDCC1]
2961 },
2962 [SDCC3] = {
2963 .pull = &mmc_pad_pull_data[SDCC3],
2964 .drv = &mmc_pad_drv_data[SDCC3]
2965 },
2966};
2967
2968struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2969 [SDCC1] = {
2970 .pad_data = &mmc_pad_data[SDCC1],
2971 },
2972 [SDCC3] = {
2973 .pad_data = &mmc_pad_data[SDCC3],
2974 },
2975};
2976
2977static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302978 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002979};
2980
2981static unsigned int sdc3_sup_clk_rates[] = {
2982 400000, 24000000, 48000000, 96000000
2983};
2984
2985#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2986static struct mmc_platform_data msm8960_sdc1_data = {
2987 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2988#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2989 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2990#else
2991 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2992#endif
2993 .sup_clk_table = sdc1_sup_clk_rates,
2994 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05302995 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002996 .nonremovable = 1,
2997 .sdcc_v4_sup = true,
2998 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302999 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003000};
3001#endif
3002
3003#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3004static struct mmc_platform_data msm8960_sdc3_data = {
3005 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3006 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3007 .sup_clk_table = sdc3_sup_clk_rates,
3008 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303009 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303010#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003011 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303012#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003013 .sdcc_v4_sup = true,
3014 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3015 .pin_data = &mmc_slot_pin_data[SDCC3],
3016#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3017 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3018 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3019 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3020#endif
3021 .xpc_cap = 1,
3022 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3023 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303024 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003025};
3026#endif
3027
3028static void __init msm8960_init_mmc(void)
3029{
3030#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3031 /* SDC1 : eMMC card connected */
3032 msm_add_sdcc(1, &msm8960_sdc1_data);
3033#endif
3034#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3035 /* SDC3: External card slot */
3036 msm_add_sdcc(3, &msm8960_sdc3_data);
3037#endif
3038}
3039
3040static void __init msm8960_init_buses(void)
3041{
3042#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003043 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003044 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3045 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3046 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3047 msm_bus_apps_fabric.dev.platform_data =
3048 &msm_bus_8960_apps_fabric_pdata;
3049 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3050 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3051 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3052 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003053#endif
3054}
3055
3056static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3057 .max_clock_speed = 15060000,
3058};
3059
3060#ifdef CONFIG_USB_MSM_OTG_72K
3061static struct msm_otg_platform_data msm_otg_pdata;
3062#else
3063#define USB_5V_EN 42
3064static void msm_hsusb_vbus_power(bool on)
3065{
3066 int rc;
3067 static bool vbus_is_on;
3068 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003069
3070 if (vbus_is_on == on)
3071 return;
3072
3073 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003074 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3075 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003076 if (IS_ERR(mvs_otg_switch)) {
3077 pr_err("Unable to get mvs_otg_switch\n");
3078 return;
3079 }
3080
3081 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3082 "usb_5v_en");
3083 if (rc < 0) {
3084 pr_err("failed to request usb_5v_en gpio\n");
3085 goto put_mvs_otg;
3086 }
3087
Anji jonnala2936fd92011-11-09 15:39:22 +05303088 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3089 if (rc) {
3090 pr_err("%s: unable to set_direction for gpio [%d]\n",
3091 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003092 goto free_usb_5v_en;
3093 }
3094
Anji jonnala2936fd92011-11-09 15:39:22 +05303095 if (regulator_enable(mvs_otg_switch)) {
3096 pr_err("unable to enable mvs_otg_switch\n");
3097 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003098 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303099
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003100 vbus_is_on = true;
3101 return;
3102 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303103 regulator_disable(mvs_otg_switch);
3104err_ldo_gpio_set_dir:
3105 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003106free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303107 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003108put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303109 regulator_put(mvs_otg_switch);
3110 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003111}
3112
3113static struct msm_otg_platform_data msm_otg_pdata = {
3114 .mode = USB_OTG,
3115 .otg_control = OTG_PMIC_CONTROL,
3116 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3117 .pclk_src_name = "dfab_usb_hs_clk",
3118 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3119 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303120 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003121};
3122#endif
3123
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303124#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303125#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303126static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3127 .strobe = 150,
3128 .data = 151,
3129};
3130#else
3131static struct msm_hsic_host_platform_data msm_hsic_pdata;
3132#endif
3133
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003134#define PID_MAGIC_ID 0x71432909
3135#define SERIAL_NUM_MAGIC_ID 0x61945374
3136#define SERIAL_NUMBER_LENGTH 127
3137#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3138
3139struct magic_num_struct {
3140 uint32_t pid;
3141 uint32_t serial_num;
3142};
3143
3144struct dload_struct {
3145 uint32_t reserved1;
3146 uint32_t reserved2;
3147 uint32_t reserved3;
3148 uint16_t reserved4;
3149 uint16_t pid;
3150 char serial_number[SERIAL_NUMBER_LENGTH];
3151 uint16_t reserved5;
3152 struct magic_num_struct magic_struct;
3153};
3154
3155static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3156{
3157 struct dload_struct __iomem *dload = 0;
3158
3159 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3160 if (!dload) {
3161 pr_err("%s: cannot remap I/O memory region: %08x\n",
3162 __func__, DLOAD_USB_BASE_ADD);
3163 return -ENXIO;
3164 }
3165
3166 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3167 __func__, dload, pid, snum);
3168 /* update pid */
3169 dload->magic_struct.pid = PID_MAGIC_ID;
3170 dload->pid = pid;
3171
3172 /* update serial number */
3173 dload->magic_struct.serial_num = 0;
3174 if (!snum) {
3175 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3176 goto out;
3177 }
3178
3179 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003180 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003181out:
3182 iounmap(dload);
3183 return 0;
3184}
3185
3186static struct android_usb_platform_data android_usb_pdata = {
3187 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3188};
3189
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003190static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003191 .name = "android_usb",
3192 .id = -1,
3193 .dev = {
3194 .platform_data = &android_usb_pdata,
3195 },
3196};
3197
3198static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3199 0x03, 0x0f,
3200};
3201
3202static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3203 0x00, 0x24, 0x54, 0x10,
3204 0x09, 0x03, 0x01,
3205 0x10, 0x54, 0x30, 0x0C,
3206 0x24, 0x30, 0x0f,
3207};
3208
3209static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3210 0x00, 0x24, 0x54, 0x10,
3211 0x09, 0x07, 0x01, 0x0B,
3212 0x10, 0x54, 0x30, 0x0C,
3213 0x24, 0x30, 0x0f,
3214};
3215
3216static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3217 [0] = {
3218 .mode = MSM_SPM_MODE_CLOCK_GATING,
3219 .notify_rpm = false,
3220 .cmd = spm_wfi_cmd_sequence,
3221 },
3222 [1] = {
3223 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3224 .notify_rpm = false,
3225 .cmd = spm_power_collapse_without_rpm,
3226 },
3227 [2] = {
3228 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3229 .notify_rpm = true,
3230 .cmd = spm_power_collapse_with_rpm,
3231 },
3232};
3233
3234static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3235 [0] = {
3236 .reg_base_addr = MSM_SAW0_BASE,
3237 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3238 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3239 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3240#if defined(CONFIG_MSM_AVS_HW)
3241 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3242 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3243#endif
3244 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3245 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3246 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3247 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3248 .vctl_timeout_us = 50,
3249 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3250 .modes = msm_spm_seq_list,
3251 },
3252 [1] = {
3253 .reg_base_addr = MSM_SAW1_BASE,
3254 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3255 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3256 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3257#if defined(CONFIG_MSM_AVS_HW)
3258 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3259 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3260#endif
3261 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3262 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3263 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3264 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3265 .vctl_timeout_us = 50,
3266 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3267 .modes = msm_spm_seq_list,
3268 },
3269};
3270
3271static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3272 0x00, 0x20, 0x03, 0x20,
3273 0x00, 0x0f,
3274};
3275
3276static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3277 0x00, 0x20, 0x34, 0x64,
3278 0x48, 0x07, 0x48, 0x20,
3279 0x50, 0x64, 0x04, 0x34,
3280 0x50, 0x0f,
3281};
3282static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3283 0x00, 0x10, 0x34, 0x64,
3284 0x48, 0x07, 0x48, 0x10,
3285 0x50, 0x64, 0x04, 0x34,
3286 0x50, 0x0F,
3287};
3288
3289static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3290 [0] = {
3291 .mode = MSM_SPM_L2_MODE_RETENTION,
3292 .notify_rpm = false,
3293 .cmd = l2_spm_wfi_cmd_sequence,
3294 },
3295 [1] = {
3296 .mode = MSM_SPM_L2_MODE_GDHS,
3297 .notify_rpm = true,
3298 .cmd = l2_spm_gdhs_cmd_sequence,
3299 },
3300 [2] = {
3301 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3302 .notify_rpm = true,
3303 .cmd = l2_spm_power_off_cmd_sequence,
3304 },
3305};
3306
3307
3308static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3309 [0] = {
3310 .reg_base_addr = MSM_SAW_L2_BASE,
3311 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3312 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3313 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3314 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3315 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3316 .modes = msm_spm_l2_seq_list,
3317 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3318 },
3319};
3320
3321#define CYTTSP_TS_GPIO_IRQ 11
3322#define CYTTSP_TS_SLEEP_GPIO 50
3323#define CYTTSP_TS_RESOUT_N_GPIO 52
3324
3325/*virtual key support */
3326static ssize_t tma340_vkeys_show(struct kobject *kobj,
3327 struct kobj_attribute *attr, char *buf)
3328{
3329 return snprintf(buf, 200,
3330 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3331 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3332 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3333 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3334 "\n");
3335}
3336
3337static struct kobj_attribute tma340_vkeys_attr = {
3338 .attr = {
3339 .mode = S_IRUGO,
3340 },
3341 .show = &tma340_vkeys_show,
3342};
3343
3344static struct attribute *tma340_properties_attrs[] = {
3345 &tma340_vkeys_attr.attr,
3346 NULL
3347};
3348
3349static struct attribute_group tma340_properties_attr_group = {
3350 .attrs = tma340_properties_attrs,
3351};
3352
3353
3354static int cyttsp_platform_init(struct i2c_client *client)
3355{
3356 int rc = 0;
3357 static struct kobject *tma340_properties_kobj;
3358
3359 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3360 tma340_properties_kobj = kobject_create_and_add("board_properties",
3361 NULL);
3362 if (tma340_properties_kobj)
3363 rc = sysfs_create_group(tma340_properties_kobj,
3364 &tma340_properties_attr_group);
3365 if (!tma340_properties_kobj || rc)
3366 pr_err("%s: failed to create board_properties\n",
3367 __func__);
3368
3369 return 0;
3370}
3371
3372static struct cyttsp_regulator regulator_data[] = {
3373 {
3374 .name = "vdd",
3375 .min_uV = CY_TMA300_VTG_MIN_UV,
3376 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303377 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3378 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003379 },
3380 /* TODO: Remove after runtime PM is enabled in I2C driver */
3381 {
3382 .name = "vcc_i2c",
3383 .min_uV = CY_I2C_VTG_MIN_UV,
3384 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303385 .hpm_load_uA = CY_I2C_CURR_UA,
3386 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003387 },
3388};
3389
3390static struct cyttsp_platform_data cyttsp_pdata = {
3391 .panel_maxx = 634,
3392 .panel_maxy = 1166,
3393 .disp_maxx = 616,
3394 .disp_maxy = 1023,
3395 .disp_minx = 0,
3396 .disp_miny = 16,
3397 .flags = 0x01,
3398 .gen = CY_GEN3, /* or */
3399 .use_st = CY_USE_ST,
3400 .use_mt = CY_USE_MT,
3401 .use_hndshk = CY_SEND_HNDSHK,
3402 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303403 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003404 .use_gestures = CY_USE_GESTURES,
3405 .fw_fname = "cyttsp_8960_cdp.hex",
3406 /* activate up to 4 groups
3407 * and set active distance
3408 */
3409 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3410 CY_GEST_GRP3 | CY_GEST_GRP4 |
3411 CY_ACT_DIST,
3412 /* change act_intrvl to customize the Active power state
3413 * scanning/processing refresh interval for Operating mode
3414 */
3415 .act_intrvl = CY_ACT_INTRVL_DFLT,
3416 /* change tch_tmout to customize the touch timeout for the
3417 * Active power state for Operating mode
3418 */
3419 .tch_tmout = CY_TCH_TMOUT_DFLT,
3420 /* change lp_intrvl to customize the Low Power power state
3421 * scanning/processing refresh interval for Operating mode
3422 */
3423 .lp_intrvl = CY_LP_INTRVL_DFLT,
3424 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3425 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3426 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3427 .regulator_info = regulator_data,
3428 .num_regulators = ARRAY_SIZE(regulator_data),
3429 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303430 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003431};
3432
3433static struct i2c_board_info cyttsp_info[] __initdata = {
3434 {
3435 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3436 .platform_data = &cyttsp_pdata,
3437#ifndef CY_USE_TIMER
3438 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3439#endif /* CY_USE_TIMER */
3440 },
3441};
3442
Mohan Pallaka50837382011-09-07 11:00:57 +05303443/* configuration data */
3444static const u8 mxt_config_data[] = {
3445 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003446 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303447 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003448 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3449 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3450 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3451 0, 0, 0, 0, 0, 0, 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,
Mohan Pallaka50837382011-09-07 11:00:57 +05303455 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003456 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303457 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003458 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303459 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003460 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3461 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3462 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3463 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303464 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003465 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3466 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303467 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003468 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3469 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303470 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003471 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3472 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303473 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003474 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3475 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303476 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003477 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303478 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003479 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303480 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003481 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303482 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003483 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303484 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003485 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303486};
3487
3488#define MXT_TS_GPIO_IRQ 11
3489#define MXT_TS_LDO_EN_GPIO 50
3490#define MXT_TS_RESET_GPIO 52
3491
3492static void mxt_init_hw_liquid(void)
3493{
3494 int rc;
3495
3496 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3497 if (rc) {
3498 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3499 __func__, MXT_TS_GPIO_IRQ);
3500 return;
3501 }
3502
3503 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3504 if (rc) {
3505 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3506 __func__, MXT_TS_GPIO_IRQ);
3507 goto err_irq_gpio_req;
3508 }
3509
3510 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3511 if (rc) {
3512 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3513 __func__, MXT_TS_LDO_EN_GPIO);
3514 goto err_irq_gpio_req;
3515 }
3516
3517 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3518 if (rc) {
3519 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3520 __func__, MXT_TS_LDO_EN_GPIO);
3521 goto err_ldo_gpio_req;
3522 }
3523
3524 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3525 if (rc) {
3526 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3527 __func__, MXT_TS_RESET_GPIO);
3528 goto err_ldo_gpio_set_dir;
3529 }
3530
3531 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3532 if (rc) {
3533 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3534 __func__, MXT_TS_RESET_GPIO);
3535 goto err_reset_gpio_req;
3536 }
3537
3538 return;
3539
3540err_reset_gpio_req:
3541 gpio_free(MXT_TS_RESET_GPIO);
3542err_ldo_gpio_set_dir:
3543 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3544err_ldo_gpio_req:
3545 gpio_free(MXT_TS_LDO_EN_GPIO);
3546err_irq_gpio_req:
3547 gpio_free(MXT_TS_GPIO_IRQ);
3548}
3549
3550static struct mxt_platform_data mxt_platform_data = {
3551 .config = mxt_config_data,
3552 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003553 .x_size = 1365,
3554 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303555 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003556 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303557};
3558
3559static struct i2c_board_info mxt_device_info[] __initdata = {
3560 {
3561 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3562 .platform_data = &mxt_platform_data,
3563 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3564 },
3565};
3566
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003567static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3568{
3569}
3570
3571static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3572 .clk_freq = 100000,
3573 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003574 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3575};
3576
3577static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3578 .clk_freq = 100000,
3579 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003580 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3581};
3582
3583static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3584 .clk_freq = 100000,
3585 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003586 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3587};
3588
3589static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3590 .clk_freq = 100000,
3591 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003592 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3593};
3594
3595static struct msm_rpm_platform_data msm_rpm_data = {
3596 .reg_base_addrs = {
3597 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3598 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3599 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3600 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3601 },
3602
3603 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3604 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3605 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3606 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3607 .msm_apps_ipc_rpm_val = 4,
3608};
3609
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003610static struct ks8851_pdata spi_eth_pdata = {
3611 .irq_gpio = KS8851_IRQ_GPIO,
3612 .rst_gpio = KS8851_RST_GPIO,
3613};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003614
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003615static struct spi_board_info spi_board_info[] __initdata = {
3616 {
3617 .modalias = "ks8851",
3618 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3619 .max_speed_hz = 19200000,
3620 .bus_num = 0,
3621 .chip_select = 0,
3622 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003623 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003624 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003625 {
3626 .modalias = "dsi_novatek_3d_panel_spi",
3627 .max_speed_hz = 10800000,
3628 .bus_num = 0,
3629 .chip_select = 1,
3630 .mode = SPI_MODE_0,
3631 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003632};
3633
3634static struct platform_device msm_device_saw_core0 = {
3635 .name = "saw-regulator",
3636 .id = 0,
3637 .dev = {
3638 .platform_data = &msm_saw_regulator_pdata_s5,
3639 },
3640};
3641
3642static struct platform_device msm_device_saw_core1 = {
3643 .name = "saw-regulator",
3644 .id = 1,
3645 .dev = {
3646 .platform_data = &msm_saw_regulator_pdata_s6,
3647 },
3648};
3649
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003650#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3651static struct platform_device wfd_device = {
3652 .name = "msm_wfd",
3653 .id = -1,
3654};
3655#endif
3656
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003657static struct tsens_platform_data msm_tsens_pdata = {
3658 .slope = 910,
3659 .tsens_factor = 1000,
3660 .hw_type = MSM_8960,
3661 .tsens_num_sensor = 5,
3662};
3663
3664static struct platform_device msm_tsens_device = {
3665 .name = "tsens8960-tm",
3666 .id = -1,
3667 .dev = {
3668 .platform_data = &msm_tsens_pdata,
3669 },
3670};
3671
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003672#ifdef CONFIG_MSM_FAKE_BATTERY
3673static struct platform_device fish_battery_device = {
3674 .name = "fish_battery",
3675};
3676#endif
3677
David Collins26f05562011-06-20 09:56:28 -07003678static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003679 .name = GPIO_REGULATOR_DEV_NAME,
3680 .id = PM8921_MPP_PM_TO_SYS(7),
3681 .dev = {
3682 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3683 },
3684};
3685
David Collins26f05562011-06-20 09:56:28 -07003686static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003687 .name = GPIO_REGULATOR_DEV_NAME,
3688 .id = 91,
3689 .dev = {
3690 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3691 },
3692};
3693
David Collinsb10be1d2011-09-02 10:29:31 -07003694static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3695 .name = GPIO_REGULATOR_DEV_NAME,
3696 .id = PM8921_GPIO_PM_TO_SYS(17),
3697 .dev = {
3698 .platform_data =
3699 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3700 },
3701};
3702
David Collins26f05562011-06-20 09:56:28 -07003703static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3704 .name = "rpm-regulator",
3705 .id = -1,
3706 .dev = {
3707 .platform_data = &msm_rpm_regulator_pdata,
3708 },
3709};
3710
David Collins4c31a872011-08-31 10:07:10 -07003711static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3712 .phys_addr_base = 0x0010C000,
3713 .reg_offsets = {
3714 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3715 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3716 },
3717 .phys_size = SZ_8K,
3718 .log_len = 4096, /* log's buffer length in bytes */
3719 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3720};
3721
3722static struct platform_device msm_rpm_log_device = {
3723 .name = "msm_rpm_log",
3724 .id = -1,
3725 .dev = {
3726 .platform_data = &msm_rpm_log_pdata,
3727 },
3728};
3729
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003730static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003731 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003732 &msm_device_smd,
3733 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303734 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003735 &msm_device_saw_core0,
3736 &msm_device_saw_core1,
3737 &msm8960_device_ext_5v_vreg,
3738 &msm8960_device_ext_l2_vreg,
3739 &msm8960_device_ssbi_pm8921,
3740 &msm8960_device_qup_spi_gsbi1,
3741 &msm8960_device_qup_i2c_gsbi3,
3742 &msm8960_device_qup_i2c_gsbi4,
3743 &msm8960_device_qup_i2c_gsbi10,
3744#ifndef CONFIG_MSM_DSPS
3745 &msm8960_device_qup_i2c_gsbi12,
3746#endif
3747 &msm_slim_ctrl,
3748 &msm_device_wcnss_wlan,
3749#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3750 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3751 &qcrypto_device,
3752#endif
3753
3754#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3755 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3756 &qcedev_device,
3757#endif
3758#ifdef CONFIG_MSM_ROTATOR
3759 &msm_rotator_device,
3760#endif
3761 &msm_device_sps,
3762#ifdef CONFIG_MSM_FAKE_BATTERY
3763 &fish_battery_device,
3764#endif
3765#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003766#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003767 &android_pmem_device,
3768 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003769#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003770 &android_pmem_audio_device,
3771#endif
3772 &msm_fb_device,
3773 &msm_device_vidc,
3774 &msm_device_bam_dmux,
3775 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003776
3777#ifdef CONFIG_HW_RANDOM_MSM
3778 &msm_device_rng,
3779#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003780 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003781#ifdef CONFIG_ION_MSM
3782 &ion_dev,
3783#endif
David Collins4c31a872011-08-31 10:07:10 -07003784 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003785 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003786#ifdef CONFIG_MSM_QDSS
3787 &msm_etb_device,
3788 &msm_tpiu_device,
3789 &msm_funnel_device,
3790 &msm_ptm_device,
3791#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003792 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003793 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003794#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3795 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003796 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003797#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003798};
3799
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003800static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003801 &msm8960_device_otg,
3802 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003803 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303804 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003805 &android_usb_device,
3806 &msm_device_vidc,
3807 &mipi_dsi_simulator_panel_device,
3808 &msm_bus_apps_fabric,
3809 &msm_bus_sys_fabric,
3810 &msm_bus_mm_fabric,
3811 &msm_bus_sys_fpb,
3812 &msm_bus_cpss_fpb,
3813 &msm_pcm,
3814 &msm_pcm_routing,
3815 &msm_cpudai0,
3816 &msm_cpudai1,
3817 &msm_cpudai_hdmi_rx,
3818 &msm_cpudai_bt_rx,
3819 &msm_cpudai_bt_tx,
3820 &msm_cpudai_fm_rx,
3821 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003822 &msm_cpudai_auxpcm_rx,
3823 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003824 &msm_cpu_fe,
3825 &msm_stub_codec,
3826 &msm_voice,
3827 &msm_voip,
3828 &msm_lpa_pcm,
3829
3830#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3831 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3832 &qcrypto_device,
3833#endif
3834
3835#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3836 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3837 &qcedev_device,
3838#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003839};
3840
3841static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003842 &msm_kgsl_3d0,
3843 &msm_kgsl_2d0,
3844 &msm_kgsl_2d1,
3845 &mipi_dsi_renesas_panel_device,
3846#ifdef CONFIG_MSM_GEMINI
3847 &msm8960_gemini_device,
3848#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003849};
3850
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003851static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003852 &msm8960_device_otg,
3853 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003854 &msm_device_hsusb_host,
3855 &android_usb_device,
3856 &msm_pcm,
3857 &msm_pcm_routing,
3858 &msm_cpudai0,
3859 &msm_cpudai1,
3860 &msm_cpudai_hdmi_rx,
3861 &msm_cpudai_bt_rx,
3862 &msm_cpudai_bt_tx,
3863 &msm_cpudai_fm_rx,
3864 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003865 &msm_cpudai_auxpcm_rx,
3866 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003867 &msm_cpu_fe,
3868 &msm_stub_codec,
3869 &msm_kgsl_3d0,
3870#ifdef CONFIG_MSM_KGSL_2D
3871 &msm_kgsl_2d0,
3872 &msm_kgsl_2d1,
3873#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003874 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003875#ifdef CONFIG_MSM_GEMINI
3876 &msm8960_gemini_device,
3877#endif
3878 &msm_voice,
3879 &msm_voip,
3880 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303881 &msm_cpudai_afe_01_rx,
3882 &msm_cpudai_afe_01_tx,
3883 &msm_cpudai_afe_02_rx,
3884 &msm_cpudai_afe_02_tx,
3885 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003886#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3887 &hdmi_msm_device,
3888#endif
3889 &msm_pcm_hostless,
3890 &msm_bus_apps_fabric,
3891 &msm_bus_sys_fabric,
3892 &msm_bus_mm_fabric,
3893 &msm_bus_sys_fpb,
3894 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003895 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003896};
3897
3898static void __init msm8960_i2c_init(void)
3899{
3900 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3901 &msm8960_i2c_qup_gsbi4_pdata;
3902
3903 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3904 &msm8960_i2c_qup_gsbi3_pdata;
3905
3906 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3907 &msm8960_i2c_qup_gsbi10_pdata;
3908
3909 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3910 &msm8960_i2c_qup_gsbi12_pdata;
3911}
3912
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003913static void __init msm8960_gfx_init(void)
3914{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003915 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003916 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3917 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3918 msm_kgsl_3d0.dev.platform_data;
3919 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3920 320000000;
3921 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3922 266667000;
3923 }
3924}
3925
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003926static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3927 .irq_base = PM8921_IRQ_BASE,
3928 .devirq = MSM_GPIO_TO_INT(104),
3929 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3930};
3931
3932static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3933 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3934};
3935
3936static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3937 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3938};
3939
3940static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3941 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303942 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003943};
3944
3945static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3946 .pull_up = 1,
3947 .kpd_trigger_delay_us = 970,
3948 .wakeup = 1,
3949};
3950
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303951/* Rotate lock key is not available so use F1 */
3952#define KEY_ROTATE_LOCK KEY_F1
3953
3954static const unsigned int keymap_liquid[] = {
3955 KEY(0, 0, KEY_VOLUMEUP),
3956 KEY(0, 1, KEY_VOLUMEDOWN),
3957 KEY(1, 3, KEY_ROTATE_LOCK),
3958 KEY(1, 4, KEY_HOME),
3959};
3960
3961static struct matrix_keymap_data keymap_data_liquid = {
3962 .keymap_size = ARRAY_SIZE(keymap_liquid),
3963 .keymap = keymap_liquid,
3964};
3965
3966static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3967 .input_name = "keypad_8960_liquid",
3968 .input_phys_device = "keypad_8960/input0",
3969 .num_rows = 2,
3970 .num_cols = 5,
3971 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3972 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3973 .debounce_ms = 15,
3974 .scan_delay_ms = 32,
3975 .row_hold_ns = 91500,
3976 .wakeup = 1,
3977 .keymap_data = &keymap_data_liquid,
3978};
3979
3980
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003981static const unsigned int keymap[] = {
3982 KEY(0, 0, KEY_VOLUMEUP),
3983 KEY(0, 1, KEY_VOLUMEDOWN),
3984 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3985 KEY(0, 3, KEY_CAMERA_FOCUS),
3986};
3987
3988static struct matrix_keymap_data keymap_data = {
3989 .keymap_size = ARRAY_SIZE(keymap),
3990 .keymap = keymap,
3991};
3992
3993static struct pm8xxx_keypad_platform_data keypad_data = {
3994 .input_name = "keypad_8960",
3995 .input_phys_device = "keypad_8960/input0",
3996 .num_rows = 1,
3997 .num_cols = 5,
3998 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3999 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4000 .debounce_ms = 15,
4001 .scan_delay_ms = 32,
4002 .row_hold_ns = 91500,
4003 .wakeup = 1,
4004 .keymap_data = &keymap_data,
4005};
4006
4007static const unsigned int keymap_sim[] = {
4008 KEY(0, 0, KEY_7),
4009 KEY(0, 1, KEY_DOWN),
4010 KEY(0, 2, KEY_UP),
4011 KEY(0, 3, KEY_RIGHT),
4012 KEY(0, 4, KEY_ENTER),
4013 KEY(0, 5, KEY_L),
4014 KEY(0, 6, KEY_BACK),
4015 KEY(0, 7, KEY_M),
4016
4017 KEY(1, 0, KEY_LEFT),
4018 KEY(1, 1, KEY_SEND),
4019 KEY(1, 2, KEY_1),
4020 KEY(1, 3, KEY_4),
4021 KEY(1, 4, KEY_CLEAR),
4022 KEY(1, 5, KEY_MSDOS),
4023 KEY(1, 6, KEY_SPACE),
4024 KEY(1, 7, KEY_COMMA),
4025
4026 KEY(2, 0, KEY_6),
4027 KEY(2, 1, KEY_5),
4028 KEY(2, 2, KEY_8),
4029 KEY(2, 3, KEY_3),
4030 KEY(2, 4, KEY_NUMERIC_STAR),
4031 KEY(2, 5, KEY_UP),
4032 KEY(2, 6, KEY_DOWN),
4033 KEY(2, 7, KEY_LEFTSHIFT),
4034
4035 KEY(3, 0, KEY_9),
4036 KEY(3, 1, KEY_NUMERIC_POUND),
4037 KEY(3, 2, KEY_0),
4038 KEY(3, 3, KEY_2),
4039 KEY(3, 4, KEY_SLEEP),
4040 KEY(3, 5, KEY_F1),
4041 KEY(3, 6, KEY_F2),
4042 KEY(3, 7, KEY_F3),
4043
4044 KEY(4, 0, KEY_BACK),
4045 KEY(4, 1, KEY_HOME),
4046 KEY(4, 2, KEY_MENU),
4047 KEY(4, 3, KEY_VOLUMEUP),
4048 KEY(4, 4, KEY_VOLUMEDOWN),
4049 KEY(4, 5, KEY_F4),
4050 KEY(4, 6, KEY_F5),
4051 KEY(4, 7, KEY_F6),
4052
4053 KEY(5, 0, KEY_R),
4054 KEY(5, 1, KEY_T),
4055 KEY(5, 2, KEY_Y),
4056 KEY(5, 3, KEY_LEFTALT),
4057 KEY(5, 4, KEY_KPENTER),
4058 KEY(5, 5, KEY_Q),
4059 KEY(5, 6, KEY_W),
4060 KEY(5, 7, KEY_E),
4061
4062 KEY(6, 0, KEY_F),
4063 KEY(6, 1, KEY_G),
4064 KEY(6, 2, KEY_H),
4065 KEY(6, 3, KEY_CAPSLOCK),
4066 KEY(6, 4, KEY_PAGEUP),
4067 KEY(6, 5, KEY_A),
4068 KEY(6, 6, KEY_S),
4069 KEY(6, 7, KEY_D),
4070
4071 KEY(7, 0, KEY_V),
4072 KEY(7, 1, KEY_B),
4073 KEY(7, 2, KEY_N),
4074 KEY(7, 3, KEY_MENU),
4075 KEY(7, 4, KEY_PAGEDOWN),
4076 KEY(7, 5, KEY_Z),
4077 KEY(7, 6, KEY_X),
4078 KEY(7, 7, KEY_C),
4079
4080 KEY(8, 0, KEY_P),
4081 KEY(8, 1, KEY_J),
4082 KEY(8, 2, KEY_K),
4083 KEY(8, 3, KEY_INSERT),
4084 KEY(8, 4, KEY_LINEFEED),
4085 KEY(8, 5, KEY_U),
4086 KEY(8, 6, KEY_I),
4087 KEY(8, 7, KEY_O),
4088
4089 KEY(9, 0, KEY_4),
4090 KEY(9, 1, KEY_5),
4091 KEY(9, 2, KEY_6),
4092 KEY(9, 3, KEY_7),
4093 KEY(9, 4, KEY_8),
4094 KEY(9, 5, KEY_1),
4095 KEY(9, 6, KEY_2),
4096 KEY(9, 7, KEY_3),
4097
4098 KEY(10, 0, KEY_F7),
4099 KEY(10, 1, KEY_F8),
4100 KEY(10, 2, KEY_F9),
4101 KEY(10, 3, KEY_F10),
4102 KEY(10, 4, KEY_FN),
4103 KEY(10, 5, KEY_9),
4104 KEY(10, 6, KEY_0),
4105 KEY(10, 7, KEY_DOT),
4106
4107 KEY(11, 0, KEY_LEFTCTRL),
4108 KEY(11, 1, KEY_F11),
4109 KEY(11, 2, KEY_ENTER),
4110 KEY(11, 3, KEY_SEARCH),
4111 KEY(11, 4, KEY_DELETE),
4112 KEY(11, 5, KEY_RIGHT),
4113 KEY(11, 6, KEY_LEFT),
4114 KEY(11, 7, KEY_RIGHTSHIFT),
4115 KEY(0, 0, KEY_VOLUMEUP),
4116 KEY(0, 1, KEY_VOLUMEDOWN),
4117 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4118 KEY(0, 3, KEY_CAMERA_FOCUS),
4119};
4120
4121static struct matrix_keymap_data keymap_data_sim = {
4122 .keymap_size = ARRAY_SIZE(keymap_sim),
4123 .keymap = keymap_sim,
4124};
4125
4126static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4127 .input_name = "keypad_8960",
4128 .input_phys_device = "keypad_8960/input0",
4129 .num_rows = 12,
4130 .num_cols = 8,
4131 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4132 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4133 .debounce_ms = 15,
4134 .scan_delay_ms = 32,
4135 .row_hold_ns = 91500,
4136 .wakeup = 1,
4137 .keymap_data = &keymap_data_sim,
4138};
4139
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004140static int pm8921_therm_mitigation[] = {
4141 1100,
4142 700,
4143 600,
4144 325,
4145};
4146
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004147static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004148 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004149 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004150 .max_voltage = 4200,
4151 .min_voltage = 3200,
4152 .resume_voltage = 4100,
4153 .term_current = 100,
4154 .cool_temp = 10,
4155 .warm_temp = 40,
4156 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004157 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004158 .cool_bat_chg_current = 350,
4159 .warm_bat_chg_current = 350,
4160 .cool_bat_voltage = 4100,
4161 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004162 .thermal_mitigation = pm8921_therm_mitigation,
4163 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004164};
4165
4166static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4167 .priority = 0,
4168};
4169
4170static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4171 .r_sense = 10,
4172 .i_test = 2500,
4173 .v_failure = 3000,
4174 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004175};
4176
Jay Chokshide4cefb2011-08-04 18:10:44 -07004177#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004178#define PM8XXX_LED_PWM_PERIOD 1000
4179#define PM8XXX_LED_PWM_DUTY_MS 20
4180/**
4181 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4182 * driven using PWM feature.
4183 */
4184#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004185
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004186static struct led_info pm8921_led_info[] = {
4187 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004188 .name = "led:battery_charging",
4189 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004190 },
4191 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004192 .name = "led:battery_full",
4193 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004194 },
4195};
4196
Jay Chokshi8994e392011-09-14 18:20:39 -07004197static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004198 .num_leds = ARRAY_SIZE(pm8921_led_info),
4199 .leds = pm8921_led_info,
4200};
4201
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004202static int pm8921_led0_pwm_duty_pcts[56] = {
4203 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4204 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4205 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4206 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4207 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4208 14, 10, 6, 4, 1
4209};
4210
4211static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4212 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4213 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4214 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4215 .start_idx = 0,
4216};
4217
Jay Chokshi8994e392011-09-14 18:20:39 -07004218static struct pm8xxx_led_config pm8921_led_configs[] = {
4219 [0] = {
4220 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004221 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004222 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004223 .pwm_channel = 5,
4224 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4225 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004226 },
4227 [1] = {
4228 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004229 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004230 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004231 .pwm_channel = 4,
4232 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004233 },
4234};
4235
4236static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4237 .led_core = &pm8921_led_core_pdata,
4238 .configs = pm8921_led_configs,
4239 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4240};
4241
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004242static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4243 .irq_pdata = &pm8xxx_irq_pdata,
4244 .gpio_pdata = &pm8xxx_gpio_pdata,
4245 .mpp_pdata = &pm8xxx_mpp_pdata,
4246 .rtc_pdata = &pm8xxx_rtc_pdata,
4247 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4248 .keypad_pdata = &keypad_data,
4249 .misc_pdata = &pm8xxx_misc_pdata,
4250 .regulator_pdatas = msm_pm8921_regulator_pdata,
4251 .charger_pdata = &pm8921_chg_pdata,
4252 .bms_pdata = &pm8921_bms_pdata,
4253 .adc_pdata = &pm8921_adc_pdata,
4254 .leds_pdata = &pm8xxx_leds_pdata,
4255};
4256
4257static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4258 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4259 .slave = {
4260 .name = "pm8921-core",
4261 .platform_data = &pm8921_platform_data,
4262 },
4263};
4264
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004265static struct msm_cpuidle_state msm_cstates[] __initdata = {
4266 {0, 0, "C0", "WFI",
4267 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4268
4269 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4270 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4271
4272 {0, 2, "C2", "POWER_COLLAPSE",
4273 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4274
4275 {1, 0, "C0", "WFI",
4276 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4277
4278 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4279 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4280};
4281
4282static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4283 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4284 .idle_supported = 1,
4285 .suspend_supported = 1,
4286 .idle_enabled = 0,
4287 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004288 },
4289
4290 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4291 .idle_supported = 1,
4292 .suspend_supported = 1,
4293 .idle_enabled = 0,
4294 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004295 },
4296
4297 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4298 .idle_supported = 1,
4299 .suspend_supported = 1,
4300 .idle_enabled = 1,
4301 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004302 },
4303
4304 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4305 .idle_supported = 0,
4306 .suspend_supported = 1,
4307 .idle_enabled = 0,
4308 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004309 },
4310
4311 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4312 .idle_supported = 1,
4313 .suspend_supported = 1,
4314 .idle_enabled = 0,
4315 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004316 },
4317
4318 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4319 .idle_supported = 1,
4320 .suspend_supported = 0,
4321 .idle_enabled = 1,
4322 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004323 },
4324};
4325
4326static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4327 {
4328 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4329 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4330 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004331 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004332 },
4333
4334 {
4335 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4336 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4337 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004338 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004339 },
4340
4341 {
4342 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4343 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4344 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004345 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004346 },
4347
4348 {
4349 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4350 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4351 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004352 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004353 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004354 {
4355 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4356 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4357 false,
4358 7000, 3500, 66600000, 5150,
4359 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004360
4361 {
4362 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4363 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4364 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004365 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004366 },
4367
4368 {
4369 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4370 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4371 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004372 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004373 },
4374
4375 {
4376 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4377 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4378 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004379 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004380 },
4381
4382 {
4383 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4384 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4385 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004386 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004387 },
4388};
4389
4390#ifdef CONFIG_I2C
4391#define I2C_SURF 1
4392#define I2C_FFA (1 << 1)
4393#define I2C_RUMI (1 << 2)
4394#define I2C_SIM (1 << 3)
4395#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004396#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004397
4398struct i2c_registry {
4399 u8 machs;
4400 int bus;
4401 struct i2c_board_info *info;
4402 int len;
4403};
4404
4405#ifdef CONFIG_MSM_CAMERA
4406static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4407#ifdef CONFIG_IMX074
4408 {
4409 I2C_BOARD_INFO("imx074", 0x1A),
4410 },
4411#endif
4412#ifdef CONFIG_OV2720
4413 {
4414 I2C_BOARD_INFO("ov2720", 0x6C),
4415 },
4416#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004417 {
4418 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4419 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304420#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4421 {
4422 I2C_BOARD_INFO("sc628a", 0x6E),
4423 },
4424#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004425};
4426#endif
4427
4428/* Sensors DSPS platform data */
4429#ifdef CONFIG_MSM_DSPS
4430#define DSPS_PIL_GENERIC_NAME "dsps"
4431#endif /* CONFIG_MSM_DSPS */
4432
4433static void __init msm8960_init_dsps(void)
4434{
4435#ifdef CONFIG_MSM_DSPS
4436 struct msm_dsps_platform_data *pdata =
4437 msm_dsps_device.dev.platform_data;
4438 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4439 pdata->gpios = NULL;
4440 pdata->gpios_num = 0;
4441
4442 platform_device_register(&msm_dsps_device);
4443#endif /* CONFIG_MSM_DSPS */
4444}
4445
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004446static void __init msm8960_init_hsic(void)
4447{
4448#ifdef CONFIG_USB_EHCI_MSM_HSIC
4449 uint32_t version = socinfo_get_version();
4450
4451 pr_info("%s: version:%d mtp:%d\n", __func__,
4452 SOCINFO_VERSION_MAJOR(version),
4453 machine_is_msm8960_mtp());
4454
4455 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4456 machine_is_msm8960_mtp() ||
4457 machine_is_msm8960_fluid())
4458 return;
4459
4460 msm_gpiomux_install(msm8960_hsic_configs,
4461 ARRAY_SIZE(msm8960_hsic_configs));
4462
4463 platform_device_register(&msm_device_hsic_host);
4464#endif
4465}
4466
4467
Amir Samuelov5137e392011-09-21 17:31:25 +03004468#ifdef CONFIG_ISL9519_CHARGER
4469static struct isl_platform_data isl_data __initdata = {
4470 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4471 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4472 .max_system_voltage = 4200,
4473 .min_system_voltage = 3200,
4474 .chgcurrent = 1000, /* 1900, */
4475 .term_current = 400, /* Need fine tuning */
4476 .input_current = 2048,
4477};
4478
4479static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4480 {
4481 I2C_BOARD_INFO("isl9519q", 0x9),
4482 .irq = 0, /* Not required when notify-by-pmic */
4483 .platform_data = &isl_data,
4484 },
4485};
4486#endif /* CONFIG_ISL9519_CHARGER */
4487
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004488static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4489#ifdef CONFIG_MSM_CAMERA
4490 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004491 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004492 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4493 msm_camera_boardinfo,
4494 ARRAY_SIZE(msm_camera_boardinfo),
4495 },
4496#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004497#ifdef CONFIG_ISL9519_CHARGER
4498 {
4499 I2C_LIQUID,
4500 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4501 isl_charger_i2c_info,
4502 ARRAY_SIZE(isl_charger_i2c_info),
4503 },
4504#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004505 {
4506 I2C_SURF | I2C_FFA | I2C_FLUID,
4507 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4508 cyttsp_info,
4509 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004510 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304511 {
4512 I2C_LIQUID,
4513 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4514 mxt_device_info,
4515 ARRAY_SIZE(mxt_device_info),
4516 },
4517
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004518};
4519#endif /* CONFIG_I2C */
4520
4521static void __init register_i2c_devices(void)
4522{
4523#ifdef CONFIG_I2C
4524 u8 mach_mask = 0;
4525 int i;
4526
4527 /* Build the matching 'supported_machs' bitmask */
4528 if (machine_is_msm8960_cdp())
4529 mach_mask = I2C_SURF;
4530 else if (machine_is_msm8960_rumi3())
4531 mach_mask = I2C_RUMI;
4532 else if (machine_is_msm8960_sim())
4533 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004534 else if (machine_is_msm8960_fluid())
4535 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004536 else if (machine_is_msm8960_liquid())
4537 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004538 else if (machine_is_msm8960_mtp())
4539 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004540 else
4541 pr_err("unmatched machine ID in register_i2c_devices\n");
4542
4543 /* Run the array and install devices as appropriate */
4544 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4545 if (msm8960_i2c_devices[i].machs & mach_mask)
4546 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4547 msm8960_i2c_devices[i].info,
4548 msm8960_i2c_devices[i].len);
4549 }
4550#endif
4551}
4552
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004553static void __init msm8960_sim_init(void)
4554{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004555 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4556 &msm8960_device_watchdog.dev.platform_data;
4557
4558 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004559 BUG_ON(msm_rpm_init(&msm_rpm_data));
4560 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4561 ARRAY_SIZE(msm_rpmrs_levels)));
4562 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004563 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004564 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004565 msm8960_device_ssbi_pm8921.dev.platform_data =
4566 &msm8960_ssbi_pm8921_pdata;
4567 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004568
4569 /* Simulator supports a QWERTY keypad */
4570 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4571
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004572 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4573 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4574 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004575 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004576 msm8960_i2c_init();
4577 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4578 msm_spm_l2_init(msm_spm_l2_data);
4579 msm8960_init_buses();
4580 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4581 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004582 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004583 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004584
4585 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4586 &msm8960_qup_spi_gsbi1_pdata;
4587 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4588
4589 msm8960_init_mmc();
4590 msm_fb_add_devices();
4591 slim_register_board_info(msm_slim_devices,
4592 ARRAY_SIZE(msm_slim_devices));
4593 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4594 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4595 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4596 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004597 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004598}
4599
4600static void __init msm8960_rumi3_init(void)
4601{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004602 BUG_ON(msm_rpm_init(&msm_rpm_data));
4603 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4604 ARRAY_SIZE(msm_rpmrs_levels)));
4605 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004606 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004607 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004608 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004609 msm8960_device_ssbi_pm8921.dev.platform_data =
4610 &msm8960_ssbi_pm8921_pdata;
4611 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4612 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4613 &msm8960_qup_spi_gsbi1_pdata;
4614 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4615 msm8960_i2c_init();
4616 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4617 msm_spm_l2_init(msm_spm_l2_data);
4618 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4619 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004620 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004621 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004622 register_i2c_devices();
4623 msm_fb_add_devices();
4624 slim_register_board_info(msm_slim_devices,
4625 ARRAY_SIZE(msm_slim_devices));
4626 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4627 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4628 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4629 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004630 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004631}
4632
4633static void __init msm8960_cdp_init(void)
4634{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004635 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4636 pr_err("meminfo_init() failed!\n");
4637
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004638 BUG_ON(msm_rpm_init(&msm_rpm_data));
4639 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4640 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004641
4642 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004643 regulator_suppress_info_printing();
4644 if (msm_xo_init())
4645 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004646 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004647 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304648 if (machine_is_msm8960_liquid())
4649 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004650 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4651 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4652 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304653#ifdef CONFIG_USB_EHCI_MSM_HSIC
4654 if (machine_is_msm8960_liquid()) {
4655 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4656 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4657 }
4658#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304659 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004660 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304661 if (machine_is_msm8960_liquid())
4662 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004663 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4664 &msm8960_qup_spi_gsbi1_pdata;
4665 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4666 msm8960_device_ssbi_pm8921.dev.platform_data =
4667 &msm8960_ssbi_pm8921_pdata;
4668 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4669 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004670 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004671 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4672 msm_spm_l2_init(msm_spm_l2_data);
4673 msm8960_init_buses();
4674 platform_add_devices(msm_footswitch_devices,
4675 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004676 if (machine_is_msm8960_liquid())
4677 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004678 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4679 pm8921_gpio_mpp_init();
4680 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004681 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004682 msm8960_init_cam();
4683 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004684 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304685 if (machine_is_msm8960_liquid())
4686 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004687 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004688 msm_fb_add_devices();
4689 slim_register_board_info(msm_slim_devices,
4690 ARRAY_SIZE(msm_slim_devices));
4691 msm8960_init_dsps();
4692 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4693 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4694 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4695 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004696 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004697 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004698}
4699
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004700MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4701 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004702 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004703 .init_irq = msm8960_init_irq,
4704 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004705 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004706 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004707 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004708MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004709
4710MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4711 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004712 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004713 .init_irq = msm8960_init_irq,
4714 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004715 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004716 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004717 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004718MACHINE_END
4719
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004720MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4721 .map_io = msm8960_map_io,
4722 .reserve = msm8960_reserve,
4723 .init_irq = msm8960_init_irq,
4724 .timer = &msm_timer,
4725 .init_machine = msm8960_cdp_init,
4726 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004727 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004728MACHINE_END
4729
4730MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4731 .map_io = msm8960_map_io,
4732 .reserve = msm8960_reserve,
4733 .init_irq = msm8960_init_irq,
4734 .timer = &msm_timer,
4735 .init_machine = msm8960_cdp_init,
4736 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004737 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004738MACHINE_END
4739
4740MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4741 .map_io = msm8960_map_io,
4742 .reserve = msm8960_reserve,
4743 .init_irq = msm8960_init_irq,
4744 .timer = &msm_timer,
4745 .init_machine = msm8960_cdp_init,
4746 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004747 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004748MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004749
4750MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4751 .map_io = msm8960_map_io,
4752 .reserve = msm8960_reserve,
4753 .init_irq = msm8960_init_irq,
4754 .timer = &msm_timer,
4755 .init_machine = msm8960_cdp_init,
4756 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004757 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004758MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004759
4760#ifdef CONFIG_ARCH_MSM8930
4761MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4762 .map_io = msm8930_map_io,
4763 .reserve = msm8960_reserve,
4764 .init_irq = msm8960_init_irq,
4765 .timer = &msm_timer,
4766 .init_machine = msm8960_cdp_init,
4767 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004768 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004769MACHINE_END
4770
4771MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4772 .map_io = msm8930_map_io,
4773 .reserve = msm8960_reserve,
4774 .init_irq = msm8960_init_irq,
4775 .timer = &msm_timer,
4776 .init_machine = msm8960_cdp_init,
4777 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004778 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004779MACHINE_END
4780
4781MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4782 .map_io = msm8930_map_io,
4783 .reserve = msm8960_reserve,
4784 .init_irq = msm8960_init_irq,
4785 .timer = &msm_timer,
4786 .init_machine = msm8960_cdp_init,
4787 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004788 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004789MACHINE_END
4790#endif