fix for sb16 and mmap and dmabuf

Daniel J. Rodriksson (djr@dit.upm.es)
Mon, 30 Nov 1998 16:15:11 +0100


This is a multi-part message in MIME format.
--------------AF6AFE735A10F92F32A8735A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

1. Patch one cures the sb16, quake and mmap sound-glitch

sound-glitch.diff

It seems that the original dma juggling performed in
the sb16 ( and clones ) code was not consistent with
the duplex behaviour expected in dmabuf so at closing
time the dmap structs must be reverted if switching from
8 to 16 bit.

Simply moving the MMAPED flag from dmap_in to dmap_out
or viceversa does not work, but swapping both dmap
structs does.

2. Patch 2 is a fix for what I believe to be a bug in
dmabuf.c

dmabuf-bug.diff

At closing time, DMAbuf_release checks if dmap_in ( ?? ) is
mapped to perform a DMA_sync. I think it should check
dmap_out ( it checks if dmap_out->mode == DMAP_OUTPUT, hence
I think checking for dmap_in mapping is a mistake ).

Enjoy

-- 
---------------------------------------------------------------|
|         Remember Scotch: 'THERE CAN BE ONLY ONE'             |
---------------------------------------------------------------|
| Daniel J. Rodriksson       | B-204.1,ETSI Telecomunicaciones |
| djr@dit.upm.es             | Avda Paraninfo S/N              |
| http://www.dit.upm.es/~djr | 28040 Madrid                    |
| +34-1-3367366 + ext 442    | SPAIN                           |
|--------------------------------------------------------------|
--------------AF6AFE735A10F92F32A8735A
Content-Type: text/plain; charset=us-ascii; name="sound-glitch.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="sound-glitch.diff"

--- linux-2.1.130.orig/drivers/sound/sb_audio.c Sun Nov 8 22:56:10 1998 +++ linux-2.1.130/drivers/sound/sb_audio.c Mon Nov 30 16:03:17 1998 @@ -91,6 +91,14 @@ { sb_devc *devc = audio_devs[dev]->devc; + /* if we did dma juggling put the right dmap in the right place */ + if(devc->duplex && audio_devs[dev]->dmap_out->dma != devc->dma8) + { + struct dma_buffparms *dmap_temp; + dmap_temp = audio_devs[dev]->dmap_out; + audio_devs[dev]->dmap_out = audio_devs[dev]->dmap_in; + audio_devs[dev]->dmap_in = dmap_temp; + } audio_devs[dev]->dmap_out->dma = devc->dma8; audio_devs[dev]->dmap_in->dma = ( devc->duplex ) ? devc->dma16 : devc->dma8;

--------------AF6AFE735A10F92F32A8735A Content-Type: text/plain; charset=us-ascii; name="dmabuf-bug.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="dmabuf-bug.diff"

--- linux-2.1.130.orig/drivers/sound/dmabuf.c Sun Nov 8 22:56:10 1998 +++ linux-2.1.130/drivers/sound/dmabuf.c Mon Nov 30 16:06:17 1998 @@ -474,7 +474,7 @@ adev->dmap_in->closing = 1; if (adev->open_mode & OPEN_WRITE) - if (!(adev->dmap_in->mapping_flags & DMA_MAP_MAPPED)) + if (!(adev->dmap_out->mapping_flags & DMA_MAP_MAPPED)) if (!signal_pending(current) && (adev->dmap_out->dma_mode == DMODE_OUTPUT)) DMAbuf_sync(dev); if (adev->dmap_out->dma_mode == DMODE_OUTPUT)

--------------AF6AFE735A10F92F32A8735A--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/