Commit 5dd72f12 authored by Florian Tobias Schandinat's avatar Florian Tobias Schandinat
Browse files

viafb: get rid of the remaining modetable structure assumptions



This patch removes the remaining places where assumptions about the
structure of the modetable were made. Aside from some places where
assumptions are made that certain modes are in the modetable the
only code dealing with the modetable and not just a single mode is
in viamode. This will allow chaniging the modetable and use other
sources for videomodes like the subsystem or EDID.

Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
parent bfe7d5f9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ int viafb_LCD_ON ;
int viafb_LCD2_ON;
int viafb_SAMM_ON;
int viafb_dual_fb;
unsigned int viafb_second_xres = 640;
unsigned int viafb_second_yres = 480;
int viafb_hotplug_Xres = 640;
int viafb_hotplug_Yres = 480;
int viafb_hotplug_bpp = 32;
+2 −0
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ extern int viafb_lcd_dsp_method;
extern int viafb_lcd_mode;

extern int viafb_CRT_ON;
extern unsigned int viafb_second_xres;
extern unsigned int viafb_second_yres;
extern int viafb_hotplug_Xres;
extern int viafb_hotplug_Yres;
extern int viafb_hotplug_bpp;
+7 −16
Original line number Diff line number Diff line
@@ -1840,23 +1840,16 @@ static void hw_init(void)
	load_fix_bit_crtc_reg();
}

int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
	struct VideoModeTable *vmode_tbl1, int video_bpp1)
int viafb_setmode(int video_bpp, int video_bpp1)
{
	int j;
	int port;
	u32 devices = viaparinfo->shared->iga1_devices
		| viaparinfo->shared->iga2_devices;
	u8 value, index, mask;
	struct crt_mode_table *crt_timing;
	struct crt_mode_table *crt_timing1 = NULL;
	struct fb_var_screeninfo var2;

	device_screen_off();
	crt_timing = vmode_tbl->crtc;
	if (viafb_SAMM_ON == 1)
		crt_timing1 = vmode_tbl1->crtc;

	device_off();
	via_set_state(devices, VIA_STATE_OFF);

@@ -1866,8 +1859,7 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,

	if ((viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266
		|| viaparinfo->chip_info->gfx_chip_name == UNICHROME_K400)
	    && vmode_tbl->crtc[0].crtc.hor_addr == 1024
	    && vmode_tbl->crtc[0].crtc.ver_addr == 768) {
		&& viafbinfo->var.xres == 1024 && viafbinfo->var.yres == 768) {
		for (j = 0; j < res_patch_table[0].table_length; j++) {
			index = res_patch_table[0].io_reg_table[j].index;
			port = res_patch_table[0].io_reg_table[j].port;
@@ -1898,8 +1890,7 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
		var2 = viafbinfo1->var;
	} else if (viafb_SAMM_ON) {
		viafb_fill_var_timing_info(&var2, viafb_get_best_mode(
			vmode_tbl1->crtc->crtc.hor_addr,
			vmode_tbl1->crtc->crtc.ver_addr, viafb_refresh1));
			viafb_second_xres, viafb_second_yres, viafb_refresh1));
		var2.bits_per_pixel = viafbinfo->var.bits_per_pixel;
	}

@@ -1916,7 +1907,7 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
		/* Patch if set_hres is not 8 alignment (1366) to viafb_setmode
		to 8 alignment (1368),there is several pixels (2 pixels)
		on right side of screen. */
		if (vmode_tbl->crtc[0].crtc.hor_addr % 8) {
		if (viafbinfo->var.xres % 8) {
			viafb_unlock_crt();
			viafb_write_reg(CR02, VIACR,
				viafb_read_reg(VIACR, CR02) - 1);
@@ -1974,8 +1965,8 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,

	/* If set mode normally, save resolution information for hot-plug . */
	if (!viafb_hotplug) {
		viafb_hotplug_Xres = vmode_tbl->crtc[0].crtc.hor_addr;
		viafb_hotplug_Yres = vmode_tbl->crtc[0].crtc.ver_addr;
		viafb_hotplug_Xres = viafbinfo->var.xres;
		viafb_hotplug_Yres = viafbinfo->var.yres;
		viafb_hotplug_bpp = video_bpp;
		viafb_hotplug_refresh = viafb_refresh;

+1 −2
Original line number Diff line number Diff line
@@ -657,8 +657,7 @@ void viafb_load_FIFO_reg(int set_iga, int hor_active, int ver_active);
void viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\
					*p_gfx_dpa_setting);

int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
	struct VideoModeTable *vmode_tbl1, int video_bpp1);
int viafb_setmode(int video_bpp, int video_bpp1);
void viafb_fill_var_timing_info(struct fb_var_screeninfo *var,
	struct crt_mode_table *mode);
void __devinit viafb_init_chip_info(int chip_type);
+3 −11
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@ static char *viafb_mode1;
static int viafb_bpp = 32;
static int viafb_bpp1 = 32;

static unsigned int viafb_second_xres = 640;
static unsigned int viafb_second_yres = 480;
static unsigned int viafb_second_offset;
static int viafb_second_size;

@@ -267,7 +265,6 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
static int viafb_set_par(struct fb_info *info)
{
	struct viafb_par *viapar = info->par;
	struct VideoModeTable *vmode_entry, *vmode_entry1 = NULL;
	int refresh;
	DEBUG_MSG(KERN_INFO "viafb_set_par!\n");

@@ -276,10 +273,7 @@ static int viafb_set_par(struct fb_info *info)
	viafb_update_device_setting(viafbinfo->var.xres, viafbinfo->var.yres,
		viafbinfo->var.bits_per_pixel, 0);

	vmode_entry = viafb_get_mode(viafbinfo->var.xres, viafbinfo->var.yres);
	if (viafb_dual_fb) {
		vmode_entry1 = viafb_get_mode(viafbinfo1->var.xres,
			viafbinfo1->var.yres);
		viafb_update_device_setting(viafbinfo1->var.xres,
			viafbinfo1->var.yres, viafbinfo1->var.bits_per_pixel,
			1);
@@ -287,8 +281,6 @@ static int viafb_set_par(struct fb_info *info)
		DEBUG_MSG(KERN_INFO
		"viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n",
			  viafb_second_xres, viafb_second_yres, viafb_bpp1);
		vmode_entry1 = viafb_get_mode(viafb_second_xres,
			viafb_second_yres);

		viafb_update_device_setting(viafb_second_xres,
			viafb_second_yres, viafb_bpp1, 1);
@@ -296,7 +288,8 @@ static int viafb_set_par(struct fb_info *info)

	refresh = viafb_get_refresh(info->var.xres, info->var.yres,
		get_var_refresh(&info->var));
	if (vmode_entry) {
	if (viafb_get_best_mode(viafbinfo->var.xres, viafbinfo->var.yres,
		refresh)) {
		if (viafb_dual_fb && viapar->iga_path == IGA2) {
			viafb_bpp1 = info->var.bits_per_pixel;
			viafb_refresh1 = refresh;
@@ -309,8 +302,7 @@ static int viafb_set_par(struct fb_info *info)
			info->flags &= ~FBINFO_HWACCEL_DISABLED;
		else
			info->flags |= FBINFO_HWACCEL_DISABLED;
		viafb_setmode(vmode_entry, info->var.bits_per_pixel,
			vmode_entry1, viafb_bpp1);
		viafb_setmode(info->var.bits_per_pixel, viafb_bpp1);
		viafb_pan_display(&info->var, info);
	}

Loading