ALSA: emu10k1: do away with extra voices in E-MU D.A.S. mode
PATCH 1/1 ALSA: emu10k1: do away with extra voices in E-MU D.A.S. mode
Maybe somewhat unsurprisingly, Creative Inc. learned from the period interrupt disaster of the EMU10K1, and equipped Audigy with a way to delay the interrupts by a configurable amount. So make use of that. This allows us to do away with the extra voices for driving interrupts.
The most salient advantage of that is that we can maximize the number of playback channels in 24-bit 192 kHz mode, bringing it up to 8. A minor point is that no bandwidth is wasted on fetching data that is discarded anyway.
The removal of the extra voices has one disadvantage: the hardware is limited to two periods, thus increasing the likelihood of underruns. Therefore, we do this only in D.A.S. mode, which aims at high-quality low-latency multi-channel recording, and therefore can be expected to be operated in an optimal environment. Also, prior to a few commits back, the multi-channel playback was actually limited to two periods anyway (for no good reason).
---
this is obviously meaningless without the d.a.s. series. i'm posting it only so it's on record.
---
This patch needs to be applied on top of the patch titled "ALSA:
emu10k1: add high-rate playback in E-MU D.A.S. mode".
--- include/sound/emu10k1.h | 11 +++++++ sound/pci/emu10k1/emu10k1_main.c | 16 ++++++++++ sound/pci/emu10k1/emupcm.c | 52 +++++++++++++++++++++++--------- sound/pci/emu10k1/irq.c | 8 +++++ 4 files changed, 73 insertions(+), 14 deletions(-)
include/sound/emu10k1.h +11 -0
@@ -838,7 +838,18 @@ SUB_REG(FXIDX, IDX, 0x0000ffff)#define A_SPRA 0x6b/* S/PDIF Host Record Address */ #define A_SPRC 0x6c/* S/PDIF Host Record Control */ +// NOTE: 64-bit +// Voice 0 holds the counter, while voice 1 holds the enable bits. +// Bits in IPR are set according to incoming IRQs as usual. +// When a corresponding bit is set in the delay enable register, +// the counter starts, and the IRQ isn't delivered until timeout. +// Additional delayed IRQs arriving during the countdown do not +// retrigger it, so they will be delayed less or not at all. +// Non-delayed IRQs arriving during the countdown are delivered +// immediately, while the countdown continues. #define A_DICE 0x6d/* Delayed Interrupt Counter & Enable */ +#define A_DICE_DELAY_MASK 0x000003ff/* Interrupt delay minus 1 */ +#define A_DICE_COUNTER_MASK 0x03ff0000/* Counter's current value */ #define A_TTB 0x6e/* Tank Table Base */ #define A_TDOF 0x6f/* Tank Delay Offset */
sound/pci/emu10k1/emu10k1_main.c +16 -0
@@ -159,6 +159,8 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir)/* disable channel interrupt */ CLIEL ,0 ,CLIEH ,0 , +HLIEL ,0 , +HLIEH ,0 ,/* disable stop on loop end */ SOLEL, 0,
@@ -174,6 +176,12 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir) AC97SLOT_REAR_LEFT); } +if (emu->das_mode) { +// Enable delayed period interrupts +snd_emu10k1_ptr_write (emu,A_DICE ,0 ,64 -3 +1 ); +snd_emu10k1_ptr_write (emu,A_DICE ,1 ,IPR_CHANNELLOOP ); + } +/* init envelope engine */ for (ch =0 ; ch <NUM_G ; ch++)snd_emu10k1_voice_init (emu, ch);
@@ -414,6 +422,12 @@ int snd_emu10k1_done(struct snd_emu10k1 *emu)else snd_emu10k1_ptr_write (emu,DBG ,0 ,EMU10K1_DBG_SINGLE_STEP ); +if (emu->das_mode) { +// Disable delayed period interrupts +snd_emu10k1_ptr_write (emu,A_DICE ,0 ,0 ); +snd_emu10k1_ptr_write (emu,A_DICE ,1 ,0 ); + } + snd_emu10k1_ptr_write_multiple(emu, 0, /* reset recording buffers */ MICBS, 0,
@@ -429,6 +443,8 @@ int snd_emu10k1_done(struct snd_emu10k1 *emu)/* disable channel interrupt */ CLIEL ,0 ,CLIEH ,0 , +HLIEL ,0 , +HLIEH ,0 ,SOLEL ,0 , SOLEH, 0,
sound/pci/emu10k1/emupcm.c +38 -14
121 lines not on this page · raw message
sound/pci/emu10k1/irq.c +8 -0
@@ -23,6 +23,14 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id) "Suspected sound card removal\n");break ; } +if ((status &IPR_CHANNELLOOP ) && emu->das_mode && + (snd_emu10k1_ptr_read (emu,A_DICE ,0 ) &A_DICE_COUNTER_MASK )) { +// If another IRQ "punched through" the delay, +// we mask away the delayed IRQ. + status &= ~(IPR_CHANNELLOOP |IPR_CHANNELNUMBERMASK ); +if (!status)// Will usually happen in 2nd iteration +break ; + }if (++timeout ==1000 ) {dev_info (emu->card->dev,"emu10k1 irq routine failure\n" );break ;
base-commit: 3c04ccbdf86e7e93e06e68f1915e39eb55afb0d0
prerequisite-patch-id: 45677e4f73ea654bda3258c1143c8027173e4b5c
prerequisite-patch-id: 358302d653684999fa1d7b7c0b9c643d6daf768d
prerequisite-patch-id: e5ad839d4411bacb9ed5d639a0bf151a3b9dfeb1
prerequisite-patch-id: aa2b589f883089a61a979b76897a60865ab2fd8a
prerequisite-patch-id: 86710b3c986270dcdbabbbbad9f0d86ed634a3ad
prerequisite-patch-id: 7d3ce3deda4c9a317868cc13150b3ece13f0096e
prerequisite-patch-id: 3bd887e1980015ed352cc20eea63b69f3cf8a9c2
Signature · 1 line
2.40.0.152.g15d061e6df