From: wenping.zhang Date: Mon, 17 Oct 2016 02:16:40 +0000 (+0800) Subject: video: rockchip: dp: fix deadlock if video timing get failed. X-Git-Tag: firefly_0821_release~1372 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a860c496e5a34792d516b80e405886047d076e1b;p=firefly-linux-kernel-4.4.55.git video: rockchip: dp: fix deadlock if video timing get failed. Change-Id: I00511a7b2aa0229b04c2326ca267a39cf7d46f42 Signed-off-by: wenping.zhang --- diff --git a/drivers/video/rockchip/dp/rockchip_dp_core.c b/drivers/video/rockchip/dp/rockchip_dp_core.c index 8c6ad8945f13..64e69d73a64e 100644 --- a/drivers/video/rockchip/dp/rockchip_dp_core.c +++ b/drivers/video/rockchip/dp/rockchip_dp_core.c @@ -105,7 +105,7 @@ static int cdn_dp_clk_enable(struct cdn_dp_device *dp) ret = cdn_dp_set_fw_rate(dp); if (ret < 0) { - dev_err(dp->dev, "cannot get pm runtime %d\n", ret); + dev_err(dp->dev, "cannot get set fw rate %d\n", ret); goto err_set_rate; } @@ -158,6 +158,7 @@ int cdn_dp_encoder_disable(void *dp) int ret = 0; mutex_lock(&dp_dev->lock); + memset(&dp_dev->mode, 0, sizeof(dp_dev->mode)); if (dp_dev->hpd_status == connector_status_disconnected) { dp_dev->dpms_mode = DRM_MODE_DPMS_OFF; mutex_unlock(&dp_dev->lock); @@ -288,6 +289,16 @@ int cdn_dp_encoder_enable(void *dp) mutex_lock(&dp_dev->lock); if (dp_dev->dpms_mode == DRM_MODE_DPMS_OFF) { + /** + * the mode info of dp device will be cleared when dp encoder is disabled + * so if clock value of mode is 0, means rockchip_dp_config_video is not + * return success, so we don't do cdn_dp_commit. + */ + if (dp_dev->mode.clock == 0) { + dev_err(dp_dev->dev, "Error !Please make sure function cdn_dp_encoder_mode_set return success!\n"); + mutex_unlock(&dp_dev->lock); + return -1; + } cdn_dp_commit(dp_dev); } else { dev_warn(dp_dev->dev, "wrong dpms status,dp encoder has already been enabled\n");