bl: fix backlight regression

Submitted by Karol Herbst on Feb. 16, 2018, 10:21 a.m.

Details

Message ID 20180216102115.11761-1-kherbst@redhat.com
State New
Headers show
Series "bl: fix backlight regression" ( rev: 1 ) in Nouveau

Not browsing as part of any series.

Commit Message

Karol Herbst Feb. 16, 2018, 10:21 a.m.
fixes d9c0aadc5aa241df26ce8301d34a8418919fb5ae

Signed-off-by: Karol Herbst <kherbst@redhat.com>
---
 drm/nouveau/nouveau_backlight.c | 7 +++++++
 drm/nouveau/nv50_display.c      | 4 ++--
 drm/nouveau/nv50_display.h      | 4 ++++
 3 files changed, 13 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drm/nouveau/nouveau_backlight.c b/drm/nouveau/nouveau_backlight.c
index 380f3402..057708da 100644
--- a/drm/nouveau/nouveau_backlight.c
+++ b/drm/nouveau/nouveau_backlight.c
@@ -38,6 +38,8 @@ 
 #include "nouveau_reg.h"
 #include "nouveau_encoder.h"
 
+#include "nv50_display.h"
+
 static struct ida bl_ida;
 #define BL_NAME_SIZE 15 // 12 for name + 2 for digits + 1 for '\0'
 
@@ -220,6 +222,7 @@  nv50_backlight_init(struct drm_connector *connector)
 	const struct backlight_ops *ops;
 	struct backlight_connector bl_connector;
 	char backlight_name[BL_NAME_SIZE];
+	int ret;
 
 	nv_encoder = find_encoder(connector, DCB_OUTPUT_LVDS);
 	if (!nv_encoder) {
@@ -228,8 +231,12 @@  nv50_backlight_init(struct drm_connector *connector)
 			return -ENODEV;
 	}
 
+	ret = nv50_outp_acquire(nv_encoder);
+	if (ret)
+		return ret;
 	if (!nvif_rd32(device, NV50_PDISP_SOR_PWM_CTL(nv_encoder->or)))
 		return 0;
+	nv50_outp_release(nv_encoder);
 
 	if (drm->client.device.info.chipset <= 0xa0 ||
 	    drm->client.device.info.chipset == 0xaa ||
diff --git a/drm/nouveau/nv50_display.c b/drm/nouveau/nv50_display.c
index 6694fa37..70c31b5e 100644
--- a/drm/nouveau/nv50_display.c
+++ b/drm/nouveau/nv50_display.c
@@ -2444,7 +2444,7 @@  out:
 /******************************************************************************
  * Output path helpers
  *****************************************************************************/
-static void
+void
 nv50_outp_release(struct nouveau_encoder *nv_encoder)
 {
 	struct nv50_disp *disp = nv50_disp(nv_encoder->base.base.dev);
@@ -2462,7 +2462,7 @@  nv50_outp_release(struct nouveau_encoder *nv_encoder)
 	nv_encoder->link = 0;
 }
 
-static int
+int
 nv50_outp_acquire(struct nouveau_encoder *nv_encoder)
 {
 	struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
diff --git a/drm/nouveau/nv50_display.h b/drm/nouveau/nv50_display.h
index 918187ce..115637f8 100644
--- a/drm/nouveau/nv50_display.h
+++ b/drm/nouveau/nv50_display.h
@@ -31,8 +31,12 @@ 
 #include "nouveau_crtc.h"
 #include "nouveau_reg.h"
 
+struct nouveau_encoder;
+
 int  nv50_display_create(struct drm_device *);
 void nv50_display_destroy(struct drm_device *);
 int  nv50_display_init(struct drm_device *);
 void nv50_display_fini(struct drm_device *);
+void nv50_outp_release(struct nouveau_encoder *);
+int  nv50_outp_acquire(struct nouveau_encoder *);
 #endif /* __NV50_DISPLAY_H__ */