Commit 8932541b authored by Dave Airlie's avatar Dave Airlie

Merge tag 'tilcdc-4.16' of https://github.com/jsarha/linux into drm-next

drm/tilcdc changes for 4.16

* tag 'tilcdc-4.16' of https://github.com/jsarha/linux:
  drm/tilcdc: make tilcdc_mode_hvtotal() static
  drm/tilcdc: Remove drm_framebuffer_get() and *_put() calls
  drm/tilcdc: ensure nonatomic iowrite64 is not used
parents 6a9991bc 584d4ed8
...@@ -51,12 +51,8 @@ struct tilcdc_crtc { ...@@ -51,12 +51,8 @@ struct tilcdc_crtc {
ktime_t last_vblank; ktime_t last_vblank;
unsigned int hvtotal_us; unsigned int hvtotal_us;
struct drm_framebuffer *curr_fb;
struct drm_framebuffer *next_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 */ /* Only set if an external encoder is connected */
bool simulate_vesa_sync; bool simulate_vesa_sync;
...@@ -70,20 +66,8 @@ struct tilcdc_crtc { ...@@ -70,20 +66,8 @@ struct tilcdc_crtc {
}; };
#define to_tilcdc_crtc(x) container_of(x, struct tilcdc_crtc, base) #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) 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 drm_device *dev = crtc->dev;
struct tilcdc_drm_private *priv = dev->dev_private; struct tilcdc_drm_private *priv = dev->dev_private;
struct drm_gem_cma_object *gem; struct drm_gem_cma_object *gem;
...@@ -108,12 +92,6 @@ static void set_scanout(struct drm_crtc *crtc, struct drm_framebuffer *fb) ...@@ -108,12 +92,6 @@ static void set_scanout(struct drm_crtc *crtc, struct drm_framebuffer *fb)
dma_base_and_ceiling = (u64)end << 32 | start; dma_base_and_ceiling = (u64)end << 32 | start;
tilcdc_write64(dev, LCDC_DMA_FB_BASE_ADDR_0_REG, dma_base_and_ceiling); 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) ...@@ -294,7 +272,7 @@ static void tilcdc_crtc_set_clk(struct drm_crtc *crtc)
LCDC_V2_CORE_CLK_EN); 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, return (uint) div_u64(1000llu * mode->htotal * mode->vtotal,
mode->clock); mode->clock);
...@@ -464,8 +442,6 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc) ...@@ -464,8 +442,6 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)
set_scanout(crtc, fb); set_scanout(crtc, fb);
drm_framebuffer_get(fb);
crtc->hwmode = crtc->state->adjusted_mode; crtc->hwmode = crtc->state->adjusted_mode;
tilcdc_crtc->hvtotal_us = tilcdc_crtc->hvtotal_us =
...@@ -524,7 +500,6 @@ static void tilcdc_crtc_off(struct drm_crtc *crtc, bool shutdown) ...@@ -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 tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct tilcdc_drm_private *priv = dev->dev_private;
int ret; int ret;
mutex_lock(&tilcdc_crtc->enable_lock); mutex_lock(&tilcdc_crtc->enable_lock);
...@@ -554,20 +529,6 @@ static void tilcdc_crtc_off(struct drm_crtc *crtc, bool shutdown) ...@@ -554,20 +529,6 @@ static void tilcdc_crtc_off(struct drm_crtc *crtc, bool shutdown)
pm_runtime_put_sync(dev->dev); 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; tilcdc_crtc->enabled = false;
mutex_unlock(&tilcdc_crtc->enable_lock); mutex_unlock(&tilcdc_crtc->enable_lock);
} }
...@@ -614,7 +575,6 @@ static void tilcdc_crtc_recover_work(struct work_struct *work) ...@@ -614,7 +575,6 @@ static void tilcdc_crtc_recover_work(struct work_struct *work)
static void tilcdc_crtc_destroy(struct drm_crtc *crtc) 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; struct tilcdc_drm_private *priv = crtc->dev->dev_private;
tilcdc_crtc_shutdown(crtc); tilcdc_crtc_shutdown(crtc);
...@@ -623,7 +583,6 @@ static void tilcdc_crtc_destroy(struct drm_crtc *crtc) ...@@ -623,7 +583,6 @@ static void tilcdc_crtc_destroy(struct drm_crtc *crtc)
of_node_put(crtc->port); of_node_put(crtc->port);
drm_crtc_cleanup(crtc); drm_crtc_cleanup(crtc);
drm_flip_work_cleanup(&tilcdc_crtc->unref_work);
} }
int tilcdc_crtc_update_fb(struct drm_crtc *crtc, int tilcdc_crtc_update_fb(struct drm_crtc *crtc,
...@@ -638,9 +597,6 @@ int tilcdc_crtc_update_fb(struct drm_crtc *crtc, ...@@ -638,9 +597,6 @@ int tilcdc_crtc_update_fb(struct drm_crtc *crtc,
return -EBUSY; return -EBUSY;
} }
drm_framebuffer_get(fb);
crtc->primary->fb = fb;
tilcdc_crtc->event = event; tilcdc_crtc->event = event;
mutex_lock(&tilcdc_crtc->enable_lock); mutex_lock(&tilcdc_crtc->enable_lock);
...@@ -936,8 +892,6 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc) ...@@ -936,8 +892,6 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
now = ktime_get(); now = ktime_get();
drm_flip_work_commit(&tilcdc_crtc->unref_work, priv->wq);
spin_lock_irqsave(&tilcdc_crtc->irq_lock, flags); spin_lock_irqsave(&tilcdc_crtc->irq_lock, flags);
tilcdc_crtc->last_vblank = now; tilcdc_crtc->last_vblank = now;
...@@ -1064,9 +1018,6 @@ int tilcdc_crtc_create(struct drm_device *dev) ...@@ -1064,9 +1018,6 @@ int tilcdc_crtc_create(struct drm_device *dev)
init_waitqueue_head(&tilcdc_crtc->frame_done_wq); 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); spin_lock_init(&tilcdc_crtc->irq_lock);
INIT_WORK(&tilcdc_crtc->recover_work, tilcdc_crtc_recover_work); INIT_WORK(&tilcdc_crtc->recover_work, tilcdc_crtc_recover_work);
......
...@@ -133,7 +133,7 @@ static inline void tilcdc_write64(struct drm_device *dev, u32 reg, u64 data) ...@@ -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; struct tilcdc_drm_private *priv = dev->dev_private;
volatile void __iomem *addr = priv->mmio + reg; volatile void __iomem *addr = priv->mmio + reg;
#ifdef iowrite64 #if defined(iowrite64) && !defined(iowrite64_is_nonatomic)
iowrite64(data, addr); iowrite64(data, addr);
#else #else
__iowmb(); __iowmb();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment