Commit 10437d9b authored by Shawn Guo's avatar Shawn Guo

drm: tegra: 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, the wrapper functions tegra_drm_xxx get killed
completely, and tegra_dc_xxx are filled into struct drm_crtc_funcs as
vblank hooks directly.
Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1486458995-31018-21-git-send-email-shawnguo@kernel.org
parent 50480a78
...@@ -909,8 +909,10 @@ static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc) ...@@ -909,8 +909,10 @@ static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc)
return 0; return 0;
} }
u32 tegra_dc_get_vblank_counter(struct tegra_dc *dc) static u32 tegra_dc_get_vblank_counter(struct drm_crtc *crtc)
{ {
struct tegra_dc *dc = to_tegra_dc(crtc);
if (dc->syncpt) if (dc->syncpt)
return host1x_syncpt_read(dc->syncpt); return host1x_syncpt_read(dc->syncpt);
...@@ -918,8 +920,9 @@ u32 tegra_dc_get_vblank_counter(struct tegra_dc *dc) ...@@ -918,8 +920,9 @@ u32 tegra_dc_get_vblank_counter(struct tegra_dc *dc)
return drm_crtc_vblank_count(&dc->base); return drm_crtc_vblank_count(&dc->base);
} }
void tegra_dc_enable_vblank(struct tegra_dc *dc) static int tegra_dc_enable_vblank(struct drm_crtc *crtc)
{ {
struct tegra_dc *dc = to_tegra_dc(crtc);
unsigned long value, flags; unsigned long value, flags;
spin_lock_irqsave(&dc->lock, flags); spin_lock_irqsave(&dc->lock, flags);
...@@ -929,10 +932,13 @@ void tegra_dc_enable_vblank(struct tegra_dc *dc) ...@@ -929,10 +932,13 @@ void tegra_dc_enable_vblank(struct tegra_dc *dc)
tegra_dc_writel(dc, value, DC_CMD_INT_MASK); tegra_dc_writel(dc, value, DC_CMD_INT_MASK);
spin_unlock_irqrestore(&dc->lock, flags); spin_unlock_irqrestore(&dc->lock, flags);
return 0;
} }
void tegra_dc_disable_vblank(struct tegra_dc *dc) static void tegra_dc_disable_vblank(struct drm_crtc *crtc)
{ {
struct tegra_dc *dc = to_tegra_dc(crtc);
unsigned long value, flags; unsigned long value, flags;
spin_lock_irqsave(&dc->lock, flags); spin_lock_irqsave(&dc->lock, flags);
...@@ -1036,6 +1042,9 @@ static const struct drm_crtc_funcs tegra_crtc_funcs = { ...@@ -1036,6 +1042,9 @@ static const struct drm_crtc_funcs tegra_crtc_funcs = {
.reset = tegra_crtc_reset, .reset = tegra_crtc_reset,
.atomic_duplicate_state = tegra_crtc_atomic_duplicate_state, .atomic_duplicate_state = tegra_crtc_atomic_duplicate_state,
.atomic_destroy_state = tegra_crtc_atomic_destroy_state, .atomic_destroy_state = tegra_crtc_atomic_destroy_state,
.get_vblank_counter = tegra_dc_get_vblank_counter,
.enable_vblank = tegra_dc_enable_vblank,
.disable_vblank = tegra_dc_disable_vblank,
}; };
static int tegra_dc_set_timings(struct tegra_dc *dc, static int tegra_dc_set_timings(struct tegra_dc *dc,
......
...@@ -804,40 +804,6 @@ static const struct file_operations tegra_drm_fops = { ...@@ -804,40 +804,6 @@ static const struct file_operations tegra_drm_fops = {
.llseek = noop_llseek, .llseek = noop_llseek,
}; };
static u32 tegra_drm_get_vblank_counter(struct drm_device *drm,
unsigned int pipe)
{
struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
struct tegra_dc *dc = to_tegra_dc(crtc);
if (!crtc)
return 0;
return tegra_dc_get_vblank_counter(dc);
}
static int tegra_drm_enable_vblank(struct drm_device *drm, unsigned int pipe)
{
struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
struct tegra_dc *dc = to_tegra_dc(crtc);
if (!crtc)
return -ENODEV;
tegra_dc_enable_vblank(dc);
return 0;
}
static void tegra_drm_disable_vblank(struct drm_device *drm, unsigned int pipe)
{
struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
struct tegra_dc *dc = to_tegra_dc(crtc);
if (crtc)
tegra_dc_disable_vblank(dc);
}
static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file) static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file)
{ {
struct tegra_drm_file *fpriv = file->driver_priv; struct tegra_drm_file *fpriv = file->driver_priv;
...@@ -905,10 +871,6 @@ static struct drm_driver tegra_drm_driver = { ...@@ -905,10 +871,6 @@ static struct drm_driver tegra_drm_driver = {
.preclose = tegra_drm_preclose, .preclose = tegra_drm_preclose,
.lastclose = tegra_drm_lastclose, .lastclose = tegra_drm_lastclose,
.get_vblank_counter = tegra_drm_get_vblank_counter,
.enable_vblank = tegra_drm_enable_vblank,
.disable_vblank = tegra_drm_disable_vblank,
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
.debugfs_init = tegra_debugfs_init, .debugfs_init = tegra_debugfs_init,
#endif #endif
......
...@@ -193,9 +193,6 @@ struct tegra_dc_window { ...@@ -193,9 +193,6 @@ struct tegra_dc_window {
}; };
/* from dc.c */ /* from dc.c */
u32 tegra_dc_get_vblank_counter(struct tegra_dc *dc);
void tegra_dc_enable_vblank(struct tegra_dc *dc);
void tegra_dc_disable_vblank(struct tegra_dc *dc);
void tegra_dc_commit(struct tegra_dc *dc); void tegra_dc_commit(struct tegra_dc *dc);
int tegra_dc_state_setup_clock(struct tegra_dc *dc, int tegra_dc_state_setup_clock(struct tegra_dc *dc,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
......
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