blob: 7e9226663592d45690b55bae0e94249aec92e8fb [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 \
33 (roundup((1920 * 1200 * 4), 4096) * 3) /* 4 bpp x 3 pages */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080034#else
Padmanabhan Komanduruede0a632012-01-25 12:01:28 +053035#define MSM_FB_PRIM_BUF_SIZE \
36 (roundup((1920 * 1200 * 4), 4096) * 2) /* 4 bpp x 2 pages */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080037#endif
38
39#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
Padmanabhan Komanduruede0a632012-01-25 12:01:28 +053040#define MSM_FB_EXT_BUF_SIZE \
41 (roundup((1920 * 1088 * 2), 4096) * 1) /* 2 bpp x 1 page */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080042#elif defined(CONFIG_FB_MSM_TVOUT)
Padmanabhan Komanduruede0a632012-01-25 12:01:28 +053043#define MSM_FB_EXT_BUF_SIZE \
44 (roundup((720 * 576 * 2), 4096) * 2) /* 2 bpp x 2 pages */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080045#else
46#define MSM_FB_EXT_BUF_SIZE 0
47#endif
48
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080049/* Note: must be multiple of 4096 */
Huaibin Yang27634b82011-12-09 00:16:25 -080050#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE, 4096)
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080051
Huaibin Yanga5419422011-12-08 23:52:10 -080052#ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK
Amir Samuelovd7621032011-12-25 12:24:04 +020053#define MSM_FB_OVERLAY0_WRITEBACK_SIZE roundup((1920 * 1200 * 3 * 2), 4096)
Huaibin Yanga5419422011-12-08 23:52:10 -080054#else
55#define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0)
56#endif /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */
57
58#ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK
59#define MSM_FB_OVERLAY1_WRITEBACK_SIZE roundup((1920 * 1088 * 3 * 2), 4096)
60#else
61#define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0)
62#endif /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */
63
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080064#define MDP_VSYNC_GPIO 0
65
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080066#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
67#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
68#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
Ravishangar Kalyanamda07f662012-02-16 13:29:43 -080069#define MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME "mipi_video_toshiba_wuxga"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080070#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
Amir Samuelov6f1e5002012-02-01 17:42:43 +020071#define MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME "mipi_video_chimei_wuxga"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080072#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
73#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -080074#define MIPI_VIDEO_ORISE_720P_PANEL_NAME "mipi_video_orise_720p"
75#define MIPI_CMD_ORISE_720P_PANEL_NAME "mipi_cmd_orise_720p"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080076#define HDMI_PANEL_NAME "hdmi_msm"
77#define TVOUT_PANEL_NAME "tvout_msm"
78
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -080079#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
80unsigned char hdmi_is_primary = 1;
81#else
82unsigned char hdmi_is_primary;
83#endif
84
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080085static struct resource msm_fb_resources[] = {
86 {
87 .flags = IORESOURCE_DMA,
88 }
89};
90
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -080091static void set_mdp_clocks_for_wuxga(void);
Amir Samuelovf0d1f542012-02-06 12:50:42 +020092
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080093static int msm_fb_detect_panel(const char *name)
94{
95 if (machine_is_msm8960_liquid()) {
Amir Samuelov6f1e5002012-02-01 17:42:43 +020096 u32 ver = socinfo_get_platform_version();
97 if (SOCINFO_VERSION_MAJOR(ver) == 3) {
98 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME,
99 strnlen(MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME,
Amir Samuelovf0d1f542012-02-06 12:50:42 +0200100 PANEL_NAME_MAX_LEN))) {
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800101 set_mdp_clocks_for_wuxga();
Amir Samuelov6f1e5002012-02-01 17:42:43 +0200102 return 0;
Amir Samuelovf0d1f542012-02-06 12:50:42 +0200103 }
Amir Samuelov6f1e5002012-02-01 17:42:43 +0200104 } else {
105 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
106 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
107 PANEL_NAME_MAX_LEN)))
108 return 0;
109 }
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800110 } else {
111 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
112 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
113 PANEL_NAME_MAX_LEN)))
114 return 0;
115
Ravishangar Kalyanama4286d72012-02-15 16:09:58 -0800116#if !defined(CONFIG_FB_MSM_LVDS_MIPI_PANEL_DETECT) && \
117 !defined(CONFIG_FB_MSM_MIPI_PANEL_DETECT)
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800118 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
119 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
120 PANEL_NAME_MAX_LEN)))
121 return 0;
122
123 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
124 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
125 PANEL_NAME_MAX_LEN)))
126 return 0;
127
128 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
129 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
130 PANEL_NAME_MAX_LEN)))
131 return 0;
132
133 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
134 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
135 PANEL_NAME_MAX_LEN)))
136 return 0;
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800137
Ravishangar Kalyanamda07f662012-02-16 13:29:43 -0800138 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
139 strnlen(MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800140 PANEL_NAME_MAX_LEN))) {
141 set_mdp_clocks_for_wuxga();
142 return 0;
143 }
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -0800144
145 if (!strncmp(name, MIPI_VIDEO_ORISE_720P_PANEL_NAME,
146 strnlen(MIPI_VIDEO_ORISE_720P_PANEL_NAME,
147 PANEL_NAME_MAX_LEN)))
148 return 0;
149
150 if (!strncmp(name, MIPI_CMD_ORISE_720P_PANEL_NAME,
151 strnlen(MIPI_CMD_ORISE_720P_PANEL_NAME,
152 PANEL_NAME_MAX_LEN)))
153 return 0;
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800154#endif
155 }
156
157 if (!strncmp(name, HDMI_PANEL_NAME,
158 strnlen(HDMI_PANEL_NAME,
159 PANEL_NAME_MAX_LEN)))
160 return 0;
161
162 if (!strncmp(name, TVOUT_PANEL_NAME,
163 strnlen(TVOUT_PANEL_NAME,
164 PANEL_NAME_MAX_LEN)))
165 return 0;
166
167 pr_warning("%s: not supported '%s'", __func__, name);
168 return -ENODEV;
169}
170
171static struct msm_fb_platform_data msm_fb_pdata = {
172 .detect_client = msm_fb_detect_panel,
173};
174
175static struct platform_device msm_fb_device = {
176 .name = "msm_fb",
177 .id = 0,
178 .num_resources = ARRAY_SIZE(msm_fb_resources),
179 .resource = msm_fb_resources,
180 .dev.platform_data = &msm_fb_pdata,
181};
182
183static bool dsi_power_on;
184
185/**
186 * LiQUID panel on/off
187 *
188 * @param on
189 *
190 * @return int
191 */
192static int mipi_dsi_liquid_panel_power(int on)
193{
194 static struct regulator *reg_l2, *reg_ext_3p3v;
195 static int gpio21, gpio24, gpio43;
196 int rc;
197
Jeff Ohlstein2cbe5ba2011-12-16 13:32:56 -0800198 pr_debug("%s: on=%d\n", __func__, on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800199
200 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
201 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
202 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
203
204 if (!dsi_power_on) {
205
206 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
207 "dsi_vdda");
208 if (IS_ERR(reg_l2)) {
209 pr_err("could not get 8921_l2, rc = %ld\n",
210 PTR_ERR(reg_l2));
211 return -ENODEV;
212 }
213
214 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
215 if (rc) {
216 pr_err("set_voltage l2 failed, rc=%d\n", rc);
217 return -EINVAL;
218 }
219
220 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
221 "vdd_lvds_3p3v");
222 if (IS_ERR(reg_ext_3p3v)) {
223 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
224 PTR_ERR(reg_ext_3p3v));
225 return -ENODEV;
226 }
227
228 rc = gpio_request(gpio21, "disp_pwr_en_n");
229 if (rc) {
230 pr_err("request gpio 21 failed, rc=%d\n", rc);
231 return -ENODEV;
232 }
233
234 rc = gpio_request(gpio43, "disp_rst_n");
235 if (rc) {
236 pr_err("request gpio 43 failed, rc=%d\n", rc);
237 return -ENODEV;
238 }
239
240 rc = gpio_request(gpio24, "disp_backlight_pwm");
241 if (rc) {
242 pr_err("request gpio 24 failed, rc=%d\n", rc);
243 return -ENODEV;
244 }
245
246 dsi_power_on = true;
247 }
248
249 if (on) {
250 rc = regulator_set_optimum_mode(reg_l2, 100000);
251 if (rc < 0) {
252 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
253 return -EINVAL;
254 }
255 rc = regulator_enable(reg_l2);
256 if (rc) {
257 pr_err("enable l2 failed, rc=%d\n", rc);
258 return -ENODEV;
259 }
260
261 rc = regulator_enable(reg_ext_3p3v);
262 if (rc) {
263 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
264 return -ENODEV;
265 }
266
267 /* set reset pin before power enable */
268 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
269
270 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
271 msleep(20);
272 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
273 msleep(20);
274 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
275 msleep(20);
276 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
277 msleep(20);
278 } else {
279 gpio_set_value_cansleep(gpio43, 0);
280 gpio_set_value_cansleep(gpio21, 1);
281
282 rc = regulator_disable(reg_l2);
283 if (rc) {
284 pr_err("disable reg_l2 failed, rc=%d\n", rc);
285 return -ENODEV;
286 }
287 rc = regulator_disable(reg_ext_3p3v);
288 if (rc) {
289 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
290 return -ENODEV;
291 }
292 rc = regulator_set_optimum_mode(reg_l2, 100);
293 if (rc < 0) {
294 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
295 return -EINVAL;
296 }
297 }
298
299 return 0;
300}
301
302static int mipi_dsi_cdp_panel_power(int on)
303{
304 static struct regulator *reg_l8, *reg_l23, *reg_l2;
305 static int gpio43;
306 int rc;
307
Jeff Ohlstein2cbe5ba2011-12-16 13:32:56 -0800308 pr_debug("%s: state : %d\n", __func__, on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800309
310 if (!dsi_power_on) {
311
312 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
313 "dsi_vdc");
314 if (IS_ERR(reg_l8)) {
315 pr_err("could not get 8921_l8, rc = %ld\n",
316 PTR_ERR(reg_l8));
317 return -ENODEV;
318 }
319 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
320 "dsi_vddio");
321 if (IS_ERR(reg_l23)) {
322 pr_err("could not get 8921_l23, rc = %ld\n",
323 PTR_ERR(reg_l23));
324 return -ENODEV;
325 }
326 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
327 "dsi_vdda");
328 if (IS_ERR(reg_l2)) {
329 pr_err("could not get 8921_l2, rc = %ld\n",
330 PTR_ERR(reg_l2));
331 return -ENODEV;
332 }
333 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
334 if (rc) {
335 pr_err("set_voltage l8 failed, rc=%d\n", rc);
336 return -EINVAL;
337 }
338 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
339 if (rc) {
340 pr_err("set_voltage l23 failed, rc=%d\n", rc);
341 return -EINVAL;
342 }
343 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
344 if (rc) {
345 pr_err("set_voltage l2 failed, rc=%d\n", rc);
346 return -EINVAL;
347 }
348 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
349 rc = gpio_request(gpio43, "disp_rst_n");
350 if (rc) {
351 pr_err("request gpio 43 failed, rc=%d\n", rc);
352 return -ENODEV;
353 }
354 dsi_power_on = true;
355 }
356 if (on) {
357 rc = regulator_set_optimum_mode(reg_l8, 100000);
358 if (rc < 0) {
359 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
360 return -EINVAL;
361 }
362 rc = regulator_set_optimum_mode(reg_l23, 100000);
363 if (rc < 0) {
364 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
365 return -EINVAL;
366 }
367 rc = regulator_set_optimum_mode(reg_l2, 100000);
368 if (rc < 0) {
369 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
370 return -EINVAL;
371 }
372 rc = regulator_enable(reg_l8);
373 if (rc) {
374 pr_err("enable l8 failed, rc=%d\n", rc);
375 return -ENODEV;
376 }
377 rc = regulator_enable(reg_l23);
378 if (rc) {
379 pr_err("enable l8 failed, rc=%d\n", rc);
380 return -ENODEV;
381 }
382 rc = regulator_enable(reg_l2);
383 if (rc) {
384 pr_err("enable l2 failed, rc=%d\n", rc);
385 return -ENODEV;
386 }
387 gpio_set_value_cansleep(gpio43, 1);
388 } else {
389 rc = regulator_disable(reg_l2);
390 if (rc) {
391 pr_err("disable reg_l2 failed, rc=%d\n", rc);
392 return -ENODEV;
393 }
394 rc = regulator_disable(reg_l8);
395 if (rc) {
396 pr_err("disable reg_l8 failed, rc=%d\n", rc);
397 return -ENODEV;
398 }
399 rc = regulator_disable(reg_l23);
400 if (rc) {
401 pr_err("disable reg_l23 failed, rc=%d\n", rc);
402 return -ENODEV;
403 }
404 rc = regulator_set_optimum_mode(reg_l8, 100);
405 if (rc < 0) {
406 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
407 return -EINVAL;
408 }
409 rc = regulator_set_optimum_mode(reg_l23, 100);
410 if (rc < 0) {
411 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
412 return -EINVAL;
413 }
414 rc = regulator_set_optimum_mode(reg_l2, 100);
415 if (rc < 0) {
416 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
417 return -EINVAL;
418 }
419 gpio_set_value_cansleep(gpio43, 0);
420 }
421 return 0;
422}
423
424static int mipi_dsi_panel_power(int on)
425{
426 int ret;
427
Jeff Ohlstein2cbe5ba2011-12-16 13:32:56 -0800428 pr_debug("%s: on=%d\n", __func__, on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800429
430 if (machine_is_msm8960_liquid())
431 ret = mipi_dsi_liquid_panel_power(on);
432 else
433 ret = mipi_dsi_cdp_panel_power(on);
434
435 return ret;
436}
437
438static struct mipi_dsi_platform_data mipi_dsi_pdata = {
439 .vsync_gpio = MDP_VSYNC_GPIO,
440 .dsi_power_save = mipi_dsi_panel_power,
441};
442
443#ifdef CONFIG_MSM_BUS_SCALING
444
Nagamalleswararao Ganji5fabbd62011-11-06 23:10:43 -0800445static struct msm_bus_vectors rotator_init_vectors[] = {
446 {
447 .src = MSM_BUS_MASTER_ROTATOR,
448 .dst = MSM_BUS_SLAVE_EBI_CH0,
449 .ab = 0,
450 .ib = 0,
451 },
452};
453
454static struct msm_bus_vectors rotator_ui_vectors[] = {
455 {
456 .src = MSM_BUS_MASTER_ROTATOR,
457 .dst = MSM_BUS_SLAVE_EBI_CH0,
458 .ab = (1024 * 600 * 4 * 2 * 60),
459 .ib = (1024 * 600 * 4 * 2 * 60 * 1.5),
460 },
461};
462
463static struct msm_bus_vectors rotator_vga_vectors[] = {
464 {
465 .src = MSM_BUS_MASTER_ROTATOR,
466 .dst = MSM_BUS_SLAVE_EBI_CH0,
467 .ab = (640 * 480 * 2 * 2 * 30),
468 .ib = (640 * 480 * 2 * 2 * 30 * 1.5),
469 },
470};
471static struct msm_bus_vectors rotator_720p_vectors[] = {
472 {
473 .src = MSM_BUS_MASTER_ROTATOR,
474 .dst = MSM_BUS_SLAVE_EBI_CH0,
475 .ab = (1280 * 736 * 2 * 2 * 30),
476 .ib = (1280 * 736 * 2 * 2 * 30 * 1.5),
477 },
478};
479
480static struct msm_bus_vectors rotator_1080p_vectors[] = {
481 {
482 .src = MSM_BUS_MASTER_ROTATOR,
483 .dst = MSM_BUS_SLAVE_EBI_CH0,
484 .ab = (1920 * 1088 * 2 * 2 * 30),
485 .ib = (1920 * 1088 * 2 * 2 * 30 * 1.5),
486 },
487};
488
489static struct msm_bus_paths rotator_bus_scale_usecases[] = {
490 {
491 ARRAY_SIZE(rotator_init_vectors),
492 rotator_init_vectors,
493 },
494 {
495 ARRAY_SIZE(rotator_ui_vectors),
496 rotator_ui_vectors,
497 },
498 {
499 ARRAY_SIZE(rotator_vga_vectors),
500 rotator_vga_vectors,
501 },
502 {
503 ARRAY_SIZE(rotator_720p_vectors),
504 rotator_720p_vectors,
505 },
506 {
507 ARRAY_SIZE(rotator_1080p_vectors),
508 rotator_1080p_vectors,
509 },
510};
511
512struct msm_bus_scale_pdata rotator_bus_scale_pdata = {
513 rotator_bus_scale_usecases,
514 ARRAY_SIZE(rotator_bus_scale_usecases),
515 .name = "rotator",
516};
517
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800518static struct msm_bus_vectors mdp_init_vectors[] = {
519 {
520 .src = MSM_BUS_MASTER_MDP_PORT0,
521 .dst = MSM_BUS_SLAVE_EBI_CH0,
522 .ab = 0,
523 .ib = 0,
524 },
525};
526
527#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
528static struct msm_bus_vectors hdmi_as_primary_vectors[] = {
529 /* If HDMI is used as primary */
530 {
531 .src = MSM_BUS_MASTER_MDP_PORT0,
532 .dst = MSM_BUS_SLAVE_EBI_CH0,
533 .ab = 2000000000,
534 .ib = 2000000000,
535 },
536};
537static struct msm_bus_paths mdp_bus_scale_usecases[] = {
538 {
539 ARRAY_SIZE(mdp_init_vectors),
540 mdp_init_vectors,
541 },
542 {
543 ARRAY_SIZE(hdmi_as_primary_vectors),
544 hdmi_as_primary_vectors,
545 },
546 {
547 ARRAY_SIZE(hdmi_as_primary_vectors),
548 hdmi_as_primary_vectors,
549 },
550 {
551 ARRAY_SIZE(hdmi_as_primary_vectors),
552 hdmi_as_primary_vectors,
553 },
554 {
555 ARRAY_SIZE(hdmi_as_primary_vectors),
556 hdmi_as_primary_vectors,
557 },
558 {
559 ARRAY_SIZE(hdmi_as_primary_vectors),
560 hdmi_as_primary_vectors,
561 },
562};
563#else
564static struct msm_bus_vectors mdp_ui_vectors[] = {
565 {
566 .src = MSM_BUS_MASTER_MDP_PORT0,
567 .dst = MSM_BUS_SLAVE_EBI_CH0,
568 .ab = 216000000 * 2,
569 .ib = 270000000 * 2,
570 },
571};
572
573static struct msm_bus_vectors mdp_vga_vectors[] = {
574 /* VGA and less video */
575 {
576 .src = MSM_BUS_MASTER_MDP_PORT0,
577 .dst = MSM_BUS_SLAVE_EBI_CH0,
578 .ab = 216000000 * 2,
579 .ib = 270000000 * 2,
580 },
581};
582
583static struct msm_bus_vectors mdp_720p_vectors[] = {
584 /* 720p and less video */
585 {
586 .src = MSM_BUS_MASTER_MDP_PORT0,
587 .dst = MSM_BUS_SLAVE_EBI_CH0,
588 .ab = 230400000 * 2,
589 .ib = 288000000 * 2,
590 },
591};
592
593static struct msm_bus_vectors mdp_1080p_vectors[] = {
594 /* 1080p and less video */
595 {
596 .src = MSM_BUS_MASTER_MDP_PORT0,
597 .dst = MSM_BUS_SLAVE_EBI_CH0,
598 .ab = 334080000 * 2,
599 .ib = 417600000 * 2,
600 },
601};
602
603static struct msm_bus_paths mdp_bus_scale_usecases[] = {
604 {
605 ARRAY_SIZE(mdp_init_vectors),
606 mdp_init_vectors,
607 },
608 {
609 ARRAY_SIZE(mdp_ui_vectors),
610 mdp_ui_vectors,
611 },
612 {
613 ARRAY_SIZE(mdp_ui_vectors),
614 mdp_ui_vectors,
615 },
616 {
617 ARRAY_SIZE(mdp_vga_vectors),
618 mdp_vga_vectors,
619 },
620 {
621 ARRAY_SIZE(mdp_720p_vectors),
622 mdp_720p_vectors,
623 },
624 {
625 ARRAY_SIZE(mdp_1080p_vectors),
626 mdp_1080p_vectors,
627 },
628};
629#endif
630
631static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
632 mdp_bus_scale_usecases,
633 ARRAY_SIZE(mdp_bus_scale_usecases),
634 .name = "mdp",
635};
636
637#endif
638
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800639static int mdp_core_clk_rate_table[] = {
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800640 85330000,
Huaibin Yang1f180ee2012-01-30 16:23:06 -0800641 128000000,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800642 160000000,
643 200000000,
644};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800645
646static struct msm_panel_common_pdata mdp_pdata = {
647 .gpio = MDP_VSYNC_GPIO,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800648 .mdp_core_clk_rate = 85330000,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800649 .mdp_core_clk_table = mdp_core_clk_rate_table,
650 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
651#ifdef CONFIG_MSM_BUS_SCALING
652 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
653#endif
654 .mdp_rev = MDP_REV_42,
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800655#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
656 .mem_hid = ION_CP_MM_HEAP_ID,
657#else
658 .mem_hid = MEMTYPE_EBI1,
659#endif
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800660};
661
Amir Samuelovf0d1f542012-02-06 12:50:42 +0200662/**
663 * Set MDP clocks to high frequency to avoid DSI underflow
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800664 * when using high resolution 1200x1920 WUXGA panels
Amir Samuelovf0d1f542012-02-06 12:50:42 +0200665 */
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800666static void set_mdp_clocks_for_wuxga(void)
Amir Samuelovf0d1f542012-02-06 12:50:42 +0200667{
668 int i;
669
670 mdp_ui_vectors[0].ab = 2000000000;
671 mdp_ui_vectors[0].ib = 2000000000;
Ravishangar Kalyanam30170872012-02-25 17:47:18 -0800672 mdp_vga_vectors[0].ab = 2000000000;
673 mdp_vga_vectors[0].ib = 2000000000;
674 mdp_720p_vectors[0].ab = 2000000000;
675 mdp_720p_vectors[0].ib = 2000000000;
676 mdp_1080p_vectors[0].ab = 2000000000;
677 mdp_1080p_vectors[0].ib = 2000000000;
Amir Samuelovf0d1f542012-02-06 12:50:42 +0200678
679 mdp_pdata.mdp_core_clk_rate = 200000000;
680
681 for (i = 0; i < ARRAY_SIZE(mdp_core_clk_rate_table); i++)
682 mdp_core_clk_rate_table[i] = 200000000;
683
684}
685
Huaibin Yanga5419422011-12-08 23:52:10 -0800686void __init msm8960_mdp_writeback(struct memtype_reserve* reserve_table)
687{
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800688 mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE;
689 mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE;
690#if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
691 reserve_table[mdp_pdata.mem_hid].size +=
692 mdp_pdata.ov0_wb_size;
693 reserve_table[mdp_pdata.mem_hid].size +=
694 mdp_pdata.ov1_wb_size;
695#endif
Huaibin Yanga5419422011-12-08 23:52:10 -0800696}
697
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800698static struct platform_device mipi_dsi_renesas_panel_device = {
699 .name = "mipi_renesas",
700 .id = 0,
701};
702
703static struct platform_device mipi_dsi_simulator_panel_device = {
704 .name = "mipi_simulator",
705 .id = 0,
706};
707
708#define LPM_CHANNEL0 0
709static int toshiba_gpio[] = {LPM_CHANNEL0};
710
711static struct mipi_dsi_panel_platform_data toshiba_pdata = {
712 .gpio = toshiba_gpio,
713};
714
715static struct platform_device mipi_dsi_toshiba_panel_device = {
716 .name = "mipi_toshiba",
717 .id = 0,
718 .dev = {
719 .platform_data = &toshiba_pdata,
720 }
721};
722
723#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelovca199b92012-01-31 14:50:04 +0200724static int dsi2lvds_gpio[4] = {
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800725 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
Amir Samuelovca199b92012-01-31 14:50:04 +0200726 0x1F08, /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
727 GPIO_LIQUID_EXPANDER_BASE+6, /* TN Enable */
728 GPIO_LIQUID_EXPANDER_BASE+7, /* TN Mode */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800729 };
730
731static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
732 .gpio_num = dsi2lvds_gpio,
733};
734
735static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
736
737/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
738 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
739 /* timing */
740 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
741 0x0c, 0x03, 0x04, 0xa0},
742 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
743 {0xff, 0x00, 0x06, 0x00}, /* strength */
744 /* pll control */
745 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
746 0x40, 0x07, 0x03,
747 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
748};
749
750static struct mipi_dsi_panel_platform_data novatek_pdata = {
751 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
752 .fpga_ctrl_mode = FPGA_SPI_INTF,
753 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
754};
755
756static struct platform_device mipi_dsi_novatek_panel_device = {
757 .name = "mipi_novatek",
758 .id = 0,
759 .dev = {
760 .platform_data = &novatek_pdata,
761 }
762};
763
764static struct platform_device mipi_dsi2lvds_bridge_device = {
765 .name = "mipi_tc358764",
766 .id = 0,
767 .dev.platform_data = &mipi_dsi2lvds_pdata,
768};
769
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -0800770static struct platform_device mipi_dsi_orise_panel_device = {
771 .name = "mipi_orise",
772 .id = 0,
773};
774
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800775#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
776static struct resource hdmi_msm_resources[] = {
777 {
778 .name = "hdmi_msm_qfprom_addr",
779 .start = 0x00700000,
780 .end = 0x007060FF,
781 .flags = IORESOURCE_MEM,
782 },
783 {
784 .name = "hdmi_msm_hdmi_addr",
785 .start = 0x04A00000,
786 .end = 0x04A00FFF,
787 .flags = IORESOURCE_MEM,
788 },
789 {
790 .name = "hdmi_msm_irq",
791 .start = HDMI_IRQ,
792 .end = HDMI_IRQ,
793 .flags = IORESOURCE_IRQ,
794 },
795};
796
797static int hdmi_enable_5v(int on);
798static int hdmi_core_power(int on, int show);
799static int hdmi_cec_power(int on);
800
801static struct msm_hdmi_platform_data hdmi_msm_data = {
802 .irq = HDMI_IRQ,
803 .enable_5v = hdmi_enable_5v,
804 .core_power = hdmi_core_power,
805 .cec_power = hdmi_cec_power,
806};
807
808static struct platform_device hdmi_msm_device = {
809 .name = "hdmi_msm",
810 .id = 0,
811 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
812 .resource = hdmi_msm_resources,
813 .dev.platform_data = &hdmi_msm_data,
814};
815#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
816
817#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
818static struct platform_device wfd_panel_device = {
819 .name = "wfd_panel",
820 .id = 0,
821 .dev.platform_data = NULL,
822};
Stepan Moskovchenko270888d2011-11-30 12:19:11 -0800823
824static struct platform_device wfd_device = {
825 .name = "msm_wfd",
826 .id = -1,
827};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800828#endif
829
830#ifdef CONFIG_MSM_BUS_SCALING
831static struct msm_bus_vectors dtv_bus_init_vectors[] = {
832 {
833 .src = MSM_BUS_MASTER_MDP_PORT0,
834 .dst = MSM_BUS_SLAVE_EBI_CH0,
835 .ab = 0,
836 .ib = 0,
837 },
838};
839
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800840static struct msm_bus_vectors dtv_bus_def_vectors[] = {
841 {
842 .src = MSM_BUS_MASTER_MDP_PORT0,
843 .dst = MSM_BUS_SLAVE_EBI_CH0,
844 .ab = 566092800 * 2,
845 .ib = 707616000 * 2,
846 },
847};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800848
849static struct msm_bus_paths dtv_bus_scale_usecases[] = {
850 {
851 ARRAY_SIZE(dtv_bus_init_vectors),
852 dtv_bus_init_vectors,
853 },
854 {
855 ARRAY_SIZE(dtv_bus_def_vectors),
856 dtv_bus_def_vectors,
857 },
858};
859static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
860 dtv_bus_scale_usecases,
861 ARRAY_SIZE(dtv_bus_scale_usecases),
862 .name = "dtv",
863};
864
865static struct lcdc_platform_data dtv_pdata = {
866 .bus_scale_table = &dtv_bus_scale_pdata,
867};
868#endif
869
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800870#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800871static int hdmi_enable_5v(int on)
872{
873 /* TBD: PM8921 regulator instead of 8901 */
874 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
875 static int prev_on;
876 int rc;
877
878 if (on == prev_on)
879 return 0;
880
Ajay Singh Parmar07847642011-12-09 02:57:45 +0530881 if (!reg_8921_hdmi_mvs) {
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800882 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
Ajay Singh Parmar07847642011-12-09 02:57:45 +0530883 "hdmi_mvs");
884 if (IS_ERR(reg_8921_hdmi_mvs)) {
885 pr_err("'%s' regulator not found, rc=%ld\n",
886 "hdmi_mvs", IS_ERR(reg_8921_hdmi_mvs));
887 reg_8921_hdmi_mvs = NULL;
888 return -ENODEV;
889 }
890 }
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800891
892 if (on) {
893 rc = regulator_enable(reg_8921_hdmi_mvs);
894 if (rc) {
895 pr_err("'%s' regulator enable failed, rc=%d\n",
896 "8921_hdmi_mvs", rc);
897 return rc;
898 }
899 pr_debug("%s(on): success\n", __func__);
900 } else {
901 rc = regulator_disable(reg_8921_hdmi_mvs);
902 if (rc)
903 pr_warning("'%s' regulator disable failed, rc=%d\n",
904 "8921_hdmi_mvs", rc);
905 pr_debug("%s(off): success\n", __func__);
906 }
907
908 prev_on = on;
909
910 return 0;
911}
912
913static int hdmi_core_power(int on, int show)
914{
915 static struct regulator *reg_8921_l23, *reg_8921_s4;
916 static int prev_on;
917 int rc;
918
919 if (on == prev_on)
920 return 0;
921
922 /* TBD: PM8921 regulator instead of 8901 */
923 if (!reg_8921_l23) {
924 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
925 if (IS_ERR(reg_8921_l23)) {
926 pr_err("could not get reg_8921_l23, rc = %ld\n",
927 PTR_ERR(reg_8921_l23));
928 return -ENODEV;
929 }
930 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
931 if (rc) {
932 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
933 return -EINVAL;
934 }
935 }
936 if (!reg_8921_s4) {
937 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
938 if (IS_ERR(reg_8921_s4)) {
939 pr_err("could not get reg_8921_s4, rc = %ld\n",
940 PTR_ERR(reg_8921_s4));
941 return -ENODEV;
942 }
943 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
944 if (rc) {
945 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
946 return -EINVAL;
947 }
948 }
949
950 if (on) {
951 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
952 if (rc < 0) {
953 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
954 return -EINVAL;
955 }
956 rc = regulator_enable(reg_8921_l23);
957 if (rc) {
958 pr_err("'%s' regulator enable failed, rc=%d\n",
959 "hdmi_avdd", rc);
960 return rc;
961 }
962 rc = regulator_enable(reg_8921_s4);
963 if (rc) {
964 pr_err("'%s' regulator enable failed, rc=%d\n",
965 "hdmi_vcc", rc);
966 return rc;
967 }
968 rc = gpio_request(100, "HDMI_DDC_CLK");
969 if (rc) {
970 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
971 "HDMI_DDC_CLK", 100, rc);
972 goto error1;
973 }
974 rc = gpio_request(101, "HDMI_DDC_DATA");
975 if (rc) {
976 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
977 "HDMI_DDC_DATA", 101, rc);
978 goto error2;
979 }
980 rc = gpio_request(102, "HDMI_HPD");
981 if (rc) {
982 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
983 "HDMI_HPD", 102, rc);
984 goto error3;
985 }
986 pr_debug("%s(on): success\n", __func__);
987 } else {
988 gpio_free(100);
989 gpio_free(101);
990 gpio_free(102);
991
992 rc = regulator_disable(reg_8921_l23);
993 if (rc) {
994 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
995 return -ENODEV;
996 }
997 rc = regulator_disable(reg_8921_s4);
998 if (rc) {
999 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
1000 return -ENODEV;
1001 }
1002 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1003 if (rc < 0) {
1004 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1005 return -EINVAL;
1006 }
1007 pr_debug("%s(off): success\n", __func__);
1008 }
1009
1010 prev_on = on;
1011
1012 return 0;
1013
1014error3:
1015 gpio_free(101);
1016error2:
1017 gpio_free(100);
1018error1:
1019 regulator_disable(reg_8921_l23);
1020 regulator_disable(reg_8921_s4);
1021 return rc;
1022}
1023
1024static int hdmi_cec_power(int on)
1025{
1026 static int prev_on;
1027 int rc;
1028
1029 if (on == prev_on)
1030 return 0;
1031
1032 if (on) {
1033 rc = gpio_request(99, "HDMI_CEC_VAR");
1034 if (rc) {
1035 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1036 "HDMI_CEC_VAR", 99, rc);
1037 goto error;
1038 }
1039 pr_debug("%s(on): success\n", __func__);
1040 } else {
1041 gpio_free(99);
1042 pr_debug("%s(off): success\n", __func__);
1043 }
1044
1045 prev_on = on;
1046
1047 return 0;
1048error:
1049 return rc;
1050}
1051#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1052
1053void __init msm8960_init_fb(void)
1054{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001055 platform_device_register(&msm_fb_device);
1056
Stepan Moskovchenko270888d2011-11-30 12:19:11 -08001057#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
1058 platform_device_register(&wfd_panel_device);
1059 platform_device_register(&wfd_device);
1060#endif
1061
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001062 if (machine_is_msm8960_sim())
1063 platform_device_register(&mipi_dsi_simulator_panel_device);
1064
1065 if (machine_is_msm8960_rumi3())
1066 platform_device_register(&mipi_dsi_renesas_panel_device);
1067
1068 if (!machine_is_msm8960_sim() && !machine_is_msm8960_rumi3()) {
1069 platform_device_register(&mipi_dsi_novatek_panel_device);
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -08001070 platform_device_register(&mipi_dsi_orise_panel_device);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001071
1072#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1073 platform_device_register(&hdmi_msm_device);
1074#endif
1075 }
1076
1077 if (machine_is_msm8960_liquid())
1078 platform_device_register(&mipi_dsi2lvds_bridge_device);
1079 else
1080 platform_device_register(&mipi_dsi_toshiba_panel_device);
1081
1082 if (machine_is_msm8x60_rumi3()) {
1083 msm_fb_register_device("mdp", NULL);
1084 mipi_dsi_pdata.target_type = 1;
1085 } else
1086 msm_fb_register_device("mdp", &mdp_pdata);
1087 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
1088#ifdef CONFIG_MSM_BUS_SCALING
1089 msm_fb_register_device("dtv", &dtv_pdata);
1090#endif
1091}
1092
1093void __init msm8960_allocate_fb_region(void)
1094{
1095 void *addr;
1096 unsigned long size;
1097
1098 size = MSM_FB_SIZE;
1099 addr = alloc_bootmem_align(size, 0x1000);
1100 msm_fb_resources[0].start = __pa(addr);
1101 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1102 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1103 size, addr, __pa(addr));
1104}
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001105
1106void __init msm8960_set_display_params(char *prim_panel, char *ext_panel)
1107{
1108 if (strnlen(prim_panel, PANEL_NAME_MAX_LEN)) {
1109 strlcpy(msm_fb_pdata.prim_panel_name, prim_panel,
1110 PANEL_NAME_MAX_LEN);
1111 pr_debug("msm_fb_pdata.prim_panel_name %s\n",
1112 msm_fb_pdata.prim_panel_name);
1113
1114 if (!strncmp((char *)msm_fb_pdata.prim_panel_name,
1115 HDMI_PANEL_NAME, strnlen(HDMI_PANEL_NAME,
1116 PANEL_NAME_MAX_LEN))) {
1117 pr_debug("HDMI is the primary display by"
1118 " boot parameter\n");
1119 hdmi_is_primary = 1;
1120 }
1121 }
1122 if (strnlen(ext_panel, PANEL_NAME_MAX_LEN)) {
1123 strlcpy(msm_fb_pdata.ext_panel_name, ext_panel,
1124 PANEL_NAME_MAX_LEN);
1125 pr_debug("msm_fb_pdata.ext_panel_name %s\n",
1126 msm_fb_pdata.ext_panel_name);
1127 }
1128}