diff options
Diffstat (limited to 'sound/pci/ice1712/ice1724.c')
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 23 |
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 | */ | ||
1019 | static 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; |