From ff732e6d28291a6266933afc8217d99721336403 Mon Sep 17 00:00:00 2001 From: Jeffery Miller Date: Fri, 11 Nov 2016 15:54:14 -0500 Subject: [PATCH] nouveau: Force iMac9,1 backlight PWM DIV to 1. The iMac9,1 GeForce 9400 device has NV50_PDISP_SOR_PWM_DIV set to 0x1 by default on boot. Upon resuming via the vbios post routines the DIV will change to 0x84. With this changed range the device does not have the same brightness at the same percentages. It is dark as low as 50%. Force the value to 1 to keep the behavior consistent. Link: https://bugs.freedesktop.org/show_bug.cgi?id=98677 Signed-off-by: Jeffery Miller --- drivers/gpu/drm/nouveau/nouveau_backlight.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index 89eb460..df1729f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c @@ -117,6 +117,10 @@ nv50_set_intensity(struct backlight_device *bd) u32 div = 1025; u32 val = (bd->props.brightness * div) / 100; + /* iMac 9,1 subvendor match to force backlight div consistency. */ + if (nv_match_device(nv_encoder->base.base.dev, 0x0867, 0x106b, 0x00ad)) + nvif_wr32(device, NV50_PDISP_SOR_PWM_DIV(or), 0x1); + nvif_wr32(device, NV50_PDISP_SOR_PWM_CTL(or), NV50_PDISP_SOR_PWM_CTL_NEW | val); return 0; -- 2.7.4