viafb modesetting update 1
cover viafb modesetting update 1
Hi all,
this is the first series containing some stable patches of my modesetting work. Adding the functions for setting the timing parameters in via_modesetting is an important step as well as pushing the strange behaviour that sync end and blanking end contained the length and not the end value one level up. Additionally it has some related cleanups.
All this should be relatively stable, is not expected to cause regressions and was tested on CLE266, VX800 and VX855. These patches will show up in linux-next after the merge window is closed.
The next step will be to limit the influence of the modetable and hopefully replace parts of it by things provided in the subsystem to get rid of some bugs.
Thanks,
Florian Tobias Schandinat
Florian Tobias Schandinat (6):
viafb: use more compact modesetting functions
viafb: kill viafb_load_crtc_timing
viafb: remove superfluous register unlocking/locking
viafb: remove superfluous mode lookup
viafb: simplify viafb_fill_crtc_timing
viafb: remove 640x480-60 CRT special case
drivers/video/via/dvi.c | 6 +- drivers/video/via/hw.c | 341 ++--------------------------------- drivers/video/via/hw.h | 277 +---------------------------- drivers/video/via/lcd.c | 41 ++--- drivers/video/via/lcd.h | 2 - drivers/video/via/share.h | 19 +-- drivers/video/via/via_modesetting.c | 104 +++++++++++ drivers/video/via/via_modesetting.h | 18 ++ drivers/video/via/viafbdev.c | 2 - drivers/video/via/viamode.c | 2 +- 10 files changed, 161 insertions(+), 651 deletions(-)
PATCH 1/6 viafb: use more compact modesetting functions
This patch replaces the old timing setup code with a redesigned one. The new code might be slightly faster as it has no conditinals and does not write the same register multiple times. Also it makes the comparison to the documentation easier.
Regressions are unlikely but could happen as a lot of hardware is undocumented.
drivers/video/via/hw.c | 296 +---------------------------------- drivers/video/via/hw.h | 273 -------------------------------- drivers/video/via/share.h | 19 +-- drivers/video/via/via_modesetting.c | 100 ++++++++++++ drivers/video/via/via_modesetting.h | 18 ++ 5 files changed, 128 insertions(+), 578 deletions(-)
Signature · 1 line
1.6.3.2
PATCH 2/6 viafb: kill viafb_load_crtc_timing
In reply to Florian Tobias SchandinatThis patch replaces calls to viafb_load_crtc_timing with the code. This should make it easier to fix the oddity that in the modetable the blank and sync end entries contain the length and we need to add the start values to get those to be written to the hardware.
drivers/video/via/hw.c | 30 ++++++++---------------------- drivers/video/via/lcd.c | 41 +++++++++++++++++++---------------------- drivers/video/via/lcd.h | 2 -- 3 files changed, 27 insertions(+), 46 deletions(-)
Signature · 1 line
1.6.3.2
PATCH 3/6 viafb: remove superfluous register unlocking/locking
In reply to Florian Tobias SchandinatThe locking is done within the viafb_set_*_timing functions so there is no need to do it here. Move a missing hardware reset into the modesetting function.
drivers/video/via/hw.c | 7 ------- drivers/video/via/via_modesetting.c | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-)
Signature · 1 line
1.6.3.2
PATCH 4/6 viafb: remove superfluous mode lookup
In reply to Florian Tobias SchandinatAs the result is not used anywhere there is no need to perform the lookup at all.
drivers/video/via/viafbdev.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
Signature · 1 line
1.6.3.2
PATCH 5/6 viafb: simplify viafb_fill_crtc_timing
In reply to Florian Tobias SchandinatAs the first argument is just part of the structure passed as the second argument there is no need for it at all.
drivers/video/via/dvi.c | 6 ++---- drivers/video/via/hw.c | 12 ++++++------ drivers/video/via/hw.h | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-)
Signature · 1 line
1.6.3.2
PATCH 6/6 viafb: remove 640x480-60 CRT special case
In reply to Florian Tobias SchandinatThe timing for 640x480-60 was handled different than all others. This patch changes this by changing the blanking start and end. The reason for this is that I can't find any reason for the old behaviour and it was not consistent anyway as the special case for LCD did not always trigger as the LCD code does not use this function and it did trigger regardless of whether the display set is CRT or LCD but only based whether any DVI/LCD device exists. There are no negative effects observed for CRT or DVI devices.
drivers/video/via/hw.c | 14 -------------- drivers/video/via/viamode.c | 2 +- 2 files changed, 1 insertions(+), 15 deletions(-)
Signature · 1 line
1.6.3.2
PATCH 1/6 viafb: use more compact modesetting functions
In reply to Florian Tobias SchandinatThis patch replaces the old timing setup code with a redesigned one. The new code might be slightly faster as it has no conditinals and does not write the same register multiple times. Also it makes the comparison to the documentation easier.
Regressions are unlikely but could happen as a lot of hardware is undocumented.
--- drivers/video/via/hw.c | 296 +---------------------------------- drivers/video/via/hw.h | 273 -------------------------------- drivers/video/via/share.h | 19 +-- drivers/video/via/via_modesetting.c | 100 ++++++++++++ drivers/video/via/via_modesetting.h | 18 ++ 5 files changed, 128 insertions(+), 578 deletions(-)
drivers/video/via/hw.c +8 -239
@@ -191,67 +191,6 @@ static struct fetch_count fetch_count_reg = { {IGA2_FETCH_COUNT_REG_NUM, {{CR65, 0, 7}, {CR67, 2, 3} } } }; -static struct iga1_crtc_timing iga1_crtc_reg = { -/* IGA1 Horizontal Total */ - {IGA1_HOR_TOTAL_REG_NUM , {{CR00 ,0 ,7 }, {CR36 ,3 ,3 } } }, -/* IGA1 Horizontal Addressable Video */ - {IGA1_HOR_ADDR_REG_NUM , {{CR01 ,0 ,7 } } }, -/* IGA1 Horizontal Blank Start */ - {IGA1_HOR_BLANK_START_REG_NUM , {{CR02 ,0 ,7 } } }, -/* IGA1 Horizontal Blank End */ - {IGA1_HOR_BLANK_END_REG_NUM , - {{CR03 ,0 ,4 }, {CR05 ,7 ,7 }, {CR33 ,5 ,5 } } }, -/* IGA1 Horizontal Sync Start */ - {IGA1_HOR_SYNC_START_REG_NUM , {{CR04 ,0 ,7 }, {CR33 ,4 ,4 } } }, -/* IGA1 Horizontal Sync End */ - {IGA1_HOR_SYNC_END_REG_NUM , {{CR05 ,0 ,4 } } }, -/* IGA1 Vertical Total */ - {IGA1_VER_TOTAL_REG_NUM , - {{CR06 ,0 ,7 }, {CR07 ,0 ,0 }, {CR07 ,5 ,5 }, {CR35 ,0 ,0 } } }, -/* IGA1 Vertical Addressable Video */ - {IGA1_VER_ADDR_REG_NUM , - {{CR12 ,0 ,7 }, {CR07 ,1 ,1 }, {CR07 ,6 ,6 }, {CR35 ,2 ,2 } } }, -/* IGA1 Vertical Blank Start */ - {IGA1_VER_BLANK_START_REG_NUM , - {{CR15 ,0 ,7 }, {CR07 ,3 ,3 }, {CR09 ,5 ,5 }, {CR35 ,3 ,3 } } }, -/* IGA1 Vertical Blank End */ - {IGA1_VER_BLANK_END_REG_NUM , {{CR16 ,0 ,7 } } }, -/* IGA1 Vertical Sync Start */ - {IGA1_VER_SYNC_START_REG_NUM , - {{CR10 ,0 ,7 }, {CR07 ,2 ,2 }, {CR07 ,7 ,7 }, {CR35 ,1 ,1 } } }, -/* IGA1 Vertical Sync End */ - {IGA1_VER_SYNC_END_REG_NUM , {{CR11 ,0 ,3 } } } -}; - -static struct iga2_crtc_timing iga2_crtc_reg = { -/* IGA2 Horizontal Total */ - {IGA2_HOR_TOTAL_REG_NUM , {{CR50 ,0 ,7 }, {CR55 ,0 ,3 } } }, -/* IGA2 Horizontal Addressable Video */ - {IGA2_HOR_ADDR_REG_NUM , {{CR51 ,0 ,7 }, {CR55 ,4 ,6 } } }, -/* IGA2 Horizontal Blank Start */ - {IGA2_HOR_BLANK_START_REG_NUM , {{CR52 ,0 ,7 }, {CR54 ,0 ,2 } } }, -/* IGA2 Horizontal Blank End */ - {IGA2_HOR_BLANK_END_REG_NUM , - {{CR53 ,0 ,7 }, {CR54 ,3 ,5 }, {CR5D ,6 ,6 } } }, -/* IGA2 Horizontal Sync Start */ - {IGA2_HOR_SYNC_START_REG_NUM , - {{CR56 ,0 ,7 }, {CR54 ,6 ,7 }, {CR5C ,7 ,7 }, {CR5D ,7 ,7 } } }, -/* IGA2 Horizontal Sync End */ - {IGA2_HOR_SYNC_END_REG_NUM , {{CR57 ,0 ,7 }, {CR5C ,6 ,6 } } }, -/* IGA2 Vertical Total */ - {IGA2_VER_TOTAL_REG_NUM , {{CR58 ,0 ,7 }, {CR5D ,0 ,2 } } }, -/* IGA2 Vertical Addressable Video */ - {IGA2_VER_ADDR_REG_NUM , {{CR59 ,0 ,7 }, {CR5D ,3 ,5 } } }, -/* IGA2 Vertical Blank Start */ - {IGA2_VER_BLANK_START_REG_NUM , {{CR5A ,0 ,7 }, {CR5C ,0 ,2 } } }, -/* IGA2 Vertical Blank End */ - {IGA2_VER_BLANK_END_REG_NUM , {{CR5B ,0 ,7 }, {CR5C ,3 ,5 } } }, -/* IGA2 Vertical Sync Start */ - {IGA2_VER_SYNC_START_REG_NUM , {{CR5E ,0 ,7 }, {CR5F ,5 ,7 } } }, -/* IGA2 Vertical Sync End */ - {IGA2_VER_SYNC_END_REG_NUM , {{CR5F ,0 ,4 } } } -}; -static struct rgbLUT palLUT_table[] = {/* {R,G,B} */ /* Index 0x00~0x03 */
@@ -1531,234 +1470,15 @@ void viafb_set_vclock(u32 clk, int set_iga)void viafb_load_crtc_timing (struct display_timing device_timing,int set_iga) { -int i; -int viafb_load_reg_num =0 ; -int reg_value =0 ; -struct io_register *reg =NULL ; - -viafb_unlock_crt (); - -for (i =0 ; i <12 ; i++) { -if (set_iga =IGA1 ) { -switch (i) { -case H_TOTAL_INDEX : - reg_value -IGA1_HOR_TOTAL_FORMULA (device_timing. - hor_total); - viafb_load_reg_num - iga1_crtc_reg.hor_total.reg_num; - reg = iga1_crtc_reg.hor_total.reg; -break ; -case H_ADDR_INDEX : - reg_value -IGA1_HOR_ADDR_FORMULA (device_timing. - hor_addr); - viafb_load_reg_num - iga1_crtc_reg.hor_addr.reg_num; - reg = iga1_crtc_reg.hor_addr.reg; -break ; -case H_BLANK_START_INDEX : - reg_value -IGA1_HOR_BLANK_START_FORMULA - (device_timing.hor_blank_start); - viafb_load_reg_num - iga1_crtc_reg.hor_blank_start.reg_num; - reg = iga1_crtc_reg.hor_blank_start.reg; -break ; -case H_BLANK_END_INDEX : - reg_value -IGA1_HOR_BLANK_END_FORMULA - (device_timing.hor_blank_start, - device_timing.hor_blank_end); - viafb_load_reg_num - iga1_crtc_reg.hor_blank_end.reg_num; - reg = iga1_crtc_reg.hor_blank_end.reg; -break ; -case H_SYNC_START_INDEX : - reg_value -IGA1_HOR_SYNC_START_FORMULA - (device_timing.hor_sync_start); - viafb_load_reg_num - iga1_crtc_reg.hor_sync_start.reg_num; - reg = iga1_crtc_reg.hor_sync_start.reg; -break ; -case H_SYNC_END_INDEX : - reg_value -IGA1_HOR_SYNC_END_FORMULA - (device_timing.hor_sync_start, - device_timing.hor_sync_end); - viafb_load_reg_num - iga1_crtc_reg.hor_sync_end.reg_num; - reg = iga1_crtc_reg.hor_sync_end.reg; -break ; -case V_TOTAL_INDEX : - reg_value -IGA1_VER_TOTAL_FORMULA (device_timing. - ver_total); - viafb_load_reg_num - iga1_crtc_reg.ver_total.reg_num; - reg = iga1_crtc_reg.ver_total.reg; -break ; -case V_ADDR_INDEX : - reg_value -IGA1_VER_ADDR_FORMULA (device_timing. - ver_addr); - viafb_load_reg_num - iga1_crtc_reg.ver_addr.reg_num; - reg = iga1_crtc_reg.ver_addr.reg; -break ; -case V_BLANK_START_INDEX : - reg_value -IGA1_VER_BLANK_START_FORMULA - (device_timing.ver_blank_start); - viafb_load_reg_num - iga1_crtc_reg.ver_blank_start.reg_num; - reg = iga1_crtc_reg.ver_blank_start.reg; -break ; -case V_BLANK_END_INDEX : - reg_value -IGA1_VER_BLANK_END_FORMULA - (device_timing.ver_blank_start, - device_timing.ver_blank_end); - viafb_load_reg_num - iga1_crtc_reg.ver_blank_end.reg_num; - reg = iga1_crtc_reg.ver_blank_end.reg; -break ; -case V_SYNC_START_INDEX : - reg_value -IGA1_VER_SYNC_START_FORMULA - (device_timing.ver_sync_start); - viafb_load_reg_num - iga1_crtc_reg.ver_sync_start.reg_num; - reg = iga1_crtc_reg.ver_sync_start.reg; -break ; -case V_SYNC_END_INDEX : - reg_value -IGA1_VER_SYNC_END_FORMULA - (device_timing.ver_sync_start, - device_timing.ver_sync_end); - viafb_load_reg_num - iga1_crtc_reg.ver_sync_end.reg_num; - reg = iga1_crtc_reg.ver_sync_end.reg; -break ; - - } - } - -if (set_iga =IGA2 ) { -switch (i) { -case H_TOTAL_INDEX : - reg_value -IGA2_HOR_TOTAL_FORMULA (device_timing. - hor_total); - viafb_load_reg_num - iga2_crtc_reg.hor_total.reg_num; - reg = iga2_crtc_reg.hor_total.reg; -break ; -case H_ADDR_INDEX : - reg_value -IGA2_HOR_ADDR_FORMULA (device_timing. - hor_addr); - viafb_load_reg_num - iga2_crtc_reg.hor_addr.reg_num; - reg = iga2_crtc_reg.hor_addr.reg; -break ; -case H_BLANK_START_INDEX : - reg_value -IGA2_HOR_BLANK_START_FORMULA - (device_timing.hor_blank_start); - viafb_load_reg_num - iga2_crtc_reg.hor_blank_start.reg_num; - reg = iga2_crtc_reg.hor_blank_start.reg; -break ; -case H_BLANK_END_INDEX : - reg_value -IGA2_HOR_BLANK_END_FORMULA - (device_timing.hor_blank_start, - device_timing.hor_blank_end); - viafb_load_reg_num - iga2_crtc_reg.hor_blank_end.reg_num; - reg = iga2_crtc_reg.hor_blank_end.reg; -break ; -case H_SYNC_START_INDEX : - reg_value -IGA2_HOR_SYNC_START_FORMULA - (device_timing.hor_sync_start); -if (UNICHROME_CN700 <- viaparinfo->chip_info->gfx_chip_name) - viafb_load_reg_num - iga2_crtc_reg.hor_sync_start. - reg_num; -else - viafb_load_reg_num =3 ; - reg = iga2_crtc_reg.hor_sync_start.reg; -break ; -case H_SYNC_END_INDEX : - reg_value -IGA2_HOR_SYNC_END_FORMULA - (device_timing.hor_sync_start, - device_timing.hor_sync_end); - viafb_load_reg_num - iga2_crtc_reg.hor_sync_end.reg_num; - reg = iga2_crtc_reg.hor_sync_end.reg; -break ; -case V_TOTAL_INDEX : - reg_value -IGA2_VER_TOTAL_FORMULA (device_timing. - ver_total); - viafb_load_reg_num - iga2_crtc_reg.ver_total.reg_num; - reg = iga2_crtc_reg.ver_total.reg; -break ; -case V_ADDR_INDEX : - reg_value -IGA2_VER_ADDR_FORMULA (device_timing. - ver_addr); - viafb_load_reg_num - iga2_crtc_reg.ver_addr.reg_num; - reg = iga2_crtc_reg.ver_addr.reg; -break ; -case V_BLANK_START_INDEX : - reg_value -IGA2_VER_BLANK_START_FORMULA - (device_timing.ver_blank_start); - viafb_load_reg_num - iga2_crtc_reg.ver_blank_start.reg_num; - reg = iga2_crtc_reg.ver_blank_start.reg; -break ; -case V_BLANK_END_INDEX : - reg_value -IGA2_VER_BLANK_END_FORMULA - (device_timing.ver_blank_start, - device_timing.ver_blank_end); - viafb_load_reg_num - iga2_crtc_reg.ver_blank_end.reg_num; - reg = iga2_crtc_reg.ver_blank_end.reg; -break ; -case V_SYNC_START_INDEX : - reg_value -IGA2_VER_SYNC_START_FORMULA - (device_timing.ver_sync_start); - viafb_load_reg_num - iga2_crtc_reg.ver_sync_start.reg_num; - reg = iga2_crtc_reg.ver_sync_start.reg; -break ; -case V_SYNC_END_INDEX : - reg_value -IGA2_VER_SYNC_END_FORMULA - (device_timing.ver_sync_start, - device_timing.ver_sync_end); - viafb_load_reg_num - iga2_crtc_reg.ver_sync_end.reg_num; - reg = iga2_crtc_reg.ver_sync_end.reg; -break ; + device_timing.hor_blank_end += device_timing.hor_blank_start; + device_timing.hor_sync_end += device_timing.hor_sync_start; + device_timing.ver_blank_end += device_timing.ver_blank_start; + device_timing.ver_sync_end += device_timing.ver_sync_start; - } - } -viafb_load_reg (reg_value, viafb_load_reg_num, reg,VIACR ); - } - -viafb_lock_crt (); +if (set_iga =IGA1 ) +via_set_primary_timing (&device_timing); +else if (set_iga =IGA2 ) +via_set_secondary_timing (&device_timing); } void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
drivers/video/via/hw.h +0 -273
321 lines not on this page · raw message
drivers/video/via/share.h +2 -17
@@ -22,6 +22,8 @@#ifndef __SHARE_H__#define __SHARE_H__ +#include "via_modesetting.h" +/* Define Bit Field */ #define BIT0 0x01#define BIT1 0x02
@@ -648,23 +650,6 @@#define LCD_OPENLDI 0x00#define LCD_SPWG 0x01 -/* Define display timing -*/ -struct display_timing { -u16 hor_total; -u16 hor_addr; -u16 hor_blank_start; -u16 hor_blank_end; -u16 hor_sync_start; -u16 hor_sync_end; -u16 ver_total; -u16 ver_addr; -u16 ver_blank_start; -u16 ver_blank_end; -u16 ver_sync_start; -u16 ver_sync_end; -}; -struct crt_mode_table {int refresh_rate;int h_sync_polarity;
drivers/video/via/via_modesetting.c +100 -0
106 lines not on this page · raw message
drivers/video/via/via_modesetting.h +18 -0
@@ -33,6 +33,24 @@#define VIA_PITCH_MAX 0x3FF8 +struct display_timing { +u16 hor_total; +u16 hor_addr; +u16 hor_blank_start; +u16 hor_blank_end; +u16 hor_sync_start; +u16 hor_sync_end; +u16 ver_total; +u16 ver_addr; +u16 ver_blank_start; +u16 ver_blank_end; +u16 ver_sync_start; +u16 ver_sync_end; +}; + + +void via_set_primary_timing (const struct display_timing *timing); +void via_set_secondary_timing (const struct display_timing *timing);void via_set_primary_address (u32 addr);void via_set_secondary_address (u32 addr);void via_set_primary_pitch (u32 pitch);
Signature · 1 line
1.6.3.2
PATCH 2/6 viafb: kill viafb_load_crtc_timing
In reply to Florian Tobias SchandinatThis patch replaces calls to viafb_load_crtc_timing with the code. This should make it easier to fix the oddity that in the modetable the blank and sync end entries contain the length and we need to add the start values to get those to be written to the hardware.
--- drivers/video/via/hw.c | 30 ++++++++---------------------- drivers/video/via/lcd.c | 41 +++++++++++++++++++---------------------- drivers/video/via/lcd.h | 2 -- 3 files changed, 27 insertions(+), 46 deletions(-)
drivers/video/via/hw.c +8 -22
@@ -1467,20 +1467,6 @@ void viafb_set_vclock(u32 clk, int set_iga)via_write_misc_reg_mask (0x0C ,0x0C );/* select external clock */ } -void viafb_load_crtc_timing (struct display_timing device_timing, -int set_iga) -{ - device_timing.hor_blank_end += device_timing.hor_blank_start; - device_timing.hor_sync_end += device_timing.hor_sync_start; - device_timing.ver_blank_end += device_timing.ver_blank_start; - device_timing.ver_sync_end += device_timing.ver_sync_start; - -if (set_iga =IGA1 ) -via_set_primary_timing (&device_timing); -else if (set_iga =IGA2 ) -via_set_secondary_timing (&device_timing); -} -void viafb_fill_crtc_timing (struct crt_mode_table *crt_table,struct VideoModeTable *video_mode,int bpp_byte,int set_iga) {
@@ -1515,6 +1501,10 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table, crt_reg.hor_blank_end = crt_reg.hor_blank_end +16 ; } + crt_reg.hor_blank_end += crt_reg.hor_blank_start; + crt_reg.hor_sync_end += crt_reg.hor_sync_start; + crt_reg.ver_blank_end += crt_reg.ver_blank_start; + crt_reg.ver_sync_end += crt_reg.ver_sync_start; h_addr = crt_reg.hor_addr; v_addr = crt_reg.ver_addr;if (set_iga =IGA1 ) {
@@ -1522,14 +1512,10 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,viafb_write_reg_mask (CR17 ,VIACR ,0x00 ,BIT7 ); } -switch (set_iga) { -case IGA1 : -viafb_load_crtc_timing (crt_reg,IGA1 ); -break ; -case IGA2 : -viafb_load_crtc_timing (crt_reg,IGA2 ); -break ; - } +if (set_iga =IGA1 ) +via_set_primary_timing (&crt_reg); +else if (set_iga =IGA2 ) +via_set_secondary_timing (&crt_reg);viafb_lock_crt ();viafb_write_reg_mask (CR17 ,VIACR ,0x80 ,BIT7 );
drivers/video/via/lcd.c +19 -22
57 lines not on this page · raw message
drivers/video/via/lcd.h +0 -2
@@ -85,7 +85,5 @@ void viafb_init_lvds_output_interface(struct lvds_chip_informationstruct lvds_setting_information *plvds_setting_info);bool viafb_lcd_get_mobile_state (bool *mobile); -void viafb_load_crtc_timing (struct display_timing device_timing, -int set_iga);#endif /* __LCD_H__ */
Signature · 1 line
1.6.3.2
PATCH 3/6 viafb: remove superfluous register unlocking/locking
In reply to Florian Tobias SchandinatThe locking is done within the viafb_set_*_timing functions so there is no need to do it here. Move a missing hardware reset into the modesetting function.
--- drivers/video/via/hw.c | 7 ------- drivers/video/via/via_modesetting.c | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/video/via/hw.c +0 -7
@@ -1507,18 +1507,11 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table, crt_reg.ver_sync_end += crt_reg.ver_sync_start; h_addr = crt_reg.hor_addr; v_addr = crt_reg.ver_addr; -if (set_iga =IGA1 ) { -viafb_unlock_crt (); -viafb_write_reg_mask (CR17 ,VIACR ,0x00 ,BIT7 ); - } -if (set_iga =IGA1 )via_set_primary_timing (&crt_reg);else if (set_iga =IGA2 )via_set_secondary_timing (&crt_reg); -viafb_lock_crt (); -viafb_write_reg_mask (CR17 ,VIACR ,0x80 ,BIT7 );viafb_load_fetch_count_reg (h_addr, bpp_byte, set_iga);/* load FIFO */
drivers/video/via/via_modesetting.c +4 -0
@@ -82,6 +82,10 @@ void via_set_primary_timing(const struct display_timing *timing)/* lock timing registers */ via_write_reg_mask (VIACR ,0x11 ,0x80 ,0x80 ); + +/* reset timing control */ +via_write_reg_mask (VIACR ,0x17 ,0x00 ,0x80 ); +via_write_reg_mask (VIACR ,0x17 ,0x80 ,0x80 ); }void via_set_secondary_timing (const struct display_timing *timing)
Signature · 1 line
1.6.3.2
PATCH 4/6 viafb: remove superfluous mode lookup
In reply to Florian Tobias SchandinatAs the result is not used anywhere there is no need to perform the lookup at all.
--- drivers/video/via/viafbdev.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/video/via/viafbdev.c +0 -2
@@ -1735,7 +1735,6 @@ static struct viafb_pm_hooks viafb_fb_pm_hooks = {int __devinit via_fb_pci_probe (struct viafb_dev *vdev) {u32 default_xres, default_yres; -struct VideoModeTable *vmode_entry;struct fb_var_screeninfo default_var;int rc;u32 viafb_par_length;
@@ -1808,7 +1807,6 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev) }parse_mode (viafb_mode, &default_xres, &default_yres); - vmode_entry =viafb_get_mode (default_xres, default_yres);if (viafb_SAMM_ON =1 )parse_mode (viafb_mode1, &viafb_second_xres, &viafb_second_yres);
Signature · 1 line
1.6.3.2
PATCH 5/6 viafb: simplify viafb_fill_crtc_timing
In reply to Florian Tobias SchandinatAs the first argument is just part of the structure passed as the second argument there is no need for it at all.
--- drivers/video/via/dvi.c | 6 ++---- drivers/video/via/hw.c | 12 ++++++------ drivers/video/via/hw.h | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-)
drivers/video/via/dvi.c +2 -4
@@ -190,12 +190,10 @@ void viafb_dvi_set_mode(struct VideoModeTable *mode, int mode_bpp,if ((maxPixelClock !=0 ) && (desirePixelClock > maxPixelClock)) { rb_mode =viafb_get_rb_mode (mode->crtc[0 ].crtc.hor_addr, mode->crtc[0 ].crtc.ver_addr); -if (rb_mode) { +if (rb_mode) mode = rb_mode; - pDviTiming = rb_mode->crtc; - } } -viafb_fill_crtc_timing (pDviTiming, mode, mode_bpp /8 , set_iga); +viafb_fill_crtc_timing (mode, mode_bpp /8 , set_iga); }/* Sense DVI Connector */
drivers/video/via/hw.c +6 -6
@@ -1467,9 +1467,10 @@ void viafb_set_vclock(u32 clk, int set_iga)via_write_misc_reg_mask (0x0C ,0x0C );/* select external clock */ } -void viafb_fill_crtc_timing (struct crt_mode_table *crt_table, -struct VideoModeTable *video_mode,int bpp_byte,int set_iga) +void viafb_fill_crtc_timing (struct VideoModeTable *video_mode,int bpp_byte, +int set_iga) { +struct crt_mode_table *crt_table = video_mode->crtc;struct display_timing crt_reg;int i;int index =0 ;
@@ -1911,11 +1912,10 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,if (viafb_CRT_ON) {if (viafb_SAMM_ON && viaparinfo->shared->iga2_devices &VIA_CRT ) { -viafb_fill_crtc_timing (crt_timing1, vmode_tbl1, - video_bpp1 /8 ,IGA2 ); +viafb_fill_crtc_timing (vmode_tbl1, video_bpp1 /8 , +IGA2 ); }else { -viafb_fill_crtc_timing (crt_timing, vmode_tbl, - video_bpp /8 , +viafb_fill_crtc_timing (vmode_tbl, video_bpp /8 , (viaparinfo->shared->iga1_devices &VIA_CRT ) ?IGA1 :IGA2 ); }
drivers/video/via/hw.h +2 -2
@@ -637,8 +637,8 @@ extern int viafb_LCD_ON;extern int viafb_DVI_ON;extern int viafb_hotplug; -void viafb_fill_crtc_timing (struct crt_mode_table *crt_table, -struct VideoModeTable *video_mode,int bpp_byte,int set_iga); +void viafb_fill_crtc_timing (struct VideoModeTable *video_mode,int bpp_byte, +int set_iga);void viafb_set_vclock (u32 CLK ,int set_iga); void viafb_load_reg(int timing_value, int viafb_load_reg_num,
Signature · 1 line
1.6.3.2
PATCH 6/6 viafb: remove 640x480-60 CRT special case
In reply to Florian Tobias SchandinatThe timing for 640x480-60 was handled different than all others. This patch changes this by changing the blanking start and end. The reason for this is that I can't find any reason for the old behaviour and it was not consistent anyway as the special case for LCD did not always trigger as the LCD code does not use this function and it did trigger regardless of whether the display set is CRT or LCD but only based whether any DVI/LCD device exists. There are no negative effects observed for CRT or DVI devices.
--- drivers/video/via/hw.c | 14 -------------- drivers/video/via/viamode.c | 2 +- 2 files changed, 1 insertions(+), 15 deletions(-)
drivers/video/via/hw.c +0 -14
@@ -1488,20 +1488,6 @@ void viafb_fill_crtc_timing(struct VideoModeTable *video_mode, int bpp_byte, } crt_reg = crt_table[index].crtc; - -/* Mode 640x480 has border, but LCD/DFP didn't have border. */ -/* So we would delete border. */ -if ((viafb_LCD_ON | viafb_DVI_ON) - && video_mode->crtc[0 ].crtc.hor_addr ==640 - && video_mode->crtc[0 ].crtc.ver_addr ==480 - && refresh ==60 ) { -/* The border is 8 pixels. */ - crt_reg.hor_blank_start = crt_reg.hor_blank_start -8 ; - -/* Blanking time should add left and right borders. */ - crt_reg.hor_blank_end = crt_reg.hor_blank_end +16 ; - } - crt_reg.hor_blank_end += crt_reg.hor_blank_start; crt_reg.hor_sync_end += crt_reg.hor_sync_start; crt_reg.ver_blank_end += crt_reg.ver_blank_start;
drivers/video/via/viamode.c +1 -1
@@ -281,7 +281,7 @@ static struct crt_mode_table CRTM640x480[] = {/*r_rate,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60 ,M640X480_R60_HSP ,M640X480_R60_VSP , - {800, 640, 648, 144, 656, 96, 525, 480, 480, 45, 490, 2} }, + {800, 640, 640, 160, 656, 96, 525, 480, 480, 45, 490, 2} }, {REFRESH_75, M640X480_R75_HSP, M640X480_R75_VSP, {840, 640, 640, 200, 656, 64, 500, 480, 480, 20, 481, 3} }, {REFRESH_85, M640X480_R85_HSP, M640X480_R85_VSP,
Signature · 1 line
1.6.3.2