diff options
Diffstat (limited to 'drivers/video/via/lcd.c')
-rw-r--r-- | drivers/video/via/lcd.c | 75 |
1 files changed, 2 insertions, 73 deletions
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c index 2ab0f156439a..438a106c7a4b 100644 --- a/drivers/video/via/lcd.c +++ b/drivers/video/via/lcd.c | |||
@@ -75,8 +75,6 @@ static void check_diport_of_integrated_lvds( | |||
75 | static struct display_timing lcd_centering_timging(struct display_timing | 75 | static struct display_timing lcd_centering_timging(struct display_timing |
76 | mode_crt_reg, | 76 | mode_crt_reg, |
77 | struct display_timing panel_crt_reg); | 77 | struct display_timing panel_crt_reg); |
78 | static void viafb_load_scaling_factor_for_p4m900(int set_hres, | ||
79 | int set_vres, int panel_hres, int panel_vres); | ||
80 | 78 | ||
81 | static int check_lvds_chip(int device_id_subaddr, int device_id) | 79 | static int check_lvds_chip(int device_id_subaddr, int device_id) |
82 | { | 80 | { |
@@ -437,11 +435,6 @@ static void load_lcd_scaling(int set_hres, int set_vres, int panel_hres, | |||
437 | 435 | ||
438 | /* LCD Scaling Enable */ | 436 | /* LCD Scaling Enable */ |
439 | viafb_write_reg_mask(CR79, VIACR, 0x07, BIT0 + BIT1 + BIT2); | 437 | viafb_write_reg_mask(CR79, VIACR, 0x07, BIT0 + BIT1 + BIT2); |
440 | if (UNICHROME_P4M900 == viaparinfo->chip_info->gfx_chip_name) { | ||
441 | viafb_load_scaling_factor_for_p4m900(set_hres, set_vres, | ||
442 | panel_hres, panel_vres); | ||
443 | return; | ||
444 | } | ||
445 | 438 | ||
446 | /* Check if expansion for horizontal */ | 439 | /* Check if expansion for horizontal */ |
447 | if (set_hres != panel_hres) { | 440 | if (set_hres != panel_hres) { |
@@ -464,6 +457,7 @@ static void load_lcd_scaling(int set_hres, int set_vres, int panel_hres, | |||
464 | case UNICHROME_CX700: | 457 | case UNICHROME_CX700: |
465 | case UNICHROME_K8M890: | 458 | case UNICHROME_K8M890: |
466 | case UNICHROME_P4M890: | 459 | case UNICHROME_P4M890: |
460 | case UNICHROME_P4M900: | ||
467 | reg_value = | 461 | reg_value = |
468 | K800_LCD_HOR_SCF_FORMULA(set_hres, panel_hres); | 462 | K800_LCD_HOR_SCF_FORMULA(set_hres, panel_hres); |
469 | /* Horizontal scaling enabled */ | 463 | /* Horizontal scaling enabled */ |
@@ -503,6 +497,7 @@ static void load_lcd_scaling(int set_hres, int set_vres, int panel_hres, | |||
503 | case UNICHROME_CX700: | 497 | case UNICHROME_CX700: |
504 | case UNICHROME_K8M890: | 498 | case UNICHROME_K8M890: |
505 | case UNICHROME_P4M890: | 499 | case UNICHROME_P4M890: |
500 | case UNICHROME_P4M900: | ||
506 | reg_value = | 501 | reg_value = |
507 | K800_LCD_VER_SCF_FORMULA(set_vres, panel_vres); | 502 | K800_LCD_VER_SCF_FORMULA(set_vres, panel_vres); |
508 | /* Vertical scaling enabled */ | 503 | /* Vertical scaling enabled */ |
@@ -1139,69 +1134,3 @@ bool viafb_lcd_get_mobile_state(bool *mobile) | |||
1139 | return false; | 1134 | return false; |
1140 | } | 1135 | } |
1141 | } | 1136 | } |
1142 | |||
1143 | static void viafb_load_scaling_factor_for_p4m900(int set_hres, | ||
1144 | int set_vres, int panel_hres, int panel_vres) | ||
1145 | { | ||
1146 | int h_scaling_factor; | ||
1147 | int v_scaling_factor; | ||
1148 | u8 cra2 = 0; | ||
1149 | u8 cr77 = 0; | ||
1150 | u8 cr78 = 0; | ||
1151 | u8 cr79 = 0; | ||
1152 | u8 cr9f = 0; | ||
1153 | /* Check if expansion for horizontal */ | ||
1154 | if (set_hres < panel_hres) { | ||
1155 | /* Load Horizontal Scaling Factor */ | ||
1156 | |||
1157 | /* For VIA_K8M800 or later chipsets. */ | ||
1158 | h_scaling_factor = | ||
1159 | K800_LCD_HOR_SCF_FORMULA(set_hres, panel_hres); | ||
1160 | /* HSCaleFactor[1:0] at CR9F[1:0] */ | ||
1161 | cr9f = h_scaling_factor & 0x0003; | ||
1162 | /* HSCaleFactor[9:2] at CR77[7:0] */ | ||
1163 | cr77 = (h_scaling_factor & 0x03FC) >> 2; | ||
1164 | /* HSCaleFactor[11:10] at CR79[5:4] */ | ||
1165 | cr79 = (h_scaling_factor & 0x0C00) >> 10; | ||
1166 | cr79 <<= 4; | ||
1167 | |||
1168 | /* Horizontal scaling enabled */ | ||
1169 | cra2 = 0xC0; | ||
1170 | |||
1171 | DEBUG_MSG(KERN_INFO "Horizontal Scaling value = %d\n", | ||
1172 | h_scaling_factor); | ||
1173 | } else { | ||
1174 | /* Horizontal scaling disabled */ | ||
1175 | cra2 = 0x00; | ||
1176 | } | ||
1177 | |||
1178 | /* Check if expansion for vertical */ | ||
1179 | if (set_vres < panel_vres) { | ||
1180 | /* Load Vertical Scaling Factor */ | ||
1181 | |||
1182 | /* For VIA_K8M800 or later chipsets. */ | ||
1183 | v_scaling_factor = | ||
1184 | K800_LCD_VER_SCF_FORMULA(set_vres, panel_vres); | ||
1185 | |||
1186 | /* Vertical scaling enabled */ | ||
1187 | cra2 |= 0x08; | ||
1188 | /* VSCaleFactor[0] at CR79[3] */ | ||
1189 | cr79 |= ((v_scaling_factor & 0x0001) << 3); | ||
1190 | /* VSCaleFactor[8:1] at CR78[7:0] */ | ||
1191 | cr78 |= (v_scaling_factor & 0x01FE) >> 1; | ||
1192 | /* VSCaleFactor[10:9] at CR79[7:6] */ | ||
1193 | cr79 |= ((v_scaling_factor & 0x0600) >> 9) << 6; | ||
1194 | |||
1195 | DEBUG_MSG(KERN_INFO "Vertical Scaling value = %d\n", | ||
1196 | v_scaling_factor); | ||
1197 | } else { | ||
1198 | /* Vertical scaling disabled */ | ||
1199 | cra2 |= 0x00; | ||
1200 | } | ||
1201 | |||
1202 | viafb_write_reg_mask(CRA2, VIACR, cra2, BIT3 + BIT6 + BIT7); | ||
1203 | viafb_write_reg_mask(CR77, VIACR, cr77, 0xFF); | ||
1204 | viafb_write_reg_mask(CR78, VIACR, cr78, 0xFF); | ||
1205 | viafb_write_reg_mask(CR79, VIACR, cr79, 0xF8); | ||
1206 | viafb_write_reg_mask(CR9F, VIACR, cr9f, BIT0 + BIT1); | ||
1207 | } | ||