aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/aty/mach64_ct.c
diff options
context:
space:
mode:
authorVille Syrjälä <syrjala@sci.fi>2006-01-09 23:53:27 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:48 -0500
commit25163c56ed88a3009e7c1d808d3a052357301d63 (patch)
tree8b70b0c0e0cb1d84b1e9b75ebe57088a52c510ac /drivers/video/aty/mach64_ct.c
parente98cef1e9e0ef0c5c02f6f3daa4da7956ad1c9ea (diff)
[PATCH] atyfb: Set ECP divider
Set ECP (scaler/overlay clock) divider. The limits were taken from the XFree86 ati driver. Signed-off-by: Ville Syrjälä <syrjala@sci.fi> Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/aty/mach64_ct.c')
-rw-r--r--drivers/video/aty/mach64_ct.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/aty/mach64_ct.c
index 9bdb2aab01aa..e7056934c6a8 100644
--- a/drivers/video/aty/mach64_ct.c
+++ b/drivers/video/aty/mach64_ct.c
@@ -206,9 +206,7 @@ static int aty_valid_pll_ct(const struct fb_info *info, u32 vclk_per, struct pll
206{ 206{
207 u32 q; 207 u32 q;
208 struct atyfb_par *par = (struct atyfb_par *) info->par; 208 struct atyfb_par *par = (struct atyfb_par *) info->par;
209#ifdef DEBUG
210 int pllvclk; 209 int pllvclk;
211#endif
212 210
213 /* FIXME: use the VTB/GTB /{3,6,12} post dividers if they're better suited */ 211 /* FIXME: use the VTB/GTB /{3,6,12} post dividers if they're better suited */
214 q = par->ref_clk_per * pll->pll_ref_div * 4 / vclk_per; 212 q = par->ref_clk_per * pll->pll_ref_div * 4 / vclk_per;
@@ -223,13 +221,26 @@ static int aty_valid_pll_ct(const struct fb_info *info, u32 vclk_per, struct pll
223 pll->vclk_post_div_real = postdividers[pll->vclk_post_div]; 221 pll->vclk_post_div_real = postdividers[pll->vclk_post_div];
224 // pll->vclk_post_div <<= 6; 222 // pll->vclk_post_div <<= 6;
225 pll->vclk_fb_div = q * pll->vclk_post_div_real / 8; 223 pll->vclk_fb_div = q * pll->vclk_post_div_real / 8;
226#ifdef DEBUG
227 pllvclk = (1000000 * 2 * pll->vclk_fb_div) / 224 pllvclk = (1000000 * 2 * pll->vclk_fb_div) /
228 (par->ref_clk_per * pll->pll_ref_div); 225 (par->ref_clk_per * pll->pll_ref_div);
226#ifdef DEBUG
229 printk("atyfb(%s): pllvclk=%d MHz, vclk=%d MHz\n", 227 printk("atyfb(%s): pllvclk=%d MHz, vclk=%d MHz\n",
230 __FUNCTION__, pllvclk, pllvclk / pll->vclk_post_div_real); 228 __FUNCTION__, pllvclk, pllvclk / pll->vclk_post_div_real);
231#endif 229#endif
232 pll->pll_vclk_cntl = 0x03; /* VCLK = PLL_VCLK/VCLKx_POST */ 230 pll->pll_vclk_cntl = 0x03; /* VCLK = PLL_VCLK/VCLKx_POST */
231
232 /* Set ECP (scaler/overlay clock) divider */
233 if (par->pll_limits.ecp_max) {
234 int ecp = pllvclk / pll->vclk_post_div_real;
235 int ecp_div = 0;
236
237 while (ecp > par->pll_limits.ecp_max && ecp_div < 2) {
238 ecp >>= 1;
239 ecp_div++;
240 }
241 pll->pll_vclk_cntl |= ecp_div << 4;
242 }
243
233 return 0; 244 return 0;
234} 245}
235 246