* [PATCH] fbdev: s3fb: Implement powersave for S3 FB
@ 2025-08-10 15:47 Zsolt Kajtar
2025-08-15 9:09 ` Helge Deller
0 siblings, 1 reply; 2+ messages in thread
From: Zsolt Kajtar @ 2025-08-10 15:47 UTC (permalink / raw)
To: linux-fbdev; +Cc: Zsolt Kajtar
This patch implements power saving for S3 cards by powering down the
RAMDAC and stopping MCLK and DCLK while the card is supposed to be
suspended.
The RAMDAC is also disabled while the screen is blanked and the DCLK
in stopped while in DPMS power off.
The practical difference it makes is that on a machine with such a
card the display will be placed in DPMS power off while standby is
activated (due to stopped DCLK). Same like when using other cards with
implemented power saving functionality.
Without it on my setup the connected display powers up and stays that
way showing VT63 while in standby. Sort of annoying as before standby
it's specifically placed into DPMS off in Xorg for a while.
The used functionality should exists for sure on Trio32 to Aurora64V
(according to the documentation) so I think it's generally applicable.
I'm using this on S3 Trio 3D and S3 Virge DX.
Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>
---
drivers/video/fbdev/s3fb.c | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c
index ff84106ec..9b3fca9b3 100644
--- a/drivers/video/fbdev/s3fb.c
+++ b/drivers/video/fbdev/s3fb.c
@@ -988,34 +988,30 @@ static int s3fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
static int s3fb_blank(int blank_mode, struct fb_info *info)
{
struct s3fb_info *par = info->par;
+ u8 data;
+
+ data = (blank_mode == FB_BLANK_UNBLANK) ? 0x00 : 0x20;
+ svga_wseq_mask(par->state.vgabase, 0x01, data, 0x20);
+ svga_wseq_mask(par->state.vgabase, 0x18, data, 0x20);
switch (blank_mode) {
- case FB_BLANK_UNBLANK:
- fb_dbg(info, "unblank\n");
- svga_wcrt_mask(par->state.vgabase, 0x56, 0x00, 0x06);
- svga_wseq_mask(par->state.vgabase, 0x01, 0x00, 0x20);
- break;
- case FB_BLANK_NORMAL:
- fb_dbg(info, "blank\n");
- svga_wcrt_mask(par->state.vgabase, 0x56, 0x00, 0x06);
- svga_wseq_mask(par->state.vgabase, 0x01, 0x20, 0x20);
+ default:
+ data = 0x00;
break;
case FB_BLANK_HSYNC_SUSPEND:
- fb_dbg(info, "hsync\n");
- svga_wcrt_mask(par->state.vgabase, 0x56, 0x02, 0x06);
- svga_wseq_mask(par->state.vgabase, 0x01, 0x20, 0x20);
+ data = 0x02;
break;
case FB_BLANK_VSYNC_SUSPEND:
- fb_dbg(info, "vsync\n");
- svga_wcrt_mask(par->state.vgabase, 0x56, 0x04, 0x06);
- svga_wseq_mask(par->state.vgabase, 0x01, 0x20, 0x20);
+ data = 0x04;
break;
case FB_BLANK_POWERDOWN:
- fb_dbg(info, "sync down\n");
- svga_wcrt_mask(par->state.vgabase, 0x56, 0x06, 0x06);
- svga_wseq_mask(par->state.vgabase, 0x01, 0x20, 0x20);
+ data = 0x06;
break;
}
+ svga_wcrt_mask(par->state.vgabase, 0x56, data, 0x06);
+
+ data = (blank_mode == FB_BLANK_POWERDOWN) ? 0x01 : 0x00;
+ svga_wseq_mask(par->state.vgabase, 0x14, data, 0x01);
return 0;
}
@@ -1445,6 +1441,8 @@ static int __maybe_unused s3_pci_suspend(struct device *dev)
}
fb_set_suspend(info, 1);
+ svga_wseq_mask(par->state.vgabase, 0x18, 0x20, 0x20);
+ svga_wseq_mask(par->state.vgabase, 0x14, 0x03, 0x03);
mutex_unlock(&(par->open_lock));
console_unlock();
@@ -1471,6 +1469,9 @@ static int __maybe_unused s3_pci_resume(struct device *dev)
return 0;
}
+ vga_wseq(par->state.vgabase, 0x08, 0x06);
+ svga_wseq_mask(par->state.vgabase, 0x18, 0x00, 0x20);
+ svga_wseq_mask(par->state.vgabase, 0x14, 0x00, 0x03);
s3fb_set_par(info);
fb_set_suspend(info, 0);
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fbdev: s3fb: Implement powersave for S3 FB
2025-08-10 15:47 [PATCH] fbdev: s3fb: Implement powersave for S3 FB Zsolt Kajtar
@ 2025-08-15 9:09 ` Helge Deller
0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2025-08-15 9:09 UTC (permalink / raw)
To: Zsolt Kajtar, linux-fbdev
On 8/10/25 17:47, Zsolt Kajtar wrote:
> This patch implements power saving for S3 cards by powering down the
> RAMDAC and stopping MCLK and DCLK while the card is supposed to be
> suspended.
>
> The RAMDAC is also disabled while the screen is blanked and the DCLK
> in stopped while in DPMS power off.
>
> The practical difference it makes is that on a machine with such a
> card the display will be placed in DPMS power off while standby is
> activated (due to stopped DCLK). Same like when using other cards with
> implemented power saving functionality.
>
> Without it on my setup the connected display powers up and stays that
> way showing VT63 while in standby. Sort of annoying as before standby
> it's specifically placed into DPMS off in Xorg for a while.
>
> The used functionality should exists for sure on Trio32 to Aurora64V
> (according to the documentation) so I think it's generally applicable.
> I'm using this on S3 Trio 3D and S3 Virge DX.
>
> Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>
> ---
> drivers/video/fbdev/s3fb.c | 37 +++++++++++++++++++------------------
> 1 file changed, 19 insertions(+), 18 deletions(-)
applied.
Thanks!
Helge
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-15 9:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-10 15:47 [PATCH] fbdev: s3fb: Implement powersave for S3 FB Zsolt Kajtar
2025-08-15 9:09 ` Helge Deller
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).