diff options
Diffstat (limited to 'drivers/gpu/drm/tve200/tve200_drv.c')
| -rw-r--r-- | drivers/gpu/drm/tve200/tve200_drv.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c index 7fa71c8bb828..a048e37f1c2c 100644 --- a/drivers/gpu/drm/tve200/tve200_drv.c +++ b/drivers/gpu/drm/tve200/tve200_drv.c @@ -32,17 +32,20 @@ #include <linux/irq.h> #include <linux/io.h> #include <linux/module.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/shmem_fs.h> #include <linux/slab.h> +#include <drm/clients/drm_client_setup.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_bridge.h> #include <drm/drm_drv.h> -#include <drm/drm_fb_cma_helper.h> -#include <drm/drm_fb_helper.h> -#include <drm/drm_gem_cma_helper.h> +#include <drm/drm_fbdev_dma.h> +#include <drm/drm_fourcc.h> +#include <drm/drm_gem_dma_helper.h> #include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_module.h> #include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h> @@ -64,7 +67,7 @@ static int tve200_modeset_init(struct drm_device *dev) struct tve200_drm_dev_private *priv = dev->dev_private; struct drm_panel *panel; struct drm_bridge *bridge; - int ret = 0; + int ret; drm_mode_config_init(dev); mode_config = &dev->mode_config; @@ -92,6 +95,7 @@ static int tve200_modeset_init(struct drm_device *dev) * method to get the connector out of the bridge. */ dev_err(dev->dev, "the bridge is not a panel\n"); + ret = -EINVAL; goto out_bridge; } @@ -134,7 +138,7 @@ finish: return ret; } -DEFINE_DRM_GEM_CMA_FOPS(drm_fops); +DEFINE_DRM_GEM_DMA_FOPS(drm_fops); static const struct drm_driver tve200_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, @@ -142,11 +146,11 @@ static const struct drm_driver tve200_drm_driver = { .fops = &drm_fops, .name = "tve200", .desc = DRIVER_DESC, - .date = "20170703", .major = 1, .minor = 0, .patchlevel = 0, - DRM_GEM_CMA_DRIVER_OPS, + DRM_GEM_DMA_DRIVER_OPS, + DRM_FBDEV_DMA_DRIVER_OPS, }; static int tve200_probe(struct platform_device *pdev) @@ -154,7 +158,6 @@ static int tve200_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct tve200_drm_dev_private *priv; struct drm_device *drm; - struct resource *res; int irq; int ret; @@ -190,8 +193,7 @@ static int tve200_probe(struct platform_device *pdev) goto clk_disable; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->regs = devm_ioremap_resource(dev, res); + priv->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(priv->regs)) { dev_err(dev, "%s failed mmio\n", __func__); ret = -EINVAL; @@ -221,11 +223,7 @@ static int tve200_probe(struct platform_device *pdev) if (ret < 0) goto clk_disable; - /* - * Passing in 16 here will make the RGB565 mode the default - * Passing in 32 will use XRGB8888 mode - */ - drm_fbdev_generic_setup(drm, 16); + drm_client_setup_with_fourcc(drm, DRM_FORMAT_RGB565); return 0; @@ -236,19 +234,23 @@ dev_unref: return ret; } -static int tve200_remove(struct platform_device *pdev) +static void tve200_remove(struct platform_device *pdev) { struct drm_device *drm = platform_get_drvdata(pdev); struct tve200_drm_dev_private *priv = drm->dev_private; drm_dev_unregister(drm); + drm_atomic_helper_shutdown(drm); if (priv->panel) drm_panel_bridge_remove(priv->bridge); drm_mode_config_cleanup(drm); clk_disable_unprepare(priv->pclk); drm_dev_put(drm); +} - return 0; +static void tve200_shutdown(struct platform_device *pdev) +{ + drm_atomic_helper_shutdown(platform_get_drvdata(pdev)); } static const struct of_device_id tve200_of_match[] = { @@ -261,12 +263,13 @@ static const struct of_device_id tve200_of_match[] = { static struct platform_driver tve200_driver = { .driver = { .name = "tve200", - .of_match_table = of_match_ptr(tve200_of_match), + .of_match_table = tve200_of_match, }, .probe = tve200_probe, .remove = tve200_remove, + .shutdown = tve200_shutdown, }; -module_platform_driver(tve200_driver); +drm_module_platform_driver(tve200_driver); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>"); |
