All of lore.kernel.org
 help / color / mirror / Atom feed
* hdsp9632 mixer fix + gcc 2.9x compile fix
@ 2003-11-06 12:37 Thomas Charbonnel
  2003-11-07 11:18 ` hdsp update Benouille
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Thomas Charbonnel @ 2003-11-06 12:37 UTC (permalink / raw)
  To: alsa-devel

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

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

[-- Attachment #2: hdsp9632.patch --]
[-- Type: text/plain, Size: 5394 bytes --]

--- hdsp.c.cvs	2003-11-01 09:06:45.000000000 +0100
+++ hdsp.c	2003-11-06 13:06:28.000000000 +0100
@@ -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:

^ permalink raw reply	[flat|nested] 13+ messages in thread
* hdsp update
@ 2003-11-23 17:21 Thomas Charbonnel
  2003-11-24 11:40 ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Charbonnel @ 2003-11-23 17:21 UTC (permalink / raw)
  To: alsa-devel, torger

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

Hi,

The attach patch fixes problems with speed modes for H9632 cards (many
thanks to Pentti Ala-Vannesluoma for testing the driver and helping
finding bugs), and the AutoSync mode issue (for all cards) reported by
Anders Torger at the end of september.
A new version of hdspmixer is also available here :
http://www.undata.org/~thomas/
It is mostly a bugfix release for H9632 users.
There is also a new version of hdspconf, but it only adds a .desktop
file and a nice icon (to bring it to par with the new hdspmixer), so
Takashi, feel free not to commit this one if you don't have much time :)

Thomas


[-- Attachment #2: hdsp.patch --]
[-- Type: text/plain, Size: 3021 bytes --]

--- hdsp.c.cvs	2003-11-07 14:49:56.000000000 +0100
+++ hdsp.c	2003-11-21 17:15:18.000000000 +0100
@@ -1109,16 +1109,17 @@
 		rate_bits = HDSP_Frequency176_4KHz;
 		break;
 	case 192000:
-		if (current_rate != 192000) {
+		if (current_rate < 128000) {
 			reject_if_open = 1;
 		}
 		rate_bits = HDSP_Frequency192KHz;
+		break;
 	default:
 		return -EINVAL;
 	}
 
 	if (reject_if_open && (hdsp->capture_pid >= 0 || hdsp->playback_pid >= 0)) {
-		snd_printk ("cannot change between single- and double-speed mode (capture PID = %d, playback PID = %d)\n",
+		snd_printk ("cannot change speed mode (capture PID = %d, playback PID = %d)\n",
 			    hdsp->capture_pid,
 			    hdsp->playback_pid);
 		return -EBUSY;
@@ -2102,9 +2103,11 @@
 	switch (mode) {
 	case HDSP_CLOCK_SOURCE_AUTOSYNC:
 		if (hdsp_external_sample_rate(hdsp) != 0) {
-		    hdsp->control_register &= ~HDSP_ClockModeMaster;		
-		    hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
-		    return 0;
+		    if (!hdsp_set_rate(hdsp, hdsp_external_sample_rate(hdsp), 1)) {
+			hdsp->control_register &= ~HDSP_ClockModeMaster;		
+			hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
+			return 0;
+		    }
 		}
 		return -1;
 	case HDSP_CLOCK_SOURCE_INTERNAL_32KHZ:
@@ -4189,30 +4192,36 @@
 static int snd_hdsp_hw_rule_in_channels(snd_pcm_hw_params_t *params,
 					snd_pcm_hw_rule_t *rule)
 {
-	unsigned int list[2];
+	unsigned int list[3];
 	hdsp_t *hdsp = rule->private;
 	snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
 	if (hdsp->io_type == H9632) {
 		list[0] = hdsp->qs_in_channels;
+		list[1] = hdsp->ds_in_channels;
+		list[2] = hdsp->ss_in_channels;
+		return snd_interval_list(c, 3, list, 0);
 	} else {
 		list[0] = hdsp->ds_in_channels;
+		list[1] = hdsp->ss_in_channels;
 	}
-	list[1] = hdsp->ss_in_channels;
 	return snd_interval_list(c, 2, list, 0);
 }
 
 static int snd_hdsp_hw_rule_out_channels(snd_pcm_hw_params_t *params,
 					snd_pcm_hw_rule_t *rule)
 {
-	unsigned int list[2];
+	unsigned int list[3];
 	hdsp_t *hdsp = rule->private;
 	snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
 	if (hdsp->io_type == H9632) {
 		list[0] = hdsp->qs_out_channels;
+		list[1] = hdsp->ds_out_channels;
+		list[2] = hdsp->ss_out_channels;
+		return snd_interval_list(c, 3, list, 0);
 	} else {
 		list[0] = hdsp->ds_out_channels;
+		list[1] = hdsp->ss_out_channels;
 	}
-	list[1] = hdsp->ss_out_channels;
 	return snd_interval_list(c, 2, list, 0);
 }
 
@@ -4229,7 +4238,7 @@
 			.integer = 1,
 		};
 		return snd_interval_refine(c, &t);	
-	} else if (r->min > 48000) {
+	} else if (r->min > 48000 && r->max <= 96000) {
 		snd_interval_t t = {
 			.min = hdsp->ds_in_channels,
 			.max = hdsp->ds_in_channels,
@@ -4260,7 +4269,7 @@
 			.integer = 1,
 		};
 		return snd_interval_refine(c, &t);	
-	} else if (r->min > 48000) {
+	} else if (r->min > 48000 && r->max <= 96000) {
 		snd_interval_t t = {
 			.min = hdsp->ds_out_channels,
 			.max = hdsp->ds_out_channels,


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

end of thread, other threads:[~2003-11-25 11:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-06 12:37 hdsp9632 mixer fix + gcc 2.9x compile fix Thomas Charbonnel
2003-11-07 11:18 ` hdsp update Benouille
2003-11-07 12:55   ` Thomas Charbonnel
     [not found] ` <3FAB5CE6.70306@ifrance.com>
     [not found]   ` <3FAB857A.80707@undata.org>
2003-11-07 13:20     ` hdsp9632 mixer fix + gcc 2.9x compile fix Benouille
2003-11-07 14:33       ` Thomas Charbonnel
2003-11-07 18:30 ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2003-11-23 17:21 hdsp update Thomas Charbonnel
2003-11-24 11:40 ` Takashi Iwai
2003-11-24 14:52   ` Takashi Iwai
2003-11-24 17:48     ` Thomas Charbonnel
2003-11-24 18:17       ` Takashi Iwai
2003-11-24 18:37         ` Thomas Charbonnel
2003-11-25 11:56           ` Takashi Iwai

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.