aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/rme96.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/rme96.c')
-rw-r--r--sound/pci/rme96.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 75a8b754ef28..65611a7d366d 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -1151,6 +1151,25 @@ static struct snd_pcm_hw_constraint_list hw_constraints_period_bytes = {
1151 .mask = 0 1151 .mask = 0
1152}; 1152};
1153 1153
1154static void
1155rme96_set_buffer_size_constraint(struct rme96 *rme96,
1156 struct snd_pcm_runtime *runtime)
1157{
1158 unsigned int size;
1159
1160 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
1161 RME96_BUFFER_SIZE, RME96_BUFFER_SIZE);
1162 if ((size = rme96->playback_periodsize) != 0 ||
1163 (size = rme96->capture_periodsize) != 0)
1164 snd_pcm_hw_constraint_minmax(runtime,
1165 SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1166 size, size);
1167 else
1168 snd_pcm_hw_constraint_list(runtime, 0,
1169 SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1170 &hw_constraints_period_bytes);
1171}
1172
1154static int 1173static int
1155snd_rme96_playback_spdif_open(struct snd_pcm_substream *substream) 1174snd_rme96_playback_spdif_open(struct snd_pcm_substream *substream)
1156{ 1175{
@@ -1180,8 +1199,7 @@ snd_rme96_playback_spdif_open(struct snd_pcm_substream *substream)
1180 runtime->hw.rate_min = rate; 1199 runtime->hw.rate_min = rate;
1181 runtime->hw.rate_max = rate; 1200 runtime->hw.rate_max = rate;
1182 } 1201 }
1183 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, RME96_BUFFER_SIZE, RME96_BUFFER_SIZE); 1202 rme96_set_buffer_size_constraint(rme96, runtime);
1184 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, &hw_constraints_period_bytes);
1185 1203
1186 rme96->wcreg_spdif_stream = rme96->wcreg_spdif; 1204 rme96->wcreg_spdif_stream = rme96->wcreg_spdif;
1187 rme96->spdif_ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; 1205 rme96->spdif_ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
@@ -1219,9 +1237,7 @@ snd_rme96_capture_spdif_open(struct snd_pcm_substream *substream)
1219 rme96->capture_substream = substream; 1237 rme96->capture_substream = substream;
1220 spin_unlock_irq(&rme96->lock); 1238 spin_unlock_irq(&rme96->lock);
1221 1239
1222 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, RME96_BUFFER_SIZE, RME96_BUFFER_SIZE); 1240 rme96_set_buffer_size_constraint(rme96, runtime);
1223 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, &hw_constraints_period_bytes);
1224
1225 return 0; 1241 return 0;
1226} 1242}
1227 1243
@@ -1254,8 +1270,7 @@ snd_rme96_playback_adat_open(struct snd_pcm_substream *substream)
1254 runtime->hw.rate_min = rate; 1270 runtime->hw.rate_min = rate;
1255 runtime->hw.rate_max = rate; 1271 runtime->hw.rate_max = rate;
1256 } 1272 }
1257 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, RME96_BUFFER_SIZE, RME96_BUFFER_SIZE); 1273 rme96_set_buffer_size_constraint(rme96, runtime);
1258 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, &hw_constraints_period_bytes);
1259 return 0; 1274 return 0;
1260} 1275}
1261 1276
@@ -1291,8 +1306,7 @@ snd_rme96_capture_adat_open(struct snd_pcm_substream *substream)
1291 rme96->capture_substream = substream; 1306 rme96->capture_substream = substream;
1292 spin_unlock_irq(&rme96->lock); 1307 spin_unlock_irq(&rme96->lock);
1293 1308
1294 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, RME96_BUFFER_SIZE, RME96_BUFFER_SIZE); 1309 rme96_set_buffer_size_constraint(rme96, runtime);
1295 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, &hw_constraints_period_bytes);
1296 return 0; 1310 return 0;
1297} 1311}
1298 1312