OSDN Git Service

msm: mdss: hdmi: notify hdmi audio event after video is up
authorNarender Ankam <nankam@codeaurora.org>
Mon, 24 Jul 2017 11:58:46 +0000 (17:28 +0530)
committerNarender Ankam <nankam@codeaurora.org>
Tue, 12 Sep 2017 07:27:33 +0000 (12:57 +0530)
Modify HDMI driver so that video and audio events are notified
separately. Notify video events asynchronously. send audio
events only after video is up.

Change-Id: Ie6e4e564456d65f6b6d733b8accd14b9ce4c7e15
Signed-off-by: Narender Ankam <nankam@codeaurora.org>
drivers/video/fbdev/msm/mdss_hdmi_tx.c

index 837147d..22467f1 100644 (file)
@@ -410,29 +410,33 @@ static inline void hdmi_tx_cec_device_suspend(struct hdmi_tx_ctrl *hdmi_ctrl)
        hdmi_cec_device_suspend(fd, hdmi_ctrl->panel_suspend);
 }
 
-static inline void hdmi_tx_send_cable_notification(
+static inline void hdmi_tx_send_audio_notification(
+               struct hdmi_tx_ctrl *hdmi_ctrl, int val)
+{
+       if (hdmi_ctrl && hdmi_ctrl->ext_audio_data.intf_ops.hpd) {
+       u32 flags = 0;
+
+       if (!hdmi_tx_is_dvi_mode(hdmi_ctrl))
+               flags |= MSM_EXT_DISP_HPD_AUDIO;
+
+       if (flags)
+               hdmi_ctrl->ext_audio_data.intf_ops.hpd(
+                               hdmi_ctrl->ext_pdev,
+                               hdmi_ctrl->ext_audio_data.type, val, flags);
+       }
+}
+
+static inline void hdmi_tx_send_video_notification(
        struct hdmi_tx_ctrl *hdmi_ctrl, int val, bool async)
 {
        if (hdmi_ctrl && hdmi_ctrl->ext_audio_data.intf_ops.hpd) {
                u32 flags = 0;
 
-               if (async || hdmi_tx_is_in_splash(hdmi_ctrl)) {
+               if (async || hdmi_tx_is_in_splash(hdmi_ctrl))
                        flags |= MSM_EXT_DISP_HPD_ASYNC_VIDEO;
-
-                       if (async) {
-                               if (!hdmi_tx_is_dvi_mode(hdmi_ctrl))
-                                       flags |= MSM_EXT_DISP_HPD_ASYNC_AUDIO;
-                       } else
-                               if (!hdmi_tx_is_dvi_mode(hdmi_ctrl))
-                                       flags |= MSM_EXT_DISP_HPD_AUDIO;
-
-               } else {
+               else
                        flags |= MSM_EXT_DISP_HPD_VIDEO;
 
-                       if (!hdmi_tx_is_dvi_mode(hdmi_ctrl))
-                               flags |= MSM_EXT_DISP_HPD_AUDIO;
-               }
-
                hdmi_ctrl->ext_audio_data.intf_ops.hpd(hdmi_ctrl->ext_pdev,
                                hdmi_ctrl->ext_audio_data.type, val, flags);
        }
@@ -445,6 +449,8 @@ static inline void hdmi_tx_ack_state(
                        !hdmi_tx_is_dvi_mode(hdmi_ctrl))
                hdmi_ctrl->ext_audio_data.intf_ops.notify(hdmi_ctrl->ext_pdev,
                                val);
+
+       hdmi_tx_send_audio_notification(hdmi_ctrl, val);
 }
 
 static struct hdmi_tx_ctrl *hdmi_tx_get_drvdata_from_panel_data(
@@ -876,7 +882,8 @@ static ssize_t hdmi_tx_sysfs_wta_hpd(struct device *dev,
                         * No need to blocking wait for display/audio in this
                         * case since HAL is not up so no ACK can be expected.
                         */
-                       hdmi_tx_send_cable_notification(hdmi_ctrl, 0, true);
+                       hdmi_tx_send_audio_notification(hdmi_ctrl, 0);
+                       hdmi_tx_send_video_notification(hdmi_ctrl, 0, true);
                }
 
                break;
@@ -2373,7 +2380,15 @@ static void hdmi_tx_hpd_int_work(struct work_struct *work)
 
        mutex_unlock(&hdmi_ctrl->tx_lock);
 
-       hdmi_tx_send_cable_notification(hdmi_ctrl, hdmi_ctrl->hpd_state, false);
+       if (hdmi_ctrl->hpd_state)
+               hdmi_tx_send_video_notification(hdmi_ctrl,
+                               hdmi_ctrl->hpd_state, true);
+       else {
+               hdmi_tx_send_audio_notification(hdmi_ctrl,
+                               hdmi_ctrl->hpd_state);
+               hdmi_tx_send_video_notification(hdmi_ctrl,
+                               hdmi_ctrl->hpd_state, true);
+       }
 } /* hdmi_tx_hpd_int_work */
 
 static int hdmi_tx_check_capability(struct hdmi_tx_ctrl *hdmi_ctrl)
@@ -3988,7 +4003,8 @@ static int hdmi_tx_post_evt_handle_resume(struct hdmi_tx_ctrl *hdmi_ctrl)
                        &hdmi_ctrl->hpd_int_done, HZ/10);
                if (!timeout) {
                        pr_debug("cable removed during suspend\n");
-                       hdmi_tx_send_cable_notification(hdmi_ctrl, 0, false);
+                       hdmi_tx_send_audio_notification(hdmi_ctrl, 0);
+                       hdmi_tx_send_video_notification(hdmi_ctrl, 0, true);
                }
        }
 
@@ -3999,7 +4015,8 @@ static int hdmi_tx_post_evt_handle_panel_on(struct hdmi_tx_ctrl *hdmi_ctrl)
 {
        if (hdmi_ctrl->panel_suspend) {
                pr_debug("panel suspend has triggered\n");
-               hdmi_tx_send_cable_notification(hdmi_ctrl, 0, false);
+               hdmi_tx_send_audio_notification(hdmi_ctrl, 0);
+               hdmi_tx_send_video_notification(hdmi_ctrl, 0, true);
        }
 
        return 0;