]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.52/drm-sun4i-implement-drm_driver-lastclose-to-restore-fbdev-console.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.52 / drm-sun4i-implement-drm_driver-lastclose-to-restore-fbdev-console.patch
1 From 2a596fc9d974bb040eda9ab70bf8756fcaaa6afe Mon Sep 17 00:00:00 2001
2 From: Jonathan Liu <net147@gmail.com>
3 Date: Mon, 10 Jul 2017 16:55:04 +1000
4 Subject: drm/sun4i: Implement drm_driver lastclose to restore fbdev console
5
6 From: Jonathan Liu <net147@gmail.com>
7
8 commit 2a596fc9d974bb040eda9ab70bf8756fcaaa6afe upstream.
9
10 The drm_driver lastclose callback is called when the last userspace
11 DRM client has closed. Call drm_fbdev_cma_restore_mode to restore
12 the fbdev console otherwise the fbdev console will stop working.
13
14 Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
15 Tested-by: Olliver Schinagl <oliver@schinagl.nl>
16 Reviewed-by: Chen-Yu Tsai <wens@csie.org>
17 Signed-off-by: Jonathan Liu <net147@gmail.com>
18 Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
19 [net147@gmail.com: Backport to 4.9, minor context change]
20 Signed-off-by: Jonathan Liu <net147@gmail.com>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23
24 ---
25 drivers/gpu/drm/sun4i/sun4i_drv.c | 8 ++++++++
26 1 file changed, 8 insertions(+)
27
28 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
29 +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
30 @@ -47,6 +47,13 @@ static void sun4i_drv_disable_vblank(str
31 sun4i_tcon_enable_vblank(tcon, false);
32 }
33
34 +static void sun4i_drv_lastclose(struct drm_device *dev)
35 +{
36 + struct sun4i_drv *drv = dev->dev_private;
37 +
38 + drm_fbdev_cma_restore_mode(drv->fbdev);
39 +}
40 +
41 static const struct file_operations sun4i_drv_fops = {
42 .owner = THIS_MODULE,
43 .open = drm_open,
44 @@ -65,6 +72,7 @@ static struct drm_driver sun4i_drv_drive
45 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC,
46
47 /* Generic Operations */
48 + .lastclose = sun4i_drv_lastclose,
49 .fops = &sun4i_drv_fops,
50 .name = "sun4i-drm",
51 .desc = "Allwinner sun4i Display Engine",