diff options
Diffstat (limited to 'drivers/gpu/drm/tilcdc')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 51 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_drv.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_regs.h | 2 |
4 files changed, 8 insertions, 75 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 6ef4d1a1e3a9..8bf6bb93dc79 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c @@ -51,12 +51,8 @@ struct tilcdc_crtc { ktime_t last_vblank; unsigned int hvtotal_us; - struct drm_framebuffer *curr_fb; struct drm_framebuffer *next_fb; - /* for deferred fb unref's: */ - struct drm_flip_work unref_work; - /* Only set if an external encoder is connected */ bool simulate_vesa_sync; @@ -70,20 +66,8 @@ struct tilcdc_crtc { }; #define to_tilcdc_crtc(x) container_of(x, struct tilcdc_crtc, base) -static void unref_worker(struct drm_flip_work *work, void *val) -{ - struct tilcdc_crtc *tilcdc_crtc = - container_of(work, struct tilcdc_crtc, unref_work); - struct drm_device *dev = tilcdc_crtc->base.dev; - - mutex_lock(&dev->mode_config.mutex); - drm_framebuffer_put(val); - mutex_unlock(&dev->mode_config.mutex); -} - static void set_scanout(struct drm_crtc *crtc, struct drm_framebuffer *fb) { - struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc); struct drm_device *dev = crtc->dev; struct tilcdc_drm_private *priv = dev->dev_private; struct drm_gem_cma_object *gem; @@ -108,12 +92,6 @@ static void set_scanout(struct drm_crtc *crtc, struct drm_framebuffer *fb) dma_base_and_ceiling = (u64)end << 32 | start; tilcdc_write64(dev, LCDC_DMA_FB_BASE_ADDR_0_REG, dma_base_and_ceiling); - - if (tilcdc_crtc->curr_fb) - drm_flip_work_queue(&tilcdc_crtc->unref_work, - tilcdc_crtc->curr_fb); - - tilcdc_crtc->curr_fb = fb; } /* @@ -294,7 +272,7 @@ static void tilcdc_crtc_set_clk(struct drm_crtc *crtc) LCDC_V2_CORE_CLK_EN); } -uint tilcdc_mode_hvtotal(const struct drm_display_mode *mode) +static uint tilcdc_mode_hvtotal(const struct drm_display_mode *mode) { return (uint) div_u64(1000llu * mode->htotal * mode->vtotal, mode->clock); @@ -464,8 +442,6 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc) set_scanout(crtc, fb); - drm_framebuffer_get(fb); - crtc->hwmode = crtc->state->adjusted_mode; tilcdc_crtc->hvtotal_us = @@ -524,7 +500,6 @@ static void tilcdc_crtc_off(struct drm_crtc *crtc, bool shutdown) { struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc); struct drm_device *dev = crtc->dev; - struct tilcdc_drm_private *priv = dev->dev_private; int ret; mutex_lock(&tilcdc_crtc->enable_lock); @@ -554,20 +529,6 @@ static void tilcdc_crtc_off(struct drm_crtc *crtc, bool shutdown) pm_runtime_put_sync(dev->dev); - if (tilcdc_crtc->next_fb) { - drm_flip_work_queue(&tilcdc_crtc->unref_work, - tilcdc_crtc->next_fb); - tilcdc_crtc->next_fb = NULL; - } - - if (tilcdc_crtc->curr_fb) { - drm_flip_work_queue(&tilcdc_crtc->unref_work, - tilcdc_crtc->curr_fb); - tilcdc_crtc->curr_fb = NULL; - } - - drm_flip_work_commit(&tilcdc_crtc->unref_work, priv->wq); - tilcdc_crtc->enabled = false; mutex_unlock(&tilcdc_crtc->enable_lock); } @@ -614,7 +575,6 @@ out: static void tilcdc_crtc_destroy(struct drm_crtc *crtc) { - struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc); struct tilcdc_drm_private *priv = crtc->dev->dev_private; tilcdc_crtc_shutdown(crtc); @@ -623,7 +583,6 @@ static void tilcdc_crtc_destroy(struct drm_crtc *crtc) of_node_put(crtc->port); drm_crtc_cleanup(crtc); - drm_flip_work_cleanup(&tilcdc_crtc->unref_work); } int tilcdc_crtc_update_fb(struct drm_crtc *crtc, @@ -638,9 +597,6 @@ int tilcdc_crtc_update_fb(struct drm_crtc *crtc, return -EBUSY; } - drm_framebuffer_get(fb); - - crtc->primary->fb = fb; tilcdc_crtc->event = event; mutex_lock(&tilcdc_crtc->enable_lock); @@ -936,8 +892,6 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc) now = ktime_get(); - drm_flip_work_commit(&tilcdc_crtc->unref_work, priv->wq); - spin_lock_irqsave(&tilcdc_crtc->irq_lock, flags); tilcdc_crtc->last_vblank = now; @@ -1064,9 +1018,6 @@ int tilcdc_crtc_create(struct drm_device *dev) init_waitqueue_head(&tilcdc_crtc->frame_done_wq); - drm_flip_work_init(&tilcdc_crtc->unref_work, - "unref", unref_worker); - spin_lock_init(&tilcdc_crtc->irq_lock); INIT_WORK(&tilcdc_crtc->recover_work, tilcdc_crtc_recover_work); diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 72ce063aa0d8..1afde61f1247 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -69,12 +69,6 @@ static struct drm_framebuffer *tilcdc_fb_create(struct drm_device *dev, return drm_gem_fb_create(dev, file_priv, mode_cmd); } -static void tilcdc_fb_output_poll_changed(struct drm_device *dev) -{ - struct tilcdc_drm_private *priv = dev->dev_private; - drm_fbdev_cma_hotplug_event(priv->fbdev); -} - static int tilcdc_atomic_check(struct drm_device *dev, struct drm_atomic_state *state) { @@ -146,7 +140,7 @@ static int tilcdc_commit(struct drm_device *dev, static const struct drm_mode_config_funcs mode_config_funcs = { .fb_create = tilcdc_fb_create, - .output_poll_changed = tilcdc_fb_output_poll_changed, + .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = tilcdc_atomic_check, .atomic_commit = tilcdc_commit, }; @@ -198,8 +192,7 @@ static void tilcdc_fini(struct drm_device *dev) drm_kms_helper_poll_fini(dev); - if (priv->fbdev) - drm_fbdev_cma_fini(priv->fbdev); + drm_fb_cma_fbdev_fini(dev); drm_irq_uninstall(dev); drm_mode_config_cleanup(dev); @@ -405,12 +398,9 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) drm_mode_config_reset(ddev); - priv->fbdev = drm_fbdev_cma_init(ddev, bpp, - ddev->mode_config.num_connector); - if (IS_ERR(priv->fbdev)) { - ret = PTR_ERR(priv->fbdev); + ret = drm_fb_cma_fbdev_init(ddev, bpp, 0); + if (ret) goto init_failed; - } drm_kms_helper_poll_init(ddev); @@ -427,12 +417,6 @@ init_failed: return ret; } -static void tilcdc_lastclose(struct drm_device *dev) -{ - struct tilcdc_drm_private *priv = dev->dev_private; - drm_fbdev_cma_restore_mode(priv->fbdev); -} - static irqreturn_t tilcdc_irq(int irq, void *arg) { struct drm_device *dev = arg; @@ -507,7 +491,6 @@ static int tilcdc_mm_show(struct seq_file *m, void *arg) static struct drm_info_list tilcdc_debugfs_list[] = { { "regs", tilcdc_regs_show, 0 }, { "mm", tilcdc_mm_show, 0 }, - { "fb", drm_fb_cma_debugfs_show, 0 }, }; static int tilcdc_debugfs_init(struct drm_minor *minor) @@ -538,9 +521,10 @@ DEFINE_DRM_GEM_CMA_FOPS(fops); static struct drm_driver tilcdc_driver = { .driver_features = (DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC), - .lastclose = tilcdc_lastclose, + .lastclose = drm_fb_helper_lastclose, .irq_handler = tilcdc_irq, .gem_free_object_unlocked = drm_gem_cma_free_object, + .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = drm_gem_cma_dumb_create, diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h index 8caa11bc7aec..ead512216669 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h @@ -79,8 +79,6 @@ struct tilcdc_drm_private { struct workqueue_struct *wq; - struct drm_fbdev_cma *fbdev; - struct drm_crtc *crtc; unsigned int num_encoders; diff --git a/drivers/gpu/drm/tilcdc/tilcdc_regs.h b/drivers/gpu/drm/tilcdc/tilcdc_regs.h index 9d528c0a67a4..5048ebb86835 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_regs.h +++ b/drivers/gpu/drm/tilcdc/tilcdc_regs.h @@ -133,7 +133,7 @@ static inline void tilcdc_write64(struct drm_device *dev, u32 reg, u64 data) struct tilcdc_drm_private *priv = dev->dev_private; volatile void __iomem *addr = priv->mmio + reg; -#ifdef iowrite64 +#if defined(iowrite64) && !defined(iowrite64_is_nonatomic) iowrite64(data, addr); #else __iowmb(); |