alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
To: alsa-devel@alsa-project.org
Cc: broonie@opensource.wolfsonmicro.com, lrg@slimlogic.co.uk
Subject: [PATCH 3/4] ASoC: tlv320dac33: Manage a pointer for snd_pcm_substream in private structure
Date: Fri, 30 Apr 2010 10:31:54 +0300	[thread overview]
Message-ID: <1272612715-13387-4-git-send-email-peter.ujfalusi@nokia.com> (raw)
In-Reply-To: <1272612715-13387-1-git-send-email-peter.ujfalusi@nokia.com>

As a preparation for supporting codec to be turned off,
when we are in BIAS_STANDBY.

The substream must be easily available in other places than
pcm_* callbacks.

Manage a pointer in _startup, and _shutdown for this.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
 sound/soc/codecs/tlv320dac33.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index 7d01759..6edad36 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -91,6 +91,7 @@ struct tlv320dac33_priv {
 	struct work_struct work;
 	struct snd_soc_codec codec;
 	struct regulator_bulk_data supplies[DAC33_NUM_SUPPLIES];
+	struct snd_pcm_substream *substream;
 	int power_gpio;
 	int chip_power;
 	int irq;
@@ -725,6 +726,31 @@ static void dac33_oscwait(struct snd_soc_codec *codec)
 			"internal oscillator calibration failed\n");
 }
 
+static int dac33_startup(struct snd_pcm_substream *substream,
+			   struct snd_soc_dai *dai)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_device *socdev = rtd->socdev;
+	struct snd_soc_codec *codec = socdev->card->codec;
+	struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
+
+	/* Stream started, save the substream pointer */
+	dac33->substream = substream;
+
+	return 0;
+}
+
+static void dac33_shutdown(struct snd_pcm_substream *substream,
+			     struct snd_soc_dai *dai)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_device *socdev = rtd->socdev;
+	struct snd_soc_codec *codec = socdev->card->codec;
+	struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
+
+	dac33->substream = NULL;
+}
+
 static int dac33_hw_params(struct snd_pcm_substream *substream,
 			   struct snd_pcm_hw_params *params,
 			   struct snd_soc_dai *dai)
@@ -1372,6 +1398,8 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_tlv320dac33);
 #define DAC33_FORMATS	SNDRV_PCM_FMTBIT_S16_LE
 
 static struct snd_soc_dai_ops dac33_dai_ops = {
+	.startup	= dac33_startup,
+	.shutdown	= dac33_shutdown,
 	.hw_params	= dac33_hw_params,
 	.prepare	= dac33_pcm_prepare,
 	.trigger	= dac33_pcm_trigger,
-- 
1.7.0.4

  parent reply	other threads:[~2010-04-30  7:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-30  7:31 [PATCH 0/4] ASoC: tlv320dac33: Support for turning codec off Peter Ujfalusi
2010-04-30  7:31 ` [PATCH 1/4] ASoC: tlv320dac33: Optimize power up, and restore Peter Ujfalusi
2010-04-30  7:37   ` Peter Ujfalusi
2010-04-30  7:31 ` [PATCH 2/4] ASoC: tlv320dac33: Revised module loading, and DAC33 ID read Peter Ujfalusi
2010-04-30  7:31 ` Peter Ujfalusi [this message]
2010-04-30  7:31 ` [PATCH 4/4] ASoC: tlv320dac33: Support for turning off the codec in BIAS_STANDBY Peter Ujfalusi
2010-04-30  8:41   ` Mark Brown
2010-04-30  9:45     ` Peter Ujfalusi
2010-04-30  9:56       ` Mark Brown
2010-04-30 10:10         ` Peter Ujfalusi
2010-04-30 10:23           ` [PATCH 4/4] ASoC: tlv320dac33: Support for?turning " Mark Brown
2010-04-30 10:55             ` [PATCH 4/4] ASoC: tlv320dac33: Support for turning " Peter Ujfalusi
2010-04-30 11:42               ` Mark Brown
2010-04-30 11:42               ` Peter Ujfalusi

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=1272612715-13387-4-git-send-email-peter.ujfalusi@nokia.com \
    --to=peter.ujfalusi@nokia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lrg@slimlogic.co.uk \
    /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).