[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sound issue on wake



On Sat, 2003-01-11 at 06:59, Everett Coleman II wrote:
> Hello all,
>   I have a titanium powerbook g4 667, and i'm using bitkeeper
> 2.4.21-pre2.  Sometimes when i open it up from sleep the sound goes
> crazy.  It sort of sounds like an high frequency pitch or something.  
> I wanted to know if anybody else is experiencing this and how to fix
> it...

I think I fixed that in my bk tree, I will update the rsync to
2.4.20-ben2 with that fix soon. Patch enclosed for those who want
to test.



-- 
Benjamin Herrenschmidt <benh@kernel.crashing.org>
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux 2.4 for PowerPC
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.759   -> 1.760  
#	drivers/sound/dmasound/tas3004.c	1.5     -> 1.6    
#	drivers/sound/dmasound/tas3001c.c	1.10    -> 1.11   
#	drivers/sound/dmasound/dmasound_awacs.c	1.29    -> 1.30   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/01/09	benh@zion.wanadoo.fr	1.760
# dmasound:
# Mute all outputs and hold chip reset during sleep, then do a
# full chip reset on wakeup on TAS 3001c & 3004 hw
# --------------------------------------------
#
diff -Nru a/drivers/sound/dmasound/dmasound_awacs.c b/drivers/sound/dmasound/dmasound_awacs.c
--- a/drivers/sound/dmasound/dmasound_awacs.c	Sat Jan 11 11:21:29 2003
+++ b/drivers/sound/dmasound/dmasound_awacs.c	Sat Jan 11 11:21:29 2003
@@ -1425,10 +1425,18 @@
 		/* stop rx - if going - a bit of a daft user... but */
 		out_le32(&awacs_rxdma->control, (RUN|WAKE|FLUSH << 16));
 		/* deny interrupts */
+		if (awacs)
+			disable_irq(awacs_irq);
+		disable_irq(awacs_tx_irq);
+		disable_irq(awacs_rx_irq);
+		/* Chip specific sleep code */
 		switch (awacs_revision) {
 			case AWACS_TUMBLER:
 			case AWACS_SNAPPER:
+				write_audio_gpio(gpio_headphone_mute, gpio_headphone_mute_pol);
+				write_audio_gpio(gpio_amp_mute, gpio_amp_mute_pol);
 				tas_enter_sleep();
+				write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol);
 				break ;
 			case AWACS_DACA:
 				daca_enter_sleep();
@@ -1441,10 +1449,6 @@
 				out_le32(&awacs->control, 0x11) ;
 				break ;
 		}
-		if (awacs)
-			disable_irq(awacs_irq);
-		disable_irq(awacs_tx_irq);
-		disable_irq(awacs_rx_irq);
 		/* Disable sound clock */
 		pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, awacs_node, 0, 0);
 		/* According to Darwin, we do that after turning off the sound
@@ -1473,8 +1477,14 @@
 		switch (awacs_revision) {
 			case AWACS_TUMBLER:
 			case AWACS_SNAPPER:
-				headphone_intr(0,0,0);
+				write_audio_gpio(gpio_headphone_mute, gpio_headphone_mute_pol);
+				write_audio_gpio(gpio_amp_mute, gpio_amp_mute_pol);
+				write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol);
+				wait_ms(100);
+				write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol);
+				wait_ms(150);
 				tas_leave_sleep(); /* Stub for now */
+				headphone_intr(0,0,0);
 				break;
 			case AWACS_DACA:
 				wait_ms(10); /* Check this !!! */
diff -Nru a/drivers/sound/dmasound/tas3001c.c b/drivers/sound/dmasound/tas3001c.c
--- a/drivers/sound/dmasound/tas3001c.c	Sat Jan 11 11:21:29 2003
+++ b/drivers/sound/dmasound/tas3001c.c	Sat Jan 11 11:21:29 2003
@@ -292,9 +292,16 @@
 static int
 tas3001c_leave_sleep(struct tas3001c_data_t *self)
 {
+	unsigned char mcr = (1<<6)+(2<<4)+(2<<2);
+
 	if (!self)
 		return -1;
 
+	/* Make sure something answers on the i2c bus */
+	if (tas3001c_write_register(self, TAS3001C_REG_MCR, &mcr,
+	    WRITE_NORMAL|FORCE_WRITE) < 0)
+	    	return -1;
+
 	tas3001c_fast_load(self, 1);
 
 	(void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD0);
@@ -755,10 +762,9 @@
 static int
 tas3001c_init_mixer(struct tas3001c_data_t *self)
 {
-	/* Make sure something answers on the i2c bus
-	*/
-	char mcr = (1<<6)+(2<<4)+(2<<2);
+	unsigned char mcr = (1<<6)+(2<<4)+(2<<2);
 
+	/* Make sure something answers on the i2c bus */
 	if (tas3001c_write_register(self, TAS3001C_REG_MCR, &mcr,
 	    WRITE_NORMAL|FORCE_WRITE) < 0)
 		return -1;
diff -Nru a/drivers/sound/dmasound/tas3004.c b/drivers/sound/dmasound/tas3004.c
--- a/drivers/sound/dmasound/tas3004.c	Sat Jan 11 11:21:29 2003
+++ b/drivers/sound/dmasound/tas3004.c	Sat Jan 11 11:21:29 2003
@@ -471,9 +471,16 @@
 static int
 tas3004_leave_sleep(struct tas3004_data_t *self)
 {
+	unsigned char mcr = (1<<6)+(2<<4)+(2<<2);
+
 	if (!self)
 		return -1;
 
+	/* Make sure something answers on the i2c bus */
+	if (tas3004_write_register(self, TAS3004_REG_MCR, &mcr,
+	    WRITE_NORMAL | FORCE_WRITE) < 0)
+		return -1;
+
 	tas3004_fast_load(self, 1);
 
 	(void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD0);
@@ -1027,10 +1034,9 @@
 static int
 tas3004_init_mixer(struct tas3004_data_t *self)
 {
-	/* Make sure something answers on the i2c bus
-	*/
-	char mcr = (1<<6)+(2<<4)+(2<<2);
+	unsigned char mcr = (1<<6)+(2<<4)+(2<<2);
 
+	/* Make sure something answers on the i2c bus */
 	if (tas3004_write_register(self, TAS3004_REG_MCR, &mcr,
 	    WRITE_NORMAL | FORCE_WRITE) < 0)
 		return -1;

Reply to: