diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-12-30 16:40:46 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-12-30 16:40:46 +0100 |
commit | 614acf93dceb8e9d73370f7c9b19f64c8cf17496 (patch) | |
tree | 0a9528c16e73bd5026fdc73a8602d0d645fe109a /sound/core | |
parent | 6a8484b63c421d3a69e6f560565d64e1de33d23d (diff) | |
parent | 0e2a37513a1fafa0b9829e992633a80861c3b4b5 (diff) |
Merge branch 'topic/msbits' into for-next
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_lib.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index ec9e7866177f..db05e04d0070 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1299,8 +1299,14 @@ static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params, int width = l & 0xffff; unsigned int msbits = l >> 16; struct snd_interval *i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS); - if (snd_interval_single(i) && snd_interval_value(i) == width) - params->msbits = msbits; + + if (!snd_interval_single(i)) + return 0; + + if ((snd_interval_value(i) == width) || + (width == 0 && snd_interval_value(i) > msbits)) + params->msbits = min_not_zero(params->msbits, msbits); + return 0; } @@ -1311,6 +1317,11 @@ static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params, * @width: sample bits width * @msbits: msbits width * + * This constraint will set the number of most significant bits (msbits) if a + * sample format with the specified width has been select. If width is set to 0 + * the msbits will be set for any sample format with a width larger than the + * specified msbits. + * * Return: Zero if successful, or a negative error code on failure. */ int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, |