drm/exynos: add check for the device power status
authorShirish S <s.shirish@samsung.com>
Thu, 24 Jan 2013 03:03:18 +0000 (22:03 -0500)
committerInki Dae <inki.dae@samsung.com>
Fri, 25 Jan 2013 05:38:46 +0000 (14:38 +0900)
V2: Add mutex protection, while read.

The hdmi and mixer win_commit calls currently are
not checking the status of IP before updating the
respective registers, this patch adds this check.

Signed-off-by: Shirish S <s.shirish@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/exynos/exynos_hdmi.c
drivers/gpu/drm/exynos/exynos_mixer.c

index 32c04a696a5990c6bc2460ece10102c265712d5e..fbab3c4686031ce9c07a1b19546ab73ddb4f92e7 100644 (file)
@@ -2163,6 +2163,13 @@ static void hdmi_commit(void *ctx)
 
        DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
 
+       mutex_lock(&hdata->hdmi_mutex);
+       if (!hdata->powered) {
+               mutex_unlock(&hdata->hdmi_mutex);
+               return;
+       }
+       mutex_unlock(&hdata->hdmi_mutex);
+
        hdmi_conf_apply(hdata);
 }
 
index 1ff2d7a045b5de7b21d0f18776ecc9e6f05d64eb..c414584bfbaecf36d285be933e9e212fbea7784d 100644 (file)
@@ -776,6 +776,13 @@ static void mixer_win_commit(void *ctx, int win)
 
        DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win);
 
+       mutex_lock(&mixer_ctx->mixer_mutex);
+       if (!mixer_ctx->powered) {
+               mutex_unlock(&mixer_ctx->mixer_mutex);
+               return;
+       }
+       mutex_unlock(&mixer_ctx->mixer_mutex);
+
        if (win > 1 && mixer_ctx->vp_enabled)
                vp_video_buffer(mixer_ctx, win);
        else