volt/gk104: round up in gk104_volt_set

Submitted by Karol Herbst on April 16, 2016, 6:01 p.m.

Details

Message ID 1460829719-3382-1-git-send-email-nouveau@karolherbst.de
State New
Headers show
Series "volt/gk104: round up in gk104_volt_set" ( rev: 1 ) in Nouveau

Not browsing as part of any series.

Commit Message

Karol Herbst April 16, 2016, 6:01 p.m.
We always want a equal or higher voltage than the requested ones, otherwise
nouveau undervolts.

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
---
 drm/nouveau/nvkm/subdev/volt/gk104.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drm/nouveau/nvkm/subdev/volt/gk104.c b/drm/nouveau/nvkm/subdev/volt/gk104.c
index 81788c2..9043dc8 100644
--- a/drm/nouveau/nvkm/subdev/volt/gk104.c
+++ b/drm/nouveau/nvkm/subdev/volt/gk104.c
@@ -57,7 +57,7 @@  gk104_volt_set(struct nvkm_volt *base, u32 uv)
 
 	/* the blob uses this crystal frequency, let's use it too. */
 	div = 27648000 / bios->pwm_freq;
-	duty = (uv - bios->base) * div / bios->pwm_range;
+	duty = DIV_ROUND_UP((uv - bios->base) * div, bios->pwm_range);
 
 	nvkm_wr32(device, 0x20340, div);
 	nvkm_wr32(device, 0x20344, 0x80000000 | duty);