drm/atmel-hlcdc: Use drm_fbdev_generic_setup()
authorNoralf Trønnes <noralf@tronnes.org>
Thu, 25 Oct 2018 20:13:37 +0000 (22:13 +0200)
committerNoralf Trønnes <noralf@tronnes.org>
Thu, 1 Nov 2018 14:24:22 +0000 (15:24 +0100)
The CMA helper is already using the drm_fb_helper_generic_probe part of
the generic fbdev emulation. This patch makes full use of the generic
fbdev emulation by using its drm_client callbacks. This means that
drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
now handled by the emulation code. Additionally fbdev unregister happens
automatically on drm_dev_unregister().

The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
driver. This is done to highlight the fact that fbdev emulation is an
internal client that makes use of the driver, it is not part of the
driver as such. If fbdev setup fails, an error is printed, but the driver
succeeds probing.

Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181025201340.34227-7-noralf@tronnes.org
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c

index fedbfa333bb0bd4697f1094fa4a1339d4708aacb..034a91112098d87848fd26c26749680d49c50b07 100644 (file)
@@ -556,7 +556,6 @@ error:
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
        .fb_create = atmel_hlcdc_fb_create,
-       .output_poll_changed = drm_fb_helper_output_poll_changed,
        .atomic_check = drm_atomic_helper_check,
        .atomic_commit = atmel_hlcdc_dc_atomic_commit,
 };
@@ -658,8 +657,6 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev)
 
        platform_set_drvdata(pdev, dev);
 
-       drm_fb_cma_fbdev_init(dev, 24, 0);
-
        drm_kms_helper_poll_init(dev);
 
        return 0;
@@ -678,7 +675,6 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 {
        struct atmel_hlcdc_dc *dc = dev->dev_private;
 
-       drm_fb_cma_fbdev_fini(dev);
        flush_workqueue(dc->wq);
        drm_kms_helper_poll_fini(dev);
        drm_atomic_helper_shutdown(dev);
@@ -727,7 +723,6 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
        .driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
                           DRIVER_MODESET | DRIVER_PRIME |
                           DRIVER_ATOMIC,
-       .lastclose = drm_fb_helper_lastclose,
        .irq_handler = atmel_hlcdc_dc_irq_handler,
        .irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
        .irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
@@ -769,6 +764,8 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev)
        if (ret)
                goto err_unload;
 
+       drm_fbdev_generic_setup(ddev, 24);
+
        return 0;
 
 err_unload: