Commit 1de777fe authored by Jeeja KP's avatar Jeeja KP Committed by Mark Brown

ASoC: hdac_hdmi: Enable pin and converter in prepare

Instead of enabling pin and cvt in pcm_open(), need to restore pin and
cvt state after system resume to restart the playback which is
paused/stopped before system suspend.
So enable pin and cvt in playback_prepare and call prepare when trigger
cmd is paused/started and resume to reconfigure pin and cvt.
Signed-off-by: default avatarSachin Mokashi <sachinx.mokashi@intel.com>
Signed-off-by: default avatarJeeja KP <jeeja.kp@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent a700a1e6
...@@ -114,6 +114,12 @@ struct hdac_hdmi_priv { ...@@ -114,6 +114,12 @@ struct hdac_hdmi_priv {
struct hdac_chmap chmap; struct hdac_chmap chmap;
}; };
static void hdac_hdmi_enable_cvt(struct hdac_ext_device *edev,
struct hdac_hdmi_dai_pin_map *dai_map);
static int hdac_hdmi_enable_pin(struct hdac_ext_device *hdac,
struct hdac_hdmi_dai_pin_map *dai_map);
static struct hdac_hdmi_pcm *get_hdmi_pcm_from_id(struct hdac_hdmi_priv *hdmi, static struct hdac_hdmi_pcm *get_hdmi_pcm_from_id(struct hdac_hdmi_priv *hdmi,
int pcm_idx) int pcm_idx)
{ {
...@@ -411,6 +417,10 @@ static int hdac_hdmi_playback_prepare(struct snd_pcm_substream *substream, ...@@ -411,6 +417,10 @@ static int hdac_hdmi_playback_prepare(struct snd_pcm_substream *substream,
dev_dbg(&hdac->hdac.dev, "stream tag from cpu dai %d format in cvt 0x%x\n", dev_dbg(&hdac->hdac.dev, "stream tag from cpu dai %d format in cvt 0x%x\n",
dd->stream_tag, dd->format); dd->stream_tag, dd->format);
hdac_hdmi_enable_cvt(hdac, dai_map);
ret = hdac_hdmi_enable_pin(hdac, dai_map);
if (ret < 0)
return ret;
mutex_lock(&pin->lock); mutex_lock(&pin->lock);
pin->channels = substream->runtime->channels; pin->channels = substream->runtime->channels;
...@@ -464,12 +474,7 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream, ...@@ -464,12 +474,7 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
static int hdac_hdmi_playback_cleanup(struct snd_pcm_substream *substream, static int hdac_hdmi_playback_cleanup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai);
struct hdac_ext_dma_params *dd; struct hdac_ext_dma_params *dd;
struct hdac_hdmi_priv *hdmi = edev->private_data;
struct hdac_hdmi_dai_pin_map *dai_map;
dai_map = &hdmi->dai_map[dai->id];
dd = (struct hdac_ext_dma_params *)snd_soc_dai_get_dma_data(dai, substream); dd = (struct hdac_ext_dma_params *)snd_soc_dai_get_dma_data(dai, substream);
...@@ -622,11 +627,6 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream, ...@@ -622,11 +627,6 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
dai_map->pin = pin; dai_map->pin = pin;
hdac_hdmi_enable_cvt(hdac, dai_map);
ret = hdac_hdmi_enable_pin(hdac, dai_map);
if (ret < 0)
return ret;
ret = hdac_hdmi_eld_limit_formats(substream->runtime, ret = hdac_hdmi_eld_limit_formats(substream->runtime,
pin->eld.eld_buffer); pin->eld.eld_buffer);
if (ret < 0) if (ret < 0)
...@@ -639,18 +639,15 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream, ...@@ -639,18 +639,15 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
static int hdac_hdmi_trigger(struct snd_pcm_substream *substream, int cmd, static int hdac_hdmi_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct hdac_hdmi_dai_pin_map *dai_map;
struct hdac_ext_device *hdac = snd_soc_dai_get_drvdata(dai);
struct hdac_hdmi_priv *hdmi = hdac->private_data;
int ret;
dai_map = &hdmi->dai_map[dai->id];
if (cmd == SNDRV_PCM_TRIGGER_RESUME) {
ret = hdac_hdmi_enable_pin(hdac, dai_map);
if (ret < 0)
return ret;
switch (cmd) {
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
return hdac_hdmi_playback_prepare(substream, dai); return hdac_hdmi_playback_prepare(substream, dai);
default:
return 0;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment