Commit 5922a7d0 authored by Shawn Guo's avatar Shawn Guo Committed by Daniel Vetter

drm: armada: use vblank hooks in struct drm_crtc_funcs

The vblank hooks in struct drm_driver are deprecated and only meant for
legacy drivers.  For modern drivers with DRIVER_MODESET flag, the hooks
in struct drm_crtc_funcs should be used instead.  As the result,
functions armada_drm_crtc_enable[disable]_irq() can be static, although
they are moved around a bit to save forward declaration.

The armada_crtc pointer array in struct armada_private is still kept in
there, because armada_debugfs.c still have reference to it.
Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>
Acked-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1486458995-31018-7-git-send-email-shawnguo@kernel.org
parent d7ae94be
...@@ -418,6 +418,25 @@ static bool armada_drm_crtc_mode_fixup(struct drm_crtc *crtc, ...@@ -418,6 +418,25 @@ static bool armada_drm_crtc_mode_fixup(struct drm_crtc *crtc,
return true; return true;
} }
/* These are locked by dev->vbl_lock */
static void armada_drm_crtc_disable_irq(struct armada_crtc *dcrtc, u32 mask)
{
if (dcrtc->irq_ena & mask) {
dcrtc->irq_ena &= ~mask;
writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
}
}
static void armada_drm_crtc_enable_irq(struct armada_crtc *dcrtc, u32 mask)
{
if ((dcrtc->irq_ena & mask) != mask) {
dcrtc->irq_ena |= mask;
writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
if (readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR) & mask)
writel(0, dcrtc->base + LCD_SPU_IRQ_ISR);
}
}
static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat) static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat)
{ {
void __iomem *base = dcrtc->base; void __iomem *base = dcrtc->base;
...@@ -491,25 +510,6 @@ static irqreturn_t armada_drm_irq(int irq, void *arg) ...@@ -491,25 +510,6 @@ static irqreturn_t armada_drm_irq(int irq, void *arg)
return IRQ_NONE; return IRQ_NONE;
} }
/* These are locked by dev->vbl_lock */
void armada_drm_crtc_disable_irq(struct armada_crtc *dcrtc, u32 mask)
{
if (dcrtc->irq_ena & mask) {
dcrtc->irq_ena &= ~mask;
writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
}
}
void armada_drm_crtc_enable_irq(struct armada_crtc *dcrtc, u32 mask)
{
if ((dcrtc->irq_ena & mask) != mask) {
dcrtc->irq_ena |= mask;
writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
if (readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR) & mask)
writel(0, dcrtc->base + LCD_SPU_IRQ_ISR);
}
}
static uint32_t armada_drm_crtc_calculate_csc(struct armada_crtc *dcrtc) static uint32_t armada_drm_crtc_calculate_csc(struct armada_crtc *dcrtc)
{ {
struct drm_display_mode *adj = &dcrtc->crtc.mode; struct drm_display_mode *adj = &dcrtc->crtc.mode;
...@@ -1109,6 +1109,22 @@ armada_drm_crtc_set_property(struct drm_crtc *crtc, ...@@ -1109,6 +1109,22 @@ armada_drm_crtc_set_property(struct drm_crtc *crtc,
return 0; return 0;
} }
/* These are called under the vbl_lock. */
static int armada_drm_crtc_enable_vblank(struct drm_crtc *crtc)
{
struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
armada_drm_crtc_enable_irq(dcrtc, VSYNC_IRQ_ENA);
return 0;
}
static void armada_drm_crtc_disable_vblank(struct drm_crtc *crtc)
{
struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
armada_drm_crtc_disable_irq(dcrtc, VSYNC_IRQ_ENA);
}
static const struct drm_crtc_funcs armada_crtc_funcs = { static const struct drm_crtc_funcs armada_crtc_funcs = {
.cursor_set = armada_drm_crtc_cursor_set, .cursor_set = armada_drm_crtc_cursor_set,
.cursor_move = armada_drm_crtc_cursor_move, .cursor_move = armada_drm_crtc_cursor_move,
...@@ -1116,6 +1132,8 @@ static const struct drm_crtc_funcs armada_crtc_funcs = { ...@@ -1116,6 +1132,8 @@ static const struct drm_crtc_funcs armada_crtc_funcs = {
.set_config = drm_crtc_helper_set_config, .set_config = drm_crtc_helper_set_config,
.page_flip = armada_drm_crtc_page_flip, .page_flip = armada_drm_crtc_page_flip,
.set_property = armada_drm_crtc_set_property, .set_property = armada_drm_crtc_set_property,
.enable_vblank = armada_drm_crtc_enable_vblank,
.disable_vblank = armada_drm_crtc_disable_vblank,
}; };
static const struct drm_plane_funcs armada_primary_plane_funcs = { static const struct drm_plane_funcs armada_primary_plane_funcs = {
......
...@@ -104,8 +104,6 @@ struct armada_crtc { ...@@ -104,8 +104,6 @@ struct armada_crtc {
void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int); void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int);
void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int); void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int);
void armada_drm_crtc_disable_irq(struct armada_crtc *, u32);
void armada_drm_crtc_enable_irq(struct armada_crtc *, u32);
void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *); void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *);
void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc, void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
......
...@@ -49,20 +49,6 @@ void armada_drm_queue_unref_work(struct drm_device *dev, ...@@ -49,20 +49,6 @@ void armada_drm_queue_unref_work(struct drm_device *dev,
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
} }
/* These are called under the vbl_lock. */
static int armada_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
{
struct armada_private *priv = dev->dev_private;
armada_drm_crtc_enable_irq(priv->dcrtc[pipe], VSYNC_IRQ_ENA);
return 0;
}
static void armada_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
{
struct armada_private *priv = dev->dev_private;
armada_drm_crtc_disable_irq(priv->dcrtc[pipe], VSYNC_IRQ_ENA);
}
static struct drm_ioctl_desc armada_ioctls[] = { static struct drm_ioctl_desc armada_ioctls[] = {
DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl,0), DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl,0),
DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, 0), DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, 0),
...@@ -87,8 +73,6 @@ static const struct file_operations armada_drm_fops = { ...@@ -87,8 +73,6 @@ static const struct file_operations armada_drm_fops = {
static struct drm_driver armada_drm_driver = { static struct drm_driver armada_drm_driver = {
.lastclose = armada_drm_lastclose, .lastclose = armada_drm_lastclose,
.enable_vblank = armada_drm_enable_vblank,
.disable_vblank = armada_drm_disable_vblank,
.gem_free_object_unlocked = armada_gem_free_object, .gem_free_object_unlocked = armada_gem_free_object,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle, .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
......
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