From: Jyri Sarha <jsarha@ti.com>
To: dri-devel@lists.freedesktop.org, airlied@linux.ie,
linux-omap@vger.kernel.org, devicetree@vger.kernel.org,
bcousson@baylibre.com, alsa-devel@alsa-project.org
Cc: peter.ujfalusi@ti.com, tony@atomide.com, broonie@kernel.org,
arnaud.pouliquen@st.com, Jyri Sarha <jsarha@ti.com>,
liam.r.girdwood@linux.intel.com, tomi.valkeinen@ti.com,
rmk+kernel@arm.linux.org.uk
Subject: [PATCH v9 4/7] ASoC: hdmi-codec: Add audio abort() callback for video side to use
Date: Thu, 31 Mar 2016 16:36:01 +0300 [thread overview]
Message-ID: <36a4881da9400908b2e033cb2d931daf0d59bac9.1459431292.git.jsarha@ti.com> (raw)
In-Reply-To: <cover.1459431292.git.jsarha@ti.com>
Add audio abort() callback, that is provided at audio stream start,
for video side. This is for video side to use in case there is a
pressing need to tear down the audio playback for some reason.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
include/sound/hdmi-codec.h | 8 ++++++--
sound/soc/codecs/hdmi-codec.c | 20 +++++++++++++++++++-
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h
index fc3a481..15fe70f 100644
--- a/include/sound/hdmi-codec.h
+++ b/include/sound/hdmi-codec.h
@@ -55,10 +55,14 @@ struct hdmi_codec_params {
struct hdmi_codec_ops {
/*
- * Called when ASoC starts an audio stream setup.
+ * Called when ASoC starts an audio stream setup. The call
+ * provides an audio abort callback for stoping an ongoing
+ * stream from video side driver if the HDMI audio becomes
+ * unavailable.
* Optional
*/
- int (*audio_startup)(struct device *dev);
+ int (*audio_startup)(struct device *dev,
+ void (*abort_cb)(struct device *dev));
/*
* Configures HDMI-encoder for audio stream.
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index b46b8ed..35151a4 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -47,6 +47,23 @@ enum {
DAI_ID_SPDIF,
};
+static void hdmi_codec_abort(struct device *dev)
+{
+ struct hdmi_codec_priv *hcp = dev_get_drvdata(dev);
+
+ dev_dbg(dev, "%s()\n", __func__);
+
+ mutex_lock(&hcp->current_stream_lock);
+ if (hcp->current_stream && hcp->current_stream->runtime &&
+ snd_pcm_running(hcp->current_stream)) {
+ dev_info(dev, "HDMI audio playback aborted\n");
+ snd_pcm_stream_lock_irq(hcp->current_stream);
+ snd_pcm_stop(hcp->current_stream, SNDRV_PCM_STATE_DISCONNECTED);
+ snd_pcm_stream_unlock_irq(hcp->current_stream);
+ }
+ mutex_unlock(&hcp->current_stream_lock);
+}
+
static int hdmi_codec_new_stream(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
@@ -78,7 +95,8 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
return ret;
if (hcp->hcd.ops->audio_startup) {
- ret = hcp->hcd.ops->audio_startup(dai->dev->parent);
+ ret = hcp->hcd.ops->audio_startup(dai->dev->parent,
+ hdmi_codec_abort);
if (ret) {
mutex_lock(&hcp->current_stream_lock);
hcp->current_stream = NULL;
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-03-31 13:36 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 13:35 [PATCH v9 0/7] Implement generic ASoC HDMI codec and use it in tda998x Jyri Sarha
2016-03-31 13:35 ` [PATCH v9 1/7] ALSA: pcm: add IEC958 channel status helper for hw_params Jyri Sarha
2016-03-31 13:42 ` Takashi Iwai
2016-04-06 21:42 ` Applied "ALSA: pcm: add IEC958 channel status helper for hw_params" to the asoc tree Mark Brown
2016-03-31 13:35 ` [PATCH v9 2/7] ALSA: pcm: Allow 32 bit sample format in IEC958 channel status helper Jyri Sarha
[not found] ` <44ee7ac5c0ddb4d25ac1bd4f189d328f8205e4a0.1459431292.git.jsarha-l0cyMroinI0@public.gmane.org>
2016-03-31 13:43 ` Takashi Iwai
2016-04-06 21:42 ` Applied "ALSA: pcm: Allow 32 bit sample format in IEC958 channel status helper" to the asoc tree Mark Brown
2016-03-31 13:36 ` [PATCH v9 3/7] ASoC: hdmi-codec: Add hdmi-codec for external HDMI-encoders Jyri Sarha
2016-04-13 8:06 ` Arnaud Pouliquen
[not found] ` <636486b25db48fa13ae640516cdebe7bcfea0d23.1459431292.git.jsarha-l0cyMroinI0@public.gmane.org>
2016-04-14 5:31 ` [alsa-devel] " PC Liao
2016-04-19 10:42 ` Jyri Sarha
[not found] ` <57160B9F.9090907-l0cyMroinI0@public.gmane.org>
2016-04-19 10:54 ` Mark Brown
2016-03-31 13:36 ` Jyri Sarha [this message]
2016-04-13 8:31 ` [PATCH v9 4/7] ASoC: hdmi-codec: Add audio abort() callback for video side to use Arnaud Pouliquen
2016-04-14 6:21 ` Jyri Sarha
2016-03-31 13:36 ` [PATCH v9 5/7] drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata Jyri Sarha
2016-03-31 13:36 ` [PATCH v9 6/7] drm/i2c: tda998x: Register ASoC hdmi-codec and add audio DT binding Jyri Sarha
2016-04-01 18:37 ` Rob Herring
2016-03-31 13:36 ` [PATCH v9 7/7] ARM: dts: am335x-boneblack: Add HDMI audio support Jyri Sarha
2016-04-13 7:02 ` [PATCH v9 0/7] Implement generic ASoC HDMI codec and use it in tda998x Mark Brown
2016-04-13 7:53 ` Jyri Sarha
2016-04-13 17:26 ` Mark Brown
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=36a4881da9400908b2e033cb2d931daf0d59bac9.1459431292.git.jsarha@ti.com \
--to=jsarha@ti.com \
--cc=airlied@linux.ie \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.pouliquen@st.com \
--cc=bcousson@baylibre.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-omap@vger.kernel.org \
--cc=peter.ujfalusi@ti.com \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=tomi.valkeinen@ti.com \
--cc=tony@atomide.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).