Skip to contentSkip to conversation

drm/ast: Blank with VGACR17 sync enable, always clear VGACRB6 sync off

PATCH Superseded Thomas Zimmermann 2 participants 3 messages Oct 10, 2025 – Oct 14, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 drm/ast: Blank with VGACR17 sync enable, always clear VGACRB6 sync off

Blank the display by disabling sync pulses with VGACR17<7>. Unblank by reenabling them. This VGA setting should be supported by all Aspeed hardware.

Ast currently blanks via sync-off bits in VGACRB6. Not all BMCs handle VGACRB6 correctly. After disabling sync during a reboot, some BMCs do not reenable it after the soft reset. The display output remains dark. When the display is off during boot, some BMCs set the sync-off bits in VGACRB6, so the display remains dark. Observed with Blackbird AST2500 BMC. Clearing the sync-off bits unconditionally fixes these issues.

Also do not modify VGASR1's SD bit for blanking, as it only disables GPU access to video memory.

Fixes ce3d99c83495 ("drm: Call drm_atomic_helper_shutdown() at shutdown time for misc drivers")
Cc Douglas Anderson <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc <[email protected]> # v6.7+
---
 drivers/gpu/drm/ast/ast_mode.c | 18 ++++++++++--------
 drivers/gpu/drm/ast/ast_reg.h  |  1 +
 2 files changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +10 -8
index 6b9d510c509d..fe8089266db5 100644
@@ -836,22 +836,24 @@ ast_crtc_helper_atomic_flush(struct drm_crtc *crtc,
 static void ast_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state)
 {
 	struct ast_device *ast = to_ast_device(crtc->dev);
+	u8 vgacr17 = 0x00;
+	u8 vgacrb6 = 0x00;
 
-	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, 0x00);
-	ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0x00);
+	vgacr17 |= AST_IO_VGACR17_SYNC_ENABLE;
+	vgacrb6 &= ~(AST_IO_VGACRB6_VSYNC_OFF | AST_IO_VGACRB6_HSYNC_OFF);
+
+	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17);
+	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6);
 }
 
 static void ast_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_state *state)
 {
 	struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
 	struct ast_device *ast = to_ast_device(crtc->dev);
-	u8 vgacrb6;
+	u8 vgacr17 = 0xff;
 
-	ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, AST_IO_VGASR1_SD);
-
-	vgacrb6 = AST_IO_VGACRB6_VSYNC_OFF |
-		  AST_IO_VGACRB6_HSYNC_OFF;
-	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6);
+	vgacr17 &= ~AST_IO_VGACR17_SYNC_ENABLE;
+	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17);
 
 	/*
 	 * HW cursors require the underlying primary plane and CRTC to
drivers/gpu/drm/ast/ast_reg.h +1 -0
index e15adaf3a80e..30578e3b07e4 100644
@@ -29,6 +29,7 @@
 #define AST_IO_VGAGRI			(0x4E)
 
 #define AST_IO_VGACRI			(0x54)
+#define AST_IO_VGACR17_SYNC_ENABLE	BIT(7) /* called "Hardware reset" in docs */
 #define AST_IO_VGACR80_PASSWORD		(0xa8)
 #define AST_IO_VGACR99_VGAMEM_RSRV_MASK	GENMASK(1, 0)
 #define AST_IO_VGACRA1_VGAIO_DISABLED	BIT(1)
Signature · 1 line
2.51.0
#1 lore raw
Quoted 11 lines · Thomas Zimmermann

Blank the display by disabling sync pulses with VGACR17<7>. Unblank by reenabling them. This VGA setting should be supported by all Aspeed hardware.

Ast currently blanks via sync-off bits in VGACRB6. Not all BMCs handle VGACRB6 correctly. After disabling sync during a reboot, some BMCs do not reenable it after the soft reset. The display output remains dark. When the display is off during boot, some BMCs set the sync-off bits in VGACRB6, so the display remains dark. Observed with Blackbird AST2500 BMC. Clearing the sync-off bits unconditionally fixes these issues.

Quoted 2 lines

Also do not modify VGASR1's SD bit for blanking, as it only disables GPU access to video memory.

One comment below:>

Quoted 21 lines
Fixes ce3d99c83495 ("drm: Call drm_atomic_helper_shutdown() at shutdown time for misc drivers")
Cc Douglas Anderson <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc <[email protected]> # v6.7+
---
  drivers/gpu/drm/ast/ast_mode.c | 18 ++++++++++--------
  drivers/gpu/drm/ast/ast_reg.h  |  1 +
  2 files changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +0 -0
index 6b9d510c509d..fe8089266db5 100644

drivers/gpu/drm/ast/ast_mode.c ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, · line 843

Quoted 10 lines
drivers/gpu/drm/ast/ast_mode.c +4 -2
@@ -836,22 +836,24 @@ ast_crtc_helper_atomic_flush(struct drm_crtc *crtc,
  static void ast_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state)
  {
  	struct ast_device *ast = to_ast_device(crtc->dev);
+	u8 vgacr17 = 0x00;
+	u8 vgacrb6 = 0x00;
 
-	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, 0x00);
-	ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0x00);
+	vgacr17 |= AST_IO_VGACR17_SYNC_ENABLE;
+	vgacrb6 &= ~(AST_IO_VGACRB6_VSYNC_OFF | AST_IO_VGACRB6_HSYNC_OFF);

As vgacrb6 is 0, then this "&=" shouldn't do anything?

