Skip to contentSkip to conversation

hdsp driver

PATCH In review Paul Davis 4 participants 15 messages Feb 27, 2003 – Mar 3, 2003 3 messages not in the archive

lore
Share & tools
lore

Paul Davis

author
#0 lore raw

i haven't had time today to get the patch for the hdsp ready. however, the new source works here (i have some CVS sync issues). i'll get it out to the list on monday (i'm gone for the weekend).

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#1 lore raw

Hi Paul,

At Thu, 27 Feb 2003 13:43:34 -0500,

Quoted 4 lines · Paul Davis

i haven't had time today to get the patch for the hdsp ready. however, the new source works here (i have some CVS sync issues). i'll get it out to the list on monday (i'm gone for the weekend).

could you check the attached patch (to the current cvs version) for rme9652 and hdsp?

it will replace the memory allocation using the new snd-page-alloc module instead of snd-hammerfall-mem.

although the former doesn't allocate the buffer in advance by checking the pci id, but it will preserve the buffers at alsasound stop or restart operations just like the latter does.

Takashi

#12 lore raw
In reply to Paul Davis
Quoted 4 lines · Paul Davis

i haven't had time today to get the patch for the hdsp ready. however, the new source works here (i have some CVS sync issues). i'll get it out to the list on monday (i'm gone for the weekend).

Did you sort out the rms register issue ? I'm currently implementing the metering part of HDSPMixer and the rms values returned are obviously bogus.

Thomas

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#13 lore raw

PATCH 1/1 HDSP rms and peak registers correct offsets (was: Re: hdsp driver)

Quoted 10 lines · Thomas Charbonnel
Quoted 4 lines · Paul Davis

i haven't had time today to get the patch for the hdsp ready. however, the new source works here (i have some CVS sync issues). i'll get it out to the list on monday (i'm gone for the weekend).

Did you sort out the rms register issue ? I'm currently implementing the metering part of HDSPMixer and the rms values returned are obviously bogus.

Thomas

Ok, I sorted it out myself, the offsets for the rms and peak registers were wrong. Sorry Paul, I could have seen this much earlier if I had done more extensive tests: I kept on testing inputs 1 and 2 while the input rms offset pointed on input 3... :-\

The correct offsets can be found in the attached patch.

Thomas

hdsp.c renamed from hdsp.c.orig +2 -2
@@ -123,9 +123,9 @@
 
 #define HDSP_playbackPeakLevel  4096  /* 26 * 32 bit values */
 #define HDSP_inputPeakLevel     4224  /* 26 * 32 bit values */
-#define HDSP_outputPeakLevel    4100  /* 26 * 32 bit values */
+#define HDSP_outputPeakLevel    4096  /* 26 * 32 bit values */
 #define HDSP_playbackRmsLevel   4612  /* 26 * 64 bit values */
-#define HDSP_inputRmsLevel      4884  /* 26 * 64 bit values */
+#define HDSP_inputRmsLevel      4868  /* 26 * 64 bit values */
 
 #define HDSP_IO_EXTENT     5192
 
#14 lore raw

RE: [PATCH] HDSP rms and peak registers correct offsets (was: Re:hdsp driver)

Thomas,
Will this work cover the HDSP 9652 also, or is that different and has to
wait?

Thanks,
Mark

Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Thomas Charbonnel
Sent: Sunday, March 02, 2003 3:43 PM
To: Paul Davis
Cc: alsa-devel
Subject: [PATCH] HDSP rms and peak registers correct offsets (was:
Re:[Alsa-devel] hdsp driver)

Quoted 10 lines · Thomas Charbonnel
Quoted 4 lines · Paul Davis

i haven't had time today to get the patch for the hdsp ready. however, the new source works here (i have some CVS sync issues). i'll get it out to the list on monday (i'm gone for the weekend).

Did you sort out the rms register issue ? I'm currently implementing the metering part of HDSPMixer and the rms values returned are obviously bogus.

Thomas

Quoted 10 lines

Ok, I sorted it out myself, the offsets for the rms and peak registers were wrong. Sorry Paul, I could have seen this much earlier if I had done more extensive tests: I kept on testing inputs 1 and 2 while the input rms offset pointed on input 3... :-\

The correct offsets can be found in the attached patch.

Thomas

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#15 lore raw

RE: [PATCH] HDSP rms and peak registers correct offsets (was: Re:hdsp driver)

Quoted 6 lines · Mark Knecht

Thomas,
Will this work cover the HDSP 9652 also, or is that different and has to
wait?

Thanks,
Mark

No, sorry, I'm afraid you'll have to wait.

Thomas

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#17 lore raw

Re: [PATCH] HDSP rms and peak registers correct offsets (was: Re: hdsp driver)

In reply to Thomas Charbonnel
Quoted 2 lines · Thomas Charbonnel

The correct offsets can be found in the attached patch.

Err... this wasn't the case.
The attached patch replaces the previous one and enhances it with line outs metering.

The line outs peak registers were not accessible with the current driver, so I added code to map them to ctls. The option I took is mapping all the registers, even the unused ones (i.e. from 19 to 26 on the Multiface), as those registers are always present, regardless of the attached box. This approach also avoided ctl index discontinuity. (Due to the way clts map registers, the ctls mapping the line out registers (Output Peak) had to have indexes 27 and 29).
As a side effect this transfers the task of electing relevant registers to user space applications. (In this perspective I think the 9652 shouldn't look as a digiface from user space, as it has no line outs. It should have an entry of its own in HDSP_type).

Paul, the meter section of the HDSPMixer is now functional. It helped me a lot understand how wrong the registers offsets were. I can send you a copy if you think it can help you implementing 9652 support.

Thomas

hdsp.c renamed from hdsp.c.orig +11 -7
@@ -3,6 +3,7 @@
  *
  *      Copyright (c) 2002  Paul Davis
  *                          Marcus Andersson
+ *                          Thomas Charbonnel
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -123,9 +124,9 @@
 
 #define HDSP_playbackPeakLevel  4096  /* 26 * 32 bit values */
 #define HDSP_inputPeakLevel     4224  /* 26 * 32 bit values */
-#define HDSP_outputPeakLevel    4100  /* 26 * 32 bit values */
+#define HDSP_outputPeakLevel    4352  /* 28 * 32 bit values (26 + 2 line outs) */
 #define HDSP_playbackRmsLevel   4612  /* 26 * 64 bit values */
-#define HDSP_inputRmsLevel      4884  /* 26 * 64 bit values */
+#define HDSP_inputRmsLevel      4868  /* 26 * 64 bit values */
 
 #define HDSP_IO_EXTENT     5192
 
@@ -1864,14 +1865,12 @@
 		if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_playback_mixer, hdsp)))) {
 			return err;
 		}
+	}
+	for (idx = 0; idx < HDSP_MAX_CHANNELS; ++idx) {
 		snd_hdsp_input_peak.index = idx+1;
 		if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_input_peak, hdsp)))) {
 			return err;
 		}
