aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_misc.c13
-rw-r--r--sound/core/pcm_native.c8
2 files changed, 11 insertions, 10 deletions
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
index 9142fce4dda2..afd1e4929755 100644
--- a/sound/core/pcm_misc.c
+++ b/sound/core/pcm_misc.c
@@ -433,21 +433,16 @@ EXPORT_SYMBOL(snd_pcm_format_set_silence);
433 */ 433 */
434int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime) 434int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime)
435{ 435{
436 static unsigned rates[] = {
437 /* ATTENTION: these values depend on the definition in pcm.h! */
438 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000,
439 64000, 88200, 96000, 176400, 192000
440 };
441 int i; 436 int i;
442 for (i = 0; i < (int)ARRAY_SIZE(rates); i++) { 437 for (i = 0; i < (int)snd_pcm_known_rates.count; i++) {
443 if (runtime->hw.rates & (1 << i)) { 438 if (runtime->hw.rates & (1 << i)) {
444 runtime->hw.rate_min = rates[i]; 439 runtime->hw.rate_min = snd_pcm_known_rates.list[i];
445 break; 440 break;
446 } 441 }
447 } 442 }
448 for (i = (int)ARRAY_SIZE(rates) - 1; i >= 0; i--) { 443 for (i = (int)snd_pcm_known_rates.count - 1; i >= 0; i--) {
449 if (runtime->hw.rates & (1 << i)) { 444 if (runtime->hw.rates & (1 << i)) {
450 runtime->hw.rate_max = rates[i]; 445 runtime->hw.rate_max = snd_pcm_known_rates.list[i];
451 break; 446 break;
452 } 447 }
453 } 448 }
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 59b29cd482ae..b78a411fb550 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1787,12 +1787,18 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params,
1787static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 1787static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100,
1788 48000, 64000, 88200, 96000, 176400, 192000 }; 1788 48000, 64000, 88200, 96000, 176400, 192000 };
1789 1789
1790const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = {
1791 .count = ARRAY_SIZE(rates),
1792 .list = rates,
1793};
1794
1790static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params, 1795static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params,
1791 struct snd_pcm_hw_rule *rule) 1796 struct snd_pcm_hw_rule *rule)
1792{ 1797{
1793 struct snd_pcm_hardware *hw = rule->private; 1798 struct snd_pcm_hardware *hw = rule->private;
1794 return snd_interval_list(hw_param_interval(params, rule->var), 1799 return snd_interval_list(hw_param_interval(params, rule->var),
1795 ARRAY_SIZE(rates), rates, hw->rates); 1800 snd_pcm_known_rates.count,
1801 snd_pcm_known_rates.list, hw->rates);
1796} 1802}
1797 1803
1798static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, 1804static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params,