aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fbdev
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2016-08-26 11:53:35 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-08-30 04:59:33 -0400
commit03577d6a0beff2aded55d4ae40d1058905233536 (patch)
tree7a95c783678ee0307b077a57be45e52fff7cc225 /drivers/video/fbdev
parentb86acbefa3814565b71ec9661329f7def0cc10f2 (diff)
video: mxsfb: Fix framebuffer corruption on mx6sx
Allocate the framebuffer memory as coherent, otherwise the framebuffer will suffer from artifacts when displaying scrolling text or video. This can be replicated on i.MX6SX (armv7), which has more complex memory architecture compared to the i.MX23/28 (armv5). Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Fabio Estevam <fabio.estevam@nxp.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/fbdev')
-rw-r--r--drivers/video/fbdev/mxsfb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/video/fbdev/mxsfb.c b/drivers/video/fbdev/mxsfb.c
index 4e6608ceac09..7846f0e8bbbb 100644
--- a/drivers/video/fbdev/mxsfb.c
+++ b/drivers/video/fbdev/mxsfb.c
@@ -800,6 +800,7 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host,
800 struct fb_videomode *vmode) 800 struct fb_videomode *vmode)
801{ 801{
802 int ret; 802 int ret;
803 struct device *dev = &host->pdev->dev;
803 struct fb_info *fb_info = &host->fb_info; 804 struct fb_info *fb_info = &host->fb_info;
804 struct fb_var_screeninfo *var = &fb_info->var; 805 struct fb_var_screeninfo *var = &fb_info->var;
805 dma_addr_t fb_phys; 806 dma_addr_t fb_phys;
@@ -825,12 +826,10 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host,
825 826
826 /* Memory allocation for framebuffer */ 827 /* Memory allocation for framebuffer */
827 fb_size = SZ_2M; 828 fb_size = SZ_2M;
828 fb_virt = alloc_pages_exact(fb_size, GFP_DMA); 829 fb_virt = dma_alloc_wc(dev, PAGE_ALIGN(fb_size), &fb_phys, GFP_KERNEL);
829 if (!fb_virt) 830 if (!fb_virt)
830 return -ENOMEM; 831 return -ENOMEM;
831 832
832 fb_phys = virt_to_phys(fb_virt);
833
834 fb_info->fix.smem_start = fb_phys; 833 fb_info->fix.smem_start = fb_phys;
835 fb_info->screen_base = fb_virt; 834 fb_info->screen_base = fb_virt;
836 fb_info->screen_size = fb_info->fix.smem_len = fb_size; 835 fb_info->screen_size = fb_info->fix.smem_len = fb_size;
@@ -843,9 +842,11 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host,
843 842
844static void mxsfb_free_videomem(struct mxsfb_info *host) 843static void mxsfb_free_videomem(struct mxsfb_info *host)
845{ 844{
845 struct device *dev = &host->pdev->dev;
846 struct fb_info *fb_info = &host->fb_info; 846 struct fb_info *fb_info = &host->fb_info;
847 847
848 free_pages_exact(fb_info->screen_base, fb_info->fix.smem_len); 848 dma_free_wc(dev, fb_info->screen_size, fb_info->screen_base,
849 fb_info->fix.smem_start);
849} 850}
850 851
851static const struct platform_device_id mxsfb_devtype[] = { 852static const struct platform_device_id mxsfb_devtype[] = {