blob: 892921a7ec9428767e796f2d238a0be78dff1910 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -070024#include <linux/mfd/pm8xxx/pm8921-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080042
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070045#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080046#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080048
49#include <mach/board.h>
50#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051#include <mach/msm_spi.h>
52#ifdef CONFIG_USB_MSM_OTG_72K
53#include <mach/msm_hsusb.h>
54#else
55#include <linux/usb/msm_hsusb.h>
56#endif
57#include <linux/usb/android.h>
58#include <mach/usbdiag.h>
59#include <mach/socinfo.h>
60#include <mach/rpm.h>
61#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070062#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063#include <mach/msm_bus_board.h>
64#include <mach/msm_memtypes.h>
65#include <mach/dma.h>
66#include <mach/msm_dsps.h>
67#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070068#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080069
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#ifdef CONFIG_WCD9310_CODEC
71#include <linux/slimbus/slimbus.h>
72#include <linux/mfd/wcd9310/core.h>
73#include <linux/mfd/wcd9310/pdata.h>
74#endif
75
Laura Abbottd6183792011-08-19 13:42:24 -070076#include <linux/ion.h>
77#include <mach/ion.h>
78
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080080#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "spm.h"
83#include "board-msm8960.h"
84#include "pm.h"
85#include "cpuidle.h"
86#include "rpm_resources.h"
87#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070088#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070089#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070090#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060091#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070092#include "msm_watchdog.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093
94static struct platform_device msm_fm_platform_init = {
95 .name = "iris_fm",
96 .id = -1,
97};
98
99struct pm8xxx_gpio_init {
100 unsigned gpio;
101 struct pm_gpio config;
102};
103
104struct pm8xxx_mpp_init {
105 unsigned mpp;
106 struct pm8xxx_mpp_config_data config;
107};
108
109#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
110 _func, _inv, _disable) \
111{ \
112 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
113 .config = { \
114 .direction = _dir, \
115 .output_buffer = _buf, \
116 .output_value = _val, \
117 .pull = _pull, \
118 .vin_sel = _vin, \
119 .out_strength = _out_strength, \
120 .function = _func, \
121 .inv_int_pol = _inv, \
122 .disable_pin = _disable, \
123 } \
124}
125
126#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
127{ \
128 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
129 .config = { \
130 .type = PM8XXX_MPP_TYPE_##_type, \
131 .level = _level, \
132 .control = PM8XXX_MPP_##_control, \
133 } \
134}
135
136#define PM8XXX_GPIO_DISABLE(_gpio) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
138 0, 0, 0, 1)
139
140#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
141 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
142 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
143 PM_GPIO_STRENGTH_HIGH, \
144 PM_GPIO_FUNC_NORMAL, 0, 0)
145
146#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
147 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
148 _pull, PM_GPIO_VIN_S4, \
149 PM_GPIO_STRENGTH_NO, \
150 PM_GPIO_FUNC_NORMAL, 0, 0)
151
152#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
153 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
154 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
155 PM_GPIO_STRENGTH_HIGH, \
156 _func, 0, 0)
157
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200158#define PM8XXX_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
159 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
160 PM_GPIO_PULL_NO, _vin, \
161 PM_GPIO_STRENGTH_HIGH, \
162 PM_GPIO_FUNC_NORMAL, 0, 0)
163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164/* Initial PM8921 GPIO configurations */
165static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
166 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
167 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
168 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300169 /* External regulator shared by display and touchscreen on LiQUID */
170 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200171 PM8XXX_GPIO_OUTPUT_VIN(21, 1, PM_GPIO_VIN_VPH), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700172 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700173 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700174 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700175 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Anji jonnala2936fd92011-11-09 15:39:22 +0530176 PM8XXX_GPIO_OUTPUT(42, 0), /* USB 5V reg enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700177};
178
179/* Initial PM8921 MPP configurations */
180static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
181 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
182 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700183 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
184 DOUT_CTRL_LOW),
185};
186
187static void __init pm8921_gpio_mpp_init(void)
188{
189 int i, rc;
190
191 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
192 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
193 &pm8921_gpios[i].config);
194 if (rc) {
195 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
196 break;
197 }
198 }
199
200 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
201 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
202 &pm8921_mpps[i].config);
203 if (rc) {
204 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
205 break;
206 }
207 }
208}
209
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700210#define KS8851_RST_GPIO 89
211#define KS8851_IRQ_GPIO 90
212
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700213#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
214enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700215 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700216 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
217 /* CAM Expander */
218 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
219 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
220 GPIO_CAM_GP_AFBUSY,
221 GPIO_CAM_GP_STROBE_CE,
222 GPIO_CAM_GP_CAM1MP_XCLR,
223 GPIO_CAM_GP_CAMIF_RESET_N,
224 GPIO_CAM_GP_XMT_FLASH_INT,
225 GPIO_CAM_GP_LED_EN1,
226 GPIO_CAM_GP_LED_EN2,
227
228};
229#endif
230
Harini Jayaraman608d0462011-08-09 19:10:03 -0600231/* The SPI configurations apply to GSBI 1*/
232static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700233 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700234 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700235 .pull = GPIOMUX_PULL_NONE,
236};
237
Harini Jayaraman608d0462011-08-09 19:10:03 -0600238static struct gpiomux_setting spi_suspended_config = {
239 .func = GPIOMUX_FUNC_GPIO,
240 .drv = GPIOMUX_DRV_2MA,
241 .pull = GPIOMUX_PULL_DOWN,
242};
243
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700244static struct gpiomux_setting spi_active_config2 = {
245 .func = GPIOMUX_FUNC_2,
246 .drv = GPIOMUX_DRV_8MA,
247 .pull = GPIOMUX_PULL_NONE,
248};
249
250static struct gpiomux_setting spi_suspended_config2 = {
251 .func = GPIOMUX_FUNC_GPIO,
252 .drv = GPIOMUX_DRV_2MA,
253 .pull = GPIOMUX_PULL_UP,
254};
255
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530256static struct gpiomux_setting gsbi3_suspended_cfg = {
257 .func = GPIOMUX_FUNC_1,
258 .drv = GPIOMUX_DRV_2MA,
259 .pull = GPIOMUX_PULL_KEEPER,
260};
261
262static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700263 .func = GPIOMUX_FUNC_1,
264 .drv = GPIOMUX_DRV_8MA,
265 .pull = GPIOMUX_PULL_NONE,
266};
267
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700268static struct gpiomux_setting gsbi5 = {
269 .func = GPIOMUX_FUNC_1,
270 .drv = GPIOMUX_DRV_8MA,
271 .pull = GPIOMUX_PULL_NONE,
272};
273
274static struct gpiomux_setting gsbi10 = {
275 .func = GPIOMUX_FUNC_2,
276 .drv = GPIOMUX_DRV_8MA,
277 .pull = GPIOMUX_PULL_NONE,
278};
279
280static struct gpiomux_setting gsbi12 = {
281 .func = GPIOMUX_FUNC_1,
282 .drv = GPIOMUX_DRV_8MA,
283 .pull = GPIOMUX_PULL_NONE,
284};
285
286static struct gpiomux_setting cdc_mclk = {
287 .func = GPIOMUX_FUNC_1,
288 .drv = GPIOMUX_DRV_8MA,
289 .pull = GPIOMUX_PULL_NONE,
290};
291
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700292static struct gpiomux_setting audio_auxpcm[] = {
293 /* Suspended state */
294 {
295 .func = GPIOMUX_FUNC_GPIO,
296 .drv = GPIOMUX_DRV_2MA,
297 .pull = GPIOMUX_PULL_NONE,
298 },
299 /* Active state */
300 {
301 .func = GPIOMUX_FUNC_1,
302 .drv = GPIOMUX_DRV_2MA,
303 .pull = GPIOMUX_PULL_NONE,
304 },
305};
306
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700307#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308static struct gpiomux_setting gpio_eth_config = {
309 .pull = GPIOMUX_PULL_NONE,
310 .drv = GPIOMUX_DRV_8MA,
311 .func = GPIOMUX_FUNC_GPIO,
312};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700313#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314
315static struct gpiomux_setting slimbus = {
316 .func = GPIOMUX_FUNC_1,
317 .drv = GPIOMUX_DRV_8MA,
318 .pull = GPIOMUX_PULL_KEEPER,
319};
320
321struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700322#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323 {
324 .gpio = KS8851_IRQ_GPIO,
325 .settings = {
326 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
327 }
328 },
329 {
330 .gpio = KS8851_RST_GPIO,
331 .settings = {
332 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
333 }
334 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700335#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336};
337
338static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
339 {
340 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
341 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600342 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
343 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700344 },
345 },
346 {
347 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
348 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600349 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
350 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700351 },
352 },
353 {
354 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
355 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600356 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
357 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700358 },
359 },
360 {
361 .gpio = 9, /* GSBI1 QUP SPI_CLK */
362 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600363 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
364 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700365 },
366 },
367 {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700368 .gpio = 14, /* GSBI1 SPI_CS_1 */
369 .settings = {
370 [GPIOMUX_SUSPENDED] = &spi_suspended_config2,
371 [GPIOMUX_ACTIVE] = &spi_active_config2,
372 },
373 },
374 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700375 .gpio = 16, /* GSBI3 I2C QUP SDA */
376 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530377 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
378 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700379 },
380 },
381 {
382 .gpio = 17, /* GSBI3 I2C QUP SCL */
383 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530384 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
385 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700386 },
387 },
388 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700389 .gpio = 22, /* GSBI5 UART2 */
390 .settings = {
391 [GPIOMUX_SUSPENDED] = &gsbi5,
392 },
393 },
394 {
395 .gpio = 23, /* GSBI5 UART2 */
396 .settings = {
397 [GPIOMUX_SUSPENDED] = &gsbi5,
398 },
399 },
400 {
401 .gpio = 24, /* GSBI5 UART2 */
402 .settings = {
403 [GPIOMUX_SUSPENDED] = &gsbi5,
404 },
405 },
406 {
407 .gpio = 25, /* GSBI5 UART2 */
408 .settings = {
409 [GPIOMUX_SUSPENDED] = &gsbi5,
410 },
411 },
412 {
413 .gpio = 44, /* GSBI12 I2C QUP SDA */
414 .settings = {
415 [GPIOMUX_SUSPENDED] = &gsbi12,
416 },
417 },
418 {
419 .gpio = 45, /* GSBI12 I2C QUP SCL */
420 .settings = {
421 [GPIOMUX_SUSPENDED] = &gsbi12,
422 },
423 },
424 {
425 .gpio = 73, /* GSBI10 I2C QUP SDA */
426 .settings = {
427 [GPIOMUX_SUSPENDED] = &gsbi10,
428 },
429 },
430 {
431 .gpio = 74, /* GSBI10 I2C QUP SCL */
432 .settings = {
433 [GPIOMUX_SUSPENDED] = &gsbi10,
434 },
435 },
436};
437
438static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
439 {
440 .gpio = 60, /* slimbus data */
441 .settings = {
442 [GPIOMUX_SUSPENDED] = &slimbus,
443 },
444 },
445 {
446 .gpio = 61, /* slimbus clk */
447 .settings = {
448 [GPIOMUX_SUSPENDED] = &slimbus,
449 },
450 },
451};
452
453static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
454 {
455 .gpio = 59,
456 .settings = {
457 [GPIOMUX_SUSPENDED] = &cdc_mclk,
458 },
459 },
460};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700461
462static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
463 {
464 .gpio = 63,
465 .settings = {
466 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
467 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
468 },
469 },
470 {
471 .gpio = 64,
472 .settings = {
473 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
474 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
475 },
476 },
477 {
478 .gpio = 65,
479 .settings = {
480 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
481 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
482 },
483 },
484 {
485 .gpio = 66,
486 .settings = {
487 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
488 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
489 },
490 },
491};
492
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700493static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
494 .func = GPIOMUX_FUNC_GPIO,
495 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700496 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700497};
498
499static struct gpiomux_setting wcnss_5wire_active_cfg = {
500 .func = GPIOMUX_FUNC_1,
501 .drv = GPIOMUX_DRV_6MA,
502 .pull = GPIOMUX_PULL_DOWN,
503};
504
505static struct msm_gpiomux_config wcnss_5wire_interface[] = {
506 {
507 .gpio = 84,
508 .settings = {
509 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
510 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
511 },
512 },
513 {
514 .gpio = 85,
515 .settings = {
516 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
517 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
518 },
519 },
520 {
521 .gpio = 86,
522 .settings = {
523 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
524 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
525 },
526 },
527 {
528 .gpio = 87,
529 .settings = {
530 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
531 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
532 },
533 },
534 {
535 .gpio = 88,
536 .settings = {
537 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
538 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
539 },
540 },
541};
Nishant Pandit24153d82011-08-27 16:05:13 +0530542static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530543 {
544 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
545 .drv = GPIOMUX_DRV_2MA,
546 .pull = GPIOMUX_PULL_DOWN,
547 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700548
Nishant Pandit474f2252011-07-23 23:17:56 +0530549 {
550 .func = GPIOMUX_FUNC_1, /*active 1*/
551 .drv = GPIOMUX_DRV_2MA,
552 .pull = GPIOMUX_PULL_NONE,
553 },
554
555 {
556 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
557 .drv = GPIOMUX_DRV_2MA,
558 .pull = GPIOMUX_PULL_NONE,
559 },
560
561 {
562 .func = GPIOMUX_FUNC_1, /*active 3*/
563 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700564 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530565 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530566
567 {
568 .func = GPIOMUX_FUNC_5, /*active 4*/
569 .drv = GPIOMUX_DRV_8MA,
570 .pull = GPIOMUX_PULL_UP,
571 },
572
573 {
574 .func = GPIOMUX_FUNC_6, /*active 5*/
575 .drv = GPIOMUX_DRV_8MA,
576 .pull = GPIOMUX_PULL_UP,
577 },
578
579 {
580 .func = GPIOMUX_FUNC_2, /*active 6*/
581 .drv = GPIOMUX_DRV_2MA,
582 .pull = GPIOMUX_PULL_UP,
583 },
584
585 {
586 .func = GPIOMUX_FUNC_3, /*active 7*/
587 .drv = GPIOMUX_DRV_8MA,
588 .pull = GPIOMUX_PULL_UP,
589 },
590
Kevin Chan4c58d292011-09-13 11:03:25 -0700591 {
592 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
593 .drv = GPIOMUX_DRV_2MA,
594 .pull = GPIOMUX_PULL_KEEPER,
595 },
596
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700597};
598
Nishant Pandit24153d82011-08-27 16:05:13 +0530599static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700600 {
601 .gpio = 2,
602 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530603 [GPIOMUX_ACTIVE] = &cam_settings[2],
604 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700605 },
606 },
607 {
608 .gpio = 3,
609 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530610 [GPIOMUX_ACTIVE] = &cam_settings[1],
611 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700612 },
613 },
614 {
615 .gpio = 4,
616 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530617 [GPIOMUX_ACTIVE] = &cam_settings[1],
618 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700619 },
620 },
621 {
622 .gpio = 5,
623 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530624 [GPIOMUX_ACTIVE] = &cam_settings[1],
625 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700626 },
627 },
628 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530629 .gpio = 76,
630 .settings = {
631 [GPIOMUX_ACTIVE] = &cam_settings[2],
632 [GPIOMUX_SUSPENDED] = &cam_settings[0],
633 },
634 },
635 {
636 .gpio = 107,
637 .settings = {
638 [GPIOMUX_ACTIVE] = &cam_settings[2],
639 [GPIOMUX_SUSPENDED] = &cam_settings[0],
640 },
641 },
642};
643
644static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
645 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700646 .gpio = 18,
647 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530648 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700649 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700650 },
651 },
652 {
653 .gpio = 19,
654 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530655 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700656 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700657 },
658 },
659 {
660 .gpio = 20,
661 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530662 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700663 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700664 },
665 },
666 {
667 .gpio = 21,
668 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530669 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700670 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700671 },
672 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700673};
674
675static struct gpiomux_setting cyts_resout_sus_cfg = {
676 .func = GPIOMUX_FUNC_GPIO,
677 .drv = GPIOMUX_DRV_6MA,
678 .pull = GPIOMUX_PULL_UP,
679};
680
681static struct gpiomux_setting cyts_resout_act_cfg = {
682 .func = GPIOMUX_FUNC_GPIO,
683 .drv = GPIOMUX_DRV_6MA,
684 .pull = GPIOMUX_PULL_UP,
685};
686
687static struct gpiomux_setting cyts_sleep_sus_cfg = {
688 .func = GPIOMUX_FUNC_GPIO,
689 .drv = GPIOMUX_DRV_6MA,
690 .pull = GPIOMUX_PULL_DOWN,
691};
692
693static struct gpiomux_setting cyts_sleep_act_cfg = {
694 .func = GPIOMUX_FUNC_GPIO,
695 .drv = GPIOMUX_DRV_6MA,
696 .pull = GPIOMUX_PULL_DOWN,
697};
698
699static struct gpiomux_setting cyts_int_act_cfg = {
700 .func = GPIOMUX_FUNC_GPIO,
701 .drv = GPIOMUX_DRV_8MA,
702 .pull = GPIOMUX_PULL_UP,
703};
704
705static struct gpiomux_setting cyts_int_sus_cfg = {
706 .func = GPIOMUX_FUNC_GPIO,
707 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530708 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700709};
710
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700711static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
712 { /* TS INTERRUPT */
713 .gpio = 11,
714 .settings = {
715 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
716 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
717 },
718 },
719 { /* TS SLEEP */
720 .gpio = 50,
721 .settings = {
722 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
723 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
724 },
725 },
726 { /* TS RESOUT */
727 .gpio = 52,
728 .settings = {
729 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
730 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
731 },
732 },
733};
734
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530735#ifdef CONFIG_USB_EHCI_MSM_HSIC
736static struct gpiomux_setting hsic_act_cfg = {
737 .func = GPIOMUX_FUNC_1,
738 .drv = GPIOMUX_DRV_12MA,
739 .pull = GPIOMUX_PULL_NONE,
740};
741
742static struct gpiomux_setting hsic_sus_cfg = {
743 .func = GPIOMUX_FUNC_GPIO,
744 .drv = GPIOMUX_DRV_2MA,
745 .pull = GPIOMUX_PULL_DOWN,
746};
747
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530748static struct gpiomux_setting hsic_hub_act_cfg = {
749 .func = GPIOMUX_FUNC_GPIO,
750 .drv = GPIOMUX_DRV_2MA,
751 .pull = GPIOMUX_PULL_NONE,
752};
753
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530754static struct msm_gpiomux_config msm8960_hsic_configs[] = {
755 {
756 .gpio = 150, /*HSIC_STROBE */
757 .settings = {
758 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
759 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
760 },
761 },
762 {
763 .gpio = 151, /* HSIC_DATA */
764 .settings = {
765 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
766 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
767 },
768 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530769 {
770 .gpio = 91, /* HSIC_HUB_RESET */
771 .settings = {
772 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
773 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
774 },
775 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530776};
777#endif
778
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700779#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
780enum {
781 SX150X_CAM,
782};
783
Nishant Pandit474f2252011-07-23 23:17:56 +0530784static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700785 [SX150X_CAM] = {
786 .gpio_base = GPIO_CAM_EXPANDER_BASE,
787 .oscio_is_gpo = false,
788 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530789 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700790 .io_open_drain_ena = 0x0,
791 .irq_summary = -1,
792 },
793};
Nishant Pandit474f2252011-07-23 23:17:56 +0530794
795#endif
796
797#ifdef CONFIG_I2C
798
799#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
800#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300801#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530802
803#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
804
805static struct i2c_board_info cam_expander_i2c_info[] = {
806 {
807 I2C_BOARD_INFO("sx1508q", 0x22),
808 .platform_data = &sx150x_data[SX150X_CAM]
809 },
810};
811
812static struct msm_cam_expander_info cam_expander_info[] = {
813 {
814 cam_expander_i2c_info,
815 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
816 },
817};
818#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700819#endif
820
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700821#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
822#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700823#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700824#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
825#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
826#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700827#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700828#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700829
830
831#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
832#define MSM_ION_EBI_SIZE MSM_PMEM_SIZE
833#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
834#define MSM_ION_HEAP_NUM 4
835#else
836#define MSM_ION_HEAP_NUM 2
837#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700838
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700839#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
840static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
841static int __init pmem_kernel_ebi1_size_setup(char *p)
842{
843 pmem_kernel_ebi1_size = memparse(p, NULL);
844 return 0;
845}
846early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
847#endif
848
849#ifdef CONFIG_ANDROID_PMEM
850static unsigned pmem_size = MSM_PMEM_SIZE;
851static int __init pmem_size_setup(char *p)
852{
853 pmem_size = memparse(p, NULL);
854 return 0;
855}
856early_param("pmem_size", pmem_size_setup);
857
858static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
859
860static int __init pmem_adsp_size_setup(char *p)
861{
862 pmem_adsp_size = memparse(p, NULL);
863 return 0;
864}
865early_param("pmem_adsp_size", pmem_adsp_size_setup);
866
867static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
868
869static int __init pmem_audio_size_setup(char *p)
870{
871 pmem_audio_size = memparse(p, NULL);
872 return 0;
873}
874early_param("pmem_audio_size", pmem_audio_size_setup);
875#endif
876
877#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700878#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700879static struct android_pmem_platform_data android_pmem_pdata = {
880 .name = "pmem",
881 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
882 .cached = 1,
883 .memory_type = MEMTYPE_EBI1,
884};
885
886static struct platform_device android_pmem_device = {
887 .name = "android_pmem",
888 .id = 0,
889 .dev = {.platform_data = &android_pmem_pdata},
890};
891
892static struct android_pmem_platform_data android_pmem_adsp_pdata = {
893 .name = "pmem_adsp",
894 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
895 .cached = 0,
896 .memory_type = MEMTYPE_EBI1,
897};
898static struct platform_device android_pmem_adsp_device = {
899 .name = "android_pmem",
900 .id = 2,
901 .dev = { .platform_data = &android_pmem_adsp_pdata },
902};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700903#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700904
905static struct android_pmem_platform_data android_pmem_audio_pdata = {
906 .name = "pmem_audio",
907 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
908 .cached = 0,
909 .memory_type = MEMTYPE_EBI1,
910};
911
912static struct platform_device android_pmem_audio_device = {
913 .name = "android_pmem",
914 .id = 4,
915 .dev = { .platform_data = &android_pmem_audio_pdata },
916};
917#endif
918
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700919#define DSP_RAM_BASE_8960 0x8da00000
920#define DSP_RAM_SIZE_8960 0x1800000
921static int dspcrashd_pdata_8960 = 0xDEADDEAD;
922
923static struct resource resources_dspcrashd_8960[] = {
924 {
925 .name = "msm_dspcrashd",
926 .start = DSP_RAM_BASE_8960,
927 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
928 .flags = IORESOURCE_DMA,
929 },
930};
931
932struct platform_device msm_device_dspcrashd_8960 = {
933 .name = "msm_dspcrashd",
934 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
935 .resource = resources_dspcrashd_8960,
936 .dev = { .platform_data = &dspcrashd_pdata_8960 },
937};
938
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700939static struct memtype_reserve msm8960_reserve_table[] __initdata = {
940 [MEMTYPE_SMI] = {
941 },
942 [MEMTYPE_EBI0] = {
943 .flags = MEMTYPE_FLAGS_1M_ALIGN,
944 },
945 [MEMTYPE_EBI1] = {
946 .flags = MEMTYPE_FLAGS_1M_ALIGN,
947 },
948};
949
950static void __init size_pmem_devices(void)
951{
952#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700953#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700954 android_pmem_adsp_pdata.size = pmem_adsp_size;
955 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700956#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700957 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
958#endif
959}
960
961static void __init reserve_memory_for(struct android_pmem_platform_data *p)
962{
963 msm8960_reserve_table[p->memory_type].size += p->size;
964}
965
966static void __init reserve_pmem_memory(void)
967{
968#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700969#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970 reserve_memory_for(&android_pmem_adsp_pdata);
971 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700972#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700973 reserve_memory_for(&android_pmem_audio_pdata);
974 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
975#endif
976}
977
Larry Basselb4126da2011-07-18 14:31:33 -0700978static int msm8960_paddr_to_memtype(unsigned int paddr)
979{
980 return MEMTYPE_EBI1;
981}
982
Laura Abbottd6183792011-08-19 13:42:24 -0700983#ifdef CONFIG_ION_MSM
984struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700985 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700986 .heaps = {
987 {
988 .id = ION_HEAP_SYSTEM_ID,
989 .type = ION_HEAP_TYPE_SYSTEM,
990 .name = ION_KMALLOC_HEAP_NAME,
991 },
992 {
993 .id = ION_HEAP_SYSTEM_CONTIG_ID,
994 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
995 .name = ION_VMALLOC_HEAP_NAME,
996 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700997#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700998 {
999 .id = ION_HEAP_EBI_ID,
1000 .type = ION_HEAP_TYPE_CARVEOUT,
1001 .name = ION_EBI1_HEAP_NAME,
1002 .size = MSM_ION_EBI_SIZE,
1003 .memory_type = ION_EBI_TYPE,
1004 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001005 {
1006 .id = ION_HEAP_ADSP_ID,
1007 .type = ION_HEAP_TYPE_CARVEOUT,
1008 .name = ION_ADSP_HEAP_NAME,
1009 .size = MSM_ION_ADSP_SIZE,
1010 .memory_type = ION_EBI_TYPE,
1011 },
1012#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001013 }
1014};
1015
1016struct platform_device ion_dev = {
1017 .name = "ion-msm",
1018 .id = 1,
1019 .dev = { .platform_data = &ion_pdata },
1020};
1021#endif
1022
1023static void reserve_ion_memory(void)
1024{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001025#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001026 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001027 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001028#endif
1029}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001030static void __init msm8960_calculate_reserve_sizes(void)
1031{
1032 size_pmem_devices();
1033 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001034 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001035}
1036
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001037static struct reserve_info msm8960_reserve_info __initdata = {
1038 .memtype_reserve_table = msm8960_reserve_table,
1039 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1040 .paddr_to_memtype = msm8960_paddr_to_memtype,
1041};
1042
Larry Basselb4126da2011-07-18 14:31:33 -07001043static int msm8960_memory_bank_size(void)
1044{
1045 return 1<<29;
1046}
1047
1048static void __init locate_unstable_memory(void)
1049{
1050 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1051 unsigned long bank_size;
1052 unsigned long low, high;
1053
1054 bank_size = msm8960_memory_bank_size();
1055 low = meminfo.bank[0].start;
1056 high = mb->start + mb->size;
1057 low &= ~(bank_size - 1);
1058
1059 if (high - low <= bank_size)
1060 return;
1061 msm8960_reserve_info.low_unstable_address = low + bank_size;
1062 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
1063 msm8960_reserve_info.bank_size = bank_size;
1064 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1065 msm8960_reserve_info.low_unstable_address,
1066 msm8960_reserve_info.max_unstable_size,
1067 msm8960_reserve_info.bank_size);
1068}
1069
Larry Basselb830e182011-10-14 10:46:55 -07001070static void __init place_movable_zone(void)
1071{
1072 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1073 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1074 pr_info("movable zone start %lx size %lx\n",
1075 movable_reserved_start, movable_reserved_size);
1076}
1077
1078static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001079{
1080 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001081 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001082 place_movable_zone();
1083}
1084
1085static void __init msm8960_reserve(void)
1086{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001087 msm_reserve();
1088}
1089
Larry Bassela4414b12011-08-04 11:11:02 -07001090static int msm8960_change_memory_power(u64 start, u64 size,
1091 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001092{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001093 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001094}
1095
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001096#ifdef CONFIG_MSM_CAMERA
1097
Nishant Pandit24153d82011-08-27 16:05:13 +05301098static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001099 5, /*CAMIF_MCLK*/
1100 20, /*CAMIF_I2C_DATA*/
1101 21, /*CAMIF_I2C_CLK*/
1102};
1103
Nishant Pandit24153d82011-08-27 16:05:13 +05301104static struct msm_camera_gpio_conf gpio_conf = {
1105 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1106 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1107 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1108 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1109};
1110
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001111#define VFE_CAMIF_TIMER1_GPIO 2
1112#define VFE_CAMIF_TIMER2_GPIO 3
1113#define VFE_CAMIF_TIMER3_GPIO_INT 4
1114struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1115 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1116 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1117 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1118 .flash_recharge_duration = 50000,
1119 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1120};
1121
Nishant Pandit474f2252011-07-23 23:17:56 +05301122#ifdef CONFIG_MSM_CAMERA_FLASH
1123static struct msm_camera_sensor_flash_src msm_flash_src = {
1124 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1125 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1126 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1127#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1128 defined(CONFIG_GPIO_SX150X_MODULE))
1129 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1130#endif
1131};
1132#endif
1133
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001134static struct msm_bus_vectors cam_init_vectors[] = {
1135 {
1136 .src = MSM_BUS_MASTER_VFE,
1137 .dst = MSM_BUS_SLAVE_EBI_CH0,
1138 .ab = 0,
1139 .ib = 0,
1140 },
1141 {
1142 .src = MSM_BUS_MASTER_VPE,
1143 .dst = MSM_BUS_SLAVE_EBI_CH0,
1144 .ab = 0,
1145 .ib = 0,
1146 },
1147 {
1148 .src = MSM_BUS_MASTER_JPEG_ENC,
1149 .dst = MSM_BUS_SLAVE_EBI_CH0,
1150 .ab = 0,
1151 .ib = 0,
1152 },
1153};
1154
1155static struct msm_bus_vectors cam_preview_vectors[] = {
1156 {
1157 .src = MSM_BUS_MASTER_VFE,
1158 .dst = MSM_BUS_SLAVE_EBI_CH0,
1159 .ab = 27648000,
1160 .ib = 110592000,
1161 },
1162 {
1163 .src = MSM_BUS_MASTER_VPE,
1164 .dst = MSM_BUS_SLAVE_EBI_CH0,
1165 .ab = 0,
1166 .ib = 0,
1167 },
1168 {
1169 .src = MSM_BUS_MASTER_JPEG_ENC,
1170 .dst = MSM_BUS_SLAVE_EBI_CH0,
1171 .ab = 0,
1172 .ib = 0,
1173 },
1174};
1175
1176static struct msm_bus_vectors cam_video_vectors[] = {
1177 {
1178 .src = MSM_BUS_MASTER_VFE,
1179 .dst = MSM_BUS_SLAVE_EBI_CH0,
1180 .ab = 140451840,
1181 .ib = 561807360,
1182 },
1183 {
1184 .src = MSM_BUS_MASTER_VPE,
1185 .dst = MSM_BUS_SLAVE_EBI_CH0,
1186 .ab = 206807040,
1187 .ib = 488816640,
1188 },
1189 {
1190 .src = MSM_BUS_MASTER_JPEG_ENC,
1191 .dst = MSM_BUS_SLAVE_EBI_CH0,
1192 .ab = 0,
1193 .ib = 0,
1194 },
1195};
1196
1197static struct msm_bus_vectors cam_snapshot_vectors[] = {
1198 {
1199 .src = MSM_BUS_MASTER_VFE,
1200 .dst = MSM_BUS_SLAVE_EBI_CH0,
1201 .ab = 274423680,
1202 .ib = 1097694720,
1203 },
1204 {
1205 .src = MSM_BUS_MASTER_VPE,
1206 .dst = MSM_BUS_SLAVE_EBI_CH0,
1207 .ab = 0,
1208 .ib = 0,
1209 },
1210 {
1211 .src = MSM_BUS_MASTER_JPEG_ENC,
1212 .dst = MSM_BUS_SLAVE_EBI_CH0,
1213 .ab = 540000000,
1214 .ib = 1350000000,
1215 },
1216};
1217
1218static struct msm_bus_vectors cam_zsl_vectors[] = {
1219 {
1220 .src = MSM_BUS_MASTER_VFE,
1221 .dst = MSM_BUS_SLAVE_EBI_CH0,
1222 .ab = 302071680,
1223 .ib = 1208286720,
1224 },
1225 {
1226 .src = MSM_BUS_MASTER_VPE,
1227 .dst = MSM_BUS_SLAVE_EBI_CH0,
1228 .ab = 0,
1229 .ib = 0,
1230 },
1231 {
1232 .src = MSM_BUS_MASTER_JPEG_ENC,
1233 .dst = MSM_BUS_SLAVE_EBI_CH0,
1234 .ab = 540000000,
1235 .ib = 1350000000,
1236 },
1237};
1238
1239static struct msm_bus_paths cam_bus_client_config[] = {
1240 {
1241 ARRAY_SIZE(cam_init_vectors),
1242 cam_init_vectors,
1243 },
1244 {
1245 ARRAY_SIZE(cam_preview_vectors),
1246 cam_preview_vectors,
1247 },
1248 {
1249 ARRAY_SIZE(cam_video_vectors),
1250 cam_video_vectors,
1251 },
1252 {
1253 ARRAY_SIZE(cam_snapshot_vectors),
1254 cam_snapshot_vectors,
1255 },
1256 {
1257 ARRAY_SIZE(cam_zsl_vectors),
1258 cam_zsl_vectors,
1259 },
1260};
1261
1262static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1263 cam_bus_client_config,
1264 ARRAY_SIZE(cam_bus_client_config),
1265 .name = "msm_camera",
1266};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001267
Nishant Pandit24153d82011-08-27 16:05:13 +05301268struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1269 {
1270 .ioclk.mclk_clk_rate = 24000000,
1271 .ioclk.vfe_clk_rate = 228570000,
1272 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001273 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301274 },
1275 {
1276 .ioclk.mclk_clk_rate = 24000000,
1277 .ioclk.vfe_clk_rate = 228570000,
1278 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001279 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301280 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001281};
1282
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001283#ifdef CONFIG_IMX074_ACT
1284static struct i2c_board_info imx074_actuator_i2c_info = {
1285 I2C_BOARD_INFO("imx074_act", 0x11),
1286};
1287
1288static struct msm_actuator_info imx074_actuator_info = {
1289 .board_info = &imx074_actuator_i2c_info,
1290 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1291 .vcm_pwd = 0,
1292 .vcm_enable = 1,
1293};
1294#endif
1295
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001296#ifdef CONFIG_IMX074
1297static struct msm_camera_sensor_flash_data flash_imx074 = {
1298 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301299#ifdef CONFIG_MSM_CAMERA_FLASH
1300 .flash_src = &msm_flash_src
1301#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302};
1303
Nishant Pandit24153d82011-08-27 16:05:13 +05301304static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1305 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306 .sensor_reset = 107,
1307 .sensor_pwd = 85,
1308 .vcm_pwd = 0,
1309 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301310};
1311
1312static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1313 .sensor_name = "imx074",
1314 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001315 .flash_data = &flash_imx074,
1316 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301317 .sensor_platform_info = &sensor_board_info_imx074,
1318 .gpio_conf = &gpio_conf,
1319 .csi_if = 1,
1320 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001321#ifdef CONFIG_IMX074_ACT
1322 .actuator_info = &imx074_actuator_info
1323#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001324};
1325
1326struct platform_device msm8960_camera_sensor_imx074 = {
1327 .name = "msm_camera_imx074",
1328 .dev = {
1329 .platform_data = &msm_camera_sensor_imx074_data,
1330 },
1331};
1332#endif
1333#ifdef CONFIG_OV2720
1334static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001335 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001336};
1337
Nishant Pandit24153d82011-08-27 16:05:13 +05301338static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1339 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001340 .sensor_reset = 76,
1341 .sensor_pwd = 85,
1342 .vcm_pwd = 0,
1343 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301344};
1345
1346static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1347 .sensor_name = "ov2720",
1348 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001349 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301350 .sensor_platform_info = &sensor_board_info_ov2720,
1351 .gpio_conf = &gpio_conf,
1352 .csi_if = 1,
1353 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001354};
1355
1356struct platform_device msm8960_camera_sensor_ov2720 = {
1357 .name = "msm_camera_ov2720",
1358 .dev = {
1359 .platform_data = &msm_camera_sensor_ov2720_data,
1360 },
1361};
1362#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001363
1364static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1365 .flash_type = MSM_CAMERA_FLASH_LED,
1366};
1367
Nishant Pandit24153d82011-08-27 16:05:13 +05301368static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1369 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001370 .sensor_reset = 107,
1371 .sensor_pwd = 85,
1372 .vcm_pwd = 0,
1373 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301374};
1375
1376static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1377 .sensor_name = "qs_mt9p017",
1378 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001379 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301380 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1381 .gpio_conf = &gpio_conf,
1382 .csi_if = 1,
1383 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001384};
1385
1386struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1387 .name = "msm_camera_qs_mt9p017",
1388 .dev = {
1389 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1390 },
1391};
1392
Kevin Chan8b0d2322011-09-10 21:06:31 -07001393static struct msm8960_privacy_light_cfg privacy_light_info = {
1394 .mpp = PM8921_MPP_PM_TO_SYS(12),
1395};
1396
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001397static void __init msm8960_init_cam(void)
1398{
1399 int i;
1400 struct platform_device *cam_dev[] = {
1401 &msm8960_camera_sensor_imx074,
1402 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001403 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001404 };
1405
Kevin Chan8b0d2322011-09-10 21:06:31 -07001406 if (machine_is_msm8960_liquid()) {
1407 struct msm_camera_sensor_info *s_info;
1408 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1409 s_info->sensor_platform_info->mount_angle = 180;
1410 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1411 s_info->sensor_platform_info->privacy_light = 1;
1412 s_info->sensor_platform_info->privacy_light_info =
1413 &privacy_light_info;
1414 }
1415
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001416 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1417 struct msm_camera_sensor_info *s_info;
1418 s_info = cam_dev[i]->dev.platform_data;
1419 msm_get_cam_resources(s_info);
1420 platform_device_register(cam_dev[i]);
1421 }
Kevin Chanf6216f22011-10-25 18:40:11 -07001422
1423 platform_device_register(&msm8960_device_csiphy0);
1424 platform_device_register(&msm8960_device_csiphy1);
Kevin Chanc8b52e82011-10-25 23:20:21 -07001425 platform_device_register(&msm8960_device_csid0);
1426 platform_device_register(&msm8960_device_csid1);
Kevin Chane12c6672011-10-26 11:55:26 -07001427 platform_device_register(&msm8960_device_ispif);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001428}
1429#endif
1430
1431#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001432#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001433#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001434#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001435#endif
1436
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001437
1438#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001439#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001440#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001441#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1442#else
1443#define MSM_FB_EXT_BUF_SIZE 0
1444#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001445
kuogee hsieh3830eb92011-09-12 15:25:57 -07001446#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1447/* width x height x 3 bpp x 2 frame buffer */
1448#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1449#define MSM_FB_WRITEBACK_OFFSET \
1450 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1451#else
1452#define MSM_FB_WRITEBACK_SIZE 0
1453#define MSM_FB_WRITEBACK_OFFSET 0
1454#endif
1455
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001456#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1457/* 4 bpp x 2 page HDMI case */
1458#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1459#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001460/* Note: must be multiple of 4096 */
1461#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1462 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001463#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001464
1465static int writeback_offset(void)
1466{
1467 return MSM_FB_WRITEBACK_OFFSET;
1468}
1469
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001470
1471#define MDP_VSYNC_GPIO 0
1472
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001473#define PANEL_NAME_MAX_LEN 30
1474#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1475#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1476#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1477#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1478#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1479#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1480#define HDMI_PANEL_NAME "hdmi_msm"
1481#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001482
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001483static struct resource msm_fb_resources[] = {
1484 {
1485 .flags = IORESOURCE_DMA,
1486 }
1487};
1488
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001489static int msm_fb_detect_panel(const char *name)
1490{
1491 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001492 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1493 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1494 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001495 return 0;
1496 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001497 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1498 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1499 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001500 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001501
1502#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1503 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1504 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1505 PANEL_NAME_MAX_LEN)))
1506 return 0;
1507
1508 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1509 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1510 PANEL_NAME_MAX_LEN)))
1511 return 0;
1512
1513 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1514 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1515 PANEL_NAME_MAX_LEN)))
1516 return 0;
1517
1518 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1519 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1520 PANEL_NAME_MAX_LEN)))
1521 return 0;
1522#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001523 }
1524
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001525 if (!strncmp(name, HDMI_PANEL_NAME,
1526 strnlen(HDMI_PANEL_NAME,
1527 PANEL_NAME_MAX_LEN)))
1528 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001529
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001530 if (!strncmp(name, TVOUT_PANEL_NAME,
1531 strnlen(TVOUT_PANEL_NAME,
1532 PANEL_NAME_MAX_LEN)))
1533 return 0;
1534
1535 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001536 return -ENODEV;
1537}
1538
1539static struct msm_fb_platform_data msm_fb_pdata = {
1540 .detect_client = msm_fb_detect_panel,
1541};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001542
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001543static struct platform_device msm_fb_device = {
1544 .name = "msm_fb",
1545 .id = 0,
1546 .num_resources = ARRAY_SIZE(msm_fb_resources),
1547 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001548 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001549};
1550
1551static bool dsi_power_on;
1552
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001553/**
1554 * LiQUID panel on/off
1555 *
1556 * @param on
1557 *
1558 * @return int
1559 */
1560static int mipi_dsi_liquid_panel_power(int on)
1561{
1562 static struct regulator *reg_l2, *reg_ext_3p3v;
1563 static int gpio21, gpio24, gpio43;
1564 int rc;
1565
1566 pr_info("%s: on=%d\n", __func__, on);
1567
1568 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1569 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1570 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1571
1572 if (!dsi_power_on) {
1573
1574 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1575 "dsi_vdda");
1576 if (IS_ERR(reg_l2)) {
1577 pr_err("could not get 8921_l2, rc = %ld\n",
1578 PTR_ERR(reg_l2));
1579 return -ENODEV;
1580 }
1581
1582 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1583 if (rc) {
1584 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1585 return -EINVAL;
1586 }
1587
1588 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1589 "vdd_lvds_3p3v");
1590 if (IS_ERR(reg_ext_3p3v)) {
1591 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1592 PTR_ERR(reg_ext_3p3v));
1593 return -ENODEV;
1594 }
1595
1596 rc = gpio_request(gpio21, "disp_pwr_en_n");
1597 if (rc) {
1598 pr_err("request gpio 21 failed, rc=%d\n", rc);
1599 return -ENODEV;
1600 }
1601
1602 rc = gpio_request(gpio43, "disp_rst_n");
1603 if (rc) {
1604 pr_err("request gpio 43 failed, rc=%d\n", rc);
1605 return -ENODEV;
1606 }
1607
1608 rc = gpio_request(gpio24, "disp_backlight_pwm");
1609 if (rc) {
1610 pr_err("request gpio 24 failed, rc=%d\n", rc);
1611 return -ENODEV;
1612 }
1613
1614 dsi_power_on = true;
1615 }
1616
1617 if (on) {
1618 rc = regulator_set_optimum_mode(reg_l2, 100000);
1619 if (rc < 0) {
1620 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1621 return -EINVAL;
1622 }
1623 rc = regulator_enable(reg_l2);
1624 if (rc) {
1625 pr_err("enable l2 failed, rc=%d\n", rc);
1626 return -ENODEV;
1627 }
1628
1629 rc = regulator_enable(reg_ext_3p3v);
1630 if (rc) {
1631 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1632 return -ENODEV;
1633 }
1634
1635 /* set reset pin before power enable */
1636 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1637
1638 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1639 msleep(20);
1640 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1641 msleep(20);
1642 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1643 msleep(20);
1644 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1645 msleep(20);
1646 } else {
1647 gpio_set_value_cansleep(gpio43, 0);
1648 gpio_set_value_cansleep(gpio21, 1);
1649
1650 rc = regulator_disable(reg_l2);
1651 if (rc) {
1652 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1653 return -ENODEV;
1654 }
1655 rc = regulator_disable(reg_ext_3p3v);
1656 if (rc) {
1657 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1658 return -ENODEV;
1659 }
1660 rc = regulator_set_optimum_mode(reg_l2, 100);
1661 if (rc < 0) {
1662 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1663 return -EINVAL;
1664 }
1665 }
1666
1667 return 0;
1668}
1669
1670static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001671{
1672 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001673 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001674 int rc;
1675
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001676 pr_info("%s: state : %d\n", __func__, on);
1677
1678 if (!dsi_power_on) {
1679
1680 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1681 "dsi_vdc");
1682 if (IS_ERR(reg_l8)) {
1683 pr_err("could not get 8921_l8, rc = %ld\n",
1684 PTR_ERR(reg_l8));
1685 return -ENODEV;
1686 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001687 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1688 "dsi_vddio");
1689 if (IS_ERR(reg_l23)) {
1690 pr_err("could not get 8921_l23, rc = %ld\n",
1691 PTR_ERR(reg_l23));
1692 return -ENODEV;
1693 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001694 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1695 "dsi_vdda");
1696 if (IS_ERR(reg_l2)) {
1697 pr_err("could not get 8921_l2, rc = %ld\n",
1698 PTR_ERR(reg_l2));
1699 return -ENODEV;
1700 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001701 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1702 if (rc) {
1703 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1704 return -EINVAL;
1705 }
1706 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1707 if (rc) {
1708 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1709 return -EINVAL;
1710 }
1711 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1712 if (rc) {
1713 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1714 return -EINVAL;
1715 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001716 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1717 rc = gpio_request(gpio43, "disp_rst_n");
1718 if (rc) {
1719 pr_err("request gpio 43 failed, rc=%d\n", rc);
1720 return -ENODEV;
1721 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001722 dsi_power_on = true;
1723 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001724 if (on) {
1725 rc = regulator_set_optimum_mode(reg_l8, 100000);
1726 if (rc < 0) {
1727 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1728 return -EINVAL;
1729 }
1730 rc = regulator_set_optimum_mode(reg_l23, 100000);
1731 if (rc < 0) {
1732 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1733 return -EINVAL;
1734 }
1735 rc = regulator_set_optimum_mode(reg_l2, 100000);
1736 if (rc < 0) {
1737 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1738 return -EINVAL;
1739 }
1740 rc = regulator_enable(reg_l8);
1741 if (rc) {
1742 pr_err("enable l8 failed, rc=%d\n", rc);
1743 return -ENODEV;
1744 }
1745 rc = regulator_enable(reg_l23);
1746 if (rc) {
1747 pr_err("enable l8 failed, rc=%d\n", rc);
1748 return -ENODEV;
1749 }
1750 rc = regulator_enable(reg_l2);
1751 if (rc) {
1752 pr_err("enable l2 failed, rc=%d\n", rc);
1753 return -ENODEV;
1754 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001755 gpio_set_value_cansleep(gpio43, 1);
1756 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001757 rc = regulator_disable(reg_l2);
1758 if (rc) {
1759 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1760 return -ENODEV;
1761 }
1762 rc = regulator_disable(reg_l8);
1763 if (rc) {
1764 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1765 return -ENODEV;
1766 }
1767 rc = regulator_disable(reg_l23);
1768 if (rc) {
1769 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1770 return -ENODEV;
1771 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001772 rc = regulator_set_optimum_mode(reg_l8, 100);
1773 if (rc < 0) {
1774 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1775 return -EINVAL;
1776 }
1777 rc = regulator_set_optimum_mode(reg_l23, 100);
1778 if (rc < 0) {
1779 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1780 return -EINVAL;
1781 }
1782 rc = regulator_set_optimum_mode(reg_l2, 100);
1783 if (rc < 0) {
1784 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1785 return -EINVAL;
1786 }
1787 gpio_set_value_cansleep(gpio43, 0);
1788 }
1789 return 0;
1790}
1791
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001792static int mipi_dsi_panel_power(int on)
1793{
1794 int ret;
1795
1796 pr_info("%s: on=%d\n", __func__, on);
1797
1798 if (machine_is_msm8960_liquid())
1799 ret = mipi_dsi_liquid_panel_power(on);
1800 else
1801 ret = mipi_dsi_cdp_panel_power(on);
1802
1803 return ret;
1804}
1805
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001806static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1807 .vsync_gpio = MDP_VSYNC_GPIO,
1808 .dsi_power_save = mipi_dsi_panel_power,
1809};
1810
1811#ifdef CONFIG_MSM_BUS_SCALING
1812
1813static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001814 {
1815 .src = MSM_BUS_MASTER_MDP_PORT0,
1816 .dst = MSM_BUS_SLAVE_EBI_CH0,
1817 .ab = 0,
1818 .ib = 0,
1819 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001820};
1821
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001822#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1823static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1824 /* If HDMI is used as primary */
1825 {
1826 .src = MSM_BUS_MASTER_MDP_PORT0,
1827 .dst = MSM_BUS_SLAVE_EBI_CH0,
1828 .ab = 2000000000,
1829 .ib = 2000000000,
1830 },
1831};
1832static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1833 {
1834 ARRAY_SIZE(mdp_init_vectors),
1835 mdp_init_vectors,
1836 },
1837 {
1838 ARRAY_SIZE(hdmi_as_primary_vectors),
1839 hdmi_as_primary_vectors,
1840 },
1841 {
1842 ARRAY_SIZE(hdmi_as_primary_vectors),
1843 hdmi_as_primary_vectors,
1844 },
1845 {
1846 ARRAY_SIZE(hdmi_as_primary_vectors),
1847 hdmi_as_primary_vectors,
1848 },
1849 {
1850 ARRAY_SIZE(hdmi_as_primary_vectors),
1851 hdmi_as_primary_vectors,
1852 },
1853 {
1854 ARRAY_SIZE(hdmi_as_primary_vectors),
1855 hdmi_as_primary_vectors,
1856 },
1857};
1858#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001859static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001860 {
1861 .src = MSM_BUS_MASTER_MDP_PORT0,
1862 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001863 .ab = 216000000 * 2,
1864 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001865 },
1866};
1867
1868static struct msm_bus_vectors mdp_vga_vectors[] = {
1869 /* VGA and less video */
1870 {
1871 .src = MSM_BUS_MASTER_MDP_PORT0,
1872 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001873 .ab = 216000000 * 2,
1874 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001875 },
1876};
1877
1878static struct msm_bus_vectors mdp_720p_vectors[] = {
1879 /* 720p and less video */
1880 {
1881 .src = MSM_BUS_MASTER_MDP_PORT0,
1882 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001883 .ab = 230400000 * 2,
1884 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001885 },
1886};
1887
1888static struct msm_bus_vectors mdp_1080p_vectors[] = {
1889 /* 1080p and less video */
1890 {
1891 .src = MSM_BUS_MASTER_MDP_PORT0,
1892 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001893 .ab = 334080000 * 2,
1894 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001895 },
1896};
1897
1898static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1899 {
1900 ARRAY_SIZE(mdp_init_vectors),
1901 mdp_init_vectors,
1902 },
1903 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001904 ARRAY_SIZE(mdp_ui_vectors),
1905 mdp_ui_vectors,
1906 },
1907 {
1908 ARRAY_SIZE(mdp_ui_vectors),
1909 mdp_ui_vectors,
1910 },
1911 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001912 ARRAY_SIZE(mdp_vga_vectors),
1913 mdp_vga_vectors,
1914 },
1915 {
1916 ARRAY_SIZE(mdp_720p_vectors),
1917 mdp_720p_vectors,
1918 },
1919 {
1920 ARRAY_SIZE(mdp_1080p_vectors),
1921 mdp_1080p_vectors,
1922 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001923};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001924#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001925
1926static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1927 mdp_bus_scale_usecases,
1928 ARRAY_SIZE(mdp_bus_scale_usecases),
1929 .name = "mdp",
1930};
1931
1932#endif
1933
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001934#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1935int mdp_core_clk_rate_table[] = {
1936 200000000,
1937 200000000,
1938 200000000,
1939 200000000,
1940};
1941#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001942int mdp_core_clk_rate_table[] = {
1943 85330000,
1944 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001945 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001946 200000000,
1947};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001948#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001949
1950static struct msm_panel_common_pdata mdp_pdata = {
1951 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001952#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1953 .mdp_core_clk_rate = 200000000,
1954#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001955 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001956#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001957 .mdp_core_clk_table = mdp_core_clk_rate_table,
1958 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1959#ifdef CONFIG_MSM_BUS_SCALING
1960 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1961#endif
1962 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001963 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001964};
1965
1966static struct platform_device mipi_dsi_renesas_panel_device = {
1967 .name = "mipi_renesas",
1968 .id = 0,
1969};
1970
1971static struct platform_device mipi_dsi_simulator_panel_device = {
1972 .name = "mipi_simulator",
1973 .id = 0,
1974};
1975
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001976#define LPM_CHANNEL0 0
1977static int toshiba_gpio[] = {LPM_CHANNEL0};
1978
1979static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1980 .gpio = toshiba_gpio,
1981};
1982
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001983static struct platform_device mipi_dsi_toshiba_panel_device = {
1984 .name = "mipi_toshiba",
1985 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001986 .dev = {
1987 .platform_data = &toshiba_pdata,
1988 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001989};
1990
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07001991#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001992static int dsi2lvds_gpio[2] = {
1993 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
1994 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
1995 };
1996
1997static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
1998 .gpio_num = dsi2lvds_gpio,
1999};
2000
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002001static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
2002
2003/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
2004 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
2005 /* timing */
2006 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2007 0x0c, 0x03, 0x04, 0xa0},
2008 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2009 {0xff, 0x00, 0x06, 0x00}, /* strength */
2010 /* pll control */
2011 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2012 0x40, 0x07, 0x03,
2013 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2014};
2015
2016static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002017 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2018 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002019 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2020};
2021
2022static struct platform_device mipi_dsi_novatek_panel_device = {
2023 .name = "mipi_novatek",
2024 .id = 0,
2025 .dev = {
2026 .platform_data = &novatek_pdata,
2027 }
2028};
2029
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002030static struct platform_device mipi_dsi2lvds_bridge_device = {
2031 .name = "mipi_tc358764",
2032 .id = 0,
2033 .dev.platform_data = &mipi_dsi2lvds_pdata,
2034};
2035
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002036#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2037static struct resource hdmi_msm_resources[] = {
2038 {
2039 .name = "hdmi_msm_qfprom_addr",
2040 .start = 0x00700000,
2041 .end = 0x007060FF,
2042 .flags = IORESOURCE_MEM,
2043 },
2044 {
2045 .name = "hdmi_msm_hdmi_addr",
2046 .start = 0x04A00000,
2047 .end = 0x04A00FFF,
2048 .flags = IORESOURCE_MEM,
2049 },
2050 {
2051 .name = "hdmi_msm_irq",
2052 .start = HDMI_IRQ,
2053 .end = HDMI_IRQ,
2054 .flags = IORESOURCE_IRQ,
2055 },
2056};
2057
2058static int hdmi_enable_5v(int on);
2059static int hdmi_core_power(int on, int show);
2060static int hdmi_cec_power(int on);
2061
2062static struct msm_hdmi_platform_data hdmi_msm_data = {
2063 .irq = HDMI_IRQ,
2064 .enable_5v = hdmi_enable_5v,
2065 .core_power = hdmi_core_power,
2066 .cec_power = hdmi_cec_power,
2067};
2068
2069static struct platform_device hdmi_msm_device = {
2070 .name = "hdmi_msm",
2071 .id = 0,
2072 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2073 .resource = hdmi_msm_resources,
2074 .dev.platform_data = &hdmi_msm_data,
2075};
2076#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2077
Vinay Kalia291263e2011-11-01 17:07:05 -07002078#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2079static struct platform_device wfd_panel_device = {
2080 .name = "wfd_panel",
2081 .id = 0,
2082 .dev.platform_data = NULL,
2083};
2084#endif
2085
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002086#ifdef CONFIG_MSM_BUS_SCALING
2087static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2088 {
2089 .src = MSM_BUS_MASTER_MDP_PORT0,
2090 .dst = MSM_BUS_SLAVE_EBI_CH0,
2091 .ab = 0,
2092 .ib = 0,
2093 },
2094};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002095
2096#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2097static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2098 {
2099 .src = MSM_BUS_MASTER_MDP_PORT0,
2100 .dst = MSM_BUS_SLAVE_EBI_CH0,
2101 .ab = 2000000000,
2102 .ib = 2000000000,
2103 },
2104};
2105#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002106static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2107 {
2108 .src = MSM_BUS_MASTER_MDP_PORT0,
2109 .dst = MSM_BUS_SLAVE_EBI_CH0,
2110 .ab = 566092800 * 2,
2111 .ib = 707616000 * 2,
2112 },
2113};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002114#endif
2115
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002116static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2117 {
2118 ARRAY_SIZE(dtv_bus_init_vectors),
2119 dtv_bus_init_vectors,
2120 },
2121 {
2122 ARRAY_SIZE(dtv_bus_def_vectors),
2123 dtv_bus_def_vectors,
2124 },
2125};
2126static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2127 dtv_bus_scale_usecases,
2128 ARRAY_SIZE(dtv_bus_scale_usecases),
2129 .name = "dtv",
2130};
2131
2132static struct lcdc_platform_data dtv_pdata = {
2133 .bus_scale_table = &dtv_bus_scale_pdata,
2134};
2135#endif
2136
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002137static void __init msm_fb_add_devices(void)
2138{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002139 struct platform_device *ptr = NULL;
2140
2141 if (machine_is_msm8960_liquid())
2142 ptr = &mipi_dsi2lvds_bridge_device;
2143 else
2144 ptr = &mipi_dsi_toshiba_panel_device;
2145 platform_add_devices(&ptr, 1);
2146
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002147 if (machine_is_msm8x60_rumi3()) {
2148 msm_fb_register_device("mdp", NULL);
2149 mipi_dsi_pdata.target_type = 1;
2150 } else
2151 msm_fb_register_device("mdp", &mdp_pdata);
2152 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002153#ifdef CONFIG_MSM_BUS_SCALING
2154 msm_fb_register_device("dtv", &dtv_pdata);
2155#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002156}
2157
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002158static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2159 .func = GPIOMUX_FUNC_GPIO,
2160 .drv = GPIOMUX_DRV_2MA,
2161 .pull = GPIOMUX_PULL_DOWN,
2162};
2163
2164static struct gpiomux_setting mdp_vsync_active_cfg = {
2165 .func = GPIOMUX_FUNC_1,
2166 .drv = GPIOMUX_DRV_2MA,
2167 .pull = GPIOMUX_PULL_DOWN,
2168};
2169
2170static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2171 {
2172 .gpio = MDP_VSYNC_GPIO,
2173 .settings = {
2174 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2175 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2176 },
2177 }
2178};
2179
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002180#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2181static struct gpiomux_setting hdmi_suspend_cfg = {
2182 .func = GPIOMUX_FUNC_GPIO,
2183 .drv = GPIOMUX_DRV_2MA,
2184 .pull = GPIOMUX_PULL_DOWN,
2185};
2186
2187static struct gpiomux_setting hdmi_active_1_cfg = {
2188 .func = GPIOMUX_FUNC_1,
2189 .drv = GPIOMUX_DRV_2MA,
2190 .pull = GPIOMUX_PULL_UP,
2191};
2192
2193static struct gpiomux_setting hdmi_active_2_cfg = {
2194 .func = GPIOMUX_FUNC_1,
2195 .drv = GPIOMUX_DRV_2MA,
2196 .pull = GPIOMUX_PULL_DOWN,
2197};
2198
2199static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2200 {
2201 .gpio = 99,
2202 .settings = {
2203 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2204 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2205 },
2206 },
2207 {
2208 .gpio = 100,
2209 .settings = {
2210 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2211 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2212 },
2213 },
2214 {
2215 .gpio = 101,
2216 .settings = {
2217 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2218 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2219 },
2220 },
2221 {
2222 .gpio = 102,
2223 .settings = {
2224 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2225 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2226 },
2227 },
2228};
2229
2230static int hdmi_enable_5v(int on)
2231{
2232 /* TBD: PM8921 regulator instead of 8901 */
2233 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2234 static int prev_on;
2235 int rc;
2236
2237 if (on == prev_on)
2238 return 0;
2239
2240 if (!reg_8921_hdmi_mvs)
2241 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2242 "hdmi_mvs");
2243
2244 if (on) {
2245 rc = regulator_enable(reg_8921_hdmi_mvs);
2246 if (rc) {
2247 pr_err("'%s' regulator enable failed, rc=%d\n",
2248 "8921_hdmi_mvs", rc);
2249 return rc;
2250 }
2251 pr_debug("%s(on): success\n", __func__);
2252 } else {
2253 rc = regulator_disable(reg_8921_hdmi_mvs);
2254 if (rc)
2255 pr_warning("'%s' regulator disable failed, rc=%d\n",
2256 "8921_hdmi_mvs", rc);
2257 pr_debug("%s(off): success\n", __func__);
2258 }
2259
2260 prev_on = on;
2261
2262 return 0;
2263}
2264
2265static int hdmi_core_power(int on, int show)
2266{
2267 static struct regulator *reg_8921_l23, *reg_8921_s4;
2268 static int prev_on;
2269 int rc;
2270
2271 if (on == prev_on)
2272 return 0;
2273
2274 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002275 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002276 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002277 if (IS_ERR(reg_8921_l23)) {
2278 pr_err("could not get reg_8921_l23, rc = %ld\n",
2279 PTR_ERR(reg_8921_l23));
2280 return -ENODEV;
2281 }
2282 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2283 if (rc) {
2284 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2285 return -EINVAL;
2286 }
2287 }
2288 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002289 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002290 if (IS_ERR(reg_8921_s4)) {
2291 pr_err("could not get reg_8921_s4, rc = %ld\n",
2292 PTR_ERR(reg_8921_s4));
2293 return -ENODEV;
2294 }
2295 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2296 if (rc) {
2297 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2298 return -EINVAL;
2299 }
2300 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002301
2302 if (on) {
2303 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2304 if (rc < 0) {
2305 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2306 return -EINVAL;
2307 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002308 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002309 if (rc) {
2310 pr_err("'%s' regulator enable failed, rc=%d\n",
2311 "hdmi_avdd", rc);
2312 return rc;
2313 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002314 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002315 if (rc) {
2316 pr_err("'%s' regulator enable failed, rc=%d\n",
2317 "hdmi_vcc", rc);
2318 return rc;
2319 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002320 rc = gpio_request(100, "HDMI_DDC_CLK");
2321 if (rc) {
2322 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2323 "HDMI_DDC_CLK", 100, rc);
2324 goto error1;
2325 }
2326 rc = gpio_request(101, "HDMI_DDC_DATA");
2327 if (rc) {
2328 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2329 "HDMI_DDC_DATA", 101, rc);
2330 goto error2;
2331 }
2332 rc = gpio_request(102, "HDMI_HPD");
2333 if (rc) {
2334 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2335 "HDMI_HPD", 102, rc);
2336 goto error3;
2337 }
2338 pr_debug("%s(on): success\n", __func__);
2339 } else {
2340 gpio_free(100);
2341 gpio_free(101);
2342 gpio_free(102);
2343
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002344 rc = regulator_disable(reg_8921_l23);
2345 if (rc) {
2346 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2347 return -ENODEV;
2348 }
2349 rc = regulator_disable(reg_8921_s4);
2350 if (rc) {
2351 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2352 return -ENODEV;
2353 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002354 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2355 if (rc < 0) {
2356 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2357 return -EINVAL;
2358 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002359 pr_debug("%s(off): success\n", __func__);
2360 }
2361
2362 prev_on = on;
2363
2364 return 0;
2365
2366error3:
2367 gpio_free(101);
2368error2:
2369 gpio_free(100);
2370error1:
2371 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002372 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002373 return rc;
2374}
2375
2376static int hdmi_cec_power(int on)
2377{
2378 static int prev_on;
2379 int rc;
2380
2381 if (on == prev_on)
2382 return 0;
2383
2384 if (on) {
2385 rc = gpio_request(99, "HDMI_CEC_VAR");
2386 if (rc) {
2387 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2388 "HDMI_CEC_VAR", 99, rc);
2389 goto error;
2390 }
2391 pr_debug("%s(on): success\n", __func__);
2392 } else {
2393 gpio_free(99);
2394 pr_debug("%s(off): success\n", __func__);
2395 }
2396
2397 prev_on = on;
2398
2399 return 0;
2400error:
2401 return rc;
2402}
2403#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2404
2405static void __init msm8960_allocate_memory_regions(void)
2406{
2407 void *addr;
2408 unsigned long size;
2409
2410 size = MSM_FB_SIZE;
2411 addr = alloc_bootmem_align(size, 0x1000);
2412 msm_fb_resources[0].start = __pa(addr);
2413 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2414 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2415 size, addr, __pa(addr));
2416
2417}
2418#ifdef CONFIG_WCD9310_CODEC
2419
2420#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2421
Patrick Lai3043fba2011-08-01 14:15:57 -07002422/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2423 * 4 micbiases are used to power various analog and digital
2424 * microphones operating at 1800 mV. Technically, all micbiases
2425 * can source from single cfilter since all microphones operate
2426 * at the same voltage level. The arrangement below is to make
2427 * sure all cfilters are exercised. LDO_H regulator ouput level
2428 * does not need to be as high as 2.85V. It is choosen for
2429 * microphone sensitivity purpose.
2430 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002431static struct tabla_pdata tabla_platform_data = {
2432 .slimbus_slave_device = {
2433 .name = "tabla-slave",
2434 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2435 },
2436 .irq = MSM_GPIO_TO_INT(62),
2437 .irq_base = TABLA_INTERRUPT_BASE,
2438 .num_irqs = NR_TABLA_IRQS,
2439 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002440 .micbias = {
2441 .ldoh_v = TABLA_LDOH_2P85_V,
2442 .cfilt1_mv = 1800,
2443 .cfilt2_mv = 1800,
2444 .cfilt3_mv = 1800,
2445 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2446 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2447 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2448 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2449 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002450};
2451
2452static struct slim_device msm_slim_tabla = {
2453 .name = "tabla-slim",
2454 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2455 .dev = {
2456 .platform_data = &tabla_platform_data,
2457 },
2458};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302459
2460static struct tabla_pdata tabla20_platform_data = {
2461 .slimbus_slave_device = {
2462 .name = "tabla-slave",
2463 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2464 },
2465 .irq = MSM_GPIO_TO_INT(62),
2466 .irq_base = TABLA_INTERRUPT_BASE,
2467 .num_irqs = NR_TABLA_IRQS,
2468 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2469 .micbias = {
2470 .ldoh_v = TABLA_LDOH_2P85_V,
2471 .cfilt1_mv = 1800,
2472 .cfilt2_mv = 1800,
2473 .cfilt3_mv = 1800,
2474 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2475 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2476 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2477 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2478 }
2479};
2480
2481static struct slim_device msm_slim_tabla20 = {
2482 .name = "tabla2x-slim",
2483 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2484 .dev = {
2485 .platform_data = &tabla20_platform_data,
2486 },
2487};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002488#endif
2489
2490static struct slim_boardinfo msm_slim_devices[] = {
2491#ifdef CONFIG_WCD9310_CODEC
2492 {
2493 .bus_num = 1,
2494 .slim_slave = &msm_slim_tabla,
2495 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302496 {
2497 .bus_num = 1,
2498 .slim_slave = &msm_slim_tabla20,
2499 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002500#endif
2501 /* add more slimbus slaves as needed */
2502};
2503
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002504#define MSM_WCNSS_PHYS 0x03000000
2505#define MSM_WCNSS_SIZE 0x280000
2506
2507static struct resource resources_wcnss_wlan[] = {
2508 {
2509 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2510 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2511 .name = "wcnss_wlanrx_irq",
2512 .flags = IORESOURCE_IRQ,
2513 },
2514 {
2515 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2516 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2517 .name = "wcnss_wlantx_irq",
2518 .flags = IORESOURCE_IRQ,
2519 },
2520 {
2521 .start = MSM_WCNSS_PHYS,
2522 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2523 .name = "wcnss_mmio",
2524 .flags = IORESOURCE_MEM,
2525 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002526 {
2527 .start = 84,
2528 .end = 88,
2529 .name = "wcnss_gpios_5wire",
2530 .flags = IORESOURCE_IO,
2531 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002532};
2533
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002534static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2535 .has_48mhz_xo = 1,
2536};
2537
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002538static struct platform_device msm_device_wcnss_wlan = {
2539 .name = "wcnss_wlan",
2540 .id = 0,
2541 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2542 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002543 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002544};
2545
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002546#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2547 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2548 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2549 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2550
2551#define QCE_SIZE 0x10000
2552#define QCE_0_BASE 0x18500000
2553
2554#define QCE_HW_KEY_SUPPORT 0
2555#define QCE_SHA_HMAC_SUPPORT 1
2556#define QCE_SHARE_CE_RESOURCE 1
2557#define QCE_CE_SHARED 0
2558
2559static struct resource qcrypto_resources[] = {
2560 [0] = {
2561 .start = QCE_0_BASE,
2562 .end = QCE_0_BASE + QCE_SIZE - 1,
2563 .flags = IORESOURCE_MEM,
2564 },
2565 [1] = {
2566 .name = "crypto_channels",
2567 .start = DMOV_CE_IN_CHAN,
2568 .end = DMOV_CE_OUT_CHAN,
2569 .flags = IORESOURCE_DMA,
2570 },
2571 [2] = {
2572 .name = "crypto_crci_in",
2573 .start = DMOV_CE_IN_CRCI,
2574 .end = DMOV_CE_IN_CRCI,
2575 .flags = IORESOURCE_DMA,
2576 },
2577 [3] = {
2578 .name = "crypto_crci_out",
2579 .start = DMOV_CE_OUT_CRCI,
2580 .end = DMOV_CE_OUT_CRCI,
2581 .flags = IORESOURCE_DMA,
2582 },
2583};
2584
2585static struct resource qcedev_resources[] = {
2586 [0] = {
2587 .start = QCE_0_BASE,
2588 .end = QCE_0_BASE + QCE_SIZE - 1,
2589 .flags = IORESOURCE_MEM,
2590 },
2591 [1] = {
2592 .name = "crypto_channels",
2593 .start = DMOV_CE_IN_CHAN,
2594 .end = DMOV_CE_OUT_CHAN,
2595 .flags = IORESOURCE_DMA,
2596 },
2597 [2] = {
2598 .name = "crypto_crci_in",
2599 .start = DMOV_CE_IN_CRCI,
2600 .end = DMOV_CE_IN_CRCI,
2601 .flags = IORESOURCE_DMA,
2602 },
2603 [3] = {
2604 .name = "crypto_crci_out",
2605 .start = DMOV_CE_OUT_CRCI,
2606 .end = DMOV_CE_OUT_CRCI,
2607 .flags = IORESOURCE_DMA,
2608 },
2609};
2610
2611#endif
2612
2613#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2614 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2615
2616static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2617 .ce_shared = QCE_CE_SHARED,
2618 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2619 .hw_key_support = QCE_HW_KEY_SUPPORT,
2620 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2621};
2622
2623static struct platform_device qcrypto_device = {
2624 .name = "qcrypto",
2625 .id = 0,
2626 .num_resources = ARRAY_SIZE(qcrypto_resources),
2627 .resource = qcrypto_resources,
2628 .dev = {
2629 .coherent_dma_mask = DMA_BIT_MASK(32),
2630 .platform_data = &qcrypto_ce_hw_suppport,
2631 },
2632};
2633#endif
2634
2635#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2636 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2637
2638static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2639 .ce_shared = QCE_CE_SHARED,
2640 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2641 .hw_key_support = QCE_HW_KEY_SUPPORT,
2642 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2643};
2644
2645static struct platform_device qcedev_device = {
2646 .name = "qce",
2647 .id = 0,
2648 .num_resources = ARRAY_SIZE(qcedev_resources),
2649 .resource = qcedev_resources,
2650 .dev = {
2651 .coherent_dma_mask = DMA_BIT_MASK(32),
2652 .platform_data = &qcedev_ce_hw_suppport,
2653 },
2654};
2655#endif
2656
2657
2658static int __init gpiomux_init(void)
2659{
2660 int rc;
2661
2662 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2663 if (rc) {
2664 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2665 return rc;
2666 }
2667
Nishant Pandit24153d82011-08-27 16:05:13 +05302668 msm_gpiomux_install(msm8960_cam_common_configs,
2669 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002670
2671 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002672 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002673
2674 msm_gpiomux_install(msm8960_gsbi_configs,
2675 ARRAY_SIZE(msm8960_gsbi_configs));
2676
2677 msm_gpiomux_install(msm8960_cyts_configs,
2678 ARRAY_SIZE(msm8960_cyts_configs));
2679
2680 msm_gpiomux_install(msm8960_slimbus_config,
2681 ARRAY_SIZE(msm8960_slimbus_config));
2682
2683 msm_gpiomux_install(msm8960_audio_codec_configs,
2684 ARRAY_SIZE(msm8960_audio_codec_configs));
2685
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002686 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2687 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2688
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002689#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2690 msm_gpiomux_install(msm8960_hdmi_configs,
2691 ARRAY_SIZE(msm8960_hdmi_configs));
2692#endif
2693
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002694 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2695 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2696
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002697 msm_gpiomux_install(wcnss_5wire_interface,
2698 ARRAY_SIZE(wcnss_5wire_interface));
2699
2700 return 0;
2701}
2702
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002703#define MSM_SHARED_RAM_PHYS 0x80000000
2704
2705static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2706 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2707 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2708 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2709 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2710 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2711 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2712 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2713 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2714 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2715 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2716 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2717 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002718 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2719 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2720 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2721 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2722 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2723 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2724 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2725 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2726 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2727 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2728 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2729 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2730 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2731 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002732 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002733 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2734 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2735 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002736 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2737 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002738};
2739
2740static struct pm8921_adc_properties pm8921_adc_data = {
2741 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2742 .bitresolution = 15,
2743 .bipolar = 0,
2744};
2745
2746static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2747 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002748 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002749 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002750 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002751};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002752
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002753static void __init msm8960_map_io(void)
2754{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002755 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002756 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002757
2758 if (socinfo_init() < 0)
2759 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002760}
2761
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002762#ifdef CONFIG_ARCH_MSM8930
2763static void __init msm8930_map_io(void)
2764{
2765 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2766 msm_map_msm8930_io();
2767
2768 if (socinfo_init() < 0)
2769 pr_err("socinfo_init() failed!\n");
2770}
2771#endif
2772
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002773static void __init msm8960_init_irq(void)
2774{
2775 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002776
2777 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002778 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002779 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002780
2781 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002782 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002783
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002784 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2785 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002786
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002787 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2788 * as they are configured as level, which does not play nice with
2789 * handle_percpu_irq.
2790 */
2791 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2792 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002793 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002794 }
2795}
2796
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002797/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002798enum sdcc_controllers {
2799 SDCC1,
2800 SDCC2,
2801 SDCC3,
2802 SDCC4,
2803 SDCC5,
2804 MAX_SDCC_CONTROLLER
2805};
2806
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002807/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002808static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2809 /* SDCC1 : eMMC card connected */
2810 [SDCC1] = {
2811 .name = "sdc_vdd",
2812 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302813 .high_vol_level = 2950000,
2814 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302815 .always_on = 1,
2816 .lpm_sup = 1,
2817 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002818 .hpm_uA = 200000, /* 200mA */
2819 },
2820 /* SDCC3 : External card slot connected */
2821 [SDCC3] = {
2822 .name = "sdc_vdd",
2823 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302824 .high_vol_level = 2950000,
2825 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002826 .hpm_uA = 600000, /* 600mA */
2827 }
2828};
2829
2830/* Only slots having eMMC card will require VCCQ voltage */
2831static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2832 /* SDCC1 : eMMC card connected */
2833 [SDCC1] = {
2834 .name = "sdc_vccq",
2835 .set_voltage_sup = 1,
2836 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302837 .high_vol_level = 1800000,
2838 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002839 .hpm_uA = 200000, /* 200mA */
2840 }
2841};
2842
2843/* All SDCC controllers may require voting for VDD PAD voltage */
2844static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2845 /* SDCC3 : External card slot connected */
2846 [SDCC3] = {
2847 .name = "sdc_vddp",
2848 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302849 .high_vol_level = 2950000,
2850 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002851 .always_on = 1,
2852 .lpm_sup = 1,
2853 /* Max. Active current required is 16 mA */
2854 .hpm_uA = 16000,
2855 /*
2856 * Sleep current required is ~300 uA. But min. vote can be
2857 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2858 * during sleep.
2859 */
2860 .lpm_uA = 2000,
2861 }
2862};
2863
2864static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2865 /* SDCC1 : eMMC card connected */
2866 [SDCC1] = {
2867 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2868 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2869 },
2870 /* SDCC3 : External card slot connected */
2871 [SDCC3] = {
2872 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2873 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2874 }
2875};
2876
2877/* SDC1 pad data */
2878static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2879 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302880 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2881 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002882};
2883
2884static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2885 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2886 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2887 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2888};
2889
2890static struct msm_mmc_pad_pull sdc1_pad_pull_on_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_UP},
2893 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2894};
2895
2896static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302897 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002898 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2899 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2900};
2901
2902/* SDC3 pad data */
2903static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2904 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2905 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2906 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2907};
2908
2909static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2910 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2911 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2912 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2913};
2914
2915static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302916 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002917 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2918 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2919};
2920
2921static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302922 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302923 /*
2924 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2925 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2926 * which would result in false card detection interrupts.
2927 */
2928 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2929 /*
2930 * Keeping DATA lines status to PULL UP will make sure that
2931 * there is no current leak during sleep if external pull up
2932 * is connected to DATA lines.
2933 */
2934 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002935};
2936
2937struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2938 [SDCC1] = {
2939 .on = sdc1_pad_pull_on_cfg,
2940 .off = sdc1_pad_pull_off_cfg,
2941 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2942 },
2943 [SDCC3] = {
2944 .on = sdc3_pad_pull_on_cfg,
2945 .off = sdc3_pad_pull_off_cfg,
2946 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2947 },
2948};
2949
2950struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2951 [SDCC1] = {
2952 .on = sdc1_pad_drv_on_cfg,
2953 .off = sdc1_pad_drv_off_cfg,
2954 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2955 },
2956 [SDCC3] = {
2957 .on = sdc3_pad_drv_on_cfg,
2958 .off = sdc3_pad_drv_off_cfg,
2959 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2960 },
2961};
2962
2963struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2964 [SDCC1] = {
2965 .pull = &mmc_pad_pull_data[SDCC1],
2966 .drv = &mmc_pad_drv_data[SDCC1]
2967 },
2968 [SDCC3] = {
2969 .pull = &mmc_pad_pull_data[SDCC3],
2970 .drv = &mmc_pad_drv_data[SDCC3]
2971 },
2972};
2973
2974struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2975 [SDCC1] = {
2976 .pad_data = &mmc_pad_data[SDCC1],
2977 },
2978 [SDCC3] = {
2979 .pad_data = &mmc_pad_data[SDCC3],
2980 },
2981};
2982
2983static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05302984 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002985};
2986
2987static unsigned int sdc3_sup_clk_rates[] = {
2988 400000, 24000000, 48000000, 96000000
2989};
2990
2991#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2992static struct mmc_platform_data msm8960_sdc1_data = {
2993 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2994#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2995 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2996#else
2997 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2998#endif
2999 .sup_clk_table = sdc1_sup_clk_rates,
3000 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303001 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003002 .nonremovable = 1,
3003 .sdcc_v4_sup = true,
3004 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303005 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003006};
3007#endif
3008
3009#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3010static struct mmc_platform_data msm8960_sdc3_data = {
3011 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3012 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3013 .sup_clk_table = sdc3_sup_clk_rates,
3014 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303015 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303016#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003017 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303018#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003019 .sdcc_v4_sup = true,
3020 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3021 .pin_data = &mmc_slot_pin_data[SDCC3],
3022#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3023 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3024 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3025 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3026#endif
3027 .xpc_cap = 1,
3028 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3029 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303030 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003031};
3032#endif
3033
3034static void __init msm8960_init_mmc(void)
3035{
3036#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3037 /* SDC1 : eMMC card connected */
3038 msm_add_sdcc(1, &msm8960_sdc1_data);
3039#endif
3040#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3041 /* SDC3: External card slot */
3042 msm_add_sdcc(3, &msm8960_sdc3_data);
3043#endif
3044}
3045
3046static void __init msm8960_init_buses(void)
3047{
3048#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003049 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003050 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3051 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3052 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3053 msm_bus_apps_fabric.dev.platform_data =
3054 &msm_bus_8960_apps_fabric_pdata;
3055 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3056 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3057 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3058 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003059#endif
3060}
3061
3062static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3063 .max_clock_speed = 15060000,
3064};
3065
3066#ifdef CONFIG_USB_MSM_OTG_72K
3067static struct msm_otg_platform_data msm_otg_pdata;
3068#else
3069#define USB_5V_EN 42
3070static void msm_hsusb_vbus_power(bool on)
3071{
3072 int rc;
3073 static bool vbus_is_on;
3074 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003075
3076 if (vbus_is_on == on)
3077 return;
3078
3079 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003080 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3081 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003082 if (IS_ERR(mvs_otg_switch)) {
3083 pr_err("Unable to get mvs_otg_switch\n");
3084 return;
3085 }
3086
3087 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3088 "usb_5v_en");
3089 if (rc < 0) {
3090 pr_err("failed to request usb_5v_en gpio\n");
3091 goto put_mvs_otg;
3092 }
3093
Anji jonnala2936fd92011-11-09 15:39:22 +05303094 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3095 if (rc) {
3096 pr_err("%s: unable to set_direction for gpio [%d]\n",
3097 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003098 goto free_usb_5v_en;
3099 }
3100
Anji jonnala2936fd92011-11-09 15:39:22 +05303101 if (regulator_enable(mvs_otg_switch)) {
3102 pr_err("unable to enable mvs_otg_switch\n");
3103 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003104 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303105
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003106 vbus_is_on = true;
3107 return;
3108 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303109 regulator_disable(mvs_otg_switch);
3110err_ldo_gpio_set_dir:
3111 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003112free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303113 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003114put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303115 regulator_put(mvs_otg_switch);
3116 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003117}
3118
3119static struct msm_otg_platform_data msm_otg_pdata = {
3120 .mode = USB_OTG,
3121 .otg_control = OTG_PMIC_CONTROL,
3122 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3123 .pclk_src_name = "dfab_usb_hs_clk",
3124 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3125 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303126 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003127};
3128#endif
3129
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303130#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303131#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303132static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3133 .strobe = 150,
3134 .data = 151,
3135};
3136#else
3137static struct msm_hsic_host_platform_data msm_hsic_pdata;
3138#endif
3139
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003140#define PID_MAGIC_ID 0x71432909
3141#define SERIAL_NUM_MAGIC_ID 0x61945374
3142#define SERIAL_NUMBER_LENGTH 127
3143#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3144
3145struct magic_num_struct {
3146 uint32_t pid;
3147 uint32_t serial_num;
3148};
3149
3150struct dload_struct {
3151 uint32_t reserved1;
3152 uint32_t reserved2;
3153 uint32_t reserved3;
3154 uint16_t reserved4;
3155 uint16_t pid;
3156 char serial_number[SERIAL_NUMBER_LENGTH];
3157 uint16_t reserved5;
3158 struct magic_num_struct magic_struct;
3159};
3160
3161static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3162{
3163 struct dload_struct __iomem *dload = 0;
3164
3165 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3166 if (!dload) {
3167 pr_err("%s: cannot remap I/O memory region: %08x\n",
3168 __func__, DLOAD_USB_BASE_ADD);
3169 return -ENXIO;
3170 }
3171
3172 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3173 __func__, dload, pid, snum);
3174 /* update pid */
3175 dload->magic_struct.pid = PID_MAGIC_ID;
3176 dload->pid = pid;
3177
3178 /* update serial number */
3179 dload->magic_struct.serial_num = 0;
3180 if (!snum) {
3181 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3182 goto out;
3183 }
3184
3185 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003186 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003187out:
3188 iounmap(dload);
3189 return 0;
3190}
3191
3192static struct android_usb_platform_data android_usb_pdata = {
3193 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3194};
3195
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003196static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003197 .name = "android_usb",
3198 .id = -1,
3199 .dev = {
3200 .platform_data = &android_usb_pdata,
3201 },
3202};
3203
3204static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3205 0x03, 0x0f,
3206};
3207
3208static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3209 0x00, 0x24, 0x54, 0x10,
3210 0x09, 0x03, 0x01,
3211 0x10, 0x54, 0x30, 0x0C,
3212 0x24, 0x30, 0x0f,
3213};
3214
3215static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3216 0x00, 0x24, 0x54, 0x10,
3217 0x09, 0x07, 0x01, 0x0B,
3218 0x10, 0x54, 0x30, 0x0C,
3219 0x24, 0x30, 0x0f,
3220};
3221
3222static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3223 [0] = {
3224 .mode = MSM_SPM_MODE_CLOCK_GATING,
3225 .notify_rpm = false,
3226 .cmd = spm_wfi_cmd_sequence,
3227 },
3228 [1] = {
3229 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3230 .notify_rpm = false,
3231 .cmd = spm_power_collapse_without_rpm,
3232 },
3233 [2] = {
3234 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3235 .notify_rpm = true,
3236 .cmd = spm_power_collapse_with_rpm,
3237 },
3238};
3239
3240static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3241 [0] = {
3242 .reg_base_addr = MSM_SAW0_BASE,
3243 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3244 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3245 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3246#if defined(CONFIG_MSM_AVS_HW)
3247 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3248 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3249#endif
3250 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3251 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3252 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3253 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3254 .vctl_timeout_us = 50,
3255 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3256 .modes = msm_spm_seq_list,
3257 },
3258 [1] = {
3259 .reg_base_addr = MSM_SAW1_BASE,
3260 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3261 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3262 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3263#if defined(CONFIG_MSM_AVS_HW)
3264 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3265 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3266#endif
3267 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3268 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3269 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3270 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3271 .vctl_timeout_us = 50,
3272 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3273 .modes = msm_spm_seq_list,
3274 },
3275};
3276
3277static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3278 0x00, 0x20, 0x03, 0x20,
3279 0x00, 0x0f,
3280};
3281
3282static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3283 0x00, 0x20, 0x34, 0x64,
3284 0x48, 0x07, 0x48, 0x20,
3285 0x50, 0x64, 0x04, 0x34,
3286 0x50, 0x0f,
3287};
3288static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3289 0x00, 0x10, 0x34, 0x64,
3290 0x48, 0x07, 0x48, 0x10,
3291 0x50, 0x64, 0x04, 0x34,
3292 0x50, 0x0F,
3293};
3294
3295static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3296 [0] = {
3297 .mode = MSM_SPM_L2_MODE_RETENTION,
3298 .notify_rpm = false,
3299 .cmd = l2_spm_wfi_cmd_sequence,
3300 },
3301 [1] = {
3302 .mode = MSM_SPM_L2_MODE_GDHS,
3303 .notify_rpm = true,
3304 .cmd = l2_spm_gdhs_cmd_sequence,
3305 },
3306 [2] = {
3307 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3308 .notify_rpm = true,
3309 .cmd = l2_spm_power_off_cmd_sequence,
3310 },
3311};
3312
3313
3314static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3315 [0] = {
3316 .reg_base_addr = MSM_SAW_L2_BASE,
3317 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3318 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3319 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3320 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3321 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3322 .modes = msm_spm_l2_seq_list,
3323 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3324 },
3325};
3326
3327#define CYTTSP_TS_GPIO_IRQ 11
3328#define CYTTSP_TS_SLEEP_GPIO 50
3329#define CYTTSP_TS_RESOUT_N_GPIO 52
3330
3331/*virtual key support */
3332static ssize_t tma340_vkeys_show(struct kobject *kobj,
3333 struct kobj_attribute *attr, char *buf)
3334{
3335 return snprintf(buf, 200,
3336 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3337 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3338 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3339 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3340 "\n");
3341}
3342
3343static struct kobj_attribute tma340_vkeys_attr = {
3344 .attr = {
3345 .mode = S_IRUGO,
3346 },
3347 .show = &tma340_vkeys_show,
3348};
3349
3350static struct attribute *tma340_properties_attrs[] = {
3351 &tma340_vkeys_attr.attr,
3352 NULL
3353};
3354
3355static struct attribute_group tma340_properties_attr_group = {
3356 .attrs = tma340_properties_attrs,
3357};
3358
3359
3360static int cyttsp_platform_init(struct i2c_client *client)
3361{
3362 int rc = 0;
3363 static struct kobject *tma340_properties_kobj;
3364
3365 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3366 tma340_properties_kobj = kobject_create_and_add("board_properties",
3367 NULL);
3368 if (tma340_properties_kobj)
3369 rc = sysfs_create_group(tma340_properties_kobj,
3370 &tma340_properties_attr_group);
3371 if (!tma340_properties_kobj || rc)
3372 pr_err("%s: failed to create board_properties\n",
3373 __func__);
3374
3375 return 0;
3376}
3377
3378static struct cyttsp_regulator regulator_data[] = {
3379 {
3380 .name = "vdd",
3381 .min_uV = CY_TMA300_VTG_MIN_UV,
3382 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303383 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3384 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003385 },
3386 /* TODO: Remove after runtime PM is enabled in I2C driver */
3387 {
3388 .name = "vcc_i2c",
3389 .min_uV = CY_I2C_VTG_MIN_UV,
3390 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303391 .hpm_load_uA = CY_I2C_CURR_UA,
3392 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003393 },
3394};
3395
3396static struct cyttsp_platform_data cyttsp_pdata = {
3397 .panel_maxx = 634,
3398 .panel_maxy = 1166,
3399 .disp_maxx = 616,
3400 .disp_maxy = 1023,
3401 .disp_minx = 0,
3402 .disp_miny = 16,
3403 .flags = 0x01,
3404 .gen = CY_GEN3, /* or */
3405 .use_st = CY_USE_ST,
3406 .use_mt = CY_USE_MT,
3407 .use_hndshk = CY_SEND_HNDSHK,
3408 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303409 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003410 .use_gestures = CY_USE_GESTURES,
3411 .fw_fname = "cyttsp_8960_cdp.hex",
3412 /* activate up to 4 groups
3413 * and set active distance
3414 */
3415 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3416 CY_GEST_GRP3 | CY_GEST_GRP4 |
3417 CY_ACT_DIST,
3418 /* change act_intrvl to customize the Active power state
3419 * scanning/processing refresh interval for Operating mode
3420 */
3421 .act_intrvl = CY_ACT_INTRVL_DFLT,
3422 /* change tch_tmout to customize the touch timeout for the
3423 * Active power state for Operating mode
3424 */
3425 .tch_tmout = CY_TCH_TMOUT_DFLT,
3426 /* change lp_intrvl to customize the Low Power power state
3427 * scanning/processing refresh interval for Operating mode
3428 */
3429 .lp_intrvl = CY_LP_INTRVL_DFLT,
3430 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3431 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3432 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3433 .regulator_info = regulator_data,
3434 .num_regulators = ARRAY_SIZE(regulator_data),
3435 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303436 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003437};
3438
3439static struct i2c_board_info cyttsp_info[] __initdata = {
3440 {
3441 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3442 .platform_data = &cyttsp_pdata,
3443#ifndef CY_USE_TIMER
3444 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3445#endif /* CY_USE_TIMER */
3446 },
3447};
3448
Mohan Pallaka50837382011-09-07 11:00:57 +05303449/* configuration data */
3450static const u8 mxt_config_data[] = {
3451 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003452 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303453 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003454 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3455 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3456 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3457 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3458 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3459 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3460 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303461 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003462 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303463 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003464 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303465 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003466 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3467 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3468 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3469 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303470 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003471 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3472 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303473 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003474 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3475 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303476 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003477 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3478 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303479 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003480 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3481 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303482 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003483 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303484 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003485 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303486 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003487 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303488 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003489 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303490 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003491 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303492};
3493
3494#define MXT_TS_GPIO_IRQ 11
3495#define MXT_TS_LDO_EN_GPIO 50
3496#define MXT_TS_RESET_GPIO 52
3497
3498static void mxt_init_hw_liquid(void)
3499{
3500 int rc;
3501
3502 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3503 if (rc) {
3504 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3505 __func__, MXT_TS_GPIO_IRQ);
3506 return;
3507 }
3508
3509 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3510 if (rc) {
3511 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3512 __func__, MXT_TS_GPIO_IRQ);
3513 goto err_irq_gpio_req;
3514 }
3515
3516 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3517 if (rc) {
3518 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3519 __func__, MXT_TS_LDO_EN_GPIO);
3520 goto err_irq_gpio_req;
3521 }
3522
3523 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3524 if (rc) {
3525 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3526 __func__, MXT_TS_LDO_EN_GPIO);
3527 goto err_ldo_gpio_req;
3528 }
3529
3530 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3531 if (rc) {
3532 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3533 __func__, MXT_TS_RESET_GPIO);
3534 goto err_ldo_gpio_set_dir;
3535 }
3536
3537 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3538 if (rc) {
3539 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3540 __func__, MXT_TS_RESET_GPIO);
3541 goto err_reset_gpio_req;
3542 }
3543
3544 return;
3545
3546err_reset_gpio_req:
3547 gpio_free(MXT_TS_RESET_GPIO);
3548err_ldo_gpio_set_dir:
3549 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3550err_ldo_gpio_req:
3551 gpio_free(MXT_TS_LDO_EN_GPIO);
3552err_irq_gpio_req:
3553 gpio_free(MXT_TS_GPIO_IRQ);
3554}
3555
3556static struct mxt_platform_data mxt_platform_data = {
3557 .config = mxt_config_data,
3558 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003559 .x_size = 1365,
3560 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303561 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003562 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303563};
3564
3565static struct i2c_board_info mxt_device_info[] __initdata = {
3566 {
3567 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3568 .platform_data = &mxt_platform_data,
3569 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3570 },
3571};
3572
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003573static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3574{
3575}
3576
3577static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_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_gsbi3_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_gsbi10_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_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3596 .clk_freq = 100000,
3597 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003598 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3599};
3600
3601static struct msm_rpm_platform_data msm_rpm_data = {
3602 .reg_base_addrs = {
3603 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3604 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3605 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3606 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3607 },
3608
3609 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3610 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3611 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3612 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3613 .msm_apps_ipc_rpm_val = 4,
3614};
3615
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003616static struct ks8851_pdata spi_eth_pdata = {
3617 .irq_gpio = KS8851_IRQ_GPIO,
3618 .rst_gpio = KS8851_RST_GPIO,
3619};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003620
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003621static struct spi_board_info spi_board_info[] __initdata = {
3622 {
3623 .modalias = "ks8851",
3624 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3625 .max_speed_hz = 19200000,
3626 .bus_num = 0,
3627 .chip_select = 0,
3628 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003629 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003630 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003631 {
3632 .modalias = "dsi_novatek_3d_panel_spi",
3633 .max_speed_hz = 10800000,
3634 .bus_num = 0,
3635 .chip_select = 1,
3636 .mode = SPI_MODE_0,
3637 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003638};
3639
3640static struct platform_device msm_device_saw_core0 = {
3641 .name = "saw-regulator",
3642 .id = 0,
3643 .dev = {
3644 .platform_data = &msm_saw_regulator_pdata_s5,
3645 },
3646};
3647
3648static struct platform_device msm_device_saw_core1 = {
3649 .name = "saw-regulator",
3650 .id = 1,
3651 .dev = {
3652 .platform_data = &msm_saw_regulator_pdata_s6,
3653 },
3654};
3655
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003656#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3657static struct platform_device wfd_device = {
3658 .name = "msm_wfd",
3659 .id = -1,
3660};
3661#endif
3662
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003663static struct tsens_platform_data msm_tsens_pdata = {
3664 .slope = 910,
3665 .tsens_factor = 1000,
3666 .hw_type = MSM_8960,
3667 .tsens_num_sensor = 5,
3668};
3669
3670static struct platform_device msm_tsens_device = {
3671 .name = "tsens8960-tm",
3672 .id = -1,
3673 .dev = {
3674 .platform_data = &msm_tsens_pdata,
3675 },
3676};
3677
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003678#ifdef CONFIG_MSM_FAKE_BATTERY
3679static struct platform_device fish_battery_device = {
3680 .name = "fish_battery",
3681};
3682#endif
3683
David Collins26f05562011-06-20 09:56:28 -07003684static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003685 .name = GPIO_REGULATOR_DEV_NAME,
3686 .id = PM8921_MPP_PM_TO_SYS(7),
3687 .dev = {
3688 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3689 },
3690};
3691
David Collins26f05562011-06-20 09:56:28 -07003692static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003693 .name = GPIO_REGULATOR_DEV_NAME,
3694 .id = 91,
3695 .dev = {
3696 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3697 },
3698};
3699
David Collinsb10be1d2011-09-02 10:29:31 -07003700static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3701 .name = GPIO_REGULATOR_DEV_NAME,
3702 .id = PM8921_GPIO_PM_TO_SYS(17),
3703 .dev = {
3704 .platform_data =
3705 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3706 },
3707};
3708
David Collins26f05562011-06-20 09:56:28 -07003709static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3710 .name = "rpm-regulator",
3711 .id = -1,
3712 .dev = {
3713 .platform_data = &msm_rpm_regulator_pdata,
3714 },
3715};
3716
David Collins4c31a872011-08-31 10:07:10 -07003717static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3718 .phys_addr_base = 0x0010C000,
3719 .reg_offsets = {
3720 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3721 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3722 },
3723 .phys_size = SZ_8K,
3724 .log_len = 4096, /* log's buffer length in bytes */
3725 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3726};
3727
3728static struct platform_device msm_rpm_log_device = {
3729 .name = "msm_rpm_log",
3730 .id = -1,
3731 .dev = {
3732 .platform_data = &msm_rpm_log_pdata,
3733 },
3734};
3735
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003736static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003737 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003738 &msm_device_smd,
3739 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303740 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003741 &msm_device_saw_core0,
3742 &msm_device_saw_core1,
3743 &msm8960_device_ext_5v_vreg,
3744 &msm8960_device_ext_l2_vreg,
3745 &msm8960_device_ssbi_pm8921,
3746 &msm8960_device_qup_spi_gsbi1,
3747 &msm8960_device_qup_i2c_gsbi3,
3748 &msm8960_device_qup_i2c_gsbi4,
3749 &msm8960_device_qup_i2c_gsbi10,
3750#ifndef CONFIG_MSM_DSPS
3751 &msm8960_device_qup_i2c_gsbi12,
3752#endif
3753 &msm_slim_ctrl,
3754 &msm_device_wcnss_wlan,
3755#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3756 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3757 &qcrypto_device,
3758#endif
3759
3760#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3761 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3762 &qcedev_device,
3763#endif
3764#ifdef CONFIG_MSM_ROTATOR
3765 &msm_rotator_device,
3766#endif
3767 &msm_device_sps,
3768#ifdef CONFIG_MSM_FAKE_BATTERY
3769 &fish_battery_device,
3770#endif
3771#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003772#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003773 &android_pmem_device,
3774 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003775#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003776 &android_pmem_audio_device,
3777#endif
3778 &msm_fb_device,
3779 &msm_device_vidc,
3780 &msm_device_bam_dmux,
3781 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003782
3783#ifdef CONFIG_HW_RANDOM_MSM
3784 &msm_device_rng,
3785#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003786 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003787#ifdef CONFIG_ION_MSM
3788 &ion_dev,
3789#endif
David Collins4c31a872011-08-31 10:07:10 -07003790 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003791 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003792#ifdef CONFIG_MSM_QDSS
3793 &msm_etb_device,
3794 &msm_tpiu_device,
3795 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07003796 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003797 &msm_ptm_device,
3798#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003799 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003800 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003801#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3802 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003803 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003804#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003805};
3806
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003807static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003808 &msm8960_device_otg,
3809 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003810 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303811 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003812 &android_usb_device,
3813 &msm_device_vidc,
3814 &mipi_dsi_simulator_panel_device,
3815 &msm_bus_apps_fabric,
3816 &msm_bus_sys_fabric,
3817 &msm_bus_mm_fabric,
3818 &msm_bus_sys_fpb,
3819 &msm_bus_cpss_fpb,
3820 &msm_pcm,
3821 &msm_pcm_routing,
3822 &msm_cpudai0,
3823 &msm_cpudai1,
3824 &msm_cpudai_hdmi_rx,
3825 &msm_cpudai_bt_rx,
3826 &msm_cpudai_bt_tx,
3827 &msm_cpudai_fm_rx,
3828 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003829 &msm_cpudai_auxpcm_rx,
3830 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003831 &msm_cpu_fe,
3832 &msm_stub_codec,
3833 &msm_voice,
3834 &msm_voip,
3835 &msm_lpa_pcm,
3836
3837#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3838 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3839 &qcrypto_device,
3840#endif
3841
3842#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3843 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3844 &qcedev_device,
3845#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003846};
3847
3848static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003849 &msm_kgsl_3d0,
3850 &msm_kgsl_2d0,
3851 &msm_kgsl_2d1,
3852 &mipi_dsi_renesas_panel_device,
3853#ifdef CONFIG_MSM_GEMINI
3854 &msm8960_gemini_device,
3855#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003856};
3857
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003858static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003859 &msm8960_device_otg,
3860 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003861 &msm_device_hsusb_host,
3862 &android_usb_device,
3863 &msm_pcm,
3864 &msm_pcm_routing,
3865 &msm_cpudai0,
3866 &msm_cpudai1,
3867 &msm_cpudai_hdmi_rx,
3868 &msm_cpudai_bt_rx,
3869 &msm_cpudai_bt_tx,
3870 &msm_cpudai_fm_rx,
3871 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003872 &msm_cpudai_auxpcm_rx,
3873 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003874 &msm_cpu_fe,
3875 &msm_stub_codec,
3876 &msm_kgsl_3d0,
3877#ifdef CONFIG_MSM_KGSL_2D
3878 &msm_kgsl_2d0,
3879 &msm_kgsl_2d1,
3880#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07003881 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003882#ifdef CONFIG_MSM_GEMINI
3883 &msm8960_gemini_device,
3884#endif
3885 &msm_voice,
3886 &msm_voip,
3887 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05303888 &msm_cpudai_afe_01_rx,
3889 &msm_cpudai_afe_01_tx,
3890 &msm_cpudai_afe_02_rx,
3891 &msm_cpudai_afe_02_tx,
3892 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003893#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
3894 &hdmi_msm_device,
3895#endif
3896 &msm_pcm_hostless,
3897 &msm_bus_apps_fabric,
3898 &msm_bus_sys_fabric,
3899 &msm_bus_mm_fabric,
3900 &msm_bus_sys_fpb,
3901 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003902 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003903};
3904
3905static void __init msm8960_i2c_init(void)
3906{
3907 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
3908 &msm8960_i2c_qup_gsbi4_pdata;
3909
3910 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
3911 &msm8960_i2c_qup_gsbi3_pdata;
3912
3913 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
3914 &msm8960_i2c_qup_gsbi10_pdata;
3915
3916 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
3917 &msm8960_i2c_qup_gsbi12_pdata;
3918}
3919
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003920static void __init msm8960_gfx_init(void)
3921{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06003922 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06003923 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
3924 struct kgsl_device_platform_data *kgsl_3d0_pdata =
3925 msm_kgsl_3d0.dev.platform_data;
3926 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
3927 320000000;
3928 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
3929 266667000;
3930 }
3931}
3932
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003933static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
3934 .irq_base = PM8921_IRQ_BASE,
3935 .devirq = MSM_GPIO_TO_INT(104),
3936 .irq_trigger_flag = IRQF_TRIGGER_LOW,
3937};
3938
3939static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
3940 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
3941};
3942
3943static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
3944 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
3945};
3946
3947static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
3948 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05303949 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003950};
3951
3952static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
3953 .pull_up = 1,
3954 .kpd_trigger_delay_us = 970,
3955 .wakeup = 1,
3956};
3957
Mohan Pallaka002e9e02011-08-05 11:23:22 +05303958/* Rotate lock key is not available so use F1 */
3959#define KEY_ROTATE_LOCK KEY_F1
3960
3961static const unsigned int keymap_liquid[] = {
3962 KEY(0, 0, KEY_VOLUMEUP),
3963 KEY(0, 1, KEY_VOLUMEDOWN),
3964 KEY(1, 3, KEY_ROTATE_LOCK),
3965 KEY(1, 4, KEY_HOME),
3966};
3967
3968static struct matrix_keymap_data keymap_data_liquid = {
3969 .keymap_size = ARRAY_SIZE(keymap_liquid),
3970 .keymap = keymap_liquid,
3971};
3972
3973static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
3974 .input_name = "keypad_8960_liquid",
3975 .input_phys_device = "keypad_8960/input0",
3976 .num_rows = 2,
3977 .num_cols = 5,
3978 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3979 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3980 .debounce_ms = 15,
3981 .scan_delay_ms = 32,
3982 .row_hold_ns = 91500,
3983 .wakeup = 1,
3984 .keymap_data = &keymap_data_liquid,
3985};
3986
3987
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003988static const unsigned int keymap[] = {
3989 KEY(0, 0, KEY_VOLUMEUP),
3990 KEY(0, 1, KEY_VOLUMEDOWN),
3991 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3992 KEY(0, 3, KEY_CAMERA_FOCUS),
3993};
3994
3995static struct matrix_keymap_data keymap_data = {
3996 .keymap_size = ARRAY_SIZE(keymap),
3997 .keymap = keymap,
3998};
3999
4000static struct pm8xxx_keypad_platform_data keypad_data = {
4001 .input_name = "keypad_8960",
4002 .input_phys_device = "keypad_8960/input0",
4003 .num_rows = 1,
4004 .num_cols = 5,
4005 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4006 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4007 .debounce_ms = 15,
4008 .scan_delay_ms = 32,
4009 .row_hold_ns = 91500,
4010 .wakeup = 1,
4011 .keymap_data = &keymap_data,
4012};
4013
4014static const unsigned int keymap_sim[] = {
4015 KEY(0, 0, KEY_7),
4016 KEY(0, 1, KEY_DOWN),
4017 KEY(0, 2, KEY_UP),
4018 KEY(0, 3, KEY_RIGHT),
4019 KEY(0, 4, KEY_ENTER),
4020 KEY(0, 5, KEY_L),
4021 KEY(0, 6, KEY_BACK),
4022 KEY(0, 7, KEY_M),
4023
4024 KEY(1, 0, KEY_LEFT),
4025 KEY(1, 1, KEY_SEND),
4026 KEY(1, 2, KEY_1),
4027 KEY(1, 3, KEY_4),
4028 KEY(1, 4, KEY_CLEAR),
4029 KEY(1, 5, KEY_MSDOS),
4030 KEY(1, 6, KEY_SPACE),
4031 KEY(1, 7, KEY_COMMA),
4032
4033 KEY(2, 0, KEY_6),
4034 KEY(2, 1, KEY_5),
4035 KEY(2, 2, KEY_8),
4036 KEY(2, 3, KEY_3),
4037 KEY(2, 4, KEY_NUMERIC_STAR),
4038 KEY(2, 5, KEY_UP),
4039 KEY(2, 6, KEY_DOWN),
4040 KEY(2, 7, KEY_LEFTSHIFT),
4041
4042 KEY(3, 0, KEY_9),
4043 KEY(3, 1, KEY_NUMERIC_POUND),
4044 KEY(3, 2, KEY_0),
4045 KEY(3, 3, KEY_2),
4046 KEY(3, 4, KEY_SLEEP),
4047 KEY(3, 5, KEY_F1),
4048 KEY(3, 6, KEY_F2),
4049 KEY(3, 7, KEY_F3),
4050
4051 KEY(4, 0, KEY_BACK),
4052 KEY(4, 1, KEY_HOME),
4053 KEY(4, 2, KEY_MENU),
4054 KEY(4, 3, KEY_VOLUMEUP),
4055 KEY(4, 4, KEY_VOLUMEDOWN),
4056 KEY(4, 5, KEY_F4),
4057 KEY(4, 6, KEY_F5),
4058 KEY(4, 7, KEY_F6),
4059
4060 KEY(5, 0, KEY_R),
4061 KEY(5, 1, KEY_T),
4062 KEY(5, 2, KEY_Y),
4063 KEY(5, 3, KEY_LEFTALT),
4064 KEY(5, 4, KEY_KPENTER),
4065 KEY(5, 5, KEY_Q),
4066 KEY(5, 6, KEY_W),
4067 KEY(5, 7, KEY_E),
4068
4069 KEY(6, 0, KEY_F),
4070 KEY(6, 1, KEY_G),
4071 KEY(6, 2, KEY_H),
4072 KEY(6, 3, KEY_CAPSLOCK),
4073 KEY(6, 4, KEY_PAGEUP),
4074 KEY(6, 5, KEY_A),
4075 KEY(6, 6, KEY_S),
4076 KEY(6, 7, KEY_D),
4077
4078 KEY(7, 0, KEY_V),
4079 KEY(7, 1, KEY_B),
4080 KEY(7, 2, KEY_N),
4081 KEY(7, 3, KEY_MENU),
4082 KEY(7, 4, KEY_PAGEDOWN),
4083 KEY(7, 5, KEY_Z),
4084 KEY(7, 6, KEY_X),
4085 KEY(7, 7, KEY_C),
4086
4087 KEY(8, 0, KEY_P),
4088 KEY(8, 1, KEY_J),
4089 KEY(8, 2, KEY_K),
4090 KEY(8, 3, KEY_INSERT),
4091 KEY(8, 4, KEY_LINEFEED),
4092 KEY(8, 5, KEY_U),
4093 KEY(8, 6, KEY_I),
4094 KEY(8, 7, KEY_O),
4095
4096 KEY(9, 0, KEY_4),
4097 KEY(9, 1, KEY_5),
4098 KEY(9, 2, KEY_6),
4099 KEY(9, 3, KEY_7),
4100 KEY(9, 4, KEY_8),
4101 KEY(9, 5, KEY_1),
4102 KEY(9, 6, KEY_2),
4103 KEY(9, 7, KEY_3),
4104
4105 KEY(10, 0, KEY_F7),
4106 KEY(10, 1, KEY_F8),
4107 KEY(10, 2, KEY_F9),
4108 KEY(10, 3, KEY_F10),
4109 KEY(10, 4, KEY_FN),
4110 KEY(10, 5, KEY_9),
4111 KEY(10, 6, KEY_0),
4112 KEY(10, 7, KEY_DOT),
4113
4114 KEY(11, 0, KEY_LEFTCTRL),
4115 KEY(11, 1, KEY_F11),
4116 KEY(11, 2, KEY_ENTER),
4117 KEY(11, 3, KEY_SEARCH),
4118 KEY(11, 4, KEY_DELETE),
4119 KEY(11, 5, KEY_RIGHT),
4120 KEY(11, 6, KEY_LEFT),
4121 KEY(11, 7, KEY_RIGHTSHIFT),
4122 KEY(0, 0, KEY_VOLUMEUP),
4123 KEY(0, 1, KEY_VOLUMEDOWN),
4124 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4125 KEY(0, 3, KEY_CAMERA_FOCUS),
4126};
4127
4128static struct matrix_keymap_data keymap_data_sim = {
4129 .keymap_size = ARRAY_SIZE(keymap_sim),
4130 .keymap = keymap_sim,
4131};
4132
4133static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4134 .input_name = "keypad_8960",
4135 .input_phys_device = "keypad_8960/input0",
4136 .num_rows = 12,
4137 .num_cols = 8,
4138 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4139 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4140 .debounce_ms = 15,
4141 .scan_delay_ms = 32,
4142 .row_hold_ns = 91500,
4143 .wakeup = 1,
4144 .keymap_data = &keymap_data_sim,
4145};
4146
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004147static int pm8921_therm_mitigation[] = {
4148 1100,
4149 700,
4150 600,
4151 325,
4152};
4153
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004154static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004155 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004156 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004157 .max_voltage = 4200,
4158 .min_voltage = 3200,
4159 .resume_voltage = 4100,
4160 .term_current = 100,
4161 .cool_temp = 10,
4162 .warm_temp = 40,
4163 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004164 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004165 .cool_bat_chg_current = 350,
4166 .warm_bat_chg_current = 350,
4167 .cool_bat_voltage = 4100,
4168 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004169 .thermal_mitigation = pm8921_therm_mitigation,
4170 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004171};
4172
4173static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4174 .priority = 0,
4175};
4176
4177static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4178 .r_sense = 10,
4179 .i_test = 2500,
4180 .v_failure = 3000,
4181 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004182};
4183
Jay Chokshide4cefb2011-08-04 18:10:44 -07004184#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004185#define PM8XXX_LED_PWM_PERIOD 1000
4186#define PM8XXX_LED_PWM_DUTY_MS 20
4187/**
4188 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4189 * driven using PWM feature.
4190 */
4191#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004192
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004193static struct led_info pm8921_led_info[] = {
4194 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004195 .name = "led:battery_charging",
4196 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004197 },
4198 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004199 .name = "led:battery_full",
4200 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004201 },
4202};
4203
Jay Chokshi8994e392011-09-14 18:20:39 -07004204static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004205 .num_leds = ARRAY_SIZE(pm8921_led_info),
4206 .leds = pm8921_led_info,
4207};
4208
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004209static int pm8921_led0_pwm_duty_pcts[56] = {
4210 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4211 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4212 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4213 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4214 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4215 14, 10, 6, 4, 1
4216};
4217
4218static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4219 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4220 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4221 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4222 .start_idx = 0,
4223};
4224
Jay Chokshi8994e392011-09-14 18:20:39 -07004225static struct pm8xxx_led_config pm8921_led_configs[] = {
4226 [0] = {
4227 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004228 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004229 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004230 .pwm_channel = 5,
4231 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4232 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004233 },
4234 [1] = {
4235 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004236 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004237 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004238 .pwm_channel = 4,
4239 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004240 },
4241};
4242
4243static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4244 .led_core = &pm8921_led_core_pdata,
4245 .configs = pm8921_led_configs,
4246 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4247};
4248
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004249static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4250 .irq_pdata = &pm8xxx_irq_pdata,
4251 .gpio_pdata = &pm8xxx_gpio_pdata,
4252 .mpp_pdata = &pm8xxx_mpp_pdata,
4253 .rtc_pdata = &pm8xxx_rtc_pdata,
4254 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4255 .keypad_pdata = &keypad_data,
4256 .misc_pdata = &pm8xxx_misc_pdata,
4257 .regulator_pdatas = msm_pm8921_regulator_pdata,
4258 .charger_pdata = &pm8921_chg_pdata,
4259 .bms_pdata = &pm8921_bms_pdata,
4260 .adc_pdata = &pm8921_adc_pdata,
4261 .leds_pdata = &pm8xxx_leds_pdata,
4262};
4263
4264static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4265 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4266 .slave = {
4267 .name = "pm8921-core",
4268 .platform_data = &pm8921_platform_data,
4269 },
4270};
4271
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004272static struct msm_cpuidle_state msm_cstates[] __initdata = {
4273 {0, 0, "C0", "WFI",
4274 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4275
4276 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4277 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4278
4279 {0, 2, "C2", "POWER_COLLAPSE",
4280 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4281
4282 {1, 0, "C0", "WFI",
4283 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4284
4285 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4286 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4287};
4288
4289static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4290 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
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_POWER_COLLAPSE_STANDALONE)] = {
4298 .idle_supported = 1,
4299 .suspend_supported = 1,
4300 .idle_enabled = 0,
4301 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004302 },
4303
4304 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4305 .idle_supported = 1,
4306 .suspend_supported = 1,
4307 .idle_enabled = 1,
4308 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004309 },
4310
4311 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4312 .idle_supported = 0,
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_POWER_COLLAPSE_STANDALONE)] = {
4319 .idle_supported = 1,
4320 .suspend_supported = 1,
4321 .idle_enabled = 0,
4322 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004323 },
4324
4325 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4326 .idle_supported = 1,
4327 .suspend_supported = 0,
4328 .idle_enabled = 1,
4329 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004330 },
4331};
4332
4333static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4334 {
4335 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4336 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4337 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004338 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004339 },
4340
4341 {
4342 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4343 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4344 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004345 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004346 },
4347
4348 {
4349 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4350 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4351 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004352 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004353 },
4354
4355 {
4356 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4357 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4358 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004359 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004360 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004361 {
4362 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4363 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4364 false,
4365 7000, 3500, 66600000, 5150,
4366 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004367
4368 {
4369 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4370 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4371 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004372 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004373 },
4374
4375 {
4376 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4377 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4378 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004379 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004380 },
4381
4382 {
4383 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4384 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4385 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004386 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004387 },
4388
4389 {
4390 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4391 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4392 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004393 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004394 },
4395};
4396
4397#ifdef CONFIG_I2C
4398#define I2C_SURF 1
4399#define I2C_FFA (1 << 1)
4400#define I2C_RUMI (1 << 2)
4401#define I2C_SIM (1 << 3)
4402#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004403#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004404
4405struct i2c_registry {
4406 u8 machs;
4407 int bus;
4408 struct i2c_board_info *info;
4409 int len;
4410};
4411
4412#ifdef CONFIG_MSM_CAMERA
4413static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4414#ifdef CONFIG_IMX074
4415 {
4416 I2C_BOARD_INFO("imx074", 0x1A),
4417 },
4418#endif
4419#ifdef CONFIG_OV2720
4420 {
4421 I2C_BOARD_INFO("ov2720", 0x6C),
4422 },
4423#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004424 {
4425 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4426 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304427#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4428 {
4429 I2C_BOARD_INFO("sc628a", 0x6E),
4430 },
4431#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004432};
4433#endif
4434
4435/* Sensors DSPS platform data */
4436#ifdef CONFIG_MSM_DSPS
4437#define DSPS_PIL_GENERIC_NAME "dsps"
4438#endif /* CONFIG_MSM_DSPS */
4439
4440static void __init msm8960_init_dsps(void)
4441{
4442#ifdef CONFIG_MSM_DSPS
4443 struct msm_dsps_platform_data *pdata =
4444 msm_dsps_device.dev.platform_data;
4445 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4446 pdata->gpios = NULL;
4447 pdata->gpios_num = 0;
4448
4449 platform_device_register(&msm_dsps_device);
4450#endif /* CONFIG_MSM_DSPS */
4451}
4452
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004453static void __init msm8960_init_hsic(void)
4454{
4455#ifdef CONFIG_USB_EHCI_MSM_HSIC
4456 uint32_t version = socinfo_get_version();
4457
4458 pr_info("%s: version:%d mtp:%d\n", __func__,
4459 SOCINFO_VERSION_MAJOR(version),
4460 machine_is_msm8960_mtp());
4461
4462 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4463 machine_is_msm8960_mtp() ||
4464 machine_is_msm8960_fluid())
4465 return;
4466
4467 msm_gpiomux_install(msm8960_hsic_configs,
4468 ARRAY_SIZE(msm8960_hsic_configs));
4469
4470 platform_device_register(&msm_device_hsic_host);
4471#endif
4472}
4473
4474
Amir Samuelov5137e392011-09-21 17:31:25 +03004475#ifdef CONFIG_ISL9519_CHARGER
4476static struct isl_platform_data isl_data __initdata = {
4477 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4478 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4479 .max_system_voltage = 4200,
4480 .min_system_voltage = 3200,
4481 .chgcurrent = 1000, /* 1900, */
4482 .term_current = 400, /* Need fine tuning */
4483 .input_current = 2048,
4484};
4485
4486static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4487 {
4488 I2C_BOARD_INFO("isl9519q", 0x9),
4489 .irq = 0, /* Not required when notify-by-pmic */
4490 .platform_data = &isl_data,
4491 },
4492};
4493#endif /* CONFIG_ISL9519_CHARGER */
4494
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004495static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4496#ifdef CONFIG_MSM_CAMERA
4497 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004498 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004499 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4500 msm_camera_boardinfo,
4501 ARRAY_SIZE(msm_camera_boardinfo),
4502 },
4503#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004504#ifdef CONFIG_ISL9519_CHARGER
4505 {
4506 I2C_LIQUID,
4507 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4508 isl_charger_i2c_info,
4509 ARRAY_SIZE(isl_charger_i2c_info),
4510 },
4511#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004512 {
4513 I2C_SURF | I2C_FFA | I2C_FLUID,
4514 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4515 cyttsp_info,
4516 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004517 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304518 {
4519 I2C_LIQUID,
4520 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4521 mxt_device_info,
4522 ARRAY_SIZE(mxt_device_info),
4523 },
4524
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004525};
4526#endif /* CONFIG_I2C */
4527
4528static void __init register_i2c_devices(void)
4529{
4530#ifdef CONFIG_I2C
4531 u8 mach_mask = 0;
4532 int i;
4533
4534 /* Build the matching 'supported_machs' bitmask */
4535 if (machine_is_msm8960_cdp())
4536 mach_mask = I2C_SURF;
4537 else if (machine_is_msm8960_rumi3())
4538 mach_mask = I2C_RUMI;
4539 else if (machine_is_msm8960_sim())
4540 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004541 else if (machine_is_msm8960_fluid())
4542 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004543 else if (machine_is_msm8960_liquid())
4544 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004545 else if (machine_is_msm8960_mtp())
4546 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004547 else
4548 pr_err("unmatched machine ID in register_i2c_devices\n");
4549
4550 /* Run the array and install devices as appropriate */
4551 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4552 if (msm8960_i2c_devices[i].machs & mach_mask)
4553 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4554 msm8960_i2c_devices[i].info,
4555 msm8960_i2c_devices[i].len);
4556 }
4557#endif
4558}
4559
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004560static void __init msm8960_sim_init(void)
4561{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004562 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4563 &msm8960_device_watchdog.dev.platform_data;
4564
4565 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004566 BUG_ON(msm_rpm_init(&msm_rpm_data));
4567 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4568 ARRAY_SIZE(msm_rpmrs_levels)));
4569 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004570 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004571 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004572 msm8960_device_ssbi_pm8921.dev.platform_data =
4573 &msm8960_ssbi_pm8921_pdata;
4574 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004575
4576 /* Simulator supports a QWERTY keypad */
4577 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4578
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004579 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4580 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4581 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004582 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004583 msm8960_i2c_init();
4584 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4585 msm_spm_l2_init(msm_spm_l2_data);
4586 msm8960_init_buses();
4587 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4588 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004589 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004590 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004591
4592 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4593 &msm8960_qup_spi_gsbi1_pdata;
4594 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4595
4596 msm8960_init_mmc();
4597 msm_fb_add_devices();
4598 slim_register_board_info(msm_slim_devices,
4599 ARRAY_SIZE(msm_slim_devices));
4600 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4601 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4602 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4603 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004604 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004605}
4606
4607static void __init msm8960_rumi3_init(void)
4608{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004609 BUG_ON(msm_rpm_init(&msm_rpm_data));
4610 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4611 ARRAY_SIZE(msm_rpmrs_levels)));
4612 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004613 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004614 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004615 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004616 msm8960_device_ssbi_pm8921.dev.platform_data =
4617 &msm8960_ssbi_pm8921_pdata;
4618 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4619 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4620 &msm8960_qup_spi_gsbi1_pdata;
4621 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4622 msm8960_i2c_init();
4623 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4624 msm_spm_l2_init(msm_spm_l2_data);
4625 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4626 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004627 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004628 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004629 register_i2c_devices();
4630 msm_fb_add_devices();
4631 slim_register_board_info(msm_slim_devices,
4632 ARRAY_SIZE(msm_slim_devices));
4633 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4634 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4635 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4636 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004637 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004638}
4639
4640static void __init msm8960_cdp_init(void)
4641{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004642 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4643 pr_err("meminfo_init() failed!\n");
4644
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004645 BUG_ON(msm_rpm_init(&msm_rpm_data));
4646 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4647 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004648
4649 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004650 regulator_suppress_info_printing();
4651 if (msm_xo_init())
4652 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004653 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004654 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304655 if (machine_is_msm8960_liquid())
4656 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004657 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4658 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4659 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304660#ifdef CONFIG_USB_EHCI_MSM_HSIC
4661 if (machine_is_msm8960_liquid()) {
4662 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4663 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4664 }
4665#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304666 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004667 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304668 if (machine_is_msm8960_liquid())
4669 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004670 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4671 &msm8960_qup_spi_gsbi1_pdata;
4672 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4673 msm8960_device_ssbi_pm8921.dev.platform_data =
4674 &msm8960_ssbi_pm8921_pdata;
4675 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4676 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004677 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004678 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4679 msm_spm_l2_init(msm_spm_l2_data);
4680 msm8960_init_buses();
4681 platform_add_devices(msm_footswitch_devices,
4682 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004683 if (machine_is_msm8960_liquid())
4684 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004685 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4686 pm8921_gpio_mpp_init();
4687 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004688 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004689 msm8960_init_cam();
4690 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004691 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304692 if (machine_is_msm8960_liquid())
4693 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004694 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004695 msm_fb_add_devices();
4696 slim_register_board_info(msm_slim_devices,
4697 ARRAY_SIZE(msm_slim_devices));
4698 msm8960_init_dsps();
4699 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4700 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4701 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4702 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004703 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004704 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004705}
4706
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004707MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4708 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004709 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004710 .init_irq = msm8960_init_irq,
4711 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004712 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004713 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004714 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004715MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004716
4717MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4718 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004719 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004720 .init_irq = msm8960_init_irq,
4721 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004722 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004723 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004724 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004725MACHINE_END
4726
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004727MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4728 .map_io = msm8960_map_io,
4729 .reserve = msm8960_reserve,
4730 .init_irq = msm8960_init_irq,
4731 .timer = &msm_timer,
4732 .init_machine = msm8960_cdp_init,
4733 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004734 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004735MACHINE_END
4736
4737MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4738 .map_io = msm8960_map_io,
4739 .reserve = msm8960_reserve,
4740 .init_irq = msm8960_init_irq,
4741 .timer = &msm_timer,
4742 .init_machine = msm8960_cdp_init,
4743 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004744 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004745MACHINE_END
4746
4747MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4748 .map_io = msm8960_map_io,
4749 .reserve = msm8960_reserve,
4750 .init_irq = msm8960_init_irq,
4751 .timer = &msm_timer,
4752 .init_machine = msm8960_cdp_init,
4753 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004754 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004755MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004756
4757MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4758 .map_io = msm8960_map_io,
4759 .reserve = msm8960_reserve,
4760 .init_irq = msm8960_init_irq,
4761 .timer = &msm_timer,
4762 .init_machine = msm8960_cdp_init,
4763 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004764 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004765MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004766
4767#ifdef CONFIG_ARCH_MSM8930
4768MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4769 .map_io = msm8930_map_io,
4770 .reserve = msm8960_reserve,
4771 .init_irq = msm8960_init_irq,
4772 .timer = &msm_timer,
4773 .init_machine = msm8960_cdp_init,
4774 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004775 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004776MACHINE_END
4777
4778MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4779 .map_io = msm8930_map_io,
4780 .reserve = msm8960_reserve,
4781 .init_irq = msm8960_init_irq,
4782 .timer = &msm_timer,
4783 .init_machine = msm8960_cdp_init,
4784 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004785 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004786MACHINE_END
4787
4788MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4789 .map_io = msm8930_map_io,
4790 .reserve = msm8960_reserve,
4791 .init_irq = msm8960_init_irq,
4792 .timer = &msm_timer,
4793 .init_machine = msm8960_cdp_init,
4794 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004795 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004796MACHINE_END
4797#endif