All of lore.kernel.org
 help / color / mirror / Atom feed
* re: CS4281 fixes (2nd try) (fwd)
@ 2002-08-19 16:50 Kai Vehmanen
  2002-08-20  9:44 ` Takashi Iwai
  2002-08-22 10:21 ` CS4281 fixes (2nd try) tomasz motylewski
  0 siblings, 2 replies; 7+ messages in thread
From: Kai Vehmanen @ 2002-08-19 16:50 UTC (permalink / raw)
  To: alsa-devel

After doing a cvs update and recompiling and reinstalling the driver
package, snd-cs4281 now freezes my ibm-x20 laptop (rh7x, kernel 2.4.16,
today's ALSA-CVS). 0.9.0rc1 works fine. Anyone with similar experience? I
didn't get any debug info as the system freezes up completely and I don't
have time to debug it more now, but I'm willing to try out changes if need
be. This regression might be related to the below recent patch set.

And another cs4281 mystery: with 0.9.0rc1 the record wakeup is constantly
late. Even though I've set avail_min to x frames, upon wake-up there's
continuously more than y*x frames available (ie. not just a few samples).
This is not a scheduling issue as the playback direction works fine (if
not counting system load spikes, there's always ~avail_min of data
available).

-----Original Message-----
From: ext Sander van Leeuwen [mailto:sandervl@xs4all.nl]
Sent: 08 August, 2002 13:38
To: alsa-devel@lists.sourceforge.net
Subject: [Alsa-devel] PATCH: CS4281 fixes (2nd try)


Changelog:
- Added suspend/resume support; works fine for wave; FM sounds strange
   after a resume if you previously used it. Not sure why.
- Increased loop delays during init to prevent detection failures
- Move card init code to seperate procedure since resume needs it too
- Fixed snd_cs4281_pointer; returned wrong position resulting in
  many clicks during wave playback and recording
- Leave wave playback FIFO enabled or else FM will not be audible
  (unless wave playback is active)
- Added mixer control for FM volume
- Added SNDRV_PCM_IOCTL1_SETVOLUME/SNDRV_PCM_IOCTL1_GETVOLUME
  to control the volume of wave streams
  (AC97 PCM affects both FM & wave; see crystal docs)
  Use it if you wish. I've added a similar ioctl to the ported SB Live driver to control
  the volume of each individual wave stream. (since I found no other way to do that)
  (some header updates are missing; if you want them, let me know)

The attached source file isn't up to date with the latest CVS. All my changes are marked by
#ifdef TARGET_OS2.





-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: CS4281 fixes (2nd try) (fwd)
  2002-08-19 16:50 CS4281 fixes (2nd try) (fwd) Kai Vehmanen
@ 2002-08-20  9:44 ` Takashi Iwai
  2002-08-20 11:39   ` Kai Vehmanen
  2002-08-22 10:21 ` CS4281 fixes (2nd try) tomasz motylewski
  1 sibling, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2002-08-20  9:44 UTC (permalink / raw)
  To: Kai Vehmanen; +Cc: alsa-devel

Hi,

At Mon, 19 Aug 2002 19:50:14 +0300 (EEST),
Kai Vehmanen wrote:
> 
> After doing a cvs update and recompiling and reinstalling the driver
> package, snd-cs4281 now freezes my ibm-x20 laptop (rh7x, kernel 2.4.16,
> today's ALSA-CVS). 0.9.0rc1 works fine. Anyone with similar experience? I
> didn't get any debug info as the system freezes up completely and I don't
> have time to debug it more now, but I'm willing to try out changes if need
> be. This regression might be related to the below recent patch set.

Jaroslav already fixed this on cvs (hopefully :)
please give a try.

> 
> And another cs4281 mystery: with 0.9.0rc1 the record wakeup is constantly
> late. Even though I've set avail_min to x frames, upon wake-up there's
> continuously more than y*x frames available (ie. not just a few samples).
> This is not a scheduling issue as the playback direction works fine (if
> not counting system load spikes, there's always ~avail_min of data
> available).

this issue is not investigated yet.  i'll get a card and take a look
later, too.


ciao,

Takashi


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: CS4281 fixes (2nd try) (fwd)
  2002-08-20  9:44 ` Takashi Iwai
@ 2002-08-20 11:39   ` Kai Vehmanen
  2002-08-20 12:43     ` CS4281 fixes (2nd try) Kai Vehmanen
  2002-08-20 17:21     ` CS4281 fixes (2nd try) (fwd) Takashi Iwai
  0 siblings, 2 replies; 7+ messages in thread
From: Kai Vehmanen @ 2002-08-20 11:39 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On Tue, 20 Aug 2002, Takashi Iwai wrote:

> Kai Vehmanen wrote:
>> After doing a cvs update and recompiling and reinstalling the driver
>> package, snd-cs4281 now freezes my ibm-x20 laptop (rh7x, kernel 2.4.16,
>> today's ALSA-CVS). 0.9.0rc1 works fine. Anyone with similar experience? I
> Jaroslav already fixed this on cvs (hopefully :)
> please give a try.

Yup, works fine now (tested two laptops; one x20 and one x21)! Thanks!

>> And another cs4281 mystery: with 0.9.0rc1 the record wakeup is constantly
>> late. Even though I've set avail_min to x frames, upon wake-up there's
>> continuously more than y*x frames available (ie. not just a few samples).
> this issue is not investigated yet.  i'll get a card and take a look
> later, too.

Hmm, the very latest CVS-tree seems to work differently (rc1 -> rc3). Now
that post-rc3 snd-cs4281 works with my laptops, I'll try to reproduce the
problem.

BTW; The cs4281 compilation problem I reported earlier is definitely
     a compiler issue. On two different laptops (x20&x21 thinkpads),
     compiling with the RH72 gcc 2.96 produces a snd-cs4281.o that fails 
     to recognize the soundchip. By adding one "(volatile*)" (that shouldn't 
     have any effect), driver works on all laptops. This happens with
     current CVS and all 0.9.x release candidates. So beware 
     of that gcc version.

--
 http://www.eca.cx
 Audio software for Linux!




-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: CS4281 fixes (2nd try)
  2002-08-20 11:39   ` Kai Vehmanen
@ 2002-08-20 12:43     ` Kai Vehmanen
  2002-08-20 17:21     ` CS4281 fixes (2nd try) (fwd) Takashi Iwai
  1 sibling, 0 replies; 7+ messages in thread
From: Kai Vehmanen @ 2002-08-20 12:43 UTC (permalink / raw)
  To: Kai Vehmanen; +Cc: alsa-devel

On Tue, 20 Aug 2002, Kai Vehmanen wrote:

> BTW; The cs4281 compilation problem I reported earlier is definitely
>      a compiler issue. On two different laptops (x20&x21 thinkpads),
>      compiling with the RH72 gcc 2.96 produces a snd-cs4281.o that fails 
>      to recognize the soundchip. By adding one "(volatile*)" (that shouldn't 
>      have any effect), driver works on all laptops. This happens with
>      current CVS and all 0.9.x release candidates. So beware 
>      of that gcc version.

Same happens with gcc 2.96-110 that comes with RH73.

--
 http://www.eca.cx
 Audio software for Linux!



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: CS4281 fixes (2nd try) (fwd)
  2002-08-20 11:39   ` Kai Vehmanen
  2002-08-20 12:43     ` CS4281 fixes (2nd try) Kai Vehmanen
@ 2002-08-20 17:21     ` Takashi Iwai
  1 sibling, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2002-08-20 17:21 UTC (permalink / raw)
  To: Kai Vehmanen; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

At Tue, 20 Aug 2002 14:39:13 +0300 (EEST),
Kai Vehmanen wrote:
> 
> >> And another cs4281 mystery: with 0.9.0rc1 the record wakeup is constantly
> >> late. Even though I've set avail_min to x frames, upon wake-up there's
> >> continuously more than y*x frames available (ie. not just a few samples).
> > this issue is not investigated yet.  i'll get a card and take a look
> > later, too.
> 
> Hmm, the very latest CVS-tree seems to work differently (rc1 -> rc3). Now
> that post-rc3 snd-cs4281 works with my laptops, I'll try to reproduce the
> problem.
 
ok.

> BTW; The cs4281 compilation problem I reported earlier is definitely
>      a compiler issue. On two different laptops (x20&x21 thinkpads),
>      compiling with the RH72 gcc 2.96 produces a snd-cs4281.o that fails 
>      to recognize the soundchip. By adding one "(volatile*)" (that shouldn't 
>      have any effect), driver works on all laptops. This happens with
>      current CVS and all 0.9.x release candidates. So beware 
>      of that gcc version.

the attached patch works for you?


Takashi

[-- Attachment #2: cs4281-gcc-fix.dif --]
[-- Type: application/octet-stream, Size: 1798 bytes --]

Index: alsa-kernel/pci/cs4281.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/cs4281.c,v
retrieving revision 1.26
diff -u -r1.26 cs4281.c
--- alsa-kernel/pci/cs4281.c	20 Aug 2002 09:05:36 -0000	1.26
+++ alsa-kernel/pci/cs4281.c	20 Aug 2002 17:18:30 -0000
@@ -629,6 +629,7 @@
 	cs4281_t *chip = snd_magic_cast(cs4281_t, ac97->private_data, return -ENXIO);
 	int count;
 	unsigned short result;
+	int ac97_num = ((volatile ac97_t *)ac97)->num; // FIXME: some gcc handles wrongly the pointer...
 
 	/*
 	 *  1. Write ACCAD = Command Address Register = 46Ch for AC97 register address
@@ -639,7 +640,7 @@
 	 *  6. Read ACSTS = Status Register = 464h, check VSTS bit
 	 */
 
-	snd_cs4281_peekBA0(chip, ac97->num ? BA0_ACSDA2 : BA0_ACSDA);
+	snd_cs4281_peekBA0(chip, ac97_num ? BA0_ACSDA2 : BA0_ACSDA);
 
 	/*
 	 *  Setup the AC97 control registers on the CS461x to send the
@@ -658,7 +659,7 @@
 	snd_cs4281_pokeBA0(chip, BA0_ACCDA, 0);
 	snd_cs4281_pokeBA0(chip, BA0_ACCTL, BA0_ACCTL_DCV | BA0_ACCTL_CRW |
 					    BA0_ACCTL_VFRM | BA0_ACCTL_ESYN |
-			   (ac97->num ? BA0_ACCTL_TC : 0));
+			   (ac97_num ? BA0_ACCTL_TC : 0));
 
 
 	/*
@@ -691,7 +692,7 @@
 		 *  ACSTS = Status Register = 464h
 		 *  VSTS - Valid Status
 		 */
-		if (snd_cs4281_peekBA0(chip, ac97->num ? BA0_ACSTS2 : BA0_ACSTS) & BA0_ACSTS_VSTS)
+		if (snd_cs4281_peekBA0(chip, ac97_num ? BA0_ACSTS2 : BA0_ACSTS) & BA0_ACSTS_VSTS)
 			goto __ok2;
 		udelay(10);
 	}
@@ -705,7 +706,7 @@
 	 *  Read the data returned from the AC97 register.
 	 *  ACSDA = Status Data Register = 474h
 	 */
-	result = snd_cs4281_peekBA0(chip, ac97->num ? BA0_ACSDA2 : BA0_ACSDA);
+	result = snd_cs4281_peekBA0(chip, ac97_num ? BA0_ACSDA2 : BA0_ACSDA);
 
       __end:
 	return result;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: CS4281 fixes (2nd try) (fwd)
       [not found] <4EFAB02CD1631648856752B7E482C9A312CA45@esebe003.ntc.nokia.com>
@ 2002-08-21 12:01 ` Kai Vehmanen
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Vehmanen @ 2002-08-21 12:01 UTC (permalink / raw)
  To: alsa-devel

Takashi Iwai wrote:

>> BTW; The cs4281 compilation problem I reported earlier is definitely
>>      a compiler issue. On two different laptops (x20&x21 thinkpads),
>>      compiling with the RH72 gcc 2.96 produces a snd-cs4281.o that fails 
>>      to recognize the soundchip. By adding one "(volatile*)" (that shouldn't 
> the attached patch works for you?

Unfortunately no. To make it work, I needed to add another volatile 
keyword:

-	int ac97_num = ((volatile ac97_t *)ac97)->num;
+	volatile int ac97_num = ((volatile ac97_t *)ac97)->num;

Diff between the resulting assembly files (with gcc-2.96-100) is nearly
200 lines! Removing the second 'volatile' removes just one "movzwl %ax,
%eax" operation from the assembly output, and the driver still works. Ugh,
luckily redhat still ships kgcc (egcs-1.1.2) with RH7.3. I strongly
recommend using it to compile alsa-driver/alsa-kernel.

PS Compiling with -O instead of -O2 also produces a working driver
   with the rh73 gcc.

--
 http://www.eca.cx
 Audio software for Linux!



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390

^ permalink raw reply	[flat|nested] 7+ messages in thread

* re: CS4281 fixes (2nd try)
  2002-08-19 16:50 CS4281 fixes (2nd try) (fwd) Kai Vehmanen
  2002-08-20  9:44 ` Takashi Iwai
@ 2002-08-22 10:21 ` tomasz motylewski
  1 sibling, 0 replies; 7+ messages in thread
From: tomasz motylewski @ 2002-08-22 10:21 UTC (permalink / raw)
  To: Kai Vehmanen, Sander van Leeuwen; +Cc: alsa-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1975 bytes --]


Kai Vehmanen <kai.vehmanen@wakkanet.fi>:
> And another cs4281 mystery: with 0.9.0rc1 the record wakeup is constantly
> late. Even though I've set avail_min to x frames, upon wake-up there's
> continuously more than y*x frames available (ie. not just a few samples).
> This is not a scheduling issue as the playback direction works fine (if
> not counting system load spikes, there's always ~avail_min of data
> available).

It will only wake up on the period border AFAIK. And you can have maximum 2
periods per buffer...

I have cs4281.c (forked about revision 1.20) supporting any number of periods
(ported alsa-5 code from Pekka Pessi). It also allows to actually get sound
from the secondary codec (but still within single stereo stream) so one can
for example get 2 left channels input and 2 right output or so.
I have attached it as cs4281.c-tom6.gz. 

I understand that mangle_channels code is very specialized, but the interrupt
handler allowing more periods would be of benefit to all. I would be grateful
if someone could audit and take over this part of the code. Or please advice me
what should I do to make it easier to digest.

> From: ext Sander van Leeuwen [mailto:sandervl@xs4all.nl]
> Sent: 08 August, 2002 13:38

I have a feeling that a lot  of your changes are already in ALSA CVS
(especially 1.22-1.23 diff).

> - Increased loop delays during init to prevent detection failures

That one is really important. I often need to load the current driver 2 times
to avoid timeouts.

> The attached source file isn't up to date with the latest CVS. All my changes are marked by
> #ifdef TARGET_OS2.

#ifdef TARGET_OS2
        end_time = (jiffies + 1000) + 1;

Well, you mean jiffies + 10*HZ, don't you ? Please do not make assumptions
about HZ, I am running it at 2000 Hz.

Best regards,
--
Tomasz Motylewski

P.S. To Takashi and Jaroslav: am I on your kill-list or so? I have received no
comments about reported problems with alsa-lib (snd_pcm_mmap_*_avail).

[-- Attachment #2: Type: APPLICATION/OCTET-STREAM, Size: 15759 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-08-22 10:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-19 16:50 CS4281 fixes (2nd try) (fwd) Kai Vehmanen
2002-08-20  9:44 ` Takashi Iwai
2002-08-20 11:39   ` Kai Vehmanen
2002-08-20 12:43     ` CS4281 fixes (2nd try) Kai Vehmanen
2002-08-20 17:21     ` CS4281 fixes (2nd try) (fwd) Takashi Iwai
2002-08-22 10:21 ` CS4281 fixes (2nd try) tomasz motylewski
     [not found] <4EFAB02CD1631648856752B7E482C9A312CA45@esebe003.ntc.nokia.com>
2002-08-21 12:01 ` CS4281 fixes (2nd try) (fwd) Kai Vehmanen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.