diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-11-30 11:38:58 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-12-02 06:27:14 -0500 |
commit | 62e5f676f6a063e1ab0d6b8fcaef2feb026ee00e (patch) | |
tree | 16ac40c1babf3e1d18399fc0d35f8464f8a06e6b /sound | |
parent | d3383420c969c25deffd33270ebe321e8401191a (diff) |
ASoC: Set SNDRV_PCM_INFO_JOINT_DUPLEX for PCMs with symmetry constraints
If there are symmetry constraints between the playback and the capture channel
set the SNDRV_PCM_INFO_JOINT_DUPLEX flag to let userspace know about this.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-pcm.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 170ff9695753..f3592f142832 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -180,6 +180,21 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream, | |||
180 | return 0; | 180 | return 0; |
181 | } | 181 | } |
182 | 182 | ||
183 | static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream) | ||
184 | { | ||
185 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
186 | struct snd_soc_dai_driver *cpu_driver = rtd->cpu_dai->driver; | ||
187 | struct snd_soc_dai_driver *codec_driver = rtd->codec_dai->driver; | ||
188 | struct snd_soc_dai_link *link = rtd->dai_link; | ||
189 | |||
190 | return cpu_driver->symmetric_rates || codec_driver->symmetric_rates || | ||
191 | link->symmetric_rates || cpu_driver->symmetric_channels || | ||
192 | codec_driver->symmetric_channels || link->symmetric_channels || | ||
193 | cpu_driver->symmetric_samplebits || | ||
194 | codec_driver->symmetric_samplebits || | ||
195 | link->symmetric_samplebits; | ||
196 | } | ||
197 | |||
183 | /* | 198 | /* |
184 | * List of sample sizes that might go over the bus for parameter | 199 | * List of sample sizes that might go over the bus for parameter |
185 | * application. There ought to be a wildcard sample size for things | 200 | * application. There ought to be a wildcard sample size for things |
@@ -309,6 +324,9 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
309 | &cpu_dai_drv->capture); | 324 | &cpu_dai_drv->capture); |
310 | } | 325 | } |
311 | 326 | ||
327 | if (soc_pcm_has_symmetry(substream)) | ||
328 | runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX; | ||
329 | |||
312 | ret = -EINVAL; | 330 | ret = -EINVAL; |
313 | snd_pcm_limit_hw_rates(runtime); | 331 | snd_pcm_limit_hw_rates(runtime); |
314 | if (!runtime->hw.rates) { | 332 | if (!runtime->hw.rates) { |