Skip to content

Commit

Permalink
drm/exynos: set power state variable after enabling clocks and power
Browse files Browse the repository at this point in the history
Power state variable holds the state of the mixer device.
Power on and power off functions are toggling these variable
at wrong place.

State variable should be changed to true only after Runtime
PM and clocks are enabled. Else it may result to a situation
where mixer registers are accessed with device power enabled.
Similar logic for poweroff sequence.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
  • Loading branch information
Rahul Sharma authored and Inki Dae committed Jun 24, 2014
1 parent d9b68d8 commit b4bfa3c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions drivers/gpu/drm/exynos/exynos_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ static void mixer_poweron(struct exynos_drm_manager *mgr)
mutex_unlock(&ctx->mixer_mutex);
return;
}
ctx->powered = true;

mutex_unlock(&ctx->mixer_mutex);

pm_runtime_get_sync(ctx->dev);
Expand All @@ -1072,6 +1072,10 @@ static void mixer_poweron(struct exynos_drm_manager *mgr)
clk_prepare_enable(res->sclk_mixer);
}

mutex_lock(&ctx->mixer_mutex);
ctx->powered = true;
mutex_unlock(&ctx->mixer_mutex);

mixer_reg_write(res, MXR_INT_EN, ctx->int_en);
mixer_win_reset(ctx);

Expand All @@ -1084,27 +1088,27 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr)
struct mixer_resources *res = &ctx->mixer_res;

mutex_lock(&ctx->mixer_mutex);
if (!ctx->powered)
goto out;
if (!ctx->powered) {
mutex_unlock(&ctx->mixer_mutex);
return;
}
mutex_unlock(&ctx->mixer_mutex);

mixer_window_suspend(mgr);

ctx->int_en = mixer_reg_read(res, MXR_INT_EN);

mutex_lock(&ctx->mixer_mutex);
ctx->powered = false;
mutex_unlock(&ctx->mixer_mutex);

clk_disable_unprepare(res->mixer);
if (ctx->vp_enabled) {
clk_disable_unprepare(res->vp);
clk_disable_unprepare(res->sclk_mixer);
}

pm_runtime_put_sync(ctx->dev);

mutex_lock(&ctx->mixer_mutex);
ctx->powered = false;

out:
mutex_unlock(&ctx->mixer_mutex);
}

static void mixer_dpms(struct exynos_drm_manager *mgr, int mode)
Expand Down

0 comments on commit b4bfa3c

Please sign in to comment.