summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2023-08-06 13:58:54 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2023-08-28 09:43:53 +0200
commitcbe606f304ec188b90e0b9f8b3e8b37d57553f81 (patch)
tree899b3e5a4d96763909107d1a709b48f92cd72aac
parentfbdev/sbus: Forward declare all necessary structures in header (diff)
downloadlinux-cbe606f304ec188b90e0b9f8b3e8b37d57553f81.tar.xz
linux-cbe606f304ec188b90e0b9f8b3e8b37d57553f81.zip
fbdev/sbus: Add initializer macros and Kconfig tokens for SBUS support
Add macros to initialize struct fb_ops for drivers that support framebuffers on Sparc's SBUS. Also add a Kconfig token that selects the necessary helpers. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230806120926.5368-4-tzimmermann@suse.de
-rw-r--r--drivers/video/fbdev/Kconfig6
-rw-r--r--drivers/video/fbdev/sbuslib.h31
2 files changed, 37 insertions, 0 deletions
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 5d93ecc01f6a..fd5bd284c0f8 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -518,6 +518,12 @@ config FB_SBUS
help
Say Y if you want support for SBUS or UPA based frame buffer device.
+config FB_SBUS_HELPERS
+ bool
+ select FB_CFB_COPYAREA
+ select FB_CFB_FILLRECT
+ select FB_CFB_IMAGEBLIT
+
config FB_BW2
bool "BWtwo support"
depends on (FB = y) && (SPARC && FB_SBUS)
diff --git a/drivers/video/fbdev/sbuslib.h b/drivers/video/fbdev/sbuslib.h
index 02ac1282903b..6466b4cbcd7b 100644
--- a/drivers/video/fbdev/sbuslib.h
+++ b/drivers/video/fbdev/sbuslib.h
@@ -29,4 +29,35 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
int sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg);
+/*
+ * Initialize struct fb_ops for SBUS I/O.
+ */
+
+#define __FB_DEFAULT_SBUS_OPS_RDWR(__prefix) \
+ .fb_read = fb_io_read, \
+ .fb_write = fb_io_write
+
+#define __FB_DEFAULT_SBUS_OPS_DRAW(__prefix) \
+ .fb_fillrect = cfb_fillrect, \
+ .fb_copyarea = cfb_copyarea, \
+ .fb_imageblit = cfb_imageblit
+
+#ifdef CONFIG_COMPAT
+#define __FB_DEFAULT_SBUS_OPS_IOCTL(__prefix) \
+ .fb_ioctl = __prefix ## _sbusfb_ioctl, \
+ .fb_compat_ioctl = sbusfb_compat_ioctl
+#else
+#define __FB_DEFAULT_SBUS_OPS_IOCTL(__prefix) \
+ .fb_ioctl = __prefix ## _sbusfb_ioctl
+#endif
+
+#define __FB_DEFAULT_SBUS_OPS_MMAP(__prefix) \
+ .fb_mmap = __prefix ## _sbusfb_mmap
+
+#define FB_DEFAULT_SBUS_OPS(__prefix) \
+ __FB_DEFAULT_SBUS_OPS_RDWR(__prefix), \
+ __FB_DEFAULT_SBUS_OPS_DRAW(__prefix), \
+ __FB_DEFAULT_SBUS_OPS_IOCTL(__prefix), \
+ __FB_DEFAULT_SBUS_OPS_MMAP(__prefix)
+
#endif /* _SBUSLIB_H */