drm/rockchip: inno_hdmi: fix the noise during pause/resume by application

Since the i2s does not support the clock to be always on, and
snd_pcm_stop() will turn off the i2s clock.

However, the inno HDMI codec still needs to the clock to work, then
it does not do the corresponding clear and leads to abnormal audio
logic inside HDMI without the clock.

This patch adds an AUDIO_PD off/on to clear internal audio logic
during HDMI prepare to solve this problem.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Change-Id: I1ccb486a3fe1729c95d7d755ae2caf88d61a146b
This commit is contained in:
Xing Zheng 2023-03-22 21:33:08 +08:00 committed by Tao Huang
parent ca99cd1152
commit a79d5a5f0a

View File

@ -724,6 +724,22 @@ inno_hdmi_audio_config_set(struct inno_hdmi *hdmi, struct audio_info *audio)
return inno_hdmi_config_audio_aai(hdmi, audio);
}
static int inno_hdmi_audio_prepare(struct device *dev, void *data,
struct hdmi_codec_daifmt *fmt,
struct hdmi_codec_params *hparms)
{
struct inno_hdmi *hdmi = dev_get_drvdata(dev);
if (!hdmi->hdmi_data.sink_has_audio) {
dev_err(hdmi->dev, "Sink do not support audio!\n");
return -ENODEV;
}
hdmi->audio_enable = 0;
hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_PD, v_AUDIO_PD(1));
return 0;
}
static int inno_hdmi_audio_hw_params(struct device *dev, void *d,
struct hdmi_codec_daifmt *daifmt,
struct hdmi_codec_params *params)
@ -803,6 +819,7 @@ static int inno_hdmi_audio_get_eld(struct device *dev, void *d,
static const struct hdmi_codec_ops audio_codec_ops = {
.hw_params = inno_hdmi_audio_hw_params,
.prepare = inno_hdmi_audio_prepare,
.audio_shutdown = inno_hdmi_audio_shutdown,
.mute_stream = inno_hdmi_audio_mute,
.get_eld = inno_hdmi_audio_get_eld,