diff options
Diffstat (limited to 'drivers/gpu/drm/ast/ast_mode.c')
-rw-r--r-- | drivers/gpu/drm/ast/ast_mode.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index c25b8b06d55a..47b78e52691c 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c | |||
@@ -273,7 +273,11 @@ static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mod | |||
273 | { | 273 | { |
274 | struct ast_private *ast = crtc->dev->dev_private; | 274 | struct ast_private *ast = crtc->dev->dev_private; |
275 | u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0; | 275 | u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0; |
276 | u16 temp; | 276 | u16 temp, precache = 0; |
277 | |||
278 | if ((ast->chip == AST2500) && | ||
279 | (vbios_mode->enh_table->flags & AST2500PreCatchCRT)) | ||
280 | precache = 40; | ||
277 | 281 | ||
278 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00); | 282 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00); |
279 | 283 | ||
@@ -299,12 +303,12 @@ static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mod | |||
299 | jregAD |= 0x01; /* HBE D[5] */ | 303 | jregAD |= 0x01; /* HBE D[5] */ |
300 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x03, 0xE0, (temp & 0x1f)); | 304 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x03, 0xE0, (temp & 0x1f)); |
301 | 305 | ||
302 | temp = (mode->crtc_hsync_start >> 3) - 1; | 306 | temp = ((mode->crtc_hsync_start-precache) >> 3) - 1; |
303 | if (temp & 0x100) | 307 | if (temp & 0x100) |
304 | jregAC |= 0x40; /* HRS D[5] */ | 308 | jregAC |= 0x40; /* HRS D[5] */ |
305 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x04, 0x00, temp); | 309 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x04, 0x00, temp); |
306 | 310 | ||
307 | temp = ((mode->crtc_hsync_end >> 3) - 1) & 0x3f; | 311 | temp = (((mode->crtc_hsync_end-precache) >> 3) - 1) & 0x3f; |
308 | if (temp & 0x20) | 312 | if (temp & 0x20) |
309 | jregAD |= 0x04; /* HRE D[5] */ | 313 | jregAD |= 0x04; /* HRE D[5] */ |
310 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05)); | 314 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05)); |
@@ -365,6 +369,11 @@ static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mod | |||
365 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x09, 0xdf, jreg09); | 369 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x09, 0xdf, jreg09); |
366 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAE, 0x00, (jregAE | 0x80)); | 370 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAE, 0x00, (jregAE | 0x80)); |
367 | 371 | ||
372 | if (precache) | ||
373 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x80); | ||
374 | else | ||
375 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x00); | ||
376 | |||
368 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x80); | 377 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x80); |
369 | } | 378 | } |
370 | 379 | ||
@@ -386,12 +395,16 @@ static void ast_set_dclk_reg(struct drm_device *dev, struct drm_display_mode *mo | |||
386 | struct ast_private *ast = dev->dev_private; | 395 | struct ast_private *ast = dev->dev_private; |
387 | const struct ast_vbios_dclk_info *clk_info; | 396 | const struct ast_vbios_dclk_info *clk_info; |
388 | 397 | ||
389 | clk_info = &dclk_table[vbios_mode->enh_table->dclk_index]; | 398 | if (ast->chip == AST2500) |
399 | clk_info = &dclk_table_ast2500[vbios_mode->enh_table->dclk_index]; | ||
400 | else | ||
401 | clk_info = &dclk_table[vbios_mode->enh_table->dclk_index]; | ||
390 | 402 | ||
391 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc0, 0x00, clk_info->param1); | 403 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc0, 0x00, clk_info->param1); |
392 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc1, 0x00, clk_info->param2); | 404 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc1, 0x00, clk_info->param2); |
393 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xbb, 0x0f, | 405 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xbb, 0x0f, |
394 | (clk_info->param3 & 0x80) | ((clk_info->param3 & 0x3) << 4)); | 406 | (clk_info->param3 & 0xc0) | |
407 | ((clk_info->param3 & 0x3) << 4)); | ||
395 | } | 408 | } |
396 | 409 | ||
397 | static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode, | 410 | static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode, |
@@ -425,7 +438,8 @@ static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode | |||
425 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa8, 0xfd, jregA8); | 438 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa8, 0xfd, jregA8); |
426 | 439 | ||
427 | /* Set Threshold */ | 440 | /* Set Threshold */ |
428 | if (ast->chip == AST2300 || ast->chip == AST2400) { | 441 | if (ast->chip == AST2300 || ast->chip == AST2400 || |
442 | ast->chip == AST2500) { | ||
429 | ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78); | 443 | ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78); |
430 | ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60); | 444 | ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60); |
431 | } else if (ast->chip == AST2100 || | 445 | } else if (ast->chip == AST2100 || |
@@ -800,7 +814,9 @@ static int ast_mode_valid(struct drm_connector *connector, | |||
800 | if ((mode->hdisplay == 1600) && (mode->vdisplay == 900)) | 814 | if ((mode->hdisplay == 1600) && (mode->vdisplay == 900)) |
801 | return MODE_OK; | 815 | return MODE_OK; |
802 | 816 | ||
803 | if ((ast->chip == AST2100) || (ast->chip == AST2200) || (ast->chip == AST2300) || (ast->chip == AST2400) || (ast->chip == AST1180)) { | 817 | if ((ast->chip == AST2100) || (ast->chip == AST2200) || |
818 | (ast->chip == AST2300) || (ast->chip == AST2400) || | ||
819 | (ast->chip == AST2500) || (ast->chip == AST1180)) { | ||
804 | if ((mode->hdisplay == 1920) && (mode->vdisplay == 1080)) | 820 | if ((mode->hdisplay == 1920) && (mode->vdisplay == 1080)) |
805 | return MODE_OK; | 821 | return MODE_OK; |
806 | 822 | ||