aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/mcde/mcde_fb.c
diff options
context:
space:
mode:
authorJimmy Rubin <ejimrub@steludxu031.lud.stericsson.com>2010-06-11 13:37:05 +0200
committerJohn Rigby <john.rigby@linaro.org>2010-09-02 22:45:43 -0600
commit6a347421a38a43019c4775c29ceaddbbf15d32e1 (patch)
tree4891174fe4a71434f8a1d1880c3dde3c02769a79 /drivers/video/mcde/mcde_fb.c
parent8c47209c5bf71bfcb79544171a2ac744b93eb081 (diff)
MCDE: Supports new HDMI features
This patch does the following: * Dynamic resolution change (HDMI and TV-out) * Dynamic change of rotation (Main display) * Dynamic change to 24 and 32 bpp (RGB888, RGBA8888, RGBX8888) * HDMI stability improvements * Removes Framebuffer_console for V.20 and HREF+. * Support for disabling display initialization if u-boot supports startup graphics * Removes backlight code, depends on led api * Moves PRCMU settings to prcmu_fw.c ST Ericsson Change-Id: WP259361 Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> Change-Id: I68fc0857442dee2bedb849996c060a179350b712 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/2537 Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'drivers/video/mcde/mcde_fb.c')
-rw-r--r--drivers/video/mcde/mcde_fb.c62
1 files changed, 33 insertions, 29 deletions
diff --git a/drivers/video/mcde/mcde_fb.c b/drivers/video/mcde/mcde_fb.c
index cbf493d4f4e..fc77e5be1d8 100644
--- a/drivers/video/mcde/mcde_fb.c
+++ b/drivers/video/mcde/mcde_fb.c
@@ -18,12 +18,6 @@
#include <video/mcde_fb.h>
-/* When this define is enabled, a max size frame buffer is allocated and used
- * for all resolutions.
- * Without this define, the frame buffer is reallocated when resolution is
- * changed */
-/*#define MCDE_FB_AVOID_REALLOC*/
-
#define MCDE_FB_BPP_MAX 16
#define MCDE_FB_VXRES_MAX 1920
#define MCDE_FB_VYRES_MAX 2160
@@ -88,6 +82,11 @@ struct pix_fmt_info pix_fmt_map[] = {
}
};
+static struct platform_device mcde_fb_device = {
+ .name = "mcde_fb",
+ .id = -1,
+};
+
/* Helpers */
static struct pix_fmt_info *find_pix_fmt_info(enum mcde_ovly_pix_fmt pix_fmt)
@@ -178,7 +177,7 @@ static int reallocate_fb_mem(struct fb_info *fbi, u32 size)
{
dma_addr_t paddr;
void __iomem *vaddr;
-#ifdef MCDE_FB_AVOID_REALLOC
+#ifdef CONFIG_MCDE_FB_AVOID_REALLOC
u32 size_max;
#endif
@@ -188,7 +187,7 @@ static int reallocate_fb_mem(struct fb_info *fbi, u32 size)
return 0;
/* TODO: hwmem */
-#ifdef MCDE_FB_AVOID_REALLOC
+#ifdef CONFIG_MCDE_FB_AVOID_REALLOC
if (!fbi->screen_base) {
size_max = MCDE_FB_BPP_MAX / 8 * MCDE_FB_VXRES_MAX *
MCDE_FB_VYRES_MAX;
@@ -206,13 +205,13 @@ static int reallocate_fb_mem(struct fb_info *fbi, u32 size)
return -ENOMEM;
#endif
-#ifndef MCDE_FB_AVOID_REALLOC
+#ifndef CONFIG_MCDE_FB_AVOID_REALLOC
if (fbi->screen_base)
dma_free_coherent(fbi->dev, fbi->screen_size,
fbi->screen_base, fbi->fix.smem_start);
#endif
-#ifndef MCDE_FB_AVOID_REALLOC
+#ifndef CONFIG_MCDE_FB_AVOID_REALLOC
fbi->screen_base = vaddr;
fbi->fix.smem_start = paddr;
#endif
@@ -315,18 +314,28 @@ void var_to_vmode(struct fb_var_screeninfo *var,
enum mcde_display_rotation var_to_rotation(struct fb_var_screeninfo *var)
{
+ enum mcde_display_rotation rot;
+
switch (var->rotate) {
case FB_ROTATE_UR:
- return MCDE_DISPLAY_ROT_0;
+ rot = MCDE_DISPLAY_ROT_0;
+ break;
case FB_ROTATE_CW:
- return MCDE_DISPLAY_ROT_90_CW;
+ rot = MCDE_DISPLAY_ROT_90_CW;
+ break;
case FB_ROTATE_UD:
- return MCDE_DISPLAY_ROT_180_CW;
+ rot = MCDE_DISPLAY_ROT_180_CW;
+ break;
case FB_ROTATE_CCW:
- return MCDE_DISPLAY_ROT_90_CCW;
+ rot = MCDE_DISPLAY_ROT_90_CCW;
+ break;
default:
- return MCDE_DISPLAY_ROT_0;
+ rot = MCDE_DISPLAY_ROT_0;
+ break;
}
+ dev_vdbg(&mcde_fb_device.dev, "var_rot: %d -> mcde_rot: %d\n",
+ var->rotate, rot);
+ return rot;
}
static struct mcde_display_device *fb_to_display(struct fb_info *fbi)
@@ -356,6 +365,12 @@ static int check_var(struct fb_var_screeninfo *var, struct fb_info *fbi,
var->width = w;
var->height = h;
+ /* Rotation */
+ if (var->rotate > 3) {
+ dev_info(&(ddev->dev), "check_var failed var->rotate\n");
+ return -EINVAL;
+ }
+
/* Video mode */
var_to_vmode(var, &vmode);
ret = mcde_dss_try_video_mode(ddev, &vmode);
@@ -374,12 +389,6 @@ static int check_var(struct fb_var_screeninfo *var, struct fb_info *fbi,
}
pix_fmt_info_to_var(fmtinfo, var);
- /* Rotation */
- if (var->rotate > 3) {
- dev_vdbg(&(ddev->dev), "check_var failed var->rotate\n");
- return -EINVAL;
- }
-
/* Not used */
var->grayscale = 0;
var->sync = 0;
@@ -417,14 +426,13 @@ static int apply_var(struct fb_info *fbi, struct mcde_display_device *ddev)
mfb->pix_fmt = fmt->pix_fmt;
mcde_dss_set_pixel_format(ddev, mfb->pix_fmt);
+ /* Apply rotation */
+ mcde_dss_set_rotation(ddev, var_to_rotation(var));
/* Apply video mode */
memset(&vmode, 0, sizeof(struct mcde_video_mode));
var_to_vmode(var, &vmode);
mcde_dss_set_video_mode(ddev, &vmode);
- /* Apply rotation */
- mcde_dss_set_rotation(ddev, var_to_rotation(var));
-
mcde_dss_apply_channel(ddev);
}
@@ -521,11 +529,6 @@ static struct fb_ops fb_ops = {
/* FB driver */
-static struct platform_device mcde_fb_device = {
- .name = "mcde_fb",
- .id = -1,
-};
-
struct fb_info *mcde_fb_create(struct mcde_display_device *ddev,
u16 w, u16 h, u16 vw, u16 vh, enum mcde_ovly_pix_fmt pix_fmt,
u32 rotate, bool display_initialized)
@@ -600,6 +603,7 @@ apply_var_failed:
mcde_dss_disable_display(ddev);
display_enable_failed:
framebuffer_release(fbi);
+ fbi = NULL;
fb_alloc_failed:
out:
return ret ? ERR_PTR(ret) : fbi;