aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoralf Trønnes <noralf@tronnes.org>2017-11-15 09:19:58 -0500
committerNoralf Trønnes <noralf@tronnes.org>2017-12-08 08:47:43 -0500
commitbdecd83546352e0cdf54f64d8d6206f1fef32d75 (patch)
tree3587908949ba854fe9cf4c1cb195a83ef8e20001
parentf05682a8b4ab4f854a358c25fb1220ed51161527 (diff)
drm/arm/mali: Use drm_fb_cma_fbdev_init/fini()
Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly. Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Brian Starkey <brian.starkey@arm.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Liviu Dudau <liviu.dudau@arm.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-20-noralf@tronnes.org
-rw-r--r--drivers/gpu/drm/arm/malidp_drv.c39
-rw-r--r--drivers/gpu/drm/arm/malidp_drv.h1
2 files changed, 7 insertions, 33 deletions
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index e080e31a8513..3d82712d8002 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/component.h> 15#include <linux/component.h>
16#include <linux/console.h>
17#include <linux/of_device.h> 16#include <linux/of_device.h>
18#include <linux/of_graph.h> 17#include <linux/of_graph.h>
19#include <linux/of_reserved_mem.h> 18#include <linux/of_reserved_mem.h>
@@ -24,6 +23,7 @@
24#include <drm/drm_atomic_helper.h> 23#include <drm/drm_atomic_helper.h>
25#include <drm/drm_crtc.h> 24#include <drm/drm_crtc.h>
26#include <drm/drm_crtc_helper.h> 25#include <drm/drm_crtc_helper.h>
26#include <drm/drm_fb_helper.h>
27#include <drm/drm_fb_cma_helper.h> 27#include <drm/drm_fb_cma_helper.h>
28#include <drm/drm_gem_cma_helper.h> 28#include <drm/drm_gem_cma_helper.h>
29#include <drm/drm_gem_framebuffer_helper.h> 29#include <drm/drm_gem_framebuffer_helper.h>
@@ -183,13 +183,6 @@ static int malidp_set_and_wait_config_valid(struct drm_device *drm)
183 return (ret > 0) ? 0 : -ETIMEDOUT; 183 return (ret > 0) ? 0 : -ETIMEDOUT;
184} 184}
185 185
186static void malidp_output_poll_changed(struct drm_device *drm)
187{
188 struct malidp_drm *malidp = drm->dev_private;
189
190 drm_fbdev_cma_hotplug_event(malidp->fbdev);
191}
192
193static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state) 186static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state)
194{ 187{
195 struct drm_pending_vblank_event *event; 188 struct drm_pending_vblank_event *event;
@@ -252,7 +245,7 @@ static const struct drm_mode_config_helper_funcs malidp_mode_config_helpers = {
252 245
253static const struct drm_mode_config_funcs malidp_mode_config_funcs = { 246static const struct drm_mode_config_funcs malidp_mode_config_funcs = {
254 .fb_create = drm_gem_fb_create, 247 .fb_create = drm_gem_fb_create,
255 .output_poll_changed = malidp_output_poll_changed, 248 .output_poll_changed = drm_fb_helper_output_poll_changed,
256 .atomic_check = drm_atomic_helper_check, 249 .atomic_check = drm_atomic_helper_check,
257 .atomic_commit = drm_atomic_helper_commit, 250 .atomic_commit = drm_atomic_helper_commit,
258}; 251};
@@ -317,19 +310,12 @@ static int malidp_irq_init(struct platform_device *pdev)
317 return 0; 310 return 0;
318} 311}
319 312
320static void malidp_lastclose(struct drm_device *drm)
321{
322 struct malidp_drm *malidp = drm->dev_private;
323
324 drm_fbdev_cma_restore_mode(malidp->fbdev);
325}
326
327DEFINE_DRM_GEM_CMA_FOPS(fops); 313DEFINE_DRM_GEM_CMA_FOPS(fops);
328 314
329static struct drm_driver malidp_driver = { 315static struct drm_driver malidp_driver = {
330 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC | 316 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
331 DRIVER_PRIME, 317 DRIVER_PRIME,
332 .lastclose = malidp_lastclose, 318 .lastclose = drm_fb_helper_lastclose,
333 .gem_free_object_unlocked = drm_gem_cma_free_object, 319 .gem_free_object_unlocked = drm_gem_cma_free_object,
334 .gem_vm_ops = &drm_gem_cma_vm_ops, 320 .gem_vm_ops = &drm_gem_cma_vm_ops,
335 .dumb_create = drm_gem_cma_dumb_create, 321 .dumb_create = drm_gem_cma_dumb_create,
@@ -623,14 +609,9 @@ static int malidp_bind(struct device *dev)
623 609
624 drm_mode_config_reset(drm); 610 drm_mode_config_reset(drm);
625 611
626 malidp->fbdev = drm_fbdev_cma_init(drm, 32, 612 ret = drm_fb_cma_fbdev_init(drm, 32, 0);
627 drm->mode_config.num_connector); 613 if (ret)
628
629 if (IS_ERR(malidp->fbdev)) {
630 ret = PTR_ERR(malidp->fbdev);
631 malidp->fbdev = NULL;
632 goto fbdev_fail; 614 goto fbdev_fail;
633 }
634 615
635 drm_kms_helper_poll_init(drm); 616 drm_kms_helper_poll_init(drm);
636 617
@@ -641,10 +622,7 @@ static int malidp_bind(struct device *dev)
641 return 0; 622 return 0;
642 623
643register_fail: 624register_fail:
644 if (malidp->fbdev) { 625 drm_fb_cma_fbdev_fini(drm);
645 drm_fbdev_cma_fini(malidp->fbdev);
646 malidp->fbdev = NULL;
647 }
648 drm_kms_helper_poll_fini(drm); 626 drm_kms_helper_poll_fini(drm);
649fbdev_fail: 627fbdev_fail:
650 pm_runtime_get_sync(dev); 628 pm_runtime_get_sync(dev);
@@ -681,10 +659,7 @@ static void malidp_unbind(struct device *dev)
681 struct malidp_drm *malidp = drm->dev_private; 659 struct malidp_drm *malidp = drm->dev_private;
682 660
683 drm_dev_unregister(drm); 661 drm_dev_unregister(drm);
684 if (malidp->fbdev) { 662 drm_fb_cma_fbdev_fini(drm);
685 drm_fbdev_cma_fini(malidp->fbdev);
686 malidp->fbdev = NULL;
687 }
688 drm_kms_helper_poll_fini(drm); 663 drm_kms_helper_poll_fini(drm);
689 pm_runtime_get_sync(dev); 664 pm_runtime_get_sync(dev);
690 malidp_se_irq_fini(drm); 665 malidp_se_irq_fini(drm);
diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
index 70ed6aeccf05..e0d12c9fc6b8 100644
--- a/drivers/gpu/drm/arm/malidp_drv.h
+++ b/drivers/gpu/drm/arm/malidp_drv.h
@@ -20,7 +20,6 @@
20 20
21struct malidp_drm { 21struct malidp_drm {
22 struct malidp_hw_device *dev; 22 struct malidp_hw_device *dev;
23 struct drm_fbdev_cma *fbdev;
24 struct drm_crtc crtc; 23 struct drm_crtc crtc;
25 wait_queue_head_t wq; 24 wait_queue_head_t wq;
26 atomic_t config_valid; 25 atomic_t config_valid;