-		snd_hdsp_output_peak.index = idx+1;
-		if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_output_peak, hdsp)))) {
-			return err;
-		}
 		snd_hdsp_playback_peak.index = idx+1;
 		if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_playback_peak, hdsp)))) {
 			return err;
@@ -1885,7 +1884,12 @@
 			return err;
 		}
 	}
-
+	for (idx = 0; idx < HDSP_MAX_CHANNELS + 2 ; ++idx) {
+		snd_hdsp_output_peak.index = idx+1;
+		if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_output_peak, hdsp)))) {
+			return err;
+		}
+	}
 	return 0;
 }
 
#16 lore raw

RE: [PATCH] HDSP rms and peak registers correct offsets (was:Re:hdsp driver)

In reply to Thomas Charbonnel

Thomas,
Thanks for the update.
Mark

Quoted 13 lines

-----Original Message-----
From: Thomas Charbonnel [mailto:[email protected]]
Sent: Monday, March 03, 2003 6:40 AM
To: Mark Knecht
Cc: alsa-devel
Subject: RE: [PATCH] HDSP rms and peak registers correct offsets (was:Re:[Alsa-devel] hdsp driver)

Quoted 2 lines · Mark Knecht

Thomas,
Will this work cover the HDSP 9652 also, or is that

different and has to

Quoted 11 lines
Quoted 4 lines

wait?

Thanks,
Mark

No, sorry, I'm afraid you'll have to wait.

Thomas

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

author
#2 lore raw
In reply to Takashi Iwai
Quoted 3 lines

although the former doesn't allocate the buffer in advance by checking the pci id, but it will preserve the buffers at alsasound stop or restart operations just like the latter does.

so when does it allocate them?

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#4 lore raw
In reply to a message not in the archive

At Mon, 03 Mar 2003 11:11:16 -0500,

Quoted 6 lines · Paul Davis
Quoted 4 lines

although the former doesn't allocate the buffer in advance by checking the pci id, but it will preserve the buffers at alsasound stop or restart operations just like the latter does.

so when does it allocate them?

when the allocator function (snd_malloc_xxx) is called from the driver. so, it wouldn't work exactly like snd-hammerfall-mem, which allocates by itself without call from the sound drivers. snd-page-alloc module just "caches" the buffer after the module unload/reload.

but i don't think this would make so big difference, since the sound drivers are loaded likely in the early stage, anyway.

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

author
#5 lore raw
Quoted 9 lines

At Mon, 03 Mar 2003 11:11:16 -0500,

Quoted 6 lines · Paul Davis
Quoted 4 lines

although the former doesn't allocate the buffer in advance by checking the pci id, but it will preserve the buffers at alsasound stop or restart operations just like the latter does.

