1/2 ALSA: ca0106 support 44100Hz playback to spdif
PATCH 1/1 1/2 ALSA: ca0106 support 44100Hz playback to spdif
Quoted 1 line
From
241939bdf80de14e204d6fcb43d850d33bdeda20Mon Sep 17 00:00:00 2001
From: Ben Stanley <[email protected]>
Date: Tue, 16 Dec 2008 23:47:36 +1100
Subject: [PATCH] ALSA: ca0106 support 44100Hz playback to spdif
This patch provides support for playback of 44100Hz sampled material in 16 and 32 bit sample depths through the digital spdif/iec958 connection/s available on the ca0106 card.
I have re-worked the patch to address comments from a previous review by Takashi [1]. In particular, I have incorporated spin-locking to address a race condition that Takashi was concerned about.
This code has been running on my MythTV box for the last fortnight without apparent ills. I have re-based the code a bit for submission.
This patch is against alsa-kmirror.
[1] http://article.gmane.org/gmane.linux.alsa.devel/55825/match=takashi+ca0106+44100+spdif
--- pci/ca0106/ca0106.h | 13 ++- pci/ca0106/ca0106_main.c | 402 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 351 insertions(+), 64 deletions(-)
pci/ca0106/ca0106.h +12 -1
@@ -1,7 +1,7 @@/* * Copyright (c) 2004 James Courtier-Dutton <[email protected]> * Driver CA0106 chips. e.g. Sound Blaster Audigy LS and Live 24bit -* Version: 0.0.22 +* Version: 0.0.23 * * FEATURES currently supported: * See ca0106_main.c for features.
@@ -49,6 +49,8 @@* Implement support for Line-in capture on SB Live 24bit. * 0.0.22 * Add support for mute control on SB Live 24bit (cards w/ SPI DAC) +* 0.0.23 +* Add support for playback sampling rate and format constraints. * * * This code was initally based on code from ALSA's emu10k1x.c which is:
@@ -644,6 +646,8 @@#include "ca_midi.h" +#define DRVNAME "snd-ca0106" +struct snd_ca0106 ;struct snd_ca0106_channel {
@@ -659,6 +663,7 @@ struct snd_ca0106_pcm {struct snd_pcm_substream *substream;int channel_id;unsigned short running; +unsigned short hw_reserved; };struct snd_ca0106_details {
@@ -688,6 +693,7 @@ struct snd_ca0106 {unsigned short model;/* subsystem id */ spinlock_t emu_lock; +spinlock_t pcm_lock;struct snd_ac97 *ac97;struct snd_pcm *pcm;
@@ -707,6 +713,11 @@ struct snd_ca0106 {struct snd_ca_midi midi2;u16 spi_dac_reg[16 ]; + +unsigned char count_pb_44100_chan; +unsigned char count_pb_non_44100_chan; +unsigned char count_pb_S16_chan; +unsigned char count_pb_S32_chan; };int snd_ca0106_mixer (struct snd_ca0106 *emu);
pci/ca0106/ca0106_main.c +339 -63
572 lines not on this page · raw message
Signature · 1 line
1.5.4.3
PATCH 1/1 2/2 ALSA: ca0106 support 44100Hz playback to spdif
Quoted 1 line
From
a4ddd52a7031cce64beee1e428e16ddd1b1b8084Mon Sep 17 00:00:00 2001
From: Ben Stanley <[email protected]>
Date: Wed, 17 Dec 2008 00:40:05 +1100
Subject: [PATCH] ALSA: ca0106 support 44100Hz playback to spdif
This is the patch to the alsa-driver tree to support the 44100Hz spdif playback. Its really just a code cleanup, and is independent of the other functionality.
--- pci/ca0106/ca0106_main.patch | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
pci/ca0106/ca0106_main.patch +4 -4
@@ -14,12 +14,12 @@ static struct snd_ca0106_details ca0106_chip_details[] = { /* Sound Blaster X-Fi Extreme Audio. This does not have an AC97. 53SB079000000 */ -@@ -1352,7 +1353,7 @@ +@@ -1542,7 +1543,7 @@ pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); #if 1 - printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", chip->model, -- pci->revision, chip->serial); -+ snd_pci_revision(pci), chip->serial); + printk(KERN_INFO DRVNAME ": Model %04x Rev %08x Serial %08x\n", +- chip->model, pci->revision, chip->serial); ++ chip->model, snd_pci_revision(pci), chip->serial); #endif strcpy(card->driver, "CA0106"); strcpy(card->shortname, "CA0106");
Signature · 1 line
1.5.4.3
At Wed, 17 Dec 2008 01:37:07 +1100,
Quoted 10 lines · Ben Stanley
Quoted 2 lines
From
241939bdf80de14e204d6fcb43d850d33bdeda20Mon Sep 17 00:00:00 2001From: Ben Stanley <[email protected]>
Date: Tue, 16 Dec 2008 23:47:36 +1100
Subject: [PATCH] ALSA: ca0106 support 44100Hz playback to spdifThis patch provides support for playback of 44100Hz sampled material in 16 and 32 bit sample depths through the digital spdif/iec958 connection/s available on the ca0106 card.
Quoted 8 lines
I have re-worked the patch to address comments from a previous review by Takashi [1]. In particular, I have incorporated spin-locking to address a race condition that Takashi was concerned about.
This code has been running on my MythTV box for the last fortnight without apparent ills. I have re-based the code a bit for submission.
This patch is against alsa-kmirror.
Could you rebase against sound git tree? There have been changes wrt ca0106 recently there, and your patch conflicts.
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git
The corresponding alsa-driver build stub is found in
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/alsa-driver-build.git
Quoted 4 lines
pci/ca0106/ca0106_main.c +0
-0
(snip)
pci/ca0106/ca0106_main.c static struct snd_pcm_hardware snd_ca0106_capture_hw = { · line 401
Quoted 2 lines
pci/ca0106/ca0106_main.c +2
-0+void snd_ca0106_rebuild_playback_channel_counters (struct snd_ca0106 *chip, +int skip_channel)
Missing static.
pci/ca0106/ca0106_main.c static void snd_ca0106_intr_disable(struct snd_ca0106 *emu, unsigned int intrenb · line 582
Quoted 11 lines
pci/ca0106/ca0106_main.c +7
-0@@ -463,7 +573,20 @@ static void snd_ca0106_intr_disable(struct snd_ca0106 *emu, unsigned int intrenbstatic void snd_ca0106_pcm_free_substream (struct snd_pcm_runtime *runtime) { +struct snd_ca0106_pcm *epcm = runtime->private_data; +struct snd_ca0106 *chip = epcm->emu; +/* FIXME how to tell which case to use? */ +/* struct snd_ca0106_channel *channel = +&(chip->playback_channels[epcm->channel_id]); */ +/* struct snd_ca0106_channel *channel = +&(chip->capture_channels[epcm->channel_id]); */
You can check substream->stream.
pci/ca0106/ca0106_main.c static struct snd_pcm_hardware snd_ca0106_capture_hw = { · line 340
Quoted 3 lines
pci/ca0106/ca0106_main.c +3
-0+unsigned long flags; + +spin_lock_irqsave (&chip->pcm_lock, flags);
This function is always non-atomic and safe to call without saving/restoring flags (i.e. spin_lock_irq() and spin_unlock_irq()) But, as far as I see, all places you use the lock are non-atomic. That is, it'd be better to use a mutex instead of a spinlock.
thanks,
Takashi