From: libin.yang@intel.com
To: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org
Cc: liam.r.girdwood@linux.intel.com, mengdong.lin@intel.com,
libin.yang@intel.com, pierre-louis.bossart@linux.intel.com
Subject: [RFC PATCH v2 2/2] ASoC: add asoc hdmi audio trigger handler
Date: Mon, 7 Jan 2019 10:22:01 +0800 [thread overview]
Message-ID: <1546827721-25586-2-git-send-email-libin.yang@intel.com> (raw)
In-Reply-To: <1546827721-25586-1-git-send-email-libin.yang@intel.com>
From: Libin Yang <libin.yang@intel.com>
The flow of ASoC hdmi audio suspend when playback is:
hdmi_codec_prepare() =>
snd_hdac_display_power(bus, hdev->addr, true)
snd_hdac_display_power(bus, hdev->addr, false)
suspend =>
trigger(suspend) =>
snd_hdac_display_power(bus, hdev->addr + HDA_CODEC_RT, false)
now, all bitmasks are cleared and display power is turned off.
Signed-off-by: Libin Yang <libin.yang@intel.com>
---
include/sound/hda_component.h | 1 +
sound/soc/codecs/hdac_hdmi.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/include/sound/hda_component.h b/include/sound/hda_component.h
index 2ec31b3..c7136b1 100644
--- a/include/sound/hda_component.h
+++ b/include/sound/hda_component.h
@@ -9,6 +9,7 @@
/* virtual idx for controller */
#define HDA_CODEC_IDX_CONTROLLER HDA_MAX_CODECS
+#define HDA_CODEC_RT (HDA_CODEC_IDX_CONTROLLER + 1)
#ifdef CONFIG_SND_HDA_COMPONENT
int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable);
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 782b323..908f83d 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -1383,11 +1383,43 @@ static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdev)
}
+static int hdac_hdmi_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
+ struct snd_soc_dai *dai)
+{
+ struct hdac_hdmi_priv *hdmi = snd_soc_dai_get_drvdata(dai);
+ struct hdac_device *hdev = hdmi->hdev;
+
+ switch (cmd) {
+ case SNDRV_PCM_TRIGGER_START:
+ case SNDRV_PCM_TRIGGER_RESUME:
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+ /*
+ * Maybe there is a better way to avoid using
+ * 'hdev->addr + HDA_CODEC_RT' bitmask?
+ */
+ snd_hdac_display_power(hdev->bus, hdev->addr + HDA_CODEC_RT,
+ true);
+ break;
+ case SNDRV_PCM_TRIGGER_STOP:
+ case SNDRV_PCM_TRIGGER_SUSPEND:
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+ snd_hdac_display_power(hdev->bus, hdev->addr + HDA_CODEC_RT,
+ false);
+ break;
+ default:
+ /* Nothing to do */
+ break;
+ }
+
+ return 0;
+}
+
static const struct snd_soc_dai_ops hdmi_dai_ops = {
.startup = hdac_hdmi_pcm_open,
.shutdown = hdac_hdmi_pcm_close,
.hw_params = hdac_hdmi_set_hw_params,
.set_tdm_slot = hdac_hdmi_set_tdm_slot,
+ .trigger = hdac_hdmi_pcm_trigger,
};
/*
@@ -1895,6 +1927,11 @@ static int hdmi_codec_prepare(struct device *dev)
{
struct hdac_device *hdev = dev_to_hdac_dev(dev);
+ /*
+ * FIXME: maybe using suspend/resume instead of
+ * using prepare/complete can make things simpler
+ * and no need to use 'hdev->addr + HDA_CODEC_RT'?
+ */
snd_hdac_display_power(hdev->bus, hdev->addr, true);
/*
--
2.7.4
next prev parent reply other threads:[~2019-01-07 2:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 2:22 [RFC PATCH v2 1/2] ASoC: refine ASoC hdmi audio suspend/resume libin.yang
2019-01-07 2:22 ` libin.yang [this message]
2019-01-07 16:58 ` Pierre-Louis Bossart
2019-01-08 7:53 ` Yang, Libin
2019-01-08 11:14 ` Takashi Iwai
2019-01-09 8:16 ` Yang, Libin
2019-01-09 8:29 ` Takashi Iwai
2019-01-09 9:13 ` Takashi Iwai
2019-01-10 5:30 ` Yang, Libin
2019-01-10 12:16 ` Takashi Iwai
2019-01-11 5:20 ` Yang, Libin
2019-01-11 13:34 ` Takashi Iwai
2019-01-11 14:24 ` Takashi Iwai
2019-01-11 15:43 ` Takashi Iwai
2019-01-12 1:46 ` Yang, Libin
2019-01-12 7:43 ` Takashi Iwai
2019-01-14 1:16 ` Keyon Jie
2019-01-14 6:44 ` Takashi Iwai
2019-01-11 14:35 ` Yang, Libin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1546827721-25586-2-git-send-email-libin.yang@intel.com \
--to=libin.yang@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=mengdong.lin@intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.