diff options
Diffstat (limited to 'drivers/video')
37 files changed, 235 insertions, 840 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 0217f7415ef5..20c33c42600a 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -979,18 +979,6 @@ config FB_PVR2 (<file:drivers/video/pvr2fb.c>). Please see the file <file:Documentation/fb/pvr2fb.txt>. -config FB_EPSON1355 - bool "Epson 1355 framebuffer support" - depends on (FB = y) && ARCH_CEIVA - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - help - Build in support for the SED1355 Epson Research Embedded RAMDAC - LCD/CRT Controller (since redesignated as the S1D13505) as a - framebuffer. Product specs at - <http://vdc.epson.com/>. - config FB_S1D13XXX tristate "Epson S1D13XXX framebuffer support" depends on FB @@ -1788,7 +1776,7 @@ config FB_AU1200 config FB_VT8500 bool "VT8500 LCD Driver" - depends on (FB = y) && ARM && ARCH_VT8500 && VTWM_VERSION_VT8500 + depends on (FB = y) && ARM && ARCH_VT8500 select FB_WMT_GE_ROPS select FB_SYS_IMAGEBLIT help @@ -1797,11 +1785,11 @@ config FB_VT8500 config FB_WM8505 bool "WM8505 frame buffer support" - depends on (FB = y) && ARM && ARCH_VT8500 && VTWM_VERSION_WM8505 + depends on (FB = y) && ARM && ARCH_VT8500 select FB_WMT_GE_ROPS select FB_SYS_IMAGEBLIT help - This is the framebuffer driver for WonderMedia WM8505 + This is the framebuffer driver for WonderMedia WM8505/WM8650 integrated LCD controller. source "drivers/video/geode/Kconfig" diff --git a/drivers/video/Makefile b/drivers/video/Makefile index ee8dafb69e36..194035986af2 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -94,7 +94,6 @@ obj-$(CONFIG_FB_G364) += g364fb.o obj-$(CONFIG_FB_EP93XX) += ep93xx-fb.o obj-$(CONFIG_FB_SA1100) += sa1100fb.o obj-$(CONFIG_FB_HIT) += hitfb.o -obj-$(CONFIG_FB_EPSON1355) += epson1355fb.o obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o obj-$(CONFIG_FB_VOODOO1) += sstfb.o diff --git a/drivers/video/auo_k190x.c b/drivers/video/auo_k190x.c index 77da6a2f43dc..c03ecdd31e4c 100644 --- a/drivers/video/auo_k190x.c +++ b/drivers/video/auo_k190x.c @@ -987,7 +987,6 @@ err_regfb: fb_dealloc_cmap(&info->cmap); err_cmap: fb_deferred_io_cleanup(info); - kfree(info->fbdefio); err_defio: vfree((void *)info->screen_base); err_irq: @@ -1022,7 +1021,6 @@ int __devexit auok190x_common_remove(struct platform_device *pdev) fb_dealloc_cmap(&info->cmap); fb_deferred_io_cleanup(info); - kfree(info->fbdefio); vfree((void *)info->screen_base); diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c index bfdc5fbeaa11..9a046a4c98f5 100644 --- a/drivers/video/backlight/omap1_bl.c +++ b/drivers/video/backlight/omap1_bl.c @@ -27,10 +27,10 @@ #include <linux/fb.h> #include <linux/backlight.h> #include <linux/slab.h> +#include <linux/platform_data/omap1_bl.h> #include <mach/hardware.h> -#include <plat/board.h> -#include <plat/mux.h> +#include <mach/mux.h> #define OMAPBL_MAX_INTENSITY 0xff diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c index 28b1a834906b..61b182bf32a2 100644 --- a/drivers/video/console/bitblit.c +++ b/drivers/video/console/bitblit.c @@ -162,7 +162,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info, image.depth = 1; if (attribute) { - buf = kmalloc(cellsize, GFP_KERNEL); + buf = kmalloc(cellsize, GFP_ATOMIC); if (!buf) return; } diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 2e471c22abf5..fdefa8fd72c4 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -372,8 +372,15 @@ static void fb_flashcursor(struct work_struct *work) struct vc_data *vc = NULL; int c; int mode; + int ret; + + /* FIXME: we should sort out the unbind locking instead */ + /* instead we just fail to flash the cursor if we can't get + * the lock instead of blocking fbcon deinit */ + ret = console_trylock(); + if (ret == 0) + return; - console_lock(); if (ops && ops->currcon != -1) vc = vc_cons[ops->currcon].d; @@ -442,7 +449,7 @@ static int __init fb_console_setup(char *this_opt) while ((options = strsep(&this_opt, ",")) != NULL) { if (!strncmp(options, "font:", 5)) - strcpy(fontname, options + 5); + strlcpy(fontname, options + 5, sizeof(fontname)); if (!strncmp(options, "scrollback:", 11)) { options += 11; diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 7ae9d53f2bf1..113d43a16f54 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c @@ -131,7 +131,7 @@ #define UPPER_MARGIN 32 #define LOWER_MARGIN 32 -static resource_size_t da8xx_fb_reg_base; +static void __iomem *da8xx_fb_reg_base; static struct resource *lcdc_regs; static unsigned int lcd_revision; static irq_handler_t lcdc_irq_handler; @@ -951,7 +951,7 @@ static int __devexit fb_remove(struct platform_device *dev) clk_disable(par->lcdc_clk); clk_put(par->lcdc_clk); framebuffer_release(info); - iounmap((void __iomem *)da8xx_fb_reg_base); + iounmap(da8xx_fb_reg_base); release_mem_region(lcdc_regs->start, resource_size(lcdc_regs)); } @@ -1171,7 +1171,7 @@ static int __devinit fb_probe(struct platform_device *device) if (!lcdc_regs) return -EBUSY; - da8xx_fb_reg_base = (resource_size_t)ioremap(lcdc_regs->start, len); + da8xx_fb_reg_base = ioremap(lcdc_regs->start, len); if (!da8xx_fb_reg_base) { ret = -EBUSY; goto err_request_mem; @@ -1392,7 +1392,7 @@ err_clk_put: clk_put(fb_clk); err_ioremap: - iounmap((void __iomem *)da8xx_fb_reg_base); + iounmap(da8xx_fb_reg_base); err_request_mem: release_mem_region(lcdc_regs->start, len); diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index b4a632ada401..932abaa58a89 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c @@ -553,7 +553,9 @@ static int __init efifb_init(void) int ret; char *option = NULL; - dmi_check_system(dmi_system_table); + if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI || + !(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS)) + dmi_check_system(dmi_system_table); if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) return -ENODEV; diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c index 345d96230978..f2c092da84b0 100644 --- a/drivers/video/ep93xx-fb.c +++ b/drivers/video/ep93xx-fb.c @@ -24,7 +24,7 @@ #include <linux/clk.h> #include <linux/fb.h> -#include <mach/fb.h> +#include <linux/platform_data/video-ep93xx.h> /* Vertical Frame Timing Registers */ #define EP93XXFB_VLINES_TOTAL 0x0000 /* SW locked */ diff --git a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c deleted file mode 100644 index 68b9b511ce80..000000000000 --- a/drivers/video/epson1355fb.c +++ /dev/null @@ -1,749 +0,0 @@ -/* - * linux/drivers/video/epson1355fb.c -- Epson S1D13505 frame buffer for 2.5. - * - * Epson Research S1D13505 Embedded RAMDAC LCD/CRT Controller - * (previously known as SED1355) - * - * Cf. http://vdc.epson.com/ - * - * - * Copyright (C) Hewlett-Packard Company. All rights reserved. - * - * Written by Christopher Hoover <ch@hpl.hp.com> - * - * Adapted from: - * - * linux/drivers/video/skeletonfb.c - * Modified to new api Jan 2001 by James Simmons (jsimmons@infradead.org) - * Created 28 Dec 1997 by Geert Uytterhoeven - * - * linux/drivers/video/epson1355fb.c (2.4 driver) - * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> - * - * 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. - * - * - * Noteworthy Issues - * ----------------- - * - * This driver is complicated by the fact that this is a 16-bit chip - * and, on at least one platform (ceiva), we can only do 16-bit reads - * and writes to the framebuffer. We hide this from user space - * except in the case of mmap(). - * - * - * To Do - * ----- - * - * - Test 8-bit pseudocolor mode - * - Allow setting bpp, virtual resolution - * - Implement horizontal panning - * - (maybe) Implement hardware cursor - */ - -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/string.h> -#include <linux/mm.h> -#include <linux/delay.h> -#include <linux/fb.h> -#include <linux/init.h> -#include <linux/ioport.h> -#include <linux/platform_device.h> - -#include <asm/types.h> -#include <asm/io.h> -#include <linux/uaccess.h> - -#include <video/epson1355.h> - -struct epson1355_par { - unsigned long reg_addr; - u32 pseudo_palette[16]; -}; - -/* ------------------------------------------------------------------------- */ - -#if defined(CONFIG_ARM) - -# ifdef CONFIG_ARCH_CEIVA -# include <mach/hardware.h> -# define EPSON1355FB_BASE_PHYS (CEIVA_PHYS_SED1355) -# endif - -static inline u8 epson1355_read_reg(struct epson1355_par *par, int index) -{ - return __raw_readb(par->reg_addr + index); -} - -static inline void epson1355_write_reg(struct epson1355_par *par, u8 data, int index) -{ - __raw_writeb(data, par->reg_addr + index); -} - -#else -# error "no architecture-specific epson1355_{read,write}_reg" -#endif - -#ifndef EPSON1355FB_BASE_PHYS -# error "EPSON1355FB_BASE_PHYS is not defined" -#endif - -#define EPSON1355FB_REGS_OFS (0) -#define EPSON1355FB_REGS_PHYS (EPSON1355FB_BASE_PHYS + EPSON1355FB_REGS_OFS) -#define EPSON1355FB_REGS_LEN (64) - -#define EPSON1355FB_FB_OFS (0x00200000) -#define EPSON1355FB_FB_PHYS (EPSON1355FB_BASE_PHYS + EPSON1355FB_FB_OFS) -#define EPSON1355FB_FB_LEN (2 * 1024 * 1024) - -/* ------------------------------------------------------------------------- */ - -static inline u16 epson1355_read_reg16(struct epson1355_par *par, int index) -{ - u8 lo = epson1355_read_reg(par, index); - u8 hi = epson1355_read_reg(par, index + 1); - - return (hi << 8) | lo; -} - -static inline void epson1355_write_reg16(struct epson1355_par *par, u16 data, int index) -{ - u8 lo = data & 0xff; - u8 hi = (data >> 8) & 0xff; - - epson1355_write_reg(par, lo, index); - epson1355_write_reg(par, hi, index + 1); -} - -static inline u32 epson1355_read_reg20(struct epson1355_par *par, int index) -{ - u8 b0 = epson1355_read_reg(par, index); - u8 b1 = epson1355_read_reg(par, index + 1); - u8 b2 = epson1355_read_reg(par, index + 2); - - return (b2 & 0x0f) << 16 | (b1 << 8) | b0; -} - -static inline void epson1355_write_reg20(struct epson1355_par *par, u32 data, int index) -{ - u8 b0 = data & 0xff; - u8 b1 = (data >> 8) & 0xff; - u8 b2 = (data >> 16) & 0x0f; - - epson1355_write_reg(par, b0, index); - epson1355_write_reg(par, b1, index + 1); - epson1355_write_reg(par, b2, index + 2); -} - -/* ------------------------------------------------------------------------- */ - -static void set_lut(struct epson1355_par *par, u8 index, u8 r, u8 g, u8 b) -{ - epson1355_write_reg(par, index, REG_LUT_ADDR); - epson1355_write_reg(par, r, REG_LUT_DATA); - epson1355_write_reg(par, g, REG_LUT_DATA); - epson1355_write_reg(par, b, REG_LUT_DATA); -} - - -/** - * epson1355fb_setcolreg - sets a color register. - * @regno: Which register in the CLUT we are programming - * @red: The red value which can be up to 16 bits wide - * @green: The green value which can be up to 16 bits wide - * @blue: The blue value which can be up to 16 bits wide. - * @transp: If supported the alpha value which can be up to 16 bits wide. - * @info: frame buffer info structure - * - * Returns negative errno on error, or zero on success. - */ -static int epson1355fb_setcolreg(unsigned regno, unsigned r, unsigned g, - unsigned b, unsigned transp, - struct fb_info *info) -{ - struct epson1355_par *par = info->par; - - if (info->var.grayscale) - r = g = b = (19595 * r + 38470 * g + 7471 * b) >> 16; - - switch (info->fix.visual) { - case FB_VISUAL_TRUECOLOR: - if (regno >= 16) - return -EINVAL; - - ((u32 *) info->pseudo_palette)[regno] = - (r & 0xf800) | (g & 0xfc00) >> 5 | (b & 0xf800) >> 11; - - break; - case FB_VISUAL_PSEUDOCOLOR: - if (regno >= 256) - return -EINVAL; - - set_lut(par, regno, r >> 8, g >> 8, b >> 8); - - break; - default: - return -ENOSYS; - } - return 0; -} - -/* ------------------------------------------------------------------------- */ - -/** - * epson1355fb_pan_display - Pans the display. - * @var: frame buffer variable screen structure - * @info: frame buffer structure that represents a single frame buffer - * - * Pan (or wrap, depending on the `vmode' field) the display using the - * `xoffset' and `yoffset' fields of the `var' structure. - * If the values don't fit, return -EINVAL. - * - * Returns negative errno on error, or zero on success. - */ -static int epson1355fb_pan_display(struct fb_var_screeninfo *var, - struct fb_info *info) -{ - struct epson1355_par *par = info->par; - u32 start; - - if (var->xoffset != 0) /* not yet ... */ - return -EINVAL; - - if (var->yoffset + info->var.yres > info->var.yres_virtual) - return -EINVAL; - - start = (info->fix.line_length >> 1) * var->yoffset; - - epson1355_write_reg20(par, start, REG_SCRN1_DISP_START_ADDR0); - - return 0; -} - -/* ------------------------------------------------------------------------- */ - -static void lcd_enable(struct epson1355_par *par, int enable) -{ - u8 mode = epson1355_read_reg(par, REG_DISPLAY_MODE); - - if (enable) - mode |= 1; - else - mode &= ~1; - - epson1355_write_reg(par, mode, REG_DISPLAY_MODE); -} - -#if defined(CONFIG_ARCH_CEIVA) -static void backlight_enable(int enable) -{ - /* ### this should be protected by a spinlock ... */ - u8 pddr = clps_readb(PDDR); - if (enable) - pddr |= (1 << 5); - else - pddr &= ~(1 << 5); - clps_writeb(pddr, PDDR); -} -#else -static void backlight_enable(int enable) -{ -} -#endif - - -/** - * epson1355fb_blank - blanks the display. - * @blank_mode: the blank mode we want. - * @info: frame buffer structure that represents a single frame buffer - * - * Blank the screen if blank_mode != 0, else unblank. Return 0 if - * 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. - * - */ -static int epson1355fb_blank(int blank_mode, struct fb_info *info) -{ - struct epson1355_par *par = info->par; - - switch (blank_mode) { - case FB_BLANK_UNBLANK: - case FB_BLANK_NORMAL: - lcd_enable(par, 1); - backlight_enable(1); - break; - case FB_BLANK_VSYNC_SUSPEND: - case FB_BLANK_HSYNC_SUSPEND: - backlight_enable(0); - break; - case FB_BLANK_POWERDOWN: - backlight_enable(0); - lcd_enable(par, 0); - break; - default: - return -EINVAL; - } - - /* let fbcon do a soft blank for us */ - return (blank_mode == FB_BLANK_NORMAL) ? 1 : 0; -} - -/* ------------------------------------------------------------------------- */ - -/* - * We can't use the cfb generic routines, as we have to limit - * ourselves to 16-bit or 8-bit loads and stores to this 16-bit - * chip. - */ - -static inline void epson1355fb_fb_writel(unsigned long v, unsigned long *a) -{ - u16 *p = (u16 *) a; - u16 l = v & 0xffff; - u16 h = v >> 16; - - fb_writew(l, p); - fb_writew(h, p + 1); -} - -static inline unsigned long epson1355fb_fb_readl(const unsigned long *a) -{ - const u16 *p = (u16 *) a; - u16 l = fb_readw(p); - u16 h = fb_readw(p + 1); - - return (h << 16) | l; -} - -#define FB_READL epson1355fb_fb_readl -#define FB_WRITEL epson1355fb_fb_writel - -/* ------------------------------------------------------------------------- */ - -static inline unsigned long copy_from_user16(void *to, const void *from, - unsigned long n) -{ - u16 *dst = (u16 *) to; - u16 *src = (u16 *) from; - - if (!access_ok(VERIFY_READ, from, n)) - return n; - - while (n > 1) { - u16 v; - if (__get_user(v, src)) - return n; - - fb_writew(v, dst); - - src++, dst++; - n -= 2; - } - - if (n) { - u8 v; - - if (__get_user(v, ((u8 *) src))) - return n; - - fb_writeb(v, dst); - } - return 0; -} - -static inline unsigned long copy_to_user16(void *to, const void *from, - unsigned long n) -{ - u16 *dst = (u16 *) to; - u16 *src = (u16 *) from; - - if (!access_ok(VERIFY_WRITE, to, n)) - return n; - - while (n > 1) { - u16 v = fb_readw(src); - - if (__put_user(v, dst)) - return n; - - src++, dst++; - n -= 2; - } - - if (n) { - u8 v = fb_readb(src); - - if (__put_user(v, ((u8 *) dst))) - return n; - } - return 0; -} - - -static ssize_t -epson1355fb_read(struct fb_info *info, char *buf, size_t count, loff_t * ppos) -{ - unsigned long p = *ppos; - - if (p >= info->fix.smem_len) - return 0; - if (count >= info->fix.smem_len) - count = info->fix.smem_len; - if (count + p > info->fix.smem_len) - count = info->fix.smem_len - p; - - if (count) { - char *base_addr; - - base_addr = info->screen_base; - count -= copy_to_user16(buf, base_addr + p, count); - if (!count) - return -EFAULT; - *ppos += count; - } - return count; -} - -static ssize_t -epson1355fb_write(struct fb_info *info, const char *buf, - size_t count, loff_t * ppos) -{ - unsigned long p = *ppos; - int err; - - /* from fbmem.c except for our own copy_*_user */ - if (p > info->fix.smem_len) - return -ENOSPC; - if (count >= info->fix.smem_len) - count = info->fix.smem_len; - err = 0; - if (count + p > info->fix.smem_len) { - count = info->fix.smem_len - p; - err = -ENOSPC; - } - - if (count) { - char *base_addr; - - base_addr = info->screen_base; - count -= copy_from_user16(base_addr + p, buf, count); - *ppos += count; - err = -EFAULT; - } - if (count) - return count; - return err; -} - -/* ------------------------------------------------------------------------- */ - -static struct fb_ops epson1355fb_fbops = { - .owner = THIS_MODULE, - .fb_setcolreg = epson1355fb_setcolreg, - .fb_pan_display = epson1355fb_pan_display, - .fb_blank = epson1355fb_blank, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_read = epson1355fb_read, - .fb_write = epson1355fb_write, -}; - -/* ------------------------------------------------------------------------- */ - -static __init unsigned int get_fb_size(struct fb_info *info) -{ - unsigned int size = 2 * 1024 * 1024; - char *p = info->screen_base; - - /* the 512k framebuffer is aliased at start + 0x80000 * n */ - fb_writeb(1, p); - fb_writeb(0, p + 0x80000); - if (!fb_readb(p)) - size = 512 * 1024; - - fb_writeb(0, p); - - return size; -} - -static int epson1355_width_tab[2][4] __devinitdata = - { {4, 8, 16, -1}, {9, 12, 16, -1} }; -static int epson1355_bpp_tab[8] __devinitdata = { 1, 2, 4, 8, 15, 16 }; - -static void __devinit fetch_hw_state(struct fb_info *info, struct epson1355_par *par) -{ - struct fb_var_screeninfo *var = &info->var; - struct fb_fix_screeninfo *fix = &info->fix; - u8 panel, display; - u16 offset; - u32 xres, yres; - u32 xres_virtual, yres_virtual; - int bpp, lcd_bpp; - int is_color, is_dual, is_tft; - int lcd_enabled, crt_enabled; - - fix->type = FB_TYPE_PACKED_PIXELS; - - display = epson1355_read_reg(par, REG_DISPLAY_MODE); - bpp = epson1355_bpp_tab[(display >> 2) & 7]; - - switch (bpp) { - case 8: - fix->visual = FB_VISUAL_PSEUDOCOLOR; - var->bits_per_pixel = 8; - var->red.offset = var->green.offset = var->blue.offset = 0; - var->red.length = var->green.length = var->blue.length = 8; - break; - case 16: - /* 5-6-5 RGB */ - fix->visual = FB_VISUAL_TRUECOLOR; - var->bits_per_pixel = 16; - var->red.offset = 11; - var->red.length = 5; - var->green.offset = 5; - var->green.length = 6; - var->blue.offset = 0; - var->blue.length = 5; - break; - default: - BUG(); - } - fb_alloc_cmap(&(info->cmap), 256, 0); - - panel = epson1355_read_reg(par, REG_PANEL_TYPE); - is_color = (panel & 0x04) != 0; - is_dual = (panel & 0x02) != 0; - is_tft = (panel & 0x01) != 0; - crt_enabled = (display & 0x02) != 0; - lcd_enabled = (display & 0x01) != 0; - lcd_bpp = epson1355_width_tab[is_tft][(panel >> 4) & 3]; - - xres = (epson1355_read_reg(par, REG_HORZ_DISP_WIDTH) + 1) * 8; - yres = (epson1355_read_reg16(par, REG_VERT_DISP_HEIGHT0) + 1) * - ((is_dual && !crt_enabled) ? 2 : 1); - offset = epson1355_read_reg16(par, REG_MEM_ADDR_OFFSET0) & 0x7ff; - xres_virtual = offset * 16 / bpp; - yres_virtual = fix->smem_len / (offset * 2); - - var->xres = xres; - var->yres = yres; - var->xres_virtual = xres_virtual; - var->yres_virtual = yres_virtual; - var->xoffset = var->yoffset = 0; - - fix->line_length = offset * 2; - - fix->xpanstep = 0; /* no pan yet */ - fix->ypanstep = 1; - fix->ywrapstep = 0; - fix->accel = FB_ACCEL_NONE; - - var->grayscale = !is_color; - -#ifdef DEBUG - printk(KERN_INFO - "epson1355fb: xres=%d, yres=%d, " - "is_color=%d, is_dual=%d, is_tft=%d\n", - xres, yres, is_color, is_dual, is_tft); - printk(KERN_INFO - "epson1355fb: bpp=%d, lcd_bpp=%d, " - "crt_enabled=%d, lcd_enabled=%d\n", - bpp, lcd_bpp, crt_enabled, lcd_enabled); -#endif -} - - -static void clearfb16(struct fb_info *info) -{ - u16 *dst = (u16 *) info->screen_base; - unsigned long n = info->fix.smem_len; - - while (n > 1) { - fb_writew(0, dst); - dst++, n -= 2; - } - - if (n) - fb_writeb(0, dst); -} - -static int epson1355fb_remove(struct platform_device *dev) -{ - struct fb_info *info = platform_get_drvdata(dev); - struct epson1355_par *par = info->par; - - backlight_enable(0); - if (par) { - lcd_enable(par, 0); - if (par && par->reg_addr) - iounmap((void *) par->reg_addr); - } - - if (info) { - fb_dealloc_cmap(&info->cmap); - if (info->screen_base) - iounmap(info->screen_base); - framebuffer_release(info); - } - release_mem_region(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN); - release_mem_region(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN); - return 0; -} - -static int __devinit epson1355fb_probe(struct platform_device *dev) -{ - struct epson1355_par *default_par; - struct fb_info *info; - u8 revision; - int rc = 0; - - if (!request_mem_region(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN, "S1D13505 registers")) { - printk(KERN_ERR "epson1355fb: unable to reserve " - "registers at 0x%0x\n", EPSON1355FB_REGS_PHYS); - rc = -EBUSY; - goto bail; - } - - if (!request_mem_region(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN, - "S1D13505 framebuffer")) { - printk(KERN_ERR "epson1355fb: unable to reserve " - "framebuffer at 0x%0x\n", EPSON1355FB_FB_PHYS); - rc = -EBUSY; - goto bail; - } - - info = framebuffer_alloc(sizeof(struct epson1355_par), &dev->dev); - if (!info) { - rc = -ENOMEM; - goto bail; - } - - default_par = info->par; - default_par->reg_addr = (unsigned long) ioremap(EPSON1355FB_REGS_PHYS, EPSON1355FB_REGS_LEN); - if (!default_par->reg_addr) { - printk(KERN_ERR "epson1355fb: unable to map registers\n"); - rc = -ENOMEM; - goto bail; - } - info->pseudo_palette = default_par->pseudo_palette; - - info->screen_base = ioremap(EPSON1355FB_FB_PHYS, EPSON1355FB_FB_LEN); - if (!info->screen_base) { - printk(KERN_ERR "epson1355fb: unable to map framebuffer\n"); - rc = -ENOMEM; - goto bail; - } - - revision = epson1355_read_reg(default_par, REG_REVISION_CODE); - if ((revision >> 2) != 3) { - printk(KERN_INFO "epson1355fb: epson1355 not found\n"); - rc = -ENODEV; - goto bail; - } - - info->fix.mmio_start = EPSON1355FB_REGS_PHYS; - info->fix.mmio_len = EPSON1355FB_REGS_LEN; - info->fix.smem_start = EPSON1355FB_FB_PHYS; - info->fix.smem_len = get_fb_size(info); - - printk(KERN_INFO "epson1355fb: regs mapped at 0x%lx, fb %d KiB mapped at 0x%p\n", - default_par->reg_addr, info->fix.smem_len / 1024, info->screen_base); - - strcpy(info->fix.id, "S1D13505"); - info->par = default_par; - info->fbops = &epson1355fb_fbops; - info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; - - /* we expect the boot loader to have initialized the chip - with appropriate parameters from which we can determinte - the flavor of lcd panel attached */ - fetch_hw_state(info, default_par); - - /* turn this puppy on ... */ - clearfb16(info); - backlight_enable(1); - lcd_enable(default_par, 1); - - if (register_framebuffer(info) < 0) { - rc = -EINVAL; - goto bail; - } - /* - * Our driver data. - */ - platform_set_drvdata(dev, info); - - printk(KERN_INFO "fb%d: %s frame buffer device\n", - info->node, info->fix.id); - - return 0; - - bail: - epson1355fb_remove(dev); - return rc; -} - -static struct platform_driver epson1355fb_driver = { - .probe = epson1355fb_probe, - .remove = epson1355fb_remove, - .driver = { - .name = "epson1355fb", - }, -}; - -static struct platform_device *epson1355fb_device; - -int __init epson1355fb_init(void) -{ - int ret = 0; - - if (fb_get_options("epson1355fb", NULL)) - return -ENODEV; - - ret = platform_driver_register(&epson1355fb_driver); - - if (!ret) { - epson1355fb_device = platform_device_alloc("epson1355fb", 0); - - if (epson1355fb_device) - ret = platform_device_add(epson1355fb_device); - else - ret = -ENOMEM; - - if (ret) { - platform_device_put(epson1355fb_device); - platform_driver_unregister(&epson1355fb_driver); - } - } - - return ret; -} - -module_init(epson1355fb_init); - -#ifdef MODULE -static void __exit epson1355fb_exit(void) -{ - platform_device_unregister(epson1355fb_device); - platform_driver_unregister(&epson1355fb_driver); -} - -/* ------------------------------------------------------------------------- */ - -module_exit(epson1355fb_exit); -#endif - -MODULE_AUTHOR("Christopher Hoover <ch@hpl.hp.com>"); -MODULE_DESCRIPTION("Framebuffer driver for Epson S1D13505"); -MODULE_LICENSE("GPL"); diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c index 4bc2b8a5dd8b..663c308d0e73 100644 --- a/drivers/video/exynos/exynos_mipi_dsi.c +++ b/drivers/video/exynos/exynos_mipi_dsi.c @@ -461,7 +461,7 @@ static int exynos_mipi_dsi_probe(struct platform_device *pdev) done: platform_set_drvdata(pdev, dsim); - dev_dbg(&pdev->dev, "%s() completed sucessfuly (%s mode)\n", __func__, + dev_dbg(&pdev->dev, "%s() completed successfully (%s mode)\n", __func__, dsim_config->e_interface == DSIM_COMMAND ? "CPU" : "RGB"); return 0; diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index caad3689b4e6..53ffdfc82a75 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -32,7 +32,7 @@ #include <linux/io.h> #include <linux/math64.h> -#include <mach/imxfb.h> +#include <linux/platform_data/video-imxfb.h> #include <mach/hardware.h> /* diff --git a/drivers/video/mb862xx/mb862xxfbdrv.c b/drivers/video/mb862xx/mb862xxfbdrv.c index 00ce1f34b496..57d940be5f3d 100644 --- a/drivers/video/mb862xx/mb862xxfbdrv.c +++ b/drivers/video/mb862xx/mb862xxfbdrv.c @@ -328,6 +328,8 @@ static int mb862xxfb_ioctl(struct fb_info *fbi, unsigned int cmd, case MB862XX_L1_SET_CFG: if (copy_from_user(l1_cfg, argp, sizeof(*l1_cfg))) return -EFAULT; + if (l1_cfg->dh == 0 || l1_cfg->dw == 0) + return -EINVAL; if ((l1_cfg->sw >= l1_cfg->dw) && (l1_cfg->sh >= l1_cfg->dh)) { /* downscaling */ outreg(cap, GC_CAP_CSC, diff --git a/drivers/video/msm/mddi.c b/drivers/video/msm/mddi.c index b061d709bc44..bf73f0480061 100644 --- a/drivers/video/msm/mddi.c +++ b/drivers/video/msm/mddi.c @@ -29,7 +29,7 @@ #include <mach/msm_iomap.h> #include <mach/irqs.h> #include <mach/board.h> -#include <mach/msm_fb.h> +#include <linux/platform_data/video-msm_fb.h> #include "mddi_hw.h" #define FLAG_DISABLE_HIBERNATION 0x0001 diff --git a/drivers/video/msm/mddi_client_dummy.c b/drivers/video/msm/mddi_client_dummy.c index d2a091cebe2c..f1b0dfcc9717 100644 --- a/drivers/video/msm/mddi_client_dummy.c +++ b/drivers/video/msm/mddi_client_dummy.c @@ -20,7 +20,7 @@ #include <linux/kernel.h> #include <linux/platform_device.h> -#include <mach/msm_fb.h> +#include <linux/platform_data/video-msm_fb.h> struct panel_info { struct platform_device pdev; diff --git a/drivers/video/msm/mddi_client_nt35399.c b/drivers/video/msm/mddi_client_nt35399.c index 7fcd67e132bf..d7a5bf84fb2a 100644 --- a/drivers/video/msm/mddi_client_nt35399.c +++ b/drivers/video/msm/mddi_client_nt35399.c @@ -22,7 +22,7 @@ #include <linux/sched.h> #include <linux/gpio.h> #include <linux/slab.h> -#include <mach/msm_fb.h> +#include <linux/platform_data/video-msm_fb.h> static DECLARE_WAIT_QUEUE_HEAD(nt35399_vsync_wait); diff --git a/drivers/video/msm/mddi_client_toshiba.c b/drivers/video/msm/mddi_client_toshiba.c index 053eb6877330..061d7dfebbf3 100644 --- a/drivers/video/msm/mddi_client_toshiba.c +++ b/drivers/video/msm/mddi_client_toshiba.c @@ -22,7 +22,7 @@ #include <linux/gpio.h> #include <linux/sched.h> #include <linux/slab.h> -#include <mach/msm_fb.h> +#include <linux/platform_data/video-msm_fb.h> #define LCD_CONTROL_BLOCK_BASE 0x110000 diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index cb2ddf164c98..2e0f3bab6114 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c @@ -26,7 +26,7 @@ #include <linux/slab.h> #include <mach/msm_iomap.h> -#include <mach/msm_fb.h> +#include <linux/platform_data/video-msm_fb.h> #include <linux/platform_device.h> #include <linux/export.h> @@ -257,19 +257,17 @@ int get_img(struct mdp_img *img, struct fb_info *info, unsigned long *start, unsigned long *len, struct file **filep) { - int put_needed, ret = 0; - struct file *file; - - file = fget_light(img->memory_id, &put_needed); - if (file == NULL) + int ret = 0; + struct fd f = fdget(img->memory_id); + if (f.file == NULL) return -1; - if (MAJOR(file->f_dentry->d_inode->i_rdev) == FB_MAJOR) { + if (MAJOR(f.file->f_dentry->d_inode->i_rdev) == FB_MAJOR) { *start = info->fix.smem_start; *len = info->fix.smem_len; } else ret = -1; - fput_light(file, put_needed); + fdput(f); return ret; } diff --git a/drivers/video/msm/mdp_hw.h b/drivers/video/msm/mdp_hw.h index d80477415caa..a0bacf581b32 100644 --- a/drivers/video/msm/mdp_hw.h +++ b/drivers/video/msm/mdp_hw.h @@ -16,7 +16,7 @@ #define _MDP_HW_H_ #include <mach/msm_iomap.h> -#include <mach/msm_fb.h> +#include <linux/platform_data/video-msm_fb.h> struct mdp_info { struct mdp_device mdp_dev; diff --git a/drivers/video/msm/mdp_ppp.c b/drivers/video/msm/mdp_ppp.c index 2b6564e8bfea..be6079cdfbb6 100644 --- a/drivers/video/msm/mdp_ppp.c +++ b/drivers/video/msm/mdp_ppp.c @@ -16,7 +16,7 @@ #include <linux/file.h> #include <linux/delay.h> #include <linux/msm_mdp.h> -#include <mach/msm_fb.h> +#include <linux/platform_data/video-msm_fb.h> #include "mdp_hw.h" #include "mdp_scale_tables.h" diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c index c6e3b4fcdd68..ec08a9ec377d 100644 --- a/drivers/video/msm/msm_fb.c +++ b/drivers/video/msm/msm_fb.c @@ -25,7 +25,7 @@ #include <linux/msm_mdp.h> #include <linux/io.h> #include <linux/uaccess.h> -#include <mach/msm_fb.h> +#include <linux/platform_data/video-msm_fb.h> #include <mach/board.h> #include <linux/workqueue.h> #include <linux/clk.h> diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index c89f8a8d36d2..d7381088a180 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c @@ -27,10 +27,10 @@ #include <linux/clk.h> #include <linux/mutex.h> -#include <mach/dma.h> +#include <linux/platform_data/dma-imx.h> #include <mach/hardware.h> #include <mach/ipu.h> -#include <mach/mx3fb.h> +#include <linux/platform_data/video-mx3fb.h> #include <asm/io.h> #include <asm/uaccess.h> diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index e10f551ade21..93387555337e 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c @@ -38,7 +38,7 @@ #include <mach/map.h> #include <mach/regs-clock.h> #include <mach/regs-ldm.h> -#include <mach/fb.h> +#include <linux/platform_data/video-nuc900fb.h> #include "nuc900fb.h" diff --git a/drivers/video/nuc900fb.h b/drivers/video/nuc900fb.h index bc7c9300f276..9a1ca6dbb6b2 100644 --- a/drivers/video/nuc900fb.h +++ b/drivers/video/nuc900fb.h @@ -16,7 +16,7 @@ #define __NUC900FB_H #include <mach/map.h> -#include <mach/fb.h> +#include <linux/platform_data/video-nuc900fb.h> enum nuc900_lcddrv_type { LCDDRV_NUC910, diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c index d3a311327227..ed4cad87fbcd 100644 --- a/drivers/video/omap/lcd_ams_delta.c +++ b/drivers/video/omap/lcd_ams_delta.c @@ -27,8 +27,7 @@ #include <linux/lcd.h> #include <linux/gpio.h> -#include <plat/board-ams-delta.h> -#include <mach/hardware.h> +#include <mach/board-ams-delta.h> #include "omapfb.h" diff --git a/drivers/video/omap/lcd_mipid.c b/drivers/video/omap/lcd_mipid.c index e3880c4a0bb1..b739600c51ac 100644 --- a/drivers/video/omap/lcd_mipid.c +++ b/drivers/video/omap/lcd_mipid.c @@ -25,7 +25,7 @@ #include <linux/spi/spi.h> #include <linux/module.h> -#include <plat/lcd_mipid.h> +#include <linux/platform_data/lcd-mipid.h> #include "omapfb.h" diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c index 5914220dfa9c..3aa62da89195 100644 --- a/drivers/video/omap/lcd_osk.c +++ b/drivers/video/omap/lcd_osk.c @@ -24,7 +24,7 @@ #include <linux/platform_device.h> #include <asm/gpio.h> -#include <plat/mux.h> +#include <mach/mux.h> #include "omapfb.h" static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 3f5acc7771da..6b5e6e0e202f 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c @@ -906,7 +906,7 @@ static int taal_probe(struct omap_dss_device *dssdev) r = -ENOMEM; goto err_wq; } - INIT_DELAYED_WORK_DEFERRABLE(&td->esd_work, taal_esd_work); + INIT_DEFERRABLE_WORK(&td->esd_work, taal_esd_work); INIT_DELAYED_WORK(&td->ulps_work, taal_ulps_work); dev_set_drvdata(&dssdev->dev, td); @@ -962,8 +962,8 @@ static int taal_probe(struct omap_dss_device *dssdev) goto err_irq; } - INIT_DELAYED_WORK_DEFERRABLE(&td->te_timeout_work, - taal_te_timeout_work_callback); + INIT_DEFERRABLE_WORK(&td->te_timeout_work, + taal_te_timeout_work_callback); dev_dbg(&dssdev->dev, "Using GPIO TE\n"); } diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 5b289c5f695b..ee9e29639dcc 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -37,6 +37,7 @@ #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <plat/cpu.h> #include <plat/clock.h> #include <video/omapdss.h> diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index b07e8864f82f..05ee04667af1 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -4306,7 +4306,7 @@ static void dsi_framedone_irq_callback(void *data, u32 mask) * and is sending the data. */ - __cancel_delayed_work(&dsi->framedone_timeout_work); + cancel_delayed_work(&dsi->framedone_timeout_work); dsi_handle_framedone(dsidev, 0); } @@ -4863,8 +4863,8 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev) mutex_init(&dsi->lock); sema_init(&dsi->bus_lock, 1); - INIT_DELAYED_WORK_DEFERRABLE(&dsi->framedone_timeout_work, - dsi_framedone_timeout_work_callback); + INIT_DEFERRABLE_WORK(&dsi->framedone_timeout_work, + dsi_framedone_timeout_work_callback); #ifdef DSI_CATCH_MISSING_TE init_timer(&dsi->te_timer); diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 5d31699fbd3c..f43bfe17b3b6 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c @@ -105,6 +105,20 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) sdi_config_lcd_manager(dssdev); + /* + * LCLK and PCLK divisors are located in shadow registers, and we + * normally write them to DISPC registers when enabling the output. + * However, SDI uses pck-free as source clock for its PLL, and pck-free + * is affected by the divisors. And as we need the PLL before enabling + * the output, we need to write the divisors early. + * + * It seems just writing to the DISPC register is enough, and we don't + * need to care about the shadow register mechanism for pck-free. The + * exact reason for this is unknown. + */ + dispc_mgr_set_clock_div(dssdev->manager->id, + &sdi.mgr_config.clock_info); + dss_sdi_init(dssdev->phy.sdi.datapairs); r = dss_sdi_enable(); if (r) diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 08ec1a7103f2..3c39aa8de928 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c @@ -31,6 +31,7 @@ #include <linux/omapfb.h> #include <video/omapdss.h> +#include <plat/cpu.h> #include <plat/vram.h> #include <plat/vrfb.h> @@ -1192,7 +1193,7 @@ static int _setcolreg(struct fb_info *fbi, u_int regno, u_int red, u_int green, break; if (regno < 16) { - u16 pal; + u32 pal; pal = ((red >> (16 - var->red.length)) << var->red.offset) | ((green >> (16 - var->green.length)) << diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 3f902557690e..4fa2ad43fd97 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -61,7 +61,7 @@ #include <asm/irq.h> #include <asm/div64.h> #include <mach/bitfield.h> -#include <mach/pxafb.h> +#include <linux/platform_data/video-pxafb.h> /* * Complain if VAR is out of range. diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c index 8e4a446b5ed1..b244f060f151 100644 --- a/drivers/video/tmiofb.c +++ b/drivers/video/tmiofb.c @@ -694,6 +694,10 @@ static int __devinit tmiofb_probe(struct platform_device *dev) dev_err(&dev->dev, "NULL platform data!\n"); return -EINVAL; } + if (ccr == NULL || lcr == NULL || vram == NULL || irq < 0) { + dev_err(&dev->dev, "missing resources\n"); + return -EINVAL; + } info = framebuffer_alloc(sizeof(struct tmiofb_par), &dev->dev); diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c index 2a5fe6ede845..9af8da70e781 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/vt8500lcdfb.c @@ -30,11 +30,18 @@ #include <linux/platform_device.h> #include <linux/wait.h> -#include <mach/vt8500fb.h> +#include <linux/platform_data/video-vt8500lcdfb.h> #include "vt8500lcdfb.h" #include "wmt_ge_rops.h" +#ifdef CONFIG_OF +#include <linux/of.h> +#include <linux/of_fdt.h> +#include <linux/memblock.h> +#endif + + #define to_vt8500lcd_info(__info) container_of(__info, \ struct vt8500lcd_info, fb) @@ -270,15 +277,21 @@ static int __devinit vt8500lcd_probe(struct platform_device *pdev) { struct vt8500lcd_info *fbi; struct resource *res; - struct vt8500fb_platform_data *pdata = pdev->dev.platform_data; void *addr; int irq, ret; + struct fb_videomode of_mode; + struct device_node *np; + u32 bpp; + dma_addr_t fb_mem_phys; + unsigned long fb_mem_len; + void *fb_mem_virt; + ret = -ENOMEM; fbi = NULL; - fbi = kzalloc(sizeof(struct vt8500lcd_info) + sizeof(u32) * 16, - GFP_KERNEL); + fbi = devm_kzalloc(&pdev->dev, sizeof(struct vt8500lcd_info) + + sizeof(u32) * 16, GFP_KERNEL); if (!fbi) { dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); ret = -ENOMEM; @@ -333,9 +346,45 @@ static int __devinit vt8500lcd_probe(struct platform_device *pdev) goto failed_free_res; } - fbi->fb.fix.smem_start = pdata->video_mem_phys; - fbi->fb.fix.smem_len = pdata->video_mem_len; - fbi->fb.screen_base = pdata->video_mem_virt; + np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0); + if (!np) { + pr_err("%s: No display description in Device Tree\n", __func__); + ret = -EINVAL; + goto failed_free_res; + } + + /* + * This code is copied from Sascha Hauer's of_videomode helper + * and can be replaced with a call to the helper once mainlined + */ + ret = 0; + ret |= of_property_read_u32(np, "hactive", &of_mode.xres); + ret |= of_property_read_u32(np, "vactive", &of_mode.yres); + ret |= of_property_read_u32(np, "hback-porch", &of_mode.left_margin); + ret |= of_property_read_u32(np, "hfront-porch", &of_mode.right_margin); + ret |= of_property_read_u32(np, "hsync-len", &of_mode.hsync_len); + ret |= of_property_read_u32(np, "vback-porch", &of_mode.upper_margin); + ret |= of_property_read_u32(np, "vfront-porch", &of_mode.lower_margin); + ret |= of_property_read_u32(np, "vsync-len", &of_mode.vsync_len); + ret |= of_property_read_u32(np, "bpp", &bpp); + if (ret) { + pr_err("%s: Unable to read display properties\n", __func__); + goto failed_free_res; + } + of_mode.vmode = FB_VMODE_NONINTERLACED; + + /* try allocating the framebuffer */ + fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); + fb_mem_virt = dma_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys, + GFP_KERNEL); + if (!fb_mem_virt) { + pr_err("%s: Failed to allocate framebuffer\n", __func__); + return -ENOMEM; + }; + + fbi->fb.fix.smem_start = fb_mem_phys; + fbi->fb.fix.smem_len = fb_mem_len; + fbi->fb.screen_base = fb_mem_virt; fbi->palette_size = PAGE_ALIGN(512); fbi->palette_cpu = dma_alloc_coherent(&pdev->dev, @@ -370,10 +419,11 @@ static int __devinit vt8500lcd_probe(struct platform_device *pdev) goto failed_free_irq; } - fb_videomode_to_var(&fbi->fb.var, &pdata->mode); - fbi->fb.var.bits_per_pixel = pdata->bpp; - fbi->fb.var.xres_virtual = pdata->xres_virtual; - fbi->fb.var.yres_virtual = pdata->yres_virtual; + fb_videomode_to_var(&fbi->fb.var, &of_mode); + + fbi->fb.var.xres_virtual = of_mode.xres; + fbi->fb.var.yres_virtual = of_mode.yres * 2; + fbi->fb.var.bits_per_pixel = bpp; ret = vt8500lcd_set_par(&fbi->fb); if (ret) { @@ -448,12 +498,18 @@ static int __devexit vt8500lcd_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id via_dt_ids[] = { + { .compatible = "via,vt8500-fb", }, + {} +}; + static struct platform_driver vt8500lcd_driver = { .probe = vt8500lcd_probe, .remove = __devexit_p(vt8500lcd_remove), .driver = { .owner = THIS_MODULE, .name = "vt8500-lcd", + .of_match_table = of_match_ptr(via_dt_ids), }, }; @@ -461,4 +517,5 @@ module_platform_driver(vt8500lcd_driver); MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com>"); MODULE_DESCRIPTION("LCD controller driver for VIA VT8500"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); +MODULE_DEVICE_TABLE(of, via_dt_ids); diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index c8703bd61b74..77539c1b56a0 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -28,8 +28,11 @@ #include <linux/dma-mapping.h> #include <linux/platform_device.h> #include <linux/wait.h> +#include <linux/of.h> +#include <linux/of_fdt.h> +#include <linux/memblock.h> -#include <mach/vt8500fb.h> +#include <linux/platform_data/video-vt8500lcdfb.h> #include "wm8505fb_regs.h" #include "wmt_ge_rops.h" @@ -59,8 +62,12 @@ static int wm8505fb_init_hw(struct fb_info *info) writel(fbi->fb.fix.smem_start, fbi->regbase + WMT_GOVR_FBADDR); writel(fbi->fb.fix.smem_start, fbi->regbase + WMT_GOVR_FBADDR1); - /* Set in-memory picture format to RGB 32bpp */ - writel(0x1c, fbi->regbase + WMT_GOVR_COLORSPACE); + /* + * Set in-memory picture format to RGB + * 0x31C sets the correct color mode (RGB565) for WM8650 + * Bit 8+9 (0x300) are ignored on WM8505 as reserved + */ + writel(0x31c, fbi->regbase + WMT_GOVR_COLORSPACE); writel(1, fbi->regbase + WMT_GOVR_COLORSPACE1); /* Virtual buffer size */ @@ -127,6 +134,18 @@ static int wm8505fb_set_par(struct fb_info *info) info->var.blue.msb_right = 0; info->fix.visual = FB_VISUAL_TRUECOLOR; info->fix.line_length = info->var.xres_virtual << 2; + } else if (info->var.bits_per_pixel == 16) { + info->var.red.offset = 11; + info->var.red.length = 5; + info->var.red.msb_right = 0; + info->var.green.offset = 5; + info->var.green.length = 6; + info->var.green.msb_right = 0; + info->var.blue.offset = 0; + info->var.blue.length = 5; + info->var.blue.msb_right = 0; + info->fix.visual = FB_VISUAL_TRUECOLOR; + info->fix.line_length = info->var.xres_virtual << 1; } wm8505fb_set_timing(info); @@ -246,16 +265,20 @@ static int __devinit wm8505fb_probe(struct platform_device *pdev) struct wm8505fb_info *fbi; struct resource *res; void *addr; - struct vt8500fb_platform_data *pdata; int ret; - pdata = pdev->dev.platform_data; + struct fb_videomode of_mode; + struct device_node *np; + u32 bpp; + dma_addr_t fb_mem_phys; + unsigned long fb_mem_len; + void *fb_mem_virt; ret = -ENOMEM; fbi = NULL; - fbi = kzalloc(sizeof(struct wm8505fb_info) + sizeof(u32) * 16, - GFP_KERNEL); + fbi = devm_kzalloc(&pdev->dev, sizeof(struct wm8505fb_info) + + sizeof(u32) * 16, GFP_KERNEL); if (!fbi) { dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); ret = -ENOMEM; @@ -305,21 +328,58 @@ static int __devinit wm8505fb_probe(struct platform_device *pdev) goto failed_free_res; } - fb_videomode_to_var(&fbi->fb.var, &pdata->mode); + np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0); + if (!np) { + pr_err("%s: No display description in Device Tree\n", __func__); + ret = -EINVAL; + goto failed_free_res; + } + + /* + * This code is copied from Sascha Hauer's of_videomode helper + * and can be replaced with a call to the helper once mainlined + */ + ret = 0; + ret |= of_property_read_u32(np, "hactive", &of_mode.xres); + ret |= of_property_read_u32(np, "vactive", &of_mode.yres); + ret |= of_property_read_u32(np, "hback-porch", &of_mode.left_margin); + ret |= of_property_read_u32(np, "hfront-porch", &of_mode.right_margin); + ret |= of_property_read_u32(np, "hsync-len", &of_mode.hsync_len); + ret |= of_property_read_u32(np, "vback-porch", &of_mode.upper_margin); + ret |= of_property_read_u32(np, "vfront-porch", &of_mode.lower_margin); + ret |= of_property_read_u32(np, "vsync-len", &of_mode.vsync_len); + ret |= of_property_read_u32(np, "bpp", &bpp); + if (ret) { + pr_err("%s: Unable to read display properties\n", __func__); + goto failed_free_res; + } + + of_mode.vmode = FB_VMODE_NONINTERLACED; + fb_videomode_to_var(&fbi->fb.var, &of_mode); fbi->fb.var.nonstd = 0; fbi->fb.var.activate = FB_ACTIVATE_NOW; fbi->fb.var.height = -1; fbi->fb.var.width = -1; - fbi->fb.var.xres_virtual = pdata->xres_virtual; - fbi->fb.var.yres_virtual = pdata->yres_virtual; - fbi->fb.var.bits_per_pixel = pdata->bpp; - fbi->fb.fix.smem_start = pdata->video_mem_phys; - fbi->fb.fix.smem_len = pdata->video_mem_len; - fbi->fb.screen_base = pdata->video_mem_virt; - fbi->fb.screen_size = pdata->video_mem_len; + /* try allocating the framebuffer */ + fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); + fb_mem_virt = dma_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys, + GFP_KERNEL); + if (!fb_mem_virt) { + pr_err("%s: Failed to allocate framebuffer\n", __func__); + return -ENOMEM; + }; + + fbi->fb.var.xres_virtual = of_mode.xres; + fbi->fb.var.yres_virtual = of_mode.yres * 2; + fbi->fb.var.bits_per_pixel = bpp; + + fbi->fb.fix.smem_start = fb_mem_phys; + fbi->fb.fix.smem_len = fb_mem_len; + fbi->fb.screen_base = fb_mem_virt; + fbi->fb.screen_size = fb_mem_len; if (fb_alloc_cmap(&fbi->fb.cmap, 256, 0) < 0) { dev_err(&pdev->dev, "Failed to allocate color map\n"); @@ -395,12 +455,18 @@ static int __devexit wm8505fb_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id wmt_dt_ids[] = { + { .compatible = "wm,wm8505-fb", }, + {} +}; + static struct platform_driver wm8505fb_driver = { .probe = wm8505fb_probe, .remove = __devexit_p(wm8505fb_remove), .driver = { .owner = THIS_MODULE, .name = DRIVER_NAME, + .of_match_table = of_match_ptr(wmt_dt_ids), }, }; @@ -408,4 +474,5 @@ module_platform_driver(wm8505fb_driver); MODULE_AUTHOR("Ed Spiridonov <edo.rus@gmail.com>"); MODULE_DESCRIPTION("Framebuffer driver for WMT WM8505"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); +MODULE_DEVICE_TABLE(of, wmt_dt_ids); diff --git a/drivers/video/wmt_ge_rops.c b/drivers/video/wmt_ge_rops.c index 55be3865015b..ba025b4c7d09 100644 --- a/drivers/video/wmt_ge_rops.c +++ b/drivers/video/wmt_ge_rops.c @@ -158,12 +158,18 @@ static int __devexit wmt_ge_rops_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id wmt_dt_ids[] = { + { .compatible = "wm,prizm-ge-rops", }, + { /* sentinel */ } +}; + static struct platform_driver wmt_ge_rops_driver = { .probe = wmt_ge_rops_probe, .remove = __devexit_p(wmt_ge_rops_remove), .driver = { .owner = THIS_MODULE, .name = "wmt_ge_rops", + .of_match_table = of_match_ptr(wmt_dt_ids), }, }; @@ -172,4 +178,5 @@ module_platform_driver(wmt_ge_rops_driver); MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com"); MODULE_DESCRIPTION("Accelerators for raster operations using " "WonderMedia Graphics Engine"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); +MODULE_DEVICE_TABLE(of, wmt_dt_ids); |