Skip to contentSkip to conversation

pmac: save master volume on sleep

PATCH In review Colin Leroy 3 participants 4 messages Apr 21, 2005 – Apr 24, 2005 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pmac: save master volume on sleep

Hi,

Ben's patch that shutdowns master switch and restores it after resume ("pmac: Improve sleep code of tumbler driver") isn't enough here on an iBook (snapper chip).

The master switch is correctly saved and restored, but somehow tumbler_put_master_volume() gets called just after tumbler_set_master_volume() and sets mix->master_vol[*] to 0. So, on resuming, the master switch is reenabled, but the volume is set to 0.

Here's a patch that also saves and restores master_vol. Thanks,

sound/ppc/tumbler.c +5 -0
@@ -99,6 +99,7 @@
 	pmac_gpio_t hp_detect;
 	int headphone_irq;
 	int lineout_irq;
+	unsigned int save_master_vol[2];
 	unsigned int master_vol[2];
 	unsigned int save_master_switch[2];
 	unsigned int master_switch[2];
@@ -1128,6 +1129,8 @@
 		disable_irq(mix->lineout_irq);
 	mix->save_master_switch[0] = mix->master_switch[0];
 	mix->save_master_switch[1] = mix->master_switch[1];
+	mix->save_master_vol[0] = mix->master_vol[0];
+	mix->save_master_vol[1] = mix->master_vol[1];
 	mix->master_switch[0] = mix->master_switch[1] = 0;
 
 	tumbler_set_master_volume(mix);
@@ -1156,6 +1159,8 @@
 	mix->acs &= ~1;
 	mix->master_switch[0] = mix->save_master_switch[0];
 	mix->master_switch[1] = mix->save_master_switch[1];
+	mix->master_vol[0] = mix->save_master_vol[0];
+	mix->master_vol[1] = mix->save_master_vol[1];
 	tumbler_reset_audio(chip);
 	if (mix->i2c.client && mix->i2c.init_client) {
 		if (mix->i2c.init_client(&mix->i2c) < 0)
#1 lore raw
Quoted 6 lines · Colin Leroy

Hi,

Ben's patch that shutdowns master switch and restores it after resume ("pmac: Improve sleep code of tumbler driver") isn't enough here on an iBook (snapper chip).

Quoted 7 lines

The master switch is correctly saved and restored, but somehow tumbler_put_master_volume() gets called just after tumbler_set_master_volume() and sets mix->master_vol[*] to 0. So, on resuming, the master switch is reenabled, but the volume is set to 0.

Here's a patch that also saves and restores master_vol. Thanks,

Looks good.

Ben.

#2 lore raw

On 22 Apr 2005 at 10h04, Benjamin Herrenschmidt wrote:

Hi,

Quoted 12 lines
Quoted 12 lines

Hi,

Ben's patch that shutdowns master switch and restores it after resume ("pmac: Improve sleep code of tumbler driver") isn't enough here on an iBook (snapper chip).

The master switch is correctly saved and restored, but somehow tumbler_put_master_volume() gets called just after tumbler_set_master_volume() and sets mix->master_vol[*] to 0. So, on resuming, the master switch is reenabled, but the volume is set to 0.

Quoted 4 lines
Quoted 2 lines

Here's a patch that also saves and restores master_vol. Thanks,

Looks good.

Takashi: any news or comments on this?

Thanks,

Signature · 1 line
Colin
#3 lore raw

Hi Colin,

the patch looks OK to me too.
Could you resend this to Jaroslav to apply it to ALSA tree, since I'm in vacation...?

Thanks.

Takashi

Quoted 28 lines · Colin Leroy

On 22 Apr 2005 at 10h04, Benjamin Herrenschmidt wrote:
=20
Hi,
=20

Quoted 12 lines
Quoted 12 lines

Hi,

Ben's patch that shutdowns master switch and restores it after resume ("pmac: Improve sleep code of tumbler driver") isn't enough here on an iBook (snapper chip).

The master switch is correctly saved and restored, but somehow tumbler_put_master_volume() gets called just after tumbler_set_master_volume() and sets mix->master_vol[*] to 0. So, on resuming, the master switch is reenabled, but the volume is set to 0.

Quoted 4 lines
Quoted 2 lines

Here's a patch that also saves and restores master_vol. Thanks,

Looks good.

=20
Takashi: any news or comments on this?
=20
Thanks,
--
Colin
=20