Skip to contentSkip to conversation

patch for dmasound bug

PATCH Ryan Nielsen 2 participants 4 messages Jun 2, 1999 – Jun 11, 1999

lore
Share & tools
lore
#0 lore raw

This restores the rate/byteswap to normal after playing a beep if you for example stop timidity, make a beep, resume, the sound will be slower than normal (without this patch).

drivers/sound/dmasound.c +5 -0
@@ -3255,6 +3255,11 @@
 	save_flags(flags); cli();
 	if (beep_playing) {
 		st_le16(&beep_dbdma_cmd->command, DBDMA_STOP);
+		out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
+		out_le32(&awacs->control,
+			 (in_le32(&awacs->control) & ~0x1f00)
+			 | (awacs_rate_index << 8));
+		out_le32(&awacs->byteswap, sound.hard.format != AFMT_S16_BE);
 		beep_playing = 0;
 	}
 	restore_flags(flags);

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]

#1 lore raw

OK, this reply comes a bit late, but I didn't try the patch until now, so here goes:

Ryan Nielsen:

Quoted 4 lines

This restores the rate/byteswap to normal after playing a beep if you for example stop timidity, make a beep, resume, the sound will be slower than normal (without this patch).

Although this patch might do what it was intended for, it has some unwanted consequences on the PowerBook G3 Series, namely that one gets a constant, really annoying hiss from the loudspeakers, most notably during the boot sequence. Without this patch, the hiss stops after a system beep (like when you do an "echo ^G" in a shell), but now even this does not help. So, if this patch is included in the standard distribution, I suspect we will hear a lot of complaints from PowerBook G3 users.

To me, it seems like there is something wrong in the dmasound driver that causes this hiss; it just doesn't switch off all sound when it's supposed to. I don't know enough about the workings of the audio controller to go bug hunting here myself, so all I can do is just point out that there is a problem here :(

Quoted 4 lines
drivers/sound/dmasound.c +0 -0
@@ -3255,6 +3255,11 @@
 	save_flags(flags); cli();

drivers/sound/dmasound.c line 3265

Quoted 10 lines
drivers/sound/dmasound.c +5 -0
 	if (beep_playing) {
 		st_le16(&beep_dbdma_cmd->command, DBDMA_STOP);
+		out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
+		out_le32(&awacs->control,
+			 (in_le32(&awacs->control) & ~0x1f00)
+			 | (awacs_rate_index << 8));
+		out_le32(&awacs->byteswap, sound.hard.format != AFMT_S16_BE);
 		beep_playing = 0;
 	}
 	restore_flags(flags);

aLViN

Signature · 6 lines
:r .signature

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]
#2 lore raw
Quoted 4 lines · Alvin Brattli
Quoted 3 lines

This restores the rate/byteswap to normal after playing a beep if you for example stop timidity, make a beep, resume, the sound will be slower than normal (without this patch).

Quoted 8 lines

Although this patch might do what it was intended for, it has some unwanted consequences on the PowerBook G3 Series, namely that one gets a constant, really annoying hiss from the loudspeakers, most notably during the boot sequence. Without this patch, the hiss stops after a system beep (like when you do an "echo ^G" in a shell), but now even this does not help. So, if this patch is included in the standard distribution, I suspect we will hear a lot of complaints from PowerBook G3 users.

is this better?

dmasound.c +5 -0
@@ -3255,6 +3255,11 @@
 	save_flags(flags); cli();
 	if (beep_playing) {
 		st_le16(&beep_dbdma_cmd->command, DBDMA_STOP);
+		out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
+		out_le32(&awacs->control, MASK_IEPC
+			 | (awacs_rate_index << 8) | 0x11
+			 | (awacs_revision < AWACS_BURGUNDY? MASK_IEE: 0));
+		out_le32(&awacs->byteswap, sound.hard.format != AFMT_S16_BE);
 		beep_playing = 0;
 	}
 	restore_flags(flags);

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]

#3 lore raw

Ryan Nielsen:

Quoted 15 lines
Quoted 8 lines · Alvin Brattli

Although this patch might do what it was intended for, it has some unwanted consequences on the PowerBook G3 Series, namely that one gets a constant, really annoying hiss from the loudspeakers, most notably during the boot sequence. Without this patch, the hiss stops after a system beep (like when you do an "echo ^G" in a shell), but now even this does not help. So, if this patch is included in the standard distribution, I suspect we will hear a lot of complaints from PowerBook G3 users.

is this better?

dmasound.c +0 -0
@@ -3255,6 +3255,11 @@
 	save_flags(flags); cli();

dmasound.c line 3265

Quoted 10 lines
dmasound.c +5 -0
 	if (beep_playing) {
 		st_le16(&beep_dbdma_cmd->command, DBDMA_STOP);
+		out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
+		out_le32(&awacs->control, MASK_IEPC
+			 | (awacs_rate_index << 8) | 0x11
+			 | (awacs_revision < AWACS_BURGUNDY? MASK_IEE: 0));
+		out_le32(&awacs->byteswap, sound.hard.format != AFMT_S16_BE);
 		beep_playing = 0;
 	}
 	restore_flags(flags);

Nope. The hiss is still there, and won't go away. If it can be of any help, the patch below removes the hiss during boot-time when your patch is not applied. The patch simply makes a very short beep with zero volume. However, after playing certain sounds, the hiss comes back, and can then be stopped with a system beep (like with "echo ^G" in a terminal window).

drivers/sound/dmasound.c +9 -0
@@ -4840,6 +4840,7 @@
 	int has_sound = 0;
 #ifdef CONFIG_PPC
 	struct device_node *np;
+	int beep_volume_tmp;
 #endif
 
 #if defined(__mc68000__) || defined(CONFIG_APUS)
@@ -4974,6 +4975,14 @@
 #ifdef MODULE
 	irq_installed = 1;
 #endif
+
+#ifdef CONFIG_PPC
+	/* Remove hiss from PowerBook speakers (very ad hoc) */
+	beep_volume_tmp = beep_volume;
+	beep_volume = 0;
+	awacs_mksound(750, 1);
+	beep_volume = beep_volume_tmp;
+#endif /* CONFIG_PPC */
 
 	printk(KERN_INFO "DMA sound driver installed, using %d buffers of %dk.\n",
 	       numBufs, bufSize);

aLViN

Signature · 6 lines
:r .signature

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]