Skip to contentSkip to conversation

drm/ast: Fix video broken in some resolutions on ast2600

PATCH In review Jammy Huang 2 participants 3 messages Sep 16, 2022 – Sep 20, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ast: Fix video broken in some resolutions on ast2600

Some cases are not handled well for ast2600.

---
 drivers/gpu/drm/ast/ast_mode.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +8 -2
index d327dcbaf032..be9bbc888ac3 100644
@@ -314,7 +314,7 @@ static void ast_set_crtc_reg(struct ast_private *ast,
 	u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0;
 	u16 temp, precache = 0;
 
-	if ((ast->chip == AST2500) &&
+	if ((ast->chip == AST2500 || ast->chip == AST2600) &&
 	    (vbios_mode->enh_table->flags & AST2500PreCatchCRT))
 		precache = 40;
 
@@ -355,6 +355,12 @@ static void ast_set_crtc_reg(struct ast_private *ast,
 	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC);
 	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD);
 
+	// Workaround for HSync Time non octave pixels (1920x1080@60Hz HSync 44 pixels);
+	if ((ast->chip == AST2600) && (mode->crtc_vdisplay == 1080))
+		ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xFC, 0xFD, 0x02);
+	else
+		ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xFC, 0xFD, 0x00);
+
 	/* vert timings */
 	temp = (mode->crtc_vtotal) - 2;
 	if (temp & 0x100)
@@ -432,7 +438,7 @@ static void ast_set_dclk_reg(struct ast_private *ast,
 {
 	const struct ast_vbios_dclk_info *clk_info;
 
-	if (ast->chip == AST2500)
+	if ((ast->chip == AST2500) || (ast->chip == AST2600))
 		clk_info = &dclk_table_ast2500[vbios_mode->enh_table->dclk_index];
 	else
 		clk_info = &dclk_table[vbios_mode->enh_table->dclk_index];
Signature · 1 line
2.25.1
#1 lore raw

Hi

Am 16.09.22 um 11:17 schrieb Jammy Huang:

Quoted 21 lines

Some cases are not handled well for ast2600.

---
  drivers/gpu/drm/ast/ast_mode.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +1 -1
index d327dcbaf032..be9bbc888ac3 100644
@@ -314,7 +314,7 @@ static void ast_set_crtc_reg(struct ast_private *ast,
  	u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0;
  	u16 temp, precache = 0;
 
-	if ((ast->chip == AST2500) &&
+	if ((ast->chip == AST2500 || ast->chip == AST2600) &&
  	    (vbios_mode->enh_table->flags & AST2500PreCatchCRT))
  		precache = 40;
 

drivers/gpu/drm/ast/ast_mode.c static void ast_set_crtc_reg(struct ast_private *ast, · line 358

Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c +1 -0
@@ -355,6 +355,12 @@ static void ast_set_crtc_reg(struct ast_private *ast,
  	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC);
  	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD);
 
+	// Workaround for HSync Time non octave pixels (1920x1080@60Hz HSync 44 pixels);

Applied to drm-misc-next, but what is an 'octave pixel'?

Best regards
Thomas

Quoted 17 lines
drivers/gpu/drm/ast/ast_mode.c +6 -1
+	if ((ast->chip == AST2600) && (mode->crtc_vdisplay == 1080))
+		ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xFC, 0xFD, 0x02);
+	else
+		ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xFC, 0xFD, 0x00);
+
  	/* vert timings */
  	temp = (mode->crtc_vtotal) - 2;
  	if (temp & 0x100)
@@ -432,7 +438,7 @@ static void ast_set_dclk_reg(struct ast_private *ast,
  {
  	const struct ast_vbios_dclk_info *clk_info;
 
-	if (ast->chip == AST2500)
+	if ((ast->chip == AST2500) || (ast->chip == AST2600))
  		clk_info = &dclk_table_ast2500[vbios_mode->enh_table->dclk_index];
  	else
  		clk_info = &dclk_table[vbios_mode->enh_table->dclk_index];
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
#2 lore raw

Hi Thomas,

Quoted 20 lines · Thomas Zimmermann

Hi

Am 16.09.22 um 11:17 schrieb Jammy Huang:

Quoted 17 lines

Some cases are not handled well for ast2600.

---
  drivers/gpu/drm/ast/ast_mode.c | 10 ++++++++--

  1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +0 -0
index d327dcbaf032..be9bbc888ac3 100644
@@ -314,7 +314,7 @@ static void ast_set_crtc_reg(struct ast_private 
 *ast,
       u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0;
       u16 temp, precache = 0;

  -    if ((ast->chip == AST2500) &&
+    if ((ast->chip == AST2500 || ast->chip == AST2600) &&

Quoted 8 lines
Quoted 6 lines

          (vbios_mode->enh_table->flags & AST2500PreCatchCRT))
          precache = 40;
  @@ -355,6 +355,12 @@ static void ast_set_crtc_reg(struct ast_private *ast, ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC); ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD); +    // Workaround for HSync Time non octave pixels (1920x1080@60Hz HSync 44 pixels);

Applied to drm-misc-next, but what is an 'octave pixel'?

It means to make the pixel number a multiple of 8.

Quoted 24 lines

Best regards
Thomas

Quoted 19 lines

+    if ((ast->chip == AST2600) && (mode->crtc_vdisplay == 1080)) +        ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xFC, 0xFD, 0x02);
+    else
+        ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xFC, 0xFD, 0x00);
+
      /* vert timings */
      temp = (mode->crtc_vtotal) - 2;
      if (temp & 0x100)

drivers/gpu/drm/ast/ast_mode.c +1 -0
@@ -432,7 +438,7 @@ static void ast_set_dclk_reg(struct ast_private 
 *ast,
   {
       const struct ast_vbios_dclk_info *clk_info;
   -    if (ast->chip == AST2500)
+    if ((ast->chip == AST2500) || (ast->chip == AST2600))
           clk_info = &dclk_table_ast2500[vbios_mode->enh_table->dclk_index];

      else
          clk_info = &dclk_table[vbios_mode->enh_table->dclk_index];

Signature · 2 lines
Best Regards
Jammy