Commit 085e6fc9 authored by Colin Leroy's avatar Colin Leroy Committed by Linus Torvalds

[PATCH] pmac: save master volume on sleep

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.
Signed-off-by: default avatarColin Leroy <colin@colino.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1f7b49d0
...@@ -99,6 +99,7 @@ typedef struct pmac_tumbler_t { ...@@ -99,6 +99,7 @@ typedef struct pmac_tumbler_t {
pmac_gpio_t hp_detect; pmac_gpio_t hp_detect;
int headphone_irq; int headphone_irq;
int lineout_irq; int lineout_irq;
unsigned int save_master_vol[2];
unsigned int master_vol[2]; unsigned int master_vol[2];
unsigned int save_master_switch[2]; unsigned int save_master_switch[2];
unsigned int master_switch[2]; unsigned int master_switch[2];
...@@ -1139,6 +1140,8 @@ static void tumbler_suspend(pmac_t *chip) ...@@ -1139,6 +1140,8 @@ static void tumbler_suspend(pmac_t *chip)
disable_irq(mix->lineout_irq); disable_irq(mix->lineout_irq);
mix->save_master_switch[0] = mix->master_switch[0]; mix->save_master_switch[0] = mix->master_switch[0];
mix->save_master_switch[1] = mix->master_switch[1]; 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; mix->master_switch[0] = mix->master_switch[1] = 0;
tumbler_set_master_volume(mix); tumbler_set_master_volume(mix);
if (!mix->anded_reset) { if (!mix->anded_reset) {
...@@ -1166,6 +1169,8 @@ static void tumbler_resume(pmac_t *chip) ...@@ -1166,6 +1169,8 @@ static void tumbler_resume(pmac_t *chip)
mix->acs &= ~1; mix->acs &= ~1;
mix->master_switch[0] = mix->save_master_switch[0]; mix->master_switch[0] = mix->save_master_switch[0];
mix->master_switch[1] = mix->save_master_switch[1]; 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); tumbler_reset_audio(chip);
if (mix->i2c.client && mix->i2c.init_client) { if (mix->i2c.client && mix->i2c.init_client) {
if (mix->i2c.init_client(&mix->i2c) < 0) if (mix->i2c.init_client(&mix->i2c) < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment