aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoralf Trønnes <noralf@tronnes.org>2017-11-15 09:19:44 -0500
committerNoralf Trønnes <noralf@tronnes.org>2017-12-08 08:47:39 -0500
commitce4eb35bfa4034f3076f71666e869cd729e3d0e4 (patch)
tree295d9f21a6bbb1abaf034caaa0e9d7eaa82eadf4
parent41b676e03f1c7983a94694cbd90d27c9a12cb9b9 (diff)
drm/atmel-hlcdc: 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: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-6-noralf@tronnes.org
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c26
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h2
2 files changed, 5 insertions, 23 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index c6e8061ffcfc..c1ea5c36b006 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -461,13 +461,6 @@ static struct drm_framebuffer *atmel_hlcdc_fb_create(struct drm_device *dev,
461 return drm_gem_fb_create(dev, file_priv, mode_cmd); 461 return drm_gem_fb_create(dev, file_priv, mode_cmd);
462} 462}
463 463
464static void atmel_hlcdc_fb_output_poll_changed(struct drm_device *dev)
465{
466 struct atmel_hlcdc_dc *dc = dev->dev_private;
467
468 drm_fbdev_cma_hotplug_event(dc->fbdev);
469}
470
471struct atmel_hlcdc_dc_commit { 464struct atmel_hlcdc_dc_commit {
472 struct work_struct work; 465 struct work_struct work;
473 struct drm_device *dev; 466 struct drm_device *dev;
@@ -563,7 +556,7 @@ error:
563 556
564static const struct drm_mode_config_funcs mode_config_funcs = { 557static const struct drm_mode_config_funcs mode_config_funcs = {
565 .fb_create = atmel_hlcdc_fb_create, 558 .fb_create = atmel_hlcdc_fb_create,
566 .output_poll_changed = atmel_hlcdc_fb_output_poll_changed, 559 .output_poll_changed = drm_fb_helper_output_poll_changed,
567 .atomic_check = drm_atomic_helper_check, 560 .atomic_check = drm_atomic_helper_check,
568 .atomic_commit = atmel_hlcdc_dc_atomic_commit, 561 .atomic_commit = atmel_hlcdc_dc_atomic_commit,
569}; 562};
@@ -665,10 +658,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
665 658
666 platform_set_drvdata(pdev, dev); 659 platform_set_drvdata(pdev, dev);
667 660
668 dc->fbdev = drm_fbdev_cma_init(dev, 24, 661 drm_fb_cma_fbdev_init(dev, 24, 0);
669 dev->mode_config.num_connector);
670 if (IS_ERR(dc->fbdev))
671 dc->fbdev = NULL;
672 662
673 drm_kms_helper_poll_init(dev); 663 drm_kms_helper_poll_init(dev);
674 664
@@ -688,8 +678,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
688{ 678{
689 struct atmel_hlcdc_dc *dc = dev->dev_private; 679 struct atmel_hlcdc_dc *dc = dev->dev_private;
690 680
691 if (dc->fbdev) 681 drm_fb_cma_fbdev_fini(dev);
692 drm_fbdev_cma_fini(dc->fbdev);
693 flush_workqueue(dc->wq); 682 flush_workqueue(dc->wq);
694 drm_kms_helper_poll_fini(dev); 683 drm_kms_helper_poll_fini(dev);
695 drm_mode_config_cleanup(dev); 684 drm_mode_config_cleanup(dev);
@@ -705,13 +694,6 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
705 destroy_workqueue(dc->wq); 694 destroy_workqueue(dc->wq);
706} 695}
707 696
708static void atmel_hlcdc_dc_lastclose(struct drm_device *dev)
709{
710 struct atmel_hlcdc_dc *dc = dev->dev_private;
711
712 drm_fbdev_cma_restore_mode(dc->fbdev);
713}
714
715static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev) 697static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev)
716{ 698{
717 struct atmel_hlcdc_dc *dc = dev->dev_private; 699 struct atmel_hlcdc_dc *dc = dev->dev_private;
@@ -744,7 +726,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
744 .driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM | 726 .driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
745 DRIVER_MODESET | DRIVER_PRIME | 727 DRIVER_MODESET | DRIVER_PRIME |
746 DRIVER_ATOMIC, 728 DRIVER_ATOMIC,
747 .lastclose = atmel_hlcdc_dc_lastclose, 729 .lastclose = drm_fb_helper_lastclose,
748 .irq_handler = atmel_hlcdc_dc_irq_handler, 730 .irq_handler = atmel_hlcdc_dc_irq_handler,
749 .irq_preinstall = atmel_hlcdc_dc_irq_uninstall, 731 .irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
750 .irq_postinstall = atmel_hlcdc_dc_irq_postinstall, 732 .irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
index 6833ee253cfa..ab32d5b268d2 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
@@ -32,6 +32,7 @@
32#include <drm/drm_atomic_helper.h> 32#include <drm/drm_atomic_helper.h>
33#include <drm/drm_crtc.h> 33#include <drm/drm_crtc.h>
34#include <drm/drm_crtc_helper.h> 34#include <drm/drm_crtc_helper.h>
35#include <drm/drm_fb_helper.h>
35#include <drm/drm_fb_cma_helper.h> 36#include <drm/drm_fb_cma_helper.h>
36#include <drm/drm_gem_cma_helper.h> 37#include <drm/drm_gem_cma_helper.h>
37#include <drm/drm_gem_framebuffer_helper.h> 38#include <drm/drm_gem_framebuffer_helper.h>
@@ -374,7 +375,6 @@ struct atmel_hlcdc_dc {
374 const struct atmel_hlcdc_dc_desc *desc; 375 const struct atmel_hlcdc_dc_desc *desc;
375 struct dma_pool *dscrpool; 376 struct dma_pool *dscrpool;
376 struct atmel_hlcdc *hlcdc; 377 struct atmel_hlcdc *hlcdc;
377 struct drm_fbdev_cma *fbdev;
378 struct drm_crtc *crtc; 378 struct drm_crtc *crtc;
379 struct atmel_hlcdc_layer *layers[ATMEL_HLCDC_MAX_LAYERS]; 379 struct atmel_hlcdc_layer *layers[ATMEL_HLCDC_MAX_LAYERS];
380 struct workqueue_struct *wq; 380 struct workqueue_struct *wq;