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.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 3c1bc533d511..991cb18c14f3 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
@@ -1569,17 +1583,17 @@ snd_rme96_create(struct rme96 *rme96)
1569 return err; 1583 return err;
1570 rme96->port = pci_resource_start(rme96->pci, 0); 1584 rme96->port = pci_resource_start(rme96->pci, 0);
1571 1585
1586 if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) {
1587 snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1);
1588 return -ENOMEM;
1589 }
1590
1572 if (request_irq(pci->irq, snd_rme96_interrupt, SA_INTERRUPT|SA_SHIRQ, "RME96", (void *)rme96)) { 1591 if (request_irq(pci->irq, snd_rme96_interrupt, SA_INTERRUPT|SA_SHIRQ, "RME96", (void *)rme96)) {
1573 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1592 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1574 return -EBUSY; 1593 return -EBUSY;
1575 } 1594 }
1576 rme96->irq = pci->irq; 1595 rme96->irq = pci->irq;
1577 1596
1578 if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) {
1579 snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1);
1580 return -ENOMEM;
1581 }
1582
1583 /* read the card's revision number */ 1597 /* read the card's revision number */
1584 pci_read_config_byte(pci, 8, &rme96->rev); 1598 pci_read_config_byte(pci, 8, &rme96->rev);
1585 1599
@@ -1805,7 +1819,7 @@ snd_rme96_proc_init(struct rme96 *rme96)
1805 struct snd_info_entry *entry; 1819 struct snd_info_entry *entry;
1806 1820
1807 if (! snd_card_proc_new(rme96->card, "rme96", &entry)) 1821 if (! snd_card_proc_new(rme96->card, "rme96", &entry))
1808 snd_info_set_text_ops(entry, rme96, 1024, snd_rme96_proc_read); 1822 snd_info_set_text_ops(entry, rme96, snd_rme96_proc_read);
1809} 1823}
1810 1824
1811/* 1825/*