so when does it allocate them?

Quoted 8 lines

when the allocator function (snd_malloc_xxx) is called from the driver. so, it wouldn't work exactly like snd-hammerfall-mem, which allocates by itself without call from the sound drivers. snd-page-alloc module just "caches" the buffer after the module unload/reload.

but i don't think this would make so big difference, since the sound drivers are loaded likely in the early stage, anyway.

they aren't. that's the whole problem. on my old system (148MB of RAM), allowing fsck to run would prevent memory allocation. i don't know of any distribution that inserts modules that early. do you?

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#7 lore raw
In reply to a message not in the archive

At Mon, 03 Mar 2003 11:37:20 -0500,

Quoted 16 lines · Paul Davis
Quoted 16 lines

At Mon, 03 Mar 2003 11:11:16 -0500,

Quoted 6 lines · Paul Davis
Quoted 4 lines

although the former doesn't allocate the buffer in advance by checking the pci id, but it will preserve the buffers at alsasound stop or restart operations just like the latter does.

so when does it allocate them?

when the allocator function (snd_malloc_xxx) is called from the driver. so, it wouldn't work exactly like snd-hammerfall-mem, which allocates by itself without call from the sound drivers. snd-page-alloc module just "caches" the buffer after the module unload/reload.

Quoted 6 lines
Quoted 2 lines

but i don't think this would make so big difference, since the sound drivers are loaded likely in the early stage, anyway.

they aren't. that's the whole problem. on my old system (148MB of RAM), allowing fsck to run would prevent memory allocation. i don't know of any distribution that inserts modules that early. do you?

aha, but fsck runs even before snd-hammerfall-mem, doesn't it? (unless you bulit it in kernel) otherwise it's dangerous...

now i understood the necessity of the allocation way of snd-hammerfall-mem.
we can merge the feature but it will be likely after 0.9.0, as long as the old style works. i'd like to concentrate on bug fixes now.

ciao,

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

author
#8 lore raw
Quoted 6 lines
Quoted 3 lines

they aren't. that's the whole problem. on my old system (148MB of RAM), allowing fsck to run would prevent memory allocation. i don't know of any distribution that inserts modules that early. do you?

aha, but fsck runs even before snd-hammerfall-mem, doesn't it? (unless you bulit it in kernel) otherwise it's dangerous...

no. absolutely not. i just added something equivalent to this to /etc/rc.d/rc.sysinit, right before fsck runs.

insmod snd-hammerfall-mem

since snd-hammerfall-mem has nothing to do with filesystems on disk, there is no danger. many other hammerfall users are doing equivalent things, and its also necessary under windows and macos.

Quoted 4 lines

now i understood the necessity of the allocation way of snd-hammerfall-mem. we can merge the feature but it will be likely after 0.9.0, as long as the old style works. i'd like to concentrate on bug fixes now.

as long as you propose to leave snd-hammerfall-mem in place. otherwise, you will make it impossible for many people to use their audio interfaces!

--p

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

#10 lore raw
In reply to a message not in the archive

At Mon, 03 Mar 2003 11:59:56 -0500,

Quoted 8 lines · Paul Davis
Quoted 7 lines
Quoted 4 lines

they aren't. that's the whole problem. on my old system (148MB of RAM), allowing fsck to run would prevent memory allocation. i don't know of any distribution that inserts modules that early. do you?

aha, but fsck runs even before snd-hammerfall-mem, doesn't it? (unless you bulit it in kernel) otherwise it's dangerous...

Quoted 7 lines

no. absolutely not. i just added something equivalent to this to /etc/rc.d/rc.sysinit, right before fsck runs.

insmod snd-hammerfall-mem

since snd-hammerfall-mem has nothing to do with filesystems on disk, there is no danger.

as long as the snd-hammerfall-mem module itself on the filesystem is not broken. it may happen not rarely if the filesystem crashed just after (or during) installing the new module files.

Quoted 8 lines

many other hammerfall users are doing equivalent things, and its also necessary under windows and macos.

Quoted 4 lines

now i understood the necessity of the allocation way of snd-hammerfall-mem. we can merge the feature but it will be likely after 0.9.0, as long as the old style works. i'd like to concentrate on bug fixes now.

Quoted 4 lines

as long as you propose to leave snd-hammerfall-mem in place.
otherwise, you will make it impossible for many people to use their audio interfaces!

don't worry, it's been still there. no changes regarding snd-hf-mem without asking you :)

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

author
#11 lore raw
Quoted 6 lines
Quoted 2 lines

since snd-hammerfall-mem has nothing to do with filesystems on disk, there is no danger.

as long as the snd-hammerfall-mem module itself on the filesystem is not broken. it may happen not rarely if the filesystem crashed just after (or during) installing the new module files.

when this is done (pre-fsck), only / is mounted, and its mounted read-only. nothing can happen.

--p

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf