public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael <public@dgmo.org>
To: "Delio Brignoli" <nordkyn@tin.it>
Cc: linux-kernel@vger.kernel.org
Subject: Re: i810 audio problem
Date: 19 Jun 2001 11:27:08 +1000	[thread overview]
Message-ID: <m1wv6945ub.fsf@mo.optusnet.com.au> (raw)
In-Reply-To: <20010618141715.A534@argo.tin.it>
In-Reply-To: "Delio Brignoli"'s message of "Mon, 18 Jun 2001 14:17:15 +0200"

"Delio Brignoli" <nordkyn@tin.it> writes:
> Switching from 2.4.2 to 2.4.5 breaks i810_audio on my intel MX440 based notebook:
> 
> After some (in fact a few) seconds of playback it gets stuck until the app closes and reopens /dev/dsp. (I do NOT use esd)
[..] 
> It goes on until I kill the app, then it says:
> 
> Jun 18 13:59:42 argo kernel: i810_audio: drain_dac, dma timeout?
> 
> Any idea(s), suggestions ...

What a co-incidence. I just hit this problem a few days ago.

The problem here is that:
1.	the dma buffer drains to zero.
2.	interrupt handler set LVI to CIV.
3.	app write more than a buffer size of data to dma buffer.
4.	LVI is un-changed!

There's a kludgey work-around I used, (never use more than
31 segments of the DMA buffer). (I.e. never use the last
dmabuf->fragsize of the dma buffer). This cures the hang
but it isn't an optimal solutions.

--- i810_audio.c.old	Tue Jun 19 11:22:56 2001
+++ i810_audio.c	Tue Jun 19 11:24:02 2001
@@ -1194,6 +1194,10 @@
		cnt = dmabuf->dmasize - swptr;
		if(cnt > (dmabuf->dmasize - dmabuf->count))
			cnt = dmabuf->dmasize - dmabuf->count;
+	
+		if (cnt >= dmabuf->fragsize && (dmabuf->count + cnt) >= dmabuf->dmasize)
+			cnt -= dmabuf->fragsize; 
+	
		spin_unlock_irqrestore(&state->card->lock, flags);

		if (cnt > count)


A better fix _may_ be to set CIV to LVI instead of the other way
around. (This assumes CIV is writeable). No testing at all;
may not be a fix. 

Something like:

diff -u i810_audio.c.old i810_audio.c
--- i810_audio.c.old	Tue Jun 19 11:22:56 2001
+++ i810_audio.c	Tue Jun 19 11:26:14 2001
@@ -807,11 +807,11 @@
	 * means no data on read, handle appropriately
	 */
	if(!rec && dmabuf->count == 0) {
-		outb(inb(port+OFF_CIV),port+OFF_LVI);
+		outb(inb(port+OFF_LVI),port+OFF_CIV);
		return;
	}
	if(rec && dmabuf->count == dmabuf->dmasize) {
-		outb(inb(port+OFF_CIV),port+OFF_LVI);
+		outb(inb(port+OFF_LVI),port+OFF_CIV);
		return;
	}
	/* swptr - 1 is the tail of our transfer */

but with testing and a glance at the docs. :)


Michael.




  reply	other threads:[~2001-06-19  1:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-18 12:17 i810 audio problem Delio Brignoli
2001-06-19  1:27 ` Michael [this message]
2001-06-19  7:57   ` Delio Brignoli
     [not found] <20010619.222014.-149693.3.fdavis112@juno.com>
     [not found] ` <3B300A94.2082D61A@cwo.com.au>
2001-06-20 15:23   ` i810_audio problem Delio Brignoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1wv6945ub.fsf@mo.optusnet.com.au \
    --to=public@dgmo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nordkyn@tin.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox