Skip to content

Commit

Permalink
drm/exynos: kill pipe field from drivers contexts
Browse files Browse the repository at this point in the history
Since possible_crtcs are set by Exynos core helper pipe fields have no
raison d'etre. The only place it was used, as a hack, is
fimd_clear_channels, to avoid calling drm_crtc_handle_vblank, but DRM core
has already other protection mechanism (vblank->enabled), so it could be
safely removed.

Signed-off-by: Andrzej Hajda <[email protected]>
Signed-off-by: Inki Dae <[email protected]>
  • Loading branch information
Andrzej Hajda authored and daeinki committed Jun 1, 2017
1 parent 2c82607 commit 2949390
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 30 deletions.
2 changes: 0 additions & 2 deletions drivers/gpu/drm/exynos/exynos5433_drm_decon.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ struct decon_context {
void __iomem *addr;
struct regmap *sysreg;
struct clk *clks[ARRAY_SIZE(decon_clks_name)];
int pipe;
unsigned long flags;
unsigned long out_type;
int first_win;
Expand Down Expand Up @@ -592,7 +591,6 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
int ret;

ctx->drm_dev = drm_dev;
ctx->pipe = drm_dev->mode_config.num_crtc;
drm_dev->max_vblank_count = 0xffffffff;

for (win = ctx->first_win; win < WINDOWS_NR; win++) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/gpu/drm/exynos/exynos7_drm_decon.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ struct decon_context {
unsigned long irq_flags;
bool i80_if;
bool suspended;
int pipe;
wait_queue_head_t wait_vsync_queue;
atomic_t wait_vsync_event;

Expand Down Expand Up @@ -131,7 +130,6 @@ static int decon_ctx_initialize(struct decon_context *ctx,
struct drm_device *drm_dev)
{
ctx->drm_dev = drm_dev;
ctx->pipe = drm_dev->mode_config.num_crtc;

decon_clear_channels(ctx->crtc);

Expand Down Expand Up @@ -605,7 +603,7 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
writel(clear_bit, ctx->regs + VIDINTCON1);

/* check the crtc is detached already from encoder */
if (ctx->pipe < 0 || !ctx->drm_dev)
if (!ctx->drm_dev)
goto out;

if (!ctx->i80_if) {
Expand Down
11 changes: 2 additions & 9 deletions drivers/gpu/drm/exynos/exynos_drm_fimd.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ struct fimd_context {
u32 i80ifcon;
bool i80_if;
bool suspended;
int pipe;
wait_queue_head_t wait_vsync_queue;
atomic_t wait_vsync_event;
atomic_t win_updated;
Expand Down Expand Up @@ -354,18 +353,13 @@ static void fimd_clear_channels(struct exynos_drm_crtc *crtc)

/* Wait for vsync, as disable channel takes effect at next vsync */
if (ch_enabled) {
int pipe = ctx->pipe;

/* ensure that vblank interrupt won't be reported to core */
ctx->suspended = false;
ctx->pipe = -1;

fimd_enable_vblank(ctx->crtc);
fimd_wait_for_vblank(ctx->crtc);
fimd_disable_vblank(ctx->crtc);

ctx->suspended = true;
ctx->pipe = pipe;
}

clk_disable_unprepare(ctx->lcd_clk);
Expand Down Expand Up @@ -899,7 +893,7 @@ static void fimd_te_handler(struct exynos_drm_crtc *crtc)
u32 trg_type = ctx->driver_data->trg_type;

/* Checks the crtc is detached already from encoder */
if (ctx->pipe < 0 || !ctx->drm_dev)
if (!ctx->drm_dev)
return;

if (trg_type == I80_HW_TRG)
Expand Down Expand Up @@ -957,7 +951,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
writel(clear_bit, ctx->regs + VIDINTCON1);

/* check the crtc is detached already from encoder */
if (ctx->pipe < 0 || !ctx->drm_dev)
if (!ctx->drm_dev)
goto out;

if (!ctx->i80_if)
Expand Down Expand Up @@ -987,7 +981,6 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
int ret;

ctx->drm_dev = drm_dev;
ctx->pipe = drm_dev->mode_config.num_crtc;

for (i = 0; i < WINDOWS_NR; i++) {
ctx->configs[i].pixel_formats = fimd_formats;
Expand Down
15 changes: 1 addition & 14 deletions drivers/gpu/drm/exynos/exynos_drm_vidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ struct vidi_context {
bool suspended;
struct timer_list timer;
struct mutex lock;
int pipe;
};

static inline struct vidi_context *encoder_to_vidi(struct drm_encoder *e)
Expand Down Expand Up @@ -153,15 +152,6 @@ static void vidi_disable(struct exynos_drm_crtc *crtc)
mutex_unlock(&ctx->lock);
}

static int vidi_ctx_initialize(struct vidi_context *ctx,
struct drm_device *drm_dev)
{
ctx->drm_dev = drm_dev;
ctx->pipe = drm_dev->mode_config.num_crtc;

return 0;
}

static const struct exynos_drm_crtc_ops vidi_crtc_ops = {
.enable = vidi_enable,
.disable = vidi_disable,
Expand All @@ -175,9 +165,6 @@ static void vidi_fake_vblank_timer(unsigned long arg)
{
struct vidi_context *ctx = (void *)arg;

if (ctx->pipe < 0)
return;

if (drm_crtc_handle_vblank(&ctx->crtc->base))
mod_timer(&ctx->timer,
jiffies + msecs_to_jiffies(VIDI_REFRESH_TIME) - 1);
Expand Down Expand Up @@ -397,7 +384,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
unsigned int i;
int pipe, ret;

vidi_ctx_initialize(ctx, drm_dev);
ctx->drm_dev = drm_dev;

plane_config.pixel_formats = formats;
plane_config.num_pixel_formats = ARRAY_SIZE(formats);
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/exynos/exynos_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ struct mixer_context {
struct drm_device *drm_dev;
struct exynos_drm_crtc *crtc;
struct exynos_drm_plane planes[MIXER_WIN_NR];
int pipe;
unsigned long flags;

struct mixer_resources mixer_res;
Expand Down Expand Up @@ -900,7 +899,6 @@ static int mixer_initialize(struct mixer_context *mixer_ctx,
priv = drm_dev->dev_private;

mixer_ctx->drm_dev = drm_dev;
mixer_ctx->pipe = drm_dev->mode_config.num_crtc;

/* acquire resources: regs, irqs, clocks */
ret = mixer_resources_init(mixer_ctx);
Expand Down

0 comments on commit 2949390

Please sign in to comment.