Lines Matching refs:minfo

28 static unsigned int g450_mnp2vco(const struct matrox_fb_info *minfo,  in g450_mnp2vco()  argument
35 return (minfo->features.pll.ref_freq * n + (m >> 1)) / m; in g450_mnp2vco()
38 unsigned int g450_mnp2f(const struct matrox_fb_info *minfo, unsigned int mnp) in g450_mnp2f() argument
40 return g450_vco2f(mnp, g450_mnp2vco(minfo, mnp)); in g450_mnp2f()
55 static unsigned int g450_nextpll(const struct matrox_fb_info *minfo, in g450_nextpll() argument
99 n = ((tvco * (m+1) + minfo->features.pll.ref_freq) / (minfo->features.pll.ref_freq * 2)) - 2; in g450_nextpll()
104 static unsigned int g450_firstpll(const struct matrox_fb_info *minfo, in g450_firstpll() argument
133 return g450_nextpll(minfo, pi, vco, 0xFF0000 | p); in g450_firstpll()
136 static inline unsigned int g450_setpll(const struct matrox_fb_info *minfo, in g450_setpll() argument
141 matroxfb_DAC_out(minfo, M1064_XPIXPLLAM, mnp >> 16); in g450_setpll()
142 matroxfb_DAC_out(minfo, M1064_XPIXPLLAN, mnp >> 8); in g450_setpll()
143 matroxfb_DAC_out(minfo, M1064_XPIXPLLAP, mnp); in g450_setpll()
147 matroxfb_DAC_out(minfo, M1064_XPIXPLLBM, mnp >> 16); in g450_setpll()
148 matroxfb_DAC_out(minfo, M1064_XPIXPLLBN, mnp >> 8); in g450_setpll()
149 matroxfb_DAC_out(minfo, M1064_XPIXPLLBP, mnp); in g450_setpll()
153 matroxfb_DAC_out(minfo, M1064_XPIXPLLCM, mnp >> 16); in g450_setpll()
154 matroxfb_DAC_out(minfo, M1064_XPIXPLLCN, mnp >> 8); in g450_setpll()
155 matroxfb_DAC_out(minfo, M1064_XPIXPLLCP, mnp); in g450_setpll()
159 matroxfb_DAC_out(minfo, DAC1064_XSYSPLLM, mnp >> 16); in g450_setpll()
160 matroxfb_DAC_out(minfo, DAC1064_XSYSPLLN, mnp >> 8); in g450_setpll()
161 matroxfb_DAC_out(minfo, DAC1064_XSYSPLLP, mnp); in g450_setpll()
165 matroxfb_DAC_out(minfo, M1064_XVIDPLLM, mnp >> 16); in g450_setpll()
166 matroxfb_DAC_out(minfo, M1064_XVIDPLLN, mnp >> 8); in g450_setpll()
167 matroxfb_DAC_out(minfo, M1064_XVIDPLLP, mnp); in g450_setpll()
173 static inline unsigned int g450_cmppll(const struct matrox_fb_info *minfo, in g450_cmppll() argument
182 return (matroxfb_DAC_in(minfo, M1064_XPIXPLLAM) != m || in g450_cmppll()
183 matroxfb_DAC_in(minfo, M1064_XPIXPLLAN) != n || in g450_cmppll()
184 matroxfb_DAC_in(minfo, M1064_XPIXPLLAP) != p); in g450_cmppll()
187 return (matroxfb_DAC_in(minfo, M1064_XPIXPLLBM) != m || in g450_cmppll()
188 matroxfb_DAC_in(minfo, M1064_XPIXPLLBN) != n || in g450_cmppll()
189 matroxfb_DAC_in(minfo, M1064_XPIXPLLBP) != p); in g450_cmppll()
192 return (matroxfb_DAC_in(minfo, M1064_XPIXPLLCM) != m || in g450_cmppll()
193 matroxfb_DAC_in(minfo, M1064_XPIXPLLCN) != n || in g450_cmppll()
194 matroxfb_DAC_in(minfo, M1064_XPIXPLLCP) != p); in g450_cmppll()
197 return (matroxfb_DAC_in(minfo, DAC1064_XSYSPLLM) != m || in g450_cmppll()
198 matroxfb_DAC_in(minfo, DAC1064_XSYSPLLN) != n || in g450_cmppll()
199 matroxfb_DAC_in(minfo, DAC1064_XSYSPLLP) != p); in g450_cmppll()
202 return (matroxfb_DAC_in(minfo, M1064_XVIDPLLM) != m || in g450_cmppll()
203 matroxfb_DAC_in(minfo, M1064_XVIDPLLN) != n || in g450_cmppll()
204 matroxfb_DAC_in(minfo, M1064_XVIDPLLP) != p); in g450_cmppll()
209 static inline int g450_isplllocked(const struct matrox_fb_info *minfo, in g450_isplllocked() argument
215 if (matroxfb_DAC_in(minfo, regidx) & 0x40) { in g450_isplllocked()
220 r += matroxfb_DAC_in(minfo, regidx) & 0x40; in g450_isplllocked()
229 static int g450_testpll(const struct matrox_fb_info *minfo, unsigned int mnp, in g450_testpll() argument
232 return g450_isplllocked(minfo, g450_setpll(minfo, mnp, pll)); in g450_testpll()
245 void matroxfb_g450_setpll_cond(struct matrox_fb_info *minfo, unsigned int mnp, in matroxfb_g450_setpll_cond() argument
248 if (g450_cmppll(minfo, mnp, pll)) { in matroxfb_g450_setpll_cond()
249 g450_setpll(minfo, mnp, pll); in matroxfb_g450_setpll_cond()
253 static inline unsigned int g450_findworkingpll(struct matrox_fb_info *minfo, in g450_findworkingpll() argument
281 if (g450_testpll(minfo, mnp - 0x0300, pll) && in g450_findworkingpll()
282 g450_testpll(minfo, mnp + 0x0300, pll) && in g450_findworkingpll()
283 g450_testpll(minfo, mnp - 0x0200, pll) && in g450_findworkingpll()
284 g450_testpll(minfo, mnp + 0x0200, pll) && in g450_findworkingpll()
285 g450_testpll(minfo, mnp - 0x0100, pll) && in g450_findworkingpll()
286 g450_testpll(minfo, mnp + 0x0100, pll)) { in g450_findworkingpll()
287 if (g450_testpll(minfo, mnp, pll)) { in g450_findworkingpll()
290 } else if (!found && g450_testpll(minfo, mnp, pll)) { in g450_findworkingpll()
296 g450_setpll(minfo, mnpfound, pll); in g450_findworkingpll()
309 static int g450_checkcache(struct matrox_fb_info *minfo, in g450_checkcache() argument
331 static int __g450_setclk(struct matrox_fb_info *minfo, unsigned int fout, in __g450_setclk() argument
349 xpwrctrl = matroxfb_DAC_in(minfo, M1064_XPWRCTRL); in __g450_setclk()
350 matroxfb_DAC_out(minfo, M1064_XPWRCTRL, xpwrctrl & ~M1064_XPWRCTRL_PANELPDN); in __g450_setclk()
353 tmp = matroxfb_DAC_in(minfo, M1064_XPIXCLKCTRL); in __g450_setclk()
358 matroxfb_DAC_out(minfo, M1064_XPIXCLKCTRL, tmp); in __g450_setclk()
361 if (fout >= minfo->max_pixel_clock_panellink) in __g450_setclk()
371 matroxfb_DAC_out(minfo, M1064_XPWRCTRL, in __g450_setclk()
392 pi = &minfo->limits.pixel; in __g450_setclk()
393 ci = &minfo->cache.pixel; in __g450_setclk()
399 pci_read_config_dword(minfo->pcidev, PCI_OPTION_REG, &opt); in __g450_setclk()
401 pci_write_config_dword(minfo->pcidev, PCI_OPTION_REG, opt | 0x20); in __g450_setclk()
404 pi = &minfo->limits.system; in __g450_setclk()
405 ci = &minfo->cache.system; in __g450_setclk()
414 tmp = matroxfb_DAC_in(minfo, M1064_XPWRCTRL); in __g450_setclk()
416 matroxfb_DAC_out(minfo, M1064_XPWRCTRL, tmp | 2); in __g450_setclk()
419 mnp = matroxfb_DAC_in(minfo, M1064_XPIXPLLCM) << 16; in __g450_setclk()
420 mnp |= matroxfb_DAC_in(minfo, M1064_XPIXPLLCN) << 8; in __g450_setclk()
423 pi = &minfo->limits.video; in __g450_setclk()
424 ci = &minfo->cache.video; in __g450_setclk()
435 …for (mnp = g450_firstpll(minfo, pi, &xvco, fout); mnp != NO_MORE_MNP; mnp = g450_nextpll(minfo, pi… in __g450_setclk()
440 vco = g450_mnp2vco(minfo, mnp); in __g450_setclk()
453 && vco != g450_mnp2vco(minfo, mnparray[idx-1]) in __g450_setclk()
477 mnp = g450_checkcache(minfo, ci, mnparray[0]); in __g450_setclk()
479 matroxfb_g450_setpll_cond(minfo, mnp, pll); in __g450_setclk()
481 mnp = g450_findworkingpll(minfo, pll, mnparray, mnpcount); in __g450_setclk()
484 updatehwstate_clk(&minfo->hw, mnp, pll); in __g450_setclk()
494 int matroxfb_g450_setclk(struct matrox_fb_info *minfo, unsigned int fout, in matroxfb_g450_setclk() argument
503 r = __g450_setclk(minfo, fout, pll, arr, arr + MNP_TABLE_SIZE); in matroxfb_g450_setclk()