mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-28 00:19:36 +00:00

Fix the compile-time warnings
drivers/video/fbdev/core/cfbcopyarea.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/cfbfillrect.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/cfbimgblt.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/fb_ddc.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/fb_defio.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/fb_io_fops.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/fb_sys_fops.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/fbcmap.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/fbcon.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/fbmon.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/modedb.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/svgalib.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/syscopyarea.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/sysfillrect.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/core/sysimgblt.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/macmodes.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/sbuslib.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
drivers/video/fbdev/wmt_ge_rops.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Helge Deller <deller@gmx.de>
Fixes: a934a57a42
("scripts/misc-check: check missing #include <linux/export.h> when W=1")
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250612081738.197826-3-tzimmermann@suse.de
202 lines
5.4 KiB
C
202 lines
5.4 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* linux/drivers/video/wmt_ge_rops.c
|
|
*
|
|
* Accelerators for raster operations using WonderMedia Graphics Engine
|
|
*
|
|
* Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
|
|
*/
|
|
|
|
#include <linux/export.h>
|
|
#include <linux/module.h>
|
|
#include <linux/fb.h>
|
|
#include <linux/io.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
#include "wmt_ge_rops.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;
|
|
|
|
/* from the spec it seems more like depth than bits per pixel */
|
|
static inline unsigned long pixel_to_pat(u32 depth, u32 pixel, struct fb_info *p)
|
|
{
|
|
switch (depth) {
|
|
case 1:
|
|
return ~0ul*pixel;
|
|
case 2:
|
|
return ~0ul/3*pixel;
|
|
case 4:
|
|
return ~0ul/15*pixel;
|
|
case 8:
|
|
return ~0ul/255*pixel;
|
|
case 12:
|
|
case 15:
|
|
case 16:
|
|
return ~0ul/0xffff*pixel;
|
|
case 18:
|
|
case 24:
|
|
return 0x1000001ul*pixel;
|
|
case 32:
|
|
return pixel;
|
|
default:
|
|
fb_warn_once(p, "%s: unsupported pixelformat %d\n", __func__, depth);
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
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, p);
|
|
|
|
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 wmt_ge_rops_probe(struct platform_device *pdev)
|
|
{
|
|
struct resource *res;
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
if (res == NULL) {
|
|
dev_err(&pdev->dev, "no I/O memory resource defined\n");
|
|
return -ENODEV;
|
|
}
|
|
|
|
/* 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");
|
|
return -EBUSY;
|
|
}
|
|
|
|
writel(1, regbase + GE_ENABLE_OFF);
|
|
printk(KERN_INFO "Enabled support for WMT GE raster acceleration\n");
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void wmt_ge_rops_remove(struct platform_device *pdev)
|
|
{
|
|
iounmap(regbase);
|
|
}
|
|
|
|
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 = wmt_ge_rops_remove,
|
|
.driver = {
|
|
.name = "wmt_ge_rops",
|
|
.of_match_table = wmt_dt_ids,
|
|
},
|
|
};
|
|
|
|
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_DEVICE_TABLE(of, wmt_dt_ids);
|