* [PATCH 0/6] viafb modesetting update 1 @ 2011-08-05 21:49 Florian Tobias Schandinat 2011-08-05 21:44 ` [PATCH 1/6] viafb: use more compact modesetting functions Florian Tobias Schandinat ` (11 more replies) 0 siblings, 12 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:49 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat 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(-) ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/6] viafb: use more compact modesetting functions 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat @ 2011-08-05 21:44 ` Florian Tobias Schandinat 2011-08-05 21:45 ` [PATCH 2/6] viafb: kill viafb_load_crtc_timing Florian Tobias Schandinat ` (10 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:44 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat 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. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> --- 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(-) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 47b1353..372ce4f 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -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, diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h index c7239eb..267c669 100644 --- a/drivers/video/via/hw.h +++ b/drivers/video/via/hw.h @@ -51,40 +51,6 @@ #define VIA_HSYNC_NEGATIVE 0x01 #define VIA_VSYNC_NEGATIVE 0x02 -/*************************************************** -* Definition IGA1 Design Method of CRTC Registers * -****************************************************/ -#define IGA1_HOR_TOTAL_FORMULA(x) (((x)/8)-5) -#define IGA1_HOR_ADDR_FORMULA(x) (((x)/8)-1) -#define IGA1_HOR_BLANK_START_FORMULA(x) (((x)/8)-1) -#define IGA1_HOR_BLANK_END_FORMULA(x, y) (((x+y)/8)-1) -#define IGA1_HOR_SYNC_START_FORMULA(x) ((x)/8) -#define IGA1_HOR_SYNC_END_FORMULA(x, y) ((x+y)/8) - -#define IGA1_VER_TOTAL_FORMULA(x) ((x)-2) -#define IGA1_VER_ADDR_FORMULA(x) ((x)-1) -#define IGA1_VER_BLANK_START_FORMULA(x) ((x)-1) -#define IGA1_VER_BLANK_END_FORMULA(x, y) ((x+y)-1) -#define IGA1_VER_SYNC_START_FORMULA(x) ((x)-1) -#define IGA1_VER_SYNC_END_FORMULA(x, y) ((x+y)-1) - -/*************************************************** -** Definition IGA2 Design Method of CRTC Registers * -****************************************************/ -#define IGA2_HOR_TOTAL_FORMULA(x) ((x)-1) -#define IGA2_HOR_ADDR_FORMULA(x) ((x)-1) -#define IGA2_HOR_BLANK_START_FORMULA(x) ((x)-1) -#define IGA2_HOR_BLANK_END_FORMULA(x, y) ((x+y)-1) -#define IGA2_HOR_SYNC_START_FORMULA(x) ((x)-1) -#define IGA2_HOR_SYNC_END_FORMULA(x, y) ((x+y)-1) - -#define IGA2_VER_TOTAL_FORMULA(x) ((x)-1) -#define IGA2_VER_ADDR_FORMULA(x) ((x)-1) -#define IGA2_VER_BLANK_START_FORMULA(x) ((x)-1) -#define IGA2_VER_BLANK_END_FORMULA(x, y) ((x+y)-1) -#define IGA2_VER_SYNC_START_FORMULA(x) ((x)-1) -#define IGA2_VER_SYNC_END_FORMULA(x, y) ((x+y)-1) - /**********************************************************/ /* Definition IGA2 Design Method of CRTC Shadow Registers */ /**********************************************************/ @@ -97,33 +63,6 @@ #define IGA2_VER_SYNC_START_SHADOW_FORMULA(x) (x) #define IGA2_VER_SYNC_END_SHADOW_FORMULA(x, y) (x+y) -/* Define Register Number for IGA1 CRTC Timing */ - -/* location: {CR00,0,7},{CR36,3,3} */ -#define IGA1_HOR_TOTAL_REG_NUM 2 -/* location: {CR01,0,7} */ -#define IGA1_HOR_ADDR_REG_NUM 1 -/* location: {CR02,0,7} */ -#define IGA1_HOR_BLANK_START_REG_NUM 1 -/* location: {CR03,0,4},{CR05,7,7},{CR33,5,5} */ -#define IGA1_HOR_BLANK_END_REG_NUM 3 -/* location: {CR04,0,7},{CR33,4,4} */ -#define IGA1_HOR_SYNC_START_REG_NUM 2 -/* location: {CR05,0,4} */ -#define IGA1_HOR_SYNC_END_REG_NUM 1 -/* location: {CR06,0,7},{CR07,0,0},{CR07,5,5},{CR35,0,0} */ -#define IGA1_VER_TOTAL_REG_NUM 4 -/* location: {CR12,0,7},{CR07,1,1},{CR07,6,6},{CR35,2,2} */ -#define IGA1_VER_ADDR_REG_NUM 4 -/* location: {CR15,0,7},{CR07,3,3},{CR09,5,5},{CR35,3,3} */ -#define IGA1_VER_BLANK_START_REG_NUM 4 -/* location: {CR16,0,7} */ -#define IGA1_VER_BLANK_END_REG_NUM 1 -/* location: {CR10,0,7},{CR07,2,2},{CR07,7,7},{CR35,1,1} */ -#define IGA1_VER_SYNC_START_REG_NUM 4 -/* location: {CR11,0,3} */ -#define IGA1_VER_SYNC_END_REG_NUM 1 - /* Define Register Number for IGA2 Shadow CRTC Timing */ /* location: {CR6D,0,7},{CR71,3,3} */ @@ -143,37 +82,6 @@ /* location: {CR76,0,3} */ #define IGA2_SHADOW_VER_SYNC_END_REG_NUM 1 -/* Define Register Number for IGA2 CRTC Timing */ - -/* location: {CR50,0,7},{CR55,0,3} */ -#define IGA2_HOR_TOTAL_REG_NUM 2 -/* location: {CR51,0,7},{CR55,4,6} */ -#define IGA2_HOR_ADDR_REG_NUM 2 -/* location: {CR52,0,7},{CR54,0,2} */ -#define IGA2_HOR_BLANK_START_REG_NUM 2 -/* location: CLE266: {CR53,0,7},{CR54,3,5} => CLE266's CR5D[6] -is reserved, so it may have problem to set 1600x1200 on IGA2. */ -/* Others: {CR53,0,7},{CR54,3,5},{CR5D,6,6} */ -#define IGA2_HOR_BLANK_END_REG_NUM 3 -/* location: {CR56,0,7},{CR54,6,7},{CR5C,7,7} */ -/* VT3314 and Later: {CR56,0,7},{CR54,6,7},{CR5C,7,7}, {CR5D,7,7} */ -#define IGA2_HOR_SYNC_START_REG_NUM 4 - -/* location: {CR57,0,7},{CR5C,6,6} */ -#define IGA2_HOR_SYNC_END_REG_NUM 2 -/* location: {CR58,0,7},{CR5D,0,2} */ -#define IGA2_VER_TOTAL_REG_NUM 2 -/* location: {CR59,0,7},{CR5D,3,5} */ -#define IGA2_VER_ADDR_REG_NUM 2 -/* location: {CR5A,0,7},{CR5C,0,2} */ -#define IGA2_VER_BLANK_START_REG_NUM 2 -/* location: {CR5E,0,7},{CR5C,3,5} */ -#define IGA2_VER_BLANK_END_REG_NUM 2 -/* location: {CR5E,0,7},{CR5F,5,7} */ -#define IGA2_VER_SYNC_START_REG_NUM 2 -/* location: {CR5F,0,4} */ -#define IGA2_VER_SYNC_END_REG_NUM 1 - /* Define Fetch Count Register*/ /* location: {SR1C,0,7},{SR1D,0,1} */ @@ -446,87 +354,12 @@ is reserved, so it may have problem to set 1600x1200 on IGA2. */ /* location: {CR78,0,7},{CR79,6,7} */ #define LCD_VER_SCALING_FACTOR_REG_NUM_CLE 2 -/************************************************ - ***** Define IGA1 Display Timing ***** - ************************************************/ struct io_register { u8 io_addr; u8 start_bit; u8 end_bit; }; -/* IGA1 Horizontal Total */ -struct iga1_hor_total { - int reg_num; - struct io_register reg[IGA1_HOR_TOTAL_REG_NUM]; -}; - -/* IGA1 Horizontal Addressable Video */ -struct iga1_hor_addr { - int reg_num; - struct io_register reg[IGA1_HOR_ADDR_REG_NUM]; -}; - -/* IGA1 Horizontal Blank Start */ -struct iga1_hor_blank_start { - int reg_num; - struct io_register reg[IGA1_HOR_BLANK_START_REG_NUM]; -}; - -/* IGA1 Horizontal Blank End */ -struct iga1_hor_blank_end { - int reg_num; - struct io_register reg[IGA1_HOR_BLANK_END_REG_NUM]; -}; - -/* IGA1 Horizontal Sync Start */ -struct iga1_hor_sync_start { - int reg_num; - struct io_register reg[IGA1_HOR_SYNC_START_REG_NUM]; -}; - -/* IGA1 Horizontal Sync End */ -struct iga1_hor_sync_end { - int reg_num; - struct io_register reg[IGA1_HOR_SYNC_END_REG_NUM]; -}; - -/* IGA1 Vertical Total */ -struct iga1_ver_total { - int reg_num; - struct io_register reg[IGA1_VER_TOTAL_REG_NUM]; -}; - -/* IGA1 Vertical Addressable Video */ -struct iga1_ver_addr { - int reg_num; - struct io_register reg[IGA1_VER_ADDR_REG_NUM]; -}; - -/* IGA1 Vertical Blank Start */ -struct iga1_ver_blank_start { - int reg_num; - struct io_register reg[IGA1_VER_BLANK_START_REG_NUM]; -}; - -/* IGA1 Vertical Blank End */ -struct iga1_ver_blank_end { - int reg_num; - struct io_register reg[IGA1_VER_BLANK_END_REG_NUM]; -}; - -/* IGA1 Vertical Sync Start */ -struct iga1_ver_sync_start { - int reg_num; - struct io_register reg[IGA1_VER_SYNC_START_REG_NUM]; -}; - -/* IGA1 Vertical Sync End */ -struct iga1_ver_sync_end { - int reg_num; - struct io_register reg[IGA1_VER_SYNC_END_REG_NUM]; -}; - /***************************************************** ** Define IGA2 Shadow Display Timing **** *****************************************************/ @@ -579,82 +412,6 @@ struct iga2_shadow_ver_sync_end { struct io_register reg[IGA2_SHADOW_VER_SYNC_END_REG_NUM]; }; -/***************************************************** -** Define IGA2 Display Timing **** -******************************************************/ - -/* IGA2 Horizontal Total */ -struct iga2_hor_total { - int reg_num; - struct io_register reg[IGA2_HOR_TOTAL_REG_NUM]; -}; - -/* IGA2 Horizontal Addressable Video */ -struct iga2_hor_addr { - int reg_num; - struct io_register reg[IGA2_HOR_ADDR_REG_NUM]; -}; - -/* IGA2 Horizontal Blank Start */ -struct iga2_hor_blank_start { - int reg_num; - struct io_register reg[IGA2_HOR_BLANK_START_REG_NUM]; -}; - -/* IGA2 Horizontal Blank End */ -struct iga2_hor_blank_end { - int reg_num; - struct io_register reg[IGA2_HOR_BLANK_END_REG_NUM]; -}; - -/* IGA2 Horizontal Sync Start */ -struct iga2_hor_sync_start { - int reg_num; - struct io_register reg[IGA2_HOR_SYNC_START_REG_NUM]; -}; - -/* IGA2 Horizontal Sync End */ -struct iga2_hor_sync_end { - int reg_num; - struct io_register reg[IGA2_HOR_SYNC_END_REG_NUM]; -}; - -/* IGA2 Vertical Total */ -struct iga2_ver_total { - int reg_num; - struct io_register reg[IGA2_VER_TOTAL_REG_NUM]; -}; - -/* IGA2 Vertical Addressable Video */ -struct iga2_ver_addr { - int reg_num; - struct io_register reg[IGA2_VER_ADDR_REG_NUM]; -}; - -/* IGA2 Vertical Blank Start */ -struct iga2_ver_blank_start { - int reg_num; - struct io_register reg[IGA2_VER_BLANK_START_REG_NUM]; -}; - -/* IGA2 Vertical Blank End */ -struct iga2_ver_blank_end { - int reg_num; - struct io_register reg[IGA2_VER_BLANK_END_REG_NUM]; -}; - -/* IGA2 Vertical Sync Start */ -struct iga2_ver_sync_start { - int reg_num; - struct io_register reg[IGA2_VER_SYNC_START_REG_NUM]; -}; - -/* IGA2 Vertical Sync End */ -struct iga2_ver_sync_end { - int reg_num; - struct io_register reg[IGA2_VER_SYNC_END_REG_NUM]; -}; - /* IGA1 Fetch Count Register */ struct iga1_fetch_count { int reg_num; @@ -817,21 +574,6 @@ struct display_queue_expire_num { iga2_display_queue_expire_num_reg; }; -struct iga1_crtc_timing { - struct iga1_hor_total hor_total; - struct iga1_hor_addr hor_addr; - struct iga1_hor_blank_start hor_blank_start; - struct iga1_hor_blank_end hor_blank_end; - struct iga1_hor_sync_start hor_sync_start; - struct iga1_hor_sync_end hor_sync_end; - struct iga1_ver_total ver_total; - struct iga1_ver_addr ver_addr; - struct iga1_ver_blank_start ver_blank_start; - struct iga1_ver_blank_end ver_blank_end; - struct iga1_ver_sync_start ver_sync_start; - struct iga1_ver_sync_end ver_sync_end; -}; - struct iga2_shadow_crtc_timing { struct iga2_shadow_hor_total hor_total_shadow; struct iga2_shadow_hor_blank_end hor_blank_end_shadow; @@ -843,21 +585,6 @@ struct iga2_shadow_crtc_timing { struct iga2_shadow_ver_sync_end ver_sync_end_shadow; }; -struct iga2_crtc_timing { - struct iga2_hor_total hor_total; - struct iga2_hor_addr hor_addr; - struct iga2_hor_blank_start hor_blank_start; - struct iga2_hor_blank_end hor_blank_end; - struct iga2_hor_sync_start hor_sync_start; - struct iga2_hor_sync_end hor_sync_end; - struct iga2_ver_total ver_total; - struct iga2_ver_addr ver_addr; - struct iga2_ver_blank_start ver_blank_start; - struct iga2_ver_blank_end ver_blank_end; - struct iga2_ver_sync_start ver_sync_start; - struct iga2_ver_sync_end ver_sync_end; -}; - /* device ID */ #define CLE266_FUNCTION3 0x3123 #define KM400_FUNCTION3 0x3205 diff --git a/drivers/video/via/share.h b/drivers/video/via/share.h index 61b0bd5..2906b2d 100644 --- a/drivers/video/via/share.h +++ b/drivers/video/via/share.h @@ -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; diff --git a/drivers/video/via/via_modesetting.c b/drivers/video/via/via_modesetting.c index 3cddcff..016d457 100644 --- a/drivers/video/via/via_modesetting.c +++ b/drivers/video/via/via_modesetting.c @@ -29,6 +29,106 @@ #include "share.h" #include "debug.h" + +void via_set_primary_timing(const struct display_timing *timing) +{ + struct display_timing raw; + + raw.hor_total = timing->hor_total / 8 - 5; + raw.hor_addr = timing->hor_addr / 8 - 1; + raw.hor_blank_start = timing->hor_blank_start / 8 - 1; + raw.hor_blank_end = timing->hor_blank_end / 8 - 1; + raw.hor_sync_start = timing->hor_sync_start / 8; + raw.hor_sync_end = timing->hor_sync_end / 8; + raw.ver_total = timing->ver_total - 2; + raw.ver_addr = timing->ver_addr - 1; + raw.ver_blank_start = timing->ver_blank_start - 1; + raw.ver_blank_end = timing->ver_blank_end - 1; + raw.ver_sync_start = timing->ver_sync_start - 1; + raw.ver_sync_end = timing->ver_sync_end - 1; + + /* unlock timing registers */ + via_write_reg_mask(VIACR, 0x11, 0x00, 0x80); + + via_write_reg(VIACR, 0x00, raw.hor_total & 0xFF); + via_write_reg(VIACR, 0x01, raw.hor_addr & 0xFF); + via_write_reg(VIACR, 0x02, raw.hor_blank_start & 0xFF); + via_write_reg_mask(VIACR, 0x03, raw.hor_blank_end & 0x1F, 0x1F); + via_write_reg(VIACR, 0x04, raw.hor_sync_start & 0xFF); + via_write_reg_mask(VIACR, 0x05, (raw.hor_sync_end & 0x1F) + | (raw.hor_blank_end << (7 - 5) & 0x80), 0x9F); + via_write_reg(VIACR, 0x06, raw.ver_total & 0xFF); + via_write_reg_mask(VIACR, 0x07, (raw.ver_total >> 8 & 0x01) + | (raw.ver_addr >> (8 - 1) & 0x02) + | (raw.ver_sync_start >> (8 - 2) & 0x04) + | (raw.ver_blank_start >> (8 - 3) & 0x08) + | (raw.ver_total >> (9 - 5) & 0x20) + | (raw.ver_addr >> (9 - 6) & 0x40) + | (raw.ver_sync_start >> (9 - 7) & 0x80), 0xEF); + via_write_reg_mask(VIACR, 0x09, raw.ver_blank_start >> (9 - 5) & 0x20, + 0x20); + via_write_reg(VIACR, 0x10, raw.ver_sync_start & 0xFF); + via_write_reg_mask(VIACR, 0x11, raw.ver_sync_end & 0x0F, 0x0F); + via_write_reg(VIACR, 0x12, raw.ver_addr & 0xFF); + via_write_reg(VIACR, 0x15, raw.ver_blank_start & 0xFF); + via_write_reg(VIACR, 0x16, raw.ver_blank_end & 0xFF); + via_write_reg_mask(VIACR, 0x33, (raw.hor_sync_start >> (8 - 4) & 0x10) + | (raw.hor_blank_end >> (6 - 5) & 0x20), 0x30); + via_write_reg_mask(VIACR, 0x35, (raw.ver_total >> 10 & 0x01) + | (raw.ver_sync_start >> (10 - 1) & 0x02) + | (raw.ver_addr >> (10 - 2) & 0x04) + | (raw.ver_blank_start >> (10 - 3) & 0x08), 0x0F); + via_write_reg_mask(VIACR, 0x36, raw.hor_total >> (8 - 3) & 0x08, 0x08); + + /* lock timing registers */ + via_write_reg_mask(VIACR, 0x11, 0x80, 0x80); +} + +void via_set_secondary_timing(const struct display_timing *timing) +{ + struct display_timing raw; + + raw.hor_total = timing->hor_total - 1; + raw.hor_addr = timing->hor_addr - 1; + raw.hor_blank_start = timing->hor_blank_start - 1; + raw.hor_blank_end = timing->hor_blank_end - 1; + raw.hor_sync_start = timing->hor_sync_start - 1; + raw.hor_sync_end = timing->hor_sync_end - 1; + raw.ver_total = timing->ver_total - 1; + raw.ver_addr = timing->ver_addr - 1; + raw.ver_blank_start = timing->ver_blank_start - 1; + raw.ver_blank_end = timing->ver_blank_end - 1; + raw.ver_sync_start = timing->ver_sync_start - 1; + raw.ver_sync_end = timing->ver_sync_end - 1; + + via_write_reg(VIACR, 0x50, raw.hor_total & 0xFF); + via_write_reg(VIACR, 0x51, raw.hor_addr & 0xFF); + via_write_reg(VIACR, 0x52, raw.hor_blank_start & 0xFF); + via_write_reg(VIACR, 0x53, raw.hor_blank_end & 0xFF); + via_write_reg(VIACR, 0x54, (raw.hor_blank_start >> 8 & 0x07) + | (raw.hor_blank_end >> (8 - 3) & 0x38) + | (raw.hor_sync_start >> (8 - 6) & 0xC0)); + via_write_reg_mask(VIACR, 0x55, (raw.hor_total >> 8 & 0x0F) + | (raw.hor_addr >> (8 - 4) & 0x70), 0x7F); + via_write_reg(VIACR, 0x56, raw.hor_sync_start & 0xFF); + via_write_reg(VIACR, 0x57, raw.hor_sync_end & 0xFF); + via_write_reg(VIACR, 0x58, raw.ver_total & 0xFF); + via_write_reg(VIACR, 0x59, raw.ver_addr & 0xFF); + via_write_reg(VIACR, 0x5A, raw.ver_blank_start & 0xFF); + via_write_reg(VIACR, 0x5B, raw.ver_blank_end & 0xFF); + via_write_reg(VIACR, 0x5C, (raw.ver_blank_start >> 8 & 0x07) + | (raw.ver_blank_end >> (8 - 3) & 0x38) + | (raw.hor_sync_end >> (8 - 6) & 0x40) + | (raw.hor_sync_start >> (10 - 7) & 0x80)); + via_write_reg(VIACR, 0x5D, (raw.ver_total >> 8 & 0x07) + | (raw.ver_addr >> (8 - 3) & 0x38) + | (raw.hor_blank_end >> (11 - 6) & 0x40) + | (raw.hor_sync_start >> (11 - 7) & 0x80)); + via_write_reg(VIACR, 0x5E, raw.ver_sync_start & 0xFF); + via_write_reg(VIACR, 0x5F, (raw.ver_sync_end & 0x1F) + | (raw.ver_sync_start >> (8 - 5) & 0xE0)); +} + void via_set_primary_address(u32 addr) { DEBUG_MSG(KERN_DEBUG "via_set_primary_address(0x%08X)\n", addr); diff --git a/drivers/video/via/via_modesetting.h b/drivers/video/via/via_modesetting.h index 0138845..06e09fe 100644 --- a/drivers/video/via/via_modesetting.h +++ b/drivers/video/via/via_modesetting.h @@ -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); -- 1.6.3.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/6] viafb: kill viafb_load_crtc_timing 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat 2011-08-05 21:44 ` [PATCH 1/6] viafb: use more compact modesetting functions Florian Tobias Schandinat @ 2011-08-05 21:45 ` Florian Tobias Schandinat 2011-08-05 21:46 ` [PATCH 3/6] viafb: remove superfluous register unlocking/locking Florian Tobias Schandinat ` (9 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:45 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat This 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. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> --- 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(-) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 372ce4f..52d41f0 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -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); diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c index 6e06981..0a38e4d 100644 --- a/drivers/video/via/lcd.c +++ b/drivers/video/via/lcd.c @@ -559,7 +559,7 @@ void viafb_lcd_set_mode(struct crt_mode_table *mode_crt_table, int panel_hres = plvds_setting_info->lcd_panel_hres; int panel_vres = plvds_setting_info->lcd_panel_vres; u32 clock; - struct display_timing mode_crt_reg, panel_crt_reg; + struct display_timing mode_crt_reg, panel_crt_reg, timing; struct crt_mode_table *panel_crt_table = NULL; struct VideoModeTable *vmode_tbl = viafb_get_mode(panel_hres, panel_vres); @@ -576,31 +576,28 @@ void viafb_lcd_set_mode(struct crt_mode_table *mode_crt_table, clock = panel_crt_reg.hor_total * panel_crt_reg.ver_total * panel_crt_table->refresh_rate; plvds_setting_info->vclk = clock; - if (set_iga = IGA1) { - /* IGA1 doesn't have LCD scaling, so set it as centering. */ - viafb_load_crtc_timing(lcd_centering_timging - (mode_crt_reg, panel_crt_reg), IGA1); + + if (set_iga = IGA2 && (set_hres < panel_hres || set_vres < panel_vres) + && plvds_setting_info->display_method = LCD_EXPANDSION) { + timing = panel_crt_reg; + load_lcd_scaling(set_hres, set_vres, panel_hres, panel_vres); } else { - /* Expansion */ - if (plvds_setting_info->display_method = LCD_EXPANDSION - && (set_hres < panel_hres || set_vres < panel_vres)) { - /* expansion timing IGA2 loaded panel set timing*/ - viafb_load_crtc_timing(panel_crt_reg, IGA2); - DEBUG_MSG(KERN_INFO "viafb_load_crtc_timing!!\n"); - load_lcd_scaling(set_hres, set_vres, panel_hres, - panel_vres); - DEBUG_MSG(KERN_INFO "load_lcd_scaling!!\n"); - } else { /* Centering */ - /* centering timing IGA2 always loaded panel - and mode releative timing */ - viafb_load_crtc_timing(lcd_centering_timging - (mode_crt_reg, panel_crt_reg), IGA2); - viafb_write_reg_mask(CR79, VIACR, 0x00, + timing = lcd_centering_timging(mode_crt_reg, panel_crt_reg); + if (set_iga = IGA2) + /* disable scaling */ + via_write_reg_mask(VIACR, 0x79, 0x00, BIT0 + BIT1 + BIT2); - /* LCD scaling disabled */ - } } + timing.hor_blank_end += timing.hor_blank_start; + timing.hor_sync_end += timing.hor_sync_start; + timing.ver_blank_end += timing.ver_blank_start; + timing.ver_sync_end += timing.ver_sync_start; + if (set_iga = IGA1) + via_set_primary_timing(&timing); + else if (set_iga = IGA2) + via_set_secondary_timing(&timing); + /* Fetch count for IGA2 only */ viafb_load_fetch_count_reg(set_hres, mode_bpp / 8, set_iga); diff --git a/drivers/video/via/lcd.h b/drivers/video/via/lcd.h index 75f60a6..3b9e539 100644 --- a/drivers/video/via/lcd.h +++ b/drivers/video/via/lcd.h @@ -85,7 +85,5 @@ void viafb_init_lvds_output_interface(struct lvds_chip_information struct 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__ */ -- 1.6.3.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/6] viafb: remove superfluous register unlocking/locking 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat 2011-08-05 21:44 ` [PATCH 1/6] viafb: use more compact modesetting functions Florian Tobias Schandinat 2011-08-05 21:45 ` [PATCH 2/6] viafb: kill viafb_load_crtc_timing Florian Tobias Schandinat @ 2011-08-05 21:46 ` Florian Tobias Schandinat 2011-08-05 21:46 ` [PATCH 4/6] viafb: remove superfluous mode lookup Florian Tobias Schandinat ` (8 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:46 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat The 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. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> --- drivers/video/via/hw.c | 7 ------- drivers/video/via/via_modesetting.c | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 52d41f0..8b4bdf5 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -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 */ diff --git a/drivers/video/via/via_modesetting.c b/drivers/video/via/via_modesetting.c index 016d457..0e431ae 100644 --- a/drivers/video/via/via_modesetting.c +++ b/drivers/video/via/via_modesetting.c @@ -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) -- 1.6.3.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/6] viafb: remove superfluous mode lookup 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat ` (2 preceding siblings ...) 2011-08-05 21:46 ` [PATCH 3/6] viafb: remove superfluous register unlocking/locking Florian Tobias Schandinat @ 2011-08-05 21:46 ` Florian Tobias Schandinat 2011-08-05 21:47 ` [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing Florian Tobias Schandinat ` (7 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:46 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat As the result is not used anywhere there is no need to perform the lookup at all. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> --- drivers/video/via/viafbdev.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index bddae58..3eaf607 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -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); -- 1.6.3.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat ` (3 preceding siblings ...) 2011-08-05 21:46 ` [PATCH 4/6] viafb: remove superfluous mode lookup Florian Tobias Schandinat @ 2011-08-05 21:47 ` Florian Tobias Schandinat 2011-08-05 21:47 ` [PATCH 6/6] viafb: remove 640x480-60 CRT special case Florian Tobias Schandinat ` (6 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:47 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat As the first argument is just part of the structure passed as the second argument there is no need for it at all. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> --- 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(-) diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c index b1f3647..c7ff5c0 100644 --- a/drivers/video/via/dvi.c +++ b/drivers/video/via/dvi.c @@ -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 */ diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 8b4bdf5..2050fb8 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -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); } diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h index 267c669..1fd8d98 100644 --- a/drivers/video/via/hw.h +++ b/drivers/video/via/hw.h @@ -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, -- 1.6.3.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/6] viafb: remove 640x480-60 CRT special case 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat ` (4 preceding siblings ...) 2011-08-05 21:47 ` [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing Florian Tobias Schandinat @ 2011-08-05 21:47 ` Florian Tobias Schandinat 2011-08-05 21:52 ` [PATCH 1/6] viafb: use more compact modesetting functions Florian Tobias Schandinat ` (5 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:47 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat The 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. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> --- drivers/video/via/hw.c | 14 -------------- drivers/video/via/viamode.c | 2 +- 2 files changed, 1 insertions(+), 15 deletions(-) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 2050fb8..c5e7833 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -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; diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c index 58df74e..8a9f4fc 100644 --- a/drivers/video/via/viamode.c +++ b/drivers/video/via/viamode.c @@ -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, -- 1.6.3.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 1/6] viafb: use more compact modesetting functions 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat ` (5 preceding siblings ...) 2011-08-05 21:47 ` [PATCH 6/6] viafb: remove 640x480-60 CRT special case Florian Tobias Schandinat @ 2011-08-05 21:52 ` Florian Tobias Schandinat 2011-08-05 21:55 ` [PATCH 2/6] viafb: kill viafb_load_crtc_timing Florian Tobias Schandinat ` (4 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:52 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat 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. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> 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(-) -- 1.6.3.2 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/6] viafb: kill viafb_load_crtc_timing 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat ` (6 preceding siblings ...) 2011-08-05 21:52 ` [PATCH 1/6] viafb: use more compact modesetting functions Florian Tobias Schandinat @ 2011-08-05 21:55 ` Florian Tobias Schandinat 2011-08-05 21:55 ` [PATCH 3/6] viafb: remove superfluous register unlocking/locking Florian Tobias Schandinat ` (3 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:55 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat This 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. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> 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(-) -- 1.6.3.2 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/6] viafb: remove superfluous register unlocking/locking 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat ` (7 preceding siblings ...) 2011-08-05 21:55 ` [PATCH 2/6] viafb: kill viafb_load_crtc_timing Florian Tobias Schandinat @ 2011-08-05 21:55 ` Florian Tobias Schandinat 2011-08-05 21:58 ` [PATCH 4/6] viafb: remove superfluous mode lookup Florian Tobias Schandinat ` (2 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:55 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat The 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. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> drivers/video/via/hw.c | 7 ------- drivers/video/via/via_modesetting.c | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-) -- 1.6.3.2 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/6] viafb: remove superfluous mode lookup 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat ` (8 preceding siblings ...) 2011-08-05 21:55 ` [PATCH 3/6] viafb: remove superfluous register unlocking/locking Florian Tobias Schandinat @ 2011-08-05 21:58 ` Florian Tobias Schandinat 2011-08-05 21:58 ` [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing Florian Tobias Schandinat 2011-08-05 21:59 ` [PATCH 6/6] viafb: remove 640x480-60 CRT special case Florian Tobias Schandinat 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:58 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat As the result is not used anywhere there is no need to perform the lookup at all. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> drivers/video/via/viafbdev.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) -- 1.6.3.2 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat ` (9 preceding siblings ...) 2011-08-05 21:58 ` [PATCH 4/6] viafb: remove superfluous mode lookup Florian Tobias Schandinat @ 2011-08-05 21:58 ` Florian Tobias Schandinat 2011-08-05 21:59 ` [PATCH 6/6] viafb: remove 640x480-60 CRT special case Florian Tobias Schandinat 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:58 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat As the first argument is just part of the structure passed as the second argument there is no need for it at all. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> 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(-) -- 1.6.3.2 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 6/6] viafb: remove 640x480-60 CRT special case 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat ` (10 preceding siblings ...) 2011-08-05 21:58 ` [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing Florian Tobias Schandinat @ 2011-08-05 21:59 ` Florian Tobias Schandinat 11 siblings, 0 replies; 13+ messages in thread From: Florian Tobias Schandinat @ 2011-08-05 21:59 UTC (permalink / raw) To: linux-fbdev; +Cc: linux-kernel, Florian Tobias Schandinat The 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. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> drivers/video/via/hw.c | 14 -------------- drivers/video/via/viamode.c | 2 +- 2 files changed, 1 insertions(+), 15 deletions(-) -- 1.6.3.2 ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-08-05 21:59 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-08-05 21:49 [PATCH 0/6] viafb modesetting update 1 Florian Tobias Schandinat 2011-08-05 21:44 ` [PATCH 1/6] viafb: use more compact modesetting functions Florian Tobias Schandinat 2011-08-05 21:45 ` [PATCH 2/6] viafb: kill viafb_load_crtc_timing Florian Tobias Schandinat 2011-08-05 21:46 ` [PATCH 3/6] viafb: remove superfluous register unlocking/locking Florian Tobias Schandinat 2011-08-05 21:46 ` [PATCH 4/6] viafb: remove superfluous mode lookup Florian Tobias Schandinat 2011-08-05 21:47 ` [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing Florian Tobias Schandinat 2011-08-05 21:47 ` [PATCH 6/6] viafb: remove 640x480-60 CRT special case Florian Tobias Schandinat 2011-08-05 21:52 ` [PATCH 1/6] viafb: use more compact modesetting functions Florian Tobias Schandinat 2011-08-05 21:55 ` [PATCH 2/6] viafb: kill viafb_load_crtc_timing Florian Tobias Schandinat 2011-08-05 21:55 ` [PATCH 3/6] viafb: remove superfluous register unlocking/locking Florian Tobias Schandinat 2011-08-05 21:58 ` [PATCH 4/6] viafb: remove superfluous mode lookup Florian Tobias Schandinat 2011-08-05 21:58 ` [PATCH 5/6] viafb: simplify viafb_fill_crtc_timing Florian Tobias Schandinat 2011-08-05 21:59 ` [PATCH 6/6] viafb: remove 640x480-60 CRT special case Florian Tobias Schandinat
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).