blob: cf74c669cf6f2721744f30808ccd30af68bf82fd [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_KERNEL_EBI1_SIZE 0x110C000
847#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700848#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700849#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
850#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
851#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700852#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700853#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700854
855
856#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
857#define MSM_ION_EBI_SIZE MSM_PMEM_SIZE
858#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
859#define MSM_ION_HEAP_NUM 4
860#else
861#define MSM_ION_HEAP_NUM 2
862#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700863
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
865static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
866static int __init pmem_kernel_ebi1_size_setup(char *p)
867{
868 pmem_kernel_ebi1_size = memparse(p, NULL);
869 return 0;
870}
871early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
872#endif
873
874#ifdef CONFIG_ANDROID_PMEM
875static unsigned pmem_size = MSM_PMEM_SIZE;
876static int __init pmem_size_setup(char *p)
877{
878 pmem_size = memparse(p, NULL);
879 return 0;
880}
881early_param("pmem_size", pmem_size_setup);
882
883static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
884
885static int __init pmem_adsp_size_setup(char *p)
886{
887 pmem_adsp_size = memparse(p, NULL);
888 return 0;
889}
890early_param("pmem_adsp_size", pmem_adsp_size_setup);
891
892static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
893
894static int __init pmem_audio_size_setup(char *p)
895{
896 pmem_audio_size = memparse(p, NULL);
897 return 0;
898}
899early_param("pmem_audio_size", pmem_audio_size_setup);
900#endif
901
902#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700903#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700904static struct android_pmem_platform_data android_pmem_pdata = {
905 .name = "pmem",
906 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
907 .cached = 1,
908 .memory_type = MEMTYPE_EBI1,
909};
910
911static struct platform_device android_pmem_device = {
912 .name = "android_pmem",
913 .id = 0,
914 .dev = {.platform_data = &android_pmem_pdata},
915};
916
917static struct android_pmem_platform_data android_pmem_adsp_pdata = {
918 .name = "pmem_adsp",
919 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
920 .cached = 0,
921 .memory_type = MEMTYPE_EBI1,
922};
923static struct platform_device android_pmem_adsp_device = {
924 .name = "android_pmem",
925 .id = 2,
926 .dev = { .platform_data = &android_pmem_adsp_pdata },
927};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700928#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700929
930static struct android_pmem_platform_data android_pmem_audio_pdata = {
931 .name = "pmem_audio",
932 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
933 .cached = 0,
934 .memory_type = MEMTYPE_EBI1,
935};
936
937static struct platform_device android_pmem_audio_device = {
938 .name = "android_pmem",
939 .id = 4,
940 .dev = { .platform_data = &android_pmem_audio_pdata },
941};
942#endif
943
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700944#define DSP_RAM_BASE_8960 0x8da00000
945#define DSP_RAM_SIZE_8960 0x1800000
946static int dspcrashd_pdata_8960 = 0xDEADDEAD;
947
948static struct resource resources_dspcrashd_8960[] = {
949 {
950 .name = "msm_dspcrashd",
951 .start = DSP_RAM_BASE_8960,
952 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
953 .flags = IORESOURCE_DMA,
954 },
955};
956
957struct platform_device msm_device_dspcrashd_8960 = {
958 .name = "msm_dspcrashd",
959 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
960 .resource = resources_dspcrashd_8960,
961 .dev = { .platform_data = &dspcrashd_pdata_8960 },
962};
963
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700964static struct memtype_reserve msm8960_reserve_table[] __initdata = {
965 [MEMTYPE_SMI] = {
966 },
967 [MEMTYPE_EBI0] = {
968 .flags = MEMTYPE_FLAGS_1M_ALIGN,
969 },
970 [MEMTYPE_EBI1] = {
971 .flags = MEMTYPE_FLAGS_1M_ALIGN,
972 },
973};
974
975static void __init size_pmem_devices(void)
976{
977#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700978#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700979 android_pmem_adsp_pdata.size = pmem_adsp_size;
980 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700981#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700982 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
983#endif
984}
985
986static void __init reserve_memory_for(struct android_pmem_platform_data *p)
987{
988 msm8960_reserve_table[p->memory_type].size += p->size;
989}
990
991static void __init reserve_pmem_memory(void)
992{
993#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700994#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700995 reserve_memory_for(&android_pmem_adsp_pdata);
996 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700997#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700998 reserve_memory_for(&android_pmem_audio_pdata);
999 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
1000#endif
1001}
1002
Larry Basselb4126da2011-07-18 14:31:33 -07001003static int msm8960_paddr_to_memtype(unsigned int paddr)
1004{
1005 return MEMTYPE_EBI1;
1006}
1007
Laura Abbottd6183792011-08-19 13:42:24 -07001008#ifdef CONFIG_ION_MSM
1009struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -07001010 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -07001011 .heaps = {
1012 {
1013 .id = ION_HEAP_SYSTEM_ID,
1014 .type = ION_HEAP_TYPE_SYSTEM,
1015 .name = ION_KMALLOC_HEAP_NAME,
1016 },
1017 {
1018 .id = ION_HEAP_SYSTEM_CONTIG_ID,
1019 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
1020 .name = ION_VMALLOC_HEAP_NAME,
1021 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001022#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -07001023 {
1024 .id = ION_HEAP_EBI_ID,
1025 .type = ION_HEAP_TYPE_CARVEOUT,
1026 .name = ION_EBI1_HEAP_NAME,
1027 .size = MSM_ION_EBI_SIZE,
1028 .memory_type = ION_EBI_TYPE,
1029 },
Laura Abbott2d1760b2011-09-29 21:31:24 -07001030 {
1031 .id = ION_HEAP_ADSP_ID,
1032 .type = ION_HEAP_TYPE_CARVEOUT,
1033 .name = ION_ADSP_HEAP_NAME,
1034 .size = MSM_ION_ADSP_SIZE,
1035 .memory_type = ION_EBI_TYPE,
1036 },
1037#endif
Laura Abbottd6183792011-08-19 13:42:24 -07001038 }
1039};
1040
1041struct platform_device ion_dev = {
1042 .name = "ion-msm",
1043 .id = 1,
1044 .dev = { .platform_data = &ion_pdata },
1045};
1046#endif
1047
1048static void reserve_ion_memory(void)
1049{
Laura Abbott2d1760b2011-09-29 21:31:24 -07001050#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -07001051 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -07001052 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -07001053#endif
1054}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001055static void __init msm8960_calculate_reserve_sizes(void)
1056{
1057 size_pmem_devices();
1058 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -07001059 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001060}
1061
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001062static struct reserve_info msm8960_reserve_info __initdata = {
1063 .memtype_reserve_table = msm8960_reserve_table,
1064 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
1065 .paddr_to_memtype = msm8960_paddr_to_memtype,
1066};
1067
Larry Basselb4126da2011-07-18 14:31:33 -07001068static int msm8960_memory_bank_size(void)
1069{
1070 return 1<<29;
1071}
1072
1073static void __init locate_unstable_memory(void)
1074{
1075 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
1076 unsigned long bank_size;
1077 unsigned long low, high;
1078
1079 bank_size = msm8960_memory_bank_size();
1080 low = meminfo.bank[0].start;
1081 high = mb->start + mb->size;
1082 low &= ~(bank_size - 1);
1083
1084 if (high - low <= bank_size)
1085 return;
1086 msm8960_reserve_info.low_unstable_address = low + bank_size;
1087 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
1088 msm8960_reserve_info.bank_size = bank_size;
1089 pr_info("low unstable address %lx max size %lx bank size %lx\n",
1090 msm8960_reserve_info.low_unstable_address,
1091 msm8960_reserve_info.max_unstable_size,
1092 msm8960_reserve_info.bank_size);
1093}
1094
Larry Basselb830e182011-10-14 10:46:55 -07001095static void __init place_movable_zone(void)
1096{
1097 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
1098 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
1099 pr_info("movable zone start %lx size %lx\n",
1100 movable_reserved_start, movable_reserved_size);
1101}
1102
1103static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001104{
1105 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -07001106 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -07001107 place_movable_zone();
1108}
1109
1110static void __init msm8960_reserve(void)
1111{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001112 msm_reserve();
1113}
1114
Larry Bassela4414b12011-08-04 11:11:02 -07001115static int msm8960_change_memory_power(u64 start, u64 size,
1116 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -07001117{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -07001118 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -07001119}
1120
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001121#ifdef CONFIG_MSM_CAMERA
1122
Nishant Pandit24153d82011-08-27 16:05:13 +05301123static uint16_t msm_cam_gpio_2d_tbl[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001124 5, /*CAMIF_MCLK*/
1125 20, /*CAMIF_I2C_DATA*/
1126 21, /*CAMIF_I2C_CLK*/
1127};
1128
Nishant Pandit24153d82011-08-27 16:05:13 +05301129static struct msm_camera_gpio_conf gpio_conf = {
1130 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
1131 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
1132 .cam_gpio_tbl = msm_cam_gpio_2d_tbl,
1133 .cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_2d_tbl),
1134};
1135
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001136#define VFE_CAMIF_TIMER1_GPIO 2
1137#define VFE_CAMIF_TIMER2_GPIO 3
1138#define VFE_CAMIF_TIMER3_GPIO_INT 4
1139struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
1140 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
1141 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
1142 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
1143 .flash_recharge_duration = 50000,
1144 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
1145};
1146
Nishant Pandit474f2252011-07-23 23:17:56 +05301147#ifdef CONFIG_MSM_CAMERA_FLASH
1148static struct msm_camera_sensor_flash_src msm_flash_src = {
1149 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
1150 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
1151 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
1152#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
1153 defined(CONFIG_GPIO_SX150X_MODULE))
1154 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
1155#endif
1156};
1157#endif
1158
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001159static struct msm_bus_vectors cam_init_vectors[] = {
1160 {
1161 .src = MSM_BUS_MASTER_VFE,
1162 .dst = MSM_BUS_SLAVE_EBI_CH0,
1163 .ab = 0,
1164 .ib = 0,
1165 },
1166 {
1167 .src = MSM_BUS_MASTER_VPE,
1168 .dst = MSM_BUS_SLAVE_EBI_CH0,
1169 .ab = 0,
1170 .ib = 0,
1171 },
1172 {
1173 .src = MSM_BUS_MASTER_JPEG_ENC,
1174 .dst = MSM_BUS_SLAVE_EBI_CH0,
1175 .ab = 0,
1176 .ib = 0,
1177 },
1178};
1179
1180static struct msm_bus_vectors cam_preview_vectors[] = {
1181 {
1182 .src = MSM_BUS_MASTER_VFE,
1183 .dst = MSM_BUS_SLAVE_EBI_CH0,
1184 .ab = 27648000,
1185 .ib = 110592000,
1186 },
1187 {
1188 .src = MSM_BUS_MASTER_VPE,
1189 .dst = MSM_BUS_SLAVE_EBI_CH0,
1190 .ab = 0,
1191 .ib = 0,
1192 },
1193 {
1194 .src = MSM_BUS_MASTER_JPEG_ENC,
1195 .dst = MSM_BUS_SLAVE_EBI_CH0,
1196 .ab = 0,
1197 .ib = 0,
1198 },
1199};
1200
1201static struct msm_bus_vectors cam_video_vectors[] = {
1202 {
1203 .src = MSM_BUS_MASTER_VFE,
1204 .dst = MSM_BUS_SLAVE_EBI_CH0,
1205 .ab = 140451840,
1206 .ib = 561807360,
1207 },
1208 {
1209 .src = MSM_BUS_MASTER_VPE,
1210 .dst = MSM_BUS_SLAVE_EBI_CH0,
1211 .ab = 206807040,
1212 .ib = 488816640,
1213 },
1214 {
1215 .src = MSM_BUS_MASTER_JPEG_ENC,
1216 .dst = MSM_BUS_SLAVE_EBI_CH0,
1217 .ab = 0,
1218 .ib = 0,
1219 },
1220};
1221
1222static struct msm_bus_vectors cam_snapshot_vectors[] = {
1223 {
1224 .src = MSM_BUS_MASTER_VFE,
1225 .dst = MSM_BUS_SLAVE_EBI_CH0,
1226 .ab = 274423680,
1227 .ib = 1097694720,
1228 },
1229 {
1230 .src = MSM_BUS_MASTER_VPE,
1231 .dst = MSM_BUS_SLAVE_EBI_CH0,
1232 .ab = 0,
1233 .ib = 0,
1234 },
1235 {
1236 .src = MSM_BUS_MASTER_JPEG_ENC,
1237 .dst = MSM_BUS_SLAVE_EBI_CH0,
1238 .ab = 540000000,
1239 .ib = 1350000000,
1240 },
1241};
1242
1243static struct msm_bus_vectors cam_zsl_vectors[] = {
1244 {
1245 .src = MSM_BUS_MASTER_VFE,
1246 .dst = MSM_BUS_SLAVE_EBI_CH0,
1247 .ab = 302071680,
1248 .ib = 1208286720,
1249 },
1250 {
1251 .src = MSM_BUS_MASTER_VPE,
1252 .dst = MSM_BUS_SLAVE_EBI_CH0,
1253 .ab = 0,
1254 .ib = 0,
1255 },
1256 {
1257 .src = MSM_BUS_MASTER_JPEG_ENC,
1258 .dst = MSM_BUS_SLAVE_EBI_CH0,
1259 .ab = 540000000,
1260 .ib = 1350000000,
1261 },
1262};
1263
1264static struct msm_bus_paths cam_bus_client_config[] = {
1265 {
1266 ARRAY_SIZE(cam_init_vectors),
1267 cam_init_vectors,
1268 },
1269 {
1270 ARRAY_SIZE(cam_preview_vectors),
1271 cam_preview_vectors,
1272 },
1273 {
1274 ARRAY_SIZE(cam_video_vectors),
1275 cam_video_vectors,
1276 },
1277 {
1278 ARRAY_SIZE(cam_snapshot_vectors),
1279 cam_snapshot_vectors,
1280 },
1281 {
1282 ARRAY_SIZE(cam_zsl_vectors),
1283 cam_zsl_vectors,
1284 },
1285};
1286
1287static struct msm_bus_scale_pdata cam_bus_client_pdata = {
1288 cam_bus_client_config,
1289 ARRAY_SIZE(cam_bus_client_config),
1290 .name = "msm_camera",
1291};
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001292
Nishant Pandit24153d82011-08-27 16:05:13 +05301293struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
1294 {
1295 .ioclk.mclk_clk_rate = 24000000,
1296 .ioclk.vfe_clk_rate = 228570000,
1297 .csid_core = 0,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001298 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301299 },
1300 {
1301 .ioclk.mclk_clk_rate = 24000000,
1302 .ioclk.vfe_clk_rate = 228570000,
1303 .csid_core = 1,
Shuzhen Wang65c3b1d2011-09-20 12:53:08 -07001304 .cam_bus_scale_table = &cam_bus_client_pdata,
Nishant Pandit24153d82011-08-27 16:05:13 +05301305 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001306};
1307
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001308#ifdef CONFIG_IMX074_ACT
1309static struct i2c_board_info imx074_actuator_i2c_info = {
1310 I2C_BOARD_INFO("imx074_act", 0x11),
1311};
1312
1313static struct msm_actuator_info imx074_actuator_info = {
1314 .board_info = &imx074_actuator_i2c_info,
1315 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
1316 .vcm_pwd = 0,
1317 .vcm_enable = 1,
1318};
1319#endif
1320
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001321#ifdef CONFIG_IMX074
1322static struct msm_camera_sensor_flash_data flash_imx074 = {
1323 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +05301324#ifdef CONFIG_MSM_CAMERA_FLASH
1325 .flash_src = &msm_flash_src
1326#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001327};
1328
Nishant Pandit24153d82011-08-27 16:05:13 +05301329static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
1330 .mount_angle = 90,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001331 .sensor_reset = 107,
1332 .sensor_pwd = 85,
1333 .vcm_pwd = 0,
1334 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301335};
1336
1337static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
1338 .sensor_name = "imx074",
1339 .pdata = &msm_camera_csi_device_data[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001340 .flash_data = &flash_imx074,
1341 .strobe_flash_data = &strobe_flash_xenon,
Nishant Pandit24153d82011-08-27 16:05:13 +05301342 .sensor_platform_info = &sensor_board_info_imx074,
1343 .gpio_conf = &gpio_conf,
1344 .csi_if = 1,
1345 .camera_type = BACK_CAMERA_2D,
Sreesudhan Ramakrish Ramkumarb54fd242011-09-12 17:11:19 -07001346#ifdef CONFIG_IMX074_ACT
1347 .actuator_info = &imx074_actuator_info
1348#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001349};
1350
1351struct platform_device msm8960_camera_sensor_imx074 = {
1352 .name = "msm_camera_imx074",
1353 .dev = {
1354 .platform_data = &msm_camera_sensor_imx074_data,
1355 },
1356};
1357#endif
1358#ifdef CONFIG_OV2720
1359static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -07001360 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361};
1362
Nishant Pandit24153d82011-08-27 16:05:13 +05301363static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
1364 .mount_angle = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001365 .sensor_reset = 76,
1366 .sensor_pwd = 85,
1367 .vcm_pwd = 0,
1368 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301369};
1370
1371static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
1372 .sensor_name = "ov2720",
1373 .pdata = &msm_camera_csi_device_data[1],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001374 .flash_data = &flash_ov2720,
Nishant Pandit24153d82011-08-27 16:05:13 +05301375 .sensor_platform_info = &sensor_board_info_ov2720,
1376 .gpio_conf = &gpio_conf,
1377 .csi_if = 1,
1378 .camera_type = FRONT_CAMERA_2D,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001379};
1380
1381struct platform_device msm8960_camera_sensor_ov2720 = {
1382 .name = "msm_camera_ov2720",
1383 .dev = {
1384 .platform_data = &msm_camera_sensor_ov2720_data,
1385 },
1386};
1387#endif
Kevin Chandfecce22011-07-13 10:52:41 -07001388
1389static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
1390 .flash_type = MSM_CAMERA_FLASH_LED,
1391};
1392
Nishant Pandit24153d82011-08-27 16:05:13 +05301393static struct msm_camera_sensor_platform_info sensor_board_info_qs_mt9p017 = {
1394 .mount_angle = 270,
Kevin Chandfecce22011-07-13 10:52:41 -07001395 .sensor_reset = 107,
1396 .sensor_pwd = 85,
1397 .vcm_pwd = 0,
1398 .vcm_enable = 1,
Nishant Pandit24153d82011-08-27 16:05:13 +05301399};
1400
1401static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
1402 .sensor_name = "qs_mt9p017",
1403 .pdata = &msm_camera_csi_device_data[0],
Kevin Chandfecce22011-07-13 10:52:41 -07001404 .flash_data = &flash_qs_mt9p017,
Nishant Pandit24153d82011-08-27 16:05:13 +05301405 .sensor_platform_info = &sensor_board_info_qs_mt9p017,
1406 .gpio_conf = &gpio_conf,
1407 .csi_if = 1,
1408 .camera_type = BACK_CAMERA_3D,
Kevin Chandfecce22011-07-13 10:52:41 -07001409};
1410
1411struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1412 .name = "msm_camera_qs_mt9p017",
1413 .dev = {
1414 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1415 },
1416};
1417
Kevin Chan8b0d2322011-09-10 21:06:31 -07001418static struct msm8960_privacy_light_cfg privacy_light_info = {
1419 .mpp = PM8921_MPP_PM_TO_SYS(12),
1420};
1421
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001422static void __init msm8960_init_cam(void)
1423{
1424 int i;
1425 struct platform_device *cam_dev[] = {
1426 &msm8960_camera_sensor_imx074,
1427 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001428 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001429 };
1430
Kevin Chan8b0d2322011-09-10 21:06:31 -07001431 if (machine_is_msm8960_liquid()) {
1432 struct msm_camera_sensor_info *s_info;
1433 s_info = msm8960_camera_sensor_imx074.dev.platform_data;
1434 s_info->sensor_platform_info->mount_angle = 180;
1435 s_info = msm8960_camera_sensor_ov2720.dev.platform_data;
1436 s_info->sensor_platform_info->privacy_light = 1;
1437 s_info->sensor_platform_info->privacy_light_info =
1438 &privacy_light_info;
1439 }
1440
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001441 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1442 struct msm_camera_sensor_info *s_info;
1443 s_info = cam_dev[i]->dev.platform_data;
1444 msm_get_cam_resources(s_info);
1445 platform_device_register(cam_dev[i]);
1446 }
Kevin Chanf6216f22011-10-25 18:40:11 -07001447
1448 platform_device_register(&msm8960_device_csiphy0);
1449 platform_device_register(&msm8960_device_csiphy1);
Kevin Chanc8b52e82011-10-25 23:20:21 -07001450 platform_device_register(&msm8960_device_csid0);
1451 platform_device_register(&msm8960_device_csid1);
Kevin Chane12c6672011-10-26 11:55:26 -07001452 platform_device_register(&msm8960_device_ispif);
Kevin Chan5827c552011-10-28 18:36:32 -07001453 platform_device_register(&msm8960_device_vfe);
Kevin Chana0853122011-11-07 19:48:44 -08001454 platform_device_register(&msm8960_device_vpe);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455}
1456#endif
1457
1458#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
kuogee hsieh3830eb92011-09-12 15:25:57 -07001459#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 3) /* 4 bpp x 3 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001460#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001461#define MSM_FB_PRIM_BUF_SIZE (1376 * 768 * 4 * 2) /* 4 bpp x 2 pages */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001462#endif
1463
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001464
1465#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
kuogee hsieh3830eb92011-09-12 15:25:57 -07001466#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001467#elif defined(CONFIG_FB_MSM_TVOUT)
kuogee hsieh3830eb92011-09-12 15:25:57 -07001468#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
1469#else
1470#define MSM_FB_EXT_BUF_SIZE 0
1471#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001472
kuogee hsieh3830eb92011-09-12 15:25:57 -07001473#ifdef CONFIG_FB_MSM_OVERLAY_WRITEBACK
1474/* width x height x 3 bpp x 2 frame buffer */
1475#define MSM_FB_WRITEBACK_SIZE (1376 * 768 * 3 * 2)
1476#define MSM_FB_WRITEBACK_OFFSET \
1477 (MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE)
1478#else
1479#define MSM_FB_WRITEBACK_SIZE 0
1480#define MSM_FB_WRITEBACK_OFFSET 0
1481#endif
1482
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001483#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1484/* 4 bpp x 2 page HDMI case */
1485#define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096)
1486#else
kuogee hsieh3830eb92011-09-12 15:25:57 -07001487/* Note: must be multiple of 4096 */
1488#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE + \
1489 MSM_FB_WRITEBACK_SIZE, 4096)
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001490#endif
kuogee hsieh3830eb92011-09-12 15:25:57 -07001491
1492static int writeback_offset(void)
1493{
1494 return MSM_FB_WRITEBACK_OFFSET;
1495}
1496
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001497
1498#define MDP_VSYNC_GPIO 0
1499
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001500#define PANEL_NAME_MAX_LEN 30
1501#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
1502#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
1503#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
1504#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
1505#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
1506#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
1507#define HDMI_PANEL_NAME "hdmi_msm"
1508#define TVOUT_PANEL_NAME "tvout_msm"
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001509
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001510static struct resource msm_fb_resources[] = {
1511 {
1512 .flags = IORESOURCE_DMA,
1513 }
1514};
1515
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001516static int msm_fb_detect_panel(const char *name)
1517{
1518 if (machine_is_msm8960_liquid()) {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001519 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1520 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
1521 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001522 return 0;
1523 } else {
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001524 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1525 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1526 PANEL_NAME_MAX_LEN)))
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001527 return 0;
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001528
1529#ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT
1530 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1531 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
1532 PANEL_NAME_MAX_LEN)))
1533 return 0;
1534
1535 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1536 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
1537 PANEL_NAME_MAX_LEN)))
1538 return 0;
1539
1540 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1541 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
1542 PANEL_NAME_MAX_LEN)))
1543 return 0;
1544
1545 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1546 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
1547 PANEL_NAME_MAX_LEN)))
1548 return 0;
1549#endif
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001550 }
1551
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001552 if (!strncmp(name, HDMI_PANEL_NAME,
1553 strnlen(HDMI_PANEL_NAME,
1554 PANEL_NAME_MAX_LEN)))
1555 return 0;
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001556
Ravishangar Kalyanamf8e21952011-07-28 16:47:44 -07001557 if (!strncmp(name, TVOUT_PANEL_NAME,
1558 strnlen(TVOUT_PANEL_NAME,
1559 PANEL_NAME_MAX_LEN)))
1560 return 0;
1561
1562 pr_warning("%s: not supported '%s'", __func__, name);
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001563 return -ENODEV;
1564}
1565
1566static struct msm_fb_platform_data msm_fb_pdata = {
1567 .detect_client = msm_fb_detect_panel,
1568};
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001569
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001570static struct platform_device msm_fb_device = {
1571 .name = "msm_fb",
1572 .id = 0,
1573 .num_resources = ARRAY_SIZE(msm_fb_resources),
1574 .resource = msm_fb_resources,
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001575 .dev.platform_data = &msm_fb_pdata,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001576};
1577
1578static bool dsi_power_on;
1579
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001580/**
1581 * LiQUID panel on/off
1582 *
1583 * @param on
1584 *
1585 * @return int
1586 */
1587static int mipi_dsi_liquid_panel_power(int on)
1588{
1589 static struct regulator *reg_l2, *reg_ext_3p3v;
1590 static int gpio21, gpio24, gpio43;
1591 int rc;
1592
1593 pr_info("%s: on=%d\n", __func__, on);
1594
1595 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
1596 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
1597 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
1598
1599 if (!dsi_power_on) {
1600
1601 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1602 "dsi_vdda");
1603 if (IS_ERR(reg_l2)) {
1604 pr_err("could not get 8921_l2, rc = %ld\n",
1605 PTR_ERR(reg_l2));
1606 return -ENODEV;
1607 }
1608
1609 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1610 if (rc) {
1611 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1612 return -EINVAL;
1613 }
1614
1615 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
1616 "vdd_lvds_3p3v");
1617 if (IS_ERR(reg_ext_3p3v)) {
1618 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
1619 PTR_ERR(reg_ext_3p3v));
1620 return -ENODEV;
1621 }
1622
1623 rc = gpio_request(gpio21, "disp_pwr_en_n");
1624 if (rc) {
1625 pr_err("request gpio 21 failed, rc=%d\n", rc);
1626 return -ENODEV;
1627 }
1628
1629 rc = gpio_request(gpio43, "disp_rst_n");
1630 if (rc) {
1631 pr_err("request gpio 43 failed, rc=%d\n", rc);
1632 return -ENODEV;
1633 }
1634
1635 rc = gpio_request(gpio24, "disp_backlight_pwm");
1636 if (rc) {
1637 pr_err("request gpio 24 failed, rc=%d\n", rc);
1638 return -ENODEV;
1639 }
1640
1641 dsi_power_on = true;
1642 }
1643
1644 if (on) {
1645 rc = regulator_set_optimum_mode(reg_l2, 100000);
1646 if (rc < 0) {
1647 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1648 return -EINVAL;
1649 }
1650 rc = regulator_enable(reg_l2);
1651 if (rc) {
1652 pr_err("enable l2 failed, rc=%d\n", rc);
1653 return -ENODEV;
1654 }
1655
1656 rc = regulator_enable(reg_ext_3p3v);
1657 if (rc) {
1658 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
1659 return -ENODEV;
1660 }
1661
1662 /* set reset pin before power enable */
1663 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
1664
1665 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
1666 msleep(20);
1667 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1668 msleep(20);
1669 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
1670 msleep(20);
1671 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
1672 msleep(20);
1673 } else {
1674 gpio_set_value_cansleep(gpio43, 0);
1675 gpio_set_value_cansleep(gpio21, 1);
1676
1677 rc = regulator_disable(reg_l2);
1678 if (rc) {
1679 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1680 return -ENODEV;
1681 }
1682 rc = regulator_disable(reg_ext_3p3v);
1683 if (rc) {
1684 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
1685 return -ENODEV;
1686 }
1687 rc = regulator_set_optimum_mode(reg_l2, 100);
1688 if (rc < 0) {
1689 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1690 return -EINVAL;
1691 }
1692 }
1693
1694 return 0;
1695}
1696
1697static int mipi_dsi_cdp_panel_power(int on)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001698{
1699 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001700 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001701 int rc;
1702
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001703 pr_info("%s: state : %d\n", __func__, on);
1704
1705 if (!dsi_power_on) {
1706
1707 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1708 "dsi_vdc");
1709 if (IS_ERR(reg_l8)) {
1710 pr_err("could not get 8921_l8, rc = %ld\n",
1711 PTR_ERR(reg_l8));
1712 return -ENODEV;
1713 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001714 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1715 "dsi_vddio");
1716 if (IS_ERR(reg_l23)) {
1717 pr_err("could not get 8921_l23, rc = %ld\n",
1718 PTR_ERR(reg_l23));
1719 return -ENODEV;
1720 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001721 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1722 "dsi_vdda");
1723 if (IS_ERR(reg_l2)) {
1724 pr_err("could not get 8921_l2, rc = %ld\n",
1725 PTR_ERR(reg_l2));
1726 return -ENODEV;
1727 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001728 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1729 if (rc) {
1730 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1731 return -EINVAL;
1732 }
1733 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1734 if (rc) {
1735 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1736 return -EINVAL;
1737 }
1738 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1739 if (rc) {
1740 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1741 return -EINVAL;
1742 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001743 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1744 rc = gpio_request(gpio43, "disp_rst_n");
1745 if (rc) {
1746 pr_err("request gpio 43 failed, rc=%d\n", rc);
1747 return -ENODEV;
1748 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001749 dsi_power_on = true;
1750 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001751 if (on) {
1752 rc = regulator_set_optimum_mode(reg_l8, 100000);
1753 if (rc < 0) {
1754 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1755 return -EINVAL;
1756 }
1757 rc = regulator_set_optimum_mode(reg_l23, 100000);
1758 if (rc < 0) {
1759 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1760 return -EINVAL;
1761 }
1762 rc = regulator_set_optimum_mode(reg_l2, 100000);
1763 if (rc < 0) {
1764 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1765 return -EINVAL;
1766 }
1767 rc = regulator_enable(reg_l8);
1768 if (rc) {
1769 pr_err("enable l8 failed, rc=%d\n", rc);
1770 return -ENODEV;
1771 }
1772 rc = regulator_enable(reg_l23);
1773 if (rc) {
1774 pr_err("enable l8 failed, rc=%d\n", rc);
1775 return -ENODEV;
1776 }
1777 rc = regulator_enable(reg_l2);
1778 if (rc) {
1779 pr_err("enable l2 failed, rc=%d\n", rc);
1780 return -ENODEV;
1781 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001782 gpio_set_value_cansleep(gpio43, 1);
1783 } else {
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07001784 rc = regulator_disable(reg_l2);
1785 if (rc) {
1786 pr_err("disable reg_l2 failed, rc=%d\n", rc);
1787 return -ENODEV;
1788 }
1789 rc = regulator_disable(reg_l8);
1790 if (rc) {
1791 pr_err("disable reg_l8 failed, rc=%d\n", rc);
1792 return -ENODEV;
1793 }
1794 rc = regulator_disable(reg_l23);
1795 if (rc) {
1796 pr_err("disable reg_l23 failed, rc=%d\n", rc);
1797 return -ENODEV;
1798 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001799 rc = regulator_set_optimum_mode(reg_l8, 100);
1800 if (rc < 0) {
1801 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1802 return -EINVAL;
1803 }
1804 rc = regulator_set_optimum_mode(reg_l23, 100);
1805 if (rc < 0) {
1806 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1807 return -EINVAL;
1808 }
1809 rc = regulator_set_optimum_mode(reg_l2, 100);
1810 if (rc < 0) {
1811 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1812 return -EINVAL;
1813 }
1814 gpio_set_value_cansleep(gpio43, 0);
1815 }
1816 return 0;
1817}
1818
Amir Samuelov0c7270f2011-09-07 03:13:47 +03001819static int mipi_dsi_panel_power(int on)
1820{
1821 int ret;
1822
1823 pr_info("%s: on=%d\n", __func__, on);
1824
1825 if (machine_is_msm8960_liquid())
1826 ret = mipi_dsi_liquid_panel_power(on);
1827 else
1828 ret = mipi_dsi_cdp_panel_power(on);
1829
1830 return ret;
1831}
1832
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001833static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1834 .vsync_gpio = MDP_VSYNC_GPIO,
1835 .dsi_power_save = mipi_dsi_panel_power,
1836};
1837
1838#ifdef CONFIG_MSM_BUS_SCALING
1839
1840static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001841 {
1842 .src = MSM_BUS_MASTER_MDP_PORT0,
1843 .dst = MSM_BUS_SLAVE_EBI_CH0,
1844 .ab = 0,
1845 .ib = 0,
1846 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001847};
1848
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001849#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1850static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
1851 /* If HDMI is used as primary */
1852 {
1853 .src = MSM_BUS_MASTER_MDP_PORT0,
1854 .dst = MSM_BUS_SLAVE_EBI_CH0,
1855 .ab = 2000000000,
1856 .ib = 2000000000,
1857 },
1858};
1859static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1860 {
1861 ARRAY_SIZE(mdp_init_vectors),
1862 mdp_init_vectors,
1863 },
1864 {
1865 ARRAY_SIZE(hdmi_as_primary_vectors),
1866 hdmi_as_primary_vectors,
1867 },
1868 {
1869 ARRAY_SIZE(hdmi_as_primary_vectors),
1870 hdmi_as_primary_vectors,
1871 },
1872 {
1873 ARRAY_SIZE(hdmi_as_primary_vectors),
1874 hdmi_as_primary_vectors,
1875 },
1876 {
1877 ARRAY_SIZE(hdmi_as_primary_vectors),
1878 hdmi_as_primary_vectors,
1879 },
1880 {
1881 ARRAY_SIZE(hdmi_as_primary_vectors),
1882 hdmi_as_primary_vectors,
1883 },
1884};
1885#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001886static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001887 {
1888 .src = MSM_BUS_MASTER_MDP_PORT0,
1889 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001890 .ab = 216000000 * 2,
1891 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001892 },
1893};
1894
1895static struct msm_bus_vectors mdp_vga_vectors[] = {
1896 /* VGA and less video */
1897 {
1898 .src = MSM_BUS_MASTER_MDP_PORT0,
1899 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001900 .ab = 216000000 * 2,
1901 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001902 },
1903};
1904
1905static struct msm_bus_vectors mdp_720p_vectors[] = {
1906 /* 720p and less video */
1907 {
1908 .src = MSM_BUS_MASTER_MDP_PORT0,
1909 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001910 .ab = 230400000 * 2,
1911 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001912 },
1913};
1914
1915static struct msm_bus_vectors mdp_1080p_vectors[] = {
1916 /* 1080p and less video */
1917 {
1918 .src = MSM_BUS_MASTER_MDP_PORT0,
1919 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001920 .ab = 334080000 * 2,
1921 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001922 },
1923};
1924
1925static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1926 {
1927 ARRAY_SIZE(mdp_init_vectors),
1928 mdp_init_vectors,
1929 },
1930 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001931 ARRAY_SIZE(mdp_ui_vectors),
1932 mdp_ui_vectors,
1933 },
1934 {
1935 ARRAY_SIZE(mdp_ui_vectors),
1936 mdp_ui_vectors,
1937 },
1938 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001939 ARRAY_SIZE(mdp_vga_vectors),
1940 mdp_vga_vectors,
1941 },
1942 {
1943 ARRAY_SIZE(mdp_720p_vectors),
1944 mdp_720p_vectors,
1945 },
1946 {
1947 ARRAY_SIZE(mdp_1080p_vectors),
1948 mdp_1080p_vectors,
1949 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001950};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001951#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001952
1953static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1954 mdp_bus_scale_usecases,
1955 ARRAY_SIZE(mdp_bus_scale_usecases),
1956 .name = "mdp",
1957};
1958
1959#endif
1960
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001961#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1962int mdp_core_clk_rate_table[] = {
1963 200000000,
1964 200000000,
1965 200000000,
1966 200000000,
1967};
1968#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001969int mdp_core_clk_rate_table[] = {
1970 85330000,
1971 85330000,
Nagamalleswararao Ganjiad31c982011-08-15 23:24:17 -07001972 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001973 200000000,
1974};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001975#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001976
1977static struct msm_panel_common_pdata mdp_pdata = {
1978 .gpio = MDP_VSYNC_GPIO,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001979#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
1980 .mdp_core_clk_rate = 200000000,
1981#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982 .mdp_core_clk_rate = 85330000,
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07001983#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001984 .mdp_core_clk_table = mdp_core_clk_rate_table,
1985 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1986#ifdef CONFIG_MSM_BUS_SCALING
1987 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1988#endif
1989 .mdp_rev = MDP_REV_42,
kuogee hsieh3830eb92011-09-12 15:25:57 -07001990 .writeback_offset = writeback_offset,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001991};
1992
1993static struct platform_device mipi_dsi_renesas_panel_device = {
1994 .name = "mipi_renesas",
1995 .id = 0,
1996};
1997
1998static struct platform_device mipi_dsi_simulator_panel_device = {
1999 .name = "mipi_simulator",
2000 .id = 0,
2001};
2002
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07002003#define LPM_CHANNEL0 0
2004static int toshiba_gpio[] = {LPM_CHANNEL0};
2005
2006static struct mipi_dsi_panel_platform_data toshiba_pdata = {
2007 .gpio = toshiba_gpio,
2008};
2009
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002010static struct platform_device mipi_dsi_toshiba_panel_device = {
2011 .name = "mipi_toshiba",
2012 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07002013 .dev = {
2014 .platform_data = &toshiba_pdata,
2015 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002016};
2017
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002018#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002019static int dsi2lvds_gpio[2] = {
2020 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
2021 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
2022 };
2023
2024static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
2025 .gpio_num = dsi2lvds_gpio,
2026};
2027
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002028static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
2029
2030/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
2031 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
2032 /* timing */
2033 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
2034 0x0c, 0x03, 0x04, 0xa0},
2035 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
2036 {0xff, 0x00, 0x06, 0x00}, /* strength */
2037 /* pll control */
2038 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
2039 0x40, 0x07, 0x03,
2040 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
2041};
2042
2043static struct mipi_dsi_panel_platform_data novatek_pdata = {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002044 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
2045 .fpga_ctrl_mode = FPGA_SPI_INTF,
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07002046 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
2047};
2048
2049static struct platform_device mipi_dsi_novatek_panel_device = {
2050 .name = "mipi_novatek",
2051 .id = 0,
2052 .dev = {
2053 .platform_data = &novatek_pdata,
2054 }
2055};
2056
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002057static struct platform_device mipi_dsi2lvds_bridge_device = {
2058 .name = "mipi_tc358764",
2059 .id = 0,
2060 .dev.platform_data = &mipi_dsi2lvds_pdata,
2061};
2062
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002063#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2064static struct resource hdmi_msm_resources[] = {
2065 {
2066 .name = "hdmi_msm_qfprom_addr",
2067 .start = 0x00700000,
2068 .end = 0x007060FF,
2069 .flags = IORESOURCE_MEM,
2070 },
2071 {
2072 .name = "hdmi_msm_hdmi_addr",
2073 .start = 0x04A00000,
2074 .end = 0x04A00FFF,
2075 .flags = IORESOURCE_MEM,
2076 },
2077 {
2078 .name = "hdmi_msm_irq",
2079 .start = HDMI_IRQ,
2080 .end = HDMI_IRQ,
2081 .flags = IORESOURCE_IRQ,
2082 },
2083};
2084
2085static int hdmi_enable_5v(int on);
2086static int hdmi_core_power(int on, int show);
2087static int hdmi_cec_power(int on);
2088
2089static struct msm_hdmi_platform_data hdmi_msm_data = {
2090 .irq = HDMI_IRQ,
2091 .enable_5v = hdmi_enable_5v,
2092 .core_power = hdmi_core_power,
2093 .cec_power = hdmi_cec_power,
2094};
2095
2096static struct platform_device hdmi_msm_device = {
2097 .name = "hdmi_msm",
2098 .id = 0,
2099 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
2100 .resource = hdmi_msm_resources,
2101 .dev.platform_data = &hdmi_msm_data,
2102};
2103#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2104
Vinay Kalia291263e2011-11-01 17:07:05 -07002105#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
2106static struct platform_device wfd_panel_device = {
2107 .name = "wfd_panel",
2108 .id = 0,
2109 .dev.platform_data = NULL,
2110};
2111#endif
2112
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002113#ifdef CONFIG_MSM_BUS_SCALING
2114static struct msm_bus_vectors dtv_bus_init_vectors[] = {
2115 {
2116 .src = MSM_BUS_MASTER_MDP_PORT0,
2117 .dst = MSM_BUS_SLAVE_EBI_CH0,
2118 .ab = 0,
2119 .ib = 0,
2120 },
2121};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002122
2123#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
2124static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2125 {
2126 .src = MSM_BUS_MASTER_MDP_PORT0,
2127 .dst = MSM_BUS_SLAVE_EBI_CH0,
2128 .ab = 2000000000,
2129 .ib = 2000000000,
2130 },
2131};
2132#else
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002133static struct msm_bus_vectors dtv_bus_def_vectors[] = {
2134 {
2135 .src = MSM_BUS_MASTER_MDP_PORT0,
2136 .dst = MSM_BUS_SLAVE_EBI_CH0,
2137 .ab = 566092800 * 2,
2138 .ib = 707616000 * 2,
2139 },
2140};
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -07002141#endif
2142
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002143static struct msm_bus_paths dtv_bus_scale_usecases[] = {
2144 {
2145 ARRAY_SIZE(dtv_bus_init_vectors),
2146 dtv_bus_init_vectors,
2147 },
2148 {
2149 ARRAY_SIZE(dtv_bus_def_vectors),
2150 dtv_bus_def_vectors,
2151 },
2152};
2153static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
2154 dtv_bus_scale_usecases,
2155 ARRAY_SIZE(dtv_bus_scale_usecases),
2156 .name = "dtv",
2157};
2158
2159static struct lcdc_platform_data dtv_pdata = {
2160 .bus_scale_table = &dtv_bus_scale_pdata,
2161};
2162#endif
2163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002164static void __init msm_fb_add_devices(void)
2165{
Amir Samuelov0c7270f2011-09-07 03:13:47 +03002166 struct platform_device *ptr = NULL;
2167
2168 if (machine_is_msm8960_liquid())
2169 ptr = &mipi_dsi2lvds_bridge_device;
2170 else
2171 ptr = &mipi_dsi_toshiba_panel_device;
2172 platform_add_devices(&ptr, 1);
2173
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002174 if (machine_is_msm8x60_rumi3()) {
2175 msm_fb_register_device("mdp", NULL);
2176 mipi_dsi_pdata.target_type = 1;
2177 } else
2178 msm_fb_register_device("mdp", &mdp_pdata);
2179 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07002180#ifdef CONFIG_MSM_BUS_SCALING
2181 msm_fb_register_device("dtv", &dtv_pdata);
2182#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002183}
2184
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002185static struct gpiomux_setting mdp_vsync_suspend_cfg = {
2186 .func = GPIOMUX_FUNC_GPIO,
2187 .drv = GPIOMUX_DRV_2MA,
2188 .pull = GPIOMUX_PULL_DOWN,
2189};
2190
2191static struct gpiomux_setting mdp_vsync_active_cfg = {
2192 .func = GPIOMUX_FUNC_1,
2193 .drv = GPIOMUX_DRV_2MA,
2194 .pull = GPIOMUX_PULL_DOWN,
2195};
2196
2197static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
2198 {
2199 .gpio = MDP_VSYNC_GPIO,
2200 .settings = {
2201 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
2202 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
2203 },
2204 }
2205};
2206
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002207#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2208static struct gpiomux_setting hdmi_suspend_cfg = {
2209 .func = GPIOMUX_FUNC_GPIO,
2210 .drv = GPIOMUX_DRV_2MA,
2211 .pull = GPIOMUX_PULL_DOWN,
2212};
2213
2214static struct gpiomux_setting hdmi_active_1_cfg = {
2215 .func = GPIOMUX_FUNC_1,
2216 .drv = GPIOMUX_DRV_2MA,
2217 .pull = GPIOMUX_PULL_UP,
2218};
2219
2220static struct gpiomux_setting hdmi_active_2_cfg = {
2221 .func = GPIOMUX_FUNC_1,
2222 .drv = GPIOMUX_DRV_2MA,
2223 .pull = GPIOMUX_PULL_DOWN,
2224};
2225
2226static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
2227 {
2228 .gpio = 99,
2229 .settings = {
2230 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2231 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2232 },
2233 },
2234 {
2235 .gpio = 100,
2236 .settings = {
2237 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2238 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2239 },
2240 },
2241 {
2242 .gpio = 101,
2243 .settings = {
2244 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
2245 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2246 },
2247 },
2248 {
2249 .gpio = 102,
2250 .settings = {
2251 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
2252 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
2253 },
2254 },
2255};
2256
2257static int hdmi_enable_5v(int on)
2258{
2259 /* TBD: PM8921 regulator instead of 8901 */
2260 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
2261 static int prev_on;
2262 int rc;
2263
2264 if (on == prev_on)
2265 return 0;
2266
2267 if (!reg_8921_hdmi_mvs)
2268 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
2269 "hdmi_mvs");
2270
2271 if (on) {
2272 rc = regulator_enable(reg_8921_hdmi_mvs);
2273 if (rc) {
2274 pr_err("'%s' regulator enable failed, rc=%d\n",
2275 "8921_hdmi_mvs", rc);
2276 return rc;
2277 }
2278 pr_debug("%s(on): success\n", __func__);
2279 } else {
2280 rc = regulator_disable(reg_8921_hdmi_mvs);
2281 if (rc)
2282 pr_warning("'%s' regulator disable failed, rc=%d\n",
2283 "8921_hdmi_mvs", rc);
2284 pr_debug("%s(off): success\n", __func__);
2285 }
2286
2287 prev_on = on;
2288
2289 return 0;
2290}
2291
2292static int hdmi_core_power(int on, int show)
2293{
2294 static struct regulator *reg_8921_l23, *reg_8921_s4;
2295 static int prev_on;
2296 int rc;
2297
2298 if (on == prev_on)
2299 return 0;
2300
2301 /* TBD: PM8921 regulator instead of 8901 */
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002302 if (!reg_8921_l23) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002303 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002304 if (IS_ERR(reg_8921_l23)) {
2305 pr_err("could not get reg_8921_l23, rc = %ld\n",
2306 PTR_ERR(reg_8921_l23));
2307 return -ENODEV;
2308 }
2309 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
2310 if (rc) {
2311 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
2312 return -EINVAL;
2313 }
2314 }
2315 if (!reg_8921_s4) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002316 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002317 if (IS_ERR(reg_8921_s4)) {
2318 pr_err("could not get reg_8921_s4, rc = %ld\n",
2319 PTR_ERR(reg_8921_s4));
2320 return -ENODEV;
2321 }
2322 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
2323 if (rc) {
2324 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
2325 return -EINVAL;
2326 }
2327 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002328
2329 if (on) {
2330 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
2331 if (rc < 0) {
2332 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2333 return -EINVAL;
2334 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002335 rc = regulator_enable(reg_8921_l23);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002336 if (rc) {
2337 pr_err("'%s' regulator enable failed, rc=%d\n",
2338 "hdmi_avdd", rc);
2339 return rc;
2340 }
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002341 rc = regulator_enable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002342 if (rc) {
2343 pr_err("'%s' regulator enable failed, rc=%d\n",
2344 "hdmi_vcc", rc);
2345 return rc;
2346 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002347 rc = gpio_request(100, "HDMI_DDC_CLK");
2348 if (rc) {
2349 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2350 "HDMI_DDC_CLK", 100, rc);
2351 goto error1;
2352 }
2353 rc = gpio_request(101, "HDMI_DDC_DATA");
2354 if (rc) {
2355 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2356 "HDMI_DDC_DATA", 101, rc);
2357 goto error2;
2358 }
2359 rc = gpio_request(102, "HDMI_HPD");
2360 if (rc) {
2361 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2362 "HDMI_HPD", 102, rc);
2363 goto error3;
2364 }
2365 pr_debug("%s(on): success\n", __func__);
2366 } else {
2367 gpio_free(100);
2368 gpio_free(101);
2369 gpio_free(102);
2370
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002371 rc = regulator_disable(reg_8921_l23);
2372 if (rc) {
2373 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
2374 return -ENODEV;
2375 }
2376 rc = regulator_disable(reg_8921_s4);
2377 if (rc) {
2378 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
2379 return -ENODEV;
2380 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002381 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
2382 if (rc < 0) {
2383 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
2384 return -EINVAL;
2385 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002386 pr_debug("%s(off): success\n", __func__);
2387 }
2388
2389 prev_on = on;
2390
2391 return 0;
2392
2393error3:
2394 gpio_free(101);
2395error2:
2396 gpio_free(100);
2397error1:
2398 regulator_disable(reg_8921_l23);
Nagamalleswararao Ganjica0adc02011-09-22 20:35:53 -07002399 regulator_disable(reg_8921_s4);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002400 return rc;
2401}
2402
2403static int hdmi_cec_power(int on)
2404{
2405 static int prev_on;
2406 int rc;
2407
2408 if (on == prev_on)
2409 return 0;
2410
2411 if (on) {
2412 rc = gpio_request(99, "HDMI_CEC_VAR");
2413 if (rc) {
2414 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
2415 "HDMI_CEC_VAR", 99, rc);
2416 goto error;
2417 }
2418 pr_debug("%s(on): success\n", __func__);
2419 } else {
2420 gpio_free(99);
2421 pr_debug("%s(off): success\n", __func__);
2422 }
2423
2424 prev_on = on;
2425
2426 return 0;
2427error:
2428 return rc;
2429}
2430#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
2431
2432static void __init msm8960_allocate_memory_regions(void)
2433{
2434 void *addr;
2435 unsigned long size;
2436
2437 size = MSM_FB_SIZE;
2438 addr = alloc_bootmem_align(size, 0x1000);
2439 msm_fb_resources[0].start = __pa(addr);
2440 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
2441 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
2442 size, addr, __pa(addr));
2443
2444}
2445#ifdef CONFIG_WCD9310_CODEC
2446
2447#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
2448
Patrick Lai3043fba2011-08-01 14:15:57 -07002449/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
2450 * 4 micbiases are used to power various analog and digital
2451 * microphones operating at 1800 mV. Technically, all micbiases
2452 * can source from single cfilter since all microphones operate
2453 * at the same voltage level. The arrangement below is to make
2454 * sure all cfilters are exercised. LDO_H regulator ouput level
2455 * does not need to be as high as 2.85V. It is choosen for
2456 * microphone sensitivity purpose.
2457 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002458static struct tabla_pdata tabla_platform_data = {
2459 .slimbus_slave_device = {
2460 .name = "tabla-slave",
2461 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
2462 },
2463 .irq = MSM_GPIO_TO_INT(62),
2464 .irq_base = TABLA_INTERRUPT_BASE,
2465 .num_irqs = NR_TABLA_IRQS,
2466 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -07002467 .micbias = {
2468 .ldoh_v = TABLA_LDOH_2P85_V,
2469 .cfilt1_mv = 1800,
2470 .cfilt2_mv = 1800,
2471 .cfilt3_mv = 1800,
2472 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2473 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2474 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2475 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2476 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002477};
2478
2479static struct slim_device msm_slim_tabla = {
2480 .name = "tabla-slim",
2481 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
2482 .dev = {
2483 .platform_data = &tabla_platform_data,
2484 },
2485};
Santosh Mardi60e19d92011-10-28 01:15:14 +05302486
2487static struct tabla_pdata tabla20_platform_data = {
2488 .slimbus_slave_device = {
2489 .name = "tabla-slave",
2490 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
2491 },
2492 .irq = MSM_GPIO_TO_INT(62),
2493 .irq_base = TABLA_INTERRUPT_BASE,
2494 .num_irqs = NR_TABLA_IRQS,
2495 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
2496 .micbias = {
2497 .ldoh_v = TABLA_LDOH_2P85_V,
2498 .cfilt1_mv = 1800,
2499 .cfilt2_mv = 1800,
2500 .cfilt3_mv = 1800,
2501 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
2502 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
2503 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
2504 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
2505 }
2506};
2507
2508static struct slim_device msm_slim_tabla20 = {
2509 .name = "tabla2x-slim",
2510 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
2511 .dev = {
2512 .platform_data = &tabla20_platform_data,
2513 },
2514};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002515#endif
2516
2517static struct slim_boardinfo msm_slim_devices[] = {
2518#ifdef CONFIG_WCD9310_CODEC
2519 {
2520 .bus_num = 1,
2521 .slim_slave = &msm_slim_tabla,
2522 },
Santosh Mardi60e19d92011-10-28 01:15:14 +05302523 {
2524 .bus_num = 1,
2525 .slim_slave = &msm_slim_tabla20,
2526 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002527#endif
2528 /* add more slimbus slaves as needed */
2529};
2530
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002531#define MSM_WCNSS_PHYS 0x03000000
2532#define MSM_WCNSS_SIZE 0x280000
2533
2534static struct resource resources_wcnss_wlan[] = {
2535 {
2536 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2537 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
2538 .name = "wcnss_wlanrx_irq",
2539 .flags = IORESOURCE_IRQ,
2540 },
2541 {
2542 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2543 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
2544 .name = "wcnss_wlantx_irq",
2545 .flags = IORESOURCE_IRQ,
2546 },
2547 {
2548 .start = MSM_WCNSS_PHYS,
2549 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
2550 .name = "wcnss_mmio",
2551 .flags = IORESOURCE_MEM,
2552 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -07002553 {
2554 .start = 84,
2555 .end = 88,
2556 .name = "wcnss_gpios_5wire",
2557 .flags = IORESOURCE_IO,
2558 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002559};
2560
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002561static struct qcom_wcnss_opts qcom_wcnss_pdata = {
2562 .has_48mhz_xo = 1,
2563};
2564
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002565static struct platform_device msm_device_wcnss_wlan = {
2566 .name = "wcnss_wlan",
2567 .id = 0,
2568 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
2569 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -07002570 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -07002571};
2572
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002573#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2574 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
2575 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2576 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2577
2578#define QCE_SIZE 0x10000
2579#define QCE_0_BASE 0x18500000
2580
2581#define QCE_HW_KEY_SUPPORT 0
2582#define QCE_SHA_HMAC_SUPPORT 1
2583#define QCE_SHARE_CE_RESOURCE 1
2584#define QCE_CE_SHARED 0
2585
2586static struct resource qcrypto_resources[] = {
2587 [0] = {
2588 .start = QCE_0_BASE,
2589 .end = QCE_0_BASE + QCE_SIZE - 1,
2590 .flags = IORESOURCE_MEM,
2591 },
2592 [1] = {
2593 .name = "crypto_channels",
2594 .start = DMOV_CE_IN_CHAN,
2595 .end = DMOV_CE_OUT_CHAN,
2596 .flags = IORESOURCE_DMA,
2597 },
2598 [2] = {
2599 .name = "crypto_crci_in",
2600 .start = DMOV_CE_IN_CRCI,
2601 .end = DMOV_CE_IN_CRCI,
2602 .flags = IORESOURCE_DMA,
2603 },
2604 [3] = {
2605 .name = "crypto_crci_out",
2606 .start = DMOV_CE_OUT_CRCI,
2607 .end = DMOV_CE_OUT_CRCI,
2608 .flags = IORESOURCE_DMA,
2609 },
2610};
2611
2612static struct resource qcedev_resources[] = {
2613 [0] = {
2614 .start = QCE_0_BASE,
2615 .end = QCE_0_BASE + QCE_SIZE - 1,
2616 .flags = IORESOURCE_MEM,
2617 },
2618 [1] = {
2619 .name = "crypto_channels",
2620 .start = DMOV_CE_IN_CHAN,
2621 .end = DMOV_CE_OUT_CHAN,
2622 .flags = IORESOURCE_DMA,
2623 },
2624 [2] = {
2625 .name = "crypto_crci_in",
2626 .start = DMOV_CE_IN_CRCI,
2627 .end = DMOV_CE_IN_CRCI,
2628 .flags = IORESOURCE_DMA,
2629 },
2630 [3] = {
2631 .name = "crypto_crci_out",
2632 .start = DMOV_CE_OUT_CRCI,
2633 .end = DMOV_CE_OUT_CRCI,
2634 .flags = IORESOURCE_DMA,
2635 },
2636};
2637
2638#endif
2639
2640#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2641 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2642
2643static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
2644 .ce_shared = QCE_CE_SHARED,
2645 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2646 .hw_key_support = QCE_HW_KEY_SUPPORT,
2647 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2648};
2649
2650static struct platform_device qcrypto_device = {
2651 .name = "qcrypto",
2652 .id = 0,
2653 .num_resources = ARRAY_SIZE(qcrypto_resources),
2654 .resource = qcrypto_resources,
2655 .dev = {
2656 .coherent_dma_mask = DMA_BIT_MASK(32),
2657 .platform_data = &qcrypto_ce_hw_suppport,
2658 },
2659};
2660#endif
2661
2662#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2663 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2664
2665static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
2666 .ce_shared = QCE_CE_SHARED,
2667 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
2668 .hw_key_support = QCE_HW_KEY_SUPPORT,
2669 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
2670};
2671
2672static struct platform_device qcedev_device = {
2673 .name = "qce",
2674 .id = 0,
2675 .num_resources = ARRAY_SIZE(qcedev_resources),
2676 .resource = qcedev_resources,
2677 .dev = {
2678 .coherent_dma_mask = DMA_BIT_MASK(32),
2679 .platform_data = &qcedev_ce_hw_suppport,
2680 },
2681};
2682#endif
2683
2684
2685static int __init gpiomux_init(void)
2686{
2687 int rc;
2688
2689 rc = msm_gpiomux_init(NR_GPIO_IRQS);
2690 if (rc) {
2691 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
2692 return rc;
2693 }
2694
Nishant Pandit24153d82011-08-27 16:05:13 +05302695 msm_gpiomux_install(msm8960_cam_common_configs,
2696 ARRAY_SIZE(msm8960_cam_common_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002697
2698 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07002699 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002700
2701 msm_gpiomux_install(msm8960_gsbi_configs,
2702 ARRAY_SIZE(msm8960_gsbi_configs));
2703
2704 msm_gpiomux_install(msm8960_cyts_configs,
2705 ARRAY_SIZE(msm8960_cyts_configs));
2706
2707 msm_gpiomux_install(msm8960_slimbus_config,
2708 ARRAY_SIZE(msm8960_slimbus_config));
2709
2710 msm_gpiomux_install(msm8960_audio_codec_configs,
2711 ARRAY_SIZE(msm8960_audio_codec_configs));
2712
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002713 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
2714 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
2715
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002716#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2717 msm_gpiomux_install(msm8960_hdmi_configs,
2718 ARRAY_SIZE(msm8960_hdmi_configs));
2719#endif
2720
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07002721 msm_gpiomux_install(msm8960_mdp_vsync_configs,
2722 ARRAY_SIZE(msm8960_mdp_vsync_configs));
2723
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002724 msm_gpiomux_install(wcnss_5wire_interface,
2725 ARRAY_SIZE(wcnss_5wire_interface));
2726
Mohan Pallaka5e490392011-09-09 15:18:41 +05302727 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
2728 machine_is_msm8960_liquid() || machine_is_msm8960_cdp())
2729 msm_gpiomux_install(hap_lvl_shft_config,
2730 ARRAY_SIZE(hap_lvl_shft_config));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002731 return 0;
2732}
2733
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002734#define MSM_SHARED_RAM_PHYS 0x80000000
2735
2736static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
2737 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
2738 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2739 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
2740 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2741 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
2742 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2743 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
2744 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2745 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
2746 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2747 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
2748 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002749 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
2750 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
2751 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
2752 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2753 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
2754 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2755 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2756 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
2757 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
2758 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2759 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
2760 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
2761 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
2762 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002763 {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
Siddartha Mohanadossb9e4d282011-09-13 17:50:11 -07002764 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
2765 {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
2766 ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002767 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
2768 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002769};
2770
2771static struct pm8921_adc_properties pm8921_adc_data = {
2772 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
2773 .bitresolution = 15,
2774 .bipolar = 0,
2775};
2776
2777static struct pm8921_adc_platform_data pm8921_adc_pdata = {
2778 .adc_channel = pm8921_adc_channels_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002779 .adc_num_board_channel = ARRAY_SIZE(pm8921_adc_channels_data),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002780 .adc_prop = &pm8921_adc_data,
Siddartha Mohanadoss77d106e2011-09-20 16:25:59 -07002781 .adc_mpp_base = PM8921_MPP_PM_TO_SYS(1),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002782};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002783
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002784static void __init msm8960_map_io(void)
2785{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002786 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002787 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002788
2789 if (socinfo_init() < 0)
2790 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002791}
2792
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07002793#ifdef CONFIG_ARCH_MSM8930
2794static void __init msm8930_map_io(void)
2795{
2796 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
2797 msm_map_msm8930_io();
2798
2799 if (socinfo_init() < 0)
2800 pr_err("socinfo_init() failed!\n");
2801}
2802#endif
2803
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002804static void __init msm8960_init_irq(void)
2805{
2806 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002807
2808 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002809 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002810 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002811
2812 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002813 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002814
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002815 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
2816 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002817
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002818 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
2819 * as they are configured as level, which does not play nice with
2820 * handle_percpu_irq.
2821 */
2822 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
2823 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01002824 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002825 }
2826}
2827
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002828/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002829enum sdcc_controllers {
2830 SDCC1,
2831 SDCC2,
2832 SDCC3,
2833 SDCC4,
2834 SDCC5,
2835 MAX_SDCC_CONTROLLER
2836};
2837
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07002838/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002839static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
2840 /* SDCC1 : eMMC card connected */
2841 [SDCC1] = {
2842 .name = "sdc_vdd",
2843 .set_voltage_sup = 1,
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",
2854 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302855 .high_vol_level = 2950000,
2856 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002857 .hpm_uA = 600000, /* 600mA */
2858 }
2859};
2860
2861/* Only slots having eMMC card will require VCCQ voltage */
2862static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2863 /* SDCC1 : eMMC card connected */
2864 [SDCC1] = {
2865 .name = "sdc_vccq",
2866 .set_voltage_sup = 1,
2867 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302868 .high_vol_level = 1800000,
2869 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002870 .hpm_uA = 200000, /* 200mA */
2871 }
2872};
2873
2874/* All SDCC controllers may require voting for VDD PAD voltage */
2875static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2876 /* SDCC3 : External card slot connected */
2877 [SDCC3] = {
2878 .name = "sdc_vddp",
2879 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302880 .high_vol_level = 2950000,
2881 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002882 .always_on = 1,
2883 .lpm_sup = 1,
2884 /* Max. Active current required is 16 mA */
2885 .hpm_uA = 16000,
2886 /*
2887 * Sleep current required is ~300 uA. But min. vote can be
2888 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2889 * during sleep.
2890 */
2891 .lpm_uA = 2000,
2892 }
2893};
2894
2895static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2896 /* SDCC1 : eMMC card connected */
2897 [SDCC1] = {
2898 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2899 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2900 },
2901 /* SDCC3 : External card slot connected */
2902 [SDCC3] = {
2903 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2904 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2905 }
2906};
2907
2908/* SDC1 pad data */
2909static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2910 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05302911 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2912 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002913};
2914
2915static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2916 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2917 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2918 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2919};
2920
2921static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302922 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002923 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2924 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2925};
2926
2927static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302928 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002929 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2930 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2931};
2932
2933/* SDC3 pad data */
2934static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2935 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2936 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2937 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2938};
2939
2940static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2941 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2942 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2943 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2944};
2945
2946static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302947 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002948 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2949 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2950};
2951
2952static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05302953 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05302954 /*
2955 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
2956 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
2957 * which would result in false card detection interrupts.
2958 */
2959 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2960 /*
2961 * Keeping DATA lines status to PULL UP will make sure that
2962 * there is no current leak during sleep if external pull up
2963 * is connected to DATA lines.
2964 */
2965 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002966};
2967
2968struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2969 [SDCC1] = {
2970 .on = sdc1_pad_pull_on_cfg,
2971 .off = sdc1_pad_pull_off_cfg,
2972 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2973 },
2974 [SDCC3] = {
2975 .on = sdc3_pad_pull_on_cfg,
2976 .off = sdc3_pad_pull_off_cfg,
2977 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2978 },
2979};
2980
2981struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2982 [SDCC1] = {
2983 .on = sdc1_pad_drv_on_cfg,
2984 .off = sdc1_pad_drv_off_cfg,
2985 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2986 },
2987 [SDCC3] = {
2988 .on = sdc3_pad_drv_on_cfg,
2989 .off = sdc3_pad_drv_off_cfg,
2990 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2991 },
2992};
2993
2994struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2995 [SDCC1] = {
2996 .pull = &mmc_pad_pull_data[SDCC1],
2997 .drv = &mmc_pad_drv_data[SDCC1]
2998 },
2999 [SDCC3] = {
3000 .pull = &mmc_pad_pull_data[SDCC3],
3001 .drv = &mmc_pad_drv_data[SDCC3]
3002 },
3003};
3004
3005struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
3006 [SDCC1] = {
3007 .pad_data = &mmc_pad_data[SDCC1],
3008 },
3009 [SDCC3] = {
3010 .pad_data = &mmc_pad_data[SDCC3],
3011 },
3012};
3013
3014static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303015 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003016};
3017
3018static unsigned int sdc3_sup_clk_rates[] = {
3019 400000, 24000000, 48000000, 96000000
3020};
3021
3022#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3023static struct mmc_platform_data msm8960_sdc1_data = {
3024 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3025#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
3026 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
3027#else
3028 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3029#endif
3030 .sup_clk_table = sdc1_sup_clk_rates,
3031 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303032 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003033 .nonremovable = 1,
3034 .sdcc_v4_sup = true,
3035 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303036 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003037};
3038#endif
3039
3040#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3041static struct mmc_platform_data msm8960_sdc3_data = {
3042 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
3043 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
3044 .sup_clk_table = sdc3_sup_clk_rates,
3045 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05303046 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303047#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003048 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05303049#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003050 .sdcc_v4_sup = true,
3051 .vreg_data = &mmc_slot_vreg_data[SDCC3],
3052 .pin_data = &mmc_slot_pin_data[SDCC3],
3053#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
3054 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
3055 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
3056 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3057#endif
3058 .xpc_cap = 1,
3059 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
3060 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05303061 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003062};
3063#endif
3064
3065static void __init msm8960_init_mmc(void)
3066{
3067#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
3068 /* SDC1 : eMMC card connected */
3069 msm_add_sdcc(1, &msm8960_sdc1_data);
3070#endif
3071#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
3072 /* SDC3: External card slot */
3073 msm_add_sdcc(3, &msm8960_sdc3_data);
3074#endif
3075}
3076
3077static void __init msm8960_init_buses(void)
3078{
3079#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06003080 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06003081 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
3082 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
3083 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
3084 msm_bus_apps_fabric.dev.platform_data =
3085 &msm_bus_8960_apps_fabric_pdata;
3086 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
3087 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
3088 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
3089 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003090#endif
3091}
3092
3093static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
3094 .max_clock_speed = 15060000,
3095};
3096
3097#ifdef CONFIG_USB_MSM_OTG_72K
3098static struct msm_otg_platform_data msm_otg_pdata;
3099#else
3100#define USB_5V_EN 42
3101static void msm_hsusb_vbus_power(bool on)
3102{
3103 int rc;
3104 static bool vbus_is_on;
3105 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003106
3107 if (vbus_is_on == on)
3108 return;
3109
3110 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003111 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
3112 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003113 if (IS_ERR(mvs_otg_switch)) {
3114 pr_err("Unable to get mvs_otg_switch\n");
3115 return;
3116 }
3117
3118 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
3119 "usb_5v_en");
3120 if (rc < 0) {
3121 pr_err("failed to request usb_5v_en gpio\n");
3122 goto put_mvs_otg;
3123 }
3124
Anji jonnala2936fd92011-11-09 15:39:22 +05303125 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
3126 if (rc) {
3127 pr_err("%s: unable to set_direction for gpio [%d]\n",
3128 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003129 goto free_usb_5v_en;
3130 }
3131
Anji jonnala2936fd92011-11-09 15:39:22 +05303132 if (regulator_enable(mvs_otg_switch)) {
3133 pr_err("unable to enable mvs_otg_switch\n");
3134 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003135 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303136
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003137 vbus_is_on = true;
3138 return;
3139 }
Anji jonnala2936fd92011-11-09 15:39:22 +05303140 regulator_disable(mvs_otg_switch);
3141err_ldo_gpio_set_dir:
3142 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003143free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05303144 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003145put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05303146 regulator_put(mvs_otg_switch);
3147 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003148}
3149
3150static struct msm_otg_platform_data msm_otg_pdata = {
3151 .mode = USB_OTG,
3152 .otg_control = OTG_PMIC_CONTROL,
3153 .phy_type = SNPS_28NM_INTEGRATED_PHY,
3154 .pclk_src_name = "dfab_usb_hs_clk",
3155 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
3156 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05303157 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003158};
3159#endif
3160
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303161#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05303162#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05303163static struct msm_hsic_host_platform_data msm_hsic_pdata = {
3164 .strobe = 150,
3165 .data = 151,
3166};
3167#else
3168static struct msm_hsic_host_platform_data msm_hsic_pdata;
3169#endif
3170
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003171#define PID_MAGIC_ID 0x71432909
3172#define SERIAL_NUM_MAGIC_ID 0x61945374
3173#define SERIAL_NUMBER_LENGTH 127
3174#define DLOAD_USB_BASE_ADD 0x2A03F0C8
3175
3176struct magic_num_struct {
3177 uint32_t pid;
3178 uint32_t serial_num;
3179};
3180
3181struct dload_struct {
3182 uint32_t reserved1;
3183 uint32_t reserved2;
3184 uint32_t reserved3;
3185 uint16_t reserved4;
3186 uint16_t pid;
3187 char serial_number[SERIAL_NUMBER_LENGTH];
3188 uint16_t reserved5;
3189 struct magic_num_struct magic_struct;
3190};
3191
3192static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
3193{
3194 struct dload_struct __iomem *dload = 0;
3195
3196 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
3197 if (!dload) {
3198 pr_err("%s: cannot remap I/O memory region: %08x\n",
3199 __func__, DLOAD_USB_BASE_ADD);
3200 return -ENXIO;
3201 }
3202
3203 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
3204 __func__, dload, pid, snum);
3205 /* update pid */
3206 dload->magic_struct.pid = PID_MAGIC_ID;
3207 dload->pid = pid;
3208
3209 /* update serial number */
3210 dload->magic_struct.serial_num = 0;
3211 if (!snum) {
3212 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
3213 goto out;
3214 }
3215
3216 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07003217 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003218out:
3219 iounmap(dload);
3220 return 0;
3221}
3222
3223static struct android_usb_platform_data android_usb_pdata = {
3224 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
3225};
3226
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003227static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003228 .name = "android_usb",
3229 .id = -1,
3230 .dev = {
3231 .platform_data = &android_usb_pdata,
3232 },
3233};
3234
3235static uint8_t spm_wfi_cmd_sequence[] __initdata = {
3236 0x03, 0x0f,
3237};
3238
3239static uint8_t spm_power_collapse_without_rpm[] __initdata = {
3240 0x00, 0x24, 0x54, 0x10,
3241 0x09, 0x03, 0x01,
3242 0x10, 0x54, 0x30, 0x0C,
3243 0x24, 0x30, 0x0f,
3244};
3245
3246static uint8_t spm_power_collapse_with_rpm[] __initdata = {
3247 0x00, 0x24, 0x54, 0x10,
3248 0x09, 0x07, 0x01, 0x0B,
3249 0x10, 0x54, 0x30, 0x0C,
3250 0x24, 0x30, 0x0f,
3251};
3252
3253static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
3254 [0] = {
3255 .mode = MSM_SPM_MODE_CLOCK_GATING,
3256 .notify_rpm = false,
3257 .cmd = spm_wfi_cmd_sequence,
3258 },
3259 [1] = {
3260 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3261 .notify_rpm = false,
3262 .cmd = spm_power_collapse_without_rpm,
3263 },
3264 [2] = {
3265 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
3266 .notify_rpm = true,
3267 .cmd = spm_power_collapse_with_rpm,
3268 },
3269};
3270
3271static struct msm_spm_platform_data msm_spm_data[] __initdata = {
3272 [0] = {
3273 .reg_base_addr = MSM_SAW0_BASE,
3274 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3275 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3276 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3277#if defined(CONFIG_MSM_AVS_HW)
3278 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3279 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3280#endif
3281 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3282 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3283 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3284 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3285 .vctl_timeout_us = 50,
3286 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3287 .modes = msm_spm_seq_list,
3288 },
3289 [1] = {
3290 .reg_base_addr = MSM_SAW1_BASE,
3291 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3292 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
3293 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
3294#if defined(CONFIG_MSM_AVS_HW)
3295 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
3296 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
3297#endif
3298 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
3299 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3300 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
3301 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
3302 .vctl_timeout_us = 50,
3303 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
3304 .modes = msm_spm_seq_list,
3305 },
3306};
3307
3308static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
3309 0x00, 0x20, 0x03, 0x20,
3310 0x00, 0x0f,
3311};
3312
3313static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
3314 0x00, 0x20, 0x34, 0x64,
3315 0x48, 0x07, 0x48, 0x20,
3316 0x50, 0x64, 0x04, 0x34,
3317 0x50, 0x0f,
3318};
3319static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
3320 0x00, 0x10, 0x34, 0x64,
3321 0x48, 0x07, 0x48, 0x10,
3322 0x50, 0x64, 0x04, 0x34,
3323 0x50, 0x0F,
3324};
3325
3326static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
3327 [0] = {
3328 .mode = MSM_SPM_L2_MODE_RETENTION,
3329 .notify_rpm = false,
3330 .cmd = l2_spm_wfi_cmd_sequence,
3331 },
3332 [1] = {
3333 .mode = MSM_SPM_L2_MODE_GDHS,
3334 .notify_rpm = true,
3335 .cmd = l2_spm_gdhs_cmd_sequence,
3336 },
3337 [2] = {
3338 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
3339 .notify_rpm = true,
3340 .cmd = l2_spm_power_off_cmd_sequence,
3341 },
3342};
3343
3344
3345static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
3346 [0] = {
3347 .reg_base_addr = MSM_SAW_L2_BASE,
3348 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
3349 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
3350 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
3351 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
3352 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
3353 .modes = msm_spm_l2_seq_list,
3354 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
3355 },
3356};
3357
Mohan Pallaka5e490392011-09-09 15:18:41 +05303358#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
3359#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
3360
3361static struct msm_xo_voter *xo_handle_d1;
3362
3363static int isa1200_power(int on)
3364{
3365 int rc = 0;
3366
3367 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
3368
3369 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
3370 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
3371 if (rc < 0) {
3372 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
3373 __func__, on ? "" : "de-", rc);
3374 goto err_xo_vote;
3375 }
3376
3377 return 0;
3378
3379err_xo_vote:
3380 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
3381 return rc;
3382}
3383
3384static int isa1200_dev_setup(bool enable)
3385{
3386 int rc = 0;
3387
3388 struct pm_gpio hap_gpio_config = {
3389 .direction = PM_GPIO_DIR_OUT,
3390 .pull = PM_GPIO_PULL_NO,
3391 .out_strength = PM_GPIO_STRENGTH_HIGH,
3392 .function = PM_GPIO_FUNC_NORMAL,
3393 .inv_int_pol = 0,
3394 .vin_sel = 2,
3395 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
3396 .output_value = 0,
3397 };
3398
3399 if (enable == true) {
3400 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
3401 if (rc) {
3402 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3403 __func__, PM_HAP_EN_GPIO, rc);
3404 return rc;
3405 }
3406
3407 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
3408 if (rc) {
3409 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
3410 __func__, PM_HAP_LEN_GPIO, rc);
3411 return rc;
3412 }
3413
3414 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
3415 if (rc) {
3416 pr_err("%s: unable to request gpio %d (%d)\n",
3417 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
3418 return rc;
3419 }
3420
3421 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
3422 if (rc) {
3423 pr_err("%s: Unable to set direction\n", __func__);
3424 goto free_gpio;
3425 }
3426
3427 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
3428 if (IS_ERR(xo_handle_d1)) {
3429 rc = PTR_ERR(xo_handle_d1);
3430 pr_err("%s: failed to get the handle for D1(%d)\n",
3431 __func__, rc);
3432 goto gpio_set_dir;
3433 }
3434 } else {
3435 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3436
3437 msm_xo_put(xo_handle_d1);
3438 }
3439
3440 return 0;
3441
3442gpio_set_dir:
3443 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
3444free_gpio:
3445 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
3446 return rc;
3447}
3448
3449static struct isa1200_regulator isa1200_reg_data[] = {
3450 {
3451 .name = "vcc_i2c",
3452 .min_uV = ISA_I2C_VTG_MIN_UV,
3453 .max_uV = ISA_I2C_VTG_MAX_UV,
3454 .load_uA = ISA_I2C_CURR_UA,
3455 },
3456};
3457
3458static struct isa1200_platform_data isa1200_1_pdata = {
3459 .name = "vibrator",
3460 .dev_setup = isa1200_dev_setup,
3461 .power_on = isa1200_power,
3462 .hap_en_gpio = PM_HAP_EN_GPIO,
3463 .hap_len_gpio = PM_HAP_LEN_GPIO,
3464 .max_timeout = 15000,
3465 .mode_ctrl = PWM_GEN_MODE,
3466 .pwm_fd = {
3467 .pwm_div = 256,
3468 },
3469 .is_erm = false,
3470 .smart_en = true,
3471 .ext_clk_en = true,
3472 .chip_en = 1,
3473 .regulator_info = isa1200_reg_data,
3474 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
3475};
3476
3477static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
3478 {
3479 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
3480 .platform_data = &isa1200_1_pdata,
3481 },
3482};
3483
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003484#define CYTTSP_TS_GPIO_IRQ 11
3485#define CYTTSP_TS_SLEEP_GPIO 50
3486#define CYTTSP_TS_RESOUT_N_GPIO 52
3487
3488/*virtual key support */
3489static ssize_t tma340_vkeys_show(struct kobject *kobj,
3490 struct kobj_attribute *attr, char *buf)
3491{
3492 return snprintf(buf, 200,
3493 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
3494 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
3495 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
3496 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
3497 "\n");
3498}
3499
3500static struct kobj_attribute tma340_vkeys_attr = {
3501 .attr = {
3502 .mode = S_IRUGO,
3503 },
3504 .show = &tma340_vkeys_show,
3505};
3506
3507static struct attribute *tma340_properties_attrs[] = {
3508 &tma340_vkeys_attr.attr,
3509 NULL
3510};
3511
3512static struct attribute_group tma340_properties_attr_group = {
3513 .attrs = tma340_properties_attrs,
3514};
3515
3516
3517static int cyttsp_platform_init(struct i2c_client *client)
3518{
3519 int rc = 0;
3520 static struct kobject *tma340_properties_kobj;
3521
3522 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
3523 tma340_properties_kobj = kobject_create_and_add("board_properties",
3524 NULL);
3525 if (tma340_properties_kobj)
3526 rc = sysfs_create_group(tma340_properties_kobj,
3527 &tma340_properties_attr_group);
3528 if (!tma340_properties_kobj || rc)
3529 pr_err("%s: failed to create board_properties\n",
3530 __func__);
3531
3532 return 0;
3533}
3534
3535static struct cyttsp_regulator regulator_data[] = {
3536 {
3537 .name = "vdd",
3538 .min_uV = CY_TMA300_VTG_MIN_UV,
3539 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303540 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
3541 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003542 },
3543 /* TODO: Remove after runtime PM is enabled in I2C driver */
3544 {
3545 .name = "vcc_i2c",
3546 .min_uV = CY_I2C_VTG_MIN_UV,
3547 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05303548 .hpm_load_uA = CY_I2C_CURR_UA,
3549 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003550 },
3551};
3552
3553static struct cyttsp_platform_data cyttsp_pdata = {
3554 .panel_maxx = 634,
3555 .panel_maxy = 1166,
3556 .disp_maxx = 616,
3557 .disp_maxy = 1023,
3558 .disp_minx = 0,
3559 .disp_miny = 16,
3560 .flags = 0x01,
3561 .gen = CY_GEN3, /* or */
3562 .use_st = CY_USE_ST,
3563 .use_mt = CY_USE_MT,
3564 .use_hndshk = CY_SEND_HNDSHK,
3565 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05303566 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003567 .use_gestures = CY_USE_GESTURES,
3568 .fw_fname = "cyttsp_8960_cdp.hex",
3569 /* activate up to 4 groups
3570 * and set active distance
3571 */
3572 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
3573 CY_GEST_GRP3 | CY_GEST_GRP4 |
3574 CY_ACT_DIST,
3575 /* change act_intrvl to customize the Active power state
3576 * scanning/processing refresh interval for Operating mode
3577 */
3578 .act_intrvl = CY_ACT_INTRVL_DFLT,
3579 /* change tch_tmout to customize the touch timeout for the
3580 * Active power state for Operating mode
3581 */
3582 .tch_tmout = CY_TCH_TMOUT_DFLT,
3583 /* change lp_intrvl to customize the Low Power power state
3584 * scanning/processing refresh interval for Operating mode
3585 */
3586 .lp_intrvl = CY_LP_INTRVL_DFLT,
3587 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
3588 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
3589 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
3590 .regulator_info = regulator_data,
3591 .num_regulators = ARRAY_SIZE(regulator_data),
3592 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05303593 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003594};
3595
3596static struct i2c_board_info cyttsp_info[] __initdata = {
3597 {
3598 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
3599 .platform_data = &cyttsp_pdata,
3600#ifndef CY_USE_TIMER
3601 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
3602#endif /* CY_USE_TIMER */
3603 },
3604};
3605
Mohan Pallaka50837382011-09-07 11:00:57 +05303606/* configuration data */
3607static const u8 mxt_config_data[] = {
3608 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003609 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303610 /* T38 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003611 11, 1, 0, 20, 10, 11, 0, 0, 0, 0,
3612 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3613 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3614 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3615 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3616 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3617 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303618 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003619 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05303620 /* T8 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003621 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303622 /* T9 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003623 131, 0, 0, 26, 42, 0, 32, 60, 2, 5,
3624 0, 5, 5, 34, 10, 10, 10, 10, 255, 2,
3625 85, 5, 18, 18, 18, 18, 0, 0, 5, 20,
3626 0, 5, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05303627 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003628 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3629 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303630 /* T22 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003631 0, 0, 0, 0, 0, 0, 0, 0, 30, 0,
3632 0, 0, 255, 255, 255, 255, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303633 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003634 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3635 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303636 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003637 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
3638 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303639 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003640 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303641 /* T28 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003642 0, 0, 0, 8, 8, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05303643 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003644 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303645 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003646 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303647 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07003648 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05303649};
3650
3651#define MXT_TS_GPIO_IRQ 11
3652#define MXT_TS_LDO_EN_GPIO 50
3653#define MXT_TS_RESET_GPIO 52
3654
3655static void mxt_init_hw_liquid(void)
3656{
3657 int rc;
3658
3659 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
3660 if (rc) {
3661 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
3662 __func__, MXT_TS_GPIO_IRQ);
3663 return;
3664 }
3665
3666 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
3667 if (rc) {
3668 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
3669 __func__, MXT_TS_GPIO_IRQ);
3670 goto err_irq_gpio_req;
3671 }
3672
3673 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
3674 if (rc) {
3675 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
3676 __func__, MXT_TS_LDO_EN_GPIO);
3677 goto err_irq_gpio_req;
3678 }
3679
3680 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
3681 if (rc) {
3682 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
3683 __func__, MXT_TS_LDO_EN_GPIO);
3684 goto err_ldo_gpio_req;
3685 }
3686
3687 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
3688 if (rc) {
3689 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
3690 __func__, MXT_TS_RESET_GPIO);
3691 goto err_ldo_gpio_set_dir;
3692 }
3693
3694 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
3695 if (rc) {
3696 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
3697 __func__, MXT_TS_RESET_GPIO);
3698 goto err_reset_gpio_req;
3699 }
3700
3701 return;
3702
3703err_reset_gpio_req:
3704 gpio_free(MXT_TS_RESET_GPIO);
3705err_ldo_gpio_set_dir:
3706 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
3707err_ldo_gpio_req:
3708 gpio_free(MXT_TS_LDO_EN_GPIO);
3709err_irq_gpio_req:
3710 gpio_free(MXT_TS_GPIO_IRQ);
3711}
3712
3713static struct mxt_platform_data mxt_platform_data = {
3714 .config = mxt_config_data,
3715 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07003716 .x_size = 1365,
3717 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05303718 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07003719 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05303720};
3721
3722static struct i2c_board_info mxt_device_info[] __initdata = {
3723 {
3724 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
3725 .platform_data = &mxt_platform_data,
3726 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
3727 },
3728};
3729
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003730static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
3731{
3732}
3733
3734static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
3735 .clk_freq = 100000,
3736 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003737 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3738};
3739
3740static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
3741 .clk_freq = 100000,
3742 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003743 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3744};
3745
3746static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
3747 .clk_freq = 100000,
3748 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003749 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3750};
3751
3752static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
3753 .clk_freq = 100000,
3754 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003755 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
3756};
3757
3758static struct msm_rpm_platform_data msm_rpm_data = {
3759 .reg_base_addrs = {
3760 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
3761 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
3762 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
3763 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
3764 },
3765
3766 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
3767 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
3768 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
3769 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
3770 .msm_apps_ipc_rpm_val = 4,
3771};
3772
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003773static struct ks8851_pdata spi_eth_pdata = {
3774 .irq_gpio = KS8851_IRQ_GPIO,
3775 .rst_gpio = KS8851_RST_GPIO,
3776};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003777
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003778static struct spi_board_info spi_board_info[] __initdata = {
3779 {
3780 .modalias = "ks8851",
3781 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
3782 .max_speed_hz = 19200000,
3783 .bus_num = 0,
3784 .chip_select = 0,
3785 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07003786 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003787 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07003788 {
3789 .modalias = "dsi_novatek_3d_panel_spi",
3790 .max_speed_hz = 10800000,
3791 .bus_num = 0,
3792 .chip_select = 1,
3793 .mode = SPI_MODE_0,
3794 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003795};
3796
3797static struct platform_device msm_device_saw_core0 = {
3798 .name = "saw-regulator",
3799 .id = 0,
3800 .dev = {
3801 .platform_data = &msm_saw_regulator_pdata_s5,
3802 },
3803};
3804
3805static struct platform_device msm_device_saw_core1 = {
3806 .name = "saw-regulator",
3807 .id = 1,
3808 .dev = {
3809 .platform_data = &msm_saw_regulator_pdata_s6,
3810 },
3811};
3812
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003813#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3814static struct platform_device wfd_device = {
3815 .name = "msm_wfd",
3816 .id = -1,
3817};
3818#endif
3819
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07003820static struct tsens_platform_data msm_tsens_pdata = {
3821 .slope = 910,
3822 .tsens_factor = 1000,
3823 .hw_type = MSM_8960,
3824 .tsens_num_sensor = 5,
3825};
3826
3827static struct platform_device msm_tsens_device = {
3828 .name = "tsens8960-tm",
3829 .id = -1,
3830 .dev = {
3831 .platform_data = &msm_tsens_pdata,
3832 },
3833};
3834
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003835#ifdef CONFIG_MSM_FAKE_BATTERY
3836static struct platform_device fish_battery_device = {
3837 .name = "fish_battery",
3838};
3839#endif
3840
David Collins26f05562011-06-20 09:56:28 -07003841static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003842 .name = GPIO_REGULATOR_DEV_NAME,
3843 .id = PM8921_MPP_PM_TO_SYS(7),
3844 .dev = {
3845 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
3846 },
3847};
3848
David Collins26f05562011-06-20 09:56:28 -07003849static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003850 .name = GPIO_REGULATOR_DEV_NAME,
3851 .id = 91,
3852 .dev = {
3853 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
3854 },
3855};
3856
David Collinsb10be1d2011-09-02 10:29:31 -07003857static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
3858 .name = GPIO_REGULATOR_DEV_NAME,
3859 .id = PM8921_GPIO_PM_TO_SYS(17),
3860 .dev = {
3861 .platform_data =
3862 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
3863 },
3864};
3865
David Collins26f05562011-06-20 09:56:28 -07003866static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
3867 .name = "rpm-regulator",
3868 .id = -1,
3869 .dev = {
3870 .platform_data = &msm_rpm_regulator_pdata,
3871 },
3872};
3873
David Collins4c31a872011-08-31 10:07:10 -07003874static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
3875 .phys_addr_base = 0x0010C000,
3876 .reg_offsets = {
3877 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
3878 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
3879 },
3880 .phys_size = SZ_8K,
3881 .log_len = 4096, /* log's buffer length in bytes */
3882 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
3883};
3884
3885static struct platform_device msm_rpm_log_device = {
3886 .name = "msm_rpm_log",
3887 .id = -1,
3888 .dev = {
3889 .platform_data = &msm_rpm_log_pdata,
3890 },
3891};
3892
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003893static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07003894 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003895 &msm_device_smd,
3896 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05303897 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003898 &msm_device_saw_core0,
3899 &msm_device_saw_core1,
3900 &msm8960_device_ext_5v_vreg,
3901 &msm8960_device_ext_l2_vreg,
3902 &msm8960_device_ssbi_pm8921,
3903 &msm8960_device_qup_spi_gsbi1,
3904 &msm8960_device_qup_i2c_gsbi3,
3905 &msm8960_device_qup_i2c_gsbi4,
3906 &msm8960_device_qup_i2c_gsbi10,
3907#ifndef CONFIG_MSM_DSPS
3908 &msm8960_device_qup_i2c_gsbi12,
3909#endif
3910 &msm_slim_ctrl,
3911 &msm_device_wcnss_wlan,
3912#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3913 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3914 &qcrypto_device,
3915#endif
3916
3917#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
3918 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
3919 &qcedev_device,
3920#endif
3921#ifdef CONFIG_MSM_ROTATOR
3922 &msm_rotator_device,
3923#endif
3924 &msm_device_sps,
3925#ifdef CONFIG_MSM_FAKE_BATTERY
3926 &fish_battery_device,
3927#endif
3928#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07003929#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003930 &android_pmem_device,
3931 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07003932#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003933 &android_pmem_audio_device,
3934#endif
3935 &msm_fb_device,
3936 &msm_device_vidc,
3937 &msm_device_bam_dmux,
3938 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07003939
3940#ifdef CONFIG_HW_RANDOM_MSM
3941 &msm_device_rng,
3942#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06003943 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07003944#ifdef CONFIG_ION_MSM
3945 &ion_dev,
3946#endif
David Collins4c31a872011-08-31 10:07:10 -07003947 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06003948 &msm_rpm_stat_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003949#ifdef CONFIG_MSM_QDSS
3950 &msm_etb_device,
3951 &msm_tpiu_device,
3952 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07003953 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07003954 &msm_ptm_device,
3955#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07003956 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07003957 &msm8960_device_watchdog,
Vinay Kalia291263e2011-11-01 17:07:05 -07003958#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
3959 &wfd_panel_device,
Vinay Kaliaa0f744a2011-11-01 18:02:23 -07003960 &wfd_device,
Vinay Kalia291263e2011-11-01 17:07:05 -07003961#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003962};
3963
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003964static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003965 &msm8960_device_otg,
3966 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003967 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05303968 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003969 &android_usb_device,
3970 &msm_device_vidc,
3971 &mipi_dsi_simulator_panel_device,
3972 &msm_bus_apps_fabric,
3973 &msm_bus_sys_fabric,
3974 &msm_bus_mm_fabric,
3975 &msm_bus_sys_fpb,
3976 &msm_bus_cpss_fpb,
3977 &msm_pcm,
3978 &msm_pcm_routing,
3979 &msm_cpudai0,
3980 &msm_cpudai1,
3981 &msm_cpudai_hdmi_rx,
3982 &msm_cpudai_bt_rx,
3983 &msm_cpudai_bt_tx,
3984 &msm_cpudai_fm_rx,
3985 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07003986 &msm_cpudai_auxpcm_rx,
3987 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003988 &msm_cpu_fe,
3989 &msm_stub_codec,
3990 &msm_voice,
3991 &msm_voip,
3992 &msm_lpa_pcm,
3993
3994#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
3995 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
3996 &qcrypto_device,
3997#endif
3998
3999#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
4000 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
4001 &qcedev_device,
4002#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004003};
4004
4005static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004006 &msm_kgsl_3d0,
4007 &msm_kgsl_2d0,
4008 &msm_kgsl_2d1,
4009 &mipi_dsi_renesas_panel_device,
4010#ifdef CONFIG_MSM_GEMINI
4011 &msm8960_gemini_device,
4012#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004013};
4014
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004015static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004016 &msm8960_device_otg,
4017 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004018 &msm_device_hsusb_host,
4019 &android_usb_device,
4020 &msm_pcm,
4021 &msm_pcm_routing,
4022 &msm_cpudai0,
4023 &msm_cpudai1,
4024 &msm_cpudai_hdmi_rx,
4025 &msm_cpudai_bt_rx,
4026 &msm_cpudai_bt_tx,
4027 &msm_cpudai_fm_rx,
4028 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07004029 &msm_cpudai_auxpcm_rx,
4030 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004031 &msm_cpu_fe,
4032 &msm_stub_codec,
4033 &msm_kgsl_3d0,
4034#ifdef CONFIG_MSM_KGSL_2D
4035 &msm_kgsl_2d0,
4036 &msm_kgsl_2d1,
4037#endif
Chandan Uddaraju83eac3c2011-09-11 18:32:23 -07004038 &mipi_dsi_novatek_panel_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004039#ifdef CONFIG_MSM_GEMINI
4040 &msm8960_gemini_device,
4041#endif
4042 &msm_voice,
4043 &msm_voip,
4044 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05304045 &msm_cpudai_afe_01_rx,
4046 &msm_cpudai_afe_01_tx,
4047 &msm_cpudai_afe_02_rx,
4048 &msm_cpudai_afe_02_tx,
4049 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004050#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
4051 &hdmi_msm_device,
4052#endif
4053 &msm_pcm_hostless,
4054 &msm_bus_apps_fabric,
4055 &msm_bus_sys_fabric,
4056 &msm_bus_mm_fabric,
4057 &msm_bus_sys_fpb,
4058 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07004059 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004060};
4061
4062static void __init msm8960_i2c_init(void)
4063{
4064 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
4065 &msm8960_i2c_qup_gsbi4_pdata;
4066
4067 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
4068 &msm8960_i2c_qup_gsbi3_pdata;
4069
4070 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
4071 &msm8960_i2c_qup_gsbi10_pdata;
4072
4073 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
4074 &msm8960_i2c_qup_gsbi12_pdata;
4075}
4076
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004077static void __init msm8960_gfx_init(void)
4078{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06004079 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004080 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
4081 struct kgsl_device_platform_data *kgsl_3d0_pdata =
4082 msm_kgsl_3d0.dev.platform_data;
4083 kgsl_3d0_pdata->pwr_data.pwrlevel[0].gpu_freq =
4084 320000000;
4085 kgsl_3d0_pdata->pwr_data.pwrlevel[1].gpu_freq =
4086 266667000;
4087 }
4088}
4089
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004090static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
4091 .irq_base = PM8921_IRQ_BASE,
4092 .devirq = MSM_GPIO_TO_INT(104),
4093 .irq_trigger_flag = IRQF_TRIGGER_LOW,
4094};
4095
4096static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
4097 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
4098};
4099
4100static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
4101 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
4102};
4103
4104static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
4105 .rtc_write_enable = false,
Ashay Jaiswald66c9d52011-10-13 17:41:40 +05304106 .rtc_alarm_powerup = false,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004107};
4108
4109static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
4110 .pull_up = 1,
4111 .kpd_trigger_delay_us = 970,
4112 .wakeup = 1,
4113};
4114
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304115/* Rotate lock key is not available so use F1 */
4116#define KEY_ROTATE_LOCK KEY_F1
4117
4118static const unsigned int keymap_liquid[] = {
4119 KEY(0, 0, KEY_VOLUMEUP),
4120 KEY(0, 1, KEY_VOLUMEDOWN),
4121 KEY(1, 3, KEY_ROTATE_LOCK),
4122 KEY(1, 4, KEY_HOME),
4123};
4124
4125static struct matrix_keymap_data keymap_data_liquid = {
4126 .keymap_size = ARRAY_SIZE(keymap_liquid),
4127 .keymap = keymap_liquid,
4128};
4129
4130static struct pm8xxx_keypad_platform_data keypad_data_liquid = {
4131 .input_name = "keypad_8960_liquid",
4132 .input_phys_device = "keypad_8960/input0",
4133 .num_rows = 2,
4134 .num_cols = 5,
4135 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4136 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4137 .debounce_ms = 15,
4138 .scan_delay_ms = 32,
4139 .row_hold_ns = 91500,
4140 .wakeup = 1,
4141 .keymap_data = &keymap_data_liquid,
4142};
4143
4144
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004145static const unsigned int keymap[] = {
4146 KEY(0, 0, KEY_VOLUMEUP),
4147 KEY(0, 1, KEY_VOLUMEDOWN),
4148 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4149 KEY(0, 3, KEY_CAMERA_FOCUS),
4150};
4151
4152static struct matrix_keymap_data keymap_data = {
4153 .keymap_size = ARRAY_SIZE(keymap),
4154 .keymap = keymap,
4155};
4156
4157static struct pm8xxx_keypad_platform_data keypad_data = {
4158 .input_name = "keypad_8960",
4159 .input_phys_device = "keypad_8960/input0",
4160 .num_rows = 1,
4161 .num_cols = 5,
4162 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4163 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4164 .debounce_ms = 15,
4165 .scan_delay_ms = 32,
4166 .row_hold_ns = 91500,
4167 .wakeup = 1,
4168 .keymap_data = &keymap_data,
4169};
4170
4171static const unsigned int keymap_sim[] = {
4172 KEY(0, 0, KEY_7),
4173 KEY(0, 1, KEY_DOWN),
4174 KEY(0, 2, KEY_UP),
4175 KEY(0, 3, KEY_RIGHT),
4176 KEY(0, 4, KEY_ENTER),
4177 KEY(0, 5, KEY_L),
4178 KEY(0, 6, KEY_BACK),
4179 KEY(0, 7, KEY_M),
4180
4181 KEY(1, 0, KEY_LEFT),
4182 KEY(1, 1, KEY_SEND),
4183 KEY(1, 2, KEY_1),
4184 KEY(1, 3, KEY_4),
4185 KEY(1, 4, KEY_CLEAR),
4186 KEY(1, 5, KEY_MSDOS),
4187 KEY(1, 6, KEY_SPACE),
4188 KEY(1, 7, KEY_COMMA),
4189
4190 KEY(2, 0, KEY_6),
4191 KEY(2, 1, KEY_5),
4192 KEY(2, 2, KEY_8),
4193 KEY(2, 3, KEY_3),
4194 KEY(2, 4, KEY_NUMERIC_STAR),
4195 KEY(2, 5, KEY_UP),
4196 KEY(2, 6, KEY_DOWN),
4197 KEY(2, 7, KEY_LEFTSHIFT),
4198
4199 KEY(3, 0, KEY_9),
4200 KEY(3, 1, KEY_NUMERIC_POUND),
4201 KEY(3, 2, KEY_0),
4202 KEY(3, 3, KEY_2),
4203 KEY(3, 4, KEY_SLEEP),
4204 KEY(3, 5, KEY_F1),
4205 KEY(3, 6, KEY_F2),
4206 KEY(3, 7, KEY_F3),
4207
4208 KEY(4, 0, KEY_BACK),
4209 KEY(4, 1, KEY_HOME),
4210 KEY(4, 2, KEY_MENU),
4211 KEY(4, 3, KEY_VOLUMEUP),
4212 KEY(4, 4, KEY_VOLUMEDOWN),
4213 KEY(4, 5, KEY_F4),
4214 KEY(4, 6, KEY_F5),
4215 KEY(4, 7, KEY_F6),
4216
4217 KEY(5, 0, KEY_R),
4218 KEY(5, 1, KEY_T),
4219 KEY(5, 2, KEY_Y),
4220 KEY(5, 3, KEY_LEFTALT),
4221 KEY(5, 4, KEY_KPENTER),
4222 KEY(5, 5, KEY_Q),
4223 KEY(5, 6, KEY_W),
4224 KEY(5, 7, KEY_E),
4225
4226 KEY(6, 0, KEY_F),
4227 KEY(6, 1, KEY_G),
4228 KEY(6, 2, KEY_H),
4229 KEY(6, 3, KEY_CAPSLOCK),
4230 KEY(6, 4, KEY_PAGEUP),
4231 KEY(6, 5, KEY_A),
4232 KEY(6, 6, KEY_S),
4233 KEY(6, 7, KEY_D),
4234
4235 KEY(7, 0, KEY_V),
4236 KEY(7, 1, KEY_B),
4237 KEY(7, 2, KEY_N),
4238 KEY(7, 3, KEY_MENU),
4239 KEY(7, 4, KEY_PAGEDOWN),
4240 KEY(7, 5, KEY_Z),
4241 KEY(7, 6, KEY_X),
4242 KEY(7, 7, KEY_C),
4243
4244 KEY(8, 0, KEY_P),
4245 KEY(8, 1, KEY_J),
4246 KEY(8, 2, KEY_K),
4247 KEY(8, 3, KEY_INSERT),
4248 KEY(8, 4, KEY_LINEFEED),
4249 KEY(8, 5, KEY_U),
4250 KEY(8, 6, KEY_I),
4251 KEY(8, 7, KEY_O),
4252
4253 KEY(9, 0, KEY_4),
4254 KEY(9, 1, KEY_5),
4255 KEY(9, 2, KEY_6),
4256 KEY(9, 3, KEY_7),
4257 KEY(9, 4, KEY_8),
4258 KEY(9, 5, KEY_1),
4259 KEY(9, 6, KEY_2),
4260 KEY(9, 7, KEY_3),
4261
4262 KEY(10, 0, KEY_F7),
4263 KEY(10, 1, KEY_F8),
4264 KEY(10, 2, KEY_F9),
4265 KEY(10, 3, KEY_F10),
4266 KEY(10, 4, KEY_FN),
4267 KEY(10, 5, KEY_9),
4268 KEY(10, 6, KEY_0),
4269 KEY(10, 7, KEY_DOT),
4270
4271 KEY(11, 0, KEY_LEFTCTRL),
4272 KEY(11, 1, KEY_F11),
4273 KEY(11, 2, KEY_ENTER),
4274 KEY(11, 3, KEY_SEARCH),
4275 KEY(11, 4, KEY_DELETE),
4276 KEY(11, 5, KEY_RIGHT),
4277 KEY(11, 6, KEY_LEFT),
4278 KEY(11, 7, KEY_RIGHTSHIFT),
4279 KEY(0, 0, KEY_VOLUMEUP),
4280 KEY(0, 1, KEY_VOLUMEDOWN),
4281 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
4282 KEY(0, 3, KEY_CAMERA_FOCUS),
4283};
4284
4285static struct matrix_keymap_data keymap_data_sim = {
4286 .keymap_size = ARRAY_SIZE(keymap_sim),
4287 .keymap = keymap_sim,
4288};
4289
4290static struct pm8xxx_keypad_platform_data keypad_data_sim = {
4291 .input_name = "keypad_8960",
4292 .input_phys_device = "keypad_8960/input0",
4293 .num_rows = 12,
4294 .num_cols = 8,
4295 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
4296 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
4297 .debounce_ms = 15,
4298 .scan_delay_ms = 32,
4299 .row_hold_ns = 91500,
4300 .wakeup = 1,
4301 .keymap_data = &keymap_data_sim,
4302};
4303
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004304static int pm8921_therm_mitigation[] = {
4305 1100,
4306 700,
4307 600,
4308 325,
4309};
4310
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004311static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004312 .safety_time = 180,
Abhijeet Dharmapurikar33fe6fb2011-09-14 16:03:11 -07004313 .update_time = 60000,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004314 .max_voltage = 4200,
4315 .min_voltage = 3200,
4316 .resume_voltage = 4100,
4317 .term_current = 100,
4318 .cool_temp = 10,
4319 .warm_temp = 40,
4320 .temp_check_period = 1,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004321 .max_bat_chg_current = 1100,
Abhijeet Dharmapurikar34059332011-08-16 19:19:39 -07004322 .cool_bat_chg_current = 350,
4323 .warm_bat_chg_current = 350,
4324 .cool_bat_voltage = 4100,
4325 .warm_bat_voltage = 4100,
Abhijeet Dharmapurikarad742362011-08-29 19:50:02 -07004326 .thermal_mitigation = pm8921_therm_mitigation,
4327 .thermal_levels = ARRAY_SIZE(pm8921_therm_mitigation),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004328};
4329
4330static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
4331 .priority = 0,
4332};
4333
4334static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
4335 .r_sense = 10,
4336 .i_test = 2500,
4337 .v_failure = 3000,
4338 .calib_delay_ms = 600000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004339};
4340
Jay Chokshide4cefb2011-08-04 18:10:44 -07004341#define PM8921_LC_LED_MAX_CURRENT 4 /* I = 4mA */
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004342#define PM8XXX_LED_PWM_PERIOD 1000
4343#define PM8XXX_LED_PWM_DUTY_MS 20
4344/**
4345 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
4346 * driven using PWM feature.
4347 */
4348#define PM8XXX_PWM_CHANNEL_NONE -1
Jay Chokshide4cefb2011-08-04 18:10:44 -07004349
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004350static struct led_info pm8921_led_info[] = {
4351 [0] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004352 .name = "led:battery_charging",
4353 .default_trigger = "battery-charging",
Jay Chokshide4cefb2011-08-04 18:10:44 -07004354 },
4355 [1] = {
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004356 .name = "led:battery_full",
4357 .default_trigger = "battery-full",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004358 },
4359};
4360
Jay Chokshi8994e392011-09-14 18:20:39 -07004361static struct led_platform_data pm8921_led_core_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004362 .num_leds = ARRAY_SIZE(pm8921_led_info),
4363 .leds = pm8921_led_info,
4364};
4365
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004366static int pm8921_led0_pwm_duty_pcts[56] = {
4367 1, 4, 8, 12, 16, 20, 24, 28, 32, 36,
4368 40, 44, 46, 52, 56, 60, 64, 68, 72, 76,
4369 80, 84, 88, 92, 96, 100, 100, 100, 98, 95,
4370 92, 88, 84, 82, 78, 74, 70, 66, 62, 58,
4371 58, 54, 50, 48, 42, 38, 34, 30, 26, 22,
4372 14, 10, 6, 4, 1
4373};
4374
4375static struct pm8xxx_pwm_duty_cycles pm8921_led0_pwm_duty_cycles = {
4376 .duty_pcts = (int *)&pm8921_led0_pwm_duty_pcts,
4377 .num_duty_pcts = ARRAY_SIZE(pm8921_led0_pwm_duty_pcts),
4378 .duty_ms = PM8XXX_LED_PWM_DUTY_MS,
4379 .start_idx = 0,
4380};
4381
Jay Chokshi8994e392011-09-14 18:20:39 -07004382static struct pm8xxx_led_config pm8921_led_configs[] = {
4383 [0] = {
4384 .id = PM8XXX_ID_LED_0,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004385 .mode = PM8XXX_LED_MODE_PWM2,
Jay Chokshi8994e392011-09-14 18:20:39 -07004386 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004387 .pwm_channel = 5,
4388 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
4389 .pwm_duty_cycles = &pm8921_led0_pwm_duty_cycles,
Jay Chokshi8994e392011-09-14 18:20:39 -07004390 },
4391 [1] = {
4392 .id = PM8XXX_ID_LED_1,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004393 .mode = PM8XXX_LED_MODE_PWM1,
Jay Chokshi8994e392011-09-14 18:20:39 -07004394 .max_current = PM8921_LC_LED_MAX_CURRENT,
Jay Chokshi6238d5e2011-10-24 13:47:19 -07004395 .pwm_channel = 4,
4396 .pwm_period_us = PM8XXX_LED_PWM_PERIOD,
Jay Chokshi8994e392011-09-14 18:20:39 -07004397 },
4398};
4399
4400static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
4401 .led_core = &pm8921_led_core_pdata,
4402 .configs = pm8921_led_configs,
4403 .num_configs = ARRAY_SIZE(pm8921_led_configs),
4404};
4405
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004406static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
4407 .irq_pdata = &pm8xxx_irq_pdata,
4408 .gpio_pdata = &pm8xxx_gpio_pdata,
4409 .mpp_pdata = &pm8xxx_mpp_pdata,
4410 .rtc_pdata = &pm8xxx_rtc_pdata,
4411 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
4412 .keypad_pdata = &keypad_data,
4413 .misc_pdata = &pm8xxx_misc_pdata,
4414 .regulator_pdatas = msm_pm8921_regulator_pdata,
4415 .charger_pdata = &pm8921_chg_pdata,
4416 .bms_pdata = &pm8921_bms_pdata,
4417 .adc_pdata = &pm8921_adc_pdata,
4418 .leds_pdata = &pm8xxx_leds_pdata,
4419};
4420
4421static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
4422 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
4423 .slave = {
4424 .name = "pm8921-core",
4425 .platform_data = &pm8921_platform_data,
4426 },
4427};
4428
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004429static struct msm_cpuidle_state msm_cstates[] __initdata = {
4430 {0, 0, "C0", "WFI",
4431 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4432
4433 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4434 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4435
4436 {0, 2, "C2", "POWER_COLLAPSE",
4437 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
4438
4439 {1, 0, "C0", "WFI",
4440 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
4441
4442 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
4443 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
4444};
4445
4446static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
4447 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4448 .idle_supported = 1,
4449 .suspend_supported = 1,
4450 .idle_enabled = 0,
4451 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004452 },
4453
4454 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4455 .idle_supported = 1,
4456 .suspend_supported = 1,
4457 .idle_enabled = 0,
4458 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004459 },
4460
4461 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4462 .idle_supported = 1,
4463 .suspend_supported = 1,
4464 .idle_enabled = 1,
4465 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004466 },
4467
4468 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
4469 .idle_supported = 0,
4470 .suspend_supported = 1,
4471 .idle_enabled = 0,
4472 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004473 },
4474
4475 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
4476 .idle_supported = 1,
4477 .suspend_supported = 1,
4478 .idle_enabled = 0,
4479 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004480 },
4481
4482 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
4483 .idle_supported = 1,
4484 .suspend_supported = 0,
4485 .idle_enabled = 1,
4486 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004487 },
4488};
4489
4490static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
4491 {
4492 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
4493 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4494 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004495 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004496 },
4497
4498 {
4499 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
4500 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
4501 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004502 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004503 },
4504
4505 {
4506 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4507 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
4508 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004509 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004510 },
4511
4512 {
4513 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4514 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
4515 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004516 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004517 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06004518 {
4519 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4520 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
4521 false,
4522 7000, 3500, 66600000, 5150,
4523 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004524
4525 {
4526 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4527 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
4528 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004529 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004530 },
4531
4532 {
4533 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4534 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
4535 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004536 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004537 },
4538
4539 {
4540 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4541 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
4542 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004543 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004544 },
4545
4546 {
4547 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
4548 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
4549 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06004550 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004551 },
4552};
4553
4554#ifdef CONFIG_I2C
4555#define I2C_SURF 1
4556#define I2C_FFA (1 << 1)
4557#define I2C_RUMI (1 << 2)
4558#define I2C_SIM (1 << 3)
4559#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03004560#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004561
4562struct i2c_registry {
4563 u8 machs;
4564 int bus;
4565 struct i2c_board_info *info;
4566 int len;
4567};
4568
4569#ifdef CONFIG_MSM_CAMERA
4570static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
4571#ifdef CONFIG_IMX074
4572 {
4573 I2C_BOARD_INFO("imx074", 0x1A),
4574 },
4575#endif
4576#ifdef CONFIG_OV2720
4577 {
4578 I2C_BOARD_INFO("ov2720", 0x6C),
4579 },
4580#endif
Kevin Chandfecce22011-07-13 10:52:41 -07004581 {
4582 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
4583 },
Nishant Pandit474f2252011-07-23 23:17:56 +05304584#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
4585 {
4586 I2C_BOARD_INFO("sc628a", 0x6E),
4587 },
4588#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004589};
4590#endif
4591
4592/* Sensors DSPS platform data */
4593#ifdef CONFIG_MSM_DSPS
4594#define DSPS_PIL_GENERIC_NAME "dsps"
4595#endif /* CONFIG_MSM_DSPS */
4596
4597static void __init msm8960_init_dsps(void)
4598{
4599#ifdef CONFIG_MSM_DSPS
4600 struct msm_dsps_platform_data *pdata =
4601 msm_dsps_device.dev.platform_data;
4602 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
4603 pdata->gpios = NULL;
4604 pdata->gpios_num = 0;
4605
4606 platform_device_register(&msm_dsps_device);
4607#endif /* CONFIG_MSM_DSPS */
4608}
4609
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004610static void __init msm8960_init_hsic(void)
4611{
4612#ifdef CONFIG_USB_EHCI_MSM_HSIC
4613 uint32_t version = socinfo_get_version();
4614
4615 pr_info("%s: version:%d mtp:%d\n", __func__,
4616 SOCINFO_VERSION_MAJOR(version),
4617 machine_is_msm8960_mtp());
4618
4619 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
4620 machine_is_msm8960_mtp() ||
4621 machine_is_msm8960_fluid())
4622 return;
4623
4624 msm_gpiomux_install(msm8960_hsic_configs,
4625 ARRAY_SIZE(msm8960_hsic_configs));
4626
4627 platform_device_register(&msm_device_hsic_host);
4628#endif
4629}
4630
4631
Amir Samuelov5137e392011-09-21 17:31:25 +03004632#ifdef CONFIG_ISL9519_CHARGER
4633static struct isl_platform_data isl_data __initdata = {
4634 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
4635 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
4636 .max_system_voltage = 4200,
4637 .min_system_voltage = 3200,
4638 .chgcurrent = 1000, /* 1900, */
4639 .term_current = 400, /* Need fine tuning */
4640 .input_current = 2048,
4641};
4642
4643static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
4644 {
4645 I2C_BOARD_INFO("isl9519q", 0x9),
4646 .irq = 0, /* Not required when notify-by-pmic */
4647 .platform_data = &isl_data,
4648 },
4649};
4650#endif /* CONFIG_ISL9519_CHARGER */
4651
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004652static struct i2c_registry msm8960_i2c_devices[] __initdata = {
4653#ifdef CONFIG_MSM_CAMERA
4654 {
Amir Samuelov05f87802011-08-27 18:30:12 +03004655 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004656 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
4657 msm_camera_boardinfo,
4658 ARRAY_SIZE(msm_camera_boardinfo),
4659 },
4660#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03004661#ifdef CONFIG_ISL9519_CHARGER
4662 {
4663 I2C_LIQUID,
4664 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4665 isl_charger_i2c_info,
4666 ARRAY_SIZE(isl_charger_i2c_info),
4667 },
4668#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004669 {
4670 I2C_SURF | I2C_FFA | I2C_FLUID,
4671 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4672 cyttsp_info,
4673 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07004674 },
Mohan Pallaka50837382011-09-07 11:00:57 +05304675 {
4676 I2C_LIQUID,
4677 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
4678 mxt_device_info,
4679 ARRAY_SIZE(mxt_device_info),
4680 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05304681 {
4682 I2C_LIQUID,
4683 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
4684 msm_isa1200_board_info,
4685 ARRAY_SIZE(msm_isa1200_board_info),
4686 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004687};
4688#endif /* CONFIG_I2C */
4689
4690static void __init register_i2c_devices(void)
4691{
4692#ifdef CONFIG_I2C
4693 u8 mach_mask = 0;
4694 int i;
4695
4696 /* Build the matching 'supported_machs' bitmask */
4697 if (machine_is_msm8960_cdp())
4698 mach_mask = I2C_SURF;
4699 else if (machine_is_msm8960_rumi3())
4700 mach_mask = I2C_RUMI;
4701 else if (machine_is_msm8960_sim())
4702 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07004703 else if (machine_is_msm8960_fluid())
4704 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03004705 else if (machine_is_msm8960_liquid())
4706 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07004707 else if (machine_is_msm8960_mtp())
4708 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004709 else
4710 pr_err("unmatched machine ID in register_i2c_devices\n");
4711
4712 /* Run the array and install devices as appropriate */
4713 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
4714 if (msm8960_i2c_devices[i].machs & mach_mask)
4715 i2c_register_board_info(msm8960_i2c_devices[i].bus,
4716 msm8960_i2c_devices[i].info,
4717 msm8960_i2c_devices[i].len);
4718 }
4719#endif
4720}
4721
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004722static void __init msm8960_sim_init(void)
4723{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07004724 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
4725 &msm8960_device_watchdog.dev.platform_data;
4726
4727 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004728 BUG_ON(msm_rpm_init(&msm_rpm_data));
4729 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4730 ARRAY_SIZE(msm_rpmrs_levels)));
4731 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004732 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004733 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004734 msm8960_device_ssbi_pm8921.dev.platform_data =
4735 &msm8960_ssbi_pm8921_pdata;
4736 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004737
4738 /* Simulator supports a QWERTY keypad */
4739 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
4740
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004741 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4742 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4743 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004744 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004745 msm8960_i2c_init();
4746 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4747 msm_spm_l2_init(msm_spm_l2_data);
4748 msm8960_init_buses();
4749 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4750 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004751 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07004752 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004753
4754 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4755 &msm8960_qup_spi_gsbi1_pdata;
4756 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4757
4758 msm8960_init_mmc();
4759 msm_fb_add_devices();
4760 slim_register_board_info(msm_slim_devices,
4761 ARRAY_SIZE(msm_slim_devices));
4762 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4763 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4764 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4765 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004766 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004767}
4768
4769static void __init msm8960_rumi3_init(void)
4770{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004771 BUG_ON(msm_rpm_init(&msm_rpm_data));
4772 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4773 ARRAY_SIZE(msm_rpmrs_levels)));
4774 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07004775 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004776 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004777 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004778 msm8960_device_ssbi_pm8921.dev.platform_data =
4779 &msm8960_ssbi_pm8921_pdata;
4780 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4781 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4782 &msm8960_qup_spi_gsbi1_pdata;
4783 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4784 msm8960_i2c_init();
4785 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4786 msm_spm_l2_init(msm_spm_l2_data);
4787 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4788 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004789 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004790 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004791 register_i2c_devices();
4792 msm_fb_add_devices();
4793 slim_register_board_info(msm_slim_devices,
4794 ARRAY_SIZE(msm_slim_devices));
4795 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4796 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4797 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4798 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004799 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004800}
4801
4802static void __init msm8960_cdp_init(void)
4803{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07004804 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
4805 pr_err("meminfo_init() failed!\n");
4806
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004807 BUG_ON(msm_rpm_init(&msm_rpm_data));
4808 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
4809 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07004810
4811 pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004812 regulator_suppress_info_printing();
4813 if (msm_xo_init())
4814 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07004815 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07004816 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05304817 if (machine_is_msm8960_liquid())
4818 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07004819 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
4820 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
4821 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05304822#ifdef CONFIG_USB_EHCI_MSM_HSIC
4823 if (machine_is_msm8960_liquid()) {
4824 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
4825 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
4826 }
4827#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05304828 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004829 gpiomux_init();
Mohan Pallaka002e9e02011-08-05 11:23:22 +05304830 if (machine_is_msm8960_liquid())
4831 pm8921_platform_data.keypad_pdata = &keypad_data_liquid;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004832 msm8960_device_qup_spi_gsbi1.dev.platform_data =
4833 &msm8960_qup_spi_gsbi1_pdata;
4834 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
4835 msm8960_device_ssbi_pm8921.dev.platform_data =
4836 &msm8960_ssbi_pm8921_pdata;
4837 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
4838 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06004839 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004840 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
4841 msm_spm_l2_init(msm_spm_l2_data);
4842 msm8960_init_buses();
4843 platform_add_devices(msm_footswitch_devices,
4844 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07004845 if (machine_is_msm8960_liquid())
4846 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004847 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
4848 pm8921_gpio_mpp_init();
4849 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07004850 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004851 msm8960_init_cam();
4852 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07004853 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05304854 if (machine_is_msm8960_liquid())
4855 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004856 register_i2c_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004857 msm_fb_add_devices();
4858 slim_register_board_info(msm_slim_devices,
4859 ARRAY_SIZE(msm_slim_devices));
4860 msm8960_init_dsps();
4861 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
4862 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
4863 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
4864 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07004865 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06004866 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004867}
4868
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004869MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
4870 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004871 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004872 .init_irq = msm8960_init_irq,
4873 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004874 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004875 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004876 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08004877MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004878
4879MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
4880 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004881 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004882 .init_irq = msm8960_init_irq,
4883 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08004884 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004885 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004886 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08004887MACHINE_END
4888
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004889MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
4890 .map_io = msm8960_map_io,
4891 .reserve = msm8960_reserve,
4892 .init_irq = msm8960_init_irq,
4893 .timer = &msm_timer,
4894 .init_machine = msm8960_cdp_init,
4895 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004896 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004897MACHINE_END
4898
4899MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
4900 .map_io = msm8960_map_io,
4901 .reserve = msm8960_reserve,
4902 .init_irq = msm8960_init_irq,
4903 .timer = &msm_timer,
4904 .init_machine = msm8960_cdp_init,
4905 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004906 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004907MACHINE_END
4908
4909MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
4910 .map_io = msm8960_map_io,
4911 .reserve = msm8960_reserve,
4912 .init_irq = msm8960_init_irq,
4913 .timer = &msm_timer,
4914 .init_machine = msm8960_cdp_init,
4915 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004916 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004917MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004918
4919MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
4920 .map_io = msm8960_map_io,
4921 .reserve = msm8960_reserve,
4922 .init_irq = msm8960_init_irq,
4923 .timer = &msm_timer,
4924 .init_machine = msm8960_cdp_init,
4925 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07004926 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03004927MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004928
4929#ifdef CONFIG_ARCH_MSM8930
4930MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
4931 .map_io = msm8930_map_io,
4932 .reserve = msm8960_reserve,
4933 .init_irq = msm8960_init_irq,
4934 .timer = &msm_timer,
4935 .init_machine = msm8960_cdp_init,
4936 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004937 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004938MACHINE_END
4939
4940MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
4941 .map_io = msm8930_map_io,
4942 .reserve = msm8960_reserve,
4943 .init_irq = msm8960_init_irq,
4944 .timer = &msm_timer,
4945 .init_machine = msm8960_cdp_init,
4946 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004947 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004948MACHINE_END
4949
4950MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
4951 .map_io = msm8930_map_io,
4952 .reserve = msm8960_reserve,
4953 .init_irq = msm8960_init_irq,
4954 .timer = &msm_timer,
4955 .init_machine = msm8960_cdp_init,
4956 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07004957 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07004958MACHINE_END
4959#endif