diff options
Diffstat (limited to 'include/sound/soc-dai.h')
-rw-r--r-- | include/sound/soc-dai.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 1bafe95..bda171e 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -172,6 +172,8 @@ struct snd_soc_dai_ops { struct snd_soc_dai *); int (*trigger)(struct snd_pcm_substream *, int, struct snd_soc_dai *); + int (*bespoke_trigger)(struct snd_pcm_substream *, int, + struct snd_soc_dai *); /* * For hardware based FIFO caused delay reporting. * Optional. @@ -209,6 +211,10 @@ struct snd_soc_dai_driver { struct snd_soc_pcm_stream capture; struct snd_soc_pcm_stream playback; unsigned int symmetric_rates:1; + + /* probe ordering - for components with runtime dependencies */ + int probe_order; + int remove_order; }; /* @@ -277,4 +283,98 @@ static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai) return dev_get_drvdata(dai->dev); } +/* Backend DAI PCM ops */ +static inline int snd_soc_dai_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + int ret = 0; + + mutex_lock(&rtd->pcm_mutex); + + if (dai->driver->ops->startup) + ret = dai->driver->ops->startup(substream, dai); + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + dai->playback_active++; + else + dai->capture_active++; + + dai->active++; + + mutex_unlock(&rtd->pcm_mutex); + return ret; +} + +static inline void snd_soc_dai_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + + mutex_lock(&rtd->pcm_mutex); + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + dai->playback_active--; + else + dai->capture_active--; + + dai->active--; + + if (dai->driver->ops->shutdown) + dai->driver->ops->shutdown(substream, dai); + mutex_unlock(&rtd->pcm_mutex); +} + +static inline int snd_soc_dai_hw_params(struct snd_pcm_substream * substream, + struct snd_pcm_hw_params *hw_params, struct snd_soc_dai *dai) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + int ret = 0; + + mutex_lock(&rtd->pcm_mutex); + + if (dai->driver->ops->hw_params) + ret = dai->driver->ops->hw_params(substream, hw_params, dai); + + mutex_unlock(&rtd->pcm_mutex); + return ret; +} + +static inline int snd_soc_dai_hw_free(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + int ret = 0; + + mutex_lock(&rtd->pcm_mutex); + + if (dai->driver->ops->hw_free) + ret = dai->driver->ops->hw_free(substream, dai); + + mutex_unlock(&rtd->pcm_mutex); + return ret; +} + +static inline int snd_soc_dai_prepare(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + int ret = 0; + + mutex_lock(&rtd->pcm_mutex); + + if (dai->driver->ops->prepare) + ret = dai->driver->ops->prepare(substream, dai); + + mutex_unlock(&rtd->pcm_mutex); + return ret; +} + +static inline int snd_soc_dai_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) +{ + if (dai->driver->ops->trigger) + return dai->driver->ops->trigger(substream, cmd, dai); + return 0; +} #endif |