diff options
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_crtc.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index d819eb935a2f..1686f8291b6d 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
@@ -266,15 +266,10 @@ nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk) | |||
266 | { | 266 | { |
267 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 267 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
268 | struct pll_lims pll; | 268 | struct pll_lims pll; |
269 | uint32_t reg, reg1, reg2; | 269 | uint32_t reg1, reg2; |
270 | int ret, N1, M1, N2, M2, P; | 270 | int ret, N1, M1, N2, M2, P; |
271 | 271 | ||
272 | if (dev_priv->chipset < NV_C0) | 272 | ret = get_pll_limits(dev, PLL_VPLL0 + head, &pll); |
273 | reg = NV50_PDISPLAY_CRTC_CLK_CTRL1(head); | ||
274 | else | ||
275 | reg = 0x614140 + (head * 0x800); | ||
276 | |||
277 | ret = get_pll_limits(dev, reg, &pll); | ||
278 | if (ret) | 273 | if (ret) |
279 | return ret; | 274 | return ret; |
280 | 275 | ||
@@ -286,11 +281,11 @@ nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk) | |||
286 | NV_DEBUG(dev, "pclk %d out %d NM1 %d %d NM2 %d %d P %d\n", | 281 | NV_DEBUG(dev, "pclk %d out %d NM1 %d %d NM2 %d %d P %d\n", |
287 | pclk, ret, N1, M1, N2, M2, P); | 282 | pclk, ret, N1, M1, N2, M2, P); |
288 | 283 | ||
289 | reg1 = nv_rd32(dev, reg + 4) & 0xff00ff00; | 284 | reg1 = nv_rd32(dev, pll.reg + 4) & 0xff00ff00; |
290 | reg2 = nv_rd32(dev, reg + 8) & 0x8000ff00; | 285 | reg2 = nv_rd32(dev, pll.reg + 8) & 0x8000ff00; |
291 | nv_wr32(dev, reg, 0x10000611); | 286 | nv_wr32(dev, pll.reg + 0, 0x10000611); |
292 | nv_wr32(dev, reg + 4, reg1 | (M1 << 16) | N1); | 287 | nv_wr32(dev, pll.reg + 4, reg1 | (M1 << 16) | N1); |
293 | nv_wr32(dev, reg + 8, reg2 | (P << 28) | (M2 << 16) | N2); | 288 | nv_wr32(dev, pll.reg + 8, reg2 | (P << 28) | (M2 << 16) | N2); |
294 | } else | 289 | } else |
295 | if (dev_priv->chipset < NV_C0) { | 290 | if (dev_priv->chipset < NV_C0) { |
296 | ret = nv50_calc_pll2(dev, &pll, pclk, &N1, &N2, &M1, &P); | 291 | ret = nv50_calc_pll2(dev, &pll, pclk, &N1, &N2, &M1, &P); |
@@ -300,10 +295,10 @@ nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk) | |||
300 | NV_DEBUG(dev, "pclk %d out %d N %d fN 0x%04x M %d P %d\n", | 295 | NV_DEBUG(dev, "pclk %d out %d N %d fN 0x%04x M %d P %d\n", |
301 | pclk, ret, N1, N2, M1, P); | 296 | pclk, ret, N1, N2, M1, P); |
302 | 297 | ||
303 | reg1 = nv_rd32(dev, reg + 4) & 0xffc00000; | 298 | reg1 = nv_rd32(dev, pll.reg + 4) & 0xffc00000; |
304 | nv_wr32(dev, reg, 0x50000610); | 299 | nv_wr32(dev, pll.reg + 0, 0x50000610); |
305 | nv_wr32(dev, reg + 4, reg1 | (P << 16) | (M1 << 8) | N1); | 300 | nv_wr32(dev, pll.reg + 4, reg1 | (P << 16) | (M1 << 8) | N1); |
306 | nv_wr32(dev, reg + 8, N2); | 301 | nv_wr32(dev, pll.reg + 8, N2); |
307 | } else { | 302 | } else { |
308 | ret = nv50_calc_pll2(dev, &pll, pclk, &N1, &N2, &M1, &P); | 303 | ret = nv50_calc_pll2(dev, &pll, pclk, &N1, &N2, &M1, &P); |
309 | if (ret <= 0) | 304 | if (ret <= 0) |
@@ -312,9 +307,9 @@ nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk) | |||
312 | NV_DEBUG(dev, "pclk %d out %d N %d fN 0x%04x M %d P %d\n", | 307 | NV_DEBUG(dev, "pclk %d out %d N %d fN 0x%04x M %d P %d\n", |
313 | pclk, ret, N1, N2, M1, P); | 308 | pclk, ret, N1, N2, M1, P); |
314 | 309 | ||
315 | nv_mask(dev, reg + 0x0c, 0x00000000, 0x00000100); | 310 | nv_mask(dev, pll.reg + 0x0c, 0x00000000, 0x00000100); |
316 | nv_wr32(dev, reg + 0x04, (P << 16) | (N1 << 8) | M1); | 311 | nv_wr32(dev, pll.reg + 0x04, (P << 16) | (N1 << 8) | M1); |
317 | nv_wr32(dev, reg + 0x10, N2 << 16); | 312 | nv_wr32(dev, pll.reg + 0x10, N2 << 16); |
318 | } | 313 | } |
319 | 314 | ||
320 | return 0; | 315 | return 0; |