[alsa-devel] Backported sbxfi driver (UNTESTED!)
Takashi Iwai
tiwai at suse.de
Thu Oct 23 19:15:26 CEST 2008
At Thu, 23 Oct 2008 19:07:40 +0200,
I wrote:
>
> At Thu, 23 Oct 2008 15:23:24 +0100,
> Jason Harvey wrote:
> >
> > Takashi Iwai wrote:
> > > What is the last kernel message from sbxfi driver?
> > > Usually it prints some messages (as debug=1 as default).
> > >
> > >
> >
> > I applied the patch and when trying "mplayer wn.wav" I consistently get
> > the following message on the console
> >
> > PANIC: double fault, gdt at c13f6000 [255 bytes]
> >
> > nothing else, either reboots instantly or locks up.
> >
> > In case you might find it of use I modprobed at debug=3 and ran dmesg
> > before I ran mplayer. Output attached.
>
> Thanks.
>
> The last entries are:
>
> > SBXFI: Setting TLB buffer page 0x1daff000
> > SBXFI: write(0) 0x13b004 = 0x1daff000
> > SBXFI: write(0) 0x13b000 = 0x0
>
> Hm, this smells like a buffer handling issue.
>
> I updated the sbxfi driver code now, added mutex around the code
> handling TLB pages.
> Please give it a try.
Another patch to try is the one like below (on the top of the latest
code). Any change with this?
thanks,
Takashi
diff --git a/sound/pci/sbxfi/sbxfi.c b/sound/pci/sbxfi/sbxfi.c
index 458294f..cbb56eb 100644
--- a/sound/pci/sbxfi/sbxfi.c
+++ b/sound/pci/sbxfi/sbxfi.c
@@ -603,10 +603,6 @@ static void sbxfi_capture_start(struct sbxfi *chip, struct sbxfi_port *port)
/* slave */
ctrl = ratec;
sbxfi_setup_src(chip, port->src[1], start, loop, 0x80, ctrl);
-#if 0 /* XXX */
- /* Enable SRC input from Audio Ring */
- sbxfi_write(chip, SRC_MASTER_CTL, 0x1);
-#endif
}
static void sbxfi_capture_stop(struct sbxfi *chip, struct sbxfi_port *port)
@@ -620,10 +616,6 @@ static void sbxfi_capture_stop(struct sbxfi *chip, struct sbxfi_port *port)
val = sbxfi_read(chip, SRCCTL(port->src[1]));
val &= ~0x0f;
sbxfi_write(chip, SRCCTL(port->src[1]), val);
-#if 0 /* XXX */
- /* Disable SRC inputs from Audio Ring */
- sbxfi_write(chip, SRC_MASTER_CTL, 0x0);
-#endif
}
/* some sync of reset sequence */
@@ -900,6 +892,8 @@ static void sbxfi_clear_tlb(struct sbxfi *chip, struct sbxfi_port *port)
port->tlb_pages = 0;
port->tlb_index = -1;
if (!chip->used_pages) {
+ /* Disable SRC inputs from Audio Ring */
+ sbxfi_write(chip, SRC_MASTER_CTL, 0x0);
LOG(1, "Disabling TLB buffer\n");
sbxfi_write(chip, TRANS_TLB_PHY_ADDR_LO_0, 0);
sbxfi_write(chip, TRANS_TLB_PHY_ADDR_HI_0, 0);
@@ -938,6 +932,8 @@ static int sbxfi_setup_tlb(struct sbxfi *chip, struct sbxfi_port *port,
sbxfi_write(chip, TRANS_TLB_PHY_ADDR_LO_0, (u32)chip->tlb.addr);
sbxfi_write(chip, TRANS_TLB_PHY_ADDR_HI_0,
upper_32_bits(chip->tlb.addr));
+ /* Enable SRC input from Audio Ring */
+ sbxfi_write(chip, SRC_MASTER_CTL, 0x1);
}
chip->used_pages += pages;
@@ -977,10 +973,6 @@ static struct sbxfi_port *sbxfi_port_alloc(struct sbxfi *chip,
port->src[1] = src + 1;
LOG(1, "Allocate SRC %d\n", src);
spin_lock_irq(&chip->port_lock);
- if (list_empty(&chip->port_list)) {
- /* Enable SRC input from Audio Ring */
- sbxfi_write(chip, SRC_MASTER_CTL, 0x1);
- }
list_add(&port->list, &chip->port_list);
spin_unlock_irq(&chip->port_lock);
return port;
@@ -992,10 +984,6 @@ static void sbxfi_port_free(struct sbxfi *chip, struct sbxfi_port *port)
return;
spin_lock_irq(&chip->port_lock);
list_del(&port->list);
- if (list_empty(&chip->port_list)) {
- /* Disable SRC inputs from Audio Ring */
- sbxfi_write(chip, SRC_MASTER_CTL, 0x0);
- }
spin_unlock_irq(&chip->port_lock);
LOG(1, "Release SRC %d\n", port->src[0]);
bitmap_release_region(chip->src_bitmap, port->src[0], 1);
@@ -1338,7 +1326,6 @@ static int sbxfi_playback_close(struct snd_pcm_substream *substream)
{
struct sbxfi *chip = snd_pcm_substream_chip(substream);
struct sbxfi_port *port = substream->runtime->private_data;
- sbxfi_cleanup_play_mapper(chip, port);
sbxfi_port_free(chip, port);
return 0;
}
@@ -1379,6 +1366,7 @@ static int sbxfi_pcm_hw_params(struct snd_pcm_substream *substream,
unsigned int bytes = params_buffer_bytes(hw_params);
int err;
+ sbxfi_cleanup_play_mapper(chip, port);
sbxfi_clear_tlb(chip, port);
err = snd_pcm_lib_malloc_pages(substream, bytes);
if (err < 0)
@@ -1396,6 +1384,7 @@ static int sbxfi_pcm_hw_free(struct snd_pcm_substream *substream)
struct sbxfi *chip = snd_pcm_substream_chip(substream);
struct sbxfi_port *port = substream->runtime->private_data;
+ sbxfi_cleanup_play_mapper(chip, port);
sbxfi_clear_tlb(chip, port);
return snd_pcm_lib_free_pages(substream);
}
More information about the Alsa-devel
mailing list