build/patch/kernel/archive/sunxi-5.15/patches.megous/video-fbdev-Add-events-for-early-fb-event-support.patch

74 lines
2.3 KiB
Diff
Raw Normal View History

From 5d853c170149211e2c45b78d0eff96c0567e931e Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Sun, 17 Oct 2021 12:46:01 +0200
Subject: [PATCH 454/478] video: fbdev: Add events for early fb event support
This patch adds FB_EARLY_EVENT_BLANK and FB_R_EARLY_EVENT_BLANK
event mode supports. first, fb_notifier_call_chain() is called with
FB_EARLY_EVENT_BLANK and fb_blank() of specific fb driver is called
and then fb_notifier_call_chain() is called with FB_EVENT_BLANK again
at fb_blank(). and if fb_blank() was failed then fb_nitifier_call_chain()
would be called with FB_R_EARLY_EVENT_BLANK to revert the previous effects.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/video/fbdev/core/fbmem.c | 12 +++++++++++-
include/linux/fb.h | 5 +++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 7420d2c16e47..ac3ad34a9f27 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1067,7 +1067,7 @@ int
fb_blank(struct fb_info *info, int blank)
{
struct fb_event event;
- int ret = -EINVAL;
+ int ret = -EINVAL, early_ret;
if (blank > FB_BLANK_POWERDOWN)
blank = FB_BLANK_POWERDOWN;
@@ -1075,11 +1075,21 @@ fb_blank(struct fb_info *info, int blank)
event.info = info;
event.data = &blank;
+ early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event);
+
if (info->fbops->fb_blank)
ret = info->fbops->fb_blank(blank, info);
if (!ret)
fb_notifier_call_chain(FB_EVENT_BLANK, &event);
+ else {
+ /*
+ * if fb_blank is failed then revert effects of
+ * the early blank event.
+ */
+ if (!early_ret)
+ fb_notifier_call_chain(FB_R_EARLY_EVENT_BLANK, &event);
+ }
return ret;
}
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 5950f8f5dc74..1ec43cf5d765 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -137,6 +137,11 @@ struct fb_cursor_user {
/* A display blank is requested */
#define FB_EVENT_BLANK 0x09
+/* A hardware display blank early change occured */
+#define FB_EARLY_EVENT_BLANK 0x10
+/* A hardware display blank revert early change occured */
+#define FB_R_EARLY_EVENT_BLANK 0x11
+
struct fb_event {
struct fb_info *info;
void *data;
--
2.35.3