From 8b485877e0b9eb23c3579f50cca165f75442c6cc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 15 May 2008 13:44:08 -0700 Subject: fbdev: fix race in device_create There is a race from when a device is created with device_create() and then the drvdata is set with a call to dev_set_drvdata() in which a sysfs file could be open, yet the drvdata will be NULL, causing all sorts of bad things to happen. This patch fixes the problem by using the new function, device_create_drvdata(). Cc: Kay Sievers Cc: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/video/display/display-sysfs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c index 35477177bef..6ef800bdf48 100644 --- a/drivers/video/display/display-sysfs.c +++ b/drivers/video/display/display-sysfs.c @@ -26,6 +26,7 @@ #include #include #include +#include static ssize_t display_show_name(struct device *dev, struct device_attribute *attr, char *buf) @@ -152,10 +153,13 @@ struct display_device *display_device_register(struct display_driver *driver, mutex_unlock(&allocated_dsp_lock); if (!ret) { - new_dev->dev = device_create(display_class, parent, 0, - "display%d", new_dev->idx); + new_dev->dev = device_create_drvdata(display_class, + parent, + MKDEV(0,0), + new_dev, + "display%d", + new_dev->idx); if (!IS_ERR(new_dev->dev)) { - dev_set_drvdata(new_dev->dev, new_dev); new_dev->parent = parent; new_dev->driver = driver; mutex_init(&new_dev->lock); -- cgit v1.2.3 From 4ba35fbe293be319b1a5d97951e567c0d9527d09 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Thu, 22 May 2008 10:19:28 +0100 Subject: [ARM] 5043/1: pxafb: remove unused mode variable in pxafb_init_fbinfo Signed-off-by: Philipp Zabel Acked-by: Eric Miao Signed-off-by: Russell King --- drivers/video/pxafb.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 3ee314beacc..274bc93ab7d 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -1351,7 +1351,6 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) struct pxafb_info *fbi; void *addr; struct pxafb_mach_info *inf = dev->platform_data; - struct pxafb_mode_info *mode = inf->modes; /* Alloc the pxafb_info and pseudo_palette in one step */ fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); -- cgit v1.2.3 From 5e2daeb3c982ea19ecad0c2e720a4052034be14b Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Thu, 22 May 2008 15:45:08 -0700 Subject: fbdev: fix integer as NULL pointer warning drivers/video/aty/atyfb_base.c:3359:26: warning: Using plain integer as NULL pointer drivers/video/aty/radeon_base.c:2280:32: warning: Using plain integer as NULL pointer drivers/video/matrox/matroxfb_base.h:203:25: warning: Using plain integer as NULL pointer drivers/video/matrox/matroxfb_base.h:203:25: warning: Using plain integer as NULL pointer drivers/video/sis/sis_main.c:5790:44: warning: Using plain integer as NULL pointer Signed-off-by: Harvey Harrison Signed-off-by: Linus Torvalds --- drivers/video/aty/atyfb_base.c | 2 +- drivers/video/aty/radeon_base.c | 4 ++-- drivers/video/matrox/matroxfb_base.h | 2 +- drivers/video/sis/sis_main.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index e4bcf5376a9..bd4ac0bafec 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c @@ -3356,7 +3356,7 @@ static int __devinit atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *i info->fix.mmio_start = raddr; par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); - if (par->ati_regbase == 0) + if (par->ati_regbase == NULL) return -ENOMEM; info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 72cd0d2f14e..400e9264e45 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c @@ -2277,8 +2277,8 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, do { rinfo->fb_base = ioremap (rinfo->fb_base_phys, rinfo->mapped_vram); - } while ( rinfo->fb_base == 0 && - ((rinfo->mapped_vram /=2) >= MIN_MAPPED_VRAM) ); + } while (rinfo->fb_base == NULL && + ((rinfo->mapped_vram /= 2) >= MIN_MAPPED_VRAM)); if (rinfo->fb_base == NULL) { printk (KERN_ERR "radeonfb (%s): cannot map FB\n", diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index f3107ad7e54..95883236c0c 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h @@ -200,7 +200,7 @@ static inline int mga_ioremap(unsigned long phys, unsigned long size, int flags, virt->vaddr = ioremap_nocache(phys, size); else virt->vaddr = ioremap(phys, size); - return (virt->vaddr == 0); /* 0, !0... 0, error_code in future */ + return (virt->vaddr == NULL); /* 0, !0... 0, error_code in future */ } static inline void mga_iounmap(vaddr_t va) { diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 73803624c13..b9343844cd1 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c @@ -5787,7 +5787,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } else { struct sis_video_info *countvideo = card_list; ivideo->cardnumber = 1; - while((countvideo = countvideo->next) != 0) + while((countvideo = countvideo->next) != NULL) ivideo->cardnumber++; } -- cgit v1.2.3 From cdc83ae2453ddb19060e05e6afd22b1254128c42 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Fri, 23 May 2008 13:04:53 -0700 Subject: SM501: reverse FPEN/VBIASEN flags behaviour To keep backwards compatibility, reverse the meanings of these flags so that when they are not set, the driver uses the original behvaiour. Signed-off-by: Ben Dooks Cc: Arnaud Patard Acked-by: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/sm501fb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index 742b5c656d6..15d4a768b1f 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c @@ -663,14 +663,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to) sm501fb_sync_regs(fbi); mdelay(10); - if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { + if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) { control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */ writel(control, ctrl_reg); sm501fb_sync_regs(fbi); mdelay(10); } - if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { + if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) { control |= SM501_DC_PANEL_CONTROL_FPEN; writel(control, ctrl_reg); sm501fb_sync_regs(fbi); @@ -678,14 +678,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to) } } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) { /* disable panel power */ - if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { + if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) { control &= ~SM501_DC_PANEL_CONTROL_FPEN; writel(control, ctrl_reg); sm501fb_sync_regs(fbi); mdelay(10); } - if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { + if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) { control &= ~SM501_DC_PANEL_CONTROL_BIAS; writel(control, ctrl_reg); sm501fb_sync_regs(fbi); -- cgit v1.2.3 From 673b4600e3b3cc6689025e6a6fc6909b6e53dd5e Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Fri, 23 May 2008 13:04:55 -0700 Subject: S3C2410: ensure that FB_BLANK_POWERDOWN shuts down the controller When a blank level of FB_BLANK_POWERDOWN is used, we should shut down the controller so that it no longer tries to produce any panel signals or data, and shuts down the DMA which is not needed. Signed-off-by: Ben Dooks Cc: Arnaud Patard Acked-by: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/s3c2410fb.c | 49 ++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 20 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 13b38cbbe4c..2219ae56a0e 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -580,6 +580,27 @@ static int s3c2410fb_setcolreg(unsigned regno, return 0; } +/* s3c2410fb_lcd_enable + * + * shutdown the lcd controller + */ +static void s3c2410fb_lcd_enable(struct s3c2410fb_info *fbi, int enable) +{ + unsigned long flags; + + local_irq_save(flags); + + if (enable) + fbi->regs.lcdcon1 |= S3C2410_LCDCON1_ENVID; + else + fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID; + + writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1); + + local_irq_restore(flags); +} + + /* * s3c2410fb_blank * @blank_mode: the blank mode we want. @@ -589,9 +610,6 @@ static int s3c2410fb_setcolreg(unsigned regno, * blanking succeeded, != 0 if un-/blanking failed due to e.g. a * video mode which doesn't support it. Implements VESA suspend * and powerdown modes on hardware that supports disabling hsync/vsync: - * blank_mode == 2: suspend vsync - * blank_mode == 3: suspend hsync - * blank_mode == 4: powerdown * * Returns negative errno on error, or zero on success. * @@ -605,6 +623,12 @@ static int s3c2410fb_blank(int blank_mode, struct fb_info *info) tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; + if (blank_mode == FB_BLANK_POWERDOWN) { + s3c2410fb_lcd_enable(fbi, 0); + } else { + s3c2410fb_lcd_enable(fbi, 1); + } + if (blank_mode == FB_BLANK_UNBLANK) writel(0x0, tpal_reg); else { @@ -983,21 +1007,6 @@ static int __init s3c2412fb_probe(struct platform_device *pdev) return s3c24xxfb_probe(pdev, DRV_S3C2412); } -/* s3c2410fb_stop_lcd - * - * shutdown the lcd controller - */ -static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi) -{ - unsigned long flags; - - local_irq_save(flags); - - fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID; - writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1); - - local_irq_restore(flags); -} /* * Cleanup @@ -1010,7 +1019,7 @@ static int s3c2410fb_remove(struct platform_device *pdev) unregister_framebuffer(fbinfo); - s3c2410fb_stop_lcd(info); + s3c2410fb_lcd_enable(info, 0); msleep(1); s3c2410fb_unmap_video_memory(fbinfo); @@ -1043,7 +1052,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state) struct fb_info *fbinfo = platform_get_drvdata(dev); struct s3c2410fb_info *info = fbinfo->par; - s3c2410fb_stop_lcd(info); + s3c2410fb_lcd_enable(info, 0); /* sleep before disabling the clock, we need to ensure * the LCD DMA engine is not going to get back on the bus -- cgit v1.2.3 From d585dfe840c93ea800afc124333b6ac04722d359 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Fri, 23 May 2008 13:04:56 -0700 Subject: S3C2410: add error print if we cannot add attribute Fix the following warning by checking the result of device_create_file and printing an error but not removing the device (loss of debug registers is not fatal). drivers/video/s3c2410fb.c:905: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result Signed-off-by: Ben Dooks Cc: Arnaud Patard Acked-by: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/s3c2410fb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 2219ae56a0e..5fea847acd1 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -972,7 +972,10 @@ static int __init s3c24xxfb_probe(struct platform_device *pdev, } /* create device files */ - device_create_file(&pdev->dev, &dev_attr_debug); + ret = device_create_file(&pdev->dev, &dev_attr_debug); + if (ret) { + printk(KERN_ERR "failed to add debug attribute\n"); + } printk(KERN_INFO "fb%d: %s frame buffer device\n", fbinfo->node, fbinfo->fix.id); -- cgit v1.2.3 From 6a0e4ec7bcc6e80d2a32a4c0b83a32c904aadc05 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Fri, 23 May 2008 13:04:56 -0700 Subject: S3C2410: clean out changelog header and tidy Remove the old changelog entries which are now out of date and should be extractable from git anyway. Also tidy up the copyright for the driver. Signed-off-by: Ben Dooks Cc: Arnaud Patard Acked-by: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/s3c2410fb.c | 74 +++++------------------------------------------ drivers/video/s3c2410fb.h | 20 +++---------- 2 files changed, 11 insertions(+), 83 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 5fea847acd1..24d5ea5b9dd 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -1,75 +1,15 @@ -/* - * linux/drivers/video/s3c2410fb.c - * Copyright (c) Arnaud Patard, Ben Dooks +/* linux/drivers/video/s3c2410fb.c + * Copyright (c) 2004,2005 Arnaud Patard + * Copyright (c) 2004-2008 Ben Dooks + * + * S3C2410 LCD Framebuffer Driver * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. * - * S3C2410 LCD Controller Frame Buffer Driver - * based on skeletonfb.c, sa1100fb.c and others - * - * ChangeLog - * 2005-04-07: Arnaud Patard - * - u32 state -> pm_message_t state - * - S3C2410_{VA,SZ}_LCD -> S3C24XX - * - * 2005-03-15: Arnaud Patard - * - Removed the ioctl - * - use readl/writel instead of __raw_writel/__raw_readl - * - * 2004-12-04: Arnaud Patard - * - Added the possibility to set on or off the - * debugging messages - * - Replaced 0 and 1 by on or off when reading the - * /sys files - * - * 2005-03-23: Ben Dooks - * - added non 16bpp modes - * - updated platform information for range of x/y/bpp - * - add code to ensure palette is written correctly - * - add pixel clock divisor control - * - * 2004-11-11: Arnaud Patard - * - Removed the use of currcon as it no more exists - * - Added LCD power sysfs interface - * - * 2004-11-03: Ben Dooks - * - minor cleanups - * - add suspend/resume support - * - s3c2410fb_setcolreg() not valid in >8bpp modes - * - removed last CONFIG_FB_S3C2410_FIXED - * - ensure lcd controller stopped before cleanup - * - added sysfs interface for backlight power - * - added mask for gpio configuration - * - ensured IRQs disabled during GPIO configuration - * - disable TPAL before enabling video - * - * 2004-09-20: Arnaud Patard - * - Suppress command line options - * - * 2004-09-15: Arnaud Patard - * - code cleanup - * - * 2004-09-07: Arnaud Patard - * - Renamed from h1940fb.c to s3c2410fb.c - * - Add support for different devices - * - Backlight support - * - * 2004-09-05: Herbert Pötzl - * - added clock (de-)allocation code - * - added fixem fbmem option - * - * 2004-07-27: Arnaud Patard - * - code cleanup - * - added a forgotten return in h1940fb_init - * - * 2004-07-19: Herbert Pötzl - * - code cleanup and extended debugging - * - * 2004-07-15: Arnaud Patard - * - First version - */ + * Driver based on skeletonfb.c, sa1100fb.c and others. +*/ #include #include diff --git a/drivers/video/s3c2410fb.h b/drivers/video/s3c2410fb.h index dbb73b95e2e..9a6ba3e9d1b 100644 --- a/drivers/video/s3c2410fb.h +++ b/drivers/video/s3c2410fb.h @@ -1,26 +1,14 @@ /* * linux/drivers/video/s3c2410fb.h - * Copyright (c) Arnaud Patard + * Copyright (c) 2004 Arnaud Patard + * + * S3C2410 LCD Framebuffer Driver * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. * - * S3C2410 LCD Controller Frame Buffer Driver - * based on skeletonfb.c, sa1100fb.h - * - * ChangeLog - * - * 2004-12-04: Arnaud Patard - * - Moved dprintk to s3c2410fb.c - * - * 2004-09-07: Arnaud Patard - * - Renamed from h1940fb.h to s3c2410fb.h - * - Changed h1940 to s3c2410 - * - * 2004-07-15: Arnaud Patard - * - First version - */ +*/ #ifndef __S3C2410FB_H #define __S3C2410FB_H -- cgit v1.2.3 From ee29420aca6ca6fbb3e72ee8a980b2600911b864 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Fri, 23 May 2008 13:04:57 -0700 Subject: S3C2410: fix driver MODULE_ALIAS() Add a correct MODULE_ALIAS() entry for this driver to enable udev module loading. Signed-off-by: Ben Dooks Cc: Arnaud Patard Acked-by: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/s3c2410fb.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 24d5ea5b9dd..f0598961c6b 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -1070,3 +1070,5 @@ MODULE_AUTHOR("Arnaud Patard , " "Ben Dooks "); MODULE_DESCRIPTION("Framebuffer driver for the s3c2410"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:s3c2410-lcd"); +MODULE_ALIAS("platform:s3c2412-lcd"); -- cgit v1.2.3 From e2d4ecafd24d6eee4ae6bdbede0cfd0e78423a33 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Thu, 5 Jun 2008 22:45:56 -0700 Subject: modedb: fix incorrect sync and vmode flags for CVT modes The temporary structure for calculated CVT mode is not initialized. Few fields have only bits or-ed or and-ed so they may be left in incorrect (random) state. Testing of the tridentfb seems like a good exercise for the fbdev layer. Signed-off-by: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/modedb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/video') diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 47356219158..d1bbef930df 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c @@ -590,6 +590,7 @@ done: "", (margins) ? " with margins" : "", (interlace) ? " interlaced" : ""); + memset(&cvt_mode, 0, sizeof(cvt_mode)); cvt_mode.xres = xres; cvt_mode.yres = yres; cvt_mode.refresh = (refresh) ? refresh : 60; -- cgit v1.2.3 From 10732c35dff6c2e15e413e7806a7114a2faa0ecf Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Thu, 5 Jun 2008 22:46:33 -0700 Subject: fbcon: fix wrong vmode bits copied on console switch The interlaced and double line mode bits should not be copied to new console when the console is switched. Otherwise, the new console may be set to incorrect refresh rate. Also, the x and y offsets does not need to be copied. Signed-off-by: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/console/fbcon.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 5fa8b76673c..97aff8db10b 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -2275,9 +2275,7 @@ static int fbcon_switch(struct vc_data *vc) * in fb_set_var() */ info->var.activate = var.activate; - var.yoffset = info->var.yoffset; - var.xoffset = info->var.xoffset; - var.vmode = info->var.vmode; + var.vmode |= info->var.vmode & ~FB_VMODE_MASK; fb_set_var(info, &var); ops->var = info->var; -- cgit v1.2.3 From 659179b28f15ab1b1db5f8767090f5e728f115a1 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Thu, 5 Jun 2008 22:46:44 -0700 Subject: fbdev: export symbol fb_mode_option Frame buffer and mode setting drivers can be built as modules, so fb_mode_option needs to be exported to support these. Prevents this error: ERROR: "fb_mode_option" [drivers/ps3/ps3av_mod.ko] undefined! Signed-off-by: Geoff Levand Acked-by: Geert Uytterhoeven Cc: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/modedb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/video') diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index d1bbef930df..d3c3af53a29 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c @@ -28,6 +28,7 @@ #endif const char *fb_mode_option; +EXPORT_SYMBOL_GPL(fb_mode_option); /* * Standard video mode definitions (taken from XFree86) -- cgit v1.2.3 From 738eca74d1bd3e51180de179b7b74d4e34c4e5a3 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Tue, 10 Jun 2008 14:13:09 -0700 Subject: sparc: get leo framebuffer working This patch fixes several issues: Use the right openprom device name so the driver is actually loaded. Fix a crash due to unitialized info->pseudo_palette. Put the framebuffer in the proper mode for software rendering. checkpatch cleanups. Hardware acceleration was removed when the driver was rewritten for the new framebuffer API in 2003. Software rendering requires a different framebuffer access mode but that wasn't changed. The driver now works again but is slow. The proper fix is to reintroduce hardware acceleration. Signed-off-by: Robert Reif Signed-off-by: David S. Miller --- drivers/video/leo.c | 58 ++++++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 32 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/leo.c b/drivers/video/leo.c index 8bc46e93034..13fea61d6ae 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c @@ -17,8 +17,8 @@ #include #include #include +#include -#include #include #include "sbuslib.h" @@ -33,7 +33,6 @@ static int leo_blank(int, struct fb_info *); static int leo_mmap(struct fb_info *, struct vm_area_struct *); static int leo_ioctl(struct fb_info *, unsigned int, unsigned long); -static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *); /* * Frame buffer operations @@ -43,7 +42,6 @@ static struct fb_ops leo_ops = { .owner = THIS_MODULE, .fb_setcolreg = leo_setcolreg, .fb_blank = leo_blank, - .fb_pan_display = leo_pan_display, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, @@ -78,7 +76,7 @@ static struct fb_ops leo_ops = { #define LEO_CUR_TYPE_CMAP 0x00000050 struct leo_cursor { - u8 xxx0[16]; + u8 xxx0[16]; u32 cur_type; u32 cur_misc; u32 cur_cursxy; @@ -105,7 +103,7 @@ struct leo_lx_krn { struct leo_lc_ss0_krn { u32 misc; - u8 xxx0[0x800-4]; + u8 xxx0[0x800-4]; u32 rev; }; @@ -116,7 +114,7 @@ struct leo_lc_ss0_usr { u32 fontt; u32 extent; u32 src; - u32 dst; + u32 dst; u32 copy; u32 fill; }; @@ -129,8 +127,8 @@ struct leo_lc_ss1_usr { u8 unknown; }; -struct leo_ld { - u8 xxx0[0xe00]; +struct leo_ld_ss0 { + u8 xxx0[0xe00]; u32 csr; u32 wid; u32 wmask; @@ -144,13 +142,13 @@ struct leo_ld { u32 src; /* Copy/Scroll (SS0 only) */ u32 dst; /* Copy/Scroll/Fill (SS0 only) */ u32 extent; /* Copy/Scroll/Fill size (SS0 only) */ - u32 xxx1[3]; + u32 xxx1[3]; u32 setsem; /* SS1 only */ u32 clrsem; /* SS1 only */ u32 clrpick; /* SS1 only */ u32 clrdat; /* SS1 only */ u32 alpha; /* SS1 only */ - u8 xxx2[0x2c]; + u8 xxx2[0x2c]; u32 winbg; u32 planemask; u32 rop; @@ -199,11 +197,12 @@ struct leo_par { static void leo_wait(struct leo_lx_krn __iomem *lx_krn) { int i; - + for (i = 0; - (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) && i < 300000; + (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) && + i < 300000; i++) - udelay (1); /* Busy wait at most 0.3 sec */ + udelay(1); /* Busy wait at most 0.3 sec */ return; } @@ -221,7 +220,7 @@ static int leo_setcolreg(unsigned regno, unsigned transp, struct fb_info *info) { struct leo_par *par = (struct leo_par *) info->par; - struct leo_lx_krn __iomem *lx_krn = par->lx_krn; + struct leo_lx_krn __iomem *lx_krn = par->lx_krn; unsigned long flags; u32 val; int i; @@ -408,7 +407,7 @@ static void leo_wid_put(struct fb_info *info, struct fb_wid_list *wl) leo_wait(lx_krn); for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) { - switch(wi->wi_type) { + switch (wi->wi_type) { case FB_WID_DBL_8: j = (wi->wi_index & 0xf) + 0x40; break; @@ -453,13 +452,12 @@ static void leo_init_wids(struct fb_info *info) wi.wi_index = 1; wi.wi_values [0] = 0x30; leo_wid_put(info, &wl); - } static void leo_switch_from_graph(struct fb_info *info) { struct leo_par *par = (struct leo_par *) info->par; - struct leo_ld __iomem *ss = (struct leo_ld __iomem *) par->ld_ss0; + struct leo_ld_ss0 __iomem *ss = par->ld_ss0; unsigned long flags; u32 val; @@ -485,19 +483,13 @@ static void leo_switch_from_graph(struct fb_info *info) val = sbus_readl(&par->lc_ss0_usr->csr); } while (val & 0x20000000); - spin_unlock_irqrestore(&par->lock, flags); -} - -static int leo_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) -{ - /* We just use this to catch switches out of - * graphics mode. - */ - leo_switch_from_graph(info); + /* setup screen buffer for cfb_* functions */ + sbus_writel(1, &ss->wid); + sbus_writel(0x00ffffff, &ss->planemask); + sbus_writel(0x310b90, &ss->rop); + sbus_writel(0, &par->lc_ss0_usr->addrspace); - if (var->xoffset || var->yoffset || var->vmode) - return -EINVAL; - return 0; + spin_unlock_irqrestore(&par->lock, flags); } static void leo_init_hw(struct fb_info *info) @@ -542,7 +534,8 @@ static void leo_unmap_regs(struct of_device *op, struct fb_info *info, of_iounmap(&op->resource[0], info->screen_base, 0x800000); } -static int __devinit leo_probe(struct of_device *op, const struct of_device_id *match) +static int __devinit leo_probe(struct of_device *op, + const struct of_device_id *match) { struct device_node *dp = op->node; struct fb_info *info; @@ -594,8 +587,9 @@ static int __devinit leo_probe(struct of_device *op, const struct of_device_id * !info->screen_base) goto out_unmap_regs; - info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; + info->flags = FBINFO_DEFAULT; info->fbops = &leo_ops; + info->pseudo_palette = par->clut_data; leo_init_wids(info); leo_init_hw(info); @@ -649,7 +643,7 @@ static int __devexit leo_remove(struct of_device *op) static struct of_device_id leo_match[] = { { - .name = "leo", + .name = "SUNW,leo", }, {}, }; -- cgit v1.2.3 From 62cfcf4f467733a8dc218691c791804a148da887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Schindele?= Date: Wed, 11 Jun 2008 19:56:06 +0100 Subject: [ARM] 5090/1: Correct pxafb palette typo error This patch correct a typo error in pxafb vhich is relevant for 8-bit palette framebuffer configuration. Signed-off-by: Jrgen Schindele Acked-by: Eric Miao Signed-off-by: Russell King --- drivers/video/pxafb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 274bc93ab7d..7dcda187d9b 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -573,8 +573,8 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal, dma_desc->fdadr = fbi->dma_buff_phys + dma_desc_off; fbi->fdadr[dma] = fbi->dma_buff_phys + dma_desc_off; } else { - pal_desc = &fbi->dma_buff->pal_desc[dma]; - pal_desc_off = offsetof(struct pxafb_dma_buff, dma_desc[pal]); + pal_desc = &fbi->dma_buff->pal_desc[pal]; + pal_desc_off = offsetof(struct pxafb_dma_buff, pal_desc[pal]); pal_desc->fsadr = fbi->dma_buff_phys + pal * PALETTE_SIZE; pal_desc->fidr = 0; @@ -1276,6 +1276,8 @@ static int __init pxafb_map_video_memory(struct pxafb_info *fbi) fbi->dma_buff_phys = fbi->map_dma; fbi->palette_cpu = (u16 *) fbi->dma_buff->palette; + pr_debug("pxafb: palette_mem_size = 0x%08lx\n", fbi->palette_size*sizeof(u16)); + #ifdef CONFIG_FB_PXA_SMARTPANEL fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff; fbi->n_smart_cmds = 0; -- cgit v1.2.3 From f969c5672b16b857e5231ad3c78f08d8ef3305aa Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Thu, 12 Jun 2008 02:05:26 -0400 Subject: fsl-diu-db: compile fix This patch fixes a compile failure in 2.6.26-rc5-git5. The variable is expected to be called ofdev. Signed-off-by: Jeff Mahoney Signed-off-by: Linus Torvalds --- drivers/video/fsl-diu-fb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index b50bb03cb5a..0a2785361ca 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -1320,7 +1320,7 @@ static void free_irq_local(int irq) * Power management hooks. Note that we won't be called from IRQ context, * unlike the blank functions above, so we may sleep. */ -static int fsl_diu_suspend(struct of_device *dev, pm_message_t state) +static int fsl_diu_suspend(struct of_device *ofdev, pm_message_t state) { struct fsl_diu_data *machine_data; @@ -1330,7 +1330,7 @@ static int fsl_diu_suspend(struct of_device *dev, pm_message_t state) return 0; } -static int fsl_diu_resume(struct of_device *dev) +static int fsl_diu_resume(struct of_device *ofdev) { struct fsl_diu_data *machine_data; -- cgit v1.2.3 From 630c270183133ac25bef8c8d726ac448df9b169a Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Thu, 12 Jun 2008 15:21:29 -0700 Subject: hgafb: resource management fix Release ports which are requested during detection which are not freed if there is no hga card. Otherwise there is a crash during cat /proc/ioports command. Signed-off-by: Krzysztof Helt Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/hgafb.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c index fb9e6722854..c18880d9db1 100644 --- a/drivers/video/hgafb.c +++ b/drivers/video/hgafb.c @@ -279,7 +279,7 @@ static void hga_blank(int blank_mode) static int __init hga_card_detect(void) { - int count=0; + int count = 0; void __iomem *p, *q; unsigned short p_save, q_save; @@ -303,20 +303,18 @@ static int __init hga_card_detect(void) writew(0x55aa, p); if (readw(p) == 0x55aa) count++; writew(p_save, p); - if (count != 2) { - return 0; - } + if (count != 2) + goto error; /* Ok, there is definitely a card registering at the correct * memory location, so now we do an I/O port test. */ - if (!test_hga_b(0x66, 0x0f)) { /* cursor low register */ - return 0; - } - if (!test_hga_b(0x99, 0x0f)) { /* cursor low register */ - return 0; - } + if (!test_hga_b(0x66, 0x0f)) /* cursor low register */ + goto error; + + if (!test_hga_b(0x99, 0x0f)) /* cursor low register */ + goto error; /* See if the card is a Hercules, by checking whether the vsync * bit of the status register is changing. This test lasts for @@ -331,7 +329,7 @@ static int __init hga_card_detect(void) } if (p_save == q_save) - return 0; + goto error; switch (inb_p(HGA_STATUS_PORT) & 0x70) { case 0x10: @@ -348,6 +346,12 @@ static int __init hga_card_detect(void) break; } return 1; +error: + if (release_io_ports) + release_region(0x3b0, 12); + if (release_io_port) + release_region(0x3bf, 1); + return 0; } /** -- cgit v1.2.3 From e59b6a5ab51f6192cbe20d4f031335fe6d0e73fd Mon Sep 17 00:00:00 2001 From: Philippe De Muyter Date: Thu, 12 Jun 2008 15:21:45 -0700 Subject: drivers/video/cirrusfb: fix RAM address printk In the cirrusfb driver, the RAM address printk has a superfluous 'x' that could be interpreted as "don't care", while it is actually a typo. Fix that. [akpm@linux-foundation.org: join the two printk strings to make it atomic] Signed-off-by: Philippe De Muyter Cc: Jiri Slaby Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/cirrusfb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index 35ac9d956b3..c14b2435d23 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c @@ -2432,9 +2432,9 @@ static int cirrusfb_pci_register(struct pci_dev *pdev, info->screen_size = board_size; cinfo->unmap = cirrusfb_pci_unmap; - printk(KERN_INFO " RAM (%lu kB) at 0xx%lx, ", - info->screen_size >> 10, board_addr); - printk(KERN_INFO "Cirrus Logic chipset on PCI bus\n"); + printk(KERN_INFO "RAM (%lu kB) at 0x%lx, Cirrus " + "Logic chipset on PCI bus\n", + info->screen_size >> 10, board_addr); pci_set_drvdata(pdev, info); ret = cirrusfb_register(info); -- cgit v1.2.3 From f1edfc420ac7beb90b27bf822036cbbfa32483f1 Mon Sep 17 00:00:00 2001 From: Jaya Kumar Date: Sun, 22 Jun 2008 04:27:25 +0100 Subject: [ARM] 5115/1: pxafb: fix ifdef for command line option handling This bug was found and fixed by Lothar Wassmann. Previously, the use of ifndef CONFIG_MODULES made it such that pxafb command line option parsing was dependent on whether the kernel was built with module support. The ifndef should be MODULE so that parsing is dependent only on whether the driver is built-in or not. Signed-off-by: Jaya Kumar Acked-by: Krzysztof Helt Acked-by: Eric Miao Signed-off-by: Russell King --- drivers/video/pxafb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 7dcda187d9b..eb23d192333 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -1588,7 +1588,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options) static char g_options[256] __devinitdata = ""; -#ifndef CONFIG_MODULES +#ifndef MODULE static int __devinit pxafb_setup_options(void) { char *options = NULL; -- cgit v1.2.3 From ee98476bbc565f8fe42e198602e647288b6a258d Mon Sep 17 00:00:00 2001 From: Jaya Kumar Date: Sun, 22 Jun 2008 04:27:26 +0100 Subject: [ARM] 5116/1: pxafb: cleanup and fix order of failure handling This issue was found by Krzysztof Helt and Eric Miao. pxafb had issues in the order with which it cleaned up if errors occurred during a probe. This patch reorders the failure handling sequence and also frees the cmap and clk. Signed-off-by: Jaya Kumar Acked-by: Krzysztof Helt Acked-by: Eric Miao Signed-off-by: Russell King --- drivers/video/pxafb.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index eb23d192333..796e0d1d5b1 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -1685,14 +1685,14 @@ static int __init pxafb_probe(struct platform_device *dev) if (r == NULL) { dev_err(&dev->dev, "no I/O memory resource defined\n"); ret = -ENODEV; - goto failed; + goto failed_fbi; } r = request_mem_region(r->start, r->end - r->start + 1, dev->name); if (r == NULL) { dev_err(&dev->dev, "failed to request I/O memory\n"); ret = -EBUSY; - goto failed; + goto failed_fbi; } fbi->mmio_base = ioremap(r->start, r->end - r->start + 1); @@ -1735,8 +1735,17 @@ static int __init pxafb_probe(struct platform_device *dev) * This makes sure that our colour bitfield * descriptors are correctly initialised. */ - pxafb_check_var(&fbi->fb.var, &fbi->fb); - pxafb_set_par(&fbi->fb); + ret = pxafb_check_var(&fbi->fb.var, &fbi->fb); + if (ret) { + dev_err(&dev->dev, "failed to get suitable mode\n"); + goto failed_free_irq; + } + + ret = pxafb_set_par(&fbi->fb); + if (ret) { + dev_err(&dev->dev, "Failed to set parameters\n"); + goto failed_free_irq; + } platform_set_drvdata(dev, fbi); @@ -1744,7 +1753,7 @@ static int __init pxafb_probe(struct platform_device *dev) if (ret < 0) { dev_err(&dev->dev, "Failed to register framebuffer device: %d\n", ret); - goto failed_free_irq; + goto failed_free_cmap; } #ifdef CONFIG_CPU_FREQ @@ -1763,18 +1772,23 @@ static int __init pxafb_probe(struct platform_device *dev) return 0; +failed_free_cmap: + if (fbi->fb.cmap.len) + fb_dealloc_cmap(&fbi->fb.cmap); failed_free_irq: free_irq(irq, fbi); -failed_free_res: - release_mem_region(r->start, r->end - r->start + 1); -failed_free_io: - iounmap(fbi->mmio_base); failed_free_mem: dma_free_writecombine(&dev->dev, fbi->map_size, fbi->map_cpu, fbi->map_dma); -failed: +failed_free_io: + iounmap(fbi->mmio_base); +failed_free_res: + release_mem_region(r->start, r->end - r->start + 1); +failed_fbi: + clk_put(fbi->clk); platform_set_drvdata(dev, NULL); kfree(fbi); +failed: return ret; } -- cgit v1.2.3 From 9e6c29768fc05d32ba1342b9348957b24bc476c2 Mon Sep 17 00:00:00 2001 From: Jaya Kumar Date: Sun, 22 Jun 2008 04:27:27 +0100 Subject: [ARM] 5117/1: pxafb: fix __devinit/exit annotations This patch fixes pxafb's init/exit annotations. It uses __devinit/exit for probe functions and __init for init functions. g_options is left as __devinitdata since it is used by both. Signed-off-by: Jaya Kumar Acked-by: Krzysztof Helt Acked-by: Eric Miao Signed-off-by: Russell King --- drivers/video/pxafb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 796e0d1d5b1..fafe7db20d6 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -1246,7 +1246,7 @@ static int pxafb_resume(struct platform_device *dev) * cache. Once this area is remapped, all virtual memory * access to the video memory should occur at the new region. */ -static int __init pxafb_map_video_memory(struct pxafb_info *fbi) +static int __devinit pxafb_map_video_memory(struct pxafb_info *fbi) { /* * We reserve one page for the palette, plus the size @@ -1348,7 +1348,7 @@ decode_mode: pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes); } -static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) +static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev) { struct pxafb_info *fbi; void *addr; @@ -1410,7 +1410,7 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) } #ifdef CONFIG_FB_PXA_PARAMETERS -static int __init parse_opt_mode(struct device *dev, const char *this_opt) +static int __devinit parse_opt_mode(struct device *dev, const char *this_opt) { struct pxafb_mach_info *inf = dev->platform_data; @@ -1469,7 +1469,7 @@ done: return 0; } -static int __init parse_opt(struct device *dev, char *this_opt) +static int __devinit parse_opt(struct device *dev, char *this_opt) { struct pxafb_mach_info *inf = dev->platform_data; struct pxafb_mode_info *mode = &inf->modes[0]; @@ -1567,7 +1567,7 @@ static int __init parse_opt(struct device *dev, char *this_opt) return 0; } -static int __init pxafb_parse_options(struct device *dev, char *options) +static int __devinit pxafb_parse_options(struct device *dev, char *options) { char *this_opt; int ret; @@ -1589,7 +1589,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options) static char g_options[256] __devinitdata = ""; #ifndef MODULE -static int __devinit pxafb_setup_options(void) +static int __init pxafb_setup_options(void) { char *options = NULL; @@ -1613,7 +1613,7 @@ MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)"); #define pxafb_setup_options() (0) #endif -static int __init pxafb_probe(struct platform_device *dev) +static int __devinit pxafb_probe(struct platform_device *dev) { struct pxafb_info *fbi; struct pxafb_mach_info *inf; @@ -1801,7 +1801,7 @@ static struct platform_driver pxafb_driver = { }, }; -static int __devinit pxafb_init(void) +static int __init pxafb_init(void) { if (pxafb_setup_options()) return -EINVAL; -- cgit v1.2.3 From 05946bce839b4fed5442dbfab77060fb75e051f3 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Fri, 4 Jul 2008 09:59:38 -0700 Subject: fsl_diu_fb: fix build with CONFIG_PM=y, plus fix some warnings This patch fixes following build error when CONFIG_PM is set. CC drivers/video/fsl-diu-fb.o drivers/video/fsl-diu-fb.c: In function 'fsl_diu_suspend': drivers/video/fsl-diu-fb.c:1327: error: 'ofdev' undeclared (first use in this function) drivers/video/fsl-diu-fb.c:1327: error: (Each undeclared identifier is reported only once drivers/video/fsl-diu-fb.c:1327: error: for each function it appears in.) drivers/video/fsl-diu-fb.c: In function 'fsl_diu_resume': drivers/video/fsl-diu-fb.c:1337: error: 'ofdev' undeclared (first use in this function) While I'm at it, also fix this warning: drivers/video/fsl-diu-fb.c: In function 'fsl_diu_alloc': drivers/video/fsl-diu-fb.c:314: warning: format '%lx' expects type 'long unsigned int', but argument 3 has type 'phys_addr_t' And these section mismatches: ..from the function fsl_diu_remove() to the function .exit.text:uninstall_fb() ..from the function fsl_diu_remove() to the function .exit.text:uninstall_fb() ..from the function install_fb() to the variable .devinit.data:fsl_diu_mode_db ..from the function install_fb() to the variable .devinit.data:fsl_diu_mode_db ..from the function fsl_diu_probe() to the function .exit.text:uninstall_fb() ..from the function fsl_diu_probe() to the function .exit.text:uninstall_fb() Also, some sparse fixes: make two functions static, and use NULL where appropriate. There are still a lot of sparse warnings, mainly wrt absence of __iomem annotations, but some will require ugly __force stuff. I'll leave them for now, since proper fix would be not that trivial as few one-liners below. Signed-off-by: Anton Vorontsov Cc: Timur Tabi Cc: Antonino Daplas Cc: York Sun Cc: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/fsl-diu-fb.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 0a2785361ca..712dabc6269 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -286,7 +286,7 @@ static struct diu_pool pool; * rheap and make the furture large allocation fail. */ -void *fsl_diu_alloc(unsigned long size, phys_addr_t *phys) +static void *fsl_diu_alloc(unsigned long size, phys_addr_t *phys) { void *virt; @@ -311,12 +311,12 @@ void *fsl_diu_alloc(unsigned long size, phys_addr_t *phys) memset(virt, 0, size); } - pr_debug("rh virt=%p phys=%lx\n", virt, *phys); + pr_debug("rh virt=%p phys=%llx\n", virt, (unsigned long long)*phys); return virt; } -void fsl_diu_free(void *p, unsigned long size) +static void fsl_diu_free(void *p, unsigned long size) { pr_debug("p=%p size=%lu\n", p, size); @@ -770,7 +770,7 @@ static int map_video_memory(struct fb_info *info) info->fix.smem_len = info->fix.line_length * info->var.yres_virtual; pr_debug("MAP_VIDEO_MEMORY: smem_len = %d\n", info->fix.smem_len); info->screen_base = fsl_diu_alloc(info->fix.smem_len, &phys); - if (info->screen_base == 0) { + if (info->screen_base == NULL) { printk(KERN_ERR "Unable to allocate fb memory\n"); return -ENOMEM; } @@ -788,7 +788,7 @@ static int map_video_memory(struct fb_info *info) static void unmap_video_memory(struct fb_info *info) { fsl_diu_free(info->screen_base, info->fix.smem_len); - info->screen_base = 0; + info->screen_base = NULL; info->fix.smem_start = 0; info->fix.smem_len = 0; } @@ -1158,7 +1158,7 @@ static int init_fbinfo(struct fb_info *info) return 0; } -static int install_fb(struct fb_info *info) +static int __devinit install_fb(struct fb_info *info) { int rc; struct mfb_info *mfbi = info->par; @@ -1233,7 +1233,7 @@ static int install_fb(struct fb_info *info) return 0; } -static void __exit uninstall_fb(struct fb_info *info) +static void uninstall_fb(struct fb_info *info) { struct mfb_info *mfbi = info->par; @@ -1287,7 +1287,7 @@ static int request_irq_local(int irq) /* Read to clear the status */ status = in_be32(&hw->int_status); - ret = request_irq(irq, fsl_diu_isr, 0, "diu", 0); + ret = request_irq(irq, fsl_diu_isr, 0, "diu", NULL); if (ret) pr_info("Request diu IRQ failed.\n"); else { @@ -1312,7 +1312,7 @@ static void free_irq_local(int irq) /* Disable all LCDC interrupt */ out_be32(&hw->int_mask, 0x1f); - free_irq(irq, 0); + free_irq(irq, NULL); } #ifdef CONFIG_PM @@ -1324,7 +1324,7 @@ static int fsl_diu_suspend(struct of_device *ofdev, pm_message_t state) { struct fsl_diu_data *machine_data; - machine_data = dev_get_drvdata(&ofdev->dev); + machine_data = dev_get_drvdata(&dev->dev); disable_lcdc(machine_data->fsl_diu_info[0]); return 0; @@ -1334,7 +1334,7 @@ static int fsl_diu_resume(struct of_device *ofdev) { struct fsl_diu_data *machine_data; - machine_data = dev_get_drvdata(&ofdev->dev); + machine_data = dev_get_drvdata(&dev->dev); enable_lcdc(machine_data->fsl_diu_info[0]); return 0; @@ -1353,7 +1353,8 @@ static int allocate_buf(struct diu_addr *buf, u32 size, u32 bytes_align) dma_addr_t paddr = 0; ssize = size + bytes_align; - buf->vaddr = dma_alloc_coherent(0, ssize, &paddr, GFP_DMA | __GFP_ZERO); + buf->vaddr = dma_alloc_coherent(NULL, ssize, &paddr, GFP_DMA | + __GFP_ZERO); if (!buf->vaddr) return -ENOMEM; @@ -1371,7 +1372,7 @@ static int allocate_buf(struct diu_addr *buf, u32 size, u32 bytes_align) static void free_buf(struct diu_addr *buf, u32 size, u32 bytes_align) { - dma_free_coherent(0, size + bytes_align, + dma_free_coherent(NULL, size + bytes_align, buf->vaddr, (buf->paddr - buf->offset)); return; } @@ -1411,7 +1412,7 @@ static ssize_t show_monitor(struct device *device, return diu_ops.show_monitor_port(machine_data->monitor_port, buf); } -static int fsl_diu_probe(struct of_device *ofdev, +static int __devinit fsl_diu_probe(struct of_device *ofdev, const struct of_device_id *match) { struct device_node *np = ofdev->node; -- cgit v1.2.3 From e5dd3cbd81aad69bdf773ab63c06fbaabc2b767a Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Fri, 4 Jul 2008 09:59:52 -0700 Subject: w100fb: do not depend on SHARPSL Apart from Sharp SL-Cxx series, there are a few other devices that have ATI Imageon chips, among them HP iPAQ hx4700. Signed-off-by: Philipp Zabel Acked-by: Ian Molton Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 002b61b4f0f..e0c5f96b273 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -1825,12 +1825,13 @@ config FB_FSL_DIU config FB_W100 tristate "W100 frame buffer support" - depends on FB && PXA_SHARPSL + depends on FB && ARCH_PXA select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT ---help--- Frame buffer driver for the w100 as found on the Sharp SL-Cxx series. + It can also drive the w3220 chip found on iPAQ hx4700. This driver is also available as a module ( = code which can be inserted and removed from the running kernel whenever you want). The -- cgit v1.2.3 From 27c8d95f8c9ff83e4e4d8a90523d891427964c79 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Fri, 4 Jul 2008 09:59:53 -0700 Subject: w100fb: add 80 MHz modeline This is needed for HTC Blueangel (w3200). At 96MHz its screen flickers. Signed-off-by: Philipp Zabel Acked-by: Ian Molton Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/w100fb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/video') diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c index 30469bf906e..d0674f1e3f1 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/w100fb.c @@ -1003,6 +1003,7 @@ static struct w100_pll_info xtal_14318000[] = { static struct w100_pll_info xtal_16000000[] = { /*freq M N_int N_fac tfgoal lock_time */ { 72, 1, 8, 0, 0xe0, 48}, /* tfgoal guessed */ + { 80, 1, 9, 0, 0xe0, 13}, /* tfgoal guessed */ { 95, 1, 10, 7, 0xe0, 38}, /* tfgoal guessed */ { 96, 1, 11, 0, 0xe0, 36}, /* tfgoal guessed */ { 0, 0, 0, 0, 0, 0}, -- cgit v1.2.3 From 48948a3e237ff47823d414704aeb8604a4c61ad0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 8 Jul 2008 18:41:17 +0200 Subject: Fix broken fix for fsl-diu-db On 2.6.26-rc9, the commit 05946bce839b4fed5442dbfab77060fb75e051f3 ("fsl_diu_fb: fix build with CONFIG_PM=y, plus fix some warnings") breaks its previous fix f969c5672b16b857e5231ad3c78f08d8ef3305aa ("fsl-diu-db: compile fix") This patch reverts the broken part. Signed-off-by: Takashi Iwai Acked-by: Anton Vorontsov Signed-off-by: Linus Torvalds --- drivers/video/fsl-diu-fb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 712dabc6269..09d7e22c6fe 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -1324,7 +1324,7 @@ static int fsl_diu_suspend(struct of_device *ofdev, pm_message_t state) { struct fsl_diu_data *machine_data; - machine_data = dev_get_drvdata(&dev->dev); + machine_data = dev_get_drvdata(&ofdev->dev); disable_lcdc(machine_data->fsl_diu_info[0]); return 0; @@ -1334,7 +1334,7 @@ static int fsl_diu_resume(struct of_device *ofdev) { struct fsl_diu_data *machine_data; - machine_data = dev_get_drvdata(&dev->dev); + machine_data = dev_get_drvdata(&ofdev->dev); enable_lcdc(machine_data->fsl_diu_info[0]); return 0; -- cgit v1.2.3 From f31ad92f34913043cf008d6e479e92dfbaf02df1 Mon Sep 17 00:00:00 2001 From: Jaya Kumar Date: Sat, 12 Jul 2008 13:47:51 -0700 Subject: fbdev: bugfix for multiprocess defio This patch is a bugfix for how defio handles multiple processes manipulating the same framebuffer. Thanks to Bernard Blackham for identifying this bug. It occurs when two applications mmap the same framebuffer and concurrently write to the same page. Normally, this doesn't occur since only a single process mmaps the framebuffer. The symptom of the bug is that the mapping applications will hang. The cause is that defio incorrectly tries to add the same page twice to the pagelist. The solution I have is to walk the pagelist and check for a duplicate before adding. Since I needed to walk the pagelist, I now also keep the pagelist in sorted order. Signed-off-by: Jaya Kumar Cc: Bernard Blackham Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/fb_defio.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c index 24843fdd539..59df132cc37 100644 --- a/drivers/video/fb_defio.c +++ b/drivers/video/fb_defio.c @@ -74,6 +74,7 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma, { struct fb_info *info = vma->vm_private_data; struct fb_deferred_io *fbdefio = info->fbdefio; + struct page *cur; /* this is a callback we get when userspace first tries to write to the page. we schedule a workqueue. that workqueue @@ -83,7 +84,24 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma, /* protect against the workqueue changing the page list */ mutex_lock(&fbdefio->lock); - list_add(&page->lru, &fbdefio->pagelist); + + /* we loop through the pagelist before adding in order + to keep the pagelist sorted */ + list_for_each_entry(cur, &fbdefio->pagelist, lru) { + /* this check is to catch the case where a new + process could start writing to the same page + through a new pte. this new access can cause the + mkwrite even when the original ps's pte is marked + writable */ + if (unlikely(cur == page)) + goto page_already_added; + else if (cur->index > page->index) + break; + } + + list_add_tail(&page->lru, &cur->lru); + +page_already_added: mutex_unlock(&fbdefio->lock); /* come back after delay to process the deferred IO */ -- cgit v1.2.3