blob: e28b4ea418d971e08a594b2683f635bc30e877c5 [file] [log] [blame]
Nagamalleswararao Ganji70fac1e2011-12-29 19:06:37 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002 *
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 *
12 */
13
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <linux/platform_device.h>
17#include <linux/bootmem.h>
Huaibin Yang4a084e32011-12-15 15:25:52 -080018#include <linux/ion.h>
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080019#include <asm/mach-types.h>
20#include <mach/msm_bus_board.h>
Huaibin Yanga5419422011-12-08 23:52:10 -080021#include <mach/msm_memtypes.h>
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080022#include <mach/board.h>
23#include <mach/gpio.h>
24#include <mach/gpiomux.h>
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -080025#include <mach/ion.h>
Amir Samuelov6f1e5002012-02-01 17:42:43 +020026#include <mach/socinfo.h>
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -080027
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080028#include "devices.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080029#include "board-8960.h"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080030
31#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
Padmanabhan Komanduruede0a632012-01-25 12:01:28 +053032#define MSM_FB_PRIM_BUF_SIZE \
Eugene Yasman7052e132012-03-11 16:16:06 +020033 (roundup((roundup(1920, 32) * roundup(1200, 32) * 4), 4096) * 3)
34 /* 4 bpp x 3 pages */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080035#else
Padmanabhan Komanduruede0a632012-01-25 12:01:28 +053036#define MSM_FB_PRIM_BUF_SIZE \
Eugene Yasman7052e132012-03-11 16:16:06 +020037 (roundup((roundup(1920, 32) * roundup(1200, 32) * 4), 4096) * 2)
38 /* 4 bpp x 2 pages */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080039#endif
40
41#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
Padmanabhan Komanduruede0a632012-01-25 12:01:28 +053042#define MSM_FB_EXT_BUF_SIZE \
Eugene Yasman7052e132012-03-11 16:16:06 +020043 (roundup((roundup(1920, 32) * roundup(1080, 32) * 2), 4096) * 1)
44 /* 2 bpp x 1 page */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080045#elif defined(CONFIG_FB_MSM_TVOUT)
Padmanabhan Komanduruede0a632012-01-25 12:01:28 +053046#define MSM_FB_EXT_BUF_SIZE \
Eugene Yasman7052e132012-03-11 16:16:06 +020047 (roundup((roundup(720, 32) * roundup(576, 32) * 2), 4096) * 2)
48 /* 2 bpp x 2 pages */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080049#else
50#define MSM_FB_EXT_BUF_SIZE 0
51#endif
52
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080053/* Note: must be multiple of 4096 */
Huaibin Yang27634b82011-12-09 00:16:25 -080054#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE, 4096)
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080055
Huaibin Yanga5419422011-12-08 23:52:10 -080056#ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK
Eugene Yasman7052e132012-03-11 16:16:06 +020057#define MSM_FB_OVERLAY0_WRITEBACK_SIZE \
58 roundup((roundup(1920, 32) * roundup(1200, 32) * 3 * 2), 4096)
Huaibin Yanga5419422011-12-08 23:52:10 -080059#else
60#define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0)
61#endif /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */
62
63#ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK
Eugene Yasman7052e132012-03-11 16:16:06 +020064#define MSM_FB_OVERLAY1_WRITEBACK_SIZE \
65 roundup((roundup(1920, 32) * roundup(1080, 32) * 3 * 2), 4096)
Huaibin Yanga5419422011-12-08 23:52:10 -080066#else
67#define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0)
68#endif /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */
69
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080070#define MDP_VSYNC_GPIO 0
71
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080072#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
73#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
74#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
Ravishangar Kalyanamda07f662012-02-16 13:29:43 -080075#define MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME "mipi_video_toshiba_wuxga"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080076#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
Amir Samuelov6f1e5002012-02-01 17:42:43 +020077#define MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME "mipi_video_chimei_wuxga"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080078#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
79#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -080080#define MIPI_VIDEO_ORISE_720P_PANEL_NAME "mipi_video_orise_720p"
81#define MIPI_CMD_ORISE_720P_PANEL_NAME "mipi_cmd_orise_720p"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080082#define HDMI_PANEL_NAME "hdmi_msm"
83#define TVOUT_PANEL_NAME "tvout_msm"
84
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -080085#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
86unsigned char hdmi_is_primary = 1;
87#else
88unsigned char hdmi_is_primary;
89#endif
90
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080091static struct resource msm_fb_resources[] = {
92 {
93 .flags = IORESOURCE_DMA,
94 }
95};
96
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -080097static void set_mdp_clocks_for_wuxga(void);
Amir Samuelovf0d1f542012-02-06 12:50:42 +020098
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080099static int msm_fb_detect_panel(const char *name)
100{
101 if (machine_is_msm8960_liquid()) {
Amir Samuelov6f1e5002012-02-01 17:42:43 +0200102 u32 ver = socinfo_get_platform_version();
103 if (SOCINFO_VERSION_MAJOR(ver) == 3) {
104 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME,
105 strnlen(MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME,
Amir Samuelovf0d1f542012-02-06 12:50:42 +0200106 PANEL_NAME_MAX_LEN))) {
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800107 set_mdp_clocks_for_wuxga();
Amir Samuelov6f1e5002012-02-01 17:42:43 +0200108 return 0;
Amir Samuelovf0d1f542012-02-06 12:50:42 +0200109 }
Amir Samuelov6f1e5002012-02-01 17:42:43 +0200110 } else {
111 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
112 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
113 PANEL_NAME_MAX_LEN)))
114 return 0;
115 }
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800116 } else {
117 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
118 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
119 PANEL_NAME_MAX_LEN)))
120 return 0;
121
Ravishangar Kalyanama4286d72012-02-15 16:09:58 -0800122#if !defined(CONFIG_FB_MSM_LVDS_MIPI_PANEL_DETECT) && \
123 !defined(CONFIG_FB_MSM_MIPI_PANEL_DETECT)
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800124 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
125 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
126 PANEL_NAME_MAX_LEN)))
127 return 0;
128
129 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
130 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
131 PANEL_NAME_MAX_LEN)))
132 return 0;
133
134 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
135 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
136 PANEL_NAME_MAX_LEN)))
137 return 0;
138
139 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
140 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
141 PANEL_NAME_MAX_LEN)))
142 return 0;
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800143
Ravishangar Kalyanamda07f662012-02-16 13:29:43 -0800144 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
145 strnlen(MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800146 PANEL_NAME_MAX_LEN))) {
147 set_mdp_clocks_for_wuxga();
148 return 0;
149 }
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -0800150
151 if (!strncmp(name, MIPI_VIDEO_ORISE_720P_PANEL_NAME,
152 strnlen(MIPI_VIDEO_ORISE_720P_PANEL_NAME,
153 PANEL_NAME_MAX_LEN)))
154 return 0;
155
156 if (!strncmp(name, MIPI_CMD_ORISE_720P_PANEL_NAME,
157 strnlen(MIPI_CMD_ORISE_720P_PANEL_NAME,
158 PANEL_NAME_MAX_LEN)))
159 return 0;
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800160#endif
161 }
162
163 if (!strncmp(name, HDMI_PANEL_NAME,
164 strnlen(HDMI_PANEL_NAME,
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -0700165 PANEL_NAME_MAX_LEN))) {
166 if (hdmi_is_primary)
167 set_mdp_clocks_for_wuxga();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800168 return 0;
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -0700169 }
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800170
171 if (!strncmp(name, TVOUT_PANEL_NAME,
172 strnlen(TVOUT_PANEL_NAME,
173 PANEL_NAME_MAX_LEN)))
174 return 0;
175
176 pr_warning("%s: not supported '%s'", __func__, name);
177 return -ENODEV;
178}
179
180static struct msm_fb_platform_data msm_fb_pdata = {
181 .detect_client = msm_fb_detect_panel,
182};
183
184static struct platform_device msm_fb_device = {
185 .name = "msm_fb",
186 .id = 0,
187 .num_resources = ARRAY_SIZE(msm_fb_resources),
188 .resource = msm_fb_resources,
189 .dev.platform_data = &msm_fb_pdata,
190};
191
Chandan Uddaraju2679f092012-03-09 15:48:04 -0800192static void mipi_dsi_panel_pwm_cfg(void)
193{
194 int rc;
195 static int mipi_dsi_panel_gpio_configured;
196 static struct pm_gpio pwm_enable = {
197 .direction = PM_GPIO_DIR_OUT,
198 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
199 .output_value = 1,
200 .pull = PM_GPIO_PULL_NO,
201 .vin_sel = PM_GPIO_VIN_VPH,
202 .out_strength = PM_GPIO_STRENGTH_HIGH,
203 .function = PM_GPIO_FUNC_NORMAL,
204 .inv_int_pol = 0,
205 .disable_pin = 0,
206 };
207 static struct pm_gpio pwm_mode = {
208 .direction = PM_GPIO_DIR_OUT,
209 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
210 .output_value = 0,
211 .pull = PM_GPIO_PULL_NO,
212 .vin_sel = PM_GPIO_VIN_S4,
213 .out_strength = PM_GPIO_STRENGTH_HIGH,
214 .function = PM_GPIO_FUNC_2,
215 .inv_int_pol = 0,
216 .disable_pin = 0,
217 };
218
219 if (mipi_dsi_panel_gpio_configured == 0) {
220 /* pm8xxx: gpio-21, Backlight Enable */
221 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(21),
222 &pwm_enable);
223 if (rc != 0)
224 pr_err("%s: pwm_enabled failed\n", __func__);
225
226 /* pm8xxx: gpio-24, Bl: Off, PWM mode */
227 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(24),
228 &pwm_mode);
229 if (rc != 0)
230 pr_err("%s: pwm_mode failed\n", __func__);
231
232 mipi_dsi_panel_gpio_configured++;
233 }
234}
235
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800236static bool dsi_power_on;
237
238/**
239 * LiQUID panel on/off
240 *
241 * @param on
242 *
243 * @return int
244 */
245static int mipi_dsi_liquid_panel_power(int on)
246{
247 static struct regulator *reg_l2, *reg_ext_3p3v;
248 static int gpio21, gpio24, gpio43;
249 int rc;
250
Chandan Uddaraju2679f092012-03-09 15:48:04 -0800251 mipi_dsi_panel_pwm_cfg();
Jeff Ohlstein2cbe5ba2011-12-16 13:32:56 -0800252 pr_debug("%s: on=%d\n", __func__, on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800253
254 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
255 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
256 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
257
258 if (!dsi_power_on) {
259
260 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
261 "dsi_vdda");
262 if (IS_ERR(reg_l2)) {
263 pr_err("could not get 8921_l2, rc = %ld\n",
264 PTR_ERR(reg_l2));
265 return -ENODEV;
266 }
267
268 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
269 if (rc) {
270 pr_err("set_voltage l2 failed, rc=%d\n", rc);
271 return -EINVAL;
272 }
273
274 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
275 "vdd_lvds_3p3v");
276 if (IS_ERR(reg_ext_3p3v)) {
277 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
278 PTR_ERR(reg_ext_3p3v));
279 return -ENODEV;
280 }
281
282 rc = gpio_request(gpio21, "disp_pwr_en_n");
283 if (rc) {
284 pr_err("request gpio 21 failed, rc=%d\n", rc);
285 return -ENODEV;
286 }
287
288 rc = gpio_request(gpio43, "disp_rst_n");
289 if (rc) {
290 pr_err("request gpio 43 failed, rc=%d\n", rc);
291 return -ENODEV;
292 }
293
294 rc = gpio_request(gpio24, "disp_backlight_pwm");
295 if (rc) {
296 pr_err("request gpio 24 failed, rc=%d\n", rc);
297 return -ENODEV;
298 }
299
300 dsi_power_on = true;
301 }
302
303 if (on) {
304 rc = regulator_set_optimum_mode(reg_l2, 100000);
305 if (rc < 0) {
306 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
307 return -EINVAL;
308 }
309 rc = regulator_enable(reg_l2);
310 if (rc) {
311 pr_err("enable l2 failed, rc=%d\n", rc);
312 return -ENODEV;
313 }
314
315 rc = regulator_enable(reg_ext_3p3v);
316 if (rc) {
317 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
318 return -ENODEV;
319 }
320
321 /* set reset pin before power enable */
322 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
323
324 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
325 msleep(20);
326 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
327 msleep(20);
328 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
329 msleep(20);
330 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
331 msleep(20);
332 } else {
333 gpio_set_value_cansleep(gpio43, 0);
334 gpio_set_value_cansleep(gpio21, 1);
335
336 rc = regulator_disable(reg_l2);
337 if (rc) {
338 pr_err("disable reg_l2 failed, rc=%d\n", rc);
339 return -ENODEV;
340 }
341 rc = regulator_disable(reg_ext_3p3v);
342 if (rc) {
343 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
344 return -ENODEV;
345 }
346 rc = regulator_set_optimum_mode(reg_l2, 100);
347 if (rc < 0) {
348 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
349 return -EINVAL;
350 }
351 }
352
353 return 0;
354}
355
356static int mipi_dsi_cdp_panel_power(int on)
357{
358 static struct regulator *reg_l8, *reg_l23, *reg_l2;
359 static int gpio43;
360 int rc;
361
Jeff Ohlstein2cbe5ba2011-12-16 13:32:56 -0800362 pr_debug("%s: state : %d\n", __func__, on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800363
364 if (!dsi_power_on) {
365
366 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
367 "dsi_vdc");
368 if (IS_ERR(reg_l8)) {
369 pr_err("could not get 8921_l8, rc = %ld\n",
370 PTR_ERR(reg_l8));
371 return -ENODEV;
372 }
373 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
374 "dsi_vddio");
375 if (IS_ERR(reg_l23)) {
376 pr_err("could not get 8921_l23, rc = %ld\n",
377 PTR_ERR(reg_l23));
378 return -ENODEV;
379 }
380 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
381 "dsi_vdda");
382 if (IS_ERR(reg_l2)) {
383 pr_err("could not get 8921_l2, rc = %ld\n",
384 PTR_ERR(reg_l2));
385 return -ENODEV;
386 }
387 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
388 if (rc) {
389 pr_err("set_voltage l8 failed, rc=%d\n", rc);
390 return -EINVAL;
391 }
392 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
393 if (rc) {
394 pr_err("set_voltage l23 failed, rc=%d\n", rc);
395 return -EINVAL;
396 }
397 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
398 if (rc) {
399 pr_err("set_voltage l2 failed, rc=%d\n", rc);
400 return -EINVAL;
401 }
402 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
403 rc = gpio_request(gpio43, "disp_rst_n");
404 if (rc) {
405 pr_err("request gpio 43 failed, rc=%d\n", rc);
406 return -ENODEV;
407 }
408 dsi_power_on = true;
409 }
410 if (on) {
411 rc = regulator_set_optimum_mode(reg_l8, 100000);
412 if (rc < 0) {
413 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
414 return -EINVAL;
415 }
416 rc = regulator_set_optimum_mode(reg_l23, 100000);
417 if (rc < 0) {
418 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
419 return -EINVAL;
420 }
421 rc = regulator_set_optimum_mode(reg_l2, 100000);
422 if (rc < 0) {
423 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
424 return -EINVAL;
425 }
426 rc = regulator_enable(reg_l8);
427 if (rc) {
428 pr_err("enable l8 failed, rc=%d\n", rc);
429 return -ENODEV;
430 }
431 rc = regulator_enable(reg_l23);
432 if (rc) {
433 pr_err("enable l8 failed, rc=%d\n", rc);
434 return -ENODEV;
435 }
436 rc = regulator_enable(reg_l2);
437 if (rc) {
438 pr_err("enable l2 failed, rc=%d\n", rc);
439 return -ENODEV;
440 }
441 gpio_set_value_cansleep(gpio43, 1);
442 } else {
443 rc = regulator_disable(reg_l2);
444 if (rc) {
445 pr_err("disable reg_l2 failed, rc=%d\n", rc);
446 return -ENODEV;
447 }
448 rc = regulator_disable(reg_l8);
449 if (rc) {
450 pr_err("disable reg_l8 failed, rc=%d\n", rc);
451 return -ENODEV;
452 }
453 rc = regulator_disable(reg_l23);
454 if (rc) {
455 pr_err("disable reg_l23 failed, rc=%d\n", rc);
456 return -ENODEV;
457 }
458 rc = regulator_set_optimum_mode(reg_l8, 100);
459 if (rc < 0) {
460 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
461 return -EINVAL;
462 }
463 rc = regulator_set_optimum_mode(reg_l23, 100);
464 if (rc < 0) {
465 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
466 return -EINVAL;
467 }
468 rc = regulator_set_optimum_mode(reg_l2, 100);
469 if (rc < 0) {
470 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
471 return -EINVAL;
472 }
473 gpio_set_value_cansleep(gpio43, 0);
474 }
475 return 0;
476}
477
478static int mipi_dsi_panel_power(int on)
479{
480 int ret;
481
Jeff Ohlstein2cbe5ba2011-12-16 13:32:56 -0800482 pr_debug("%s: on=%d\n", __func__, on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800483
484 if (machine_is_msm8960_liquid())
485 ret = mipi_dsi_liquid_panel_power(on);
486 else
487 ret = mipi_dsi_cdp_panel_power(on);
488
489 return ret;
490}
491
492static struct mipi_dsi_platform_data mipi_dsi_pdata = {
493 .vsync_gpio = MDP_VSYNC_GPIO,
494 .dsi_power_save = mipi_dsi_panel_power,
495};
496
497#ifdef CONFIG_MSM_BUS_SCALING
498
Nagamalleswararao Ganji5fabbd62011-11-06 23:10:43 -0800499static struct msm_bus_vectors rotator_init_vectors[] = {
500 {
501 .src = MSM_BUS_MASTER_ROTATOR,
502 .dst = MSM_BUS_SLAVE_EBI_CH0,
503 .ab = 0,
504 .ib = 0,
505 },
506};
507
508static struct msm_bus_vectors rotator_ui_vectors[] = {
509 {
510 .src = MSM_BUS_MASTER_ROTATOR,
511 .dst = MSM_BUS_SLAVE_EBI_CH0,
512 .ab = (1024 * 600 * 4 * 2 * 60),
513 .ib = (1024 * 600 * 4 * 2 * 60 * 1.5),
514 },
515};
516
517static struct msm_bus_vectors rotator_vga_vectors[] = {
518 {
519 .src = MSM_BUS_MASTER_ROTATOR,
520 .dst = MSM_BUS_SLAVE_EBI_CH0,
521 .ab = (640 * 480 * 2 * 2 * 30),
522 .ib = (640 * 480 * 2 * 2 * 30 * 1.5),
523 },
524};
525static struct msm_bus_vectors rotator_720p_vectors[] = {
526 {
527 .src = MSM_BUS_MASTER_ROTATOR,
528 .dst = MSM_BUS_SLAVE_EBI_CH0,
529 .ab = (1280 * 736 * 2 * 2 * 30),
530 .ib = (1280 * 736 * 2 * 2 * 30 * 1.5),
531 },
532};
533
534static struct msm_bus_vectors rotator_1080p_vectors[] = {
535 {
536 .src = MSM_BUS_MASTER_ROTATOR,
537 .dst = MSM_BUS_SLAVE_EBI_CH0,
538 .ab = (1920 * 1088 * 2 * 2 * 30),
539 .ib = (1920 * 1088 * 2 * 2 * 30 * 1.5),
540 },
541};
542
543static struct msm_bus_paths rotator_bus_scale_usecases[] = {
544 {
545 ARRAY_SIZE(rotator_init_vectors),
546 rotator_init_vectors,
547 },
548 {
549 ARRAY_SIZE(rotator_ui_vectors),
550 rotator_ui_vectors,
551 },
552 {
553 ARRAY_SIZE(rotator_vga_vectors),
554 rotator_vga_vectors,
555 },
556 {
557 ARRAY_SIZE(rotator_720p_vectors),
558 rotator_720p_vectors,
559 },
560 {
561 ARRAY_SIZE(rotator_1080p_vectors),
562 rotator_1080p_vectors,
563 },
564};
565
566struct msm_bus_scale_pdata rotator_bus_scale_pdata = {
567 rotator_bus_scale_usecases,
568 ARRAY_SIZE(rotator_bus_scale_usecases),
569 .name = "rotator",
570};
571
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800572static struct msm_bus_vectors mdp_init_vectors[] = {
573 {
574 .src = MSM_BUS_MASTER_MDP_PORT0,
575 .dst = MSM_BUS_SLAVE_EBI_CH0,
576 .ab = 0,
577 .ib = 0,
578 },
579};
580
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800581static struct msm_bus_vectors mdp_ui_vectors[] = {
582 {
583 .src = MSM_BUS_MASTER_MDP_PORT0,
584 .dst = MSM_BUS_SLAVE_EBI_CH0,
585 .ab = 216000000 * 2,
586 .ib = 270000000 * 2,
587 },
588};
589
590static struct msm_bus_vectors mdp_vga_vectors[] = {
591 /* VGA and less video */
592 {
593 .src = MSM_BUS_MASTER_MDP_PORT0,
594 .dst = MSM_BUS_SLAVE_EBI_CH0,
595 .ab = 216000000 * 2,
596 .ib = 270000000 * 2,
597 },
598};
599
600static struct msm_bus_vectors mdp_720p_vectors[] = {
601 /* 720p and less video */
602 {
603 .src = MSM_BUS_MASTER_MDP_PORT0,
604 .dst = MSM_BUS_SLAVE_EBI_CH0,
605 .ab = 230400000 * 2,
606 .ib = 288000000 * 2,
607 },
608};
609
610static struct msm_bus_vectors mdp_1080p_vectors[] = {
611 /* 1080p and less video */
612 {
613 .src = MSM_BUS_MASTER_MDP_PORT0,
614 .dst = MSM_BUS_SLAVE_EBI_CH0,
615 .ab = 334080000 * 2,
616 .ib = 417600000 * 2,
617 },
618};
619
620static struct msm_bus_paths mdp_bus_scale_usecases[] = {
621 {
622 ARRAY_SIZE(mdp_init_vectors),
623 mdp_init_vectors,
624 },
625 {
626 ARRAY_SIZE(mdp_ui_vectors),
627 mdp_ui_vectors,
628 },
629 {
630 ARRAY_SIZE(mdp_ui_vectors),
631 mdp_ui_vectors,
632 },
633 {
634 ARRAY_SIZE(mdp_vga_vectors),
635 mdp_vga_vectors,
636 },
637 {
638 ARRAY_SIZE(mdp_720p_vectors),
639 mdp_720p_vectors,
640 },
641 {
642 ARRAY_SIZE(mdp_1080p_vectors),
643 mdp_1080p_vectors,
644 },
645};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800646
647static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
648 mdp_bus_scale_usecases,
649 ARRAY_SIZE(mdp_bus_scale_usecases),
650 .name = "mdp",
651};
652
653#endif
654
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800655static int mdp_core_clk_rate_table[] = {
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800656 85330000,
Huaibin Yang1f180ee2012-01-30 16:23:06 -0800657 128000000,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800658 160000000,
659 200000000,
660};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800661
662static struct msm_panel_common_pdata mdp_pdata = {
663 .gpio = MDP_VSYNC_GPIO,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800664 .mdp_core_clk_rate = 85330000,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800665 .mdp_core_clk_table = mdp_core_clk_rate_table,
666 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
667#ifdef CONFIG_MSM_BUS_SCALING
668 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
669#endif
670 .mdp_rev = MDP_REV_42,
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800671#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Ravishangar Kalyanama3b168b2012-03-26 11:13:11 -0700672 .mem_hid = BIT(ION_CP_MM_HEAP_ID),
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800673#else
674 .mem_hid = MEMTYPE_EBI1,
675#endif
Chandan Uddaraju2679f092012-03-09 15:48:04 -0800676 .cont_splash_enabled = 0x01,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800677};
678
Huaibin Yanga5419422011-12-08 23:52:10 -0800679void __init msm8960_mdp_writeback(struct memtype_reserve* reserve_table)
680{
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800681 mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE;
682 mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE;
683#if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
684 reserve_table[mdp_pdata.mem_hid].size +=
685 mdp_pdata.ov0_wb_size;
686 reserve_table[mdp_pdata.mem_hid].size +=
687 mdp_pdata.ov1_wb_size;
688#endif
Huaibin Yanga5419422011-12-08 23:52:10 -0800689}
690
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800691static struct platform_device mipi_dsi_renesas_panel_device = {
692 .name = "mipi_renesas",
693 .id = 0,
694};
695
696static struct platform_device mipi_dsi_simulator_panel_device = {
697 .name = "mipi_simulator",
698 .id = 0,
699};
700
701#define LPM_CHANNEL0 0
702static int toshiba_gpio[] = {LPM_CHANNEL0};
703
704static struct mipi_dsi_panel_platform_data toshiba_pdata = {
705 .gpio = toshiba_gpio,
Chandan Uddaraju2679f092012-03-09 15:48:04 -0800706 .dsi_pwm_cfg = mipi_dsi_panel_pwm_cfg,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800707};
708
709static struct platform_device mipi_dsi_toshiba_panel_device = {
710 .name = "mipi_toshiba",
711 .id = 0,
712 .dev = {
713 .platform_data = &toshiba_pdata,
714 }
715};
716
717#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelovca199b92012-01-31 14:50:04 +0200718static int dsi2lvds_gpio[4] = {
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800719 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
Amir Samuelovca199b92012-01-31 14:50:04 +0200720 0x1F08, /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
721 GPIO_LIQUID_EXPANDER_BASE+6, /* TN Enable */
722 GPIO_LIQUID_EXPANDER_BASE+7, /* TN Mode */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800723 };
724
725static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
726 .gpio_num = dsi2lvds_gpio,
727};
728
729static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
730
731/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
732 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
733 /* timing */
734 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
735 0x0c, 0x03, 0x04, 0xa0},
736 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
737 {0xff, 0x00, 0x06, 0x00}, /* strength */
738 /* pll control */
739 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
740 0x40, 0x07, 0x03,
741 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
742};
743
744static struct mipi_dsi_panel_platform_data novatek_pdata = {
745 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
746 .fpga_ctrl_mode = FPGA_SPI_INTF,
747 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
748};
749
750static struct platform_device mipi_dsi_novatek_panel_device = {
751 .name = "mipi_novatek",
752 .id = 0,
753 .dev = {
754 .platform_data = &novatek_pdata,
755 }
756};
757
758static struct platform_device mipi_dsi2lvds_bridge_device = {
759 .name = "mipi_tc358764",
760 .id = 0,
761 .dev.platform_data = &mipi_dsi2lvds_pdata,
762};
763
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -0800764static struct platform_device mipi_dsi_orise_panel_device = {
765 .name = "mipi_orise",
766 .id = 0,
767};
768
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800769#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
770static struct resource hdmi_msm_resources[] = {
771 {
772 .name = "hdmi_msm_qfprom_addr",
773 .start = 0x00700000,
774 .end = 0x007060FF,
775 .flags = IORESOURCE_MEM,
776 },
777 {
778 .name = "hdmi_msm_hdmi_addr",
779 .start = 0x04A00000,
780 .end = 0x04A00FFF,
781 .flags = IORESOURCE_MEM,
782 },
783 {
784 .name = "hdmi_msm_irq",
785 .start = HDMI_IRQ,
786 .end = HDMI_IRQ,
787 .flags = IORESOURCE_IRQ,
788 },
789};
790
791static int hdmi_enable_5v(int on);
792static int hdmi_core_power(int on, int show);
793static int hdmi_cec_power(int on);
794
795static struct msm_hdmi_platform_data hdmi_msm_data = {
796 .irq = HDMI_IRQ,
797 .enable_5v = hdmi_enable_5v,
798 .core_power = hdmi_core_power,
799 .cec_power = hdmi_cec_power,
800};
801
802static struct platform_device hdmi_msm_device = {
803 .name = "hdmi_msm",
804 .id = 0,
805 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
806 .resource = hdmi_msm_resources,
807 .dev.platform_data = &hdmi_msm_data,
808};
809#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
810
811#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
812static struct platform_device wfd_panel_device = {
813 .name = "wfd_panel",
814 .id = 0,
815 .dev.platform_data = NULL,
816};
Stepan Moskovchenko270888d2011-11-30 12:19:11 -0800817
818static struct platform_device wfd_device = {
819 .name = "msm_wfd",
820 .id = -1,
821};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800822#endif
823
824#ifdef CONFIG_MSM_BUS_SCALING
825static struct msm_bus_vectors dtv_bus_init_vectors[] = {
826 {
827 .src = MSM_BUS_MASTER_MDP_PORT0,
828 .dst = MSM_BUS_SLAVE_EBI_CH0,
829 .ab = 0,
830 .ib = 0,
831 },
832};
833
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800834static struct msm_bus_vectors dtv_bus_def_vectors[] = {
835 {
836 .src = MSM_BUS_MASTER_MDP_PORT0,
837 .dst = MSM_BUS_SLAVE_EBI_CH0,
838 .ab = 566092800 * 2,
839 .ib = 707616000 * 2,
840 },
841};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800842
843static struct msm_bus_paths dtv_bus_scale_usecases[] = {
844 {
845 ARRAY_SIZE(dtv_bus_init_vectors),
846 dtv_bus_init_vectors,
847 },
848 {
849 ARRAY_SIZE(dtv_bus_def_vectors),
850 dtv_bus_def_vectors,
851 },
852};
853static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
854 dtv_bus_scale_usecases,
855 ARRAY_SIZE(dtv_bus_scale_usecases),
856 .name = "dtv",
857};
858
859static struct lcdc_platform_data dtv_pdata = {
860 .bus_scale_table = &dtv_bus_scale_pdata,
861};
862#endif
863
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800864#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800865static int hdmi_enable_5v(int on)
866{
867 /* TBD: PM8921 regulator instead of 8901 */
868 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
869 static int prev_on;
870 int rc;
871
872 if (on == prev_on)
873 return 0;
874
Ajay Singh Parmar07847642011-12-09 02:57:45 +0530875 if (!reg_8921_hdmi_mvs) {
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800876 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
Ajay Singh Parmar07847642011-12-09 02:57:45 +0530877 "hdmi_mvs");
878 if (IS_ERR(reg_8921_hdmi_mvs)) {
879 pr_err("'%s' regulator not found, rc=%ld\n",
880 "hdmi_mvs", IS_ERR(reg_8921_hdmi_mvs));
881 reg_8921_hdmi_mvs = NULL;
882 return -ENODEV;
883 }
884 }
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800885
886 if (on) {
887 rc = regulator_enable(reg_8921_hdmi_mvs);
888 if (rc) {
889 pr_err("'%s' regulator enable failed, rc=%d\n",
890 "8921_hdmi_mvs", rc);
891 return rc;
892 }
893 pr_debug("%s(on): success\n", __func__);
894 } else {
895 rc = regulator_disable(reg_8921_hdmi_mvs);
896 if (rc)
897 pr_warning("'%s' regulator disable failed, rc=%d\n",
898 "8921_hdmi_mvs", rc);
899 pr_debug("%s(off): success\n", __func__);
900 }
901
902 prev_on = on;
903
904 return 0;
905}
906
907static int hdmi_core_power(int on, int show)
908{
909 static struct regulator *reg_8921_l23, *reg_8921_s4;
910 static int prev_on;
911 int rc;
912
913 if (on == prev_on)
914 return 0;
915
916 /* TBD: PM8921 regulator instead of 8901 */
917 if (!reg_8921_l23) {
918 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
919 if (IS_ERR(reg_8921_l23)) {
920 pr_err("could not get reg_8921_l23, rc = %ld\n",
921 PTR_ERR(reg_8921_l23));
922 return -ENODEV;
923 }
924 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
925 if (rc) {
926 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
927 return -EINVAL;
928 }
929 }
930 if (!reg_8921_s4) {
931 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
932 if (IS_ERR(reg_8921_s4)) {
933 pr_err("could not get reg_8921_s4, rc = %ld\n",
934 PTR_ERR(reg_8921_s4));
935 return -ENODEV;
936 }
937 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
938 if (rc) {
939 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
940 return -EINVAL;
941 }
942 }
943
944 if (on) {
945 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
946 if (rc < 0) {
947 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
948 return -EINVAL;
949 }
950 rc = regulator_enable(reg_8921_l23);
951 if (rc) {
952 pr_err("'%s' regulator enable failed, rc=%d\n",
953 "hdmi_avdd", rc);
954 return rc;
955 }
956 rc = regulator_enable(reg_8921_s4);
957 if (rc) {
958 pr_err("'%s' regulator enable failed, rc=%d\n",
959 "hdmi_vcc", rc);
960 return rc;
961 }
962 rc = gpio_request(100, "HDMI_DDC_CLK");
963 if (rc) {
964 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
965 "HDMI_DDC_CLK", 100, rc);
966 goto error1;
967 }
968 rc = gpio_request(101, "HDMI_DDC_DATA");
969 if (rc) {
970 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
971 "HDMI_DDC_DATA", 101, rc);
972 goto error2;
973 }
974 rc = gpio_request(102, "HDMI_HPD");
975 if (rc) {
976 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
977 "HDMI_HPD", 102, rc);
978 goto error3;
979 }
980 pr_debug("%s(on): success\n", __func__);
981 } else {
982 gpio_free(100);
983 gpio_free(101);
984 gpio_free(102);
985
986 rc = regulator_disable(reg_8921_l23);
987 if (rc) {
988 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
989 return -ENODEV;
990 }
991 rc = regulator_disable(reg_8921_s4);
992 if (rc) {
993 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
994 return -ENODEV;
995 }
996 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
997 if (rc < 0) {
998 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
999 return -EINVAL;
1000 }
1001 pr_debug("%s(off): success\n", __func__);
1002 }
1003
1004 prev_on = on;
1005
1006 return 0;
1007
1008error3:
1009 gpio_free(101);
1010error2:
1011 gpio_free(100);
1012error1:
1013 regulator_disable(reg_8921_l23);
1014 regulator_disable(reg_8921_s4);
1015 return rc;
1016}
1017
1018static int hdmi_cec_power(int on)
1019{
1020 static int prev_on;
1021 int rc;
1022
1023 if (on == prev_on)
1024 return 0;
1025
1026 if (on) {
1027 rc = gpio_request(99, "HDMI_CEC_VAR");
1028 if (rc) {
1029 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1030 "HDMI_CEC_VAR", 99, rc);
1031 goto error;
1032 }
1033 pr_debug("%s(on): success\n", __func__);
1034 } else {
1035 gpio_free(99);
1036 pr_debug("%s(off): success\n", __func__);
1037 }
1038
1039 prev_on = on;
1040
1041 return 0;
1042error:
1043 return rc;
1044}
1045#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1046
1047void __init msm8960_init_fb(void)
1048{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001049 platform_device_register(&msm_fb_device);
1050
Stepan Moskovchenko270888d2011-11-30 12:19:11 -08001051#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
1052 platform_device_register(&wfd_panel_device);
1053 platform_device_register(&wfd_device);
1054#endif
1055
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001056 if (machine_is_msm8960_sim())
1057 platform_device_register(&mipi_dsi_simulator_panel_device);
1058
1059 if (machine_is_msm8960_rumi3())
1060 platform_device_register(&mipi_dsi_renesas_panel_device);
1061
1062 if (!machine_is_msm8960_sim() && !machine_is_msm8960_rumi3()) {
1063 platform_device_register(&mipi_dsi_novatek_panel_device);
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -08001064 platform_device_register(&mipi_dsi_orise_panel_device);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001065
1066#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1067 platform_device_register(&hdmi_msm_device);
1068#endif
1069 }
1070
1071 if (machine_is_msm8960_liquid())
1072 platform_device_register(&mipi_dsi2lvds_bridge_device);
1073 else
1074 platform_device_register(&mipi_dsi_toshiba_panel_device);
1075
1076 if (machine_is_msm8x60_rumi3()) {
1077 msm_fb_register_device("mdp", NULL);
1078 mipi_dsi_pdata.target_type = 1;
1079 } else
1080 msm_fb_register_device("mdp", &mdp_pdata);
1081 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
1082#ifdef CONFIG_MSM_BUS_SCALING
1083 msm_fb_register_device("dtv", &dtv_pdata);
1084#endif
1085}
1086
1087void __init msm8960_allocate_fb_region(void)
1088{
1089 void *addr;
1090 unsigned long size;
1091
1092 size = MSM_FB_SIZE;
1093 addr = alloc_bootmem_align(size, 0x1000);
1094 msm_fb_resources[0].start = __pa(addr);
1095 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1096 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1097 size, addr, __pa(addr));
1098}
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001099
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -07001100/**
1101 * Set MDP clocks to high frequency to avoid DSI underflow
1102 * when using high resolution 1200x1920 WUXGA panels
1103 */
1104static void set_mdp_clocks_for_wuxga(void)
1105{
1106 int i;
1107
1108 mdp_ui_vectors[0].ab = 2000000000;
1109 mdp_ui_vectors[0].ib = 2000000000;
1110 mdp_vga_vectors[0].ab = 2000000000;
1111 mdp_vga_vectors[0].ib = 2000000000;
1112 mdp_720p_vectors[0].ab = 2000000000;
1113 mdp_720p_vectors[0].ib = 2000000000;
1114 mdp_1080p_vectors[0].ab = 2000000000;
1115 mdp_1080p_vectors[0].ib = 2000000000;
1116
1117 mdp_pdata.mdp_core_clk_rate = 200000000;
1118
1119 for (i = 0; i < ARRAY_SIZE(mdp_core_clk_rate_table); i++)
1120 mdp_core_clk_rate_table[i] = 200000000;
1121
1122 if (hdmi_is_primary) {
1123 dtv_bus_def_vectors[0].ab = 2000000000;
1124 dtv_bus_def_vectors[0].ib = 2000000000;
1125 }
1126}
1127
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001128void __init msm8960_set_display_params(char *prim_panel, char *ext_panel)
1129{
1130 if (strnlen(prim_panel, PANEL_NAME_MAX_LEN)) {
1131 strlcpy(msm_fb_pdata.prim_panel_name, prim_panel,
1132 PANEL_NAME_MAX_LEN);
1133 pr_debug("msm_fb_pdata.prim_panel_name %s\n",
1134 msm_fb_pdata.prim_panel_name);
1135
1136 if (!strncmp((char *)msm_fb_pdata.prim_panel_name,
1137 HDMI_PANEL_NAME, strnlen(HDMI_PANEL_NAME,
1138 PANEL_NAME_MAX_LEN))) {
1139 pr_debug("HDMI is the primary display by"
1140 " boot parameter\n");
1141 hdmi_is_primary = 1;
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -07001142 set_mdp_clocks_for_wuxga();
1143 }
1144 if (!strncmp((char *)msm_fb_pdata.prim_panel_name,
1145 MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
1146 strnlen(MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
1147 PANEL_NAME_MAX_LEN))) {
1148 set_mdp_clocks_for_wuxga();
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001149 }
1150 }
1151 if (strnlen(ext_panel, PANEL_NAME_MAX_LEN)) {
1152 strlcpy(msm_fb_pdata.ext_panel_name, ext_panel,
1153 PANEL_NAME_MAX_LEN);
1154 pr_debug("msm_fb_pdata.ext_panel_name %s\n",
1155 msm_fb_pdata.ext_panel_name);
1156 }
1157}