Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b61d2b9 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Liam Girdwood
Browse files

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: default avatarPeter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 239fe55c
Loading
Loading
Loading
Loading
+28 −0
Original line number Original line Diff line number Diff line
@@ -91,6 +91,7 @@ struct tlv320dac33_priv {
	struct work_struct work;
	struct work_struct work;
	struct snd_soc_codec codec;
	struct snd_soc_codec codec;
	struct regulator_bulk_data supplies[DAC33_NUM_SUPPLIES];
	struct regulator_bulk_data supplies[DAC33_NUM_SUPPLIES];
	struct snd_pcm_substream *substream;
	int power_gpio;
	int power_gpio;
	int chip_power;
	int chip_power;
	int irq;
	int irq;
@@ -720,6 +721,31 @@ static void dac33_oscwait(struct snd_soc_codec *codec)
			"internal oscillator calibration failed\n");
			"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,
static int dac33_hw_params(struct snd_pcm_substream *substream,
			   struct snd_pcm_hw_params *params,
			   struct snd_pcm_hw_params *params,
			   struct snd_soc_dai *dai)
			   struct snd_soc_dai *dai)
@@ -1367,6 +1393,8 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_tlv320dac33);
#define DAC33_FORMATS	SNDRV_PCM_FMTBIT_S16_LE
#define DAC33_FORMATS	SNDRV_PCM_FMTBIT_S16_LE


static struct snd_soc_dai_ops dac33_dai_ops = {
static struct snd_soc_dai_ops dac33_dai_ops = {
	.startup	= dac33_startup,
	.shutdown	= dac33_shutdown,
	.hw_params	= dac33_hw_params,
	.hw_params	= dac33_hw_params,
	.prepare	= dac33_pcm_prepare,
	.prepare	= dac33_pcm_prepare,
	.trigger	= dac33_pcm_trigger,
	.trigger	= dac33_pcm_trigger,