From bb076be5901a704b5bbaf9c0a026c9325160e8df Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 19 Oct 2011 14:48:18 +1000 Subject: [PATCH] More complete fix for rhbz#747129 --- drm-nouveau-updates-fix-nv40-pm.patch | 24 ------------------------ drm-nouveau-updates.patch | 24 +++++++++++++++++------- kernel.spec | 4 ---- 3 files changed, 17 insertions(+), 35 deletions(-) delete mode 100644 drm-nouveau-updates-fix-nv40-pm.patch diff --git a/drm-nouveau-updates-fix-nv40-pm.patch b/drm-nouveau-updates-fix-nv40-pm.patch deleted file mode 100644 index 16adf20dd..000000000 --- a/drm-nouveau-updates-fix-nv40-pm.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/drivers/gpu/drm/nouveau/nv40_pm.c b/drivers/gpu/drm/nouveau/nv40_pm.c -index 9b5cbb4..73dfdff 100644 ---- a/drivers/gpu/drm/nouveau/nv40_pm.c -+++ b/drivers/gpu/drm/nouveau/nv40_pm.c -@@ -57,12 +57,14 @@ read_pll_2(struct drm_device *dev, u32 reg) - int P = (ctrl & 0x00070000) >> 16; - u32 ref = 27000, clk = 0; - -- if (ctrl & 0x80000000) -+ if ((ctrl & 0x80000000) && M1) { - clk = ref * N1 / M1; -- -- if (!(ctrl & 0x00000100)) { -- if (ctrl & 0x40000000) -- clk = clk * N2 / M2; -+ if ((ctrl & 0x40000100) == 0x40000000) { -+ if (M2) -+ clk = clk * N2 / M2; -+ else -+ clk = 0; -+ } - } - - return clk >> P; diff --git a/drm-nouveau-updates.patch b/drm-nouveau-updates.patch index d311d860d..1e7c9279e 100644 --- a/drm-nouveau-updates.patch +++ b/drm-nouveau-updates.patch @@ -5146,10 +5146,10 @@ index ad03a0e..0000000 -} diff --git a/drivers/gpu/drm/nouveau/nv40_pm.c b/drivers/gpu/drm/nouveau/nv40_pm.c new file mode 100644 -index 0000000..bbc0b9c +index 0000000..e676b0d --- /dev/null +++ b/drivers/gpu/drm/nouveau/nv40_pm.c -@@ -0,0 +1,338 @@ +@@ -0,0 +1,348 @@ +/* + * Copyright 2011 Red Hat Inc. + * @@ -5209,12 +5209,14 @@ index 0000000..bbc0b9c + int P = (ctrl & 0x00070000) >> 16; + u32 ref = 27000, clk = 0; + -+ if (ctrl & 0x80000000) ++ if ((ctrl & 0x80000000) && M1) { + clk = ref * N1 / M1; -+ -+ if (!(ctrl & 0x00000100)) { -+ if (ctrl & 0x40000000) -+ clk = clk * N2 / M2; ++ if ((ctrl & 0x40000100) == 0x40000000) { ++ if (M2) ++ clk = clk * N2 / M2; ++ else ++ clk = 0; ++ } + } + + return clk >> P; @@ -5329,6 +5331,11 @@ index 0000000..bbc0b9c + } + + /* memory clock */ ++ if (!perflvl->memory) { ++ info->mpll_ctrl = 0x00000000; ++ goto out; ++ } ++ + ret = nv40_calc_pll(dev, 0x004020, &pll, perflvl->memory, + &N1, &M1, &N2, &M2, &log2P); + if (ret < 0) @@ -5416,6 +5423,9 @@ index 0000000..bbc0b9c + mdelay(5); + nv_mask(dev, 0x00c040, 0x00000333, info->ctrl); + ++ if (!info->mpll_ctrl) ++ goto resume; ++ + /* wait for vblank start on active crtcs, disable memory access */ + for (i = 0; i < 2; i++) { + if (!(crtc_mask & (1 << i))) diff --git a/kernel.spec b/kernel.spec index 4613f7e1f..5bb627a8c 100644 --- a/kernel.spec +++ b/kernel.spec @@ -680,8 +680,6 @@ Patch1500: fix_xen_guest_on_old_EC2.patch # nouveau + drm fixes Patch1810: drm-nouveau-updates.patch -# fix divide by zero (rhbz #747129) -Patch1811: drm-nouveau-updates-fix-nv40-pm.patch # intel drm is all merged upstream Patch1824: drm-intel-next.patch # make sure the lvds comes back on lid open @@ -1322,8 +1320,6 @@ ApplyPatch fix_xen_guest_on_old_EC2.patch # Nouveau DRM ApplyOptionalPatch drm-nouveau-updates.patch -# fix divide by zero (rhbz #747129) -ApplyPatch drm-nouveau-updates-fix-nv40-pm.patch # Intel DRM ApplyOptionalPatch drm-intel-next.patch