From a625e305edd8e3ac08888a9b52981205b68cdb0e Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Tue, 25 Jan 2011 22:34:24 +0100 Subject: [PATCH 01/13] video/via: drop deprecated (and unused) i2c_adapter.id This patch removes an assignment to the deprecated i2c_adapter.id field. Since the field isn't used anywhere else in the driver it is save to remove it. Signed-off-by: Peter Huewe Acked-by: Jean Delvare Signed-off-by: Florian Tobias Schandinat --- drivers/video/via/via_i2c.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c index 3844b558b7bd..a172a31f168f 100644 --- a/drivers/video/via/via_i2c.c +++ b/drivers/video/via/via_i2c.c @@ -209,7 +209,6 @@ static int create_i2c_bus(struct i2c_adapter *adapter, sprintf(adapter->name, "viafb i2c io_port idx 0x%02x", adap_cfg->ioport_index); adapter->owner = THIS_MODULE; - adapter->id = 0x01FFFF; adapter->class = I2C_CLASS_DDC; adapter->algo_data = algo; if (pdev) From b65d6040e3a7cd75d9287f7ddfd115e85fde4b44 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 3 Mar 2011 09:59:01 -0800 Subject: [PATCH 02/13] video via: fix iomem access This driver is not respecting the iomem memory space restrictions and does direct access. This works on x86 but is non-portable and should not be done. Converted memcpy() of 2 to readw. Last post increment of romptr was unnecessary since pointer never used after that. Found by sparse, compile tested only. Signed-off-by: Stephen Hemminger Signed-off-by: Florian Tobias Schandinat --- drivers/video/via/lcd.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c index 3425c3969806..723fa04b303f 100644 --- a/drivers/video/via/lcd.c +++ b/drivers/video/via/lcd.c @@ -1064,34 +1064,33 @@ static struct display_timing lcd_centering_timging(struct display_timing bool viafb_lcd_get_mobile_state(bool *mobile) { - unsigned char *romptr, *tableptr; + unsigned char __iomem *romptr, *tableptr, *biosptr; u8 core_base; - unsigned char *biosptr; /* Rom address */ - u32 romaddr = 0x000C0000; - u16 start_pattern = 0; + const u32 romaddr = 0x000C0000; + u16 start_pattern; biosptr = ioremap(romaddr, 0x10000); + start_pattern = readw(biosptr); - memcpy(&start_pattern, biosptr, 2); /* Compare pattern */ if (start_pattern == 0xAA55) { /* Get the start of Table */ /* 0x1B means BIOS offset position */ romptr = biosptr + 0x1B; - tableptr = biosptr + *((u16 *) romptr); + tableptr = biosptr + readw(romptr); /* Get the start of biosver structure */ /* 18 means BIOS version position. */ romptr = tableptr + 18; - romptr = biosptr + *((u16 *) romptr); + romptr = biosptr + readw(romptr); /* The offset should be 44, but the actual image is less three char. */ /* pRom += 44; */ romptr += 41; - core_base = *romptr++; + core_base = readb(romptr); if (core_base & 0x8) *mobile = false; From 23e5abd5555b86fd56af6383e7a832b0cf2a2d95 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 3 Mar 2011 10:00:08 -0800 Subject: [PATCH 03/13] video via: make local variables static Many local variables should be declared static. Found by sparse, compile tested only. Signed-off-by: Stephen Hemminger Signed-off-by: Florian Tobias Schandinat --- drivers/video/via/hw.c | 2 +- drivers/video/via/lcd.c | 10 ++-- drivers/video/via/via_i2c.c | 2 +- drivers/video/via/viafbdev.c | 6 +-- drivers/video/via/viamode.c | 100 +++++++++++++++++------------------ 5 files changed, 61 insertions(+), 59 deletions(-) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 36d73f940d8b..9ecf48620d02 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -751,7 +751,7 @@ void viafb_unlock_crt(void) viafb_write_reg_mask(CR47, VIACR, 0, BIT0); } -void write_dac_reg(u8 index, u8 r, u8 g, u8 b) +static void write_dac_reg(u8 index, u8 r, u8 g, u8 b) { outb(index, LUT_INDEX_WRITE); outb(r, LUT_DATA); diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c index 723fa04b303f..2ca3bb8abbfe 100644 --- a/drivers/video/via/lcd.c +++ b/drivers/video/via/lcd.c @@ -26,10 +26,12 @@ /* CLE266 Software Power Sequence */ /* {Mask}, {Data}, {Delay} */ -int PowerSequenceOn[3][3] = { {0x10, 0x08, 0x06}, {0x10, 0x08, 0x06}, - {0x19, 0x1FE, 0x01} }; -int PowerSequenceOff[3][3] = { {0x06, 0x08, 0x10}, {0x00, 0x00, 0x00}, - {0xD2, 0x19, 0x01} }; +static const int PowerSequenceOn[3][3] = { + {0x10, 0x08, 0x06}, {0x10, 0x08, 0x06}, {0x19, 0x1FE, 0x01} +}; +static const int PowerSequenceOff[3][3] = { + {0x06, 0x08, 0x10}, {0x00, 0x00, 0x00}, {0xD2, 0x19, 0x01} +}; static struct _lcd_scaling_factor lcd_scaling_factor = { /* LCD Horizontal Scaling Factor Register */ diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c index a172a31f168f..78f1405dbab7 100644 --- a/drivers/video/via/via_i2c.c +++ b/drivers/video/via/via_i2c.c @@ -32,7 +32,7 @@ */ #define VIAFB_NUM_I2C 5 static struct via_i2c_stuff via_i2c_par[VIAFB_NUM_I2C]; -struct viafb_dev *i2c_vdev; /* Passed in from core */ +static struct viafb_dev *i2c_vdev; /* Passed in from core */ static void via_i2c_setscl(void *data, int state) { diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 4e66349e4366..f555b891cc72 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -43,11 +43,11 @@ static int viafb_second_size; static int viafb_accel = 1; /* Added for specifying active devices.*/ -char *viafb_active_dev; +static char *viafb_active_dev; /*Added for specify lcd output port*/ -char *viafb_lcd_port = ""; -char *viafb_dvi_port = ""; +static char *viafb_lcd_port = ""; +static char *viafb_dvi_port = ""; static void retrieve_device_setting(struct viafb_ioctl_setting *setting_info); diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c index 2dbad3c0f679..4b06dd73ccaa 100644 --- a/drivers/video/via/viamode.c +++ b/drivers/video/via/viamode.c @@ -443,7 +443,7 @@ struct VPITTable VPIT = { /********************/ /* 480x640 */ -struct crt_mode_table CRTM480x640[] = { +static struct crt_mode_table CRTM480x640[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_25_175M, M480X640_R60_HSP, M480X640_R60_VSP, @@ -451,7 +451,7 @@ struct crt_mode_table CRTM480x640[] = { }; /* 640x480*/ -struct crt_mode_table CRTM640x480[] = { +static struct crt_mode_table CRTM640x480[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_25_175M, M640X480_R60_HSP, M640X480_R60_VSP, @@ -469,7 +469,7 @@ struct crt_mode_table CRTM640x480[] = { }; /*720x480 (GTF)*/ -struct crt_mode_table CRTM720x480[] = { +static struct crt_mode_table CRTM720x480[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_26_880M, M720X480_R60_HSP, M720X480_R60_VSP, @@ -478,7 +478,7 @@ struct crt_mode_table CRTM720x480[] = { }; /*720x576 (GTF)*/ -struct crt_mode_table CRTM720x576[] = { +static struct crt_mode_table CRTM720x576[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_32_668M, M720X576_R60_HSP, M720X576_R60_VSP, @@ -486,7 +486,7 @@ struct crt_mode_table CRTM720x576[] = { }; /* 800x480 (CVT) */ -struct crt_mode_table CRTM800x480[] = { +static struct crt_mode_table CRTM800x480[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_29_581M, M800X480_R60_HSP, M800X480_R60_VSP, @@ -494,7 +494,7 @@ struct crt_mode_table CRTM800x480[] = { }; /* 800x600*/ -struct crt_mode_table CRTM800x600[] = { +static struct crt_mode_table CRTM800x600[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_40_000M, M800X600_R60_HSP, M800X600_R60_VSP, @@ -512,7 +512,7 @@ struct crt_mode_table CRTM800x600[] = { }; /* 848x480 (CVT) */ -struct crt_mode_table CRTM848x480[] = { +static struct crt_mode_table CRTM848x480[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_31_500M, M848X480_R60_HSP, M848X480_R60_VSP, @@ -520,7 +520,7 @@ struct crt_mode_table CRTM848x480[] = { }; /*856x480 (GTF) convert to 852x480*/ -struct crt_mode_table CRTM852x480[] = { +static struct crt_mode_table CRTM852x480[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_31_728M, M852X480_R60_HSP, M852X480_R60_VSP, @@ -528,7 +528,7 @@ struct crt_mode_table CRTM852x480[] = { }; /*1024x512 (GTF)*/ -struct crt_mode_table CRTM1024x512[] = { +static struct crt_mode_table CRTM1024x512[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_41_291M, M1024X512_R60_HSP, M1024X512_R60_VSP, @@ -537,7 +537,7 @@ struct crt_mode_table CRTM1024x512[] = { }; /* 1024x600*/ -struct crt_mode_table CRTM1024x600[] = { +static struct crt_mode_table CRTM1024x600[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_48_875M, M1024X600_R60_HSP, M1024X600_R60_VSP, @@ -545,7 +545,7 @@ struct crt_mode_table CRTM1024x600[] = { }; /* 1024x768*/ -struct crt_mode_table CRTM1024x768[] = { +static struct crt_mode_table CRTM1024x768[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_65_000M, M1024X768_R60_HSP, M1024X768_R60_VSP, @@ -559,7 +559,7 @@ struct crt_mode_table CRTM1024x768[] = { }; /* 1152x864*/ -struct crt_mode_table CRTM1152x864[] = { +static struct crt_mode_table CRTM1152x864[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_75, CLK_108_000M, M1152X864_R75_HSP, M1152X864_R75_VSP, @@ -568,7 +568,7 @@ struct crt_mode_table CRTM1152x864[] = { }; /* 1280x720 (HDMI 720P)*/ -struct crt_mode_table CRTM1280x720[] = { +static struct crt_mode_table CRTM1280x720[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_74_481M, M1280X720_R60_HSP, M1280X720_R60_VSP, @@ -578,7 +578,7 @@ struct crt_mode_table CRTM1280x720[] = { }; /*1280x768 (GTF)*/ -struct crt_mode_table CRTM1280x768[] = { +static struct crt_mode_table CRTM1280x768[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_80_136M, M1280X768_R60_HSP, M1280X768_R60_VSP, @@ -588,7 +588,7 @@ struct crt_mode_table CRTM1280x768[] = { }; /* 1280x800 (CVT) */ -struct crt_mode_table CRTM1280x800[] = { +static struct crt_mode_table CRTM1280x800[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_83_375M, M1280X800_R60_HSP, M1280X800_R60_VSP, @@ -596,7 +596,7 @@ struct crt_mode_table CRTM1280x800[] = { }; /*1280x960*/ -struct crt_mode_table CRTM1280x960[] = { +static struct crt_mode_table CRTM1280x960[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_108_000M, M1280X960_R60_HSP, M1280X960_R60_VSP, @@ -604,7 +604,7 @@ struct crt_mode_table CRTM1280x960[] = { }; /* 1280x1024*/ -struct crt_mode_table CRTM1280x1024[] = { +static struct crt_mode_table CRTM1280x1024[] = { /*r_rate,vclk,,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_108_000M, M1280X1024_R60_HSP, M1280X1024_R60_VSP, @@ -618,7 +618,7 @@ struct crt_mode_table CRTM1280x1024[] = { }; /* 1368x768 (GTF) */ -struct crt_mode_table CRTM1368x768[] = { +static struct crt_mode_table CRTM1368x768[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_85_860M, M1368X768_R60_HSP, M1368X768_R60_VSP, @@ -626,7 +626,7 @@ struct crt_mode_table CRTM1368x768[] = { }; /*1440x1050 (GTF)*/ -struct crt_mode_table CRTM1440x1050[] = { +static struct crt_mode_table CRTM1440x1050[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_125_104M, M1440X1050_R60_HSP, M1440X1050_R60_VSP, @@ -634,7 +634,7 @@ struct crt_mode_table CRTM1440x1050[] = { }; /* 1600x1200*/ -struct crt_mode_table CRTM1600x1200[] = { +static struct crt_mode_table CRTM1600x1200[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_162_000M, M1600X1200_R60_HSP, M1600X1200_R60_VSP, @@ -646,7 +646,7 @@ struct crt_mode_table CRTM1600x1200[] = { }; /* 1680x1050 (CVT) */ -struct crt_mode_table CRTM1680x1050[] = { +static struct crt_mode_table CRTM1680x1050[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_146_760M, M1680x1050_R60_HSP, M1680x1050_R60_VSP, @@ -657,7 +657,7 @@ struct crt_mode_table CRTM1680x1050[] = { }; /* 1680x1050 (CVT Reduce Blanking) */ -struct crt_mode_table CRTM1680x1050_RB[] = { +static struct crt_mode_table CRTM1680x1050_RB[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_119_000M, M1680x1050_RB_R60_HSP, @@ -666,7 +666,7 @@ struct crt_mode_table CRTM1680x1050_RB[] = { }; /* 1920x1080 (CVT)*/ -struct crt_mode_table CRTM1920x1080[] = { +static struct crt_mode_table CRTM1920x1080[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_172_798M, M1920X1080_R60_HSP, M1920X1080_R60_VSP, @@ -674,7 +674,7 @@ struct crt_mode_table CRTM1920x1080[] = { }; /* 1920x1080 (CVT with Reduce Blanking) */ -struct crt_mode_table CRTM1920x1080_RB[] = { +static struct crt_mode_table CRTM1920x1080_RB[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_138_400M, M1920X1080_RB_R60_HSP, @@ -683,7 +683,7 @@ struct crt_mode_table CRTM1920x1080_RB[] = { }; /* 1920x1440*/ -struct crt_mode_table CRTM1920x1440[] = { +static struct crt_mode_table CRTM1920x1440[] = { /*r_rate,vclk,hsp,vsp */ /*HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_234_000M, M1920X1440_R60_HSP, M1920X1440_R60_VSP, @@ -694,7 +694,7 @@ struct crt_mode_table CRTM1920x1440[] = { }; /* 1400x1050 (CVT) */ -struct crt_mode_table CRTM1400x1050[] = { +static struct crt_mode_table CRTM1400x1050[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_121_750M, M1400X1050_R60_HSP, M1400X1050_R60_VSP, @@ -705,7 +705,7 @@ struct crt_mode_table CRTM1400x1050[] = { }; /* 1400x1050 (CVT Reduce Blanking) */ -struct crt_mode_table CRTM1400x1050_RB[] = { +static struct crt_mode_table CRTM1400x1050_RB[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_101_000M, M1400X1050_RB_R60_HSP, @@ -714,7 +714,7 @@ struct crt_mode_table CRTM1400x1050_RB[] = { }; /* 960x600 (CVT) */ -struct crt_mode_table CRTM960x600[] = { +static struct crt_mode_table CRTM960x600[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_45_250M, M960X600_R60_HSP, M960X600_R60_VSP, @@ -722,7 +722,7 @@ struct crt_mode_table CRTM960x600[] = { }; /* 1000x600 (GTF) */ -struct crt_mode_table CRTM1000x600[] = { +static struct crt_mode_table CRTM1000x600[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_48_000M, M1000X600_R60_HSP, M1000X600_R60_VSP, @@ -730,7 +730,7 @@ struct crt_mode_table CRTM1000x600[] = { }; /* 1024x576 (GTF) */ -struct crt_mode_table CRTM1024x576[] = { +static struct crt_mode_table CRTM1024x576[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_46_996M, M1024X576_R60_HSP, M1024X576_R60_VSP, @@ -738,7 +738,7 @@ struct crt_mode_table CRTM1024x576[] = { }; /* 1088x612 (CVT) */ -struct crt_mode_table CRTM1088x612[] = { +static struct crt_mode_table CRTM1088x612[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_52_977M, M1088X612_R60_HSP, M1088X612_R60_VSP, @@ -746,7 +746,7 @@ struct crt_mode_table CRTM1088x612[] = { }; /* 1152x720 (CVT) */ -struct crt_mode_table CRTM1152x720[] = { +static struct crt_mode_table CRTM1152x720[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_66_750M, M1152X720_R60_HSP, M1152X720_R60_VSP, @@ -754,7 +754,7 @@ struct crt_mode_table CRTM1152x720[] = { }; /* 1200x720 (GTF) */ -struct crt_mode_table CRTM1200x720[] = { +static struct crt_mode_table CRTM1200x720[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_70_159M, M1200X720_R60_HSP, M1200X720_R60_VSP, @@ -762,7 +762,7 @@ struct crt_mode_table CRTM1200x720[] = { }; /* 1200x900 (DCON) */ -struct crt_mode_table DCON1200x900[] = { +static struct crt_mode_table DCON1200x900[] = { /* r_rate, vclk, hsp, vsp */ {REFRESH_60, CLK_57_275M, M1200X900_R60_HSP, M1200X900_R60_VSP, /* The correct htotal is 1240, but this doesn't raster on VX855. */ @@ -772,7 +772,7 @@ struct crt_mode_table DCON1200x900[] = { }; /* 1280x600 (GTF) */ -struct crt_mode_table CRTM1280x600[] = { +static struct crt_mode_table CRTM1280x600[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_61_500M, M1280x600_R60_HSP, M1280x600_R60_VSP, @@ -780,7 +780,7 @@ struct crt_mode_table CRTM1280x600[] = { }; /* 1360x768 (CVT) */ -struct crt_mode_table CRTM1360x768[] = { +static struct crt_mode_table CRTM1360x768[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_84_750M, M1360X768_R60_HSP, M1360X768_R60_VSP, @@ -788,7 +788,7 @@ struct crt_mode_table CRTM1360x768[] = { }; /* 1360x768 (CVT Reduce Blanking) */ -struct crt_mode_table CRTM1360x768_RB[] = { +static struct crt_mode_table CRTM1360x768_RB[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_72_000M, M1360X768_RB_R60_HSP, @@ -797,7 +797,7 @@ struct crt_mode_table CRTM1360x768_RB[] = { }; /* 1366x768 (GTF) */ -struct crt_mode_table CRTM1366x768[] = { +static struct crt_mode_table CRTM1366x768[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_85_860M, M1368X768_R60_HSP, M1368X768_R60_VSP, @@ -807,7 +807,7 @@ struct crt_mode_table CRTM1366x768[] = { }; /* 1440x900 (CVT) */ -struct crt_mode_table CRTM1440x900[] = { +static struct crt_mode_table CRTM1440x900[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_106_500M, M1440X900_R60_HSP, M1440X900_R60_VSP, @@ -817,7 +817,7 @@ struct crt_mode_table CRTM1440x900[] = { }; /* 1440x900 (CVT Reduce Blanking) */ -struct crt_mode_table CRTM1440x900_RB[] = { +static struct crt_mode_table CRTM1440x900_RB[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_88_750M, M1440X900_RB_R60_HSP, @@ -826,7 +826,7 @@ struct crt_mode_table CRTM1440x900_RB[] = { }; /* 1600x900 (CVT) */ -struct crt_mode_table CRTM1600x900[] = { +static struct crt_mode_table CRTM1600x900[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_118_840M, M1600X900_R60_HSP, M1600X900_R60_VSP, @@ -834,7 +834,7 @@ struct crt_mode_table CRTM1600x900[] = { }; /* 1600x900 (CVT Reduce Blanking) */ -struct crt_mode_table CRTM1600x900_RB[] = { +static struct crt_mode_table CRTM1600x900_RB[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_97_750M, M1600X900_RB_R60_HSP, @@ -843,7 +843,7 @@ struct crt_mode_table CRTM1600x900_RB[] = { }; /* 1600x1024 (GTF) */ -struct crt_mode_table CRTM1600x1024[] = { +static struct crt_mode_table CRTM1600x1024[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_136_700M, M1600X1024_R60_HSP, M1600X1024_R60_VSP, @@ -851,7 +851,7 @@ struct crt_mode_table CRTM1600x1024[] = { }; /* 1792x1344 (DMT) */ -struct crt_mode_table CRTM1792x1344[] = { +static struct crt_mode_table CRTM1792x1344[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_204_000M, M1792x1344_R60_HSP, M1792x1344_R60_VSP, @@ -859,7 +859,7 @@ struct crt_mode_table CRTM1792x1344[] = { }; /* 1856x1392 (DMT) */ -struct crt_mode_table CRTM1856x1392[] = { +static struct crt_mode_table CRTM1856x1392[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_218_500M, M1856x1392_R60_HSP, M1856x1392_R60_VSP, @@ -867,7 +867,7 @@ struct crt_mode_table CRTM1856x1392[] = { }; /* 1920x1200 (CVT) */ -struct crt_mode_table CRTM1920x1200[] = { +static struct crt_mode_table CRTM1920x1200[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_193_295M, M1920X1200_R60_HSP, M1920X1200_R60_VSP, @@ -875,7 +875,7 @@ struct crt_mode_table CRTM1920x1200[] = { }; /* 1920x1200 (CVT with Reduce Blanking) */ -struct crt_mode_table CRTM1920x1200_RB[] = { +static struct crt_mode_table CRTM1920x1200_RB[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_153_920M, M1920X1200_RB_R60_HSP, @@ -884,14 +884,14 @@ struct crt_mode_table CRTM1920x1200_RB[] = { }; /* 2048x1536 (CVT) */ -struct crt_mode_table CRTM2048x1536[] = { +static struct crt_mode_table CRTM2048x1536[] = { /* r_rate, vclk, hsp, vsp */ /* HT, HA, HBS, HBE, HSS, HSE, VT, VA, VBS, VBE, VSS, VSE */ {REFRESH_60, CLK_267_250M, M2048x1536_R60_HSP, M2048x1536_R60_VSP, {2800, 2048, 2048, 752, 2200, 224, 1592, 1536, 1536, 56, 1539, 4} } }; -struct VideoModeTable viafb_modes[] = { +static struct VideoModeTable viafb_modes[] = { /* Display : 480x640 (GTF) */ {CRTM480x640, ARRAY_SIZE(CRTM480x640)}, @@ -1016,7 +1016,7 @@ struct VideoModeTable viafb_modes[] = { {CRTM1400x1050, ARRAY_SIZE(CRTM1400x1050)} }; -struct VideoModeTable viafb_rb_modes[] = { +static struct VideoModeTable viafb_rb_modes[] = { /* Display : 1360x768 (CVT Reduce Blanking) */ {CRTM1360x768_RB, ARRAY_SIZE(CRTM1360x768_RB)}, From dbf85f2326dbb070256ff153853b00f70c27717a Mon Sep 17 00:00:00 2001 From: Florian Tobias Schandinat Date: Sat, 11 Dec 2010 04:01:13 +0000 Subject: [PATCH 04/13] viafb: kill lcd_panel_id This patch removes all internal uses of another mostly artificial value. It does duplicate the information of the maximum resolution and it is not flexible as only a few resolutions exist. Hence it is better to remove it and clean the mess up. No runtime change expected. Signed-off-by: Florian Tobias Schandinat --- drivers/video/via/chip.h | 2 -- drivers/video/via/lcd.c | 50 ------------------------------- drivers/video/via/tblDPASetting.c | 23 -------------- drivers/video/via/tblDPASetting.h | 2 -- drivers/video/via/vt1636.c | 43 ++++++++------------------ 5 files changed, 13 insertions(+), 107 deletions(-) diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h index 48f1342897bd..a2f62002c3a3 100644 --- a/drivers/video/via/chip.h +++ b/drivers/video/via/chip.h @@ -163,7 +163,6 @@ struct lvds_setting_information { int v_active; int bpp; int refresh_rate; - int lcd_panel_id; int lcd_panel_hres; int lcd_panel_vres; int display_method; @@ -188,7 +187,6 @@ struct GFX_DPA_SETTING { }; struct VT1636_DPA_SETTING { - int PanelSizeID; u8 CLK_SEL_ST1; u8 CLK_SEL_ST2; }; diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c index 2ca3bb8abbfe..d75e3f8e9061 100644 --- a/drivers/video/via/lcd.c +++ b/drivers/video/via/lcd.c @@ -97,8 +97,6 @@ void __devinit viafb_init_lcd_size(void) DEBUG_MSG(KERN_INFO "viafb_init_lcd_size()\n"); fp_id_to_vindex(viafb_lcd_panel_id); - viaparinfo->lvds_setting_info2->lcd_panel_id = - viaparinfo->lvds_setting_info->lcd_panel_id; viaparinfo->lvds_setting_info2->lcd_panel_hres = viaparinfo->lvds_setting_info->lcd_panel_hres; viaparinfo->lvds_setting_info2->lcd_panel_vres = @@ -205,176 +203,132 @@ static void __devinit fp_id_to_vindex(int panel_id) case 0x0: viaparinfo->lvds_setting_info->lcd_panel_hres = 640; viaparinfo->lvds_setting_info->lcd_panel_vres = 480; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID0_640X480; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x1: viaparinfo->lvds_setting_info->lcd_panel_hres = 800; viaparinfo->lvds_setting_info->lcd_panel_vres = 600; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID1_800X600; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x2: viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID2_1024X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x3: viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID3_1280X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x4: viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; viaparinfo->lvds_setting_info->lcd_panel_vres = 1024; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID4_1280X1024; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x5: viaparinfo->lvds_setting_info->lcd_panel_hres = 1400; viaparinfo->lvds_setting_info->lcd_panel_vres = 1050; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID5_1400X1050; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x6: viaparinfo->lvds_setting_info->lcd_panel_hres = 1600; viaparinfo->lvds_setting_info->lcd_panel_vres = 1200; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID6_1600X1200; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x8: viaparinfo->lvds_setting_info->lcd_panel_hres = 800; viaparinfo->lvds_setting_info->lcd_panel_vres = 480; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_IDA_800X480; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x9: viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID2_1024X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0xA: viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID2_1024X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 0; break; case 0xB: viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID2_1024X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 0; break; case 0xC: viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID3_1280X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 0; break; case 0xD: viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; viaparinfo->lvds_setting_info->lcd_panel_vres = 1024; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID4_1280X1024; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 0; break; case 0xE: viaparinfo->lvds_setting_info->lcd_panel_hres = 1400; viaparinfo->lvds_setting_info->lcd_panel_vres = 1050; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID5_1400X1050; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 0; break; case 0xF: viaparinfo->lvds_setting_info->lcd_panel_hres = 1600; viaparinfo->lvds_setting_info->lcd_panel_vres = 1200; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID6_1600X1200; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 0; break; case 0x10: viaparinfo->lvds_setting_info->lcd_panel_hres = 1366; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID7_1366X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 0; break; case 0x11: viaparinfo->lvds_setting_info->lcd_panel_hres = 1024; viaparinfo->lvds_setting_info->lcd_panel_vres = 600; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID8_1024X600; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x12: viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID3_1280X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x13: viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; viaparinfo->lvds_setting_info->lcd_panel_vres = 800; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID9_1280X800; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 1; break; case 0x14: viaparinfo->lvds_setting_info->lcd_panel_hres = 1360; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_IDB_1360X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 0; break; case 0x15: viaparinfo->lvds_setting_info->lcd_panel_hres = 1280; viaparinfo->lvds_setting_info->lcd_panel_vres = 768; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID3_1280X768; viaparinfo->lvds_setting_info->device_lcd_dualedge = 1; viaparinfo->lvds_setting_info->LCDDithering = 0; break; case 0x16: viaparinfo->lvds_setting_info->lcd_panel_hres = 480; viaparinfo->lvds_setting_info->lcd_panel_vres = 640; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_IDC_480X640; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 1; break; @@ -382,16 +336,12 @@ static void __devinit fp_id_to_vindex(int panel_id) /* OLPC XO-1.5 panel */ viaparinfo->lvds_setting_info->lcd_panel_hres = 1200; viaparinfo->lvds_setting_info->lcd_panel_vres = 900; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_IDD_1200X900; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 0; break; default: viaparinfo->lvds_setting_info->lcd_panel_hres = 800; viaparinfo->lvds_setting_info->lcd_panel_vres = 600; - viaparinfo->lvds_setting_info->lcd_panel_id = - LCD_PANEL_ID1_800X600; viaparinfo->lvds_setting_info->device_lcd_dualedge = 0; viaparinfo->lvds_setting_info->LCDDithering = 1; } diff --git a/drivers/video/via/tblDPASetting.c b/drivers/video/via/tblDPASetting.c index 0c4c8cc712f4..73bb554e7c1e 100644 --- a/drivers/video/via/tblDPASetting.c +++ b/drivers/video/via/tblDPASetting.c @@ -20,17 +20,6 @@ */ #include "global.h" -/* For VT3324: */ -struct VT1636_DPA_SETTING VT1636_DPA_SETTING_TBL_VT3324[] = { - /* Panel ID, CLK_SEL_ST1[09], CLK_SEL_ST2[08] */ - {LCD_PANEL_ID0_640X480, 0x00, 0x00}, /* For 640x480 */ - {LCD_PANEL_ID1_800X600, 0x00, 0x00}, /* For 800x600 */ - {LCD_PANEL_ID2_1024X768, 0x00, 0x00}, /* For 1024x768 */ - {LCD_PANEL_ID3_1280X768, 0x00, 0x00}, /* For 1280x768 */ - {LCD_PANEL_ID4_1280X1024, 0x00, 0x00}, /* For 1280x1024 */ - {LCD_PANEL_ID5_1400X1050, 0x00, 0x00}, /* For 1400x1050 */ - {LCD_PANEL_ID6_1600X1200, 0x0B, 0x03} /* For 1600x1200 */ -}; struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3324[] = { /* ClkRange, DVP0, DVP0DataDriving, DVP0ClockDriving, DVP1, @@ -57,18 +46,6 @@ struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3324[] = { 0x00}, }; -/* For VT3327: */ -struct VT1636_DPA_SETTING VT1636_DPA_SETTING_TBL_VT3327[] = { - /* Panel ID, CLK_SEL_ST1[09], CLK_SEL_ST2[08] */ - {LCD_PANEL_ID0_640X480, 0x00, 0x00}, /* For 640x480 */ - {LCD_PANEL_ID1_800X600, 0x00, 0x00}, /* For 800x600 */ - {LCD_PANEL_ID2_1024X768, 0x00, 0x00}, /* For 1024x768 */ - {LCD_PANEL_ID3_1280X768, 0x00, 0x00}, /* For 1280x768 */ - {LCD_PANEL_ID4_1280X1024, 0x00, 0x00}, /* For 1280x1024 */ - {LCD_PANEL_ID5_1400X1050, 0x00, 0x00}, /* For 1400x1050 */ - {LCD_PANEL_ID6_1600X1200, 0x00, 0x00} /* For 1600x1200 */ -}; - struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3327[] = { /* ClkRange,DVP0, DVP0DataDriving, DVP0ClockDriving, DVP1, DVP1Driving, DFPHigh, DFPLow */ diff --git a/drivers/video/via/tblDPASetting.h b/drivers/video/via/tblDPASetting.h index b065a83481d3..6db61519cb5d 100644 --- a/drivers/video/via/tblDPASetting.h +++ b/drivers/video/via/tblDPASetting.h @@ -38,9 +38,7 @@ enum DPA_RANGE { DPA_CLK_RANGE_150M }; -extern struct VT1636_DPA_SETTING VT1636_DPA_SETTING_TBL_VT3324[7]; extern struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3324[6]; -extern struct VT1636_DPA_SETTING VT1636_DPA_SETTING_TBL_VT3327[7]; extern struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3327[]; extern struct GFX_DPA_SETTING GFX_DPA_SETTING_TBL_VT3364[6]; diff --git a/drivers/video/via/vt1636.c b/drivers/video/via/vt1636.c index 60e4192c2b34..ee2903b472cf 100644 --- a/drivers/video/via/vt1636.c +++ b/drivers/video/via/vt1636.c @@ -167,22 +167,6 @@ static int get_clk_range_index(u32 Clk) return DPA_CLK_RANGE_150M; } -static int get_lvds_dpa_setting_index(int panel_size_id, - struct VT1636_DPA_SETTING *p_vt1636_dpasetting_tbl, - int tbl_size) -{ - int i; - - for (i = 0; i < tbl_size; i++) { - if (panel_size_id == p_vt1636_dpasetting_tbl->PanelSizeID) - return i; - - p_vt1636_dpasetting_tbl++; - } - - return 0; -} - static void set_dpa_vt1636(struct lvds_setting_information *plvds_setting_info, struct lvds_chip_information *plvds_chip_info, struct VT1636_DPA_SETTING *p_vt1636_dpa_setting) @@ -206,7 +190,9 @@ void viafb_vt1636_patch_skew_on_vt3324( struct lvds_setting_information *plvds_setting_info, struct lvds_chip_information *plvds_chip_info) { - int index, size; + struct VT1636_DPA_SETTING dpa = {0x00, 0x00}, dpa_16x12 = {0x0B, 0x03}, + *pdpa; + int index; DEBUG_MSG(KERN_INFO "viafb_vt1636_patch_skew_on_vt3324.\n"); @@ -216,19 +202,21 @@ void viafb_vt1636_patch_skew_on_vt3324( &GFX_DPA_SETTING_TBL_VT3324[index]); /* LVDS Transmitter DPA settings: */ - size = ARRAY_SIZE(VT1636_DPA_SETTING_TBL_VT3324); - index = - get_lvds_dpa_setting_index(plvds_setting_info->lcd_panel_id, - VT1636_DPA_SETTING_TBL_VT3324, size); - set_dpa_vt1636(plvds_setting_info, plvds_chip_info, - &VT1636_DPA_SETTING_TBL_VT3324[index]); + if (plvds_setting_info->lcd_panel_hres == 1600 && + plvds_setting_info->lcd_panel_vres == 1200) + pdpa = &dpa_16x12; + else + pdpa = &dpa; + + set_dpa_vt1636(plvds_setting_info, plvds_chip_info, pdpa); } void viafb_vt1636_patch_skew_on_vt3327( struct lvds_setting_information *plvds_setting_info, struct lvds_chip_information *plvds_chip_info) { - int index, size; + struct VT1636_DPA_SETTING dpa = {0x00, 0x00}; + int index; DEBUG_MSG(KERN_INFO "viafb_vt1636_patch_skew_on_vt3327.\n"); @@ -238,12 +226,7 @@ void viafb_vt1636_patch_skew_on_vt3327( &GFX_DPA_SETTING_TBL_VT3327[index]); /* LVDS Transmitter DPA settings: */ - size = ARRAY_SIZE(VT1636_DPA_SETTING_TBL_VT3327); - index = - get_lvds_dpa_setting_index(plvds_setting_info->lcd_panel_id, - VT1636_DPA_SETTING_TBL_VT3327, size); - set_dpa_vt1636(plvds_setting_info, plvds_chip_info, - &VT1636_DPA_SETTING_TBL_VT3327[index]); + set_dpa_vt1636(plvds_setting_info, plvds_chip_info, &dpa); } void viafb_vt1636_patch_skew_on_vt3364( From c8350be26237e2b850b9611dbe55304ad6ebc6c7 Mon Sep 17 00:00:00 2001 From: Florian Tobias Schandinat Date: Sat, 11 Dec 2010 05:11:00 +0000 Subject: [PATCH 05/13] viafb: remove unused data_mode and device_type This patch is a little cleanup for the chip_info structures. Signed-off-by: Florian Tobias Schandinat --- drivers/video/via/chip.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h index a2f62002c3a3..3e8aacd0609e 100644 --- a/drivers/video/via/chip.h +++ b/drivers/video/via/chip.h @@ -110,16 +110,13 @@ struct tmds_chip_information { int tmds_chip_name; int tmds_chip_slave_addr; - int data_mode; int output_interface; int i2c_port; - int device_type; }; struct lvds_chip_information { int lvds_chip_name; int lvds_chip_slave_addr; - int data_mode; int output_interface; int i2c_port; }; From d90108765b64e39e88e59f51d05ac652f0e53fea Mon Sep 17 00:00:00 2001 From: Florian Tobias Schandinat Date: Sun, 19 Dec 2010 02:31:55 +0000 Subject: [PATCH 06/13] viafb: strip some structures This patch removes some write-only variables from the device management structures. Just a small cleanup. Signed-off-by: Florian Tobias Schandinat --- drivers/video/via/chip.h | 4 ---- drivers/video/via/hw.c | 11 ----------- 2 files changed, 15 deletions(-) diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h index 3e8aacd0609e..781f3aa66b42 100644 --- a/drivers/video/via/chip.h +++ b/drivers/video/via/chip.h @@ -139,9 +139,6 @@ struct chip_information { struct crt_setting_information { int iga_path; - int h_active; - int v_active; - int bpp; int refresh_rate; }; @@ -159,7 +156,6 @@ struct lvds_setting_information { int h_active; int v_active; int bpp; - int refresh_rate; int lcd_panel_hres; int lcd_panel_vres; int display_method; diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 9ecf48620d02..b0b02783b6ee 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -2117,9 +2117,6 @@ void viafb_update_device_setting(int hres, int vres, int bpp, int vmode_refresh, int flag) { if (flag == 0) { - viaparinfo->crt_setting_info->h_active = hres; - viaparinfo->crt_setting_info->v_active = vres; - viaparinfo->crt_setting_info->bpp = bpp; viaparinfo->crt_setting_info->refresh_rate = vmode_refresh; @@ -2129,13 +2126,9 @@ void viafb_update_device_setting(int hres, int vres, viaparinfo->lvds_setting_info->h_active = hres; viaparinfo->lvds_setting_info->v_active = vres; viaparinfo->lvds_setting_info->bpp = bpp; - viaparinfo->lvds_setting_info->refresh_rate = - vmode_refresh; viaparinfo->lvds_setting_info2->h_active = hres; viaparinfo->lvds_setting_info2->v_active = vres; viaparinfo->lvds_setting_info2->bpp = bpp; - viaparinfo->lvds_setting_info2->refresh_rate = - vmode_refresh; } else { if (viaparinfo->tmds_setting_info->iga_path == IGA2) { @@ -2147,15 +2140,11 @@ void viafb_update_device_setting(int hres, int vres, viaparinfo->lvds_setting_info->h_active = hres; viaparinfo->lvds_setting_info->v_active = vres; viaparinfo->lvds_setting_info->bpp = bpp; - viaparinfo->lvds_setting_info->refresh_rate = - vmode_refresh; } if (IGA2 == viaparinfo->lvds_setting_info2->iga_path) { viaparinfo->lvds_setting_info2->h_active = hres; viaparinfo->lvds_setting_info2->v_active = vres; viaparinfo->lvds_setting_info2->bpp = bpp; - viaparinfo->lvds_setting_info2->refresh_rate = - vmode_refresh; } } } From bf5ea02d9058a97a0bc2da9ca04ae4b34989407a Mon Sep 17 00:00:00 2001 From: Florian Tobias Schandinat Date: Wed, 5 Jan 2011 10:36:05 +0000 Subject: [PATCH 07/13] viafb: factor lcd scaling parameters out These parameters are the same for all currently known VIA IGPs so it does not make any sense to store them with IGP specific data. This saves a few bytes and helps a bit in dicovering the real differences. Signed-off-by: Florian Tobias Schandinat --- drivers/video/via/hw.c | 19 +++++++++ drivers/video/via/viamode.c | 85 ------------------------------------- 2 files changed, 19 insertions(+), 85 deletions(-) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index b0b02783b6ee..6cb3b5626f0d 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -360,6 +360,24 @@ static struct pll_map pll_value[] = { {208, 5, 2} } }; +/* according to VIA Technologies these values are based on experiment */ +static struct io_reg scaling_parameters[] = { + {VIACR, CR7A, 0xFF, 0x01}, /* LCD Scaling Parameter 1 */ + {VIACR, CR7B, 0xFF, 0x02}, /* LCD Scaling Parameter 2 */ + {VIACR, CR7C, 0xFF, 0x03}, /* LCD Scaling Parameter 3 */ + {VIACR, CR7D, 0xFF, 0x04}, /* LCD Scaling Parameter 4 */ + {VIACR, CR7E, 0xFF, 0x07}, /* LCD Scaling Parameter 5 */ + {VIACR, CR7F, 0xFF, 0x0A}, /* LCD Scaling Parameter 6 */ + {VIACR, CR80, 0xFF, 0x0D}, /* LCD Scaling Parameter 7 */ + {VIACR, CR81, 0xFF, 0x13}, /* LCD Scaling Parameter 8 */ + {VIACR, CR82, 0xFF, 0x16}, /* LCD Scaling Parameter 9 */ + {VIACR, CR83, 0xFF, 0x19}, /* LCD Scaling Parameter 10 */ + {VIACR, CR84, 0xFF, 0x1C}, /* LCD Scaling Parameter 11 */ + {VIACR, CR85, 0xFF, 0x1D}, /* LCD Scaling Parameter 12 */ + {VIACR, CR86, 0xFF, 0x1E}, /* LCD Scaling Parameter 13 */ + {VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */ +}; + static struct fifo_depth_select display_fifo_depth_reg = { /* IGA1 FIFO Depth_Select */ {IGA1_FIFO_DEPTH_SELECT_REG_NUM, {{SR17, 0, 7} } }, @@ -2419,6 +2437,7 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp, break; } + viafb_write_regx(scaling_parameters, ARRAY_SIZE(scaling_parameters)); device_off(); via_set_state(devices, VIA_STATE_OFF); diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c index 4b06dd73ccaa..81274890fc29 100644 --- a/drivers/video/via/viamode.c +++ b/drivers/video/via/viamode.c @@ -108,20 +108,6 @@ struct io_reg CN400_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01}, {VIACR, CR6A, 0xFF, 0x40}, {VIACR, CR6B, 0xFF, 0x00}, {VIACR, CR6C, 0xFF, 0x00}, -{VIACR, CR7A, 0xFF, 0x01}, /* LCD Scaling Parameter 1 */ -{VIACR, CR7B, 0xFF, 0x02}, /* LCD Scaling Parameter 2 */ -{VIACR, CR7C, 0xFF, 0x03}, /* LCD Scaling Parameter 3 */ -{VIACR, CR7D, 0xFF, 0x04}, /* LCD Scaling Parameter 4 */ -{VIACR, CR7E, 0xFF, 0x07}, /* LCD Scaling Parameter 5 */ -{VIACR, CR7F, 0xFF, 0x0A}, /* LCD Scaling Parameter 6 */ -{VIACR, CR80, 0xFF, 0x0D}, /* LCD Scaling Parameter 7 */ -{VIACR, CR81, 0xFF, 0x13}, /* LCD Scaling Parameter 8 */ -{VIACR, CR82, 0xFF, 0x16}, /* LCD Scaling Parameter 9 */ -{VIACR, CR83, 0xFF, 0x19}, /* LCD Scaling Parameter 10 */ -{VIACR, CR84, 0xFF, 0x1C}, /* LCD Scaling Parameter 11 */ -{VIACR, CR85, 0xFF, 0x1D}, /* LCD Scaling Parameter 12 */ -{VIACR, CR86, 0xFF, 0x1E}, /* LCD Scaling Parameter 13 */ -{VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */ {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */ {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */ {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */ @@ -172,20 +158,6 @@ struct io_reg CN700_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01}, {VIACR, CR78, 0xFF, 0x00}, /* LCD scaling Factor */ {VIACR, CR79, 0xFF, 0x00}, /* LCD scaling Factor */ {VIACR, CR9F, 0x03, 0x00}, /* LCD scaling Factor */ -{VIACR, CR7A, 0xFF, 0x01}, /* LCD Scaling Parameter 1 */ -{VIACR, CR7B, 0xFF, 0x02}, /* LCD Scaling Parameter 2 */ -{VIACR, CR7C, 0xFF, 0x03}, /* LCD Scaling Parameter 3 */ -{VIACR, CR7D, 0xFF, 0x04}, /* LCD Scaling Parameter 4 */ -{VIACR, CR7E, 0xFF, 0x07}, /* LCD Scaling Parameter 5 */ -{VIACR, CR7F, 0xFF, 0x0A}, /* LCD Scaling Parameter 6 */ -{VIACR, CR80, 0xFF, 0x0D}, /* LCD Scaling Parameter 7 */ -{VIACR, CR81, 0xFF, 0x13}, /* LCD Scaling Parameter 8 */ -{VIACR, CR82, 0xFF, 0x16}, /* LCD Scaling Parameter 9 */ -{VIACR, CR83, 0xFF, 0x19}, /* LCD Scaling Parameter 10 */ -{VIACR, CR84, 0xFF, 0x1C}, /* LCD Scaling Parameter 11 */ -{VIACR, CR85, 0xFF, 0x1D}, /* LCD Scaling Parameter 12 */ -{VIACR, CR86, 0xFF, 0x1E}, /* LCD Scaling Parameter 13 */ -{VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */ {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */ {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */ {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */ @@ -229,20 +201,6 @@ struct io_reg KM400_ModeXregs[] = { {VIACR, CR36, 0xFF, 0x01}, /* Power Mangement 3 */ {VIACR, CR68, 0xFF, 0x67}, /* Default FIFO For IGA2 */ {VIACR, CR6A, 0x20, 0x20}, /* Extended FIFO On */ - {VIACR, CR7A, 0xFF, 0x01}, /* LCD Scaling Parameter 1 */ - {VIACR, CR7B, 0xFF, 0x02}, /* LCD Scaling Parameter 2 */ - {VIACR, CR7C, 0xFF, 0x03}, /* LCD Scaling Parameter 3 */ - {VIACR, CR7D, 0xFF, 0x04}, /* LCD Scaling Parameter 4 */ - {VIACR, CR7E, 0xFF, 0x07}, /* LCD Scaling Parameter 5 */ - {VIACR, CR7F, 0xFF, 0x0A}, /* LCD Scaling Parameter 6 */ - {VIACR, CR80, 0xFF, 0x0D}, /* LCD Scaling Parameter 7 */ - {VIACR, CR81, 0xFF, 0x13}, /* LCD Scaling Parameter 8 */ - {VIACR, CR82, 0xFF, 0x16}, /* LCD Scaling Parameter 9 */ - {VIACR, CR83, 0xFF, 0x19}, /* LCD Scaling Parameter 10 */ - {VIACR, CR84, 0xFF, 0x1C}, /* LCD Scaling Parameter 11 */ - {VIACR, CR85, 0xFF, 0x1D}, /* LCD Scaling Parameter 12 */ - {VIACR, CR86, 0xFF, 0x1E}, /* LCD Scaling Parameter 13 */ - {VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */ {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */ {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */ {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */ @@ -283,20 +241,6 @@ struct io_reg CX700_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01}, {VIACR, CR6A, 0xFF, 0x40}, {VIACR, CR6B, 0xFF, 0x00}, {VIACR, CR6C, 0xFF, 0x00}, -{VIACR, CR7A, 0xFF, 0x01}, /* LCD Scaling Parameter 1 */ -{VIACR, CR7B, 0xFF, 0x02}, /* LCD Scaling Parameter 2 */ -{VIACR, CR7C, 0xFF, 0x03}, /* LCD Scaling Parameter 3 */ -{VIACR, CR7D, 0xFF, 0x04}, /* LCD Scaling Parameter 4 */ -{VIACR, CR7E, 0xFF, 0x07}, /* LCD Scaling Parameter 5 */ -{VIACR, CR7F, 0xFF, 0x0A}, /* LCD Scaling Parameter 6 */ -{VIACR, CR80, 0xFF, 0x0D}, /* LCD Scaling Parameter 7 */ -{VIACR, CR81, 0xFF, 0x13}, /* LCD Scaling Parameter 8 */ -{VIACR, CR82, 0xFF, 0x16}, /* LCD Scaling Parameter 9 */ -{VIACR, CR83, 0xFF, 0x19}, /* LCD Scaling Parameter 10 */ -{VIACR, CR84, 0xFF, 0x1C}, /* LCD Scaling Parameter 11 */ -{VIACR, CR85, 0xFF, 0x1D}, /* LCD Scaling Parameter 12 */ -{VIACR, CR86, 0xFF, 0x1E}, /* LCD Scaling Parameter 13 */ -{VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */ {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */ {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */ {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */ @@ -342,20 +286,6 @@ struct io_reg VX855_ModeXregs[] = { {VIACR, CR6A, 0xFD, 0x60}, {VIACR, CR6B, 0xFF, 0x00}, {VIACR, CR6C, 0xFF, 0x00}, -{VIACR, CR7A, 0xFF, 0x01}, /* LCD Scaling Parameter 1 */ -{VIACR, CR7B, 0xFF, 0x02}, /* LCD Scaling Parameter 2 */ -{VIACR, CR7C, 0xFF, 0x03}, /* LCD Scaling Parameter 3 */ -{VIACR, CR7D, 0xFF, 0x04}, /* LCD Scaling Parameter 4 */ -{VIACR, CR7E, 0xFF, 0x07}, /* LCD Scaling Parameter 5 */ -{VIACR, CR7F, 0xFF, 0x0A}, /* LCD Scaling Parameter 6 */ -{VIACR, CR80, 0xFF, 0x0D}, /* LCD Scaling Parameter 7 */ -{VIACR, CR81, 0xFF, 0x13}, /* LCD Scaling Parameter 8 */ -{VIACR, CR82, 0xFF, 0x16}, /* LCD Scaling Parameter 9 */ -{VIACR, CR83, 0xFF, 0x19}, /* LCD Scaling Parameter 10 */ -{VIACR, CR84, 0xFF, 0x1C}, /* LCD Scaling Parameter 11 */ -{VIACR, CR85, 0xFF, 0x1D}, /* LCD Scaling Parameter 12 */ -{VIACR, CR86, 0xFF, 0x1E}, /* LCD Scaling Parameter 13 */ -{VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */ {VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */ {VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */ {VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */ @@ -390,21 +320,6 @@ struct io_reg CLE266_ModeXregs[] = { {VIASR, SR1E, 0xF0, 0x00}, {VIAGR, GR20, 0xFF, 0x00}, {VIAGR, GR21, 0xFF, 0x00}, {VIAGR, GR22, 0xFF, 0x00}, - /* LCD Parameters */ -{VIACR, CR7A, 0xFF, 0x01}, /* LCD Parameter 1 */ -{VIACR, CR7B, 0xFF, 0x02}, /* LCD Parameter 2 */ -{VIACR, CR7C, 0xFF, 0x03}, /* LCD Parameter 3 */ -{VIACR, CR7D, 0xFF, 0x04}, /* LCD Parameter 4 */ -{VIACR, CR7E, 0xFF, 0x07}, /* LCD Parameter 5 */ -{VIACR, CR7F, 0xFF, 0x0A}, /* LCD Parameter 6 */ -{VIACR, CR80, 0xFF, 0x0D}, /* LCD Parameter 7 */ -{VIACR, CR81, 0xFF, 0x13}, /* LCD Parameter 8 */ -{VIACR, CR82, 0xFF, 0x16}, /* LCD Parameter 9 */ -{VIACR, CR83, 0xFF, 0x19}, /* LCD Parameter 10 */ -{VIACR, CR84, 0xFF, 0x1C}, /* LCD Parameter 11 */ -{VIACR, CR85, 0xFF, 0x1D}, /* LCD Parameter 12 */ -{VIACR, CR86, 0xFF, 0x1E}, /* LCD Parameter 13 */ -{VIACR, CR87, 0xFF, 0x1F}, /* LCD Parameter 14 */ }; From 3b0fd9d75598584478d1d3f6551f8a8a9696c34e Mon Sep 17 00:00:00 2001 From: Alexandre Courbot Date: Wed, 16 Feb 2011 03:49:01 +0000 Subject: [PATCH 08/13] fbdev: sh_mobile_lcdcfb: add backlight support Support for backlight devices controlled through board-specific routines. Backlights can be defined per-channel and follow fbdev directives to switch off as the LCD blanks or is turned on/off. Signed-off-by: Alexandre Courbot Signed-off-by: Paul Mundt --- drivers/video/Kconfig | 1 + drivers/video/sh_mobile_lcdcfb.c | 81 ++++++++++++++++++++++++++++++++ drivers/video/sh_mobile_lcdcfb.h | 2 + include/video/sh_mobile_lcdc.h | 9 ++++ 4 files changed, 93 insertions(+) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 6bafb51bb437..a222d65ae642 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -2005,6 +2005,7 @@ config FB_SH_MOBILE_LCDC select FB_SYS_IMAGEBLIT select FB_SYS_FOPS select FB_DEFERRED_IO + select FB_BACKLIGHT select SH_MIPI_DSI if SH_LCD_MIPI_DSI ---help--- Frame buffer driver for the on-chip SH-Mobile LCD controller. diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index bf12e53aed5c..e040e46d7d91 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include