aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_lib.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-10-26 17:51:43 -0400
committerTakashi Iwai <tiwai@suse.de>2011-10-26 17:51:43 -0400
commitd22665702226e9c40bc331098559e3d55e7cd43d (patch)
tree6e92734c9835dc9e064b20182624939f3486d28d /sound/core/pcm_lib.c
parent5cdf745ebae0f5bcf9b798d8fd5cb57add592cc1 (diff)
parentdde7ad8dee274763c8958769779aea8c993c950e (diff)
Merge branch 'topic/misc' into for-linus
Diffstat (limited to 'sound/core/pcm_lib.c')
-rw-r--r--sound/core/pcm_lib.c26
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
1400EXPORT_SYMBOL(snd_pcm_hw_constraint_pow2); 1400EXPORT_SYMBOL(snd_pcm_hw_constraint_pow2);
1401 1401
1402static 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 */
1417int 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}
1426EXPORT_SYMBOL(snd_pcm_hw_rule_noresample);
1427
1402static void _snd_pcm_hw_param_any(struct snd_pcm_hw_params *params, 1428static 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{