diff options
Diffstat (limited to 'drivers/gpu/drm/mgag200')
| -rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_mode.c | 23 | 
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index a274b9906ef..78d8e919509 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -382,19 +382,19 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)  	m = n = p = 0;  	vcomax = 800000;  	vcomin = 400000; -	pllreffreq = 3333; +	pllreffreq = 33333;  	delta = 0xffffffff;  	permitteddelta = clock * 5 / 1000; -	for (testp = 16; testp > 0; testp--) { +	for (testp = 16; testp > 0; testp >>= 1) {  		if (clock * testp > vcomax)  			continue;  		if (clock * testp < vcomin)  			continue;  		for (testm = 1; testm < 33; testm++) { -			for (testn = 1; testn < 257; testn++) { +			for (testn = 17; testn < 257; testn++) {  				computed = (pllreffreq * testn) /  					(testm * testp);  				if (computed > clock) @@ -404,11 +404,11 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)  				if (tmpdelta < delta) {  					delta = tmpdelta;  					n = testn - 1; -					m = (testm - 1) | ((n >> 1) & 0x80); +					m = (testm - 1);  					p = testp - 1;  				}  				if ((clock * testp) >= 600000) -					p |= 80; +					p |= 0x80;  			}  		}  	} @@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,  	int i;  	unsigned char misc = 0;  	unsigned char ext_vga[6]; -	unsigned char ext_vga_index24; -	unsigned char dac_index90 = 0;  	u8 bppshift;  	static unsigned char dacvalue[] = { @@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,  		option2 = 0x0000b000;  		break;  	case G200_ER: -		dac_index90 = 0;  		break;  	} @@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,  		WREG_DAC(i, dacvalue[i]);  	} -	if (mdev->type == G200_ER) { -		WREG_DAC(0x90, dac_index90); -	} - +	if (mdev->type == G200_ER) +		WREG_DAC(0x90, 0);  	if (option)  		pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option); @@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,  	if (mdev->type == G200_WB)  		ext_vga[1] |= 0x88; -	ext_vga_index24 = 0x05; -  	/* Set pixel clocks */  	misc = 0x2d;  	WREG8(MGA_MISC_OUT, misc); @@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,  	}  	if (mdev->type == G200_ER) -		WREG_ECRT(24, ext_vga_index24); +		WREG_ECRT(0x24, 0x5);  	if (mdev->type == G200_EV) {  		WREG_ECRT(6, 0);  |