[alsa-devel] [PATCH] snd-sbxfi: implement support for 192khz playback/capture.
Implements support for 192khz initialization for playback and capture.
Signed-off-by: William Pitcock nenolod@sacredspiral.co.uk --- sound/pci/sbxfi/sbxfi.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/sound/pci/sbxfi/sbxfi.c b/sound/pci/sbxfi/sbxfi.c index 4c65125..d64d462 100644 --- a/sound/pci/sbxfi/sbxfi.c +++ b/sound/pci/sbxfi/sbxfi.c @@ -514,7 +514,7 @@ static void sbxfi_write_amop(struct sbxfi *chip, static void sbxfi_playback_start(struct sbxfi *chip, struct sbxfi_port *port) { unsigned int start, loop; - unsigned int ctrl, ratec; + unsigned int ctrl, ratec = 0; struct snd_pcm_runtime *runtime;
if (port->tlb_index < 0) @@ -523,12 +523,19 @@ static void sbxfi_playback_start(struct sbxfi *chip, struct sbxfi_port *port) start = port->tlb_index * SBXFI_PAGE_SIZE; loop = start + frames_to_bytes(runtime, runtime->buffer_size);
+ /* + * ratec is the rate selection mode, 0x4c = 48000hz, 0x5c = 96000hz, + * 0x6c = 192000hz. + */ switch (runtime->rate) { case 48000: - ratec = 0x4c; /* XXX what meaning? */ + ratec = 0x4c; break; case 96000: - ratec = 0x5c; /* XXX what meaning? */ + ratec = 0x5c; + break; + case 192000: + ratec = 0x6c; break; } ctrl = ratec; @@ -559,7 +566,7 @@ static void sbxfi_playback_stop(struct sbxfi *chip, struct sbxfi_port *port) static void sbxfi_capture_start(struct sbxfi *chip, struct sbxfi_port *port) { unsigned int start, loop; - unsigned int ctrl, ratec; + unsigned int ctrl, ratec = 0; struct snd_pcm_runtime *runtime;
if (port->tlb_index < 0) @@ -575,6 +582,9 @@ static void sbxfi_capture_start(struct sbxfi *chip, struct sbxfi_port *port) case 96000: ratec = 0x5d | SRCCTL_RUN_STATE; break; + case 192000: + ratec = 0x6d | SRCCTL_RUN_STATE; + break; }
ctrl = ratec;
William Pitcock wrote:
Implements support for 192khz initialization for playback and capture.
case 96000: ratec = 0x5d | SRCCTL_RUN_STATE; break;
case 192000:
ratec = 0x6d | SRCCTL_RUN_STATE;
break;
}
ctrl = ratec;
FYI:
ratec writes to the SRC_CTL register.
The SRC_CTL register is a 32bit register with bits 31-0 Bits 2-0: STATE: Sample rate converter state 000 OFF 001 RESERVED 010 TAIL 011 STOPPING 100 INIT 101 RUN 110 INIT_AUTO_LOAD 111 RUN_AUTO_LOAD
Bit 3: BM: Bus Master enable
Bits 5-4: RSR: Reference sample rate 00 48 kHz Uses 1 channel 01 96kHz Uses 2 channels 10 192 kHz Uses 4 channels 11 384kHz Uses 8 channels Note: 44.1kHz is possible, but is more complex because it uses a method whereby the channel ring marks each sample in the channel ring as valid or not, so to get 44.1kHz, some samples are simply tagged invalid. The "channel ring" is not the ring buffer that is used to get sound samples to the card. The "channel ring" is used to pass samples between different processing modules on the card. One of these processing modules is the SRC, another is the INs/OUTs, another is the hardware mixer, and yet another is the DSP.
Bits 8-6: SF: Sample format 000 8-bit unsigned 001 16-bit signed 010 24-bit signed, packed on 3-byte boundaries 011 32-bit signed (can be used for 24-bit unpacked) 100 32-bit float
Bit 9: WR: Write cache to memory. Takes samples only from the ring, and not from the host.
Bit 10: PM: Pitch master of following channel: Used to phase lock neighboring channels together.
Bit 12-11: Pitch ROM select 00 Pitch 0 to 8.0 (very high quality) 01 Pitch 0.26 to 1.72 (extremely high quality) 10 Pitch 1.8375 (88.2 kHz 48 kHz) 11 Pitch 2.0 (96kHz 48 kHz)
Bit 13: VO: Variable output rate, fixed input rate.
Bit 14: Stop on Loop: Stop after last sample in the loop.
Bit 15: IE: Interrupt enable: Interrupt after last sample in the loop.
Bit 19-16: ILSZ: Interleave size: Indicates number of contiguous channels that are part of an interleaved group. Only needs to be tagged in the first channel of the group.
Bit 20: Bypass: Bypass SRC.
Bits 21-31 not used
At Sat, 18 Oct 2008 22:32:21 +0100, James Courtier-Dutton wrote:
William Pitcock wrote:
Implements support for 192khz initialization for playback and capture.
case 96000: ratec = 0x5d | SRCCTL_RUN_STATE; break;
case 192000:
ratec = 0x6d | SRCCTL_RUN_STATE;
break;
}
ctrl = ratec;
FYI:
ratec writes to the SRC_CTL register.
(snip)
That's great information. I added to the header file and fixed sbxfi.c accordingly now.
Thanks!
(BTW, the 192kHz still doesn't work? Supposedly we'd need 4-channel link for that...)
Takashi
At Sat, 18 Oct 2008 13:37:24 -0500, William Pitcock wrote:
Implements support for 192khz initialization for playback and capture.
Signed-off-by: William Pitcock nenolod@sacredspiral.co.uk
Applied now. Thanks.
sound/pci/sbxfi/sbxfi.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/sound/pci/sbxfi/sbxfi.c b/sound/pci/sbxfi/sbxfi.c index 4c65125..d64d462 100644 --- a/sound/pci/sbxfi/sbxfi.c +++ b/sound/pci/sbxfi/sbxfi.c @@ -514,7 +514,7 @@ static void sbxfi_write_amop(struct sbxfi *chip, static void sbxfi_playback_start(struct sbxfi *chip, struct sbxfi_port *port) { unsigned int start, loop;
- unsigned int ctrl, ratec;
unsigned int ctrl, ratec = 0; struct snd_pcm_runtime *runtime;
if (port->tlb_index < 0)
@@ -523,12 +523,19 @@ static void sbxfi_playback_start(struct sbxfi *chip, struct sbxfi_port *port) start = port->tlb_index * SBXFI_PAGE_SIZE; loop = start + frames_to_bytes(runtime, runtime->buffer_size);
- /*
* ratec is the rate selection mode, 0x4c = 48000hz, 0x5c = 96000hz,
* 0x6c = 192000hz.
switch (runtime->rate) { case 48000:*/
ratec = 0x4c; /* XXX what meaning? */
break; case 96000:ratec = 0x4c;
ratec = 0x5c; /* XXX what meaning? */
ratec = 0x5c;
break;
- case 192000:
break; } ctrl = ratec;ratec = 0x6c;
@@ -559,7 +566,7 @@ static void sbxfi_playback_stop(struct sbxfi *chip, struct sbxfi_port *port) static void sbxfi_capture_start(struct sbxfi *chip, struct sbxfi_port *port) { unsigned int start, loop;
- unsigned int ctrl, ratec;
unsigned int ctrl, ratec = 0; struct snd_pcm_runtime *runtime;
if (port->tlb_index < 0)
@@ -575,6 +582,9 @@ static void sbxfi_capture_start(struct sbxfi *chip, struct sbxfi_port *port) case 96000: ratec = 0x5d | SRCCTL_RUN_STATE; break;
case 192000:
ratec = 0x6d | SRCCTL_RUN_STATE;
break;
}
ctrl = ratec;
-- 1.5.5.4
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
participants (3)
-
James Courtier-Dutton
-
Takashi Iwai
-
William Pitcock