Quoted 34 lines
drivers/gpu/drm/ast/ast_mode.c +6 -6
+
+	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17);
+	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6);
  }
 
  static void ast_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_state *state)
  {
  	struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
  	struct ast_device *ast = to_ast_device(crtc->dev);
-	u8 vgacrb6;
+	u8 vgacr17 = 0xff;
 
-	ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, AST_IO_VGASR1_SD);
-
-	vgacrb6 = AST_IO_VGACRB6_VSYNC_OFF |
-		  AST_IO_VGACRB6_HSYNC_OFF;
-	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6);
+	vgacr17 &= ~AST_IO_VGACR17_SYNC_ENABLE;
+	ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17);
 
  	/*
  	 * HW cursors require the underlying primary plane and CRTC to
drivers/gpu/drm/ast/ast_reg.h +1 -0
index e15adaf3a80e..30578e3b07e4 100644
@@ -29,6 +29,7 @@
  #define AST_IO_VGAGRI			(0x4E)
 
  #define AST_IO_VGACRI			(0x54)
+#define AST_IO_VGACR17_SYNC_ENABLE	BIT(7) /* called "Hardware reset" in docs */
  #define AST_IO_VGACR80_PASSWORD		(0xa8)
  #define AST_IO_VGACR99_VGAMEM_RSRV_MASK	GENMASK(1, 0)
  #define AST_IO_VGACRA1_VGAIO_DISABLED	BIT(1)
author maintainer
#2 lore raw

Hi

Am 14.10.25 um 09:45 schrieb Jocelyn Falempe:

Quoted 47 lines · Thomas Zimmermann
Quoted 11 lines

Blank the display by disabling sync pulses with VGACR17<7>. Unblank by reenabling them. This VGA setting should be supported by all Aspeed hardware.

Ast currently blanks via sync-off bits in VGACRB6. Not all BMCs handle VGACRB6 correctly. After disabling sync during a reboot, some BMCs do not reenable it after the soft reset. The display output remains dark. When the display is off during boot, some BMCs set the sync-off bits in VGACRB6, so the display remains dark. Observed with Blackbird AST2500 BMC. Clearing the sync-off bits unconditionally fixes these issues.

Quoted 2 lines

Also do not modify VGASR1's SD bit for blanking, as it only disables GPU access to video memory.

One comment below:>

Quoted 30 lines
Fixes ce3d99c83495 ("drm: Call drm_atomic_helper_shutdown() at shutdown time for misc drivers")
Cc Douglas Anderson <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc <[email protected]> # v6.7+

---
  drivers/gpu/drm/ast/ast_mode.c | 18 ++++++++++-------- drivers/gpu/drm/ast/ast_reg.h  |  1 +

  2 files changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +3 -1
index 6b9d510c509d..fe8089266db5 100644
@@ -836,22 +836,24 @@ ast_crtc_helper_atomic_flush(struct drm_crtc 
 *crtc,
   static void ast_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state)
   {
       struct ast_device *ast = to_ast_device(crtc->dev);
+    u8 vgacr17 = 0x00;
+    u8 vgacrb6 = 0x00;
   -    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, 0x00);
-    ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0x00);
+    vgacr17 |= AST_IO_VGACR17_SYNC_ENABLE;
Quoted 2 lines

drivers/gpu/drm/ast/ast_mode.c ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, · line 843

Quoted 1 line
drivers/gpu/drm/ast/ast_mode.c +1 -0
+    vgacrb6 &= ~(AST_IO_VGACRB6_VSYNC_OFF | AST_IO_VGACRB6_HSYNC_OFF);

As vgacrb6 is 0, then this "&=" shouldn't do anything?

Indeed! I'll fix that in the next rev. But the result is luckily the same, :) because clearing these bits to 0 enables sync.

To give you some context on this code: Just writing plain 0x00 into the HW registers obscures what this code does. But assigning these AST_IO_ constants directly to the variables gives a compiler warning about size mismatches for storing long in u8. Hence these &= and |= constructs. So vgacrb6 should be 0xff and the &= statement clears the bits. It's a masked write below, so the remaining bits will be ignored.

Best regards
Thomas

Quoted 33 lines
Quoted 32 lines
drivers/gpu/drm/ast/ast_mode.c +6 -5
+
+    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17);
+    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6);
   }
     static void ast_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_state *state)
   {
       struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
       struct ast_device *ast = to_ast_device(crtc->dev);
-    u8 vgacrb6;
+    u8 vgacr17 = 0xff;
   -    ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, AST_IO_VGASR1_SD);
-
-    vgacrb6 = AST_IO_VGACRB6_VSYNC_OFF |
-          AST_IO_VGACRB6_HSYNC_OFF;
-    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6);
+    vgacr17 &= ~AST_IO_VGACR17_SYNC_ENABLE;
+    ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x17, 0x7f, vgacr17);
         /*
        * HW cursors require the underlying primary plane and CRTC to
drivers/gpu/drm/ast/ast_reg.h +1 -0
index e15adaf3a80e..30578e3b07e4 100644
@@ -29,6 +29,7 @@
   #define AST_IO_VGAGRI            (0x4E)
     #define AST_IO_VGACRI            (0x54)
+#define AST_IO_VGACR17_SYNC_ENABLE    BIT(7) /* called "Hardware 

reset" in docs */
  #define AST_IO_VGACR80_PASSWORD        (0xa8) #define AST_IO_VGACR99_VGAMEM_RSRV_MASK    GENMASK(1, 0) #define AST_IO_VGACRA1_VGAIO_DISABLED    BIT(1)

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)