/*
|
/*
|
* linux/drivers/video/v586fb.c -- v586 frame buffer device
|
* linux/drivers/video/v586fb.c -- v586 frame buffer device
|
*
|
*
|
* Copyright (C) 2017
|
* Copyright (C) 2001
|
*
|
*
|
* This driver is derived from the q40 one done by :
|
|
* Richard Zidlicky <rz@linux-m68k.org>
|
* Richard Zidlicky <rz@linux-m68k.org>
|
*
|
*
|
* This file is subject to the terms and conditions of the GNU General Public
|
* 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
|
* License. See the file COPYING in the main directory of this archive for
|
* more details.
|
* more details.
|
*/
|
*/
|
|
|
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
#include <linux/errno.h>
|
#include <linux/errno.h>
|
#include <linux/string.h>
|
#include <linux/string.h>
|
#include <linux/mm.h>
|
#include <linux/mm.h>
|
#include <linux/delay.h>
|
#include <linux/delay.h>
|
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
|
|
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
#include <asm/setup.h>
|
#include <asm/setup.h>
|
#include <linux/fb.h>
|
#include <linux/fb.h>
|
#include <linux/module.h>
|
#include <linux/module.h>
|
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
|
|
#define v586_PHYS_SCREEN_ADDR 0x000A0000
|
#define v586_PHYS_SCREEN_ADDR 0x40F00000
|
#define v586_PHYS_SCREEN_SIZE 0x00020000
|
#define v586_PHYS_SCREEN_SIZE 0x00020000
|
/* static void *videomemory; */
|
/* static void *videomemory; */
|
static u_long videomemorysize = v586_PHYS_SCREEN_SIZE;
|
static u_long videomemorysize = v586_PHYS_SCREEN_SIZE;
|
module_param(videomemorysize, ulong, 0);
|
module_param(videomemorysize, ulong, 0);
|
|
|
static struct fb_fix_screeninfo v586fb_fix = {
|
static struct fb_fix_screeninfo v586fb_fix = {
|
.id = "v586fb",
|
.id = "v586fb",
|
.smem_len = 640*200,
|
.smem_len = 640*200,
|
.type = FB_TYPE_PACKED_PIXELS,
|
.type = FB_TYPE_PACKED_PIXELS,
|
.visual = FB_VISUAL_TRUECOLOR,
|
.visual = FB_VISUAL_TRUECOLOR,
|
.line_length = 640,
|
.line_length = 640,
|
.accel = FB_ACCEL_NONE,
|
.accel = FB_ACCEL_NONE,
|
};
|
};
|
|
|
static struct fb_var_screeninfo v586fb_var = {
|
static struct fb_var_screeninfo v586fb_var = {
|
.xres = 640,
|
.xres = 640,
|
.yres = 200,
|
.yres = 200,
|
.xres_virtual = 640,
|
.xres_virtual = 640,
|
.yres_virtual = 200,
|
.yres_virtual = 200,
|
.bits_per_pixel = 8,
|
.bits_per_pixel = 8,
|
.red = {0, 3, 0},
|
.red = {0, 3, 0},
|
.green = {3, 3, 0},
|
.green = {3, 3, 0},
|
.blue = {6, 2, 0},
|
.blue = {6, 2, 0},
|
.activate = FB_ACTIVATE_NOW,
|
.activate = FB_ACTIVATE_NOW,
|
.height = 230,
|
.height = 230,
|
.width = 300,
|
.width = 300,
|
.vmode = FB_VMODE_NONINTERLACED,
|
.vmode = FB_VMODE_NONINTERLACED,
|
};
|
};
|
|
|
static struct fb_ops v586fb_ops = {
|
static struct fb_ops v586fb_ops = {
|
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
.fb_fillrect = cfb_fillrect,
|
.fb_fillrect = cfb_fillrect,
|
.fb_copyarea = cfb_copyarea,
|
.fb_copyarea = cfb_copyarea,
|
.fb_imageblit = cfb_imageblit,
|
.fb_imageblit = cfb_imageblit,
|
};
|
};
|
|
|
static int v586fb_probe(struct platform_device *dev)
|
static int v586fb_probe(struct platform_device *dev)
|
{
|
{
|
struct fb_info *info;
|
struct fb_info *info;
|
|
|
v586fb_fix.smem_start = v586_PHYS_SCREEN_ADDR;
|
v586fb_fix.smem_start = v586_PHYS_SCREEN_ADDR;
|
|
|
info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
|
info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
|
if (!info)
|
if (!info)
|
return -ENOMEM;
|
return -ENOMEM;
|
|
|
if (!request_mem_region(v586_PHYS_SCREEN_ADDR, v586_PHYS_SCREEN_SIZE, "v586fb")) {
|
if (!request_mem_region(v586_PHYS_SCREEN_ADDR, v586_PHYS_SCREEN_SIZE, "v586fb")) {
|
printk(KERN_INFO"v586fb: cannot get framebuffer\n");
|
printk(KERN_INFO"v586fb: cannot get framebuffer\n");
|
}
|
}
|
|
|
info->var = v586fb_var;
|
info->var = v586fb_var;
|
info->fix = v586fb_fix;
|
info->fix = v586fb_fix;
|
info->fbops = &v586fb_ops;
|
info->fbops = &v586fb_ops;
|
info->flags = FBINFO_DEFAULT; /* not as module for now */
|
info->flags = FBINFO_DEFAULT; /* not as module for now */
|
info->par = NULL;
|
info->par = NULL;
|
info->screen_base = ioremap(v586_PHYS_SCREEN_ADDR,videomemorysize); /* (char *) v586fb_fix.smem_start; */
|
info->screen_base = ioremap(v586_PHYS_SCREEN_ADDR,videomemorysize); /* (char *) v586fb_fix.smem_start; */
|
|
|
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
|
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
|
framebuffer_release(info);
|
framebuffer_release(info);
|
return -ENOMEM;
|
return -ENOMEM;
|
}
|
}
|
|
|
if (register_framebuffer(info) < 0) {
|
if (register_framebuffer(info) < 0) {
|
printk(KERN_ERR "Unable to register v586fb frame buffer\n");
|
printk(KERN_ERR "Unable to register v586fb frame buffer\n");
|
fb_dealloc_cmap(&info->cmap);
|
fb_dealloc_cmap(&info->cmap);
|
framebuffer_release(info);
|
framebuffer_release(info);
|
return -EINVAL;
|
return -EINVAL;
|
}
|
}
|
|
|
fb_info(info, "v586fb frame buffer alive and kicking !\n");
|
fb_info(info, "v586fb frame buffer alive and kicking !\n");
|
return 0;
|
return 0;
|
}
|
}
|
|
|
static struct platform_driver v586fb_driver = {
|
static struct platform_driver v586fb_driver = {
|
.probe = v586fb_probe,
|
.probe = v586fb_probe,
|
.driver = {
|
.driver = {
|
.name = "v586fb",
|
.name = "v586fb",
|
},
|
},
|
};
|
};
|
|
|
static struct platform_device v586fb_device = {
|
static struct platform_device v586fb_device = {
|
.name = "v586fb",
|
.name = "v586fb",
|
};
|
};
|
|
|
int __init v586fb_init(void)
|
int __init v586fb_init(void)
|
{
|
{
|
int ret = 0;
|
int ret = 0;
|
|
|
if (fb_get_options("v586fb", NULL))
|
if (fb_get_options("v586fb", NULL))
|
return -ENODEV;
|
return -ENODEV;
|
|
|
ret = platform_driver_register(&v586fb_driver);
|
ret = platform_driver_register(&v586fb_driver);
|
|
|
if (!ret) {
|
if (!ret) {
|
ret = platform_device_register(&v586fb_device);
|
ret = platform_device_register(&v586fb_device);
|
if (ret)
|
if (ret)
|
platform_driver_unregister(&v586fb_driver);
|
platform_driver_unregister(&v586fb_driver);
|
}
|
}
|
return ret;
|
return ret;
|
}
|
}
|
|
|
module_init(v586fb_init);
|
module_init(v586fb_init);
|
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
|
|