diff options
Diffstat (limited to 'sound/core/pcm_lib.c')
-rw-r--r-- | sound/core/pcm_lib.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 62e90b862a0d..95d1e789715f 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -1399,6 +1399,32 @@ int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime, | |||
1399 | 1399 | ||
1400 | EXPORT_SYMBOL(snd_pcm_hw_constraint_pow2); | 1400 | EXPORT_SYMBOL(snd_pcm_hw_constraint_pow2); |
1401 | 1401 | ||
1402 | static int snd_pcm_hw_rule_noresample_func(struct snd_pcm_hw_params *params, | ||
1403 | struct snd_pcm_hw_rule *rule) | ||
1404 | { | ||
1405 | unsigned int base_rate = (unsigned int)(uintptr_t)rule->private; | ||
1406 | struct snd_interval *rate; | ||
1407 | |||
1408 | rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); | ||
1409 | return snd_interval_list(rate, 1, &base_rate, 0); | ||
1410 | } | ||
1411 | |||
1412 | /** | ||
1413 | * snd_pcm_hw_rule_noresample - add a rule to allow disabling hw resampling | ||
1414 | * @runtime: PCM runtime instance | ||
1415 | * @base_rate: the rate at which the hardware does not resample | ||
1416 | */ | ||
1417 | int snd_pcm_hw_rule_noresample(struct snd_pcm_runtime *runtime, | ||
1418 | unsigned int base_rate) | ||
1419 | { | ||
1420 | return snd_pcm_hw_rule_add(runtime, SNDRV_PCM_HW_PARAMS_NORESAMPLE, | ||
1421 | SNDRV_PCM_HW_PARAM_RATE, | ||
1422 | snd_pcm_hw_rule_noresample_func, | ||
1423 | (void *)(uintptr_t)base_rate, | ||
1424 | SNDRV_PCM_HW_PARAM_RATE, -1); | ||
1425 | } | ||
1426 | EXPORT_SYMBOL(snd_pcm_hw_rule_noresample); | ||
1427 | |||
1402 | static void _snd_pcm_hw_param_any(struct snd_pcm_hw_params *params, | 1428 | static void _snd_pcm_hw_param_any(struct snd_pcm_hw_params *params, |
1403 | snd_pcm_hw_param_t var) | 1429 | snd_pcm_hw_param_t var) |
1404 | { | 1430 | { |