aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nva3_pm.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-07-19 19:59:05 -0400
committerBen Skeggs <bskeggs@redhat.com>2011-09-20 02:08:37 -0400
commit93e692dc5f4ad9153a34cfb4bd02144f4368151b (patch)
tree2c4dcfbc364c72b26384f25d5c6259caff7a7e4d /drivers/gpu/drm/nouveau/nva3_pm.c
parent6b70e481671cff087a39d40cd823435d0177000c (diff)
drm/nva3/pm: pll disabled if bit 0 of ctrl not set
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nva3_pm.c')
-rw-r--r--drivers/gpu/drm/nouveau/nva3_pm.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
index 864a15bd6128..16d574dbe369 100644
--- a/drivers/gpu/drm/nouveau/nva3_pm.c
+++ b/drivers/gpu/drm/nouveau/nva3_pm.c
@@ -72,19 +72,21 @@ static u32
72read_pll(struct drm_device *dev, int clk, u32 pll) 72read_pll(struct drm_device *dev, int clk, u32 pll)
73{ 73{
74 u32 ctrl = nv_rd32(dev, pll + 0); 74 u32 ctrl = nv_rd32(dev, pll + 0);
75 u32 sclk, P = 1, N = 1, M = 1; 75 u32 sclk = 0, P = 1, N = 1, M = 1;
76 76
77 if (!(ctrl & 0x00000008)) { 77 if (!(ctrl & 0x00000008)) {
78 u32 coef = nv_rd32(dev, pll + 4); 78 if (ctrl & 0x00000001) {
79 M = (coef & 0x000000ff) >> 0; 79 u32 coef = nv_rd32(dev, pll + 4);
80 N = (coef & 0x0000ff00) >> 8; 80 M = (coef & 0x000000ff) >> 0;
81 P = (coef & 0x003f0000) >> 16; 81 N = (coef & 0x0000ff00) >> 8;
82 P = (coef & 0x003f0000) >> 16;
82 83
83 /* not post-divider on these.. */ 84 /* no post-divider on these.. */
84 if ((pll & 0x00ff00) == 0x00e800) 85 if ((pll & 0x00ff00) == 0x00e800)
85 P = 1; 86 P = 1;
86 87
87 sclk = read_clk(dev, 0x00 + clk, false); 88 sclk = read_clk(dev, 0x00 + clk, false);
89 }
88 } else { 90 } else {
89 sclk = read_clk(dev, 0x10 + clk, false); 91 sclk = read_clk(dev, 0x10 + clk, false);
90 } 92 }
@@ -306,16 +308,18 @@ nva3_pm_clocks_set(struct drm_device *dev, void *pre_state)
306 prog_clk(dev, 0x20, &info->unka0); 308 prog_clk(dev, 0x20, &info->unka0);
307 prog_clk(dev, 0x21, &info->vdec); 309 prog_clk(dev, 0x21, &info->vdec);
308 310
309 nv_wr32(dev, 0x100210, 0); 311 if (info->mclk.clk || info->mclk.pll) {
310 nv_wr32(dev, 0x1002dc, 1); 312 nv_wr32(dev, 0x100210, 0);
311 nv_wr32(dev, 0x004018, 0x00001000); 313 nv_wr32(dev, 0x1002dc, 1);
312 prog_pll(dev, 0x02, 0x004000, &info->mclk); 314 nv_wr32(dev, 0x004018, 0x00001000);
313 if (nv_rd32(dev, 0x4000) & 0x00000008) 315 prog_pll(dev, 0x02, 0x004000, &info->mclk);
314 nv_wr32(dev, 0x004018, 0x1000d000); 316 if (nv_rd32(dev, 0x4000) & 0x00000008)
315 else 317 nv_wr32(dev, 0x004018, 0x1000d000);
316 nv_wr32(dev, 0x004018, 0x10005000); 318 else
317 nv_wr32(dev, 0x1002dc, 0); 319 nv_wr32(dev, 0x004018, 0x10005000);
318 nv_wr32(dev, 0x100210, 0x80000000); 320 nv_wr32(dev, 0x1002dc, 0);
321 nv_wr32(dev, 0x100210, 0x80000000);
322 }
319 323
320cleanup: 324cleanup:
321 /* unfreeze PFIFO */ 325 /* unfreeze PFIFO */