diff options
Diffstat (limited to 'drivers/video')
32 files changed, 413 insertions, 178 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 3e153d313bb0..f5079c78ba4e 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -520,16 +520,11 @@ config FB_GBE config FB_GBE_MEM int "Video memory size in MB" depends on FB_GBE - default 8 + default 4 help This is the amount of memory reserved for the framebuffer, which can be any value between 1MB and 8MB. -config BUS_I2C - bool - depends on (FB = y) && VISWS - default y - config FB_SUN3 bool "Sun3 framebuffer support" depends on (FB = y) && (SUN3 || SUN3X) && BROKEN diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index b2187175d03f..6761b68c35e9 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c @@ -116,9 +116,10 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) int ret = 0; memset(&var->transp, 0, sizeof(var->transp)); - memset(&var->red, 0, sizeof(var->red)); - memset(&var->green, 0, sizeof(var->green)); - memset(&var->blue, 0, sizeof(var->blue)); + + var->red.msb_right = 0; + var->green.msb_right = 0; + var->blue.msb_right = 0; switch (var->bits_per_pixel) { case 1: @@ -133,34 +134,20 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) var->blue.offset = 0; break; case 16: - var->red.length = 5; - var->green.length = 6; - var->blue.length = 5; - if (fb->panel->cntl & CNTL_BGR) { - var->red.offset = 11; - var->green.offset = 5; - var->blue.offset = 0; - } else { - var->red.offset = 0; - var->green.offset = 5; - var->blue.offset = 11; - } + var->red.length = 5; + var->blue.length = 5; + /* + * Green length can be 5 or 6 depending whether + * we're operating in RGB555 or RGB565 mode. + */ + if (var->green.length != 5 && var->green.length != 6) + var->green.length = 6; break; case 32: if (fb->panel->cntl & CNTL_LCDTFT) { var->red.length = 8; var->green.length = 8; var->blue.length = 8; - - if (fb->panel->cntl & CNTL_BGR) { - var->red.offset = 16; - var->green.offset = 8; - var->blue.offset = 0; - } else { - var->red.offset = 0; - var->green.offset = 8; - var->blue.offset = 16; - } break; } default: @@ -168,6 +155,23 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) break; } + /* + * >= 16bpp displays have separate colour component bitfields + * encoded in the pixel data. Calculate their position from + * the bitfield length defined above. + */ + if (ret == 0 && var->bits_per_pixel >= 16) { + if (fb->panel->cntl & CNTL_BGR) { + var->blue.offset = 0; + var->green.offset = var->blue.offset + var->blue.length; + var->red.offset = var->green.offset + var->green.length; + } else { + var->red.offset = 0; + var->green.offset = var->red.offset + var->red.length; + var->blue.offset = var->green.offset + var->green.length; + } + } + return ret; } diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index df8e5667b348..466042808daf 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c @@ -253,7 +253,7 @@ static void arcfb_lcd_update_page(struct arcfb_par *par, unsigned int upper, { unsigned char *src; unsigned int xindex, yindex, chipindex, linesize; - int i, count; + int i; unsigned char val; unsigned char bitmask, rightshift; @@ -282,7 +282,6 @@ static void arcfb_lcd_update_page(struct arcfb_par *par, unsigned int upper, } ks108_writeb_data(par, chipindex, val); left++; - count++; if (bitmask == 0x80) { bitmask = 1; src++; @@ -460,11 +459,11 @@ static ssize_t arcfb_write(struct file *file, const char __user *buf, size_t cou inode = file->f_dentry->d_inode; fbidx = iminor(inode); info = registered_fb[fbidx]; - par = info->par; if (!info || !info->screen_base) return -ENODEV; + par = info->par; xres = info->var.xres; fbmemlength = (xres * info->var.yres)/8; diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c index 69f75547865d..c924d81f7978 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/asiliantfb.c @@ -322,32 +322,29 @@ static int asiliantfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, writeb(green, mmio_base + 0x791); writeb(blue, mmio_base + 0x791); - switch(p->var.bits_per_pixel) { - case 15: - if (regno < 16) { + if (regno < 16) { + switch(p->var.red.offset) { + case 10: /* RGB 555 */ ((u32 *)(p->pseudo_palette))[regno] = ((red & 0xf8) << 7) | ((green & 0xf8) << 2) | ((blue & 0xf8) >> 3); - } - break; - case 16: - if (regno < 16) { + break; + case 11: /* RGB 565 */ ((u32 *)(p->pseudo_palette))[regno] = ((red & 0xf8) << 8) | ((green & 0xfc) << 3) | ((blue & 0xf8) >> 3); - } - break; - case 24: - if (regno < 24) { + break; + case 16: /* RGB 888 */ ((u32 *)(p->pseudo_palette))[regno] = (red << 16) | (green << 8) | (blue); + break; } - break; } + return 0; } diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index bfc8a93b2c73..620c9a934e0e 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c @@ -1326,7 +1326,7 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll, unsigned char post_dividers[] = {1,2,4,8,3,6,12}; u32 output_freq; u32 vclk; /* in .01 MHz */ - int i; + int i = 0; u32 n, d; vclk = 100000000 / period_in_ps; /* convert units to 10 kHz */ @@ -1340,15 +1340,16 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll, /* now, find an acceptable divider */ for (i = 0; i < sizeof(post_dividers); i++) { output_freq = post_dividers[i] * vclk; - if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) + if (output_freq >= c.ppll_min && output_freq <= c.ppll_max) { + pll->post_divider = post_dividers[i]; break; + } } /* calculate feedback divider */ n = c.ref_divider * output_freq; d = c.ref_clk; - pll->post_divider = post_dividers[i]; pll->feedback_divider = round_div(n, d); pll->vclk = vclk; diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c index 7f9838dceab5..98c05bc0de44 100644 --- a/drivers/video/aty/radeon_monitor.c +++ b/drivers/video/aty/radeon_monitor.c @@ -396,6 +396,10 @@ static int __devinit radeon_parse_monitor_layout(struct radeonfb_info *rinfo, s1[i] = *s; i++; } + + if (i > 4) + i = 4; + } while (*s++); if (second) s2[i] = 0; diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 556895e99645..1f8d805c61e5 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c @@ -1321,8 +1321,6 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) mdelay( 15); } -#ifdef CONFIG_PPC_OF - static void radeon_pm_reset_pad_ctlr_strength(struct radeonfb_info *rinfo) { u32 tmp, tmp2; @@ -1836,6 +1834,8 @@ static void radeon_reinitialize_M10(struct radeonfb_info *rinfo) radeon_pm_m10_enable_lvds_spread_spectrum(rinfo); } +#ifdef CONFIG_PPC_OF + static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo) { OUTREG(MC_CNTL, rinfo->save_regs[46]); @@ -2728,13 +2728,23 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) printk("radeonfb: Dynamic Clock Power Management disabled\n"); } +#if defined(CONFIG_PM) /* Check if we can power manage on suspend/resume. We can do * D2 on M6, M7 and M9, and we can resume from D3 cold a few other * "Mac" cards, but that's all. We need more infos about what the * BIOS does tho. Right now, all this PM stuff is pmac-only for that * reason. --BenH */ -#if defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) + /* Special case for Samsung P35 laptops + */ + if ((rinfo->pdev->vendor == PCI_VENDOR_ID_ATI) && + (rinfo->pdev->device == PCI_CHIP_RV350_NP) && + (rinfo->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG) && + (rinfo->pdev->subsystem_device == 0xc00c)) { + rinfo->reinit_func = radeon_reinitialize_M10; + rinfo->pm_mode |= radeon_pm_off; + } +#if defined(CONFIG_PPC_PMAC) if (_machine == _MACH_Pmac && rinfo->of_node) { if (rinfo->is_mobility && rinfo->pm_reg && rinfo->family <= CHIP_FAMILY_RV250) @@ -2778,7 +2788,8 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000); #endif } -#endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) */ +#endif /* defined(CONFIG_PPC_PMAC) */ +#endif /* defined(CONFIG_PM) */ } void radeonfb_pm_exit(struct radeonfb_info *rinfo) diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 2406899f1207..3d04b2def0f1 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c @@ -49,6 +49,7 @@ #include <linux/interrupt.h> #include <linux/ctype.h> #include <linux/dma-mapping.h> +#include <linux/platform_device.h> #include <asm/mach-au1x00/au1000.h> @@ -406,7 +407,7 @@ int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) vma->vm_flags |= VM_IO; - if (io_remap_page_range(vma, vma->vm_start, off, + if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot)) { return -EAGAIN; diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 996d543d6609..9d996f2c10d5 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -50,3 +50,11 @@ config BACKLIGHT_CORGI If you have a Sharp Zaurus SL-C7xx, say y to enable the backlight driver. +config BACKLIGHT_HP680 + tristate "HP Jornada 680 Backlight Driver" + depends on BACKLIGHT_DEVICE && SH_HP6XX + default y + help + If you have a HP Jornada 680, say y to enable the + backlight driver. + diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 4af321fae390..744210c38e74 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -3,4 +3,5 @@ obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o +obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o obj-$(CONFIG_SHARP_LOCOMO) += locomolcd.o diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 9d5015e99372..151fda8dded0 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -13,7 +13,6 @@ #include <linux/ctype.h> #include <linux/err.h> #include <linux/fb.h> -#include <asm/bug.h> static ssize_t backlight_show_power(struct class_device *cdev, char *buf) { @@ -173,7 +172,7 @@ struct backlight_device *backlight_device_register(const char *name, void *devda new_bd = kmalloc(sizeof(struct backlight_device), GFP_KERNEL); if (unlikely(!new_bd)) - return ERR_PTR(ENOMEM); + return ERR_PTR(-ENOMEM); init_MUTEX(&new_bd->sem); new_bd->props = bp; diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c new file mode 100644 index 000000000000..95da4c9ed1f1 --- /dev/null +++ b/drivers/video/backlight/hp680_bl.c @@ -0,0 +1,189 @@ +/* + * Backlight Driver for HP Jornada 680 + * + * Copyright (c) 2005 Andriy Skulysh + * + * Based on Sharp's Corgi Backlight 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. + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/device.h> +#include <linux/spinlock.h> +#include <linux/fb.h> +#include <linux/backlight.h> + +#include <asm/cpu/dac.h> +#include <asm/hp6xx/hp6xx.h> +#include <asm/hd64461/hd64461.h> + +#define HP680_MAX_INTENSITY 255 +#define HP680_DEFAULT_INTENSITY 10 + +static int hp680bl_powermode = FB_BLANK_UNBLANK; +static int current_intensity = 0; +static spinlock_t bl_lock = SPIN_LOCK_UNLOCKED; + +static void hp680bl_send_intensity(int intensity) +{ + unsigned long flags; + + if (hp680bl_powermode != FB_BLANK_UNBLANK) + intensity = 0; + + spin_lock_irqsave(&bl_lock, flags); + sh_dac_output(255-(u8)intensity, DAC_LCD_BRIGHTNESS); + spin_unlock_irqrestore(&bl_lock, flags); +} + +static void hp680bl_blank(int blank) +{ + u16 v; + + switch(blank) { + + case FB_BLANK_NORMAL: + case FB_BLANK_VSYNC_SUSPEND: + case FB_BLANK_HSYNC_SUSPEND: + case FB_BLANK_POWERDOWN: + if (hp680bl_powermode == FB_BLANK_UNBLANK) { + hp680bl_send_intensity(0); + hp680bl_powermode = blank; + sh_dac_disable(DAC_LCD_BRIGHTNESS); + v = inw(HD64461_GPBDR); + v |= HD64461_GPBDR_LCDOFF; + outw(v, HD64461_GPBDR); + } + break; + case FB_BLANK_UNBLANK: + if (hp680bl_powermode != FB_BLANK_UNBLANK) { + sh_dac_enable(DAC_LCD_BRIGHTNESS); + v = inw(HD64461_GPBDR); + v &= ~HD64461_GPBDR_LCDOFF; + outw(v, HD64461_GPBDR); + hp680bl_powermode = blank; + hp680bl_send_intensity(current_intensity); + } + break; + } +} + +#ifdef CONFIG_PM +static int hp680bl_suspend(struct device *dev, pm_message_t state, u32 level) +{ + if (level == SUSPEND_POWER_DOWN) + hp680bl_blank(FB_BLANK_POWERDOWN); + return 0; +} + +static int hp680bl_resume(struct device *dev, u32 level) +{ + if (level == RESUME_POWER_ON) + hp680bl_blank(FB_BLANK_UNBLANK); + return 0; +} +#else +#define hp680bl_suspend NULL +#define hp680bl_resume NULL +#endif + + +static int hp680bl_set_power(struct backlight_device *bd, int state) +{ + hp680bl_blank(state); + return 0; +} + +static int hp680bl_get_power(struct backlight_device *bd) +{ + return hp680bl_powermode; +} + +static int hp680bl_set_intensity(struct backlight_device *bd, int intensity) +{ + if (intensity > HP680_MAX_INTENSITY) + intensity = HP680_MAX_INTENSITY; + hp680bl_send_intensity(intensity); + current_intensity = intensity; + return 0; +} + +static int hp680bl_get_intensity(struct backlight_device *bd) +{ + return current_intensity; +} + +static struct backlight_properties hp680bl_data = { + .owner = THIS_MODULE, + .get_power = hp680bl_get_power, + .set_power = hp680bl_set_power, + .max_brightness = HP680_MAX_INTENSITY, + .get_brightness = hp680bl_get_intensity, + .set_brightness = hp680bl_set_intensity, +}; + +static struct backlight_device *hp680_backlight_device; + +static int __init hp680bl_probe(struct device *dev) +{ + hp680_backlight_device = backlight_device_register ("hp680-bl", + NULL, &hp680bl_data); + if (IS_ERR (hp680_backlight_device)) + return PTR_ERR (hp680_backlight_device); + + hp680bl_set_intensity(NULL, HP680_DEFAULT_INTENSITY); + + return 0; +} + +static int hp680bl_remove(struct device *dev) +{ + backlight_device_unregister(hp680_backlight_device); + + return 0; +} + +static struct device_driver hp680bl_driver = { + .name = "hp680-bl", + .bus = &platform_bus_type, + .probe = hp680bl_probe, + .remove = hp680bl_remove, + .suspend = hp680bl_suspend, + .resume = hp680bl_resume, +}; + +static struct platform_device hp680bl_device = { + .name = "hp680-bl", + .id = -1, +}; + +static int __init hp680bl_init(void) +{ + int ret; + + ret=driver_register(&hp680bl_driver); + if (!ret) { + ret = platform_device_register(&hp680bl_device); + if (ret) + driver_unregister(&hp680bl_driver); + } + return ret; +} + +static void __exit hp680bl_exit(void) +{ + platform_device_unregister(&hp680bl_device); + driver_unregister(&hp680bl_driver); +} + +module_init(hp680bl_init); +module_exit(hp680bl_exit); + +MODULE_AUTHOR("Andriy Skulysh <askulysh@image.kiev.ua>"); +MODULE_DESCRIPTION("HP Jornada 680 Backlight Driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 68c690605aa7..86908a60c630 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -13,7 +13,6 @@ #include <linux/ctype.h> #include <linux/err.h> #include <linux/fb.h> -#include <asm/bug.h> static ssize_t lcd_show_power(struct class_device *cdev, char *buf) { @@ -172,7 +171,7 @@ struct lcd_device *lcd_device_register(const char *name, void *devdata, new_ld = kmalloc(sizeof(struct lcd_device), GFP_KERNEL); if (unlikely(!new_ld)) - return ERR_PTR(ENOMEM); + return ERR_PTR(-ENOMEM); init_MUTEX(&new_ld->sem); new_ld->props = lp; diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c index a7bcd17112c0..0339f5640a78 100644 --- a/drivers/video/console/sticore.c +++ b/drivers/video/console/sticore.c @@ -30,10 +30,11 @@ #define STI_DRIVERVERSION "Version 0.9a" -struct sti_struct *default_sti; +struct sti_struct *default_sti __read_mostly; -static int num_sti_roms; /* # of STI ROMS found */ -static struct sti_struct *sti_roms[MAX_STI_ROMS]; /* ptr to each sti_struct */ +/* number of STI ROMS found and their ptrs to each struct */ +static int num_sti_roms __read_mostly; +static struct sti_struct *sti_roms[MAX_STI_ROMS] __read_mostly; /* The colour indices used by STI are @@ -266,7 +267,7 @@ sti_rom_copy(unsigned long base, unsigned long count, void *dest) -static char default_sti_path[21]; +static char default_sti_path[21] __read_mostly; #ifndef MODULE static int __init sti_setup(char *str) @@ -414,10 +415,10 @@ sti_init_glob_cfg(struct sti_struct *sti, if (!sti->sti_mem_request) sti->sti_mem_request = 256; /* STI default */ - glob_cfg = kmalloc(sizeof(*sti->glob_cfg), GFP_KERNEL); - glob_cfg_ext = kmalloc(sizeof(*glob_cfg_ext), GFP_KERNEL); - save_addr = kmalloc(save_addr_size, GFP_KERNEL); - sti_mem_addr = kmalloc(sti->sti_mem_request, GFP_KERNEL); + glob_cfg = kzalloc(sizeof(*sti->glob_cfg), GFP_KERNEL); + glob_cfg_ext = kzalloc(sizeof(*glob_cfg_ext), GFP_KERNEL); + save_addr = kzalloc(save_addr_size, GFP_KERNEL); + sti_mem_addr = kzalloc(sti->sti_mem_request, GFP_KERNEL); if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) { kfree(glob_cfg); @@ -427,11 +428,6 @@ sti_init_glob_cfg(struct sti_struct *sti, return -ENOMEM; } - memset(glob_cfg, 0, sizeof(*glob_cfg)); - memset(glob_cfg_ext, 0, sizeof(*glob_cfg_ext)); - memset(save_addr, 0, save_addr_size); - memset(sti_mem_addr, 0, sti->sti_mem_request); - glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext); glob_cfg->save_addr = STI_PTR(save_addr); for (i=0; i<8; i++) { @@ -502,9 +498,9 @@ sti_init_glob_cfg(struct sti_struct *sti, #ifdef CONFIG_FB struct sti_cooked_font * __init -sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name ) +sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) { - struct font_desc *fbfont; + const struct font_desc *fbfont; unsigned int size, bpc; void *dest; struct sti_rom_font *nf; @@ -525,10 +521,9 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name ) size = bpc * 256; size += sizeof(struct sti_rom_font); - nf = kmalloc(size, GFP_KERNEL); + nf = kzalloc(size, GFP_KERNEL); if (!nf) return NULL; - memset(nf, 0, size); nf->first_char = 0; nf->last_char = 255; @@ -544,7 +539,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name ) dest += sizeof(struct sti_rom_font); memcpy(dest, fbfont->data, bpc*256); - cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); + cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); if (!cooked_font) { kfree(nf); return NULL; @@ -559,7 +554,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name ) } #else struct sti_cooked_font * __init -sti_select_fbfont(struct sti_cooked_rom *cooked_rom, char *fbfont_name) +sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) { return NULL; } @@ -617,7 +612,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom, struct sti_rom_font *raw_font, *font_start; struct sti_cooked_font *cooked_font; - cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); + cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); if (!cooked_font) return 0; @@ -631,7 +626,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom, while (raw_font->next_font) { raw_font = ((void *)font_start) + (raw_font->next_font); - cooked_font->next_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); + cooked_font->next_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL); if (!cooked_font->next_font) return 1; @@ -668,10 +663,9 @@ sti_bmode_font_raw(struct sti_cooked_font *f) unsigned char *n, *p, *q; int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); - n = kmalloc (4*size, GFP_KERNEL); + n = kzalloc (4*size, GFP_KERNEL); if (!n) return NULL; - memset (n, 0, 4*size); p = n + 3; q = (unsigned char *)f->raw; while (size--) { @@ -816,13 +810,12 @@ sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd return NULL; } - sti = kmalloc(sizeof(*sti), GFP_KERNEL); + sti = kzalloc(sizeof(*sti), GFP_KERNEL); if (!sti) { printk(KERN_ERR "Not enough memory !\n"); return NULL; } - memset(sti, 0, sizeof(*sti)); spin_lock_init(&sti->lock); test_rom: @@ -1035,7 +1028,7 @@ static struct parisc_driver pa_sti_driver = { * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[] */ -static int sticore_initialized; +static int sticore_initialized __read_mostly; static void __init sti_init_roms(void) { diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 12d9329d1408..5a86978537d2 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -509,57 +509,60 @@ static int vgacon_doresize(struct vc_data *c, { unsigned long flags; unsigned int scanlines = height * c->vc_font.height; - u8 scanlines_lo, r7, vsync_end, mode, max_scan; + u8 scanlines_lo = 0, r7 = 0, vsync_end = 0, mode, max_scan; spin_lock_irqsave(&vga_lock, flags); - outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg); - max_scan = inb_p(vga_video_port_val); - - if (max_scan & 0x80) - scanlines <<= 1; - vgacon_xres = width * VGA_FONTWIDTH; vgacon_yres = height * c->vc_font.height; - outb_p(VGA_CRTC_MODE, vga_video_port_reg); - mode = inb_p(vga_video_port_val); + if (vga_video_type >= VIDEO_TYPE_VGAC) { + outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg); + max_scan = inb_p(vga_video_port_val); - if (mode & 0x04) - scanlines >>= 1; + if (max_scan & 0x80) + scanlines <<= 1; - scanlines -= 1; - scanlines_lo = scanlines & 0xff; + outb_p(VGA_CRTC_MODE, vga_video_port_reg); + mode = inb_p(vga_video_port_val); - outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); - r7 = inb_p(vga_video_port_val) & ~0x42; + if (mode & 0x04) + scanlines >>= 1; - if (scanlines & 0x100) - r7 |= 0x02; - if (scanlines & 0x200) - r7 |= 0x40; + scanlines -= 1; + scanlines_lo = scanlines & 0xff; - /* deprotect registers */ - outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); - vsync_end = inb_p(vga_video_port_val); - outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); - outb_p(vsync_end & ~0x80, vga_video_port_val); + outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); + r7 = inb_p(vga_video_port_val) & ~0x42; + + if (scanlines & 0x100) + r7 |= 0x02; + if (scanlines & 0x200) + r7 |= 0x40; + + /* deprotect registers */ + outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); + vsync_end = inb_p(vga_video_port_val); + outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); + outb_p(vsync_end & ~0x80, vga_video_port_val); + } outb_p(VGA_CRTC_H_DISP, vga_video_port_reg); outb_p(width - 1, vga_video_port_val); outb_p(VGA_CRTC_OFFSET, vga_video_port_reg); outb_p(width >> 1, vga_video_port_val); - outb_p(VGA_CRTC_V_DISP_END, vga_video_port_reg); - outb_p(scanlines_lo, vga_video_port_val); - outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); - outb_p(r7,vga_video_port_val); + if (vga_video_type >= VIDEO_TYPE_VGAC) { + outb_p(VGA_CRTC_V_DISP_END, vga_video_port_reg); + outb_p(scanlines_lo, vga_video_port_val); + outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); + outb_p(r7,vga_video_port_val); - /* reprotect registers */ - outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); - outb_p(vsync_end, vga_video_port_val); + /* reprotect registers */ + outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); + outb_p(vsync_end, vga_video_port_val); + } spin_unlock_irqrestore(&vga_lock, flags); - return 0; } diff --git a/drivers/video/cyblafb.c b/drivers/video/cyblafb.c index 2b972461a030..0ae0a97b0fed 100644 --- a/drivers/video/cyblafb.c +++ b/drivers/video/cyblafb.c @@ -1665,7 +1665,6 @@ static int __devinit cyblafb_init(void) } #endif output("CyblaFB version %s initializing\n", VERSION); - return pci_module_init(&cyblafb_pci_driver); return pci_register_driver(&cyblafb_pci_driver); } diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index d2dede6ed3e5..996c7b58564e 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1550,6 +1550,7 @@ int fb_get_options(char *name, char **option) return retval; } +#ifndef MODULE /** * video_setup - process command line options * @options: string of options @@ -1593,6 +1594,7 @@ static int __init video_setup(char *options) return 0; } __setup("video=", video_setup); +#endif /* * Visible symbols for modules diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index 38d22729b129..5e25b9860196 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c @@ -656,12 +656,15 @@ static int gbefb_set_par(struct fb_info *info) switch (bytesPerPixel) { case 1: SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_I8); + info->fix.visual = FB_VISUAL_PSEUDOCOLOR; break; case 2: SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_ARGB5); + info->fix.visual = FB_VISUAL_TRUECOLOR; break; case 4: SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_RGB8); + info->fix.visual = FB_VISUAL_TRUECOLOR; break; } SET_GBE_FIELD(WID, BUF, val, GBE_BMODE_BOTH); @@ -1243,7 +1246,7 @@ static int __devexit gbefb_remove(struct platform_device* p_dev) (void *)gbe_tiles.cpu, gbe_tiles.dma); release_mem_region(GBE_BASE, sizeof(struct sgi_gbe)); iounmap(gbe); - gbefb_remove_sysfs(dev); + gbefb_remove_sysfs(&p_dev->dev); framebuffer_release(info); return 0; diff --git a/drivers/video/i810/i810-i2c.c b/drivers/video/i810/i810-i2c.c index bd410e06db73..e3c8b5f1ca76 100644 --- a/drivers/video/i810/i810-i2c.c +++ b/drivers/video/i810/i810-i2c.c @@ -191,11 +191,11 @@ int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid, int conn) u8 *edid = NULL; int i; - DPRINTK("i810-i2c: Probe DDC%i Bus\n", conn); - if (conn < 4) { + DPRINTK("i810-i2c: Probe DDC%i Bus\n", conn+1); + if (conn < par->ddc_num) { for (i = 0; i < 3; i++) { /* Do the real work */ - edid = i810_do_probe_i2c_edid(&par->chan[conn-1]); + edid = i810_do_probe_i2c_edid(&par->chan[conn]); if (edid) break; } diff --git a/drivers/video/i810/i810.h b/drivers/video/i810/i810.h index 6c187d5fe951..579195c2bea3 100644 --- a/drivers/video/i810/i810.h +++ b/drivers/video/i810/i810.h @@ -280,6 +280,7 @@ struct i810fb_par { u32 blit_bpp; u32 ovract; u32 cur_state; + u32 ddc_num; int mtrr_reg; u16 bltcntl; u8 interlace; diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 266d0ab92663..d8467c03b49f 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c @@ -149,6 +149,7 @@ static int vyres __devinitdata; static int sync __devinitdata; static int extvga __devinitdata; static int dcolor __devinitdata; +static int ddc3 __devinitdata = 2; /*------------------------------------------------------------*/ @@ -1763,6 +1764,8 @@ static void __devinit i810_init_defaults(struct i810fb_par *par, if (sync) par->dev_flags |= ALWAYS_SYNC; + par->ddc_num = ddc3; + if (bpp < 8) bpp = 8; @@ -1885,7 +1888,7 @@ static void __devinit i810fb_find_init_mode(struct fb_info *info) int found = 0; #ifdef CONFIG_FB_I810_I2C int i; - int err; + int err = 1; struct i810fb_par *par = info->par; #endif @@ -1895,8 +1898,8 @@ static void __devinit i810fb_find_init_mode(struct fb_info *info) #ifdef CONFIG_FB_I810_I2C i810_create_i2c_busses(par); - for (i = 0; i < 4; i++) { - err = i810_probe_i2c_connector(info, &par->edid, i+1); + for (i = 0; i < par->ddc_num + 1; i++) { + err = i810_probe_i2c_connector(info, &par->edid, i); if (!err) break; } @@ -1983,6 +1986,8 @@ static int __devinit i810fb_setup(char *options) vsync2 = simple_strtoul(this_opt+7, NULL, 0); else if (!strncmp(this_opt, "dcolor", 6)) dcolor = 1; + else if (!strncmp(this_opt, "ddc3", 4)) + ddc3 = 3; else mode_option = this_opt; } @@ -2190,6 +2195,8 @@ MODULE_PARM_DESC(sync, "wait for accel engine to finish drawing" module_param(dcolor, bool, 0); MODULE_PARM_DESC(dcolor, "use DirectColor visuals" " (default = 0 = TrueColor)"); +module_param(ddc3, bool, 0); +MODULE_PARM_DESC(ddc3, "Probe DDC bus 3 (default = 0 = no)"); module_param(mode_option, charp, 0); MODULE_PARM_DESC(mode_option, "Specify initial video mode"); diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index ad416ae47596..7db42542eb19 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c @@ -1510,6 +1510,8 @@ imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) default: printk(KERN_INFO "imsttfb: Device 0x%x unknown, " "contact maintainer.\n", pdev->device); + release_mem_region(addr, size); + framebuffer_release(info); return -ENODEV; } diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 6b8bd3cdf9c0..995b47c165a7 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c @@ -1333,33 +1333,35 @@ intelfb_setcolreg(unsigned regno, unsigned red, unsigned green, if (regno > 255) return 1; - switch (dinfo->depth) { - case 8: - { - red >>= 8; - green >>= 8; - blue >>= 8; + if (dinfo->depth == 8) { + red >>= 8; + green >>= 8; + blue >>= 8; + + intelfbhw_setcolreg(dinfo, regno, red, green, blue, + transp); + } - intelfbhw_setcolreg(dinfo, regno, red, green, blue, - transp); + if (regno < 16) { + switch (dinfo->depth) { + case 15: + dinfo->pseudo_palette[regno] = ((red & 0xf800) >> 1) | + ((green & 0xf800) >> 6) | + ((blue & 0xf800) >> 11); + break; + case 16: + dinfo->pseudo_palette[regno] = (red & 0xf800) | + ((green & 0xfc00) >> 5) | + ((blue & 0xf800) >> 11); + break; + case 24: + dinfo->pseudo_palette[regno] = ((red & 0xff00) << 8) | + (green & 0xff00) | + ((blue & 0xff00) >> 8); + break; } - break; - case 15: - dinfo->pseudo_palette[regno] = ((red & 0xf800) >> 1) | - ((green & 0xf800) >> 6) | - ((blue & 0xf800) >> 11); - break; - case 16: - dinfo->pseudo_palette[regno] = (red & 0xf800) | - ((green & 0xfc00) >> 5) | - ((blue & 0xf800) >> 11); - break; - case 24: - dinfo->pseudo_palette[regno] = ((red & 0xff00) << 8) | - (green & 0xff00) | - ((blue & 0xff00) >> 8); - break; } + return 0; } diff --git a/drivers/video/kyro/STG4000VTG.c b/drivers/video/kyro/STG4000VTG.c index 3690b04190af..bd389709d234 100644 --- a/drivers/video/kyro/STG4000VTG.c +++ b/drivers/video/kyro/STG4000VTG.c @@ -17,7 +17,7 @@ void DisableVGA(volatile STG4000REG __iomem *pSTGReg) { u32 tmp; - volatile u32 count, i; + volatile u32 count = 0, i; /* Reset the VGA registers */ tmp = STG_READ_REG(SoftwareReset); diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 747602aa5615..b961d5601bd9 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c @@ -486,10 +486,8 @@ static void vgaHWRestore(const struct fb_info *info, static inline int neo2200_sync(struct fb_info *info) { struct neofb_par *par = info->par; - int waitcycles; - while (readl(&par->neo2200->bltStat) & 1) - waitcycles++; + while (readl(&par->neo2200->bltStat) & 1); return 0; } @@ -843,6 +841,9 @@ static int neofb_set_par(struct fb_info *info) par->SysIfaceCntl2 = 0xc0; /* VESA Bios sets this to 0x80! */ + /* Initialize: by default, we want display config register to be read */ + par->PanelDispCntlRegRead = 1; + /* Enable any user specified display devices. */ par->PanelDispCntlReg1 = 0x00; if (par->internal_display) @@ -1334,6 +1335,18 @@ static int neofb_blank(int blank_mode, struct fb_info *info) struct neofb_par *par = info->par; int seqflags, lcdflags, dpmsflags, reg; + + /* + * Reload the value stored in the register, if sensible. It might have + * been changed via FN keystroke. + */ + if (par->PanelDispCntlRegRead) { + neoUnlock(); + par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03; + neoLock(&par->state); + } + par->PanelDispCntlRegRead = !blank_mode; + switch (blank_mode) { case FB_BLANK_POWERDOWN: /* powerdown - both sync lines down */ seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */ @@ -1366,7 +1379,7 @@ static int neofb_blank(int blank_mode, struct fb_info *info) case FB_BLANK_NORMAL: /* just blank screen (backlight stays on) */ seqflags = VGA_SR01_SCREEN_OFF; /* Disable sequencer */ lcdflags = par->PanelDispCntlReg1 & 0x02; /* LCD normal */ - dpmsflags = 0; /* no hsync/vsync suppression */ + dpmsflags = 0x00; /* no hsync/vsync suppression */ break; case FB_BLANK_UNBLANK: /* unblank */ seqflags = 0; /* Enable sequencer */ diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index dbcb8962e57d..a7c4e5e8ead6 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c @@ -138,6 +138,8 @@ static struct pci_device_id nvidiafb_pci_tbl[] = { PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_4000, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO, diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c index f3927b6cda9d..f5361cd8ccce 100644 --- a/drivers/video/pmag-ba-fb.c +++ b/drivers/video/pmag-ba-fb.c @@ -30,7 +30,6 @@ #include <linux/module.h> #include <linux/types.h> -#include <asm/bug.h> #include <asm/io.h> #include <asm/system.h> diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c index 25148de5fe67..eeeac924b500 100644 --- a/drivers/video/pmagb-b-fb.c +++ b/drivers/video/pmagb-b-fb.c @@ -27,7 +27,6 @@ #include <linux/module.h> #include <linux/types.h> -#include <asm/bug.h> #include <asm/io.h> #include <asm/system.h> diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c index e5d0f92eeae3..feec47bdd479 100644 --- a/drivers/video/s1d13xxxfb.c +++ b/drivers/video/s1d13xxxfb.c @@ -588,6 +588,7 @@ s1d13xxxfb_probe(struct platform_device *pdev) goto bail; } + platform_set_drvdata(pdev, info); default_par = info->par; default_par->regs = ioremap_nocache(pdev->resource[1].start, pdev->resource[1].end - pdev->resource[1].start +1); @@ -638,8 +639,6 @@ s1d13xxxfb_probe(struct platform_device *pdev) goto bail; } - platform_set_drvdata(pdev, info); - printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index d574dd3c9c8a..9451932fbaf2 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -82,7 +82,6 @@ #include <linux/fb.h> #include <linux/init.h> #include <linux/dma-mapping.h> -#include <linux/string.h> #include <linux/interrupt.h> #include <linux/workqueue.h> #include <linux/wait.h> diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index ab727eaa7f43..10e6b3aab9ea 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c @@ -2021,8 +2021,8 @@ static int __devinit savagefb_probe (struct pci_dev* dev, #if defined(CONFIG_FB_SAVAGE_I2C) savagefb_create_i2c_busses(info); savagefb_probe_i2c_connector(info, &par->edid); - kfree(par->edid); fb_edid_to_monspecs(par->edid, &info->monspecs); + kfree(par->edid); fb_videomode_to_modelist(info->monspecs.modedb, info->monspecs.modedb_len, &info->modelist); diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index 3e7baf4c9fa8..5e5328d682db 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c @@ -786,28 +786,32 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, if (regno >= info->cmap.len || regno > 255) return 1; switch (info->fix.visual) { - case FB_VISUAL_PSEUDOCOLOR: - rgbcol =(((u32)red & 0xff00) << 8) | - (((u32)green & 0xff00) << 0) | - (((u32)blue & 0xff00) >> 8); - do_setpalentry(par, regno, rgbcol); - break; - /* Truecolor has no hardware color palettes. */ - case FB_VISUAL_TRUECOLOR: + case FB_VISUAL_PSEUDOCOLOR: + rgbcol =(((u32)red & 0xff00) << 8) | + (((u32)green & 0xff00) << 0) | + (((u32)blue & 0xff00) >> 8); + do_setpalentry(par, regno, rgbcol); + break; + /* Truecolor has no hardware color palettes. */ + case FB_VISUAL_TRUECOLOR: + if (regno < 16) { rgbcol = (CNVT_TOHW( red, info->var.red.length) << info->var.red.offset) | - (CNVT_TOHW( green, info->var.green.length) << - info->var.green.offset) | - (CNVT_TOHW( blue, info->var.blue.length) << - info->var.blue.offset) | - (CNVT_TOHW( transp, info->var.transp.length) << - info->var.transp.offset); - par->palette[regno] = rgbcol; - break; - default: - DPRINTK("bad depth %u\n", info->var.bits_per_pixel); - break; + (CNVT_TOHW( green, info->var.green.length) << + info->var.green.offset) | + (CNVT_TOHW( blue, info->var.blue.length) << + info->var.blue.offset) | + (CNVT_TOHW( transp, info->var.transp.length) << + info->var.transp.offset); + par->palette[regno] = rgbcol; + } + + break; + default: + DPRINTK("bad depth %u\n", info->var.bits_per_pixel); + break; } + return 0; } |