treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157
[sfrench/cifs-2.6.git] / drivers / gpu / drm / mxsfb / mxsfb_drv.c
index 88ba003979e6b841cce82bd390282335ebb13028..6fafc90da4ec6f071d3164e0492346d511e397bb 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 Marek Vasut <marex@denx.de>
  *
@@ -5,15 +6,6 @@
  * Copyright (C) 2010 Juergen Beisert, Pengutronix
  * Copyright (C) 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright (C) 2008 Embedded Alley Solutions, Inc All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/module.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
-#include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 
 #include "mxsfb_drv.h"
@@ -263,23 +255,12 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)
 
        drm_kms_helper_poll_init(drm);
 
-       mxsfb->fbdev = drm_fbdev_cma_init(drm, 32,
-                                         drm->mode_config.num_connector);
-       if (IS_ERR(mxsfb->fbdev)) {
-               ret = PTR_ERR(mxsfb->fbdev);
-               mxsfb->fbdev = NULL;
-               dev_err(drm->dev, "Failed to init FB CMA area\n");
-               goto err_cma;
-       }
-
        platform_set_drvdata(pdev, drm);
 
        drm_helper_hpd_irq_event(drm);
 
        return 0;
 
-err_cma:
-       drm_irq_uninstall(drm);
 err_irq:
        drm_panel_detach(mxsfb->panel);
 err_vblank:
@@ -290,11 +271,6 @@ err_vblank:
 
 static void mxsfb_unload(struct drm_device *drm)
 {
-       struct mxsfb_drm_private *mxsfb = drm->dev_private;
-
-       if (mxsfb->fbdev)
-               drm_fbdev_cma_fini(mxsfb->fbdev);
-
        drm_kms_helper_poll_fini(drm);
        drm_mode_config_cleanup(drm);
 
@@ -307,13 +283,6 @@ static void mxsfb_unload(struct drm_device *drm)
        pm_runtime_disable(drm->dev);
 }
 
-static void mxsfb_lastclose(struct drm_device *drm)
-{
-       struct mxsfb_drm_private *mxsfb = drm->dev_private;
-
-       drm_fbdev_cma_restore_mode(mxsfb->fbdev);
-}
-
 static void mxsfb_irq_preinstall(struct drm_device *drm)
 {
        struct mxsfb_drm_private *mxsfb = drm->dev_private;
@@ -345,9 +314,7 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static struct drm_driver mxsfb_driver = {
        .driver_features        = DRIVER_GEM | DRIVER_MODESET |
-                                 DRIVER_PRIME | DRIVER_ATOMIC |
-                                 DRIVER_HAVE_IRQ,
-       .lastclose              = mxsfb_lastclose,
+                                 DRIVER_PRIME | DRIVER_ATOMIC,
        .irq_handler            = mxsfb_irq_handler,
        .irq_preinstall         = mxsfb_irq_preinstall,
        .irq_uninstall          = mxsfb_irq_preinstall,
@@ -412,6 +379,8 @@ static int mxsfb_probe(struct platform_device *pdev)
        if (ret)
                goto err_unload;
 
+       drm_fbdev_generic_setup(drm, 32);
+
        return 0;
 
 err_unload: