blob: ece65f34fe08b2a2b6a0abed9817a25bb636411b [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>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080043
44#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070046#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080047#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080049
50#include <mach/board.h>
51#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include <mach/msm_spi.h>
53#ifdef CONFIG_USB_MSM_OTG_72K
54#include <mach/msm_hsusb.h>
55#else
56#include <linux/usb/msm_hsusb.h>
57#endif
58#include <linux/usb/android.h>
59#include <mach/usbdiag.h>
60#include <mach/socinfo.h>
61#include <mach/rpm.h>
62#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070063#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064#include <mach/msm_bus_board.h>
65#include <mach/msm_memtypes.h>
66#include <mach/dma.h>
67#include <mach/msm_dsps.h>
68#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070069#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080070
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#ifdef CONFIG_WCD9310_CODEC
72#include <linux/slimbus/slimbus.h>
73#include <linux/mfd/wcd9310/core.h>
74#include <linux/mfd/wcd9310/pdata.h>
75#endif
76
Laura Abbottd6183792011-08-19 13:42:24 -070077#include <linux/ion.h>
78#include <mach/ion.h>
79
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080081#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083#include "spm.h"
84#include "board-msm8960.h"
85#include "pm.h"
86#include "cpuidle.h"
87#include "rpm_resources.h"
88#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070089#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070090#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070091#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060092#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070093#include "msm_watchdog.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094
95static struct platform_device msm_fm_platform_init = {
96 .name = "iris_fm",
97 .id = -1,
98};
99
100struct pm8xxx_gpio_init {
101 unsigned gpio;
102 struct pm_gpio config;
103};
104
105struct pm8xxx_mpp_init {
106 unsigned mpp;
107 struct pm8xxx_mpp_config_data config;
108};
109
110#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
111 _func, _inv, _disable) \
112{ \
113 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
114 .config = { \
115 .direction = _dir, \
116 .output_buffer = _buf, \
117 .output_value = _val, \
118 .pull = _pull, \
119 .vin_sel = _vin, \
120 .out_strength = _out_strength, \
121 .function = _func, \
122 .inv_int_pol = _inv, \
123 .disable_pin = _disable, \
124 } \
125}
126
127#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
128{ \
129 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
130 .config = { \
131 .type = PM8XXX_MPP_TYPE_##_type, \
132 .level = _level, \
133 .control = PM8XXX_MPP_##_control, \
134 } \
135}
136
137#define PM8XXX_GPIO_DISABLE(_gpio) \
138 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
139 0, 0, 0, 1)
140
141#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
142 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
143 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
144 PM_GPIO_STRENGTH_HIGH, \
145 PM_GPIO_FUNC_NORMAL, 0, 0)
146
147#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
148 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
149 _pull, PM_GPIO_VIN_S4, \
150 PM_GPIO_STRENGTH_NO, \
151 PM_GPIO_FUNC_NORMAL, 0, 0)
152
153#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
154 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
155 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
156 PM_GPIO_STRENGTH_HIGH, \
157 _func, 0, 0)
158
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200159#define PM8XXX_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
160 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
161 PM_GPIO_PULL_NO, _vin, \
162 PM_GPIO_STRENGTH_HIGH, \
163 PM_GPIO_FUNC_NORMAL, 0, 0)
164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165/* Initial PM8921 GPIO configurations */
166static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
167 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
168 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
169 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
Amir Samuelov0c7270f2011-09-07 03:13:47 +0300170 /* External regulator shared by display and touchscreen on LiQUID */
171 PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */
Amir Samuelovf9b0c3c2011-11-03 18:55:53 +0200172 PM8XXX_GPIO_OUTPUT_VIN(21, 1, PM_GPIO_VIN_VPH), /* Backlight Enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700174 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -0700176 PM8XXX_GPIO_OUTPUT(43, PM_GPIO_PULL_UP_30), /* DISP_RESET_N */
Anji jonnala2936fd92011-11-09 15:39:22 +0530177 PM8XXX_GPIO_OUTPUT(42, 0), /* USB 5V reg enable */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700178};
179
180/* Initial PM8921 MPP configurations */
181static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
182 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
183 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700184 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
185 DOUT_CTRL_LOW),
186};
187
188static void __init pm8921_gpio_mpp_init(void)
189{
190 int i, rc;
191
192 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
193 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
194 &pm8921_gpios[i].config);
195 if (rc) {
196 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
197 break;
198 }
199 }
200
201 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
202 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
203 &pm8921_mpps[i].config);
204 if (rc) {
205 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
206 break;
207 }
208 }
209}
210
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700211#define KS8851_RST_GPIO 89
212#define KS8851_IRQ_GPIO 90
213
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700214#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
215enum {
Abhijeet Dharmapurikar0fda5602011-08-17 18:00:55 -0700216 GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700217 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
218 /* CAM Expander */
219 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
220 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
221 GPIO_CAM_GP_AFBUSY,
222 GPIO_CAM_GP_STROBE_CE,
223 GPIO_CAM_GP_CAM1MP_XCLR,
224 GPIO_CAM_GP_CAMIF_RESET_N,
225 GPIO_CAM_GP_XMT_FLASH_INT,
226 GPIO_CAM_GP_LED_EN1,
227 GPIO_CAM_GP_LED_EN2,
228
229};
230#endif
231
Harini Jayaraman608d0462011-08-09 19:10:03 -0600232/* The SPI configurations apply to GSBI 1*/
233static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700234 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700235 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700236 .pull = GPIOMUX_PULL_NONE,
237};
238
Harini Jayaraman608d0462011-08-09 19:10:03 -0600239static struct gpiomux_setting spi_suspended_config = {
240 .func = GPIOMUX_FUNC_GPIO,
241 .drv = GPIOMUX_DRV_2MA,
242 .pull = GPIOMUX_PULL_DOWN,
243};
244
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700245static struct gpiomux_setting spi_active_config2 = {
246 .func = GPIOMUX_FUNC_2,
247 .drv = GPIOMUX_DRV_8MA,
248 .pull = GPIOMUX_PULL_NONE,
249};
250
251static struct gpiomux_setting spi_suspended_config2 = {
252 .func = GPIOMUX_FUNC_GPIO,
253 .drv = GPIOMUX_DRV_2MA,
254 .pull = GPIOMUX_PULL_UP,
255};
256
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530257static struct gpiomux_setting gsbi3_suspended_cfg = {
258 .func = GPIOMUX_FUNC_1,
259 .drv = GPIOMUX_DRV_2MA,
260 .pull = GPIOMUX_PULL_KEEPER,
261};
262
263static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264 .func = GPIOMUX_FUNC_1,
265 .drv = GPIOMUX_DRV_8MA,
266 .pull = GPIOMUX_PULL_NONE,
267};
268
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700269static struct gpiomux_setting gsbi5 = {
270 .func = GPIOMUX_FUNC_1,
271 .drv = GPIOMUX_DRV_8MA,
272 .pull = GPIOMUX_PULL_NONE,
273};
274
275static struct gpiomux_setting gsbi10 = {
276 .func = GPIOMUX_FUNC_2,
277 .drv = GPIOMUX_DRV_8MA,
278 .pull = GPIOMUX_PULL_NONE,
279};
280
281static struct gpiomux_setting gsbi12 = {
282 .func = GPIOMUX_FUNC_1,
283 .drv = GPIOMUX_DRV_8MA,
284 .pull = GPIOMUX_PULL_NONE,
285};
286
287static struct gpiomux_setting cdc_mclk = {
288 .func = GPIOMUX_FUNC_1,
289 .drv = GPIOMUX_DRV_8MA,
290 .pull = GPIOMUX_PULL_NONE,
291};
292
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700293static struct gpiomux_setting audio_auxpcm[] = {
294 /* Suspended state */
295 {
296 .func = GPIOMUX_FUNC_GPIO,
297 .drv = GPIOMUX_DRV_2MA,
298 .pull = GPIOMUX_PULL_NONE,
299 },
300 /* Active state */
301 {
302 .func = GPIOMUX_FUNC_1,
303 .drv = GPIOMUX_DRV_2MA,
304 .pull = GPIOMUX_PULL_NONE,
305 },
306};
307
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700308#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700309static struct gpiomux_setting gpio_eth_config = {
310 .pull = GPIOMUX_PULL_NONE,
311 .drv = GPIOMUX_DRV_8MA,
312 .func = GPIOMUX_FUNC_GPIO,
313};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700314#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700315
316static struct gpiomux_setting slimbus = {
317 .func = GPIOMUX_FUNC_1,
318 .drv = GPIOMUX_DRV_8MA,
319 .pull = GPIOMUX_PULL_KEEPER,
320};
321
322struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700323#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324 {
325 .gpio = KS8851_IRQ_GPIO,
326 .settings = {
327 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
328 }
329 },
330 {
331 .gpio = KS8851_RST_GPIO,
332 .settings = {
333 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
334 }
335 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700336#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337};
338
339static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
340 {
341 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
342 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600343 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
344 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 },
346 },
347 {
348 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
349 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600350 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
351 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352 },
353 },
354 {
355 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
356 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600357 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
358 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 },
360 },
361 {
362 .gpio = 9, /* GSBI1 QUP SPI_CLK */
363 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600364 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
365 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700366 },
367 },
368 {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700369 .gpio = 14, /* GSBI1 SPI_CS_1 */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &spi_suspended_config2,
372 [GPIOMUX_ACTIVE] = &spi_active_config2,
373 },
374 },
375 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700376 .gpio = 16, /* GSBI3 I2C QUP SDA */
377 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530378 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
379 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700380 },
381 },
382 {
383 .gpio = 17, /* GSBI3 I2C QUP SCL */
384 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530385 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
386 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700387 },
388 },
389 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700390 .gpio = 22, /* GSBI5 UART2 */
391 .settings = {
392 [GPIOMUX_SUSPENDED] = &gsbi5,
393 },
394 },
395 {
396 .gpio = 23, /* GSBI5 UART2 */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &gsbi5,
399 },
400 },
401 {
402 .gpio = 24, /* GSBI5 UART2 */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &gsbi5,
405 },
406 },
407 {
408 .gpio = 25, /* GSBI5 UART2 */
409 .settings = {
410 [GPIOMUX_SUSPENDED] = &gsbi5,
411 },
412 },
413 {
414 .gpio = 44, /* GSBI12 I2C QUP SDA */
415 .settings = {
416 [GPIOMUX_SUSPENDED] = &gsbi12,
417 },
418 },
419 {
420 .gpio = 45, /* GSBI12 I2C QUP SCL */
421 .settings = {
422 [GPIOMUX_SUSPENDED] = &gsbi12,
423 },
424 },
425 {
426 .gpio = 73, /* GSBI10 I2C QUP SDA */
427 .settings = {
428 [GPIOMUX_SUSPENDED] = &gsbi10,
429 },
430 },
431 {
432 .gpio = 74, /* GSBI10 I2C QUP SCL */
433 .settings = {
434 [GPIOMUX_SUSPENDED] = &gsbi10,
435 },
436 },
437};
438
439static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
440 {
441 .gpio = 60, /* slimbus data */
442 .settings = {
443 [GPIOMUX_SUSPENDED] = &slimbus,
444 },
445 },
446 {
447 .gpio = 61, /* slimbus clk */
448 .settings = {
449 [GPIOMUX_SUSPENDED] = &slimbus,
450 },
451 },
452};
453
454static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
455 {
456 .gpio = 59,
457 .settings = {
458 [GPIOMUX_SUSPENDED] = &cdc_mclk,
459 },
460 },
461};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700462
463static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
464 {
465 .gpio = 63,
466 .settings = {
467 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
468 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
469 },
470 },
471 {
472 .gpio = 64,
473 .settings = {
474 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
475 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
476 },
477 },
478 {
479 .gpio = 65,
480 .settings = {
481 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
482 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
483 },
484 },
485 {
486 .gpio = 66,
487 .settings = {
488 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
489 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
490 },
491 },
492};
493
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700494static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
495 .func = GPIOMUX_FUNC_GPIO,
496 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700497 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700498};
499
500static struct gpiomux_setting wcnss_5wire_active_cfg = {
501 .func = GPIOMUX_FUNC_1,
502 .drv = GPIOMUX_DRV_6MA,
503 .pull = GPIOMUX_PULL_DOWN,
504};
505
506static struct msm_gpiomux_config wcnss_5wire_interface[] = {
507 {
508 .gpio = 84,
509 .settings = {
510 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
511 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
512 },
513 },
514 {
515 .gpio = 85,
516 .settings = {
517 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
518 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
519 },
520 },
521 {
522 .gpio = 86,
523 .settings = {
524 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
525 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
526 },
527 },
528 {
529 .gpio = 87,
530 .settings = {
531 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
532 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
533 },
534 },
535 {
536 .gpio = 88,
537 .settings = {
538 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
539 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
540 },
541 },
542};
Nishant Pandit24153d82011-08-27 16:05:13 +0530543static struct gpiomux_setting cam_settings[] = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530544 {
545 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
546 .drv = GPIOMUX_DRV_2MA,
547 .pull = GPIOMUX_PULL_DOWN,
548 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700549
Nishant Pandit474f2252011-07-23 23:17:56 +0530550 {
551 .func = GPIOMUX_FUNC_1, /*active 1*/
552 .drv = GPIOMUX_DRV_2MA,
553 .pull = GPIOMUX_PULL_NONE,
554 },
555
556 {
557 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
558 .drv = GPIOMUX_DRV_2MA,
559 .pull = GPIOMUX_PULL_NONE,
560 },
561
562 {
563 .func = GPIOMUX_FUNC_1, /*active 3*/
564 .drv = GPIOMUX_DRV_8MA,
Kevin Chan4c58d292011-09-13 11:03:25 -0700565 .pull = GPIOMUX_PULL_NONE,
Nishant Pandit474f2252011-07-23 23:17:56 +0530566 },
Nishant Pandit24153d82011-08-27 16:05:13 +0530567
568 {
569 .func = GPIOMUX_FUNC_5, /*active 4*/
570 .drv = GPIOMUX_DRV_8MA,
571 .pull = GPIOMUX_PULL_UP,
572 },
573
574 {
575 .func = GPIOMUX_FUNC_6, /*active 5*/
576 .drv = GPIOMUX_DRV_8MA,
577 .pull = GPIOMUX_PULL_UP,
578 },
579
580 {
581 .func = GPIOMUX_FUNC_2, /*active 6*/
582 .drv = GPIOMUX_DRV_2MA,
583 .pull = GPIOMUX_PULL_UP,
584 },
585
586 {
587 .func = GPIOMUX_FUNC_3, /*active 7*/
588 .drv = GPIOMUX_DRV_8MA,
589 .pull = GPIOMUX_PULL_UP,
590 },
591
Kevin Chan4c58d292011-09-13 11:03:25 -0700592 {
593 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
594 .drv = GPIOMUX_DRV_2MA,
595 .pull = GPIOMUX_PULL_KEEPER,
596 },
597
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598};
599
Nishant Pandit24153d82011-08-27 16:05:13 +0530600static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700601 {
602 .gpio = 2,
603 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530604 [GPIOMUX_ACTIVE] = &cam_settings[2],
605 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 },
607 },
608 {
609 .gpio = 3,
610 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530611 [GPIOMUX_ACTIVE] = &cam_settings[1],
612 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700613 },
614 },
615 {
616 .gpio = 4,
617 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530618 [GPIOMUX_ACTIVE] = &cam_settings[1],
619 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 },
621 },
622 {
623 .gpio = 5,
624 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530625 [GPIOMUX_ACTIVE] = &cam_settings[1],
626 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700627 },
628 },
629 {
Nishant Pandit24153d82011-08-27 16:05:13 +0530630 .gpio = 76,
631 .settings = {
632 [GPIOMUX_ACTIVE] = &cam_settings[2],
633 [GPIOMUX_SUSPENDED] = &cam_settings[0],
634 },
635 },
636 {
637 .gpio = 107,
638 .settings = {
639 [GPIOMUX_ACTIVE] = &cam_settings[2],
640 [GPIOMUX_SUSPENDED] = &cam_settings[0],
641 },
642 },
643};
644
645static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
646 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700647 .gpio = 18,
648 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530649 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700650 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700651 },
652 },
653 {
654 .gpio = 19,
655 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530656 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700657 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700658 },
659 },
660 {
661 .gpio = 20,
662 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530663 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700664 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700665 },
666 },
667 {
668 .gpio = 21,
669 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530670 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan4c58d292011-09-13 11:03:25 -0700671 [GPIOMUX_SUSPENDED] = &cam_settings[8],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700672 },
673 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700674};
675
676static struct gpiomux_setting cyts_resout_sus_cfg = {
677 .func = GPIOMUX_FUNC_GPIO,
678 .drv = GPIOMUX_DRV_6MA,
679 .pull = GPIOMUX_PULL_UP,
680};
681
682static struct gpiomux_setting cyts_resout_act_cfg = {
683 .func = GPIOMUX_FUNC_GPIO,
684 .drv = GPIOMUX_DRV_6MA,
685 .pull = GPIOMUX_PULL_UP,
686};
687
688static struct gpiomux_setting cyts_sleep_sus_cfg = {
689 .func = GPIOMUX_FUNC_GPIO,
690 .drv = GPIOMUX_DRV_6MA,
691 .pull = GPIOMUX_PULL_DOWN,
692};
693
694static struct gpiomux_setting cyts_sleep_act_cfg = {
695 .func = GPIOMUX_FUNC_GPIO,
696 .drv = GPIOMUX_DRV_6MA,
697 .pull = GPIOMUX_PULL_DOWN,
698};
699
700static struct gpiomux_setting cyts_int_act_cfg = {
701 .func = GPIOMUX_FUNC_GPIO,
702 .drv = GPIOMUX_DRV_8MA,
703 .pull = GPIOMUX_PULL_UP,
704};
705
706static struct gpiomux_setting cyts_int_sus_cfg = {
707 .func = GPIOMUX_FUNC_GPIO,
708 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530709 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700710};
711
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700712static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
713 { /* TS INTERRUPT */
714 .gpio = 11,
715 .settings = {
716 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
717 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
718 },
719 },
720 { /* TS SLEEP */
721 .gpio = 50,
722 .settings = {
723 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
724 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
725 },
726 },
727 { /* TS RESOUT */
728 .gpio = 52,
729 .settings = {
730 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
731 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
732 },
733 },
734};
735
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530736#ifdef CONFIG_USB_EHCI_MSM_HSIC
737static struct gpiomux_setting hsic_act_cfg = {
738 .func = GPIOMUX_FUNC_1,
739 .drv = GPIOMUX_DRV_12MA,
740 .pull = GPIOMUX_PULL_NONE,
741};
742
743static struct gpiomux_setting hsic_sus_cfg = {
744 .func = GPIOMUX_FUNC_GPIO,
745 .drv = GPIOMUX_DRV_2MA,
746 .pull = GPIOMUX_PULL_DOWN,
747};
748
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530749static struct gpiomux_setting hsic_hub_act_cfg = {
750 .func = GPIOMUX_FUNC_GPIO,
751 .drv = GPIOMUX_DRV_2MA,
752 .pull = GPIOMUX_PULL_NONE,
753};
754
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530755static struct msm_gpiomux_config msm8960_hsic_configs[] = {
756 {
757 .gpio = 150, /*HSIC_STROBE */
758 .settings = {
759 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
760 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
761 },
762 },
763 {
764 .gpio = 151, /* HSIC_DATA */
765 .settings = {
766 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
767 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
768 },
769 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530770 {
771 .gpio = 91, /* HSIC_HUB_RESET */
772 .settings = {
773 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
774 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
775 },
776 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530777};
778#endif
779
Mohan Pallaka5e490392011-09-09 15:18:41 +0530780#define HAP_SHIFT_LVL_OE_GPIO 47
781
782static struct gpiomux_setting hap_lvl_shft_suspended_config = {
783 .func = GPIOMUX_FUNC_GPIO,
784 .drv = GPIOMUX_DRV_2MA,
785 .pull = GPIOMUX_PULL_DOWN,
786};
787
788static struct gpiomux_setting hap_lvl_shft_active_config = {
789 .func = GPIOMUX_FUNC_GPIO,
790 .drv = GPIOMUX_DRV_8MA,
791 .pull = GPIOMUX_PULL_UP,
792};
793
794static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
795 {
796 .gpio = HAP_SHIFT_LVL_OE_GPIO,
797 .settings = {
798 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
799 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
800 },
801 },
802};
803
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700804#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
805enum {
806 SX150X_CAM,
807};
808
Nishant Pandit474f2252011-07-23 23:17:56 +0530809static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700810 [SX150X_CAM] = {
811 .gpio_base = GPIO_CAM_EXPANDER_BASE,
812 .oscio_is_gpo = false,
813 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530814 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700815 .io_open_drain_ena = 0x0,
816 .irq_summary = -1,
817 },
818};
Nishant Pandit474f2252011-07-23 23:17:56 +0530819
820#endif
821
822#ifdef CONFIG_I2C
823
824#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
825#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
Amir Samuelov5137e392011-09-21 17:31:25 +0300826#define MSM_8960_GSBI10_QUP_I2C_BUS_ID 10
Nishant Pandit474f2252011-07-23 23:17:56 +0530827
828#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
829
830static struct i2c_board_info cam_expander_i2c_info[] = {
831 {
832 I2C_BOARD_INFO("sx1508q", 0x22),
833 .platform_data = &sx150x_data[SX150X_CAM]
834 },
835};
836
837static struct msm_cam_expander_info cam_expander_info[] = {
838 {
839 cam_expander_i2c_info,
840 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
841 },
842};
843#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700844#endif
845
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700846#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700847#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700848#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
849#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
850#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700851#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700852#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700853
854
855#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbott6db11c92011-11-04 10:31:43 -0700856#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
857#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
Laura Abbott2d1760b2011-09-29 21:31:24 -0700858#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
859#define MSM_ION_HEAP_NUM 4
860#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700861#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700862#define MSM_ION_HEAP_NUM 2
863#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700864
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700865#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
866static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
867static int __init pmem_kernel_ebi1_size_setup(char *p)
868{
869 pmem_kernel_ebi1_size = memparse(p, NULL);
870 return 0;
871}
872early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
873#endif
874
875#ifdef CONFIG_ANDROID_PMEM
876static unsigned pmem_size = MSM_PMEM_SIZE;
877static int __init pmem_size_setup(char *p)
878{
879 pmem_size = memparse(p, NULL);
880 return 0;
881}
882early_param("pmem_size", pmem_size_setup);
883
884static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
885
886static int __init pmem_adsp_size_setup(char *p)
887{
888 pmem_adsp_size = memparse(p, NULL);
889 return 0;
890}
891early_param("pmem_adsp_size", pmem_adsp_size_setup);
892
893static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
894
895static int __init pmem_audio_size_setup(char *p)
896{
897 pmem_audio_size = memparse(p, NULL);
898 return 0;
899}
900early_param("pmem_audio_size", pmem_audio_size_setup);
901#endif
902
903#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700904#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905static struct android_pmem_platform_data android_pmem_pdata = {
906 .name = "pmem",
907 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
908 .cached = 1,
909 .memory_type = MEMTYPE_EBI1,
910};
911
912static struct platform_device android_pmem_device = {
913 .name = "android_pmem",
914 .id = 0,
915 .dev = {.platform_data = &android_pmem_pdata},
916};
917
918static struct android_pmem_platform_data android_pmem_adsp_pdata = {
919 .name = "pmem_adsp",
920 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
921 .cached = 0,
922 .memory_type = MEMTYPE_EBI1,
923};
924static struct platform_device android_pmem_adsp_device = {
925 .name = "android_pmem",
926 .id = 2,
927 .dev = { .platform_data = &android_pmem_adsp_pdata },
928};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700929#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700930
931static struct android_pmem_platform_data android_pmem_audio_pdata = {
932 .name = "pmem_audio",
933 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
934 .cached = 0,
935 .memory_type = MEMTYPE_EBI1,
936};
937
938static struct platform_device android_pmem_audio_device = {
939 .name = "android_pmem",
940 .id = 4,
941 .dev = { .platform_data = &android_pmem_audio_pdata },
942};
943#endif
944
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700945#define DSP_RAM_BASE_8960 0x8da00000
946#define DSP_RAM_SIZE_8960 0x1800000
947static int dspcrashd_pdata_8960 = 0xDEADDEAD;
948
949static struct resource resources_dspcrashd_8960[] = {
950 {
951 .name = "msm_dspcrashd",
952 .start = DSP_RAM_BASE_8960,
953 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
954 .flags = IORESOURCE_DMA,
955 },
956};
957
958struct platform_device msm_device_dspcrashd_8960 = {
959 .name = "msm_dspcrashd",
960 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
961 .resource = resources_dspcrashd_8960,
962 .dev = { .platform_data = &dspcrashd_pdata_8960 },
963};
964
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700965static struct memtype_reserve msm8960_reserve_table[] __initdata = {
966 [MEMTYPE_SMI] = {
967 },
968 [MEMTYPE_EBI0] = {
969 .flags = MEMTYPE_FLAGS_1M_ALIGN,
970 },
971 [MEMTYPE_EBI1] = {
972 .flags = MEMTYPE_FLAGS_1M_ALIGN,
973 },
974};
975
976static void __init size_pmem_devices(void)
977{
978#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700979#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700980 android_pmem_adsp_pdata.size = pmem_adsp_size;
981 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700982#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700983 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
984#endif
985}
986
987static void __init reserve_memory_for(struct android_pmem_platform_data *p)
988{
989 msm8960_reserve_table[p->memory_type].size += p->size;
990}
991
992static void __init reserve_pmem_memory(void)
993{
994#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700995#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700996 reserve_memory_for(&android_pmem_adsp_pdata);
997 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700998#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999 reserve_memory_for(&android_pmem_audio_pdata);
1000 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
1001#endif
1002}
1003
Larry Basselb4126da2011-07-18 14:31:33 -07001004static int msm8960_paddr_to_memtype(unsigned int paddr)
1005{
1006 return MEMTYPE_EBI1;
1007}
1008
Laura Abbottd6183792011-08-19 13:42:24 -07001009#ifdef CONFIG_ION_MSM
1010struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -07001011 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -07001012 .heaps = {
1013 {
1014 .id = ION_HEAP_SYSTEM_ID,
1015 .type = ION_HEAP_TYPE_SYSTEM,
1016 .name = ION_KMALLOC_HEAP_NAME,
1017 },
1018 {
1019 .id = ION_HEAP_SYSTEM_CONTIG_ID,
1020 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
1021 .name = ION_VMALLOC_HEAP_NAME,
1022 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001023#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -07001024 {
1025 .id = ION_HEAP_EBI_ID,
1026 .type = ION_HEAP_TYPE_CARVEOUT,
1027 .name = ION_EBI1_HEAP_NAME,
1028 .size = MSM_ION_EBI_SIZE,
1029 .memory_type = ION_EBI_TYPE,
1030 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001031 {
1032 .id = ION_HEAP_ADSP_ID,
1033 .type = ION_HEAP_TYPE_CARVEOUT,
1034 .name = ION_ADSP_HEAP_NAME,
1035 .size = MSM_ION_ADSP_SIZE,
1036 .memory_type = ION_EBI_TYPE,
1037 },
1038#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001039 }
1040};
1041
1042struct platform_device ion_dev = {
1043 .name = "ion-msm",
1044 .id = 1,
1045 .dev = { .platform_data = &ion_pdata },
1046};
1047#endif
1048
1049static void reserve_ion_memory(void)
1050{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001051#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001052 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001053 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001054#endif
1055}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001056static void __init msm8960_calculate_reserve_sizes(void)
1057{
1058 size_pmem_devices();
1059 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001060 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001061}
1062
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001063static struct reserve_info msm8960_reserve_info __initdata = {
1064 .memtype_reserve_table = msm8960_reserve_table,
1065 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1066 .paddr_to_memtype = msm8960_paddr_to_memtype,
1067};
1068
Larry Basselb4126da2011-07-18 14:31:33 -07001069static int msm8960_memory_bank_size(void)
1070{
1071 return 1<<29;
1072}
1073
1074static void __init locate_unstable_memory(void)
1075{
1076 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1077 unsigned long bank_size;
1078 unsigned long low, high;
1079
1080 bank_size = msm8960_memory_bank_size();
1081 low = meminfo.bank[0].start;
1082 high = mb->start + mb->size;
1083 low &= ~(bank_size - 1);
1084
1085 if (high - low <= bank_size)
1086 return;
1087 msm8960_reserve_info.low_unstable_address = low + bank_size;
1088 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
1089 msm8960_reserve_info.bank_size = bank_size;
1090 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1091 msm8960_reserve_info.low_unstable_address,
1092 msm8960_reserve_info.max_unstable_size,
1093 msm8960_reserve_info.bank_size);
1094}
1095
Larry Basselb830e182011-10-14 10:46:55 -07001096static void __init place_movable_zone(void)
1097{
1098 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1099 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1100 pr_info("movable zone start %lx size %lx\n",
1101 movable_reserved_start, movable_reserved_size);
1102}
1103
1104static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001105{
1106 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001107 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001108 place_movable_zone();
1109}
1110
1111static void __init msm8960_reserve(void)
1112{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001113 msm_reserve();
1114}
1115
Larry Bassela4414b12011-08-04 11:11:02 -07001116static int msm8960_change_memory_power(u64 start, u64 size,
1117 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001118{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001119 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001120}
1121
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001122#ifdef CONFIG_MSM_CAMERA
1123
Nishant Pandit24153d82011-08-27 16:05:13 +05301124static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001125 5, /*CAMIF_MCLK*/
1126 20, /*CAMIF_I2C_DATA*/
1127 21, /*CAMIF_I2C_CLK*/
1128};
1129
Nishant Pandit24153d82011-08-27 16:05:13 +05301130static struct msm_camera_gpio_conf gpio_conf = {
1131 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1132 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1133 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1134 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1135};
1136
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001137#define VFE_CAMIF_TIMER1_GPIO 2
1138#define VFE_CAMIF_TIMER2_GPIO 3
1139#define VFE_CAMIF_TIMER3_GPIO_INT 4
1140struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1141 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1142 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1143 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1144 .flash_recharge_duration = 50000,
1145 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1146};
1147
Nishant Pandit474f2252011-07-23 23:17:56 +05301148#ifdef CONFIG_MSM_CAMERA_FLASH
1149static struct msm_camera_sensor_flash_src msm_flash_src = {
1150 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1151 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1152 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1153#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1154 defined(CONFIG_GPIO_SX150X_MODULE))
1155 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1156#endif
1157};
1158#endif
1159
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001160static struct msm_bus_vectors cam_init_vectors[] = {
1161 {
1162 .src = MSM_BUS_MASTER_VFE,
1163 .dst = MSM_BUS_SLAVE_EBI_CH0,
1164 .ab = 0,
1165 .ib = 0,
1166 },
1167 {
1168 .src = MSM_BUS_MASTER_VPE,
1169 .dst = MSM_BUS_SLAVE_EBI_CH0,
1170 .ab = 0,
1171 .ib = 0,
1172 },
1173 {
1174 .src = MSM_BUS_MASTER_JPEG_ENC,
1175 .dst = MSM_BUS_SLAVE_EBI_CH0,
1176 .ab = 0,
1177 .ib = 0,
1178 },
1179};
1180
1181static struct msm_bus_vectors cam_preview_vectors[] = {
1182 {
1183 .src = MSM_BUS_MASTER_VFE,
1184 .dst = MSM_BUS_SLAVE_EBI_CH0,
1185 .ab = 27648000,
1186 .ib = 110592000,
1187 },
1188 {
1189 .src = MSM_BUS_MASTER_VPE,
1190 .dst = MSM_BUS_SLAVE_EBI_CH0,
1191 .ab = 0,
1192 .ib = 0,
1193 },
1194 {
1195 .src = MSM_BUS_MASTER_JPEG_ENC,
1196 .dst = MSM_BUS_SLAVE_EBI_CH0,
1197 .ab = 0,
1198 .ib = 0,
1199 },
1200};
1201
1202static struct msm_bus_vectors cam_video_vectors[] = {
1203 {
1204 .src = MSM_BUS_MASTER_VFE,
1205 .dst = MSM_BUS_SLAVE_EBI_CH0,
1206 .ab = 140451840,
1207 .ib = 561807360,
1208 },
1209 {
1210 .src = MSM_BUS_MASTER_VPE,
1211 .dst = MSM_BUS_SLAVE_EBI_CH0,
1212 .ab = 206807040,
1213 .ib = 488816640,
1214 },
1215 {
1216 .src = MSM_BUS_MASTER_JPEG_ENC,
1217 .dst = MSM_BUS_SLAVE_EBI_CH0,
1218 .ab = 0,
1219 .ib = 0,
1220 },
1221};
1222
1223static struct msm_bus_vectors cam_snapshot_vectors[] = {
1224 {
1225 .src = MSM_BUS_MASTER_VFE,
1226 .dst = MSM_BUS_SLAVE_EBI_CH0,
1227 .ab = 274423680,
1228 .ib = 1097694720,
1229 },
1230 {
1231 .src = MSM_BUS_MASTER_VPE,
1232 .dst = MSM_BUS_SLAVE_EBI_CH0,
1233 .ab = 0,
1234 .ib = 0,
1235 },
1236 {
1237 .src = MSM_BUS_MASTER_JPEG_ENC,
1238 .dst = MSM_BUS_SLAVE_EBI_CH0,
1239 .ab = 540000000,
1240 .ib = 1350000000,
1241 },
1242};
1243
1244static struct msm_bus_vectors cam_zsl_vectors[] = {
1245 {
1246 .src = MSM_BUS_MASTER_VFE,
1247 .dst = MSM_BUS_SLAVE_EBI_CH0,
1248 .ab = 302071680,
1249 .ib = 1208286720,
1250 },
1251 {
1252 .src = MSM_BUS_MASTER_VPE,
1253 .dst = MSM_BUS_SLAVE_EBI_CH0,
1254 .ab = 0,
1255 .ib = 0,
1256 },
1257 {
1258 .src = MSM_BUS_MASTER_JPEG_ENC,
1259 .dst = MSM_BUS_SLAVE_EBI_CH0,
1260 .ab = 540000000,
1261 .ib = 1350000000,
1262 },
1263};
1264
1265static struct msm_bus_paths cam_bus_client_config[] = {
1266 {
1267 ARRAY_SIZE(cam_init_vectors),
1268 cam_init_vectors,
1269 },
1270 {
1271 ARRAY_SIZE(cam_preview_vectors),
1272 cam_preview_vectors,
1273 },
1274 {
1275 ARRAY_SIZE(cam_video_vectors),
1276 cam_video_vectors,
1277 },
1278 {
1279 ARRAY_SIZE(cam_snapshot_vectors),
1280 cam_snapshot_vectors,
1281 },
1282 {
1283 ARRAY_SIZE(cam_zsl_vectors),
1284 cam_zsl_vectors,
1285 },
1286};
1287
1288static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1289 cam_bus_client_config,
1290 ARRAY_SIZE(cam_bus_client_config),
1291 .name = "msm_camera",
1292};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001293
Nishant Pandit24153d82011-08-27 16:05:13 +05301294struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1295 {
1296 .ioclk.mclk_clk_rate = 24000000,
1297 .ioclk.vfe_clk_rate = 228570000,
1298 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001299 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301300 },
1301 {
1302 .ioclk.mclk_clk_rate = 24000000,
1303 .ioclk.vfe_clk_rate = 228570000,
1304 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001305 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301306 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001307};
1308
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001309#ifdef CONFIG_IMX074_ACT
1310static struct i2c_board_info imx074_actuator_i2c_info = {
1311 I2C_BOARD_INFO("imx074_act", 0x11),
1312};
1313
1314static struct msm_actuator_info imx074_actuator_info = {
1315 .board_info = &imx074_actuator_i2c_info,
1316 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1317 .vcm_pwd = 0,
1318 .vcm_enable = 1,
1319};
1320#endif
1321
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001322#ifdef CONFIG_IMX074
1323static struct msm_camera_sensor_flash_data flash_imx074 = {
1324 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301325#ifdef CONFIG_MSM_CAMERA_FLASH
1326 .flash_src = &msm_flash_src
1327#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001328};
1329
Nishant Pandit24153d82011-08-27 16:05:13 +05301330static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1331 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001332 .sensor_reset = 107,
1333 .sensor_pwd = 85,
1334 .vcm_pwd = 0,
1335 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301336};
1337
1338static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1339 .sensor_name = "imx074",
1340 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001341 .flash_data = &flash_imx074,
1342 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301343 .sensor_platform_info = &sensor_board_info_imx074,
1344 .gpio_conf = &gpio_conf,
1345 .csi_if = 1,
1346 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001347#ifdef CONFIG_IMX074_ACT
1348 .actuator_info = &imx074_actuator_info
1349#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001350};
1351
1352struct platform_device msm8960_camera_sensor_imx074 = {
1353 .name = "msm_camera_imx074",
1354 .dev = {
1355 .platform_data = &msm_camera_sensor_imx074_data,
1356 },
1357};
1358#endif
1359#ifdef CONFIG_OV2720
1360static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001361 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001362};
1363
Nishant Pandit24153d82011-08-27 16:05:13 +05301364static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1365 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001366 .sensor_reset = 76,
1367 .sensor_pwd = 85,
1368 .vcm_pwd = 0,
1369 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301370};
1371
1372static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1373 .sensor_name = "ov2720",
1374 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001375 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301376 .sensor_platform_info = &sensor_board_info_ov2720,
1377 .gpio_conf = &gpio_conf,
1378 .csi_if = 1,
1379 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001380};
1381
1382struct platform_device msm8960_camera_sensor_ov2720 = {
1383 .name = "msm_camera_ov2720",
1384 .dev = {
1385 .platform_data = &msm_camera_sensor_ov2720_data,
1386 },
1387};
1388#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001389
1390static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1391 .flash_type = MSM_CAMERA_FLASH_LED,
1392};
1393
Nishant Pandit24153d82011-08-27 16:05:13 +05301394static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1395 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001396 .sensor_reset = 107,
1397 .sensor_pwd = 85,
1398 .vcm_pwd = 0,
1399 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301400};
1401
1402static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1403 .sensor_name = "qs_mt9p017",
1404 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001405 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301406 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1407 .gpio_conf = &gpio_conf,
1408 .csi_if = 1,
1409 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001410};
1411
1412struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1413 .name = "msm_camera_qs_mt9p017",
1414 .dev = {
1415 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1416 },
1417};
1418
Kevin Chan8b0d2322011-09-10 21:06:31 -07001419static struct msm8960_privacy_light_cfg privacy_light_info = {
1420 .mpp = PM8921_MPP_PM_TO_SYS(12),
1421};
1422
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001423static void __init msm8960_init_cam(void)
1424{
1425 int i;
1426 struct platform_device *cam_dev[] = {
1427 &msm8960_camera_sensor_imx074,
1428 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001429 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001430 };
1431
Kevin Chan8b0d2322011-09-10 21:06:31 -07001432 if (machine_is_msm8960_liquid()) {
1433 struct msm_camera_sensor_info *s_info;
1434 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1435 s_info->sensor_platform_info->mount_angle = 180;
1436 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1437 s_info->sensor_platform_info->privacy_light = 1;
1438 s_info->sensor_platform_info->privacy_light_info =
1439 &privacy_light_info;
1440 }
1441
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001442 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1443 struct msm_camera_sensor_info *s_info;
1444 s_info = cam_dev[i]->dev.platform_data;
1445 msm_get_cam_resources(s_info);
1446 platform_device_register(cam_dev[i]);
1447 }
Kevin Chanf6216f22011-10-25 18:40:11 -07001448
1449 platform_device_register(&msm8960_device_csiphy0);
1450 platform_device_register(&msm8960_device_csiphy1);
Kevin Chanc8b52e82011-10-25 23:20:21 -07001451 platform_device_register(&msm8960_device_csid0);
1452 platform_device_register(&msm8960_device_csid1);
Kevin Chane12c6672011-10-26 11:55:26 -07001453 platform_device_register(&msm8960_device_ispif);
Kevin Chan5827c552011-10-28 18:36:32 -07001454 platform_device_register(&msm8960_device_vfe);
Kevin Chana0853122011-11-07 19:48:44 -08001455 platform_device_register(&msm8960_device_vpe);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001456}
1457#endif
1458
1459#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001460#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001461#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001462#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001463#endif
1464
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001465
1466#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001467#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001468#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001469#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1470#else
1471#define MSM_FB_EXT_BUF_SIZE 0
1472#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001473
kuogee hsieh3830eb92011-09-12 15:25:57 -07001474#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1475/* width x height x 3 bpp x 2 frame buffer */
1476#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1477#define MSM_FB_WRITEBACK_OFFSET \
1478 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1479#else
1480#define MSM_FB_WRITEBACK_SIZE 0
1481#define MSM_FB_WRITEBACK_OFFSET 0
1482#endif
1483
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001484#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1485/* 4 bpp x 2 page HDMI case */
1486#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1487#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001488/* Note: must be multiple of 4096 */
1489#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1490 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001491#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001492
1493static int writeback_offset(void)
1494{
1495 return MSM_FB_WRITEBACK_OFFSET;
1496}
1497
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001498
1499#define MDP_VSYNC_GPIO 0
1500
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001501#define PANEL_NAME_MAX_LEN 30
1502#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1503#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1504#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1505#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1506#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1507#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1508#define HDMI_PANEL_NAME "hdmi_msm"
1509#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001510
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001511static struct resource msm_fb_resources[] = {
1512 {
1513 .flags = IORESOURCE_DMA,
1514 }
1515};
1516
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001517static int msm_fb_detect_panel(const char *name)
1518{
1519 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001520 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1521 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1522 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001523 return 0;
1524 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001525 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1526 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1527 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001528 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001529
1530#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1531 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1532 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1533 PANEL_NAME_MAX_LEN)))
1534 return 0;
1535
1536 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1537 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1538 PANEL_NAME_MAX_LEN)))
1539 return 0;
1540
1541 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1542 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1543 PANEL_NAME_MAX_LEN)))
1544 return 0;
1545
1546 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1547 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1548 PANEL_NAME_MAX_LEN)))
1549 return 0;
1550#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001551 }
1552
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001553 if (!strncmp(name, HDMI_PANEL_NAME,
1554 strnlen(HDMI_PANEL_NAME,
1555 PANEL_NAME_MAX_LEN)))
1556 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001557
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001558 if (!strncmp(name, TVOUT_PANEL_NAME,
1559 strnlen(TVOUT_PANEL_NAME,
1560 PANEL_NAME_MAX_LEN)))
1561 return 0;
1562
1563 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001564 return -ENODEV;
1565}
1566
1567static struct msm_fb_platform_data msm_fb_pdata = {
1568 .detect_client = msm_fb_detect_panel,
1569};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001570
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001571static struct platform_device msm_fb_device = {
1572 .name = "msm_fb",
1573 .id = 0,
1574 .num_resources = ARRAY_SIZE(msm_fb_resources),
1575 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001576 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001577};
1578
1579static bool dsi_power_on;
1580
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001581/**
1582 * LiQUID panel on/off
1583 *
1584 * @param on
1585 *
1586 * @return int
1587 */
1588static int mipi_dsi_liquid_panel_power(int on)
1589{
1590 static struct regulator *reg_l2, *reg_ext_3p3v;
1591 static int gpio21, gpio24, gpio43;
1592 int rc;
1593
1594 pr_info("%s: on=%d\n", __func__, on);
1595
1596 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1597 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1598 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1599
1600 if (!dsi_power_on) {
1601
1602 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1603 "dsi_vdda");
1604 if (IS_ERR(reg_l2)) {
1605 pr_err("could not get 8921_l2, rc = %ld\n",
1606 PTR_ERR(reg_l2));
1607 return -ENODEV;
1608 }
1609
1610 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1611 if (rc) {
1612 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1613 return -EINVAL;
1614 }
1615
1616 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1617 "vdd_lvds_3p3v");
1618 if (IS_ERR(reg_ext_3p3v)) {
1619 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1620 PTR_ERR(reg_ext_3p3v));
1621 return -ENODEV;
1622 }
1623
1624 rc = gpio_request(gpio21, "disp_pwr_en_n");
1625 if (rc) {
1626 pr_err("request gpio 21 failed, rc=%d\n", rc);
1627 return -ENODEV;
1628 }
1629
1630 rc = gpio_request(gpio43, "disp_rst_n");
1631 if (rc) {
1632 pr_err("request gpio 43 failed, rc=%d\n", rc);
1633 return -ENODEV;
1634 }
1635
1636 rc = gpio_request(gpio24, "disp_backlight_pwm");
1637 if (rc) {
1638 pr_err("request gpio 24 failed, rc=%d\n", rc);
1639 return -ENODEV;
1640 }
1641
1642 dsi_power_on = true;
1643 }
1644
1645 if (on) {
1646 rc = regulator_set_optimum_mode(reg_l2, 100000);
1647 if (rc < 0) {
1648 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1649 return -EINVAL;
1650 }
1651 rc = regulator_enable(reg_l2);
1652 if (rc) {
1653 pr_err("enable l2 failed, rc=%d\n", rc);
1654 return -ENODEV;
1655 }
1656
1657 rc = regulator_enable(reg_ext_3p3v);
1658 if (rc) {
1659 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1660 return -ENODEV;
1661 }
1662
1663 /* set reset pin before power enable */
1664 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1665
1666 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1667 msleep(20);
1668 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1669 msleep(20);
1670 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1671 msleep(20);
1672 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1673 msleep(20);
1674 } else {
1675 gpio_set_value_cansleep(gpio43, 0);
1676 gpio_set_value_cansleep(gpio21, 1);
1677
1678 rc = regulator_disable(reg_l2);
1679 if (rc) {
1680 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1681 return -ENODEV;
1682 }
1683 rc = regulator_disable(reg_ext_3p3v);
1684 if (rc) {
1685 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1686 return -ENODEV;
1687 }
1688 rc = regulator_set_optimum_mode(reg_l2, 100);
1689 if (rc < 0) {
1690 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1691 return -EINVAL;
1692 }
1693 }
1694
1695 return 0;
1696}
1697
1698static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001699{
1700 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001701 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001702 int rc;
1703
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001704 pr_info("%s: state : %d\n", __func__, on);
1705
1706 if (!dsi_power_on) {
1707
1708 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1709 "dsi_vdc");
1710 if (IS_ERR(reg_l8)) {
1711 pr_err("could not get 8921_l8, rc = %ld\n",
1712 PTR_ERR(reg_l8));
1713 return -ENODEV;
1714 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001715 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1716 "dsi_vddio");
1717 if (IS_ERR(reg_l23)) {
1718 pr_err("could not get 8921_l23, rc = %ld\n",
1719 PTR_ERR(reg_l23));
1720 return -ENODEV;
1721 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001722 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1723 "dsi_vdda");
1724 if (IS_ERR(reg_l2)) {
1725 pr_err("could not get 8921_l2, rc = %ld\n",
1726 PTR_ERR(reg_l2));
1727 return -ENODEV;
1728 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001729 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1730 if (rc) {
1731 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1732 return -EINVAL;
1733 }
1734 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1735 if (rc) {
1736 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1737 return -EINVAL;
1738 }
1739 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1740 if (rc) {
1741 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1742 return -EINVAL;
1743 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001744 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1745 rc = gpio_request(gpio43, "disp_rst_n");
1746 if (rc) {
1747 pr_err("request gpio 43 failed, rc=%d\n", rc);
1748 return -ENODEV;
1749 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001750 dsi_power_on = true;
1751 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001752 if (on) {
1753 rc = regulator_set_optimum_mode(reg_l8, 100000);
1754 if (rc < 0) {
1755 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1756 return -EINVAL;
1757 }
1758 rc = regulator_set_optimum_mode(reg_l23, 100000);
1759 if (rc < 0) {
1760 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1761 return -EINVAL;
1762 }
1763 rc = regulator_set_optimum_mode(reg_l2, 100000);
1764 if (rc < 0) {
1765 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1766 return -EINVAL;
1767 }
1768 rc = regulator_enable(reg_l8);
1769 if (rc) {
1770 pr_err("enable l8 failed, rc=%d\n", rc);
1771 return -ENODEV;
1772 }
1773 rc = regulator_enable(reg_l23);
1774 if (rc) {
1775 pr_err("enable l8 failed, rc=%d\n", rc);
1776 return -ENODEV;
1777 }
1778 rc = regulator_enable(reg_l2);
1779 if (rc) {
1780 pr_err("enable l2 failed, rc=%d\n", rc);
1781 return -ENODEV;
1782 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001783 gpio_set_value_cansleep(gpio43, 1);
1784 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001785 rc = regulator_disable(reg_l2);
1786 if (rc) {
1787 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1788 return -ENODEV;
1789 }
1790 rc = regulator_disable(reg_l8);
1791 if (rc) {
1792 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1793 return -ENODEV;
1794 }
1795 rc = regulator_disable(reg_l23);
1796 if (rc) {
1797 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1798 return -ENODEV;
1799 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001800 rc = regulator_set_optimum_mode(reg_l8, 100);
1801 if (rc < 0) {
1802 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1803 return -EINVAL;
1804 }
1805 rc = regulator_set_optimum_mode(reg_l23, 100);
1806 if (rc < 0) {
1807 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1808 return -EINVAL;
1809 }
1810 rc = regulator_set_optimum_mode(reg_l2, 100);
1811 if (rc < 0) {
1812 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1813 return -EINVAL;
1814 }
1815 gpio_set_value_cansleep(gpio43, 0);
1816 }
1817 return 0;
1818}
1819
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001820static int mipi_dsi_panel_power(int on)
1821{
1822 int ret;
1823
1824 pr_info("%s: on=%d\n", __func__, on);
1825
1826 if (machine_is_msm8960_liquid())
1827 ret = mipi_dsi_liquid_panel_power(on);
1828 else
1829 ret = mipi_dsi_cdp_panel_power(on);
1830
1831 return ret;
1832}
1833
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001834static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1835 .vsync_gpio = MDP_VSYNC_GPIO,
1836 .dsi_power_save = mipi_dsi_panel_power,
1837};
1838
1839#ifdef CONFIG_MSM_BUS_SCALING
1840
1841static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001842 {
1843 .src = MSM_BUS_MASTER_MDP_PORT0,
1844 .dst = MSM_BUS_SLAVE_EBI_CH0,
1845 .ab = 0,
1846 .ib = 0,
1847 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001848};
1849
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001850#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1851static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1852 /* If HDMI is used as primary */
1853 {
1854 .src = MSM_BUS_MASTER_MDP_PORT0,
1855 .dst = MSM_BUS_SLAVE_EBI_CH0,
1856 .ab = 2000000000,
1857 .ib = 2000000000,
1858 },
1859};
1860static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1861 {
1862 ARRAY_SIZE(mdp_init_vectors),
1863 mdp_init_vectors,
1864 },
1865 {
1866 ARRAY_SIZE(hdmi_as_primary_vectors),
1867 hdmi_as_primary_vectors,
1868 },
1869 {
1870 ARRAY_SIZE(hdmi_as_primary_vectors),
1871 hdmi_as_primary_vectors,
1872 },
1873 {
1874 ARRAY_SIZE(hdmi_as_primary_vectors),
1875 hdmi_as_primary_vectors,
1876 },
1877 {
1878 ARRAY_SIZE(hdmi_as_primary_vectors),
1879 hdmi_as_primary_vectors,
1880 },
1881 {
1882 ARRAY_SIZE(hdmi_as_primary_vectors),
1883 hdmi_as_primary_vectors,
1884 },
1885};
1886#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001887static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001888 {
1889 .src = MSM_BUS_MASTER_MDP_PORT0,
1890 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001891 .ab = 216000000 * 2,
1892 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001893 },
1894};
1895
1896static struct msm_bus_vectors mdp_vga_vectors[] = {
1897 /* VGA and less video */
1898 {
1899 .src = MSM_BUS_MASTER_MDP_PORT0,
1900 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001901 .ab = 216000000 * 2,
1902 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001903 },
1904};
1905
1906static struct msm_bus_vectors mdp_720p_vectors[] = {
1907 /* 720p and less video */
1908 {
1909 .src = MSM_BUS_MASTER_MDP_PORT0,
1910 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001911 .ab = 230400000 * 2,
1912 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001913 },
1914};
1915
1916static struct msm_bus_vectors mdp_1080p_vectors[] = {
1917 /* 1080p and less video */
1918 {
1919 .src = MSM_BUS_MASTER_MDP_PORT0,
1920 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001921 .ab = 334080000 * 2,
1922 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001923 },
1924};
1925
1926static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1927 {
1928 ARRAY_SIZE(mdp_init_vectors),
1929 mdp_init_vectors,
1930 },
1931 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001932 ARRAY_SIZE(mdp_ui_vectors),
1933 mdp_ui_vectors,
1934 },
1935 {
1936 ARRAY_SIZE(mdp_ui_vectors),
1937 mdp_ui_vectors,
1938 },
1939 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001940 ARRAY_SIZE(mdp_vga_vectors),
1941 mdp_vga_vectors,
1942 },
1943 {
1944 ARRAY_SIZE(mdp_720p_vectors),
1945 mdp_720p_vectors,
1946 },
1947 {
1948 ARRAY_SIZE(mdp_1080p_vectors),
1949 mdp_1080p_vectors,
1950 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001951};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001952#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001953
1954static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1955 mdp_bus_scale_usecases,
1956 ARRAY_SIZE(mdp_bus_scale_usecases),
1957 .name = "mdp",
1958};
1959
1960#endif
1961
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001962#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1963int mdp_core_clk_rate_table[] = {
1964 200000000,
1965 200000000,
1966 200000000,
1967 200000000,
1968};
1969#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001970int mdp_core_clk_rate_table[] = {
1971 85330000,
1972 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001973 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001974 200000000,
1975};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001976#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001977
1978static struct msm_panel_common_pdata mdp_pdata = {
1979 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001980#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1981 .mdp_core_clk_rate = 200000000,
1982#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001983 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001984#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001985 .mdp_core_clk_table = mdp_core_clk_rate_table,
1986 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1987#ifdef CONFIG_MSM_BUS_SCALING
1988 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1989#endif
1990 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001991 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001992};
1993
1994static struct platform_device mipi_dsi_renesas_panel_device = {
1995 .name = "mipi_renesas",
1996 .id = 0,
1997};
1998
1999static struct platform_device mipi_dsi_simulator_panel_device = {
2000 .name = "mipi_simulator",
2001 .id = 0,
2002};
2003
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07002004#define LPM_CHANNEL0 0
2005static int toshiba_gpio[] = {LPM_CHANNEL0};
2006
2007static struct mipi_dsi_panel_platform_data toshiba_pdata = {
2008 .gpio = toshiba_gpio,
2009};
2010
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002011static struct platform_device mipi_dsi_toshiba_panel_device = {
2012 .name = "mipi_toshiba",
2013 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07002014 .dev = {
2015 .platform_data = &toshiba_pdata,
2016 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002017};
2018
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002019#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002020static int dsi2lvds_gpio[2] = {
2021 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
2022 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
2023 };
2024
2025static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
2026 .gpio_num = dsi2lvds_gpio,
2027};
2028
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002029static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
2030
2031/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
2032 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
2033 /* timing */
2034 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2035 0x0c, 0x03, 0x04, 0xa0},
2036 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2037 {0xff, 0x00, 0x06, 0x00}, /* strength */
2038 /* pll control */
2039 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2040 0x40, 0x07, 0x03,
2041 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2042};
2043
2044static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002045 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2046 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002047 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2048};
2049
2050static struct platform_device mipi_dsi_novatek_panel_device = {
2051 .name = "mipi_novatek",
2052 .id = 0,
2053 .dev = {
2054 .platform_data = &novatek_pdata,
2055 }
2056};
2057
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002058static struct platform_device mipi_dsi2lvds_bridge_device = {
2059 .name = "mipi_tc358764",
2060 .id = 0,
2061 .dev.platform_data = &mipi_dsi2lvds_pdata,
2062};
2063
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002064#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2065static struct resource hdmi_msm_resources[] = {
2066 {
2067 .name = "hdmi_msm_qfprom_addr",
2068 .start = 0x00700000,
2069 .end = 0x007060FF,
2070 .flags = IORESOURCE_MEM,
2071 },
2072 {
2073 .name = "hdmi_msm_hdmi_addr",
2074 .start = 0x04A00000,
2075 .end = 0x04A00FFF,
2076 .flags = IORESOURCE_MEM,
2077 },
2078 {
2079 .name = "hdmi_msm_irq",
2080 .start = HDMI_IRQ,
2081 .end = HDMI_IRQ,
2082 .flags = IORESOURCE_IRQ,
2083 },
2084};
2085
2086static int hdmi_enable_5v(int on);
2087static int hdmi_core_power(int on, int show);
2088static int hdmi_cec_power(int on);
2089
2090static struct msm_hdmi_platform_data hdmi_msm_data = {
2091 .irq = HDMI_IRQ,
2092 .enable_5v = hdmi_enable_5v,
2093 .core_power = hdmi_core_power,
2094 .cec_power = hdmi_cec_power,
2095};
2096
2097static struct platform_device hdmi_msm_device = {
2098 .name = "hdmi_msm",
2099 .id = 0,
2100 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2101 .resource = hdmi_msm_resources,
2102 .dev.platform_data = &hdmi_msm_data,
2103};
2104#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2105
Vinay Kalia291263e2011-11-01 17:07:05 -07002106#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2107static struct platform_device wfd_panel_device = {
2108 .name = "wfd_panel",
2109 .id = 0,
2110 .dev.platform_data = NULL,
2111};
2112#endif
2113
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002114#ifdef CONFIG_MSM_BUS_SCALING
2115static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2116 {
2117 .src = MSM_BUS_MASTER_MDP_PORT0,
2118 .dst = MSM_BUS_SLAVE_EBI_CH0,
2119 .ab = 0,
2120 .ib = 0,
2121 },
2122};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002123
2124#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2125static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2126 {
2127 .src = MSM_BUS_MASTER_MDP_PORT0,
2128 .dst = MSM_BUS_SLAVE_EBI_CH0,
2129 .ab = 2000000000,
2130 .ib = 2000000000,
2131 },
2132};
2133#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002134static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2135 {
2136 .src = MSM_BUS_MASTER_MDP_PORT0,
2137 .dst = MSM_BUS_SLAVE_EBI_CH0,
2138 .ab = 566092800 * 2,
2139 .ib = 707616000 * 2,
2140 },
2141};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002142#endif
2143
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002144static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2145 {
2146 ARRAY_SIZE(dtv_bus_init_vectors),
2147 dtv_bus_init_vectors,
2148 },
2149 {
2150 ARRAY_SIZE(dtv_bus_def_vectors),
2151 dtv_bus_def_vectors,
2152 },
2153};
2154static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2155 dtv_bus_scale_usecases,
2156 ARRAY_SIZE(dtv_bus_scale_usecases),
2157 .name = "dtv",
2158};
2159
2160static struct lcdc_platform_data dtv_pdata = {
2161 .bus_scale_table = &dtv_bus_scale_pdata,
2162};
2163#endif
2164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002165static void __init msm_fb_add_devices(void)
2166{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002167 struct platform_device *ptr = NULL;
2168
2169 if (machine_is_msm8960_liquid())
2170 ptr = &mipi_dsi2lvds_bridge_device;
2171 else
2172 ptr = &mipi_dsi_toshiba_panel_device;
2173 platform_add_devices(&ptr, 1);
2174
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002175 if (machine_is_msm8x60_rumi3()) {
2176 msm_fb_register_device("mdp", NULL);
2177 mipi_dsi_pdata.target_type = 1;
2178 } else
2179 msm_fb_register_device("mdp", &mdp_pdata);
2180 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002181#ifdef CONFIG_MSM_BUS_SCALING
2182 msm_fb_register_device("dtv", &dtv_pdata);
2183#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002184}
2185
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002186static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2187 .func = GPIOMUX_FUNC_GPIO,
2188 .drv = GPIOMUX_DRV_2MA,
2189 .pull = GPIOMUX_PULL_DOWN,
2190};
2191
2192static struct gpiomux_setting mdp_vsync_active_cfg = {
2193 .func = GPIOMUX_FUNC_1,
2194 .drv = GPIOMUX_DRV_2MA,
2195 .pull = GPIOMUX_PULL_DOWN,
2196};
2197
2198static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2199 {
2200 .gpio = MDP_VSYNC_GPIO,
2201 .settings = {
2202 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2203 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2204 },
2205 }
2206};
2207
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002208#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2209static struct gpiomux_setting hdmi_suspend_cfg = {
2210 .func = GPIOMUX_FUNC_GPIO,
2211 .drv = GPIOMUX_DRV_2MA,
2212 .pull = GPIOMUX_PULL_DOWN,
2213};
2214
2215static struct gpiomux_setting hdmi_active_1_cfg = {
2216 .func = GPIOMUX_FUNC_1,
2217 .drv = GPIOMUX_DRV_2MA,
2218 .pull = GPIOMUX_PULL_UP,
2219};
2220
2221static struct gpiomux_setting hdmi_active_2_cfg = {
2222 .func = GPIOMUX_FUNC_1,
2223 .drv = GPIOMUX_DRV_2MA,
2224 .pull = GPIOMUX_PULL_DOWN,
2225};
2226
2227static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2228 {
2229 .gpio = 99,
2230 .settings = {
2231 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2232 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2233 },
2234 },
2235 {
2236 .gpio = 100,
2237 .settings = {
2238 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2239 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2240 },
2241 },
2242 {
2243 .gpio = 101,
2244 .settings = {
2245 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2246 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2247 },
2248 },
2249 {
2250 .gpio = 102,
2251 .settings = {
2252 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2253 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2254 },
2255 },
2256};
2257
2258static int hdmi_enable_5v(int on)
2259{
2260 /* TBD: PM8921 regulator instead of 8901 */
2261 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2262 static int prev_on;
2263 int rc;
2264
2265 if (on == prev_on)
2266 return 0;
2267
2268 if (!reg_8921_hdmi_mvs)
2269 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2270 "hdmi_mvs");
2271
2272 if (on) {
2273 rc = regulator_enable(reg_8921_hdmi_mvs);
2274 if (rc) {
2275 pr_err("'%s' regulator enable failed, rc=%d\n",
2276 "8921_hdmi_mvs", rc);
2277 return rc;
2278 }
2279 pr_debug("%s(on): success\n", __func__);
2280 } else {
2281 rc = regulator_disable(reg_8921_hdmi_mvs);
2282 if (rc)
2283 pr_warning("'%s' regulator disable failed, rc=%d\n",
2284 "8921_hdmi_mvs", rc);
2285 pr_debug("%s(off): success\n", __func__);
2286 }
2287
2288 prev_on = on;
2289
2290 return 0;
2291}
2292
2293static int hdmi_core_power(int on, int show)
2294{
2295 static struct regulator *reg_8921_l23, *reg_8921_s4;
2296 static int prev_on;
2297 int rc;
2298
2299 if (on == prev_on)
2300 return 0;
2301
2302 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002303 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002304 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002305 if (IS_ERR(reg_8921_l23)) {
2306 pr_err("could not get reg_8921_l23, rc = %ld\n",
2307 PTR_ERR(reg_8921_l23));
2308 return -ENODEV;
2309 }
2310 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2311 if (rc) {
2312 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2313 return -EINVAL;
2314 }
2315 }
2316 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002317 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002318 if (IS_ERR(reg_8921_s4)) {
2319 pr_err("could not get reg_8921_s4, rc = %ld\n",
2320 PTR_ERR(reg_8921_s4));
2321 return -ENODEV;
2322 }
2323 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2324 if (rc) {
2325 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2326 return -EINVAL;
2327 }
2328 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002329
2330 if (on) {
2331 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2332 if (rc < 0) {
2333 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2334 return -EINVAL;
2335 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002336 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002337 if (rc) {
2338 pr_err("'%s' regulator enable failed, rc=%d\n",
2339 "hdmi_avdd", rc);
2340 return rc;
2341 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002342 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002343 if (rc) {
2344 pr_err("'%s' regulator enable failed, rc=%d\n",
2345 "hdmi_vcc", rc);
2346 return rc;
2347 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002348 rc = gpio_request(100, "HDMI_DDC_CLK");
2349 if (rc) {
2350 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2351 "HDMI_DDC_CLK", 100, rc);
2352 goto error1;
2353 }
2354 rc = gpio_request(101, "HDMI_DDC_DATA");
2355 if (rc) {
2356 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2357 "HDMI_DDC_DATA", 101, rc);
2358 goto error2;
2359 }
2360 rc = gpio_request(102, "HDMI_HPD");
2361 if (rc) {
2362 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2363 "HDMI_HPD", 102, rc);
2364 goto error3;
2365 }
2366 pr_debug("%s(on): success\n", __func__);
2367 } else {
2368 gpio_free(100);
2369 gpio_free(101);
2370 gpio_free(102);
2371
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002372 rc = regulator_disable(reg_8921_l23);
2373 if (rc) {
2374 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2375 return -ENODEV;
2376 }
2377 rc = regulator_disable(reg_8921_s4);
2378 if (rc) {
2379 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2380 return -ENODEV;
2381 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002382 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2383 if (rc < 0) {
2384 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2385 return -EINVAL;
2386 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002387 pr_debug("%s(off): success\n", __func__);
2388 }
2389
2390 prev_on = on;
2391
2392 return 0;
2393
2394error3:
2395 gpio_free(101);
2396error2:
2397 gpio_free(100);
2398error1:
2399 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002400 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002401 return rc;
2402}
2403
2404static int hdmi_cec_power(int on)
2405{
2406 static int prev_on;
2407 int rc;
2408
2409 if (on == prev_on)
2410 return 0;
2411
2412 if (on) {
2413 rc = gpio_request(99, "HDMI_CEC_VAR");
2414 if (rc) {
2415 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2416 "HDMI_CEC_VAR", 99, rc);
2417 goto error;
2418 }
2419 pr_debug("%s(on): success\n", __func__);
2420 } else {
2421 gpio_free(99);
2422 pr_debug("%s(off): success\n", __func__);
2423 }
2424
2425 prev_on = on;
2426
2427 return 0;
2428error:
2429 return rc;
2430}
2431#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2432
2433static void __init msm8960_allocate_memory_regions(void)
2434{
2435 void *addr;
2436 unsigned long size;
2437
2438 size = MSM_FB_SIZE;
2439 addr = alloc_bootmem_align(size, 0x1000);
2440 msm_fb_resources[0].start = __pa(addr);
2441 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2442 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2443 size, addr, __pa(addr));
2444
2445}
2446#ifdef CONFIG_WCD9310_CODEC
2447
2448#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2449
Patrick Lai3043fba2011-08-01 14:15:57 -07002450/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2451 * 4 micbiases are used to power various analog and digital
2452 * microphones operating at 1800 mV. Technically, all micbiases
2453 * can source from single cfilter since all microphones operate
2454 * at the same voltage level. The arrangement below is to make
2455 * sure all cfilters are exercised. LDO_H regulator ouput level
2456 * does not need to be as high as 2.85V. It is choosen for
2457 * microphone sensitivity purpose.
2458 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002459static struct tabla_pdata tabla_platform_data = {
2460 .slimbus_slave_device = {
2461 .name = "tabla-slave",
2462 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2463 },
2464 .irq = MSM_GPIO_TO_INT(62),
2465 .irq_base = TABLA_INTERRUPT_BASE,
2466 .num_irqs = NR_TABLA_IRQS,
2467 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002468 .micbias = {
2469 .ldoh_v = TABLA_LDOH_2P85_V,
2470 .cfilt1_mv = 1800,
2471 .cfilt2_mv = 1800,
2472 .cfilt3_mv = 1800,
2473 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2474 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2475 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2476 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2477 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002478};
2479
2480static struct slim_device msm_slim_tabla = {
2481 .name = "tabla-slim",
2482 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2483 .dev = {
2484 .platform_data = &tabla_platform_data,
2485 },
2486};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302487
2488static struct tabla_pdata tabla20_platform_data = {
2489 .slimbus_slave_device = {
2490 .name = "tabla-slave",
2491 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2492 },
2493 .irq = MSM_GPIO_TO_INT(62),
2494 .irq_base = TABLA_INTERRUPT_BASE,
2495 .num_irqs = NR_TABLA_IRQS,
2496 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2497 .micbias = {
2498 .ldoh_v = TABLA_LDOH_2P85_V,
2499 .cfilt1_mv = 1800,
2500 .cfilt2_mv = 1800,
2501 .cfilt3_mv = 1800,
2502 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2503 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2504 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2505 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2506 }
2507};
2508
2509static struct slim_device msm_slim_tabla20 = {
2510 .name = "tabla2x-slim",
2511 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2512 .dev = {
2513 .platform_data = &tabla20_platform_data,
2514 },
2515};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002516#endif
2517
2518static struct slim_boardinfo msm_slim_devices[] = {
2519#ifdef CONFIG_WCD9310_CODEC
2520 {
2521 .bus_num = 1,
2522 .slim_slave = &msm_slim_tabla,
2523 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302524 {
2525 .bus_num = 1,
2526 .slim_slave = &msm_slim_tabla20,
2527 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002528#endif
2529 /* add more slimbus slaves as needed */
2530};
2531
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002532#define MSM_WCNSS_PHYS 0x03000000
2533#define MSM_WCNSS_SIZE 0x280000
2534
2535static struct resource resources_wcnss_wlan[] = {
2536 {
2537 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2538 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2539 .name = "wcnss_wlanrx_irq",
2540 .flags = IORESOURCE_IRQ,
2541 },
2542 {
2543 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2544 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2545 .name = "wcnss_wlantx_irq",
2546 .flags = IORESOURCE_IRQ,
2547 },
2548 {
2549 .start = MSM_WCNSS_PHYS,
2550 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2551 .name = "wcnss_mmio",
2552 .flags = IORESOURCE_MEM,
2553 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002554 {
2555 .start = 84,
2556 .end = 88,
2557 .name = "wcnss_gpios_5wire",
2558 .flags = IORESOURCE_IO,
2559 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002560};
2561
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002562static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2563 .has_48mhz_xo = 1,
2564};
2565
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002566static struct platform_device msm_device_wcnss_wlan = {
2567 .name = "wcnss_wlan",
2568 .id = 0,
2569 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2570 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002571 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002572};
2573
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002574#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2575 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2576 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2577 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2578
2579#define QCE_SIZE 0x10000
2580#define QCE_0_BASE 0x18500000
2581
2582#define QCE_HW_KEY_SUPPORT 0
2583#define QCE_SHA_HMAC_SUPPORT 1
2584#define QCE_SHARE_CE_RESOURCE 1
2585#define QCE_CE_SHARED 0
2586
2587static struct resource qcrypto_resources[] = {
2588 [0] = {
2589 .start = QCE_0_BASE,
2590 .end = QCE_0_BASE + QCE_SIZE - 1,
2591 .flags = IORESOURCE_MEM,
2592 },
2593 [1] = {
2594 .name = "crypto_channels",
2595 .start = DMOV_CE_IN_CHAN,
2596 .end = DMOV_CE_OUT_CHAN,
2597 .flags = IORESOURCE_DMA,
2598 },
2599 [2] = {
2600 .name = "crypto_crci_in",
2601 .start = DMOV_CE_IN_CRCI,
2602 .end = DMOV_CE_IN_CRCI,
2603 .flags = IORESOURCE_DMA,
2604 },
2605 [3] = {
2606 .name = "crypto_crci_out",
2607 .start = DMOV_CE_OUT_CRCI,
2608 .end = DMOV_CE_OUT_CRCI,
2609 .flags = IORESOURCE_DMA,
2610 },
2611};
2612
2613static struct resource qcedev_resources[] = {
2614 [0] = {
2615 .start = QCE_0_BASE,
2616 .end = QCE_0_BASE + QCE_SIZE - 1,
2617 .flags = IORESOURCE_MEM,
2618 },
2619 [1] = {
2620 .name = "crypto_channels",
2621 .start = DMOV_CE_IN_CHAN,
2622 .end = DMOV_CE_OUT_CHAN,
2623 .flags = IORESOURCE_DMA,
2624 },
2625 [2] = {
2626 .name = "crypto_crci_in",
2627 .start = DMOV_CE_IN_CRCI,
2628 .end = DMOV_CE_IN_CRCI,
2629 .flags = IORESOURCE_DMA,
2630 },
2631 [3] = {
2632 .name = "crypto_crci_out",
2633 .start = DMOV_CE_OUT_CRCI,
2634 .end = DMOV_CE_OUT_CRCI,
2635 .flags = IORESOURCE_DMA,
2636 },
2637};
2638
2639#endif
2640
2641#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2642 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2643
2644static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2645 .ce_shared = QCE_CE_SHARED,
2646 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2647 .hw_key_support = QCE_HW_KEY_SUPPORT,
2648 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2649};
2650
2651static struct platform_device qcrypto_device = {
2652 .name = "qcrypto",
2653 .id = 0,
2654 .num_resources = ARRAY_SIZE(qcrypto_resources),
2655 .resource = qcrypto_resources,
2656 .dev = {
2657 .coherent_dma_mask = DMA_BIT_MASK(32),
2658 .platform_data = &qcrypto_ce_hw_suppport,
2659 },
2660};
2661#endif
2662
2663#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2664 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2665
2666static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2667 .ce_shared = QCE_CE_SHARED,
2668 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2669 .hw_key_support = QCE_HW_KEY_SUPPORT,
2670 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2671};
2672
2673static struct platform_device qcedev_device = {
2674 .name = "qce",
2675 .id = 0,
2676 .num_resources = ARRAY_SIZE(qcedev_resources),
2677 .resource = qcedev_resources,
2678 .dev = {
2679 .coherent_dma_mask = DMA_BIT_MASK(32),
2680 .platform_data = &qcedev_ce_hw_suppport,
2681 },
2682};
2683#endif
2684
2685
2686static int __init gpiomux_init(void)
2687{
2688 int rc;
2689
2690 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2691 if (rc) {
2692 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2693 return rc;
2694 }
2695
Nishant Pandit24153d82011-08-27 16:05:13 +05302696 msm_gpiomux_install(msm8960_cam_common_configs,
2697 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002698
2699 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002700 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002701
2702 msm_gpiomux_install(msm8960_gsbi_configs,
2703 ARRAY_SIZE(msm8960_gsbi_configs));
2704
2705 msm_gpiomux_install(msm8960_cyts_configs,
2706 ARRAY_SIZE(msm8960_cyts_configs));
2707
2708 msm_gpiomux_install(msm8960_slimbus_config,
2709 ARRAY_SIZE(msm8960_slimbus_config));
2710
2711 msm_gpiomux_install(msm8960_audio_codec_configs,
2712 ARRAY_SIZE(msm8960_audio_codec_configs));
2713
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002714 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2715 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2716
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002717#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2718 msm_gpiomux_install(msm8960_hdmi_configs,
2719 ARRAY_SIZE(msm8960_hdmi_configs));
2720#endif
2721
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002722 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2723 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2724
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002725 msm_gpiomux_install(wcnss_5wire_interface,
2726 ARRAY_SIZE(wcnss_5wire_interface));
2727
Mohan Pallaka5e490392011-09-09 15:18:41 +05302728 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2729 machine_is_msm8960_liquid() || machine_is_msm8960_cdp())
2730 msm_gpiomux_install(hap_lvl_shft_config,
2731 ARRAY_SIZE(hap_lvl_shft_config));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002732 return 0;
2733}
2734
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002735#define MSM_SHARED_RAM_PHYS 0x80000000
2736
2737static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2738 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2739 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2740 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2741 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2742 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2743 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2744 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2745 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2746 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2747 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2748 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2749 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002750 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2751 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2752 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2753 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2754 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2755 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2756 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2757 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2758 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2759 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2760 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2761 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2762 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2763 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002764 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002765 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2766 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2767 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002768 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2769 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002770};
2771
2772static struct pm8921_adc_properties pm8921_adc_data = {
2773 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2774 .bitresolution = 15,
2775 .bipolar = 0,
2776};
2777
2778static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2779 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002780 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002781 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002782 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002783};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002784
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002785static void __init msm8960_map_io(void)
2786{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002787 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002788 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002789
2790 if (socinfo_init() < 0)
2791 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002792}
2793
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002794#ifdef CONFIG_ARCH_MSM8930
2795static void __init msm8930_map_io(void)
2796{
2797 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2798 msm_map_msm8930_io();
2799
2800 if (socinfo_init() < 0)
2801 pr_err("socinfo_init() failed!\n");
2802}
2803#endif
2804
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002805static void __init msm8960_init_irq(void)
2806{
2807 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002808
2809 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002810 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002811 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002812
2813 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002814 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002815
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002816 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2817 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002818
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002819 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2820 * as they are configured as level, which does not play nice with
2821 * handle_percpu_irq.
2822 */
2823 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2824 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002825 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002826 }
2827}
2828
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002829/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002830enum sdcc_controllers {
2831 SDCC1,
2832 SDCC2,
2833 SDCC3,
2834 SDCC4,
2835 SDCC5,
2836 MAX_SDCC_CONTROLLER
2837};
2838
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002839/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002840static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2841 /* SDCC1 : eMMC card connected */
2842 [SDCC1] = {
2843 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302844 .high_vol_level = 2950000,
2845 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05302846 .always_on = 1,
2847 .lpm_sup = 1,
2848 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002849 .hpm_uA = 200000, /* 200mA */
2850 },
2851 /* SDCC3 : External card slot connected */
2852 [SDCC3] = {
2853 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302854 .high_vol_level = 2950000,
2855 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002856 .hpm_uA = 600000, /* 600mA */
2857 }
2858};
2859
2860/* Only slots having eMMC card will require VCCQ voltage */
2861static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2862 /* SDCC1 : eMMC card connected */
2863 [SDCC1] = {
2864 .name = "sdc_vccq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002865 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302866 .high_vol_level = 1800000,
2867 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002868 .hpm_uA = 200000, /* 200mA */
2869 }
2870};
2871
2872/* All SDCC controllers may require voting for VDD PAD voltage */
2873static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2874 /* SDCC3 : External card slot connected */
2875 [SDCC3] = {
2876 .name = "sdc_vddp",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302877 .high_vol_level = 2950000,
2878 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002879 .always_on = 1,
2880 .lpm_sup = 1,
2881 /* Max. Active current required is 16 mA */
2882 .hpm_uA = 16000,
2883 /*
2884 * Sleep current required is ~300 uA. But min. vote can be
2885 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2886 * during sleep.
2887 */
2888 .lpm_uA = 2000,
2889 }
2890};
2891
2892static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2893 /* SDCC1 : eMMC card connected */
2894 [SDCC1] = {
2895 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2896 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2897 },
2898 /* SDCC3 : External card slot connected */
2899 [SDCC3] = {
2900 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2901 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2902 }
2903};
2904
2905/* SDC1 pad data */
2906static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2907 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302908 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2909 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002910};
2911
2912static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2913 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2914 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2915 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2916};
2917
2918static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302919 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002920 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2921 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2922};
2923
2924static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302925 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002926 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2927 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2928};
2929
2930/* SDC3 pad data */
2931static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2932 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2933 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2934 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2935};
2936
2937static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2938 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2939 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2940 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2941};
2942
2943static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302944 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002945 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2946 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2947};
2948
2949static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302950 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302951 /*
2952 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2953 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2954 * which would result in false card detection interrupts.
2955 */
2956 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2957 /*
2958 * Keeping DATA lines status to PULL UP will make sure that
2959 * there is no current leak during sleep if external pull up
2960 * is connected to DATA lines.
2961 */
2962 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002963};
2964
2965struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2966 [SDCC1] = {
2967 .on = sdc1_pad_pull_on_cfg,
2968 .off = sdc1_pad_pull_off_cfg,
2969 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2970 },
2971 [SDCC3] = {
2972 .on = sdc3_pad_pull_on_cfg,
2973 .off = sdc3_pad_pull_off_cfg,
2974 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2975 },
2976};
2977
2978struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2979 [SDCC1] = {
2980 .on = sdc1_pad_drv_on_cfg,
2981 .off = sdc1_pad_drv_off_cfg,
2982 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2983 },
2984 [SDCC3] = {
2985 .on = sdc3_pad_drv_on_cfg,
2986 .off = sdc3_pad_drv_off_cfg,
2987 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2988 },
2989};
2990
2991struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2992 [SDCC1] = {
2993 .pull = &mmc_pad_pull_data[SDCC1],
2994 .drv = &mmc_pad_drv_data[SDCC1]
2995 },
2996 [SDCC3] = {
2997 .pull = &mmc_pad_pull_data[SDCC3],
2998 .drv = &mmc_pad_drv_data[SDCC3]
2999 },
3000};
3001
3002struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
3003 [SDCC1] = {
3004 .pad_data = &mmc_pad_data[SDCC1],
3005 },
3006 [SDCC3] = {
3007 .pad_data = &mmc_pad_data[SDCC3],
3008 },
3009};
3010
3011static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303012 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003013};
3014
3015static unsigned int sdc3_sup_clk_rates[] = {
3016 400000, 24000000, 48000000, 96000000
3017};
3018
3019#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3020static struct mmc_platform_data msm8960_sdc1_data = {
3021 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3022#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
3023 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
3024#else
3025 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3026#endif
3027 .sup_clk_table = sdc1_sup_clk_rates,
3028 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303029 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003030 .nonremovable = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003031 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303032 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003033};
3034#endif
3035
3036#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3037static struct mmc_platform_data msm8960_sdc3_data = {
3038 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3039 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3040 .sup_clk_table = sdc3_sup_clk_rates,
3041 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303042 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303043#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003044 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303045#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003046 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3047 .pin_data = &mmc_slot_pin_data[SDCC3],
3048#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3049 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3050 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3051 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3052#endif
3053 .xpc_cap = 1,
3054 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3055 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303056 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003057};
3058#endif
3059
3060static void __init msm8960_init_mmc(void)
3061{
3062#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3063 /* SDC1 : eMMC card connected */
3064 msm_add_sdcc(1, &msm8960_sdc1_data);
3065#endif
3066#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3067 /* SDC3: External card slot */
3068 msm_add_sdcc(3, &msm8960_sdc3_data);
3069#endif
3070}
3071
3072static void __init msm8960_init_buses(void)
3073{
3074#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003075 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003076 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3077 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3078 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3079 msm_bus_apps_fabric.dev.platform_data =
3080 &msm_bus_8960_apps_fabric_pdata;
3081 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3082 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3083 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3084 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003085#endif
3086}
3087
3088static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3089 .max_clock_speed = 15060000,
3090};
3091
3092#ifdef CONFIG_USB_MSM_OTG_72K
3093static struct msm_otg_platform_data msm_otg_pdata;
3094#else
3095#define USB_5V_EN 42
3096static void msm_hsusb_vbus_power(bool on)
3097{
3098 int rc;
3099 static bool vbus_is_on;
3100 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003101
3102 if (vbus_is_on == on)
3103 return;
3104
3105 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003106 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3107 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003108 if (IS_ERR(mvs_otg_switch)) {
3109 pr_err("Unable to get mvs_otg_switch\n");
3110 return;
3111 }
3112
3113 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3114 "usb_5v_en");
3115 if (rc < 0) {
3116 pr_err("failed to request usb_5v_en gpio\n");
3117 goto put_mvs_otg;
3118 }
3119
Anji jonnala2936fd92011-11-09 15:39:22 +05303120 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3121 if (rc) {
3122 pr_err("%s: unable to set_direction for gpio [%d]\n",
3123 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003124 goto free_usb_5v_en;
3125 }
3126
Anji jonnala2936fd92011-11-09 15:39:22 +05303127 if (regulator_enable(mvs_otg_switch)) {
3128 pr_err("unable to enable mvs_otg_switch\n");
3129 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003130 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303131
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003132 vbus_is_on = true;
3133 return;
3134 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303135 regulator_disable(mvs_otg_switch);
3136err_ldo_gpio_set_dir:
3137 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003138free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303139 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003140put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303141 regulator_put(mvs_otg_switch);
3142 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003143}
3144
3145static struct msm_otg_platform_data msm_otg_pdata = {
3146 .mode = USB_OTG,
3147 .otg_control = OTG_PMIC_CONTROL,
3148 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3149 .pclk_src_name = "dfab_usb_hs_clk",
3150 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3151 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303152 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003153};
3154#endif
3155
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303156#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303157#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303158static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3159 .strobe = 150,
3160 .data = 151,
3161};
3162#else
3163static struct msm_hsic_host_platform_data msm_hsic_pdata;
3164#endif
3165
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003166#define PID_MAGIC_ID 0x71432909
3167#define SERIAL_NUM_MAGIC_ID 0x61945374
3168#define SERIAL_NUMBER_LENGTH 127
3169#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3170
3171struct magic_num_struct {
3172 uint32_t pid;
3173 uint32_t serial_num;
3174};
3175
3176struct dload_struct {
3177 uint32_t reserved1;
3178 uint32_t reserved2;
3179 uint32_t reserved3;
3180 uint16_t reserved4;
3181 uint16_t pid;
3182 char serial_number[SERIAL_NUMBER_LENGTH];
3183 uint16_t reserved5;
3184 struct magic_num_struct magic_struct;
3185};
3186
3187static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3188{
3189 struct dload_struct __iomem *dload = 0;
3190
3191 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3192 if (!dload) {
3193 pr_err("%s: cannot remap I/O memory region: %08x\n",
3194 __func__, DLOAD_USB_BASE_ADD);
3195 return -ENXIO;
3196 }
3197
3198 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3199 __func__, dload, pid, snum);
3200 /* update pid */
3201 dload->magic_struct.pid = PID_MAGIC_ID;
3202 dload->pid = pid;
3203
3204 /* update serial number */
3205 dload->magic_struct.serial_num = 0;
3206 if (!snum) {
3207 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3208 goto out;
3209 }
3210
3211 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003212 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003213out:
3214 iounmap(dload);
3215 return 0;
3216}
3217
3218static struct android_usb_platform_data android_usb_pdata = {
3219 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3220};
3221
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003222static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003223 .name = "android_usb",
3224 .id = -1,
3225 .dev = {
3226 .platform_data = &android_usb_pdata,
3227 },
3228};
3229
3230static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3231 0x03, 0x0f,
3232};
3233
3234static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3235 0x00, 0x24, 0x54, 0x10,
3236 0x09, 0x03, 0x01,
3237 0x10, 0x54, 0x30, 0x0C,
3238 0x24, 0x30, 0x0f,
3239};
3240
3241static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3242 0x00, 0x24, 0x54, 0x10,
3243 0x09, 0x07, 0x01, 0x0B,
3244 0x10, 0x54, 0x30, 0x0C,
3245 0x24, 0x30, 0x0f,
3246};
3247
3248static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3249 [0] = {
3250 .mode = MSM_SPM_MODE_CLOCK_GATING,
3251 .notify_rpm = false,
3252 .cmd = spm_wfi_cmd_sequence,
3253 },
3254 [1] = {
3255 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3256 .notify_rpm = false,
3257 .cmd = spm_power_collapse_without_rpm,
3258 },
3259 [2] = {
3260 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3261 .notify_rpm = true,
3262 .cmd = spm_power_collapse_with_rpm,
3263 },
3264};
3265
3266static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3267 [0] = {
3268 .reg_base_addr = MSM_SAW0_BASE,
3269 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3270 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3271 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3272#if defined(CONFIG_MSM_AVS_HW)
3273 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3274 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3275#endif
3276 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3277 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3278 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3279 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3280 .vctl_timeout_us = 50,
3281 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3282 .modes = msm_spm_seq_list,
3283 },
3284 [1] = {
3285 .reg_base_addr = MSM_SAW1_BASE,
3286 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3287 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3288 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3289#if defined(CONFIG_MSM_AVS_HW)
3290 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3291 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3292#endif
3293 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3294 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3295 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3296 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3297 .vctl_timeout_us = 50,
3298 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3299 .modes = msm_spm_seq_list,
3300 },
3301};
3302
3303static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3304 0x00, 0x20, 0x03, 0x20,
3305 0x00, 0x0f,
3306};
3307
3308static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3309 0x00, 0x20, 0x34, 0x64,
3310 0x48, 0x07, 0x48, 0x20,
3311 0x50, 0x64, 0x04, 0x34,
3312 0x50, 0x0f,
3313};
3314static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3315 0x00, 0x10, 0x34, 0x64,
3316 0x48, 0x07, 0x48, 0x10,
3317 0x50, 0x64, 0x04, 0x34,
3318 0x50, 0x0F,
3319};
3320
3321static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3322 [0] = {
3323 .mode = MSM_SPM_L2_MODE_RETENTION,
3324 .notify_rpm = false,
3325 .cmd = l2_spm_wfi_cmd_sequence,
3326 },
3327 [1] = {
3328 .mode = MSM_SPM_L2_MODE_GDHS,
3329 .notify_rpm = true,
3330 .cmd = l2_spm_gdhs_cmd_sequence,
3331 },
3332 [2] = {
3333 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3334 .notify_rpm = true,
3335 .cmd = l2_spm_power_off_cmd_sequence,
3336 },
3337};
3338
3339
3340static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3341 [0] = {
3342 .reg_base_addr = MSM_SAW_L2_BASE,
3343 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3344 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3345 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3346 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3347 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3348 .modes = msm_spm_l2_seq_list,
3349 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3350 },
3351};
3352
Mohan Pallaka5e490392011-09-09 15:18:41 +05303353#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
3354#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
3355
3356static struct msm_xo_voter *xo_handle_d1;
3357
3358static int isa1200_power(int on)
3359{
3360 int rc = 0;
3361
3362 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
3363
3364 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
3365 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
3366 if (rc < 0) {
3367 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
3368 __func__, on ? "" : "de-", rc);
3369 goto err_xo_vote;
3370 }
3371
3372 return 0;
3373
3374err_xo_vote:
3375 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
3376 return rc;
3377}
3378
3379static int isa1200_dev_setup(bool enable)
3380{
3381 int rc = 0;
3382
3383 struct pm_gpio hap_gpio_config = {
3384 .direction = PM_GPIO_DIR_OUT,
3385 .pull = PM_GPIO_PULL_NO,
3386 .out_strength = PM_GPIO_STRENGTH_HIGH,
3387 .function = PM_GPIO_FUNC_NORMAL,
3388 .inv_int_pol = 0,
3389 .vin_sel = 2,
3390 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3391 .output_value = 0,
3392 };
3393
3394 if (enable == true) {
3395 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
3396 if (rc) {
3397 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3398 __func__, PM_HAP_EN_GPIO, rc);
3399 return rc;
3400 }
3401
3402 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
3403 if (rc) {
3404 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3405 __func__, PM_HAP_LEN_GPIO, rc);
3406 return rc;
3407 }
3408
3409 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
3410 if (rc) {
3411 pr_err("%s: unable to request gpio %d (%d)\n",
3412 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
3413 return rc;
3414 }
3415
3416 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
3417 if (rc) {
3418 pr_err("%s: Unable to set direction\n", __func__);
3419 goto free_gpio;
3420 }
3421
3422 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
3423 if (IS_ERR(xo_handle_d1)) {
3424 rc = PTR_ERR(xo_handle_d1);
3425 pr_err("%s: failed to get the handle for D1(%d)\n",
3426 __func__, rc);
3427 goto gpio_set_dir;
3428 }
3429 } else {
3430 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3431
3432 msm_xo_put(xo_handle_d1);
3433 }
3434
3435 return 0;
3436
3437gpio_set_dir:
3438 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
3439free_gpio:
3440 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3441 return rc;
3442}
3443
3444static struct isa1200_regulator isa1200_reg_data[] = {
3445 {
3446 .name = "vcc_i2c",
3447 .min_uV = ISA_I2C_VTG_MIN_UV,
3448 .max_uV = ISA_I2C_VTG_MAX_UV,
3449 .load_uA = ISA_I2C_CURR_UA,
3450 },
3451};
3452
3453static struct isa1200_platform_data isa1200_1_pdata = {
3454 .name = "vibrator",
3455 .dev_setup = isa1200_dev_setup,
3456 .power_on = isa1200_power,
3457 .hap_en_gpio = PM_HAP_EN_GPIO,
3458 .hap_len_gpio = PM_HAP_LEN_GPIO,
3459 .max_timeout = 15000,
3460 .mode_ctrl = PWM_GEN_MODE,
3461 .pwm_fd = {
3462 .pwm_div = 256,
3463 },
3464 .is_erm = false,
3465 .smart_en = true,
3466 .ext_clk_en = true,
3467 .chip_en = 1,
3468 .regulator_info = isa1200_reg_data,
3469 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
3470};
3471
3472static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
3473 {
3474 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
3475 .platform_data = &isa1200_1_pdata,
3476 },
3477};
3478
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003479#define CYTTSP_TS_GPIO_IRQ 11
3480#define CYTTSP_TS_SLEEP_GPIO 50
3481#define CYTTSP_TS_RESOUT_N_GPIO 52
3482
3483/*virtual key support */
3484static ssize_t tma340_vkeys_show(struct kobject *kobj,
3485 struct kobj_attribute *attr, char *buf)
3486{
3487 return snprintf(buf, 200,
3488 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3489 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3490 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3491 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3492 "\n");
3493}
3494
3495static struct kobj_attribute tma340_vkeys_attr = {
3496 .attr = {
3497 .mode = S_IRUGO,
3498 },
3499 .show = &tma340_vkeys_show,
3500};
3501
3502static struct attribute *tma340_properties_attrs[] = {
3503 &tma340_vkeys_attr.attr,
3504 NULL
3505};
3506
3507static struct attribute_group tma340_properties_attr_group = {
3508 .attrs = tma340_properties_attrs,
3509};
3510
3511
3512static int cyttsp_platform_init(struct i2c_client *client)
3513{
3514 int rc = 0;
3515 static struct kobject *tma340_properties_kobj;
3516
3517 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3518 tma340_properties_kobj = kobject_create_and_add("board_properties",
3519 NULL);
3520 if (tma340_properties_kobj)
3521 rc = sysfs_create_group(tma340_properties_kobj,
3522 &tma340_properties_attr_group);
3523 if (!tma340_properties_kobj || rc)
3524 pr_err("%s: failed to create board_properties\n",
3525 __func__);
3526
3527 return 0;
3528}
3529
3530static struct cyttsp_regulator regulator_data[] = {
3531 {
3532 .name = "vdd",
3533 .min_uV = CY_TMA300_VTG_MIN_UV,
3534 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303535 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3536 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003537 },
3538 /* TODO: Remove after runtime PM is enabled in I2C driver */
3539 {
3540 .name = "vcc_i2c",
3541 .min_uV = CY_I2C_VTG_MIN_UV,
3542 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303543 .hpm_load_uA = CY_I2C_CURR_UA,
3544 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003545 },
3546};
3547
3548static struct cyttsp_platform_data cyttsp_pdata = {
3549 .panel_maxx = 634,
3550 .panel_maxy = 1166,
3551 .disp_maxx = 616,
3552 .disp_maxy = 1023,
3553 .disp_minx = 0,
3554 .disp_miny = 16,
3555 .flags = 0x01,
3556 .gen = CY_GEN3, /* or */
3557 .use_st = CY_USE_ST,
3558 .use_mt = CY_USE_MT,
3559 .use_hndshk = CY_SEND_HNDSHK,
3560 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303561 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003562 .use_gestures = CY_USE_GESTURES,
3563 .fw_fname = "cyttsp_8960_cdp.hex",
3564 /* activate up to 4 groups
3565 * and set active distance
3566 */
3567 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3568 CY_GEST_GRP3 | CY_GEST_GRP4 |
3569 CY_ACT_DIST,
3570 /* change act_intrvl to customize the Active power state
3571 * scanning/processing refresh interval for Operating mode
3572 */
3573 .act_intrvl = CY_ACT_INTRVL_DFLT,
3574 /* change tch_tmout to customize the touch timeout for the
3575 * Active power state for Operating mode
3576 */
3577 .tch_tmout = CY_TCH_TMOUT_DFLT,
3578 /* change lp_intrvl to customize the Low Power power state
3579 * scanning/processing refresh interval for Operating mode
3580 */
3581 .lp_intrvl = CY_LP_INTRVL_DFLT,
3582 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3583 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3584 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3585 .regulator_info = regulator_data,
3586 .num_regulators = ARRAY_SIZE(regulator_data),
3587 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303588 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003589};
3590
3591static struct i2c_board_info cyttsp_info[] __initdata = {
3592 {
3593 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3594 .platform_data = &cyttsp_pdata,
3595#ifndef CY_USE_TIMER
3596 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3597#endif /* CY_USE_TIMER */
3598 },
3599};
3600
Mohan Pallaka50837382011-09-07 11:00:57 +05303601/* configuration data */
3602static const u8 mxt_config_data[] = {
3603 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003604 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303605 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003606 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3607 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3608 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3609 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3610 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3611 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3612 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303613 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003614 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303615 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003616 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303617 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003618 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3619 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3620 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3621 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303622 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003623 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3624 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303625 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003626 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3627 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303628 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003629 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3630 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303631 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003632 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3633 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303634 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003635 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303636 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003637 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303638 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003639 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303640 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003641 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303642 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003643 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303644};
3645
3646#define MXT_TS_GPIO_IRQ 11
3647#define MXT_TS_LDO_EN_GPIO 50
3648#define MXT_TS_RESET_GPIO 52
3649
3650static void mxt_init_hw_liquid(void)
3651{
3652 int rc;
3653
3654 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3655 if (rc) {
3656 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3657 __func__, MXT_TS_GPIO_IRQ);
3658 return;
3659 }
3660
3661 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3662 if (rc) {
3663 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3664 __func__, MXT_TS_GPIO_IRQ);
3665 goto err_irq_gpio_req;
3666 }
3667
3668 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3669 if (rc) {
3670 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3671 __func__, MXT_TS_LDO_EN_GPIO);
3672 goto err_irq_gpio_req;
3673 }
3674
3675 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3676 if (rc) {
3677 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3678 __func__, MXT_TS_LDO_EN_GPIO);
3679 goto err_ldo_gpio_req;
3680 }
3681
3682 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3683 if (rc) {
3684 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3685 __func__, MXT_TS_RESET_GPIO);
3686 goto err_ldo_gpio_set_dir;
3687 }
3688
3689 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3690 if (rc) {
3691 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3692 __func__, MXT_TS_RESET_GPIO);
3693 goto err_reset_gpio_req;
3694 }
3695
3696 return;
3697
3698err_reset_gpio_req:
3699 gpio_free(MXT_TS_RESET_GPIO);
3700err_ldo_gpio_set_dir:
3701 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3702err_ldo_gpio_req:
3703 gpio_free(MXT_TS_LDO_EN_GPIO);
3704err_irq_gpio_req:
3705 gpio_free(MXT_TS_GPIO_IRQ);
3706}
3707
3708static struct mxt_platform_data mxt_platform_data = {
3709 .config = mxt_config_data,
3710 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003711 .x_size = 1365,
3712 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303713 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003714 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303715};
3716
3717static struct i2c_board_info mxt_device_info[] __initdata = {
3718 {
3719 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3720 .platform_data = &mxt_platform_data,
3721 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3722 },
3723};
3724
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003725static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3726{
3727}
3728
3729static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3730 .clk_freq = 100000,
3731 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003732 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3733};
3734
3735static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3736 .clk_freq = 100000,
3737 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003738 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3739};
3740
3741static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3742 .clk_freq = 100000,
3743 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003744 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3745};
3746
3747static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3748 .clk_freq = 100000,
3749 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003750 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3751};
3752
3753static struct msm_rpm_platform_data msm_rpm_data = {
3754 .reg_base_addrs = {
3755 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3756 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3757 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3758 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3759 },
3760
3761 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3762 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3763 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3764 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3765 .msm_apps_ipc_rpm_val = 4,
3766};
3767
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003768static struct ks8851_pdata spi_eth_pdata = {
3769 .irq_gpio = KS8851_IRQ_GPIO,
3770 .rst_gpio = KS8851_RST_GPIO,
3771};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003772
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003773static struct spi_board_info spi_board_info[] __initdata = {
3774 {
3775 .modalias = "ks8851",
3776 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3777 .max_speed_hz = 19200000,
3778 .bus_num = 0,
3779 .chip_select = 0,
3780 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003781 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003782 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003783 {
3784 .modalias = "dsi_novatek_3d_panel_spi",
3785 .max_speed_hz = 10800000,
3786 .bus_num = 0,
3787 .chip_select = 1,
3788 .mode = SPI_MODE_0,
3789 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003790};
3791
3792static struct platform_device msm_device_saw_core0 = {
3793 .name = "saw-regulator",
3794 .id = 0,
3795 .dev = {
3796 .platform_data = &msm_saw_regulator_pdata_s5,
3797 },
3798};
3799
3800static struct platform_device msm_device_saw_core1 = {
3801 .name = "saw-regulator",
3802 .id = 1,
3803 .dev = {
3804 .platform_data = &msm_saw_regulator_pdata_s6,
3805 },
3806};
3807
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003808#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3809static struct platform_device wfd_device = {
3810 .name = "msm_wfd",
3811 .id = -1,
3812};
3813#endif
3814
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003815static struct tsens_platform_data msm_tsens_pdata = {
3816 .slope = 910,
3817 .tsens_factor = 1000,
3818 .hw_type = MSM_8960,
3819 .tsens_num_sensor = 5,
3820};
3821
3822static struct platform_device msm_tsens_device = {
3823 .name = "tsens8960-tm",
3824 .id = -1,
3825 .dev = {
3826 .platform_data = &msm_tsens_pdata,
3827 },
3828};
3829
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003830#ifdef CONFIG_MSM_FAKE_BATTERY
3831static struct platform_device fish_battery_device = {
3832 .name = "fish_battery",
3833};
3834#endif
3835
David Collins26f05562011-06-20 09:56:28 -07003836static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003837 .name = GPIO_REGULATOR_DEV_NAME,
3838 .id = PM8921_MPP_PM_TO_SYS(7),
3839 .dev = {
3840 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3841 },
3842};
3843
David Collins26f05562011-06-20 09:56:28 -07003844static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003845 .name = GPIO_REGULATOR_DEV_NAME,
3846 .id = 91,
3847 .dev = {
3848 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3849 },
3850};
3851
David Collinsb10be1d2011-09-02 10:29:31 -07003852static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3853 .name = GPIO_REGULATOR_DEV_NAME,
3854 .id = PM8921_GPIO_PM_TO_SYS(17),
3855 .dev = {
3856 .platform_data =
3857 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3858 },
3859};
3860
David Collins26f05562011-06-20 09:56:28 -07003861static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3862 .name = "rpm-regulator",
3863 .id = -1,
3864 .dev = {
3865 .platform_data = &msm_rpm_regulator_pdata,
3866 },
3867};
3868
David Collins4c31a872011-08-31 10:07:10 -07003869static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3870 .phys_addr_base = 0x0010C000,
3871 .reg_offsets = {
3872 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3873 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3874 },
3875 .phys_size = SZ_8K,
3876 .log_len = 4096, /* log's buffer length in bytes */
3877 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3878};
3879
3880static struct platform_device msm_rpm_log_device = {
3881 .name = "msm_rpm_log",
3882 .id = -1,
3883 .dev = {
3884 .platform_data = &msm_rpm_log_pdata,
3885 },
3886};
3887
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003888static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003889 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003890 &msm_device_smd,
3891 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303892 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003893 &msm_device_saw_core0,
3894 &msm_device_saw_core1,
3895 &msm8960_device_ext_5v_vreg,
3896 &msm8960_device_ext_l2_vreg,
3897 &msm8960_device_ssbi_pm8921,
3898 &msm8960_device_qup_spi_gsbi1,
3899 &msm8960_device_qup_i2c_gsbi3,
3900 &msm8960_device_qup_i2c_gsbi4,
3901 &msm8960_device_qup_i2c_gsbi10,
3902#ifndef CONFIG_MSM_DSPS
3903 &msm8960_device_qup_i2c_gsbi12,
3904#endif
3905 &msm_slim_ctrl,
3906 &msm_device_wcnss_wlan,
3907#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3908 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3909 &qcrypto_device,
3910#endif
3911
3912#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3913 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3914 &qcedev_device,
3915#endif
3916#ifdef CONFIG_MSM_ROTATOR
3917 &msm_rotator_device,
3918#endif
3919 &msm_device_sps,
3920#ifdef CONFIG_MSM_FAKE_BATTERY
3921 &fish_battery_device,
3922#endif
3923#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003924#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003925 &android_pmem_device,
3926 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003927#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003928 &android_pmem_audio_device,
3929#endif
3930 &msm_fb_device,
3931 &msm_device_vidc,
3932 &msm_device_bam_dmux,
3933 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003934
3935#ifdef CONFIG_HW_RANDOM_MSM
3936 &msm_device_rng,
3937#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003938 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003939#ifdef CONFIG_ION_MSM
3940 &ion_dev,
3941#endif
David Collins4c31a872011-08-31 10:07:10 -07003942 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003943 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003944#ifdef CONFIG_MSM_QDSS
3945 &msm_etb_device,
3946 &msm_tpiu_device,
3947 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07003948 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003949 &msm_ptm_device,
3950#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003951 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003952 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003953#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3954 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003955 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003956#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003957};
3958
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003959static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003960 &msm8960_device_otg,
3961 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003962 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303963 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003964 &android_usb_device,
3965 &msm_device_vidc,
3966 &mipi_dsi_simulator_panel_device,
3967 &msm_bus_apps_fabric,
3968 &msm_bus_sys_fabric,
3969 &msm_bus_mm_fabric,
3970 &msm_bus_sys_fpb,
3971 &msm_bus_cpss_fpb,
3972 &msm_pcm,
3973 &msm_pcm_routing,
3974 &msm_cpudai0,
3975 &msm_cpudai1,
3976 &msm_cpudai_hdmi_rx,
3977 &msm_cpudai_bt_rx,
3978 &msm_cpudai_bt_tx,
3979 &msm_cpudai_fm_rx,
3980 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003981 &msm_cpudai_auxpcm_rx,
3982 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003983 &msm_cpu_fe,
3984 &msm_stub_codec,
3985 &msm_voice,
3986 &msm_voip,
3987 &msm_lpa_pcm,
3988
3989#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3990 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3991 &qcrypto_device,
3992#endif
3993
3994#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3995 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3996 &qcedev_device,
3997#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003998};
3999
4000static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004001 &msm_kgsl_3d0,
4002 &msm_kgsl_2d0,
4003 &msm_kgsl_2d1,
4004 &mipi_dsi_renesas_panel_device,
4005#ifdef CONFIG_MSM_GEMINI
4006 &msm8960_gemini_device,
4007#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004008};
4009
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004010static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004011 &msm8960_device_otg,
4012 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004013 &msm_device_hsusb_host,
4014 &android_usb_device,
4015 &msm_pcm,
4016 &msm_pcm_routing,
4017 &msm_cpudai0,
4018 &msm_cpudai1,
4019 &msm_cpudai_hdmi_rx,
4020 &msm_cpudai_bt_rx,
4021 &msm_cpudai_bt_tx,
4022 &msm_cpudai_fm_rx,
4023 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07004024 &msm_cpudai_auxpcm_rx,
4025 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004026 &msm_cpu_fe,
4027 &msm_stub_codec,
4028 &msm_kgsl_3d0,
4029#ifdef CONFIG_MSM_KGSL_2D
4030 &msm_kgsl_2d0,
4031 &msm_kgsl_2d1,
4032#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07004033 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004034#ifdef CONFIG_MSM_GEMINI
4035 &msm8960_gemini_device,
4036#endif
4037 &msm_voice,
4038 &msm_voip,
4039 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05304040 &msm_cpudai_afe_01_rx,
4041 &msm_cpudai_afe_01_tx,
4042 &msm_cpudai_afe_02_rx,
4043 &msm_cpudai_afe_02_tx,
4044 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004045#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
4046 &hdmi_msm_device,
4047#endif
4048 &msm_pcm_hostless,
4049 &msm_bus_apps_fabric,
4050 &msm_bus_sys_fabric,
4051 &msm_bus_mm_fabric,
4052 &msm_bus_sys_fpb,
4053 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07004054 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004055};
4056
4057static void __init msm8960_i2c_init(void)
4058{
4059 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
4060 &msm8960_i2c_qup_gsbi4_pdata;
4061
4062 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
4063 &msm8960_i2c_qup_gsbi3_pdata;
4064
4065 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
4066 &msm8960_i2c_qup_gsbi10_pdata;
4067
4068 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
4069 &msm8960_i2c_qup_gsbi12_pdata;
4070}
4071
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004072static void __init msm8960_gfx_init(void)
4073{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06004074 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004075 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
4076 struct kgsl_device_platform_data *kgsl_3d0_pdata =
4077 msm_kgsl_3d0.dev.platform_data;
4078 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
4079 320000000;
4080 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
4081 266667000;
4082 }
4083}
4084
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004085static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
4086 .irq_base = PM8921_IRQ_BASE,
4087 .devirq = MSM_GPIO_TO_INT(104),
4088 .irq_trigger_flag = IRQF_TRIGGER_LOW,
4089};
4090
4091static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
4092 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
4093};
4094
4095static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
4096 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
4097};
4098
4099static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
4100 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05304101 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004102};
4103
4104static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
4105 .pull_up = 1,
4106 .kpd_trigger_delay_us = 970,
4107 .wakeup = 1,
4108};
4109
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304110/* Rotate lock key is not available so use F1 */
4111#define KEY_ROTATE_LOCK KEY_F1
4112
4113static const unsigned int keymap_liquid[] = {
4114 KEY(0, 0, KEY_VOLUMEUP),
4115 KEY(0, 1, KEY_VOLUMEDOWN),
4116 KEY(1, 3, KEY_ROTATE_LOCK),
4117 KEY(1, 4, KEY_HOME),
4118};
4119
4120static struct matrix_keymap_data keymap_data_liquid = {
4121 .keymap_size = ARRAY_SIZE(keymap_liquid),
4122 .keymap = keymap_liquid,
4123};
4124
4125static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
4126 .input_name = "keypad_8960_liquid",
4127 .input_phys_device = "keypad_8960/input0",
4128 .num_rows = 2,
4129 .num_cols = 5,
4130 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4131 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4132 .debounce_ms = 15,
4133 .scan_delay_ms = 32,
4134 .row_hold_ns = 91500,
4135 .wakeup = 1,
4136 .keymap_data = &keymap_data_liquid,
4137};
4138
4139
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004140static const unsigned int keymap[] = {
4141 KEY(0, 0, KEY_VOLUMEUP),
4142 KEY(0, 1, KEY_VOLUMEDOWN),
4143 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4144 KEY(0, 3, KEY_CAMERA_FOCUS),
4145};
4146
4147static struct matrix_keymap_data keymap_data = {
4148 .keymap_size = ARRAY_SIZE(keymap),
4149 .keymap = keymap,
4150};
4151
4152static struct pm8xxx_keypad_platform_data keypad_data = {
4153 .input_name = "keypad_8960",
4154 .input_phys_device = "keypad_8960/input0",
4155 .num_rows = 1,
4156 .num_cols = 5,
4157 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4158 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4159 .debounce_ms = 15,
4160 .scan_delay_ms = 32,
4161 .row_hold_ns = 91500,
4162 .wakeup = 1,
4163 .keymap_data = &keymap_data,
4164};
4165
4166static const unsigned int keymap_sim[] = {
4167 KEY(0, 0, KEY_7),
4168 KEY(0, 1, KEY_DOWN),
4169 KEY(0, 2, KEY_UP),
4170 KEY(0, 3, KEY_RIGHT),
4171 KEY(0, 4, KEY_ENTER),
4172 KEY(0, 5, KEY_L),
4173 KEY(0, 6, KEY_BACK),
4174 KEY(0, 7, KEY_M),
4175
4176 KEY(1, 0, KEY_LEFT),
4177 KEY(1, 1, KEY_SEND),
4178 KEY(1, 2, KEY_1),
4179 KEY(1, 3, KEY_4),
4180 KEY(1, 4, KEY_CLEAR),
4181 KEY(1, 5, KEY_MSDOS),
4182 KEY(1, 6, KEY_SPACE),
4183 KEY(1, 7, KEY_COMMA),
4184
4185 KEY(2, 0, KEY_6),
4186 KEY(2, 1, KEY_5),
4187 KEY(2, 2, KEY_8),
4188 KEY(2, 3, KEY_3),
4189 KEY(2, 4, KEY_NUMERIC_STAR),
4190 KEY(2, 5, KEY_UP),
4191 KEY(2, 6, KEY_DOWN),
4192 KEY(2, 7, KEY_LEFTSHIFT),
4193
4194 KEY(3, 0, KEY_9),
4195 KEY(3, 1, KEY_NUMERIC_POUND),
4196 KEY(3, 2, KEY_0),
4197 KEY(3, 3, KEY_2),
4198 KEY(3, 4, KEY_SLEEP),
4199 KEY(3, 5, KEY_F1),
4200 KEY(3, 6, KEY_F2),
4201 KEY(3, 7, KEY_F3),
4202
4203 KEY(4, 0, KEY_BACK),
4204 KEY(4, 1, KEY_HOME),
4205 KEY(4, 2, KEY_MENU),
4206 KEY(4, 3, KEY_VOLUMEUP),
4207 KEY(4, 4, KEY_VOLUMEDOWN),
4208 KEY(4, 5, KEY_F4),
4209 KEY(4, 6, KEY_F5),
4210 KEY(4, 7, KEY_F6),
4211
4212 KEY(5, 0, KEY_R),
4213 KEY(5, 1, KEY_T),
4214 KEY(5, 2, KEY_Y),
4215 KEY(5, 3, KEY_LEFTALT),
4216 KEY(5, 4, KEY_KPENTER),
4217 KEY(5, 5, KEY_Q),
4218 KEY(5, 6, KEY_W),
4219 KEY(5, 7, KEY_E),
4220
4221 KEY(6, 0, KEY_F),
4222 KEY(6, 1, KEY_G),
4223 KEY(6, 2, KEY_H),
4224 KEY(6, 3, KEY_CAPSLOCK),
4225 KEY(6, 4, KEY_PAGEUP),
4226 KEY(6, 5, KEY_A),
4227 KEY(6, 6, KEY_S),
4228 KEY(6, 7, KEY_D),
4229
4230 KEY(7, 0, KEY_V),
4231 KEY(7, 1, KEY_B),
4232 KEY(7, 2, KEY_N),
4233 KEY(7, 3, KEY_MENU),
4234 KEY(7, 4, KEY_PAGEDOWN),
4235 KEY(7, 5, KEY_Z),
4236 KEY(7, 6, KEY_X),
4237 KEY(7, 7, KEY_C),
4238
4239 KEY(8, 0, KEY_P),
4240 KEY(8, 1, KEY_J),
4241 KEY(8, 2, KEY_K),
4242 KEY(8, 3, KEY_INSERT),
4243 KEY(8, 4, KEY_LINEFEED),
4244 KEY(8, 5, KEY_U),
4245 KEY(8, 6, KEY_I),
4246 KEY(8, 7, KEY_O),
4247
4248 KEY(9, 0, KEY_4),
4249 KEY(9, 1, KEY_5),
4250 KEY(9, 2, KEY_6),
4251 KEY(9, 3, KEY_7),
4252 KEY(9, 4, KEY_8),
4253 KEY(9, 5, KEY_1),
4254 KEY(9, 6, KEY_2),
4255 KEY(9, 7, KEY_3),
4256
4257 KEY(10, 0, KEY_F7),
4258 KEY(10, 1, KEY_F8),
4259 KEY(10, 2, KEY_F9),
4260 KEY(10, 3, KEY_F10),
4261 KEY(10, 4, KEY_FN),
4262 KEY(10, 5, KEY_9),
4263 KEY(10, 6, KEY_0),
4264 KEY(10, 7, KEY_DOT),
4265
4266 KEY(11, 0, KEY_LEFTCTRL),
4267 KEY(11, 1, KEY_F11),
4268 KEY(11, 2, KEY_ENTER),
4269 KEY(11, 3, KEY_SEARCH),
4270 KEY(11, 4, KEY_DELETE),
4271 KEY(11, 5, KEY_RIGHT),
4272 KEY(11, 6, KEY_LEFT),
4273 KEY(11, 7, KEY_RIGHTSHIFT),
4274 KEY(0, 0, KEY_VOLUMEUP),
4275 KEY(0, 1, KEY_VOLUMEDOWN),
4276 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4277 KEY(0, 3, KEY_CAMERA_FOCUS),
4278};
4279
4280static struct matrix_keymap_data keymap_data_sim = {
4281 .keymap_size = ARRAY_SIZE(keymap_sim),
4282 .keymap = keymap_sim,
4283};
4284
4285static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4286 .input_name = "keypad_8960",
4287 .input_phys_device = "keypad_8960/input0",
4288 .num_rows = 12,
4289 .num_cols = 8,
4290 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4291 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4292 .debounce_ms = 15,
4293 .scan_delay_ms = 32,
4294 .row_hold_ns = 91500,
4295 .wakeup = 1,
4296 .keymap_data = &keymap_data_sim,
4297};
4298
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004299static int pm8921_therm_mitigation[] = {
4300 1100,
4301 700,
4302 600,
4303 325,
4304};
4305
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004306static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004307 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004308 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004309 .max_voltage = 4200,
4310 .min_voltage = 3200,
4311 .resume_voltage = 4100,
4312 .term_current = 100,
4313 .cool_temp = 10,
4314 .warm_temp = 40,
4315 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004316 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004317 .cool_bat_chg_current = 350,
4318 .warm_bat_chg_current = 350,
4319 .cool_bat_voltage = 4100,
4320 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004321 .thermal_mitigation = pm8921_therm_mitigation,
4322 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004323};
4324
4325static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4326 .priority = 0,
4327};
4328
4329static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4330 .r_sense = 10,
4331 .i_test = 2500,
4332 .v_failure = 3000,
4333 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004334};
4335
Jay Chokshide4cefb2011-08-04 18:10:44 -07004336#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004337#define PM8XXX_LED_PWM_PERIOD 1000
4338#define PM8XXX_LED_PWM_DUTY_MS 20
4339/**
4340 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4341 * driven using PWM feature.
4342 */
4343#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004344
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004345static struct led_info pm8921_led_info[] = {
4346 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004347 .name = "led:battery_charging",
4348 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004349 },
4350 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004351 .name = "led:battery_full",
4352 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004353 },
4354};
4355
Jay Chokshi8994e392011-09-14 18:20:39 -07004356static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004357 .num_leds = ARRAY_SIZE(pm8921_led_info),
4358 .leds = pm8921_led_info,
4359};
4360
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004361static int pm8921_led0_pwm_duty_pcts[56] = {
4362 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4363 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4364 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4365 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4366 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4367 14, 10, 6, 4, 1
4368};
4369
4370static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4371 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4372 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4373 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4374 .start_idx = 0,
4375};
4376
Jay Chokshi8994e392011-09-14 18:20:39 -07004377static struct pm8xxx_led_config pm8921_led_configs[] = {
4378 [0] = {
4379 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004380 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004381 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004382 .pwm_channel = 5,
4383 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4384 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004385 },
4386 [1] = {
4387 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004388 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004389 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004390 .pwm_channel = 4,
4391 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004392 },
4393};
4394
4395static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4396 .led_core = &pm8921_led_core_pdata,
4397 .configs = pm8921_led_configs,
4398 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4399};
4400
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004401static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4402 .irq_pdata = &pm8xxx_irq_pdata,
4403 .gpio_pdata = &pm8xxx_gpio_pdata,
4404 .mpp_pdata = &pm8xxx_mpp_pdata,
4405 .rtc_pdata = &pm8xxx_rtc_pdata,
4406 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4407 .keypad_pdata = &keypad_data,
4408 .misc_pdata = &pm8xxx_misc_pdata,
4409 .regulator_pdatas = msm_pm8921_regulator_pdata,
4410 .charger_pdata = &pm8921_chg_pdata,
4411 .bms_pdata = &pm8921_bms_pdata,
4412 .adc_pdata = &pm8921_adc_pdata,
4413 .leds_pdata = &pm8xxx_leds_pdata,
4414};
4415
4416static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4417 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4418 .slave = {
4419 .name = "pm8921-core",
4420 .platform_data = &pm8921_platform_data,
4421 },
4422};
4423
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004424static struct msm_cpuidle_state msm_cstates[] __initdata = {
4425 {0, 0, "C0", "WFI",
4426 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4427
4428 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4429 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4430
4431 {0, 2, "C2", "POWER_COLLAPSE",
4432 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4433
4434 {1, 0, "C0", "WFI",
4435 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4436
4437 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4438 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4439};
4440
4441static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4442 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4443 .idle_supported = 1,
4444 .suspend_supported = 1,
4445 .idle_enabled = 0,
4446 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004447 },
4448
4449 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4450 .idle_supported = 1,
4451 .suspend_supported = 1,
4452 .idle_enabled = 0,
4453 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004454 },
4455
4456 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4457 .idle_supported = 1,
4458 .suspend_supported = 1,
4459 .idle_enabled = 1,
4460 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004461 },
4462
4463 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4464 .idle_supported = 0,
4465 .suspend_supported = 1,
4466 .idle_enabled = 0,
4467 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004468 },
4469
4470 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4471 .idle_supported = 1,
4472 .suspend_supported = 1,
4473 .idle_enabled = 0,
4474 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004475 },
4476
4477 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4478 .idle_supported = 1,
4479 .suspend_supported = 0,
4480 .idle_enabled = 1,
4481 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004482 },
4483};
4484
4485static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4486 {
4487 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4488 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4489 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004490 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004491 },
4492
4493 {
4494 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4495 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4496 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004497 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004498 },
4499
4500 {
4501 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4502 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4503 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004504 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004505 },
4506
4507 {
4508 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4509 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4510 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004511 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004512 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004513 {
4514 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4515 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4516 false,
4517 7000, 3500, 66600000, 5150,
4518 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004519
4520 {
4521 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4522 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4523 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004524 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004525 },
4526
4527 {
4528 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4529 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4530 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004531 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004532 },
4533
4534 {
4535 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4536 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4537 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004538 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004539 },
4540
4541 {
4542 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4543 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4544 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004545 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004546 },
4547};
4548
4549#ifdef CONFIG_I2C
4550#define I2C_SURF 1
4551#define I2C_FFA (1 << 1)
4552#define I2C_RUMI (1 << 2)
4553#define I2C_SIM (1 << 3)
4554#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004555#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004556
4557struct i2c_registry {
4558 u8 machs;
4559 int bus;
4560 struct i2c_board_info *info;
4561 int len;
4562};
4563
4564#ifdef CONFIG_MSM_CAMERA
4565static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4566#ifdef CONFIG_IMX074
4567 {
4568 I2C_BOARD_INFO("imx074", 0x1A),
4569 },
4570#endif
4571#ifdef CONFIG_OV2720
4572 {
4573 I2C_BOARD_INFO("ov2720", 0x6C),
4574 },
4575#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004576 {
4577 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4578 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304579#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4580 {
4581 I2C_BOARD_INFO("sc628a", 0x6E),
4582 },
4583#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004584};
4585#endif
4586
4587/* Sensors DSPS platform data */
4588#ifdef CONFIG_MSM_DSPS
4589#define DSPS_PIL_GENERIC_NAME "dsps"
4590#endif /* CONFIG_MSM_DSPS */
4591
4592static void __init msm8960_init_dsps(void)
4593{
4594#ifdef CONFIG_MSM_DSPS
4595 struct msm_dsps_platform_data *pdata =
4596 msm_dsps_device.dev.platform_data;
4597 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4598 pdata->gpios = NULL;
4599 pdata->gpios_num = 0;
4600
4601 platform_device_register(&msm_dsps_device);
4602#endif /* CONFIG_MSM_DSPS */
4603}
4604
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004605static void __init msm8960_init_hsic(void)
4606{
4607#ifdef CONFIG_USB_EHCI_MSM_HSIC
4608 uint32_t version = socinfo_get_version();
4609
4610 pr_info("%s: version:%d mtp:%d\n", __func__,
4611 SOCINFO_VERSION_MAJOR(version),
4612 machine_is_msm8960_mtp());
4613
4614 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4615 machine_is_msm8960_mtp() ||
4616 machine_is_msm8960_fluid())
4617 return;
4618
4619 msm_gpiomux_install(msm8960_hsic_configs,
4620 ARRAY_SIZE(msm8960_hsic_configs));
4621
4622 platform_device_register(&msm_device_hsic_host);
4623#endif
4624}
4625
4626
Amir Samuelov5137e392011-09-21 17:31:25 +03004627#ifdef CONFIG_ISL9519_CHARGER
4628static struct isl_platform_data isl_data __initdata = {
4629 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4630 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4631 .max_system_voltage = 4200,
4632 .min_system_voltage = 3200,
4633 .chgcurrent = 1000, /* 1900, */
4634 .term_current = 400, /* Need fine tuning */
4635 .input_current = 2048,
4636};
4637
4638static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4639 {
4640 I2C_BOARD_INFO("isl9519q", 0x9),
4641 .irq = 0, /* Not required when notify-by-pmic */
4642 .platform_data = &isl_data,
4643 },
4644};
4645#endif /* CONFIG_ISL9519_CHARGER */
4646
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004647static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4648#ifdef CONFIG_MSM_CAMERA
4649 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004650 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004651 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4652 msm_camera_boardinfo,
4653 ARRAY_SIZE(msm_camera_boardinfo),
4654 },
4655#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004656#ifdef CONFIG_ISL9519_CHARGER
4657 {
4658 I2C_LIQUID,
4659 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4660 isl_charger_i2c_info,
4661 ARRAY_SIZE(isl_charger_i2c_info),
4662 },
4663#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004664 {
4665 I2C_SURF | I2C_FFA | I2C_FLUID,
4666 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4667 cyttsp_info,
4668 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004669 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304670 {
4671 I2C_LIQUID,
4672 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4673 mxt_device_info,
4674 ARRAY_SIZE(mxt_device_info),
4675 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05304676 {
4677 I2C_LIQUID,
4678 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4679 msm_isa1200_board_info,
4680 ARRAY_SIZE(msm_isa1200_board_info),
4681 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004682};
4683#endif /* CONFIG_I2C */
4684
4685static void __init register_i2c_devices(void)
4686{
4687#ifdef CONFIG_I2C
4688 u8 mach_mask = 0;
4689 int i;
4690
4691 /* Build the matching 'supported_machs' bitmask */
4692 if (machine_is_msm8960_cdp())
4693 mach_mask = I2C_SURF;
4694 else if (machine_is_msm8960_rumi3())
4695 mach_mask = I2C_RUMI;
4696 else if (machine_is_msm8960_sim())
4697 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004698 else if (machine_is_msm8960_fluid())
4699 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004700 else if (machine_is_msm8960_liquid())
4701 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004702 else if (machine_is_msm8960_mtp())
4703 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004704 else
4705 pr_err("unmatched machine ID in register_i2c_devices\n");
4706
4707 /* Run the array and install devices as appropriate */
4708 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4709 if (msm8960_i2c_devices[i].machs & mach_mask)
4710 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4711 msm8960_i2c_devices[i].info,
4712 msm8960_i2c_devices[i].len);
4713 }
4714#endif
4715}
4716
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004717static void __init msm8960_sim_init(void)
4718{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004719 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4720 &msm8960_device_watchdog.dev.platform_data;
4721
4722 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004723 BUG_ON(msm_rpm_init(&msm_rpm_data));
4724 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4725 ARRAY_SIZE(msm_rpmrs_levels)));
4726 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004727 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004728 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004729 msm8960_device_ssbi_pm8921.dev.platform_data =
4730 &msm8960_ssbi_pm8921_pdata;
4731 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004732
4733 /* Simulator supports a QWERTY keypad */
4734 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4735
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004736 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004737 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004738 msm8960_i2c_init();
4739 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4740 msm_spm_l2_init(msm_spm_l2_data);
4741 msm8960_init_buses();
4742 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4743 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004744 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004745 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004746
4747 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4748 &msm8960_qup_spi_gsbi1_pdata;
4749 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4750
4751 msm8960_init_mmc();
4752 msm_fb_add_devices();
4753 slim_register_board_info(msm_slim_devices,
4754 ARRAY_SIZE(msm_slim_devices));
4755 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4756 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4757 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4758 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004759 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004760}
4761
4762static void __init msm8960_rumi3_init(void)
4763{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004764 BUG_ON(msm_rpm_init(&msm_rpm_data));
4765 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4766 ARRAY_SIZE(msm_rpmrs_levels)));
4767 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004768 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004769 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004770 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004771 msm8960_device_ssbi_pm8921.dev.platform_data =
4772 &msm8960_ssbi_pm8921_pdata;
4773 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4774 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4775 &msm8960_qup_spi_gsbi1_pdata;
4776 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4777 msm8960_i2c_init();
4778 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4779 msm_spm_l2_init(msm_spm_l2_data);
4780 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4781 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004782 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004783 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004784 register_i2c_devices();
4785 msm_fb_add_devices();
4786 slim_register_board_info(msm_slim_devices,
4787 ARRAY_SIZE(msm_slim_devices));
4788 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4789 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4790 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4791 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004792 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004793}
4794
4795static void __init msm8960_cdp_init(void)
4796{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004797 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4798 pr_err("meminfo_init() failed!\n");
4799
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004800 BUG_ON(msm_rpm_init(&msm_rpm_data));
4801 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4802 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004803
4804 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004805 regulator_suppress_info_printing();
4806 if (msm_xo_init())
4807 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004808 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004809 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304810 if (machine_is_msm8960_liquid())
4811 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004812 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304813#ifdef CONFIG_USB_EHCI_MSM_HSIC
4814 if (machine_is_msm8960_liquid()) {
4815 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4816 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4817 }
4818#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304819 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004820 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304821 if (machine_is_msm8960_liquid())
4822 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004823 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4824 &msm8960_qup_spi_gsbi1_pdata;
4825 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4826 msm8960_device_ssbi_pm8921.dev.platform_data =
4827 &msm8960_ssbi_pm8921_pdata;
4828 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4829 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004830 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004831 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4832 msm_spm_l2_init(msm_spm_l2_data);
4833 msm8960_init_buses();
4834 platform_add_devices(msm_footswitch_devices,
4835 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004836 if (machine_is_msm8960_liquid())
4837 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004838 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4839 pm8921_gpio_mpp_init();
4840 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004841 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004842 msm8960_init_cam();
4843 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004844 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304845 if (machine_is_msm8960_liquid())
4846 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004847 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004848 msm_fb_add_devices();
4849 slim_register_board_info(msm_slim_devices,
4850 ARRAY_SIZE(msm_slim_devices));
4851 msm8960_init_dsps();
4852 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4853 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4854 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4855 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004856 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004857 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004858}
4859
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004860MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4861 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004862 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004863 .init_irq = msm8960_init_irq,
4864 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004865 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004866 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004867 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004868MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004869
4870MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4871 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004872 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004873 .init_irq = msm8960_init_irq,
4874 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004875 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004876 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004877 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004878MACHINE_END
4879
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004880MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4881 .map_io = msm8960_map_io,
4882 .reserve = msm8960_reserve,
4883 .init_irq = msm8960_init_irq,
4884 .timer = &msm_timer,
4885 .init_machine = msm8960_cdp_init,
4886 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004887 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004888MACHINE_END
4889
4890MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4891 .map_io = msm8960_map_io,
4892 .reserve = msm8960_reserve,
4893 .init_irq = msm8960_init_irq,
4894 .timer = &msm_timer,
4895 .init_machine = msm8960_cdp_init,
4896 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004897 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004898MACHINE_END
4899
4900MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4901 .map_io = msm8960_map_io,
4902 .reserve = msm8960_reserve,
4903 .init_irq = msm8960_init_irq,
4904 .timer = &msm_timer,
4905 .init_machine = msm8960_cdp_init,
4906 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004907 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004908MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004909
4910MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4911 .map_io = msm8960_map_io,
4912 .reserve = msm8960_reserve,
4913 .init_irq = msm8960_init_irq,
4914 .timer = &msm_timer,
4915 .init_machine = msm8960_cdp_init,
4916 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004917 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004918MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004919
4920#ifdef CONFIG_ARCH_MSM8930
4921MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4922 .map_io = msm8930_map_io,
4923 .reserve = msm8960_reserve,
4924 .init_irq = msm8960_init_irq,
4925 .timer = &msm_timer,
4926 .init_machine = msm8960_cdp_init,
4927 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004928 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004929MACHINE_END
4930
4931MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4932 .map_io = msm8930_map_io,
4933 .reserve = msm8960_reserve,
4934 .init_irq = msm8960_init_irq,
4935 .timer = &msm_timer,
4936 .init_machine = msm8960_cdp_init,
4937 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004938 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004939MACHINE_END
4940
4941MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4942 .map_io = msm8930_map_io,
4943 .reserve = msm8960_reserve,
4944 .init_irq = msm8960_init_irq,
4945 .timer = &msm_timer,
4946 .init_machine = msm8960_cdp_init,
4947 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004948 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004949MACHINE_END
4950#endif