video: rockchip: dp: fix sound problam when disconnect to dp
authorxuhuicong <xhc@rock-chips.com>
Thu, 1 Sep 2016 03:52:01 +0000 (11:52 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 2 Sep 2016 02:22:42 +0000 (10:22 +0800)
Change-Id: I49b96426939f0c9d1c016ca00cc5df1f43cbf848
Signed-off-by: xuhuicong <xhc@rock-chips.com>
drivers/video/rockchip/dp/rockchip_dp_core.c

index 6def0eddaa200a2a6a8edbaf1c67b9e078231cb9..02658f71755d3b34eb5775653236548af0536428 100644 (file)
@@ -308,6 +308,9 @@ static int cdn_dp_audio_hw_params(struct device *dev,  void *data,
                .channels = 8,
        };
 
+       if (!cdn_dp_connector_detect(dp))
+               return 0;
+
        switch (HDMI_I2S) {
        case HDMI_I2S:
                audio.format = AFMT_I2S;
@@ -333,9 +336,11 @@ static void cdn_dp_audio_shutdown(struct device *dev, void *data)
        struct cdn_dp_device *dp = dp_dev->dp;
        int ret;
 
-       ret = cdn_dp_audio_stop(dp, &dp->audio_info);
-       if (!ret)
-               dp->audio_info.format = AFMT_UNUSED;
+       if (cdn_dp_connector_detect(dp)) {
+               ret = cdn_dp_audio_stop(dp, &dp->audio_info);
+               if (!ret)
+                       dp->audio_info.format = AFMT_UNUSED;
+       }
 }
 
 static int cdn_dp_audio_digital_mute(struct device *dev, void *data,
@@ -344,6 +349,8 @@ static int cdn_dp_audio_digital_mute(struct device *dev, void *data,
        struct dp_dev *dp_dev = dev_get_drvdata(dev);
        struct cdn_dp_device *dp = dp_dev->dp;
 
+       if (!cdn_dp_connector_detect(dp))
+               return 0;
        return cdn_dp_audio_mute(dp, enable);
 }