Driver uses only VSYNC interrupts, so we need to cache VSYNC bit state only.
Signed-off-by: Andrzej Hajda <a.hajda at samsung.com> --- drivers/gpu/drm/exynos/exynos_mixer.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 2465b1d..4858170e 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -87,6 +87,7 @@ enum mixer_version_id { enum mixer_flag_bits { MXR_BIT_POWERED, + MXR_BIT_VSYNC, }; struct mixer_context { @@ -98,7 +99,6 @@ struct mixer_context { bool interlace; bool vp_enabled; bool has_sclk; - u32 int_en; struct mixer_resources mixer_res; struct hdmi_win_data win_data[MIXER_WIN_NR]; @@ -897,10 +897,9 @@ static int mixer_enable_vblank(struct exynos_drm_manager *mgr) struct mixer_context *mixer_ctx = mgr->ctx; struct mixer_resources *res = &mixer_ctx->mixer_res; - if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) { - mixer_ctx->int_en |= MXR_INT_EN_VSYNC; + __set_bit(MXR_BIT_VSYNC, &mixer_ctx->flags); + if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) return 0; - } /* enable vsync interrupt */ mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC); @@ -914,10 +913,10 @@ static void mixer_disable_vblank(struct exynos_drm_manager *mgr) struct mixer_context *mixer_ctx = mgr->ctx; struct mixer_resources *res = &mixer_ctx->mixer_res; - if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) { - mixer_ctx->int_en &= MXR_INT_EN_VSYNC; + __clear_bit(MXR_BIT_VSYNC, &mixer_ctx->flags); + + if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) return; - } /* disable vsync interrupt */ mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC); @@ -1092,9 +1091,10 @@ static void mixer_poweron(struct exynos_drm_manager *mgr) mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET); - if (ctx->int_en & MXR_INT_EN_VSYNC) + if (test_bit(MXR_BIT_VSYNC, &ctx->flags)) { mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC); - mixer_reg_write(res, MXR_INT_EN, ctx->int_en); + mixer_reg_writemask(res, MXR_INT_EN, ~0, MXR_INT_EN_VSYNC); + } mixer_win_reset(ctx); mixer_window_resume(mgr); @@ -1111,8 +1111,6 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) mixer_stop(ctx); mixer_window_suspend(mgr); - ctx->int_en = mixer_reg_read(res, MXR_INT_EN); - clear_bit(MXR_BIT_POWERED, &ctx->flags); clk_disable_unprepare(res->mixer); -- 1.9.1