diff options
author | Jaroslav Kysela <perex@perex.cz> | 2009-04-27 09:44:40 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-05-29 11:47:33 +0200 |
commit | 8bea869c5e56234990e6bad92a543437115bfc18 (patch) | |
tree | 7d0a5c4eeeeb69623066eccb363f35e0f2e3fda6 /sound/core/pcm_native.c | |
parent | e93721a70263afefbac781f575bfe851c6f95d84 (diff) | |
download | kernel_samsung_smdk4412-8bea869c5e56234990e6bad92a543437115bfc18.zip kernel_samsung_smdk4412-8bea869c5e56234990e6bad92a543437115bfc18.tar.gz kernel_samsung_smdk4412-8bea869c5e56234990e6bad92a543437115bfc18.tar.bz2 |
ALSA: PCM midlevel: improve fifo_size handling
Move the fifo_size assignment to hw->ioctl callback to allow lowlevel
drivers overwrite the default behaviour.
fifo_size is in frames not bytes as specified in asound.h and alsa-lib's
documentation, but most hardware have fixed byte based FIFOs. Introduce
internal SNDRV_PCM_INFO_FIFO_IN_FRAMES.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r-- | sound/core/pcm_native.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 45dc53f..84da3ba 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -312,9 +312,18 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, hw = &substream->runtime->hw; if (!params->info) - params->info = hw->info; - if (!params->fifo_size) - params->fifo_size = hw->fifo_size; + params->info = hw->info & ~SNDRV_PCM_INFO_FIFO_IN_FRAMES; + if (!params->fifo_size) { + if (snd_mask_min(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT]) == + snd_mask_max(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT]) && + snd_mask_min(¶ms->masks[SNDRV_PCM_HW_PARAM_CHANNELS]) == + snd_mask_max(¶ms->masks[SNDRV_PCM_HW_PARAM_CHANNELS])) { + changed = substream->ops->ioctl(substream, + SNDRV_PCM_IOCTL1_FIFO_SIZE, params); + if (params < 0) + return changed; + } + } params->rmask = 0; return 0; } |