diff options
author | Mark Brown <broonie@linaro.org> | 2014-01-16 07:42:57 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-01-16 07:42:57 -0500 |
commit | 2f43a23ab9ea1865a663e100b0af20198decb4f1 (patch) | |
tree | 7501fb678115cbbdb544c43dc7b59f95408f1f52 | |
parent | 7cfa7b547337faf5890c8c5f091e081fb79caf73 (diff) | |
parent | 55dcdb5051930dee75e9e2c0da90bc82ee3dcd77 (diff) |
Merge remote-tracking branch 'asoc/topic/pcm' into for-tiwai
-rw-r--r-- | include/sound/pcm.h | 2 | ||||
-rw-r--r-- | include/sound/soc.h | 4 | ||||
-rw-r--r-- | sound/core/pcm_misc.c | 39 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 3 | ||||
-rw-r--r-- | sound/soc/fsl/mpc5200_psc_i2s.c | 3 | ||||
-rw-r--r-- | sound/soc/s6000/s6000-i2s.c | 3 | ||||
-rw-r--r-- | sound/soc/soc-pcm.c | 23 |
7 files changed, 59 insertions, 18 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index fe6ca400b9ad..4883499ab38b 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -900,6 +900,8 @@ extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates; | |||
900 | int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); | 900 | int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); |
901 | unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate); | 901 | unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate); |
902 | unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit); | 902 | unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit); |
903 | unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, | ||
904 | unsigned int rates_b); | ||
903 | 905 | ||
904 | static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, | 906 | static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, |
905 | struct snd_dma_buffer *bufp) | 907 | struct snd_dma_buffer *bufp) |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 5a049d969c59..03ce45bf8ade 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -895,6 +895,10 @@ struct snd_soc_dai_link { | |||
895 | /* This DAI link can route to other DAI links at runtime (Frontend)*/ | 895 | /* This DAI link can route to other DAI links at runtime (Frontend)*/ |
896 | unsigned int dynamic:1; | 896 | unsigned int dynamic:1; |
897 | 897 | ||
898 | /* DPCM capture and Playback support */ | ||
899 | unsigned int dpcm_capture:1; | ||
900 | unsigned int dpcm_playback:1; | ||
901 | |||
898 | /* pmdown_time is ignored at stop */ | 902 | /* pmdown_time is ignored at stop */ |
899 | unsigned int ignore_pmdown_time:1; | 903 | unsigned int ignore_pmdown_time:1; |
900 | 904 | ||
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c index 43f24cce3dec..4560ca0e5651 100644 --- a/sound/core/pcm_misc.c +++ b/sound/core/pcm_misc.c | |||
@@ -514,3 +514,42 @@ unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit) | |||
514 | return 0; | 514 | return 0; |
515 | } | 515 | } |
516 | EXPORT_SYMBOL(snd_pcm_rate_bit_to_rate); | 516 | EXPORT_SYMBOL(snd_pcm_rate_bit_to_rate); |
517 | |||
518 | static unsigned int snd_pcm_rate_mask_sanitize(unsigned int rates) | ||
519 | { | ||
520 | if (rates & SNDRV_PCM_RATE_CONTINUOUS) | ||
521 | return SNDRV_PCM_RATE_CONTINUOUS; | ||
522 | else if (rates & SNDRV_PCM_RATE_KNOT) | ||
523 | return SNDRV_PCM_RATE_KNOT; | ||
524 | return rates; | ||
525 | } | ||
526 | |||
527 | /** | ||
528 | * snd_pcm_rate_mask_intersect - computes the intersection between two rate masks | ||
529 | * @rates_a: The first rate mask | ||
530 | * @rates_b: The second rate mask | ||
531 | * | ||
532 | * This function computes the rates that are supported by both rate masks passed | ||
533 | * to the function. It will take care of the special handling of | ||
534 | * SNDRV_PCM_RATE_CONTINUOUS and SNDRV_PCM_RATE_KNOT. | ||
535 | * | ||
536 | * Return: A rate mask containing the rates that are supported by both rates_a | ||
537 | * and rates_b. | ||
538 | */ | ||
539 | unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, | ||
540 | unsigned int rates_b) | ||
541 | { | ||
542 | rates_a = snd_pcm_rate_mask_sanitize(rates_a); | ||
543 | rates_b = snd_pcm_rate_mask_sanitize(rates_b); | ||
544 | |||
545 | if (rates_a & SNDRV_PCM_RATE_CONTINUOUS) | ||
546 | return rates_b; | ||
547 | else if (rates_b & SNDRV_PCM_RATE_CONTINUOUS) | ||
548 | return rates_a; | ||
549 | else if (rates_a & SNDRV_PCM_RATE_KNOT) | ||
550 | return rates_b; | ||
551 | else if (rates_b & SNDRV_PCM_RATE_KNOT) | ||
552 | return rates_a; | ||
553 | return rates_a & rates_b; | ||
554 | } | ||
555 | EXPORT_SYMBOL_GPL(snd_pcm_rate_mask_intersect); | ||
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index b2ebaf811599..76e56b39db01 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -80,8 +80,7 @@ static inline void write_ssi_mask(u32 __iomem *addr, u32 clear, u32 set) | |||
80 | * ALSA that we support all rates and let the codec driver decide what rates | 80 | * ALSA that we support all rates and let the codec driver decide what rates |
81 | * are really supported. | 81 | * are really supported. |
82 | */ | 82 | */ |
83 | #define FSLSSI_I2S_RATES (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_192000 | \ | 83 | #define FSLSSI_I2S_RATES SNDRV_PCM_RATE_CONTINUOUS |
84 | SNDRV_PCM_RATE_CONTINUOUS) | ||
85 | 84 | ||
86 | /** | 85 | /** |
87 | * FSLSSI_I2S_FORMATS: audio formats supported by the SSI | 86 | * FSLSSI_I2S_FORMATS: audio formats supported by the SSI |
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index f4efaadb80a2..5d07e8a74a21 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c | |||
@@ -26,8 +26,7 @@ | |||
26 | * ALSA that we support all rates and let the codec driver decide what rates | 26 | * ALSA that we support all rates and let the codec driver decide what rates |
27 | * are really supported. | 27 | * are really supported. |
28 | */ | 28 | */ |
29 | #define PSC_I2S_RATES (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_192000 | \ | 29 | #define PSC_I2S_RATES SNDRV_PCM_RATE_CONTINUOUS |
30 | SNDRV_PCM_RATE_CONTINUOUS) | ||
31 | 30 | ||
32 | /** | 31 | /** |
33 | * PSC_I2S_FORMATS: audio formats supported by the PSC I2S mode | 32 | * PSC_I2S_FORMATS: audio formats supported by the PSC I2S mode |
diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c index 73bb99f0109a..7eba7979b9af 100644 --- a/sound/soc/s6000/s6000-i2s.c +++ b/sound/soc/s6000/s6000-i2s.c | |||
@@ -405,8 +405,7 @@ static int s6000_i2s_dai_probe(struct snd_soc_dai *dai) | |||
405 | return 0; | 405 | return 0; |
406 | } | 406 | } |
407 | 407 | ||
408 | #define S6000_I2S_RATES (SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_5512 | \ | 408 | #define S6000_I2S_RATES SNDRV_PCM_RATE_CONTINUOUS |
409 | SNDRV_PCM_RATE_8000_192000) | ||
410 | #define S6000_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) | 409 | #define S6000_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) |
411 | 410 | ||
412 | static const struct snd_soc_dai_ops s6000_i2s_dai_ops = { | 411 | static const struct snd_soc_dai_ops s6000_i2s_dai_ops = { |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index e95ef9586723..5932971cf54d 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -240,14 +240,15 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_runtime *runtime, | |||
240 | cpu_stream->channels_min); | 240 | cpu_stream->channels_min); |
241 | hw->channels_max = min(codec_stream->channels_max, | 241 | hw->channels_max = min(codec_stream->channels_max, |
242 | cpu_stream->channels_max); | 242 | cpu_stream->channels_max); |
243 | hw->formats = codec_stream->formats & cpu_stream->formats; | 243 | if (hw->formats) |
244 | hw->rates = codec_stream->rates & cpu_stream->rates; | 244 | hw->formats &= codec_stream->formats & cpu_stream->formats; |
245 | if (codec_stream->rates | 245 | else |
246 | & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS)) | 246 | hw->formats = codec_stream->formats & cpu_stream->formats; |
247 | hw->rates |= cpu_stream->rates; | 247 | hw->rates = snd_pcm_rate_mask_intersect(codec_stream->rates, |
248 | if (cpu_stream->rates | 248 | cpu_stream->rates); |
249 | & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS)) | 249 | |
250 | hw->rates |= codec_stream->rates; | 250 | hw->rate_min = 0; |
251 | hw->rate_max = UINT_MAX; | ||
251 | 252 | ||
252 | snd_pcm_limit_hw_rates(runtime); | 253 | snd_pcm_limit_hw_rates(runtime); |
253 | 254 | ||
@@ -2140,10 +2141,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) | |||
2140 | int ret = 0, playback = 0, capture = 0; | 2141 | int ret = 0, playback = 0, capture = 0; |
2141 | 2142 | ||
2142 | if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) { | 2143 | if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) { |
2143 | if (cpu_dai->driver->playback.channels_min) | 2144 | playback = rtd->dai_link->dpcm_playback; |
2144 | playback = 1; | 2145 | capture = rtd->dai_link->dpcm_capture; |
2145 | if (cpu_dai->driver->capture.channels_min) | ||
2146 | capture = 1; | ||
2147 | } else { | 2146 | } else { |
2148 | if (codec_dai->driver->playback.channels_min && | 2147 | if (codec_dai->driver->playback.channels_min && |
2149 | cpu_dai->driver->playback.channels_min) | 2148 | cpu_dai->driver->playback.channels_min) |