Commit d6ff7d0f authored by Alexey Charkov's avatar Alexey Charkov Committed by Paul Mundt

ARM: Add support for the display controllers in VT8500 and WM8505

This adds drivers for the LCD controller found in VIA VT8500 SoC,
GOVR display controller found in WonderMedia WM8505 SoC and for the
Graphics Engine present in both of them that provides hardware
accelerated raster operations (used for copyarea and fillrect).
Signed-off-by: default avatarAlexey Charkov <alchark@gmail.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent a7bcf21e
......@@ -186,6 +186,14 @@ config FB_SYS_FOPS
depends on FB
default n
config FB_WMT_GE_ROPS
tristate
depends on FB
default n
---help---
Include functions for accelerated rectangle filling and area
copying using WonderMedia Graphics Engine operations.
config FB_DEFERRED_IO
bool
depends on FB
......@@ -1722,6 +1730,24 @@ config FB_AU1200
various panels and CRTs by passing in kernel cmd line option
au1200fb:panel=<name>.
config FB_VT8500
bool "VT8500 LCD Driver"
depends on (FB = y) && ARM && ARCH_VT8500 && VTWM_VERSION_VT8500
select FB_WMT_GE_ROPS
select FB_SYS_IMAGEBLIT
help
This is the framebuffer driver for VIA VT8500 integrated LCD
controller.
config FB_WM8505
bool "WM8505 frame buffer support"
depends on (FB = y) && ARM && ARCH_VT8500 && VTWM_VERSION_WM8505
select FB_WMT_GE_ROPS
select FB_SYS_IMAGEBLIT
help
This is the framebuffer driver for WonderMedia WM8505
integrated LCD controller.
source "drivers/video/geode/Kconfig"
config FB_HIT
......
......@@ -26,6 +26,7 @@ obj-$(CONFIG_FB_SVGALIB) += svgalib.o
obj-$(CONFIG_FB_MACMODES) += macmodes.o
obj-$(CONFIG_FB_DDC) += fb_ddc.o
obj-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o
obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o
# Hardware specific drivers go first
obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o
......@@ -104,6 +105,8 @@ obj-$(CONFIG_FB_W100) += w100fb.o
obj-$(CONFIG_FB_TMIO) += tmiofb.o
obj-$(CONFIG_FB_AU1100) += au1100fb.o
obj-$(CONFIG_FB_AU1200) += au1200fb.o
obj-$(CONFIG_FB_VT8500) += vt8500lcdfb.o
obj-$(CONFIG_FB_WM8505) += wm8505fb.o
obj-$(CONFIG_FB_PMAG_AA) += pmag-aa-fb.o
obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o
obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o
......
This diff is collapsed.
/*
* linux/drivers/video/vt8500lcdfb.h
*
* Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
struct vt8500lcd_info {
struct fb_info fb;
void __iomem *regbase;
void __iomem *palette_cpu;
dma_addr_t palette_phys;
size_t palette_size;
wait_queue_head_t wait;
};
static int bpp_values[] = {
1,
2,
4,
8,
12,
16,
18,
24,
};
This diff is collapsed.
/*
* GOVR registers list for WM8505 chips
*
* Copyright (C) 2010 Ed Spiridonov <edo.rus@gmail.com>
* Based on VIA/WonderMedia wm8510-govrh-reg.h
* http://github.com/projectgus/kernel_wm8505/blob/wm8505_2.6.29/
* drivers/video/wmt/register/wm8510/wm8510-govrh-reg.h
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _WM8505FB_REGS_H
#define _WM8505FB_REGS_H
/*
* Color space select register, default value 0x1c
* BIT0 GOVRH_DVO_YUV2RGB_ENABLE
* BIT1 GOVRH_VGA_YUV2RGB_ENABLE
* BIT2 GOVRH_RGB_MODE
* BIT3 GOVRH_DAC_CLKINV
* BIT4 GOVRH_BLANK_ZERO
*/
#define WMT_GOVR_COLORSPACE 0x1e4
/*
* Another colorspace select register, default value 1
* BIT0 GOVRH_DVO_RGB
* BIT1 GOVRH_DVO_YUV422
*/
#define WMT_GOVR_COLORSPACE1 0x30
#define WMT_GOVR_CONTRAST 0x1b8
#define WMT_GOVR_BRGHTNESS 0x1bc /* incompatible with RGB? */
/* Framubeffer address */
#define WMT_GOVR_FBADDR 0x90
#define WMT_GOVR_FBADDR1 0x94 /* UV offset in YUV mode */
/* Offset of visible window */
#define WMT_GOVR_XPAN 0xa4
#define WMT_GOVR_YPAN 0xa0
#define WMT_GOVR_XRES 0x98
#define WMT_GOVR_XRES_VIRTUAL 0x9c
#define WMT_GOVR_MIF_ENABLE 0x80
#define WMT_GOVR_FHI 0xa8
#define WMT_GOVR_REG_UPDATE 0xe4
/*
* BIT0 GOVRH_DVO_OUTWIDTH
* BIT1 GOVRH_DVO_SYNC_POLAR
* BIT2 GOVRH_DVO_ENABLE
*/
#define WMT_GOVR_DVO_SET 0x148
/* Timing generator? */
#define WMT_GOVR_TG 0x100
/* Timings */
#define WMT_GOVR_TIMING_H_ALL 0x108
#define WMT_GOVR_TIMING_V_ALL 0x10c
#define WMT_GOVR_TIMING_V_START 0x110
#define WMT_GOVR_TIMING_V_END 0x114
#define WMT_GOVR_TIMING_H_START 0x118
#define WMT_GOVR_TIMING_H_END 0x11c
#define WMT_GOVR_TIMING_V_SYNC 0x128
#define WMT_GOVR_TIMING_H_SYNC 0x12c
#endif /* _WM8505FB_REGS_H */
/*
* linux/drivers/video/wmt_ge_rops.c
*
* Accelerators for raster operations using WonderMedia Graphics Engine
*
* Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/fb.h>
#include <linux/platform_device.h>
#include "fb_draw.h"
#define GE_COMMAND_OFF 0x00
#define GE_DEPTH_OFF 0x04
#define GE_HIGHCOLOR_OFF 0x08
#define GE_ROPCODE_OFF 0x14
#define GE_FIRE_OFF 0x18
#define GE_SRCBASE_OFF 0x20
#define GE_SRCDISPW_OFF 0x24
#define GE_SRCDISPH_OFF 0x28
#define GE_SRCAREAX_OFF 0x2c
#define GE_SRCAREAY_OFF 0x30
#define GE_SRCAREAW_OFF 0x34
#define GE_SRCAREAH_OFF 0x38
#define GE_DESTBASE_OFF 0x3c
#define GE_DESTDISPW_OFF 0x40
#define GE_DESTDISPH_OFF 0x44
#define GE_DESTAREAX_OFF 0x48
#define GE_DESTAREAY_OFF 0x4c
#define GE_DESTAREAW_OFF 0x50
#define GE_DESTAREAH_OFF 0x54
#define GE_PAT0C_OFF 0x88 /* Pattern 0 color */
#define GE_ENABLE_OFF 0xec
#define GE_INTEN_OFF 0xf0
#define GE_STATUS_OFF 0xf8
static void __iomem *regbase;
void wmt_ge_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
{
unsigned long fg, pat;
if (p->state != FBINFO_STATE_RUNNING)
return;
if (p->fix.visual == FB_VISUAL_TRUECOLOR ||
p->fix.visual == FB_VISUAL_DIRECTCOLOR)
fg = ((u32 *) (p->pseudo_palette))[rect->color];
else
fg = rect->color;
pat = pixel_to_pat(p->var.bits_per_pixel, fg);
if (p->fbops->fb_sync)
p->fbops->fb_sync(p);
writel(p->var.bits_per_pixel == 32 ? 3 :
(p->var.bits_per_pixel == 8 ? 0 : 1), regbase + GE_DEPTH_OFF);
writel(p->var.bits_per_pixel == 15 ? 1 : 0, regbase + GE_HIGHCOLOR_OFF);
writel(p->fix.smem_start, regbase + GE_DESTBASE_OFF);
writel(p->var.xres_virtual - 1, regbase + GE_DESTDISPW_OFF);
writel(p->var.yres_virtual - 1, regbase + GE_DESTDISPH_OFF);
writel(rect->dx, regbase + GE_DESTAREAX_OFF);
writel(rect->dy, regbase + GE_DESTAREAY_OFF);
writel(rect->width - 1, regbase + GE_DESTAREAW_OFF);
writel(rect->height - 1, regbase + GE_DESTAREAH_OFF);
writel(pat, regbase + GE_PAT0C_OFF);
writel(1, regbase + GE_COMMAND_OFF);
writel(rect->rop == ROP_XOR ? 0x5a : 0xf0, regbase + GE_ROPCODE_OFF);
writel(1, regbase + GE_FIRE_OFF);
}
EXPORT_SYMBOL_GPL(wmt_ge_fillrect);
void wmt_ge_copyarea(struct fb_info *p, const struct fb_copyarea *area)
{
if (p->state != FBINFO_STATE_RUNNING)
return;
if (p->fbops->fb_sync)
p->fbops->fb_sync(p);
writel(p->var.bits_per_pixel > 16 ? 3 :
(p->var.bits_per_pixel > 8 ? 1 : 0), regbase + GE_DEPTH_OFF);
writel(p->fix.smem_start, regbase + GE_SRCBASE_OFF);
writel(p->var.xres_virtual - 1, regbase + GE_SRCDISPW_OFF);
writel(p->var.yres_virtual - 1, regbase + GE_SRCDISPH_OFF);
writel(area->sx, regbase + GE_SRCAREAX_OFF);
writel(area->sy, regbase + GE_SRCAREAY_OFF);
writel(area->width - 1, regbase + GE_SRCAREAW_OFF);
writel(area->height - 1, regbase + GE_SRCAREAH_OFF);
writel(p->fix.smem_start, regbase + GE_DESTBASE_OFF);
writel(p->var.xres_virtual - 1, regbase + GE_DESTDISPW_OFF);
writel(p->var.yres_virtual - 1, regbase + GE_DESTDISPH_OFF);
writel(area->dx, regbase + GE_DESTAREAX_OFF);
writel(area->dy, regbase + GE_DESTAREAY_OFF);
writel(area->width - 1, regbase + GE_DESTAREAW_OFF);
writel(area->height - 1, regbase + GE_DESTAREAH_OFF);
writel(0xcc, regbase + GE_ROPCODE_OFF);
writel(1, regbase + GE_COMMAND_OFF);
writel(1, regbase + GE_FIRE_OFF);
}
EXPORT_SYMBOL_GPL(wmt_ge_copyarea);
int wmt_ge_sync(struct fb_info *p)
{
int loops = 5000000;
while ((readl(regbase + GE_STATUS_OFF) & 4) && --loops)
cpu_relax();
return loops > 0 ? 0 : -EBUSY;
}
EXPORT_SYMBOL_GPL(wmt_ge_sync);
static int __devinit wmt_ge_rops_probe(struct platform_device *pdev)
{
struct resource *res;
int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(&pdev->dev, "no I/O memory resource defined\n");
ret = -ENODEV;
goto error;
}
/* Only one ROP engine is presently supported. */
if (unlikely(regbase)) {
WARN_ON(1);
return -EBUSY;
}
regbase = ioremap(res->start, resource_size(res));
if (regbase == NULL) {
dev_err(&pdev->dev, "failed to map I/O memory\n");
ret = -EBUSY;
goto error;
}
writel(1, regbase + GE_ENABLE_OFF);
printk(KERN_INFO "Enabled support for WMT GE raster acceleration\n");
return 0;
error:
return ret;
}
static int __devexit wmt_ge_rops_remove(struct platform_device *pdev)
{
iounmap(regbase);
return 0;
}
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",
},
};
static int __init wmt_ge_rops_init(void)
{
return platform_driver_register(&wmt_ge_rops_driver);
}
static void __exit wmt_ge_rops_exit(void)
{
platform_driver_unregister(&wmt_ge_rops_driver);
}
module_init(wmt_ge_rops_init);
module_exit(wmt_ge_rops_exit);
MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com");
MODULE_DESCRIPTION("Accelerators for raster operations using "
"WonderMedia Graphics Engine");
MODULE_LICENSE("GPL");
extern void wmt_ge_fillrect(struct fb_info *info,
const struct fb_fillrect *rect);
extern void wmt_ge_copyarea(struct fb_info *info,
const struct fb_copyarea *area);
extern int wmt_ge_sync(struct fb_info *info);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment