Skip to content

Commit bdecd83

Browse files
committed
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
1 parent f05682a commit bdecd83

2 files changed

Lines changed: 7 additions & 33 deletions

File tree

‎drivers/gpu/drm/arm/malidp_drv.c‎

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <linux/module.h>
1414
#include <linux/clk.h>
1515
#include <linux/component.h>
16-
#include <linux/console.h>
1716
#include <linux/of_device.h>
1817
#include <linux/of_graph.h>
1918
#include <linux/of_reserved_mem.h>
@@ -24,6 +23,7 @@
2423
#include <drm/drm_atomic_helper.h>
2524
#include <drm/drm_crtc.h>
2625
#include <drm/drm_crtc_helper.h>
26+
#include <drm/drm_fb_helper.h>
2727
#include <drm/drm_fb_cma_helper.h>
2828
#include <drm/drm_gem_cma_helper.h>
2929
#include <drm/drm_gem_framebuffer_helper.h>
@@ -183,13 +183,6 @@ static int malidp_set_and_wait_config_valid(struct drm_device *drm)
183183
return (ret > 0) ? 0 : -ETIMEDOUT;
184184
}
185185

186-
static 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-
193186
static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state)
194187
{
195188
struct drm_pending_vblank_event *event;
@@ -252,7 +245,7 @@ static const struct drm_mode_config_helper_funcs malidp_mode_config_helpers = {
252245

253246
static const struct drm_mode_config_funcs malidp_mode_config_funcs = {
254247
.fb_create = drm_gem_fb_create,
255-
.output_poll_changed = malidp_output_poll_changed,
248+
.output_poll_changed = drm_fb_helper_output_poll_changed,
256249
.atomic_check = drm_atomic_helper_check,
257250
.atomic_commit = drm_atomic_helper_commit,
258251
};
@@ -317,19 +310,12 @@ static int malidp_irq_init(struct platform_device *pdev)
317310
return 0;
318311
}
319312

320-
static 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-
327313
DEFINE_DRM_GEM_CMA_FOPS(fops);
328314

329315
static struct drm_driver malidp_driver = {
330316
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
331317
DRIVER_PRIME,
332-
.lastclose = malidp_lastclose,
318+
.lastclose = drm_fb_helper_lastclose,
333319
.gem_free_object_unlocked = drm_gem_cma_free_object,
334320
.gem_vm_ops = &drm_gem_cma_vm_ops,
335321
.dumb_create = drm_gem_cma_dumb_create,
@@ -623,14 +609,9 @@ static int malidp_bind(struct device *dev)
623609

624610
drm_mode_config_reset(drm);
625611

626-
malidp->fbdev = drm_fbdev_cma_init(drm, 32,
627-
drm->mode_config.num_connector);
628-
629-
if (IS_ERR(malidp->fbdev)) {
630-
ret = PTR_ERR(malidp->fbdev);
631-
malidp->fbdev = NULL;
612+
ret = drm_fb_cma_fbdev_init(drm, 32, 0);
613+
if (ret)
632614
goto fbdev_fail;
633-
}
634615

635616
drm_kms_helper_poll_init(drm);
636617

@@ -641,10 +622,7 @@ static int malidp_bind(struct device *dev)
641622
return 0;
642623

643624
register_fail:
644-
if (malidp->fbdev) {
645-
drm_fbdev_cma_fini(malidp->fbdev);
646-
malidp->fbdev = NULL;
647-
}
625+
drm_fb_cma_fbdev_fini(drm);
648626
drm_kms_helper_poll_fini(drm);
649627
fbdev_fail:
650628
pm_runtime_get_sync(dev);
@@ -681,10 +659,7 @@ static void malidp_unbind(struct device *dev)
681659
struct malidp_drm *malidp = drm->dev_private;
682660

683661
drm_dev_unregister(drm);
684-
if (malidp->fbdev) {
685-
drm_fbdev_cma_fini(malidp->fbdev);
686-
malidp->fbdev = NULL;
687-
}
662+
drm_fb_cma_fbdev_fini(drm);
688663
drm_kms_helper_poll_fini(drm);
689664
pm_runtime_get_sync(dev);
690665
malidp_se_irq_fini(drm);

‎drivers/gpu/drm/arm/malidp_drv.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
struct malidp_drm {
2222
struct malidp_hw_device *dev;
23-
struct drm_fbdev_cma *fbdev;
2423
struct drm_crtc crtc;
2524
wait_queue_head_t wq;
2625
atomic_t config_valid;

0 commit comments

Comments
 (0)