aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/rme96.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2007-08-13 11:40:54 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:58:54 -0400
commit918f3a0e8cf67b5db966516f255eaf24d814fac0 (patch)
treeae4ac300f4ca93346d4b4ca9a22d760c87ab3072 /sound/pci/rme96.c
parent7653d557606c7cae921557a6a0ebb7c510e458eb (diff)
[ALSA] pcm: add snd_pcm_rate_to_rate_bit() helper
Add a snd_pcm_rate_to_rate_bit() function to factor out common code used by several drivers. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/rme96.c')
-rw-r--r--sound/pci/rme96.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index ba4a34bae48f..0b3c532c4014 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -301,20 +301,6 @@ snd_rme96_capture_ptr(struct rme96 *rme96)
301} 301}
302 302
303static int 303static int
304snd_rme96_ratecode(int rate)
305{
306 switch (rate) {
307 case 32000: return SNDRV_PCM_RATE_32000;
308 case 44100: return SNDRV_PCM_RATE_44100;
309 case 48000: return SNDRV_PCM_RATE_48000;
310 case 64000: return SNDRV_PCM_RATE_64000;
311 case 88200: return SNDRV_PCM_RATE_88200;
312 case 96000: return SNDRV_PCM_RATE_96000;
313 }
314 return 0;
315}
316
317static int
318snd_rme96_playback_silence(struct snd_pcm_substream *substream, 304snd_rme96_playback_silence(struct snd_pcm_substream *substream,
319 int channel, /* not used (interleaved data) */ 305 int channel, /* not used (interleaved data) */
320 snd_pcm_uframes_t pos, 306 snd_pcm_uframes_t pos,
@@ -1192,7 +1178,7 @@ snd_rme96_playback_spdif_open(struct snd_pcm_substream *substream)
1192 (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0) 1178 (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
1193 { 1179 {
1194 /* slave clock */ 1180 /* slave clock */
1195 runtime->hw.rates = snd_rme96_ratecode(rate); 1181 runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
1196 runtime->hw.rate_min = rate; 1182 runtime->hw.rate_min = rate;
1197 runtime->hw.rate_max = rate; 1183 runtime->hw.rate_max = rate;
1198 } 1184 }
@@ -1219,7 +1205,7 @@ snd_rme96_capture_spdif_open(struct snd_pcm_substream *substream)
1219 if (isadat) { 1205 if (isadat) {
1220 return -EIO; 1206 return -EIO;
1221 } 1207 }
1222 runtime->hw.rates = snd_rme96_ratecode(rate); 1208 runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
1223 runtime->hw.rate_min = rate; 1209 runtime->hw.rate_min = rate;
1224 runtime->hw.rate_max = rate; 1210 runtime->hw.rate_max = rate;
1225 } 1211 }
@@ -1259,7 +1245,7 @@ snd_rme96_playback_adat_open(struct snd_pcm_substream *substream)
1259 (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0) 1245 (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
1260 { 1246 {
1261 /* slave clock */ 1247 /* slave clock */
1262 runtime->hw.rates = snd_rme96_ratecode(rate); 1248 runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
1263 runtime->hw.rate_min = rate; 1249 runtime->hw.rate_min = rate;
1264 runtime->hw.rate_max = rate; 1250 runtime->hw.rate_max = rate;
1265 } 1251 }
@@ -1284,7 +1270,7 @@ snd_rme96_capture_adat_open(struct snd_pcm_substream *substream)
1284 if (!isadat) { 1270 if (!isadat) {
1285 return -EIO; 1271 return -EIO;
1286 } 1272 }
1287 runtime->hw.rates = snd_rme96_ratecode(rate); 1273 runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate);
1288 runtime->hw.rate_min = rate; 1274 runtime->hw.rate_min = rate;
1289 runtime->hw.rate_max = rate; 1275 runtime->hw.rate_max = rate;
1290 } 1276 }