summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-07-02 11:19:54 -0500
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-10-13 11:39:39 +0000
commit809a093cf18cc374b1f59ea42cb21085a34b61fe (patch)
treeabd7f2699f24837f699d4531e7d799fab1fa66ad
parentec516140067e9a53c8b293e4c764eb8e6c7e371f (diff)
downloadlinux-809a093cf18cc374b1f59ea42cb21085a34b61fe.tar.gz
drm/vc4: Use the fbdev_cma helpers
Keep the fbdev_cma pointer around so we can use it on hotplog and close to ensure the frame buffer console is in a useful state. Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.c15
-rw-r--r--drivers/gpu/drm/vc4/vc4_drv.h2
-rw-r--r--drivers/gpu/drm/vc4/vc4_kms.c18
3 files changed, 32 insertions, 3 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 5c023ba4f6ad..04f1f738ebc2 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <drm/drm_fb_cma_helper.h>
#include "uapi/drm/vc4_drm.h"
#include "vc4_drv.h"
@@ -78,6 +79,11 @@ vc4_drm_load(struct drm_device *dev, unsigned long flags)
static int vc4_drm_unload(struct drm_device *dev)
{
+ struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+ if (vc4->fbdev)
+ drm_fbdev_cma_fini(vc4->fbdev);
+
drm_mode_config_cleanup(dev);
component_unbind_all(dev->dev, dev);
@@ -93,6 +99,14 @@ static void vc4_drm_preclose(struct drm_device *dev, struct drm_file *file)
vc4_cancel_page_flip(crtc, file);
}
+static void vc4_lastclose(struct drm_device *dev)
+{
+ struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+ if (vc4->fbdev)
+ drm_fbdev_cma_restore_mode(vc4->fbdev);
+}
+
static const struct file_operations vc4_drm_fops = {
.owner = THIS_MODULE,
.open = drm_open,
@@ -123,6 +137,7 @@ static struct drm_driver vc4_drm_driver = {
DRIVER_PRIME),
.load = vc4_drm_load,
.unload = vc4_drm_unload,
+ .lastclose = vc4_lastclose,
.set_busid = drm_platform_set_busid,
.preclose = vc4_drm_preclose,
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 13b475785ca0..d460bb3e6b64 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -81,6 +81,8 @@ struct vc4_dev {
} hangcheck;
struct semaphore async_modeset;
+
+ struct drm_fbdev_cma *fbdev;
};
static inline struct vc4_dev *
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index acfd1b23ab4a..cb18d8f0e387 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -155,7 +155,17 @@ static int vc4_atomic_commit(struct drm_device *dev,
return 0;
}
+static void vc4_output_poll_changed(struct drm_device *dev)
+{
+ struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+ if (vc4->fbdev)
+ drm_fbdev_cma_hotplug_event(vc4->fbdev);
+}
+
+
static const struct drm_mode_config_funcs vc4_mode_funcs = {
+ .output_poll_changed = vc4_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = vc4_atomic_commit,
.fb_create = drm_fb_cma_create,
@@ -214,9 +224,11 @@ vc4_kms_load(struct drm_device *dev)
drm_mode_config_reset(dev);
- drm_fbdev_cma_init(dev, 32,
- dev->mode_config.num_crtc,
- dev->mode_config.num_connector);
+ vc4->fbdev = drm_fbdev_cma_init(dev, 32,
+ dev->mode_config.num_crtc,
+ dev->mode_config.num_connector);
+ if (IS_ERR(vc4->fbdev))
+ vc4->fbdev = NULL;
drm_kms_helper_poll_init(dev);