hdsp9632 mixer fix + gcc 2.9x compile fix
Hi,
The attached patch fixes matrix mixer and metering problems spotted by Pentti Ala-Vannesluoma for H9632 cards and gcc 2.9x compile errors reported by Martin Langer.
Thomas
hdsp.c renamed from hdsp.c.cvs +25 -20
@@ -454,6 +454,7 @@unsigned short state;/* stores state bits */ u32 firmware_cache[24413 ];/* this helps recover from accidental iobox power failure */ size_t period_bytes;/* guess what this is */ +unsigned char max_channels;unsigned char qs_in_channels;/* quad speed mode for H9632 */ unsigned char ds_in_channels;unsigned char ss_in_channels;/* different for multiface/digiface */
@@ -1169,11 +1170,11 @@/* set thru for all channels */ if (enable) { -for (i =0 ; i <HDSP_MAX_CHANNELS ; i++) { +for (i =0 ; i < hdsp->max_channels; i++) {hdsp_write_gain (hdsp,hdsp_input_to_output_key (hdsp,i,i),UNITY_GAIN ); } }else { -for (i =0 ; i <HDSP_MAX_CHANNELS ; i++) { +for (i =0 ; i < hdsp->max_channels; i++) {hdsp_write_gain (hdsp,hdsp_input_to_output_key (hdsp,i,i),MINUS_INFINITY_GAIN ); } }
@@ -1181,7 +1182,7 @@ }else {int mapped_channel; -snd_assert (channel <HDSP_MAX_CHANNELS , return); +snd_assert (channel < hdsp->max_channels, return); mapped_channel = hdsp->channel_map[channel];
@@ -2902,9 +2903,9 @@ source = ucontrol->value.integer.value[0 ]; destination = ucontrol->value.integer.value[1 ]; - -if (source >25 ) { - addr =hdsp_playback_to_output_key (hdsp,source-26 ,destination); + +if (source >= hdsp->max_channels) { + addr =hdsp_playback_to_output_key (hdsp,source-hdsp->max_channels,destination); }else { addr =hdsp_input_to_output_key (hdsp,source, destination); }
@@ -2931,8 +2932,8 @@ source = ucontrol->value.integer.value[0 ]; destination = ucontrol->value.integer.value[1 ]; -if (source >25 ) { - addr =hdsp_playback_to_output_key (hdsp,source-26 , destination); +if (source >= hdsp->max_channels) { + addr =hdsp_playback_to_output_key (hdsp,source-hdsp->max_channels, destination); }else { addr =hdsp_input_to_output_key (hdsp,source, destination); }
@@ -3177,7 +3178,7 @@int snd_hdsp_create_controls (snd_card_t *card,hdsp_t *hdsp) { -unsigned int idx, limit; +unsigned int idx;int err;snd_kcontrol_t *kctl;
@@ -3676,12 +3677,13 @@odd numbered channels to right, even to left. */ if (hdsp->io_type ==H9632 ) { - lineouts_base =14 ; +/* this is the phones/analog output */ + lineouts_base =10 ; }else { lineouts_base =26 ; } -for (i =0 ; i <HDSP_MAX_CHANNELS ; i++) { +for (i =0 ; i < hdsp->max_channels; i++) {if (i &1 ) {if (hdsp_write_gain (hdsp,hdsp_input_to_output_key (hdsp, i, lineouts_base),UNITY_GAIN ) ||hdsp_write_gain (hdsp,hdsp_playback_to_output_key (hdsp, i, lineouts_base),UNITY_GAIN )) {
@@ -3793,7 +3795,7 @@ {int mapped_channel; - snd_assert(channel >= 0 || channel < HDSP_MAX_CHANNELS, return NULL); + snd_assert(channel >= 0 || channel < hdsp->max_channels, return NULL);if ((mapped_channel = hdsp->channel_map[channel]) <0 ) {return NULL ;
@@ -3963,7 +3965,7 @@hdsp_t *hdsp =_snd_pcm_substream_chip (substream);int mapped_channel; -snd_assert (info->channel <HDSP_MAX_CHANNELS , return -EINVAL ); +snd_assert (info->channel < hdsp->max_channels, return -EINVAL );if ((mapped_channel = hdsp->channel_map[info->channel]) <0 ) {return -EINVAL ;
@@ -4487,8 +4489,8 @@static int snd_hdsp_hwdep_dummy_op (snd_hwdep_t *hw,struct file *file) { -/* we have nothing to initialize but the call is required */ -return 0 ; +/* we have nothing to initialize but the call is required */ +return 0 ; }
@@ -4545,10 +4547,11 @@ }if (hdsp->io_type ==H9632 ) {int j; +hdsp_9632_meters_t *m;int doublespeed =0 ;if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DoubleSpeedStatus) doublespeed =1 ; -hdsp_9632_meters_t *m = (hdsp_9632_meters_t *)hdsp->iobase+HDSP_9632_metersBase; + m = (hdsp_9632_meters_t *)(hdsp->iobase+HDSP_9632_metersBase); peak_rms = (hdsp_peak_rms_t *)arg;for (i =0 , j =0 ; i <16 ; ++i, ++j) {if (copy_to_user ((void *)peak_rms->input_peaks+i*4 , &(m->input_peak[j]),4 ) !=0 )
@@ -4814,7 +4817,7 @@return -EIO ; } -for (i =0 ; i <HDSP_MAX_CHANNELS ; ++i) { +for (i =0 ; i < hdsp->max_channels; ++i) {hdsp_write (hdsp, HDSP_inputEnable + (4 * i),1 );hdsp_write (hdsp, HDSP_outputEnable + (4 * i),1 ); }
@@ -4841,8 +4844,9 @@case H9632 : status =hdsp_read (hdsp, HDSP_statusRegister); - aebi_channels = (status &HDSP_AEBI ) ?4 :0 ; - aebo_channels = (status &HDSP_AEBO ) ?4 :0 ; +/* HDSP_AEBx bits are low when AEB are connected */ + aebi_channels = (status &HDSP_AEBI ) ?0 :4 ; + aebo_channels = (status &HDSP_AEBO ) ?0 :4 ; hdsp->card_name ="RME Hammerfall HDSP 9632" ; hdsp->ss_in_channels =H9632_SS_CHANNELS +aebi_channels; hdsp->ds_in_channels =H9632_DS_CHANNELS +aebi_channels;
@@ -4929,7 +4933,6 @@ {struct pci_dev *pci = hdsp->pci;int err; -int i;int is_9652 =0 ;int is_9632 =0 ;
@@ -4948,6 +4951,7 @@ hdsp->control_register =0 ; hdsp->control2_register =0 ; hdsp->io_type = Undefined; + hdsp->max_channels =26 ; hdsp->card = card;
@@ -4974,6 +4978,7 @@break ;case 0x96 : hdsp->card_name ="RME HDSP 9632" ; + hdsp->max_channels =16 ; is_9632 =1 ;break ;default :
Re: hdsp update
Hi list, hi thomas,
A big thank you for all your great job on the rme hdsp. I've installed the alsa cvs dated from the november 5th on 2 pc:
one with a hdsp multiface, one with a hdsp 9652.
Since this update, I can't access anymore the level of the channels with amixer, and alsamixer reponds 'no mixer element found' on both system. Is it a normal behaviour?
Then, when I boot, the hdsp multiface is still locked and I need to call 'hdsploader' about 3 or 5 times (I have the 'post-install snd-hdsp /usr/local/bin/hdsploader' in modules.conf)
then, I have to reboot, and run hdspmixer to unmute the channels. I woul like to know if there is a way to start the system with the card properly running and all channels unmuted.
Maybe you could show us your modules.conf?
Thanks again,
Benoit
hdsp.c
Quoted 13 lines · Thomas Charbonnel
Hi,
The attached patch fixes matrix mixer and metering problems spotted by Pentti Ala-Vannesluoma for H9632 cards and gcc 2.9x compile errors reported by Martin Langer.
Thomas
------------------------------------------------------------------------
hdsp.c renamed from hdsp.c.cvs +0
-0@@ -454,6 +454,7 @@
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Re: hdsp update
Quoted 9 lines · Benouille
Hi list, hi thomas,
A big thank you for all your great job on the rme hdsp. I've installed the alsa cvs dated from the november 5th on 2 pc:
one with a hdsp multiface, one with a hdsp 9652.Since this update, I can't access anymore the level of the channels with amixer, and alsamixer reponds 'no mixer element found' on both system. Is it a normal behaviour?
It is. I removed those simple mixer controls because I could find no proper way to deal with them while changing speed mode. Anyway, anything you could do with those you can do either with hdspmixer or amixer in console mode, using the 'Mixer' ctl.
The amixer syntax is as follows :
amixer -c X cset numid=5 in,out,level
Where:
X is your alsa card number
0 <= in < 26 : physical inputs 26 <= in < 52 : playbacks (software outputs) 0 <= out < 26 : physical outputs
26 <= out <= 27 : line outs (phones), if any 0 <= level < 65536 : gain (65535 = +6dB, 32768 = 0dB)
(H9632 users should read :
0 <= in < 16 : physical inputs
16 <= in < 32 : playbacks (softwre outputs)
0 <= out < 16 : physical outputs
)
Here's an example :
amixer cset numid=5 26,0,32768
amixer cset numid=5 27,1,32768
This routes software outputs 1/2 (playback_1 and playback_2 in jack) to physical outputs 1/2 with a 0dB gain. It is the same as formerly setting the level to 50% in the first 2 alsamixer strips.
Below is a small script that does the same as the first hdspmixer preset (for non-h9632 cards, and assumes the hdsp card is the default one) :
#! /bin/bash
for out_left in $(seq 0 2 25);
do
let out_right=$out_left+1
let in_left=$out_left+26
let in_right=$out_right+26
amixer cset numid=5 $in_left,$out_left,32768
amixer cset numid=5 $in_left,26,32768
amixer cset numid=5 $in_right,$out_right,32768
amixer cset numid=5 $in_right,27,32768;
done;
Quoted 4 lines
Then, when I boot, the hdsp multiface is still locked and I need to call 'hdsploader' about 3 or 5 times (I have the 'post-install snd-hdsp
/usr/local/bin/hdsploader' in modules.conf)
I know this problem, but didn't find a solution yet. For some reason the specified wait time isn't always respected, so even if the firmware has been correctly uploaded ('host' light turns off on the io box), the function returns too early with an error, and the initialization process in stopped (the alsa pcm and midi devices are not created). Running hdsploader a second time usually fixes this.
Quoted 5 lines
then, I have to reboot, and run hdspmixer to unmute the channels. I woul like to know if there is a way to start the system with the card properly running and all channels unmuted.
Maybe you could show us your modules.conf?
I have nothing special in my modules.conf, I usually run hdsploader by hand. You may use the above script to set the levels up.
Thomas
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thanks thomas,
you're right, I'm french... and your answer was very clear! /Franchement tu fais un super bouleau, et notamment le hdspmixer est une pure merveille./
Since this mailing list is not in french , I prefer to answer in english.
About the problem of loading the firmware in the hdsp multiface, I'll try to explain my experience:
After I boot linux, the multiface is still locked (red light host error is on). Then, I need to run hdsploader 3 or 5 times (maybe I should wait a bit more between each one). Then, if I run hdspmixer to recall the preset 1, I still can't hear any sound from the soundcard, and all levels meters in hdspmixer stay null. If I reboot, no need to run hdsploader, since the firmware is already there, I run hdspmixer, and here I can get output from the card.
It's not problematic, I just share my exeperience.
For info: redhat 9, alsa cvs november 5th, Planet CCRMA kernel 2.4.22, hdsp flash firmware v1.1
A last question I know someone that have a hdsp 9652 with RME Analog Expansion Board : 2 * 8 channels output and one 8 channels input. He would like to install linux, do you know if it should work without problem? (synchro problems?)
Thanks, thanks, and one more time: THANKS!
Benoit
Quoted 70 lines · Thomas Charbonnel
Quoted 8 lines · Benouille
Hi thomas,
A big thank you for all your great job on the rme hdsp. I've installed the alsa cvs dated from the november 5th on 2 pc:
one with a hdsp multiface, one with a hdsp 9652.Since this update, I can't access anymore the level of the channels with
amixer, and alsamixer reponds 'no mixer element found' on both system. Is it a normal behaviour?Hello Benoît,
Vu ton adresse mail et ton prénom, je présume que je peux te répondre en français ?
J'ai en effet supprimé les contrôles de volumes standards dans la dernière version du driver, parce qu'il n'y avait aucun moyen élégant de les gérer lors des changements de mode (normal speed, double speed, et même quad speed pour les hdsp 9632). Ma décision est aussi basée sur le fait tu peux toujours faire la même chose qu'eux soit avec hdspmixer, soit même en mode console avec amixer et le contrôle appelé 'Mixer'.La syntaxe d'amixer est la suivante :
amixer -c X cset numid=5 in,out,level
Où X est le numéro de carte alsa de ton hdsp (tu peux ommetre l'option -c si ton hdsp est la carte par défaut)
0 <= in < 26 entrées physiques 26 <= in < 52 playbacks (sorties logicielles) 0 <= out < 26 sorties physiques 26 <= out <= 27 line out (phones) (sauf pour ta 9652)0 <= level < 65536 niveau sonore (65535 = +6dB, 32768 = 0dB)
Un exemple rapide :
amixer cset numid=5 26,0,32768
amixer cset numid=5 27,1,32768Ceci route les sorties logicielles un et deux vers les sorties physiques
un et deux (la même chose que si tu avait mis le niveau à 50 % dans les
deux premières tranches d'alsamixer).Voici un petit script bash pour router toutes les sorties logicielles dans les sorties physiques correspondante ansi que la sortie casque (c'est l'équivalent du preset 1 de totalmix/hdspmixer):
#!
/bin/bashfor
out_leftin $(seq 0 2 25);
do
let out_right=$out_left+1
let in_left=$out_left+26
let in_right=$out_right+26
amixer -c 2 cset numid=5 $in_left,$out_left,32768 amixer -c 2 cset numid=5 $in_left,26,32768 amixer -c 2 cset numid=5 $in_right,$out_right,32768 amixer -c 2 cset numid=5 $in_right,27,32768; done;Quoted 3 lines
Then, when I boot, the hdsp multiface is still locked and I need to call 'hdsploader' about 3 or 5 times (I have the 'post-install snd-hdsp
/usr/local/bin/hdsploader' in modules.conf)Je suis au courrant de ce problème, mais je n'ai pas encore mis le doigt sur la cause. Généralement lancer hdsploader 2 fois suffit : la première fois le firmware et uploadé comme il faut, mais pour un raison que j'ignore encore le temps d'attente demandé au kernel n'est pas respecté et la fonction retourne une erreur, du coup la carte n'est pas initialisée correctement. Mais tu constateras que la lumière rouge (host) s'est éteinte : la carte est fonctionnelle, mais les périphériques alsa correspondant n'ont pas été créés. Après cela, quand tu lance hdsploader à nouveau, la fonction d'upload se termine correctement, les périphériques alsa sont créés, et la carte est initialisée comme il faut.
then, I have to reboot, and run hdspmixer to unmute the channels.
En fait rien n'est muté, mais simplement le matrix mixer est vide.
Quoted 3 lines
I woul like to know if there is a way to start the system with the card properly running and all channels unmuted. Maybe you could show us your modules.conf?
Rien de particulier dans mon modules.conf. J'utilise hdsploader manuellement, et la plupart du temps je ne débranche pas le secteur du boîtier de la multiface, du coup le firmware reste uploadé, et la carte est initialisée comme il faut lors du boot. Pour ce qui est de restaurer des valeurs de routages utiles, tu peux utiliser le petit script que je t'ai inclus plus haut.
Quoted 9 lines
Conclusion, il faut décidément que je résolve ce problème d'initialisation...
Thomas
_____________________________________________________________________
Envie de discuter en "live" avec vos amis ? Télécharger MSN Messenger
http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Quoted 5 lines · Benouille
Thanks thomas,
you're right, I'm french... and your answer was very clear! /Franchement tu fais un super bouleau, et notamment le hdspmixer est une pure merveille./
Merci :)
Quoted 3 lines
Since this mailing list is not in french , I prefer to answer in english.
I also sent a translation to the list, but it didn't show up yet (smtp problems ?)
Quoted 7 lines
About the problem of loading the firmware in the hdsp multiface, I'll try to explain my experience:
After I boot linux, the multiface is still locked (red light host error is on). Then, I need to run hdsploader 3 or 5 times (maybe I should wait a bit more between each one). Then, if I run hdspmixer to recall the preset 1, I still can't hear any sound from the soundcard, and all levels meters in hdspmixer stay null. If I reboot, no need to run hdsploader, since the firmware is already there, I run hdspmixer, and here I can get output from the card.It's not problematic, I just share my exeperience.
For info: redhat 9, alsa cvs november 5th, Planet CCRMA kernel 2.4.22, hdsp flash firmware v1.1
Please try the patch I just sent to the list and tell me if the problem remains.
Quoted 2 lines
A last question I know someone that have a hdsp 9652 with RME Analog Expansion Board : 2 * 8 channels output and one 8 channels input. He would like to install linux, do you know if it should work without problem? (synchro problems?)
If these are old style expansion boards (plugged on the internal ADAT connectors, I think these are the same as those for the old rme series) it should work without any change, you just have to check the AEB checkbox in the latest hdspconf (or use amixer to set the corresponding ctl accordingly). I only know of newer extension boards for the H9632 series. These are also supposed to be supported, but it is untested yet.
Quoted 2 lines
Thanks, thanks, and one more time: THANKS!
You're welcome, I'm happy this is of some use :)
Thomas
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
At Thu, 06 Nov 2003 13:37:35 +0100,
Quoted 7 lines · Thomas Charbonnel
[1 <text/plain; us-ascii (7bit)>]
Hi,The attached patch fixes matrix mixer and metering problems spotted by Pentti Ala-Vannesluoma for H9632 cards and gcc 2.9x compile errors reported by Martin Langer.
thanks again.
it's now on cvs.
Takashi
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/