Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bbf983f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: hdmi: fix no audio over HDMI on device bootup"

parents 288edc57 942e1ce7
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ struct msm_ext_disp {
	struct list_head display_list;
	struct mutex lock;
	struct completion hpd_comp;
	bool update_audio;
	u32 flags;
};

static int msm_ext_disp_get_intf_data(struct msm_ext_disp *ext_disp,
@@ -340,6 +342,8 @@ static int msm_ext_disp_hpd(struct platform_device *pdev,
		goto end;
	}

	ext_disp->flags = flags;

	if (state == EXT_DISPLAY_CABLE_CONNECT) {
		if (!msm_ext_disp_validate_connect(ext_disp, type, flags)) {
			pr_err("Display interface (%s) already connected\n",
@@ -570,6 +574,7 @@ static int msm_ext_disp_update_audio_ops(struct msm_ext_disp *ext_disp,
{
	int ret = 0;
	struct msm_ext_disp_audio_codec_ops *ops = ext_disp->ops;
	ext_disp->update_audio = false;

	if (!(flags & MSM_EXT_DISP_HPD_AUDIO)) {
		pr_debug("skipping audio ops setup for display (%s)\n",
@@ -579,6 +584,10 @@ static int msm_ext_disp_update_audio_ops(struct msm_ext_disp *ext_disp,

	if (!ops) {
		pr_err("Invalid audio ops\n");
		if (state == EXT_DISPLAY_CABLE_CONNECT) {
			/* update audio ops once audio codec gets registered */
			ext_disp->update_audio = true;
		}
		ret = -EINVAL;
		goto end;
	}
@@ -682,6 +691,18 @@ int msm_ext_disp_register_audio_codec(struct platform_device *pdev,

	pr_debug("audio codec registered\n");

	mutex_lock(&ext_disp->lock);
	if (ext_disp->update_audio) {
		msm_ext_disp_update_audio_ops(ext_disp, ext_disp->current_disp,
				EXT_DISPLAY_CABLE_CONNECT, ext_disp->flags);

		msm_ext_disp_process_audio(ext_disp, ext_disp->current_disp,
				EXT_DISPLAY_CABLE_CONNECT, ext_disp->flags);

		ext_disp->update_audio = false;
	}
	mutex_unlock(&ext_disp->lock);

	return ret;
}

@@ -803,6 +824,8 @@ static int msm_ext_disp_probe(struct platform_device *pdev)
	INIT_LIST_HEAD(&ext_disp->display_list);
	init_completion(&ext_disp->hpd_comp);
	ext_disp->current_disp = EXT_DISPLAY_TYPE_MAX;
	ext_disp->flags = 0;
	ext_disp->update_audio = false;

	return ret;

+36 −19
Original line number Diff line number Diff line
@@ -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(
	struct hdmi_tx_ctrl *hdmi_ctrl, int val, bool async)
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 (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 {
			flags |= MSM_EXT_DISP_HPD_VIDEO;

			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))
			flags |= MSM_EXT_DISP_HPD_ASYNC_VIDEO;
		else
			flags |= MSM_EXT_DISP_HPD_VIDEO;

		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)
@@ -3989,7 +4004,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);
		}
	}

@@ -4000,7 +4016,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;