if (codec_dai->pop_wait == 1) {
codec_dai->pop_wait = 0;
- snd_soc_dapm_stream_event(codec, codec_dai->playback.stream_name,
+ snd_soc_dapm_stream_event(codec,
+ codec_dai->playback.stream_name,
SND_SOC_DAPM_STREAM_STOP);
/* power down the codec power domain if no longer active */
if (codec->active == 0) {
dbg("pop wq D3 %s %s\n", codec->name,
codec_dai->playback.stream_name);
- if (codec->dapm_event)
- codec->dapm_event(codec, SNDRV_CTL_POWER_D3hot);
+ snd_soc_dapm_device_event(socdev,
+ SNDRV_CTL_POWER_D3hot);
}
}
}
} else {
/* capture streams can be powered down now */
snd_soc_dapm_stream_event(codec,
- codec_dai->capture.stream_name, SND_SOC_DAPM_STREAM_STOP);
+ codec_dai->capture.stream_name,
+ SND_SOC_DAPM_STREAM_STOP);
- if (codec->active == 0 && codec_dai->pop_wait == 0){
- if (codec->dapm_event)
- codec->dapm_event(codec, SNDRV_CTL_POWER_D3hot);
- }
+ if (codec->active == 0 && codec_dai->pop_wait == 0)
+ snd_soc_dapm_device_event(socdev,
+ SNDRV_CTL_POWER_D3hot);
}
mutex_unlock(&pcm_mutex);
/* no delayed work - do we need to power up codec */
if (codec->dapm_state != SNDRV_CTL_POWER_D0) {
- if (codec->dapm_event)
- codec->dapm_event(codec, SNDRV_CTL_POWER_D1);
+ snd_soc_dapm_device_event(socdev, SNDRV_CTL_POWER_D1);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
snd_soc_dapm_stream_event(codec,
codec_dai->capture.stream_name,
SND_SOC_DAPM_STREAM_START);
- if (codec->dapm_event)
- codec->dapm_event(codec, SNDRV_CTL_POWER_D0);
+ snd_soc_dapm_device_event(socdev, SNDRV_CTL_POWER_D0);
if (codec_dai->dai_ops.digital_mute)
codec_dai->dai_ops.digital_mute(codec_dai, 0);
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_stream_event);
+/**
+ * snd_soc_dapm_device_event - send a device event to the dapm core
+ * @socdev: audio device
+ * @event: device event
+ *
+ * Sends a device event to the dapm core. The core then makes any
+ * necessary machine or codec power changes..
+ *
+ * Returns 0 for success else error.
+ */
+int snd_soc_dapm_device_event(struct snd_soc_device *socdev, int event)
+{
+ struct snd_soc_codec *codec = socdev->codec;
+ struct snd_soc_machine *machine = socdev->machine;
+
+ if (machine->dapm_event)
+ machine->dapm_event(machine, event);
+ if (codec->dapm_event)
+ codec->dapm_event(codec, event);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_device_event);
+
/**
* snd_soc_dapm_set_endpoint - set audio endpoint status
* @codec: audio codec