These series contains a first batch of cleanup patches for 2.6.40.
They should not change the behavior.
All patches are also available at
git://github.com/schandinat/linux-2.6.git viafb-cleanup
and will also show up in linux-next after the early rc's are done.
Thanks,
Florian Tobias Schandinat
Later the correct values will be written so there is no need to
write early some values which might be wrong.
Signed-off-by: Florian Tobias Schandinat <[email protected]>
---
drivers/video/via/hw.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index a982718..c4d2136 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2401,9 +2401,6 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
viafb_write_reg_mask(0x15, VIASR, 0xA2, 0xA2);
- /* Write CRTC */
- viafb_fill_crtc_timing(crt_timing, vmode_tbl, video_bpp / 8, IGA1);
-
/* Write Graphic Controller */
for (i = 0; i < StdGR; i++)
via_write_reg(VIAGR, i, VPIT.GR[i]);
--
1.6.3.2
This moves some mode independend initialization code to the function
where the other parts of the initialization are.
Signed-off-by: Florian Tobias Schandinat <[email protected]>
---
drivers/video/via/hw.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index dc4c778..a982718 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1162,6 +1162,8 @@ void via_odev_to_seq(struct seq_file *m, u32 odev)
static void load_fix_bit_crtc_reg(void)
{
+ viafb_unlock_crt();
+
/* always set to 1 */
viafb_write_reg_mask(CR03, VIACR, 0x80, BIT7);
/* line compare should set all bits = 1 (extend modes) */
@@ -1169,8 +1171,6 @@ static void load_fix_bit_crtc_reg(void)
/* line compare should set all bits = 1 (extend modes) */
viafb_write_reg_mask(CR07, VIACR, 0x10, BIT4);
/* line compare should set all bits = 1 (extend modes) */
- viafb_write_reg_mask(CR09, VIACR, 0x40, BIT6);
- /* line compare should set all bits = 1 (extend modes) */
viafb_write_reg_mask(CR35, VIACR, 0x10, BIT4);
/* line compare should set all bits = 1 (extend modes) */
viafb_write_reg_mask(CR33, VIACR, 0x06, BIT0 + BIT1 + BIT2);
@@ -1181,6 +1181,10 @@ static void load_fix_bit_crtc_reg(void)
viafb_write_reg(CR08, VIACR, 0x00);
/* extend mode always set to 0h */
viafb_write_reg(CR14, VIACR, 0x00);
+ viafb_write_reg_mask(CR09, VIACR, 0x40, 0xDF);
+ viafb_write_reg_mask(CR11, VIACR, 0x00, BIT4 + BIT5 + BIT6);
+
+ viafb_lock_crt();
/* If K8M800, enable Prefetch Mode. */
if ((viaparinfo->chip_info->gfx_chip_name == UNICHROME_K800)
@@ -2033,8 +2037,6 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
v_addr = crt_reg.ver_addr;
if (set_iga == IGA1) {
viafb_unlock_crt();
- viafb_write_reg(CR09, VIACR, 0x00); /*initial CR09=0 */
- viafb_write_reg_mask(CR11, VIACR, 0x00, BIT4 + BIT5 + BIT6);
viafb_write_reg_mask(CR17, VIACR, 0x00, BIT7);
}
@@ -2047,7 +2049,6 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
break;
}
- load_fix_bit_crtc_reg();
viafb_lock_crt();
viafb_write_reg_mask(CR17, VIACR, 0x80, BIT7);
viafb_load_fetch_count_reg(h_addr, bpp_byte, set_iga);
@@ -2432,6 +2433,7 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
}
}
+ load_fix_bit_crtc_reg();
via_set_primary_pitch(viafbinfo->fix.line_length);
via_set_secondary_pitch(viafb_dual_fb ? viafbinfo1->fix.line_length
: viafbinfo->fix.line_length);
--
1.6.3.2
This patch removes the max_hres and max_vres which are not used at
the moment. In general they could be useful but it would be better
to get them via any standard EDID implementation and not the buggy
incomplete one currently used which is also removed as far as
possible.
Signed-off-by: Florian Tobias Schandinat <[email protected]>
---
drivers/video/via/chip.h | 2 -
drivers/video/via/dvi.c | 138 +---------------------------------------------
2 files changed, 3 insertions(+), 137 deletions(-)
diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index 1aa0fb3..3ebf20c 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -142,8 +142,6 @@ struct tmds_setting_information {
int h_active;
int v_active;
int max_pixel_clock;
- int max_hres;
- int max_vres;
};
struct lvds_setting_information {
diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index 41ca198..3dbcd77 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -28,9 +28,6 @@ static int tmds_register_read_bytes(int index, u8 *buff, int buff_len);
static void __devinit dvi_get_panel_size_from_DDCv1(
struct tmds_chip_information *tmds_chip,
struct tmds_setting_information *tmds_setting);
-static void __devinit dvi_get_panel_size_from_DDCv2(
- struct tmds_chip_information *tmds_chip,
- struct tmds_setting_information *tmds_setting);
static int viafb_dvi_query_EDID(void);
static int check_tmds_chip(int device_id_subaddr, int device_id)
@@ -47,17 +44,8 @@ void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
DEBUG_MSG(KERN_INFO "viafb_init_dvi_size()\n");
viafb_dvi_sense();
- switch (viafb_dvi_query_EDID()) {
- case 1:
+ if (viafb_dvi_query_EDID() == 1)
dvi_get_panel_size_from_DDCv1(tmds_chip, tmds_setting);
- break;
- case 2:
- dvi_get_panel_size_from_DDCv2(tmds_chip, tmds_setting);
- break;
- default:
- printk(KERN_WARNING "viafb_init_dvi_size: DVI panel size undetected!\n");
- break;
- }
return;
}
@@ -306,12 +294,7 @@ static int viafb_dvi_query_EDID(void)
return EDID_VERSION_1; /* Found EDID1 Table */
}
- data0 = (u8) tmds_register_read(0x00);
- viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr = restore;
- if (data0 == 0x20)
- return EDID_VERSION_2; /* Found EDID2 Table */
- else
- return false;
+ return false;
}
/* Get Panel Size Using EDID1 Table */
@@ -319,50 +302,15 @@ static void __devinit dvi_get_panel_size_from_DDCv1(
struct tmds_chip_information *tmds_chip,
struct tmds_setting_information *tmds_setting)
{
- int i, max_h = 0, tmp, restore;
- unsigned char rData;
+ int i, restore;
unsigned char EDID_DATA[18];
DEBUG_MSG(KERN_INFO "\n dvi_get_panel_size_from_DDCv1 \n");
restore = tmds_chip->tmds_chip_slave_addr;
tmds_chip->tmds_chip_slave_addr = 0xA0;
-
- rData = tmds_register_read(0x23);
- if (rData & 0x3C)
- max_h = 640;
- if (rData & 0xC0)
- max_h = 720;
- if (rData & 0x03)
- max_h = 800;
-
- rData = tmds_register_read(0x24);
- if (rData & 0xC0)
- max_h = 800;
- if (rData & 0x1E)
- max_h = 1024;
- if (rData & 0x01)
- max_h = 1280;
-
for (i = 0x25; i < 0x6D; i++) {
switch (i) {
- case 0x26:
- case 0x28:
- case 0x2A:
- case 0x2C:
- case 0x2E:
- case 0x30:
- case 0x32:
- case 0x34:
- rData = tmds_register_read(i);
- if (rData == 1)
- break;
- /* data = (data + 31) * 8 */
- tmp = (rData + 31) << 3;
- if (tmp > max_h)
- max_h = tmp;
- break;
-
case 0x36:
case 0x48:
case 0x5A:
@@ -383,91 +331,11 @@ static void __devinit dvi_get_panel_size_from_DDCv1(
}
}
- tmds_setting->max_hres = max_h;
- switch (max_h) {
- case 640:
- tmds_setting->max_vres = 480;
- break;
- case 800:
- tmds_setting->max_vres = 600;
- break;
- case 1024:
- tmds_setting->max_vres = 768;
- break;
- case 1280:
- tmds_setting->max_vres = 1024;
- break;
- case 1400:
- tmds_setting->max_vres = 1050;
- break;
- case 1440:
- tmds_setting->max_vres = 1050;
- break;
- case 1600:
- tmds_setting->max_vres = 1200;
- break;
- case 1920:
- tmds_setting->max_vres = 1080;
- break;
- default:
- DEBUG_MSG(KERN_INFO "Unknown panel size max resolution = %d ! "
- "set default panel size.\n", max_h);
- break;
- }
-
DEBUG_MSG(KERN_INFO "DVI max pixelclock = %d\n",
tmds_setting->max_pixel_clock);
tmds_chip->tmds_chip_slave_addr = restore;
}
-/* Get Panel Size Using EDID2 Table */
-static void __devinit dvi_get_panel_size_from_DDCv2(
- struct tmds_chip_information *tmds_chip,
- struct tmds_setting_information *tmds_setting)
-{
- int restore;
- unsigned char R_Buffer[2];
-
- DEBUG_MSG(KERN_INFO "\n dvi_get_panel_size_from_DDCv2 \n");
-
- restore = tmds_chip->tmds_chip_slave_addr;
- tmds_chip->tmds_chip_slave_addr = 0xA2;
-
- /* Horizontal: 0x76, 0x77 */
- tmds_register_read_bytes(0x76, R_Buffer, 2);
- tmds_setting->max_hres = R_Buffer[0] + (R_Buffer[1] << 8);
-
- switch (tmds_setting->max_hres) {
- case 640:
- tmds_setting->max_vres = 480;
- break;
- case 800:
- tmds_setting->max_vres = 600;
- break;
- case 1024:
- tmds_setting->max_vres = 768;
- break;
- case 1280:
- tmds_setting->max_vres = 1024;
- break;
- case 1400:
- tmds_setting->max_vres = 1050;
- break;
- case 1440:
- tmds_setting->max_vres = 1050;
- break;
- case 1600:
- tmds_setting->max_vres = 1200;
- break;
- default:
- DEBUG_MSG(KERN_INFO "Unknown panel size max resolution = %d! "
- "set default panel size.\n", tmds_setting->max_hres);
- break;
- }
-
- tmds_chip->tmds_chip_slave_addr = restore;
-}
-
/* If Disable DVI, turn off pad */
void viafb_dvi_disable(void)
{
--
1.6.3.2
As the iga path is the only remaining information which is also
handled by the active devices there is no reason to keep it.
Signed-off-by: Florian Tobias Schandinat <[email protected]>
---
drivers/video/via/chip.h | 4 ----
drivers/video/via/hw.c | 28 +++++++++++++---------------
drivers/video/via/viafbdev.c | 7 ++-----
drivers/video/via/viafbdev.h | 2 --
4 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index 29d7024..1aa0fb3 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -137,10 +137,6 @@ struct chip_information {
struct lvds_chip_information lvds_chip_info2;
};
-struct crt_setting_information {
- int iga_path;
-};
-
struct tmds_setting_information {
int iga_path;
int h_active;
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index c4d2136..0098270 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -770,13 +770,14 @@ static u32 get_lcd_devices(int output_interface)
/*Set IGA path for each device*/
void viafb_set_iga_path(void)
{
+ int crt_iga_path = 0;
if (viafb_SAMM_ON == 1) {
if (viafb_CRT_ON) {
if (viafb_primary_dev == CRT_Device)
- viaparinfo->crt_setting_info->iga_path = IGA1;
+ crt_iga_path = IGA1;
else
- viaparinfo->crt_setting_info->iga_path = IGA2;
+ crt_iga_path = IGA2;
}
if (viafb_DVI_ON) {
@@ -793,8 +794,7 @@ void viafb_set_iga_path(void)
UNICHROME_CLE266)) {
viaparinfo->
lvds_setting_info->iga_path = IGA2;
- viaparinfo->
- crt_setting_info->iga_path = IGA1;
+ crt_iga_path = IGA1;
viaparinfo->
tmds_setting_info->iga_path = IGA1;
} else
@@ -814,10 +814,10 @@ void viafb_set_iga_path(void)
viafb_SAMM_ON = 0;
if (viafb_CRT_ON && viafb_LCD_ON) {
- viaparinfo->crt_setting_info->iga_path = IGA1;
+ crt_iga_path = IGA1;
viaparinfo->lvds_setting_info->iga_path = IGA2;
} else if (viafb_CRT_ON && viafb_DVI_ON) {
- viaparinfo->crt_setting_info->iga_path = IGA1;
+ crt_iga_path = IGA1;
viaparinfo->tmds_setting_info->iga_path = IGA2;
} else if (viafb_LCD_ON && viafb_DVI_ON) {
viaparinfo->tmds_setting_info->iga_path = IGA1;
@@ -826,7 +826,7 @@ void viafb_set_iga_path(void)
viaparinfo->lvds_setting_info->iga_path = IGA2;
viaparinfo->lvds_setting_info2->iga_path = IGA2;
} else if (viafb_CRT_ON) {
- viaparinfo->crt_setting_info->iga_path = IGA1;
+ crt_iga_path = IGA1;
} else if (viafb_LCD_ON) {
viaparinfo->lvds_setting_info->iga_path = IGA2;
} else if (viafb_DVI_ON) {
@@ -837,7 +837,7 @@ void viafb_set_iga_path(void)
viaparinfo->shared->iga1_devices = 0;
viaparinfo->shared->iga2_devices = 0;
if (viafb_CRT_ON) {
- if (viaparinfo->crt_setting_info->iga_path == IGA1)
+ if (crt_iga_path == IGA1)
viaparinfo->shared->iga1_devices |= VIA_CRT;
else
viaparinfo->shared->iga2_devices |= VIA_CRT;
@@ -2072,8 +2072,6 @@ void __devinit viafb_init_chip_info(int chip_type)
init_tmds_chip_info();
init_lvds_chip_info();
- viaparinfo->crt_setting_info->iga_path = IGA1;
-
/*Set IGA path for each device */
viafb_set_iga_path();
@@ -2450,15 +2448,15 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
/* CRT set mode */
if (viafb_CRT_ON) {
- if (viafb_SAMM_ON && (viaparinfo->crt_setting_info->iga_path ==
- IGA2)) {
+ if (viafb_SAMM_ON &&
+ viaparinfo->shared->iga2_devices & VIA_CRT) {
viafb_fill_crtc_timing(crt_timing1, vmode_tbl1,
- video_bpp1 / 8,
- viaparinfo->crt_setting_info->iga_path);
+ video_bpp1 / 8, IGA2);
} else {
viafb_fill_crtc_timing(crt_timing, vmode_tbl,
video_bpp / 8,
- viaparinfo->crt_setting_info->iga_path);
+ (viaparinfo->shared->iga1_devices & VIA_CRT)
+ ? IGA1 : IGA2);
}
/* Patch if set_hres is not 8 alignment (1366) to viafb_setmode
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 9d9bb9b..ed9bd79 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -930,10 +930,8 @@ static int get_primary_device(void)
/* Rule: device on iga1 path are the primary device. */
if (viafb_SAMM_ON) {
if (viafb_CRT_ON) {
- if (viaparinfo->crt_setting_info->iga_path == IGA1) {
- DEBUG_MSG(KERN_INFO "CRT IGA Path:%d\n",
- viaparinfo->
- crt_setting_info->iga_path);
+ if (viaparinfo->shared->iga1_devices & VIA_CRT) {
+ DEBUG_MSG(KERN_INFO "CRT IGA Path:%d\n", IGA1);
primary_device = CRT_Device;
}
}
@@ -1746,7 +1744,6 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
viaparinfo->lvds_setting_info = &viaparinfo->shared->lvds_setting_info;
viaparinfo->lvds_setting_info2 =
&viaparinfo->shared->lvds_setting_info2;
- viaparinfo->crt_setting_info = &viaparinfo->shared->crt_setting_info;
viaparinfo->chip_info = &viaparinfo->shared->chip_info;
if (viafb_dual_fb)
diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
index d66f963..ff60e1d 100644
--- a/drivers/video/via/viafbdev.h
+++ b/drivers/video/via/viafbdev.h
@@ -50,7 +50,6 @@ struct viafb_shared {
/* All the information will be needed to set engine */
struct tmds_setting_information tmds_setting_info;
- struct crt_setting_information crt_setting_info;
struct lvds_setting_information lvds_setting_info;
struct lvds_setting_information lvds_setting_info2;
struct chip_information chip_info;
@@ -79,7 +78,6 @@ struct viafb_par {
/* All the information will be needed to set engine */
/* depreciated, use the ones in shared directly */
struct tmds_setting_information *tmds_setting_info;
- struct crt_setting_information *crt_setting_info;
struct lvds_setting_information *lvds_setting_info;
struct lvds_setting_information *lvds_setting_info2;
struct chip_information *chip_info;
--
1.6.3.2