From: Thomas Zimmermann <tzimmermann@suse.de>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org, deller@gmx.de,
James.Bottomley@HansenPartnership.com, simona@ffwll.ch
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
linux-fbdev@vger.kernel.org, linux-parisc@vger.kernel.org,
sashiko-reviews@lists.linux.dev,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 1/7] vt: Add con_unblank callback to struct consw
Date: Fri, 16 Oct 2026 11:11:51 +0200 [thread overview]
Message-ID: <20261016093357.33294-2-tzimmermann@suse.de> (raw)
In-Reply-To: <20261016093357.33294-1-tzimmermann@suse.de>
Add struct consw.con_unblank as inverse operation to con_black.
If implemented invoke con_blank to turn the console from blanked to
unblanked. Also update the semantics of con_blank in this case: The
blank parameter of con_blank receives a VESA blank mode from enum
vesa_blank_mode instead of the hybrid unblank/blank values it has
used so far.
With con_unblank not implemented, invoke con_blank for blanking and
unblanking as before.
The old semantics of con_blank will be removed when all consoles
implement con_unblank.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/tty/vt/vt.c | 30 +++++++++++++++++++++++-------
include/linux/console.h | 9 ++++++---
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 57edf37495a8..04e28166b78d 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -4671,7 +4671,10 @@ void do_blank_screen(int entering_gfx)
if (console_blanked) {
if (blank_state == blank_vesa_wait) {
blank_state = blank_off;
- vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0);
+ if (vc->vc_sw->con_unblank)
+ vc->vc_sw->con_blank(vc, vesa_blank_mode, 0);
+ else
+ vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0);
}
return;
}
@@ -4680,7 +4683,10 @@ void do_blank_screen(int entering_gfx)
if (entering_gfx) {
hide_cursor(vc);
save_screen(vc);
- vc->vc_sw->con_blank(vc, VESA_VSYNC_SUSPEND, 1);
+ if (vc->vc_sw->con_unblank)
+ vc->vc_sw->con_blank(vc, VESA_NO_BLANKING, 1);
+ else
+ vc->vc_sw->con_blank(vc, VESA_VSYNC_SUSPEND, 1);
console_blanked = fg_console + 1;
blank_state = blank_off;
set_origin(vc);
@@ -4701,8 +4707,12 @@ void do_blank_screen(int entering_gfx)
save_screen(vc);
/* In case we need to reset origin, blanking hook returns 1 */
- i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_VSYNC_SUSPEND :
- (vesa_blank_mode + 1), 0);
+ if (vc->vc_sw->con_unblank)
+ i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_NO_BLANKING :
+ vesa_blank_mode, 0);
+ else
+ i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_VSYNC_SUSPEND :
+ (vesa_blank_mode + 1), 0);
console_blanked = fg_console + 1;
if (i)
set_origin(vc);
@@ -4753,9 +4763,15 @@ void do_unblank_screen(int leaving_gfx)
}
console_blanked = 0;
- if (vc->vc_sw->con_blank(vc, VESA_NO_BLANKING, leaving_gfx))
- /* Low-level driver cannot restore -> do it ourselves */
- update_screen(vc);
+ if (vc->vc_sw->con_unblank) {
+ if (vc->vc_sw->con_unblank(vc))
+ /* Low-level driver cannot restore -> do it ourselves */
+ update_screen(vc);
+ } else {
+ if (vc->vc_sw->con_blank(vc, VESA_NO_BLANKING, leaving_gfx))
+ /* Low-level driver cannot restore -> do it ourselves */
+ update_screen(vc);
+ }
if (console_blank_hook)
console_blank_hook(0);
set_palette(vc);
diff --git a/include/linux/console.h b/include/linux/console.h
index 502d1abe3f50..aadcb6053cb0 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -55,9 +55,11 @@ enum vc_intensity;
* Invoked by csi_M and printing to the console.
* @con_switch: notifier about the console switch; it is supposed to return
* true if a redraw is needed.
- * @con_blank: blank/unblank the console. The target mode is passed in @blank.
- * @mode_switch is set if changing from/to text/graphics. The hook
- * is supposed to return true if a redraw is needed.
+ * @con_blank: blank the console. The preferred VESA blank mode is passed in
+ * @blank. @mode_switch is set if changing from/to text/graphics.
+ * The hook is supposed to return true if a redraw is needed.
+ * @con_unblank: unblank the console. The hook is supposed to return true if
+ * a redraw is needed.
* @con_font_set: set console @vc font to @font with height @vpitch. @flags can
* be %KD_FONT_FLAG_DONT_RECALC. (optional)
* @con_font_get: fetch the current font on @vc of height @vpitch into @font.
@@ -99,6 +101,7 @@ struct consw {
bool (*con_switch)(struct vc_data *vc);
bool (*con_blank)(struct vc_data *vc, enum vesa_blank_mode blank,
bool mode_switch);
+ bool (*con_unblank)(struct vc_data *vc);
int (*con_font_set)(struct vc_data *vc,
const struct console_font *font,
unsigned int vpitch, unsigned int flags);
--
2.55.0
next prev parent reply other threads:[~2026-10-16 9:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 9:11 [PATCH v2 0/7] vt: Simplify console-blanking interface Thomas Zimmermann
2026-10-16 9:11 ` Thomas Zimmermann [this message]
2026-10-16 9:11 ` [PATCH v2 2/7] dummycon: Implement struct consw.con_unblank Thomas Zimmermann
2026-10-16 9:11 ` [PATCH v2 3/7] fbcon: " Thomas Zimmermann
2026-10-16 9:11 ` [PATCH v2 4/7] newport_con: " Thomas Zimmermann
2026-10-16 9:11 ` [PATCH v2 5/7] sticon: " Thomas Zimmermann
2026-10-16 9:11 ` [PATCH v2 6/7] vgacon: " Thomas Zimmermann
2026-10-16 9:11 ` [PATCH v2 7/7] vt: Remove old-style con_blank 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=20261016093357.33294-2-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=deller@gmx.de \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
/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
all inboxes | Powered by JetHome®