linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: deller@gmx.de, sam@ravnborg.org, javierm@redhat.com, davem@davemloft.net
Cc: sparclinux@vger.kernel.org, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 03/11] fbdev/sbus: Add initializer macros and Kconfig tokens for SBUS support
Date: Sun,  6 Aug 2023 13:58:54 +0200	[thread overview]
Message-ID: <20230806120926.5368-4-tzimmermann@suse.de> (raw)
In-Reply-To: <20230806120926.5368-1-tzimmermann@suse.de>

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>
---
 drivers/video/fbdev/Kconfig   |  6 ++++++
 drivers/video/fbdev/sbuslib.h | 31 +++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

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 */
-- 
2.41.0


  parent reply	other threads:[~2023-08-06 12:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-06 11:58 [PATCH 00/11] fbdev/sbus: Initializers for struct fb_ops Thomas Zimmermann
2023-08-06 11:58 ` [PATCH 01/11] fbdev/sbus: Build sbuslib.o if CONFIG_FB_SBUS has been selected Thomas Zimmermann
2023-08-06 11:58 ` [PATCH 02/11] fbdev/sbus: Forward declare all necessary structures in header Thomas Zimmermann
2023-08-06 11:58 ` Thomas Zimmermann [this message]
2023-08-06 11:58 ` [PATCH 04/11] fbdev/bw2: Use initializer macro for struct fb_ops Thomas Zimmermann
2023-08-06 11:58 ` [PATCH 05/11] fbdev/cg14: " Thomas Zimmermann
2023-08-06 11:58 ` [PATCH 06/11] fbdev/cg3: " Thomas Zimmermann
2023-08-06 11:58 ` [PATCH 07/11] fbdev/cg6: " Thomas Zimmermann
2023-08-06 11:58 ` [PATCH 08/11] fbdev/ffb: " Thomas Zimmermann
2023-08-06 11:59 ` [PATCH 09/11] fbdev/leo: " Thomas Zimmermann
2023-08-06 11:59 ` [PATCH 10/11] fbdev/p9100: " Thomas Zimmermann
2023-08-06 11:59 ` [PATCH 11/11] fbdev/tcx: " Thomas Zimmermann
2023-08-07 17:11 ` [PATCH 00/11] fbdev/sbus: Initializers " Sam Ravnborg
2023-08-28  8:51   ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230806120926.5368-4-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).