Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353359
b: refs/heads/master
c: 202c8f7
h: refs/heads/master
i:
  353357: c9bcc62
  353355: bfa5ba8
  353351: 769423d
  353343: 5b7f882
v: v3
  • Loading branch information
Charles Keepax authored and Mark Brown committed Jan 24, 2013
1 parent 05cd856 commit a84d006
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 15e2e6194a3ae13ffeea9b7c368b54b143f31594
refs/heads/master: 202c8f7082e87e09f861d06b1a03501047c017b5
31 changes: 31 additions & 0 deletions trunk/sound/soc/soc-compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,34 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
return ret;
}

/*
* Power down the audio subsystem pmdown_time msecs after close is called.
* This is to ensure there are no pops or clicks in between any music tracks
* due to DAPM power cycling.
*/
static void close_delayed_work(struct work_struct *work)
{
struct snd_soc_pcm_runtime *rtd =
container_of(work, struct snd_soc_pcm_runtime, delayed_work.work);
struct snd_soc_dai *codec_dai = rtd->codec_dai;

mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);

dev_dbg(rtd->dev, "ASoC: pop wq checking: %s status: %s waiting: %s\n",
codec_dai->driver->playback.stream_name,
codec_dai->playback_active ? "active" : "inactive",
rtd->pop_wait ? "yes" : "no");

/* are we waiting on this codec DAI stream */
if (rtd->pop_wait == 1) {
rtd->pop_wait = 0;
snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK,
SND_SOC_DAPM_STREAM_STOP);
}

mutex_unlock(&rtd->pcm_mutex);
}

static int soc_compr_free(struct snd_compr_stream *cstream)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
Expand Down Expand Up @@ -317,6 +345,9 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
return ret;
}

/* DAPM dai link stream work */
INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);

rtd->compr = compr;
compr->private_data = rtd;

Expand Down

0 comments on commit a84d006

Please sign in to comment.