From 91d63f8a306722dbf1b400d4afb11f69512977ad Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 4 Nov 2010 11:05:55 +0000 Subject: [PATCH 1/9] fbdev: sh_mobile_hdmi: properly clean up modedb on monitor unplug Even though this is not a problem currently, it is better to clear the freed pointer and nullify the length of the freed memory. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Paul Mundt --- drivers/video/sh_mobile_hdmi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 55b3077ff6ff..d7df10315d8d 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c @@ -1071,6 +1071,10 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) if (!hdmi->info) goto out; + hdmi->monspec.modedb_len = 0; + fb_destroy_modedb(hdmi->monspec.modedb); + hdmi->monspec.modedb = NULL; + acquire_console_sem(); /* HDMI disconnect */ @@ -1078,7 +1082,6 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) release_console_sem(); pm_runtime_put(hdmi->dev); - fb_destroy_modedb(hdmi->monspec.modedb); } out: From 5ae0cf82df212253857326a6706018eccb658683 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 4 Nov 2010 11:06:01 +0000 Subject: [PATCH 2/9] fbdev: sh_mobile_lcdc: use the standard CEA-861 720p timing sh_mobile_lcdcfb.c has a hard-coded 720p video mode, used as default, if none is explicitly specified by the platform. Adjust its timing to match the CEA standard. Also add an explicit refresh rate value, which is needed, when used with HDMI, to be able to recognise the default 720p mode as a pre-programmed VIC #4. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Paul Mundt --- drivers/video/sh_mobile_lcdcfb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 50963739a409..a87dace49cb7 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -115,15 +115,16 @@ static const struct fb_videomode default_720p = { .xres = 1280, .yres = 720, - .left_margin = 200, - .right_margin = 88, - .hsync_len = 48, + .left_margin = 220, + .right_margin = 110, + .hsync_len = 40, .upper_margin = 20, .lower_margin = 5, .vsync_len = 5, .pixclock = 13468, + .refresh = 60, .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, }; From 5fd284e6cd39f731db86dfd2440553365d5fad4d Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 4 Nov 2010 11:06:11 +0000 Subject: [PATCH 3/9] fbdev: sh_mobile_lcdc: use correct number of modes, when using the default Fix zero mode number, when using the default 720p mode. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Paul Mundt --- drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index a87dace49cb7..9b1364723c65 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -1198,6 +1198,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) const struct fb_videomode *mode = cfg->lcd_cfg; unsigned long max_size = 0; int k; + int num_cfg; ch->info = framebuffer_alloc(0, &pdev->dev); if (!ch->info) { @@ -1233,8 +1234,14 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) info->fix = sh_mobile_lcdc_fix; info->fix.smem_len = max_size * (cfg->bpp / 8) * 2; - if (!mode) + if (!mode) { mode = &default_720p; + num_cfg = 1; + } else { + num_cfg = ch->cfg.num_cfg; + } + + fb_videomode_to_modelist(mode, num_cfg, &info->modelist); fb_videomode_to_var(var, mode); /* Default Y virtual resolution is 2x panel size */ @@ -1282,10 +1289,6 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) for (i = 0; i < j; i++) { struct sh_mobile_lcdc_chan *ch = priv->ch + i; - const struct fb_videomode *mode = ch->cfg.lcd_cfg; - - if (!mode) - mode = &default_720p; info = ch->info; @@ -1298,7 +1301,6 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) } } - fb_videomode_to_modelist(mode, ch->cfg.num_cfg, &info->modelist); error = register_framebuffer(info); if (error < 0) goto err1; From 32ed3036c56284a720c0c00d92ee14bf609f497d Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Wed, 10 Nov 2010 13:04:19 +0200 Subject: [PATCH 4/9] sisfb: limit POST memory test according to PCI resource length If the POST memory test fails, the driver may access illegal memory areas. Instead of hard coding the maximum size, set it according to the PCI resource length (an additional check is needed in sisfb_post_map_vram() to ensure it's big enough). DRAM sizing will later adjust video_size to the correct value. Signed-off-by: Aaro Koskinen Cc: Thomas Winischhofer Signed-off-by: Paul Mundt --- drivers/video/sis/sis_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index b52f8e4ef1fd..3dde12b0ab06 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c @@ -4181,6 +4181,9 @@ static void __devinit sisfb_post_map_vram(struct sis_video_info *ivideo, unsigned int *mapsize, unsigned int min) { + if (*mapsize < (min << 20)) + return; + ivideo->video_vbase = ioremap(ivideo->video_base, (*mapsize)); if(!ivideo->video_vbase) { @@ -4514,7 +4517,7 @@ sisfb_post_sis300(struct pci_dev *pdev) } else { #endif /* Need to map max FB size for finding out about RAM size */ - mapsize = 64 << 20; + mapsize = ivideo->video_size; sisfb_post_map_vram(ivideo, &mapsize, 4); if(ivideo->video_vbase) { @@ -4680,7 +4683,7 @@ sisfb_post_xgi_ramsize(struct sis_video_info *ivideo) orSISIDXREG(SISSR, 0x20, (0x80 | 0x04)); /* Need to map max FB size for finding out about RAM size */ - mapsize = 256 << 20; + mapsize = ivideo->video_size; sisfb_post_map_vram(ivideo, &mapsize, 32); if(!ivideo->video_vbase) { @@ -5936,6 +5939,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } ivideo->video_base = pci_resource_start(pdev, 0); + ivideo->video_size = pci_resource_len(pdev, 0); ivideo->mmio_base = pci_resource_start(pdev, 1); ivideo->mmio_size = pci_resource_len(pdev, 1); ivideo->SiS_Pr.RelIO = pci_resource_start(pdev, 2) + 0x30; From 108409a8a4e325db38f27258da68d7207a0ad433 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 10 Nov 2010 11:45:18 +0200 Subject: [PATCH 5/9] OMAP: VRAM: improve VRAM error prints Improve the error prints to give more information about the offending address & size. Signed-off-by: Tomi Valkeinen Signed-off-by: Paul Mundt --- drivers/video/omap2/vram.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/video/omap2/vram.c b/drivers/video/omap2/vram.c index fed2a72bc6b6..bb5ee0663e65 100644 --- a/drivers/video/omap2/vram.c +++ b/drivers/video/omap2/vram.c @@ -554,9 +554,15 @@ void __init omap_vram_reserve_sdram_memblock(void) size = PAGE_ALIGN(size); if (paddr) { - if ((paddr & ~PAGE_MASK) || - !memblock_is_region_memory(paddr, size)) { - pr_err("Illegal SDRAM region for VRAM\n"); + if (paddr & ~PAGE_MASK) { + pr_err("VRAM start address 0x%08x not page aligned\n", + paddr); + return; + } + + if (!memblock_is_region_memory(paddr, size)) { + pr_err("Illegal SDRAM region 0x%08x..0x%08x for VRAM\n", + paddr, paddr + size - 1); return; } From 88abf44d3d8d4fefcbf3d57584d471e38cb51627 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 10 Nov 2010 11:45:19 +0200 Subject: [PATCH 6/9] OMAP: VRAM: Fix boot-time memory allocation Use memblock_free() and memblock_remove() to remove the allocated or reserved VRAM area from normal kernel memory. This is a slightly modified version of patches from Felipe Contreras and Namhyung Kim. Reported-by: Felipe Contreras Reported-by: Namhyung Kim Signed-off-by: Tomi Valkeinen Signed-off-by: Paul Mundt --- drivers/video/omap2/vram.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/video/omap2/vram.c b/drivers/video/omap2/vram.c index bb5ee0663e65..2fd7e5271be9 100644 --- a/drivers/video/omap2/vram.c +++ b/drivers/video/omap2/vram.c @@ -576,9 +576,12 @@ void __init omap_vram_reserve_sdram_memblock(void) return; } } else { - paddr = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_REAL_LIMIT); + paddr = memblock_alloc(size, PAGE_SIZE); } + memblock_free(paddr, size); + memblock_remove(paddr, size); + omap_vram_add_region(paddr, size); pr_info("Reserving %u bytes SDRAM for VRAM\n", size); From 0bf3d5a0fb569b13fc5a05f7d5a240d2db70ac61 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 10 Nov 2010 11:45:20 +0200 Subject: [PATCH 7/9] OMAP: DSS: Fix documentation regarding 'vram' kernel parameter The DSS documentation didn't mention the option to give the VRAM start address. Signed-off-by: Tomi Valkeinen Signed-off-by: Paul Mundt --- Documentation/arm/OMAP/DSS | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/arm/OMAP/DSS b/Documentation/arm/OMAP/DSS index 0af0e9eed5d6..888ae7b83ae4 100644 --- a/Documentation/arm/OMAP/DSS +++ b/Documentation/arm/OMAP/DSS @@ -255,9 +255,10 @@ framebuffer parameters. Kernel boot arguments --------------------- -vram= - - Amount of total VRAM to preallocate. For example, "10M". omapfb - allocates memory for framebuffers from VRAM. +vram=[,] + - Amount of total VRAM to preallocate and optionally a physical start + memory address. For example, "10M". omapfb allocates memory for + framebuffers from VRAM. omapfb.mode=:[,...] - Default video mode for specified displays. For example, From fc5fef5ef4f94c2d9ad0cc50871a3e2da5d8bc18 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Mon, 15 Nov 2010 13:25:31 +0900 Subject: [PATCH 8/9] MAINTAINERS: Add an fbdev git tree entry. Now that there's an fbdev git tree (this is also what is pulled in to -next), stub it in to the MAINTAINERS entry. Signed-off-by: Paul Mundt --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 0094224ca79b..0f9f26caeb81 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2435,6 +2435,7 @@ F: drivers/net/wan/sdla.c FRAMEBUFFER LAYER L: linux-fbdev@vger.kernel.org W: http://linux-fbdev.sourceforge.net/ +T: git git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6.git S: Orphan F: Documentation/fb/ F: drivers/video/fb* From dce1431cb36338bda1167591689ab1f77ccf8934 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 13 Nov 2010 02:06:27 -0500 Subject: [PATCH 9/9] fsl-diu-fb: drop dead ioctl define The fsl-diu-fb driver no longer uses this define, and we have a common one to cover this already (FBIO_WAITFORVSYNC). Signed-off-by: Mike Frysinger Signed-off-by: Paul Mundt --- include/linux/fsl-diu-fb.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h index fc295d7ea463..781d4671415f 100644 --- a/include/linux/fsl-diu-fb.h +++ b/include/linux/fsl-diu-fb.h @@ -54,7 +54,6 @@ struct aoi_display_offset { }; #define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key) -#define MFB_WAIT_FOR_VSYNC _IOW('F', 0x20, u_int32_t) #define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8) #define MFB_SET_ALPHA 0x80014d00