[alsa-devel] [PATCH 0/4] RME RayDAT/AIO - enable period size of 32 samples
Hi!
Here is a series of patches that enable period sizes of 32 samples on RME RayDAT and AIO cards. It also adds 8192 samples per period for MADI and AES cards, this mode was present in the original driver but got lost during the merge.
Cheers
Adrian Knoth (4): ALSA: hdspm - Allow for 8192 period size on RME MADI and AES cards ALSA: hdspm - Set period_bytes_min to 32 * 4 for new RME cards ALSA: hdspm - Reorder period sizes according to their bit representation ALSA: hdspm - Enable 32 samples/period on RME RayDAT/AIO
sound/pci/rme9652/hdspm.c | 50 ++++++++++++++++++++++++++++++++++++-------- 1 files changed, 41 insertions(+), 9 deletions(-)
Older RME cards like MADI and AES support period sizes of 8192 samples. The original hdspm driver already featured this value, apparently, it was lost during the rewrite.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 493e394..204e1ce 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -5673,7 +5673,7 @@ static int snd_hdspm_prepare(struct snd_pcm_substream *substream) }
static unsigned int period_sizes_old[] = { - 64, 128, 256, 512, 1024, 2048, 4096 + 64, 128, 256, 512, 1024, 2048, 4096, 8192 };
static unsigned int period_sizes_new[] = {
On newer RME cards like RayDAT and AIO, the lower bound is 32 samples per period in contrast to 64 samples as seen on older cards.
We hence lower period_bytes_min to 32 * 4. Four bytes per sample.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 204e1ce..8dc2a89 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -5703,7 +5703,7 @@ static struct snd_pcm_hardware snd_hdspm_playback_subinfo = { .channels_max = HDSPM_MAX_CHANNELS, .buffer_bytes_max = HDSPM_CHANNEL_BUFFER_BYTES * HDSPM_MAX_CHANNELS, - .period_bytes_min = (64 * 4), + .period_bytes_min = (32 * 4), .period_bytes_max = (4096 * 4) * HDSPM_MAX_CHANNELS, .periods_min = 2, .periods_max = 512, @@ -5728,7 +5728,7 @@ static struct snd_pcm_hardware snd_hdspm_capture_subinfo = { .channels_max = HDSPM_MAX_CHANNELS, .buffer_bytes_max = HDSPM_CHANNEL_BUFFER_BYTES * HDSPM_MAX_CHANNELS, - .period_bytes_min = (64 * 4), + .period_bytes_min = (32 * 4), .period_bytes_max = (4096 * 4) * HDSPM_MAX_CHANNELS, .periods_min = 2, .periods_max = 512,
On newer RME cards like RayDAT and AIO, the 8192 samples per period size are no longer supported. Instead, setting all three bits of HDSP_LatencyMask to one ({1,1,1}) now corresponds to 32 samples per period.
To make this more obvious to future developers, let's reorder the array according to their bit representation, starting at 64 ({0,0,0}) up to 4096 ({1,1,0}) and finally 32 ({1,1,1}).
Note that this patch doesn't change semantics.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 8dc2a89..159133a 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -5677,7 +5677,7 @@ static unsigned int period_sizes_old[] = { };
static unsigned int period_sizes_new[] = { - 32, 64, 128, 256, 512, 1024, 2048, 4096 + 64, 128, 256, 512, 1024, 2048, 4096, 32 };
/* RayDAT and AIO always have a buffer of 16384 samples per channel */
Newer RME cards like RayDAT and AIO support 32 samples per period. This value is encoded as {1,1,1} in the HDSP_LatencyMask bits in the control register.
Since {1,1,1} is also the representation for 8192 samples/period on older RME cards, we have to special case 32 samples and 32768 bytes according to the actual card.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 159133a..1ed4ba6 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1245,6 +1245,23 @@ static int hdspm_external_sample_rate(struct hdspm *hdspm) static inline void hdspm_compute_period_size(struct hdspm *hdspm) { hdspm->period_bytes = 1 << ((hdspm_decode_latency(hdspm->control_register) + 8)); + if (32768 == hdspm->period_bytes) { + /* Special case for new RME cards with 32 samples period size. + * The three latency bits in the control register + * (HDSP_LatencyMask) encode latency values of 64 samples as + * 0, 128 samples as 1 ... 4096 samples as 6. For old cards, 7 + * denotes 8192 samples, but on new cards like RayDAT or AIO, + * it corresponds to 32 samples. Multiplied by 4 bytes equals + * 128 bytes. + * + * Note that hdspm->period_bytes isn't used for anything + * useful on new cards (it's used on old cards in + * hdspm_hw_pointer), but for the sake of correctness and + * potential future output via procfs, let's get it right. + */ + if (RayDAT == hdspm->io_type || AIO == hdspm->io_type) + hdspm->period_bytes = 128; + } }
@@ -1303,12 +1320,27 @@ static int hdspm_set_interrupt_interval(struct hdspm *s, unsigned int frames)
spin_lock_irq(&s->lock);
- frames >>= 7; - n = 0; - while (frames) { - n++; - frames >>= 1; + if (32 == frames) { + /* Special case for new RME cards like RayDAT/AIO which + * support period sizes of 32 samples. Since latency is + * encoded in the three bits of HDSP_LatencyMask, we can only + * have values from 0 .. 7. While 0 still means 64 samples and + * 6 represents 4096 samples on all cards, 7 represents 8192 + * on older cards and 32 samples on new cards. + * + * In other words, period size in samples is calculated by + * 2^(n+6) with n ranging from 0 .. 7. + */ + n = 7; + } else { + frames >>= 7; + n = 0; + while (frames) { + n++; + frames >>= 1; + } } + s->control_register &= ~HDSPM_LatencyMask; s->control_register |= hdspm_encode_latency(n);
At Fri, 12 Aug 2011 21:57:49 +0200, Adrian Knoth wrote:
Newer RME cards like RayDAT and AIO support 32 samples per period. This value is encoded as {1,1,1} in the HDSP_LatencyMask bits in the control register.
Since {1,1,1} is also the representation for 8192 samples/period on older RME cards, we have to special case 32 samples and 32768 bytes according to the actual card.
IMO, it'd be better to change hdspm_decode_latency() instead. Otherwise similar corrections are needed in proc read functions.
thanks,
Takashi
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 159133a..1ed4ba6 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1245,6 +1245,23 @@ static int hdspm_external_sample_rate(struct hdspm *hdspm) static inline void hdspm_compute_period_size(struct hdspm *hdspm) { hdspm->period_bytes = 1 << ((hdspm_decode_latency(hdspm->control_register) + 8));
- if (32768 == hdspm->period_bytes) {
/* Special case for new RME cards with 32 samples period size.
* The three latency bits in the control register
* (HDSP_LatencyMask) encode latency values of 64 samples as
* 0, 128 samples as 1 ... 4096 samples as 6. For old cards, 7
* denotes 8192 samples, but on new cards like RayDAT or AIO,
* it corresponds to 32 samples. Multiplied by 4 bytes equals
* 128 bytes.
*
* Note that hdspm->period_bytes isn't used for anything
* useful on new cards (it's used on old cards in
* hdspm_hw_pointer), but for the sake of correctness and
* potential future output via procfs, let's get it right.
*/
if (RayDAT == hdspm->io_type || AIO == hdspm->io_type)
hdspm->period_bytes = 128;
- }
}
@@ -1303,12 +1320,27 @@ static int hdspm_set_interrupt_interval(struct hdspm *s, unsigned int frames)
spin_lock_irq(&s->lock);
- frames >>= 7;
- n = 0;
- while (frames) {
n++;
frames >>= 1;
- if (32 == frames) {
/* Special case for new RME cards like RayDAT/AIO which
* support period sizes of 32 samples. Since latency is
* encoded in the three bits of HDSP_LatencyMask, we can only
* have values from 0 .. 7. While 0 still means 64 samples and
* 6 represents 4096 samples on all cards, 7 represents 8192
* on older cards and 32 samples on new cards.
*
* In other words, period size in samples is calculated by
* 2^(n+6) with n ranging from 0 .. 7.
*/
n = 7;
- } else {
frames >>= 7;
n = 0;
while (frames) {
n++;
frames >>= 1;
}}
- s->control_register &= ~HDSPM_LatencyMask; s->control_register |= hdspm_encode_latency(n);
-- 1.7.5.4
On Sun, Aug 14, 2011 at 06:04:55PM +0200, Takashi Iwai wrote:
Newer RME cards like RayDAT and AIO support 32 samples per period. This value is encoded as {1,1,1} in the HDSP_LatencyMask bits in the control register.
Since {1,1,1} is also the representation for 8192 samples/period on older RME cards, we have to special case 32 samples and 32768 bytes according to the actual card.
IMO, it'd be better to change hdspm_decode_latency() instead. Otherwise similar corrections are needed in proc read functions.
Though decode_latency() is only used for MADI cards in proc_read_madi and hence needs no further modification, I agree to make the driver a little bit more DRY.
New patch series coming in a second.
Cheers
Hi!
Here is a series of patches that enable period sizes of 32 samples on RME RayDAT and AIO cards. It also adds 8192 samples per period for MADI and AES cards, this mode was present in the original driver but got lost during the merge.
Cheers
Changes from the previous version: - use hdspm_get_latency() to make the code more DRY
Adrian Knoth (5): ALSA: hdspm - Allow for 8192 period size on RME MADI and AES cards ALSA: hdspm - Set period_bytes_min to 32 * 4 for new RME cards ALSA: hdspm - Reorder period sizes according to their bit representation ALSA: hdspm - Introduce hdspm_get_latency() to harmonize latency calculation ALSA: hdspm - Enable 32 samples/period on RME RayDAT/AIO
sound/pci/rme9652/hdspm.c | 61 ++++++++++++++++++++++++++++++++++---------- 1 files changed, 47 insertions(+), 14 deletions(-)
Older RME cards like MADI and AES support period sizes of 8192 samples. The original hdspm driver already featured this value, apparently, it was lost during the rewrite.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 493e394..204e1ce 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -5673,7 +5673,7 @@ static int snd_hdspm_prepare(struct snd_pcm_substream *substream) }
static unsigned int period_sizes_old[] = { - 64, 128, 256, 512, 1024, 2048, 4096 + 64, 128, 256, 512, 1024, 2048, 4096, 8192 };
static unsigned int period_sizes_new[] = {
On newer RME cards like RayDAT and AIO, the lower bound is 32 samples per period in contrast to 64 samples as seen on older cards.
We hence lower period_bytes_min to 32 * 4. Four bytes per sample.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 204e1ce..8dc2a89 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -5703,7 +5703,7 @@ static struct snd_pcm_hardware snd_hdspm_playback_subinfo = { .channels_max = HDSPM_MAX_CHANNELS, .buffer_bytes_max = HDSPM_CHANNEL_BUFFER_BYTES * HDSPM_MAX_CHANNELS, - .period_bytes_min = (64 * 4), + .period_bytes_min = (32 * 4), .period_bytes_max = (4096 * 4) * HDSPM_MAX_CHANNELS, .periods_min = 2, .periods_max = 512, @@ -5728,7 +5728,7 @@ static struct snd_pcm_hardware snd_hdspm_capture_subinfo = { .channels_max = HDSPM_MAX_CHANNELS, .buffer_bytes_max = HDSPM_CHANNEL_BUFFER_BYTES * HDSPM_MAX_CHANNELS, - .period_bytes_min = (64 * 4), + .period_bytes_min = (32 * 4), .period_bytes_max = (4096 * 4) * HDSPM_MAX_CHANNELS, .periods_min = 2, .periods_max = 512,
On newer RME cards like RayDAT and AIO, the 8192 samples per period size are no longer supported. Instead, setting all three bits of HDSP_LatencyMask to one ({1,1,1}) now corresponds to 32 samples per period.
To make this more obvious to future developers, let's reorder the array according to their bit representation, starting at 64 ({0,0,0}) up to 4096 ({1,1,0}) and finally 32 ({1,1,1}).
Note that this patch doesn't change semantics.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 8dc2a89..159133a 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -5677,7 +5677,7 @@ static unsigned int period_sizes_old[] = { };
static unsigned int period_sizes_new[] = { - 32, 64, 128, 256, 512, 1024, 2048, 4096 + 64, 128, 256, 512, 1024, 2048, 4096, 32 };
/* RayDAT and AIO always have a buffer of 16384 samples per channel */
Currently, hdspm_decode_latency is called several times, violating the DRY principle. Given that we need to distinguish between old and new cards when decoding the latency bits in the control register, introduce hdspm_get_latency() to provide the required functionality.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 159133a..1a52a1a 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1241,10 +1241,30 @@ static int hdspm_external_sample_rate(struct hdspm *hdspm) return rate; }
+/* return latency in samples per period */ +static int hdspm_get_latency(struct hdspm *hdspm) +{ + int n; + + n = hdspm_decode_latency(hdspm->control_register); + + /* Special case for new RME cards with 32 samples period size. + * The three latency bits in the control register + * (HDSP_LatencyMask) encode latency values of 64 samples as + * 0, 128 samples as 1 ... 4096 samples as 6. For old cards, 7 + * denotes 8192 samples, but on new cards like RayDAT or AIO, + * it corresponds to 32 samples. + */ + if ((7 == n) && (RayDAT == hdspm->io_type || AIO == hdspm->io_type)) + n = -1; + + return 1 << (n + 6); +} + /* Latency function */ static inline void hdspm_compute_period_size(struct hdspm *hdspm) { - hdspm->period_bytes = 1 << ((hdspm_decode_latency(hdspm->control_register) + 8)); + hdspm->period_bytes = 4 * hdspm_get_latency(hdspm); }
@@ -4801,8 +4821,7 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry,
snd_iprintf(buffer, "--- Settings ---\n");
- x = 1 << (6 + hdspm_decode_latency(hdspm->control_register & - HDSPM_LatencyMask)); + x = hdspm_get_latency(hdspm);
snd_iprintf(buffer, "Size (Latency): %d samples (2 periods of %lu bytes)\n", @@ -4965,8 +4984,7 @@ snd_hdspm_proc_read_aes32(struct snd_info_entry * entry,
snd_iprintf(buffer, "--- Settings ---\n");
- x = 1 << (6 + hdspm_decode_latency(hdspm->control_register & - HDSPM_LatencyMask)); + x = hdspm_get_latency(hdspm);
snd_iprintf(buffer, "Size (Latency): %d samples (2 periods of %lu bytes)\n",
Newer RME cards like RayDAT and AIO support 32 samples per period. This value is encoded as {1,1,1} in the HDSP_LatencyMask bits in the control register.
Since {1,1,1} is also the representation for 8192 samples/period on older RME cards, we have to special case 32 samples and 32768 bytes according to the actual card.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 1a52a1a..92ac64c 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1323,12 +1323,27 @@ static int hdspm_set_interrupt_interval(struct hdspm *s, unsigned int frames)
spin_lock_irq(&s->lock);
- frames >>= 7; - n = 0; - while (frames) { - n++; - frames >>= 1; + if (32 == frames) { + /* Special case for new RME cards like RayDAT/AIO which + * support period sizes of 32 samples. Since latency is + * encoded in the three bits of HDSP_LatencyMask, we can only + * have values from 0 .. 7. While 0 still means 64 samples and + * 6 represents 4096 samples on all cards, 7 represents 8192 + * on older cards and 32 samples on new cards. + * + * In other words, period size in samples is calculated by + * 2^(n+6) with n ranging from 0 .. 7. + */ + n = 7; + } else { + frames >>= 7; + n = 0; + while (frames) { + n++; + frames >>= 1; + } } + s->control_register &= ~HDSPM_LatencyMask; s->control_register |= hdspm_encode_latency(n);
At Mon, 15 Aug 2011 00:22:49 +0200, Adrian Knoth wrote:
Hi!
Here is a series of patches that enable period sizes of 32 samples on RME RayDAT and AIO cards. It also adds 8192 samples per period for MADI and AES cards, this mode was present in the original driver but got lost during the merge.
Thanks, applied now.
Meanwhile, I found more cleanups and fixes are possible. Could you check the patches I'll send later?
thanks,
Takashi
Old models can support up to 8192 frames per period.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/hdspm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 92ac64c..c33f4a5 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -5737,7 +5737,7 @@ static struct snd_pcm_hardware snd_hdspm_playback_subinfo = { .buffer_bytes_max = HDSPM_CHANNEL_BUFFER_BYTES * HDSPM_MAX_CHANNELS, .period_bytes_min = (32 * 4), - .period_bytes_max = (4096 * 4) * HDSPM_MAX_CHANNELS, + .period_bytes_max = (8192 * 4) * HDSPM_MAX_CHANNELS, .periods_min = 2, .periods_max = 512, .fifo_size = 0 @@ -5762,7 +5762,7 @@ static struct snd_pcm_hardware snd_hdspm_capture_subinfo = { .buffer_bytes_max = HDSPM_CHANNEL_BUFFER_BYTES * HDSPM_MAX_CHANNELS, .period_bytes_min = (32 * 4), - .period_bytes_max = (4096 * 4) * HDSPM_MAX_CHANNELS, + .period_bytes_max = (8192 * 4) * HDSPM_MAX_CHANNELS, .periods_min = 2, .periods_max = 512, .fifo_size = 0
SNDRV_PCM_RATE_KNOW must be set for allowing non-standard sample rates like 128kHz supported by AES32.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/hdspm.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index c33f4a5..4add485 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6006,6 +6006,7 @@ static int snd_hdspm_playback_open(struct snd_pcm_substream *substream) }
if (AES32 == hdspm->io_type) { + runtime->hw.rates |= SNDRV_PCM_RATE_KNOT; snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hdspm_hw_constraints_aes32_sample_rates); } else { @@ -6076,6 +6077,7 @@ static int snd_hdspm_capture_open(struct snd_pcm_substream *substream) }
if (AES32 == hdspm->io_type) { + runtime->hw.rates |= SNDRV_PCM_RATE_KNOT; snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hdspm_hw_constraints_aes32_sample_rates); } else {
Refactoring the code using snd_pcm_hw_constraint_pow2() helper function.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/hdspm.c | 76 +++++++++++++++------------------------------ 1 files changed, 25 insertions(+), 51 deletions(-)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 4add485..214110d 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -5705,19 +5705,6 @@ static int snd_hdspm_prepare(struct snd_pcm_substream *substream) return 0; }
-static unsigned int period_sizes_old[] = { - 64, 128, 256, 512, 1024, 2048, 4096, 8192 -}; - -static unsigned int period_sizes_new[] = { - 64, 128, 256, 512, 1024, 2048, 4096, 32 -}; - -/* RayDAT and AIO always have a buffer of 16384 samples per channel */ -static unsigned int raydat_aio_buffer_sizes[] = { - 16384 -}; - static struct snd_pcm_hardware snd_hdspm_playback_subinfo = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | @@ -5768,24 +5755,6 @@ static struct snd_pcm_hardware snd_hdspm_capture_subinfo = { .fifo_size = 0 };
-static struct snd_pcm_hw_constraint_list hw_constraints_period_sizes_old = { - .count = ARRAY_SIZE(period_sizes_old), - .list = period_sizes_old, - .mask = 0 -}; - -static struct snd_pcm_hw_constraint_list hw_constraints_period_sizes_new = { - .count = ARRAY_SIZE(period_sizes_new), - .list = period_sizes_new, - .mask = 0 -}; - -static struct snd_pcm_hw_constraint_list hw_constraints_raydat_io_buffer = { - .count = ARRAY_SIZE(raydat_aio_buffer_sizes), - .list = raydat_aio_buffer_sizes, - .mask = 0 -}; - static int snd_hdspm_hw_rule_in_channels_rate(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { @@ -5986,23 +5955,25 @@ static int snd_hdspm_playback_open(struct snd_pcm_substream *substream) spin_unlock_irq(&hdspm->lock);
snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); + snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
switch (hdspm->io_type) { case AIO: case RayDAT: - snd_pcm_hw_constraint_list(runtime, 0, - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - &hw_constraints_period_sizes_new); - snd_pcm_hw_constraint_list(runtime, 0, - SNDRV_PCM_HW_PARAM_BUFFER_SIZE, - &hw_constraints_raydat_io_buffer); - + snd_pcm_hw_constraint_minmax(runtime, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + 32, 4096); + /* RayDAT & AIO have a fixed buffer of 16384 samples per channel */ + snd_pcm_hw_constraint_minmax(runtime, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + 16384, 16384); break;
default: - snd_pcm_hw_constraint_list(runtime, 0, - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - &hw_constraints_period_sizes_old); + snd_pcm_hw_constraint_minmax(runtime, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + 64, 8192); + break; }
if (AES32 == hdspm->io_type) { @@ -6059,21 +6030,24 @@ static int snd_hdspm_capture_open(struct snd_pcm_substream *substream) spin_unlock_irq(&hdspm->lock);
snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); + snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); + switch (hdspm->io_type) { case AIO: case RayDAT: - snd_pcm_hw_constraint_list(runtime, 0, - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - &hw_constraints_period_sizes_new); - snd_pcm_hw_constraint_list(runtime, 0, - SNDRV_PCM_HW_PARAM_BUFFER_SIZE, - &hw_constraints_raydat_io_buffer); - break; + snd_pcm_hw_constraint_minmax(runtime, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + 32, 4096); + snd_pcm_hw_constraint_minmax(runtime, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + 16384, 16384); + break;
default: - snd_pcm_hw_constraint_list(runtime, 0, - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - &hw_constraints_period_sizes_old); + snd_pcm_hw_constraint_minmax(runtime, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + 64, 8192); + break; }
if (AES32 == hdspm->io_type) {
On Mon, Aug 15, 2011 at 11:17:58AM +0200, Takashi Iwai wrote:
Hi!
Here is a series of patches that enable period sizes of 32 samples on RME RayDAT and AIO cards. It also adds 8192 samples per period for MADI and AES cards, this mode was present in the original driver but got lost during the merge.
Thanks, applied now.
Meanwhile, I found more cleanups and fixes are possible. Could you check the patches I'll send later?
All reviewed and runtime tested. Everything's fine.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
Cheers
On 08/15/11 11:42, Adrian Knoth wrote:
Meanwhile, I found more cleanups and fixes are possible. Could you check the patches I'll send later?
All reviewed and runtime tested. Everything's fine.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
This should be
Tested-by: Adrian Knoth adi@drcomp.erfurt.thur.de Reviewed-by: Adrian Knoth adi@drcomp.erfurt.thur.de
(just in case you need this to be public)
Cheers
participants (2)
-
Adrian Knoth
-
Takashi Iwai