Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353362
b: refs/heads/master
c: da18396
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Feb 8, 2013
1 parent ec85e1e commit eee7130
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e38b9b7478d57701fbcbaafdde169aa1a88d0eca
refs/heads/master: da18396f949ecaa45007d3aeb1b81bd6da092811
4 changes: 3 additions & 1 deletion trunk/include/sound/soc-dai.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,
int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);

/* Digital Audio Interface mute */
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
int direction);

struct snd_soc_dai_ops {
/*
Expand Down Expand Up @@ -157,6 +158,7 @@ struct snd_soc_dai_ops {
* Called by soc-core to minimise any pops.
*/
int (*digital_mute)(struct snd_soc_dai *dai, int mute);
int (*mute_stream)(struct snd_soc_dai *dai, int mute, int stream);

/*
* ALSA PCM audio operations - all optional.
Expand Down
19 changes: 9 additions & 10 deletions trunk/sound/soc/soc-compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,13 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
if (cstream->direction == SND_COMPRESS_PLAYBACK) {
cpu_dai->playback_active--;
codec_dai->playback_active--;
snd_soc_dai_digital_mute(codec_dai, 1);
} else {
cpu_dai->capture_active--;
codec_dai->capture_active--;
}

snd_soc_dai_digital_mute(codec_dai, 1, cstream->direction);

cpu_dai->active--;
codec_dai->active--;
codec->active--;
Expand Down Expand Up @@ -178,15 +179,13 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
goto out;
}

if (cstream->direction == SND_COMPRESS_PLAYBACK) {
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
snd_soc_dai_digital_mute(codec_dai, 0);
break;
case SNDRV_PCM_TRIGGER_STOP:
snd_soc_dai_digital_mute(codec_dai, 1);
break;
}
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
snd_soc_dai_digital_mute(codec_dai, 0, cstream->direction);
break;
case SNDRV_PCM_TRIGGER_STOP:
snd_soc_dai_digital_mute(codec_dai, 1, cstream->direction);
break;
}

out:
Expand Down
12 changes: 10 additions & 2 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3540,12 +3540,20 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_tristate);
* snd_soc_dai_digital_mute - configure DAI system or master clock.
* @dai: DAI
* @mute: mute enable
* @direction: stream to mute
*
* Mutes the DAI DAC.
*/
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute)
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
int direction)
{
if (dai->driver && dai->driver->ops->digital_mute)
if (!dai->driver)
return -ENOTSUPP;

if (dai->driver->ops->mute_stream)
return dai->driver->ops->mute_stream(dai, mute, direction);
else if (direction == SNDRV_PCM_STREAM_PLAYBACK &&
dai->driver->ops->digital_mute)
return dai->driver->ops->digital_mute(dai, mute);
else
return -ENOTSUPP;
Expand Down
6 changes: 4 additions & 2 deletions trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3247,14 +3247,16 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
break;

case SND_SOC_DAPM_POST_PMU:
ret = snd_soc_dai_digital_mute(sink, 0);
ret = snd_soc_dai_digital_mute(sink, 0,
SNDRV_PCM_STREAM_PLAYBACK);
if (ret != 0 && ret != -ENOTSUPP)
dev_warn(sink->dev, "ASoC: Failed to unmute: %d\n", ret);
ret = 0;
break;

case SND_SOC_DAPM_PRE_PMD:
ret = snd_soc_dai_digital_mute(sink, 1);
ret = snd_soc_dai_digital_mute(sink, 1,
SNDRV_PCM_STREAM_PLAYBACK);
if (ret != 0 && ret != -ENOTSUPP)
dev_warn(sink->dev, "ASoC: Failed to mute: %d\n", ret);
ret = 0;
Expand Down
7 changes: 3 additions & 4 deletions trunk/sound/soc/soc-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
/* Muting the DAC suppresses artifacts caused during digital
* shutdown, for example from stopping clocks.
*/
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
snd_soc_dai_digital_mute(codec_dai, 1);
snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);

if (cpu_dai->driver->ops->shutdown)
cpu_dai->driver->ops->shutdown(substream, cpu_dai);
Expand Down Expand Up @@ -488,7 +487,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
snd_soc_dapm_stream_event(rtd, substream->stream,
SND_SOC_DAPM_STREAM_START);

snd_soc_dai_digital_mute(codec_dai, 0);
snd_soc_dai_digital_mute(codec_dai, 0, substream->stream);

out:
mutex_unlock(&rtd->pcm_mutex);
Expand Down Expand Up @@ -586,7 +585,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)

/* apply codec digital mute */
if (!codec->active)
snd_soc_dai_digital_mute(codec_dai, 1);
snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);

/* free any machine hw params */
if (rtd->dai_link->ops && rtd->dai_link->ops->hw_free)
Expand Down

0 comments on commit eee7130

Please sign in to comment.