aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorPavel Hofman <pavel.hofman@ivitera.com>2012-03-02 16:09:39 -0500
committerTakashi Iwai <tiwai@suse.de>2012-03-05 08:53:58 -0500
commitdb05828aadbcc71aeea1c0b33ffadc8655dec600 (patch)
tree448d016a54651e9d59962dc9ea07019d9f407ae7 /sound/pci
parentadef39c0ea2e5deae5c4f2917b23694b68535e45 (diff)
ALSA: ice1724 - constrain runtime rates for locked internal rate
The driver already defines control "Multi Track Rate Locking" which locks the card at current rate if switched to internal clock. This patch limits the runtime rates to this rate only, allowing proper reporting of the card capabilities, and e.g. automatic rate conversion by the plug plugin to the currently locked rate. Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ice1712/ice1724.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 92362973764d..812d10e43ae0 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -1013,6 +1013,25 @@ static int set_rate_constraints(struct snd_ice1712 *ice,
1013 ice->hw_rates); 1013 ice->hw_rates);
1014} 1014}
1015 1015
1016/* if the card has the internal rate locked (is_pro_locked), limit runtime
1017 hw rates to the current internal rate only.
1018*/
1019static void constrain_rate_if_locked(struct snd_pcm_substream *substream)
1020{
1021 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
1022 struct snd_pcm_runtime *runtime = substream->runtime;
1023 unsigned int rate;
1024 if (is_pro_rate_locked(ice)) {
1025 rate = ice->get_rate(ice);
1026 if (rate >= runtime->hw.rate_min
1027 && rate <= runtime->hw.rate_max) {
1028 runtime->hw.rate_min = rate;
1029 runtime->hw.rate_max = rate;
1030 }
1031 }
1032}
1033
1034
1016/* multi-channel playback needs alignment 8x32bit regardless of the channels 1035/* multi-channel playback needs alignment 8x32bit regardless of the channels
1017 * actually used 1036 * actually used
1018 */ 1037 */
@@ -1046,6 +1065,7 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
1046 VT1724_BUFFER_ALIGN); 1065 VT1724_BUFFER_ALIGN);
1047 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 1066 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
1048 VT1724_BUFFER_ALIGN); 1067 VT1724_BUFFER_ALIGN);
1068 constrain_rate_if_locked(substream);
1049 if (ice->pro_open) 1069 if (ice->pro_open)
1050 ice->pro_open(ice, substream); 1070 ice->pro_open(ice, substream);
1051 return 0; 1071 return 0;
@@ -1066,6 +1086,7 @@ static int snd_vt1724_capture_pro_open(struct snd_pcm_substream *substream)
1066 VT1724_BUFFER_ALIGN); 1086 VT1724_BUFFER_ALIGN);
1067 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 1087 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
1068 VT1724_BUFFER_ALIGN); 1088 VT1724_BUFFER_ALIGN);
1089 constrain_rate_if_locked(substream);
1069 if (ice->pro_open) 1090 if (ice->pro_open)
1070 ice->pro_open(ice, substream); 1091 ice->pro_open(ice, substream);
1071 return 0; 1092 return 0;
@@ -1215,6 +1236,7 @@ static int snd_vt1724_playback_spdif_open(struct snd_pcm_substream *substream)
1215 VT1724_BUFFER_ALIGN); 1236 VT1724_BUFFER_ALIGN);
1216 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 1237 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
1217 VT1724_BUFFER_ALIGN); 1238 VT1724_BUFFER_ALIGN);
1239 constrain_rate_if_locked(substream);
1218 if (ice->spdif.ops.open) 1240 if (ice->spdif.ops.open)
1219 ice->spdif.ops.open(ice, substream); 1241 ice->spdif.ops.open(ice, substream);
1220 return 0; 1242 return 0;
@@ -1251,6 +1273,7 @@ static int snd_vt1724_capture_spdif_open(struct snd_pcm_substream *substream)
1251 VT1724_BUFFER_ALIGN); 1273 VT1724_BUFFER_ALIGN);
1252 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 1274 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
1253 VT1724_BUFFER_ALIGN); 1275 VT1724_BUFFER_ALIGN);
1276 constrain_rate_if_locked(substream);
1254 if (ice->spdif.ops.open) 1277 if (ice->spdif.ops.open)
1255 ice->spdif.ops.open(ice, substream); 1278 ice->spdif.ops.open(ice, substream);
1256 return 0; 1279 return 0;