drivers/video/fbdev/aty/mach64_gx.c

Source file repositories/reference/linux-study-clean/drivers/video/fbdev/aty/mach64_gx.c

File Facts

System
Linux kernel
Corpus path
drivers/video/fbdev/aty/mach64_gx.c
Extension
.c
Size
20792 bytes
Lines
909
Domain
Driver Families
Bucket
drivers/video
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (vclk_per <= RGB514_clocks[i].limit) {
			pll->ibm514.m = RGB514_clocks[i].m;
			pll->ibm514.n = RGB514_clocks[i].n;
			return 0;
		}
	return -EINVAL;
}

static u32 aty_pll_514_to_var(const struct fb_info *info,
			      const union aty_pll *pll)
{
	struct atyfb_par *par = (struct atyfb_par *) info->par;
	u8 df, vco_div_count, ref_div_count;

	df = pll->ibm514.m >> 6;
	vco_div_count = pll->ibm514.m & 0x3f;
	ref_div_count = pll->ibm514.n;

	return ((par->ref_clk_per * ref_div_count) << (3 - df))/
	    		(vco_div_count + 65);
}

static void aty_set_pll_514(const struct fb_info *info,
			    const union aty_pll *pll)
{
	struct atyfb_par *par = (struct atyfb_par *) info->par;

	aty_st_514(0x06, 0x02, par);	/* DAC Operation */
	aty_st_514(0x10, 0x01, par);	/* PLL Control 1 */
	aty_st_514(0x70, 0x01, par);	/* Misc Control 1 */
	aty_st_514(0x8f, 0x1f, par);	/* PLL Ref. Divider Input */
	aty_st_514(0x03, 0x00, par);	/* Sync Control */
	aty_st_514(0x05, 0x00, par);	/* Power Management */
	aty_st_514(0x20, pll->ibm514.m, par);	/* F0 / M0 */
	aty_st_514(0x21, pll->ibm514.n, par);	/* F1 / N0 */
}

const struct aty_dac_ops aty_dac_ibm514 = {
	.set_dac	= aty_set_dac_514,
};

const struct aty_pll_ops aty_pll_ibm514 = {
	.var_to_pll	= aty_var_to_pll_514,
	.pll_to_var	= aty_pll_514_to_var,
	.set_pll	= aty_set_pll_514,
};


    /*
     *  ATI 68860-B DAC
     */

static int aty_set_dac_ATI68860_B(const struct fb_info *info,
				  const union aty_pll *pll, u32 bpp,
				  u32 accel)
{
	struct atyfb_par *par = (struct atyfb_par *) info->par;
	u32 gModeReg, devSetupRegA, temp, mask;

	gModeReg = 0;
	devSetupRegA = 0;

	switch (bpp) {
	case 8:
		gModeReg = 0x83;
		devSetupRegA =
		    0x60 | 0x00 /*(info->mach64DAC8Bit ? 0x00 : 0x01) */ ;
		break;
	case 15:
		gModeReg = 0xA0;
		devSetupRegA = 0x60;
		break;
	case 16:
		gModeReg = 0xA1;
		devSetupRegA = 0x60;
		break;
	case 24:
		gModeReg = 0xC0;
		devSetupRegA = 0x60;
		break;
	case 32:
		gModeReg = 0xE3;
		devSetupRegA = 0x60;
		break;
	}

	if (!accel) {
		gModeReg = 0x80;
		devSetupRegA = 0x61;
	}

Annotation

Implementation Notes