aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ast/ast_mode.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/ast/ast_mode.c')
-rw-r--r--drivers/gpu/drm/ast/ast_mode.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 5e77d456d9bb..8bb355d5d43d 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -568,6 +568,7 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc,
568 } 568 }
569 ast_bo_unreserve(bo); 569 ast_bo_unreserve(bo);
570 570
571 ast_set_offset_reg(crtc);
571 ast_set_start_address_crt1(crtc, (u32)gpu_addr); 572 ast_set_start_address_crt1(crtc, (u32)gpu_addr);
572 573
573 return 0; 574 return 0;
@@ -972,9 +973,21 @@ static int get_clock(void *i2c_priv)
972{ 973{
973 struct ast_i2c_chan *i2c = i2c_priv; 974 struct ast_i2c_chan *i2c = i2c_priv;
974 struct ast_private *ast = i2c->dev->dev_private; 975 struct ast_private *ast = i2c->dev->dev_private;
975 uint32_t val; 976 uint32_t val, val2, count, pass;
977
978 count = 0;
979 pass = 0;
980 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
981 do {
982 val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
983 if (val == val2) {
984 pass++;
985 } else {
986 pass = 0;
987 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01;
988 }
989 } while ((pass < 5) && (count++ < 0x10000));
976 990
977 val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4;
978 return val & 1 ? 1 : 0; 991 return val & 1 ? 1 : 0;
979} 992}
980 993
@@ -982,9 +995,21 @@ static int get_data(void *i2c_priv)
982{ 995{
983 struct ast_i2c_chan *i2c = i2c_priv; 996 struct ast_i2c_chan *i2c = i2c_priv;
984 struct ast_private *ast = i2c->dev->dev_private; 997 struct ast_private *ast = i2c->dev->dev_private;
985 uint32_t val; 998 uint32_t val, val2, count, pass;
999
1000 count = 0;
1001 pass = 0;
1002 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01;
1003 do {
1004 val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01;
1005 if (val == val2) {
1006 pass++;
1007 } else {
1008 pass = 0;
1009 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01;
1010 }
1011 } while ((pass < 5) && (count++ < 0x10000));
986 1012
987 val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5;
988 return val & 1 ? 1 : 0; 1013 return val & 1 ? 1 : 0;
989} 1014}
990 1015
@@ -997,7 +1022,7 @@ static void set_clock(void *i2c_priv, int clock)
997 1022
998 for (i = 0; i < 0x10000; i++) { 1023 for (i = 0; i < 0x10000; i++) {
999 ujcrb7 = ((clock & 0x01) ? 0 : 1); 1024 ujcrb7 = ((clock & 0x01) ? 0 : 1);
1000 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfe, ujcrb7); 1025 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf4, ujcrb7);
1001 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01); 1026 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01);
1002 if (ujcrb7 == jtemp) 1027 if (ujcrb7 == jtemp)
1003 break; 1028 break;
@@ -1013,7 +1038,7 @@ static void set_data(void *i2c_priv, int data)
1013 1038
1014 for (i = 0; i < 0x10000; i++) { 1039 for (i = 0; i < 0x10000; i++) {
1015 ujcrb7 = ((data & 0x01) ? 0 : 1) << 2; 1040 ujcrb7 = ((data & 0x01) ? 0 : 1) << 2;
1016 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfb, ujcrb7); 1041 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf1, ujcrb7);
1017 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04); 1042 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04);
1018 if (ujcrb7 == jtemp) 1043 if (ujcrb7 == jtemp)
1019 break; 1044 break;
@@ -1254,7 +1279,7 @@ static int ast_cursor_move(struct drm_crtc *crtc,
1254 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07)); 1279 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07));
1255 1280
1256 /* dummy write to fire HWC */ 1281 /* dummy write to fire HWC */
1257 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xCB, 0xFF, 0x00); 1282 ast_show_cursor(crtc);
1258 1283
1259 return 0; 1284 return 0;
1260} 1285}