diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2010-04-30 07:59:35 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-05-03 07:55:48 -0400 |
commit | 0b61d2b9f2f78fc55faaedcc37f622ffd4103d14 (patch) | |
tree | e9644b438dc3907cd90f978c2bc2c110f2ab0c6f /sound | |
parent | 239fe55c7fe17d67403cb1e9222fcaea84248974 (diff) |
ASoC: tlv320dac33: Manage a pointer for snd_pcm_substream in private structure
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>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound')
-rw-r--r-- | 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 9944721a055c..50d152215abd 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -91,6 +91,7 @@ struct tlv320dac33_priv { | |||
91 | struct work_struct work; | 91 | struct work_struct work; |
92 | struct snd_soc_codec codec; | 92 | struct snd_soc_codec codec; |
93 | struct regulator_bulk_data supplies[DAC33_NUM_SUPPLIES]; | 93 | struct regulator_bulk_data supplies[DAC33_NUM_SUPPLIES]; |
94 | struct snd_pcm_substream *substream; | ||
94 | int power_gpio; | 95 | int power_gpio; |
95 | int chip_power; | 96 | int chip_power; |
96 | int irq; | 97 | int irq; |
@@ -720,6 +721,31 @@ static void dac33_oscwait(struct snd_soc_codec *codec) | |||
720 | "internal oscillator calibration failed\n"); | 721 | "internal oscillator calibration failed\n"); |
721 | } | 722 | } |
722 | 723 | ||
724 | static int dac33_startup(struct snd_pcm_substream *substream, | ||
725 | struct snd_soc_dai *dai) | ||
726 | { | ||
727 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
728 | struct snd_soc_device *socdev = rtd->socdev; | ||
729 | struct snd_soc_codec *codec = socdev->card->codec; | ||
730 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); | ||
731 | |||
732 | /* Stream started, save the substream pointer */ | ||
733 | dac33->substream = substream; | ||
734 | |||
735 | return 0; | ||
736 | } | ||
737 | |||
738 | static void dac33_shutdown(struct snd_pcm_substream *substream, | ||
739 | struct snd_soc_dai *dai) | ||
740 | { | ||
741 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
742 | struct snd_soc_device *socdev = rtd->socdev; | ||
743 | struct snd_soc_codec *codec = socdev->card->codec; | ||
744 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); | ||
745 | |||
746 | dac33->substream = NULL; | ||
747 | } | ||
748 | |||
723 | static int dac33_hw_params(struct snd_pcm_substream *substream, | 749 | static int dac33_hw_params(struct snd_pcm_substream *substream, |
724 | struct snd_pcm_hw_params *params, | 750 | struct snd_pcm_hw_params *params, |
725 | struct snd_soc_dai *dai) | 751 | struct snd_soc_dai *dai) |
@@ -1367,6 +1393,8 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_tlv320dac33); | |||
1367 | #define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE | 1393 | #define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE |
1368 | 1394 | ||
1369 | static struct snd_soc_dai_ops dac33_dai_ops = { | 1395 | static struct snd_soc_dai_ops dac33_dai_ops = { |
1396 | .startup = dac33_startup, | ||
1397 | .shutdown = dac33_shutdown, | ||
1370 | .hw_params = dac33_hw_params, | 1398 | .hw_params = dac33_hw_params, |
1371 | .prepare = dac33_pcm_prepare, | 1399 | .prepare = dac33_pcm_prepare, |
1372 | .trigger = dac33_pcm_trigger, | 1400 | .trigger = dac33_pcm_trigger, |