Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 12:45:20 UTC 2021

Modified Files:
        src/sys/arch/arm/rockchip: rk_fb.c

Log Message:
rkdrm: Turn display off and back on again at config_interrupts.

This grody kludge works around whatever we're doing wrong in the
initial modeset that causes it not to take.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_fb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/rockchip/rk_fb.c
diff -u src/sys/arch/arm/rockchip/rk_fb.c:1.5 src/sys/arch/arm/rockchip/rk_fb.c:1.6
--- src/sys/arch/arm/rockchip/rk_fb.c:1.5	Sun Dec 19 12:28:27 2021
+++ src/sys/arch/arm/rockchip/rk_fb.c	Sun Dec 19 12:45:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_fb.c,v 1.5 2021/12/19 12:28:27 riastradh Exp $ */
+/* $NetBSD: rk_fb.c,v 1.6 2021/12/19 12:45:19 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015-2019 Jared McNeill <jmcne...@invisible.ca>
@@ -29,7 +29,7 @@
 #include "opt_wsdisplay_compat.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk_fb.c,v 1.5 2021/12/19 12:28:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_fb.c,v 1.6 2021/12/19 12:45:19 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -99,6 +99,25 @@ rk_fb_attach(device_t parent, device_t s
 }
 
 static void
+rk_fb_turnoffandbackonagain(device_t self)
+{
+	struct rk_fb_softc *sc = device_private(self);
+	struct rk_drmfb_attach_args * const sfa = &sc->sc_sfa;
+
+	/*
+	 * This is a grody kludge to turn the display off and back on
+	 * again at boot; otherwise the initial modeset doesn't take.
+	 * This is surely a bug somewhere in rk_vop.c or nearby, but I
+	 * haven't been able to find it, and this gives us almost the
+	 * same effect.
+	 */
+	mutex_lock(&sfa->sfa_fb_helper->lock);
+	drm_client_modeset_dpms(&sfa->sfa_fb_helper->client, DRM_MODE_DPMS_OFF);
+	drm_client_modeset_dpms(&sfa->sfa_fb_helper->client, DRM_MODE_DPMS_ON);
+	mutex_unlock(&sfa->sfa_fb_helper->lock);
+}
+
+static void
 rk_fb_init(struct rk_drm_task *task)
 {
 	struct rk_fb_softc * const sc =
@@ -123,6 +142,8 @@ rk_fb_init(struct rk_drm_task *task)
 	}
 
 	pmf_device_register1(self, NULL, NULL, rk_fb_shutdown);
+
+	config_interrupts(self, rk_fb_turnoffandbackonagain);
 }
 
 static bool

Reply via email to