2010-04-16 19:31:30

by Frans Pop

[permalink] [raw]
Subject: [regression] Sound not transferred to docking station after resume from StR

Scenario:
- suspend laptop while *un*docked, i.e. with laptop speakers in use
- dock laptop
- resume

With 2.6.33 and earlier the sound would always come from the external
speakers connected to the docking station. But with 2.6.34-rc4 I get sound
still coming from the laptop's internal speakers, which is not correct.

System: HP 2510p running Debian stable ("Lenny")
Sound driver: snd_hda_intel; codec: AD1981

Attached my kernel config for .34, and dmesg output for both .33 and .34
showing:
- boot (docked)
- undocking (visible as several USB disconnects)
- suspend
- resume after docking

I don't see any significant changes in dmesg output during resume.

I'll do a bisect, unless someone has some idea what may be causing this.


Attachments:
(No filename) (739.00 B)
2.6.33-rc8-suspend.gz (11.38 kB)
2.6.34-rc4-suspend.gz (12.07 kB)
config-2.6.34-rc4 (76.39 kB)
Download all attachments

2010-04-16 19:48:41

by Frans Pop

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

On Friday 16 April 2010, Frans Pop wrote:
> With 2.6.33 and earlier the sound would always come from the external
> speakers connected to the docking station. But with 2.6.34-rc4 I get
> sound still coming from the laptop's internal speakers, which is not
> correct.

Forgot to mention that sound does get transferred to the external speakers
with .34 if I do an extra undock and redock after the resume.

2010-04-17 09:06:27

by Frans Pop

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

On Friday 16 April 2010, Frans Pop wrote:
> Scenario:
> - suspend laptop while *un*docked, i.e. with laptop speakers in use
> - dock laptop
> - resume
>
> With 2.6.33 and earlier the sound would always come from the external
> speakers connected to the docking station. But with 2.6.34-rc4 I get
> sound still coming from the laptop's internal speakers, which is not
> correct.

The problem is slightly different than I thought. Turns out *both* the
internal (laptop) and external (docking station) speakers are active after
the resume. So the problem is that the internal speakers are not switched off.

I have traced this to an ALSA merge: 524df55725217. Unfortunately I get
boot failures when I try to bisect down into that merge.

Here's the bisect log:
# bad: [0d0fb0f9c5fddef4a10242fe3337f00f528a3099] Linux 2.6.34-rc4
# good: [724e6d3fe8003c3f60bf404bf22e4e331327c596] Linux 2.6.33-rc8
git bisect start 'v2.6.34-rc4' 'v2.6.33-rc8'
# bad: [94468080220162f74dc6ce5c3e95e5fec8022902]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
git bisect bad 94468080220162f74dc6ce5c3e95e5fec8022902
# bad: [524df55725217b13d5a232fb5badb5846418ea0e] Merge branch 'for-linus'
of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
git bisect bad 524df55725217b13d5a232fb5badb5846418ea0e
# good: [0f4533979473a456a8adb3869365e12c7a99cf65]
Merge branches 'futexes-for-linus', 'irq-core-for-linus' and
'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
git bisect good 0f4533979473a456a8adb3869365e12c7a99cf65

Cheers,
FJP

2010-04-19 07:47:39

by Takashi Iwai

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

At Sat, 17 Apr 2010 11:06:22 +0200,
Frans Pop wrote:
>
> On Friday 16 April 2010, Frans Pop wrote:
> > Scenario:
> > - suspend laptop while *un*docked, i.e. with laptop speakers in use
> > - dock laptop
> > - resume
> >
> > With 2.6.33 and earlier the sound would always come from the external
> > speakers connected to the docking station. But with 2.6.34-rc4 I get
> > sound still coming from the laptop's internal speakers, which is not
> > correct.
>
> The problem is slightly different than I thought. Turns out *both* the
> internal (laptop) and external (docking station) speakers are active after
> the resume. So the problem is that the internal speakers are not switched off.
>
> I have traced this to an ALSA merge: 524df55725217. Unfortunately I get
> boot failures when I try to bisect down into that merge.
>
> Here's the bisect log:
> # bad: [0d0fb0f9c5fddef4a10242fe3337f00f528a3099] Linux 2.6.34-rc4
> # good: [724e6d3fe8003c3f60bf404bf22e4e331327c596] Linux 2.6.33-rc8
> git bisect start 'v2.6.34-rc4' 'v2.6.33-rc8'
> # bad: [94468080220162f74dc6ce5c3e95e5fec8022902]
> Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
> git bisect bad 94468080220162f74dc6ce5c3e95e5fec8022902
> # bad: [524df55725217b13d5a232fb5badb5846418ea0e] Merge branch 'for-linus'
> of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
> git bisect bad 524df55725217b13d5a232fb5badb5846418ea0e
> # good: [0f4533979473a456a8adb3869365e12c7a99cf65]
> Merge branches 'futexes-for-linus', 'irq-core-for-linus' and
> 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
> git bisect good 0f4533979473a456a8adb3869365e12c7a99cf65

Could you give alsa-info.sh on your machine, preferably before/after
suspend on both working (2.6.33) and non-working kernels?

Also, you can try to copy sound/pci/hda/patch_analog.c from 2.6.33 to
2.6.34 to check whether it works. There shouldn't be many changes in
that file.


thanks,

Takashi

2010-04-19 11:38:23

by Frans Pop

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

On Monday 19 April 2010, Takashi Iwai wrote:
> Could you give alsa-info.sh on your machine, preferably before/after
> suspend on both working (2.6.33) and non-working kernels?

See files in attached tarball. Contents are:
* system boot (docked)
=> alsa-info.txt_3[34]_docked
* undock
=> alsa-info.txt_3[34]_undocked
* suspend - dock (while suspended) - resume
=> alsa-info.txt_3[34]_after_resume_docked
* undock - redock (this disables the internal speakers)
=> alsa-info.txt_34_after_resume_redocked

> Also, you can try to copy sound/pci/hda/patch_analog.c from 2.6.33 to
> 2.6.34 to check whether it works. There shouldn't be many changes in
> that file.

That fixes the problem.

Thanks,
FJP


Attachments:
(No filename) (706.00 B)
alsa-info.tgz (140.00 kB)
Download all attachments

2010-04-19 11:59:38

by Takashi Iwai

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

At Mon, 19 Apr 2010 13:38:14 +0200,
Frans Pop wrote:
>
> On Monday 19 April 2010, Takashi Iwai wrote:
> > Could you give alsa-info.sh on your machine, preferably before/after
> > suspend on both working (2.6.33) and non-working kernels?
>
> See files in attached tarball. Contents are:
> * system boot (docked)
> => alsa-info.txt_3[34]_docked
> * undock
> => alsa-info.txt_3[34]_undocked
> * suspend - dock (while suspended) - resume
> => alsa-info.txt_3[34]_after_resume_docked
> * undock - redock (this disables the internal speakers)
> => alsa-info.txt_34_after_resume_redocked
>
> > Also, you can try to copy sound/pci/hda/patch_analog.c from 2.6.33 to
> > 2.6.34 to check whether it works. There shouldn't be many changes in
> > that file.
>
> That fixes the problem.

Then my rough guess is

commit ea52bf260ecbb175339af3178c15788df21b7516
Author: Daniel T Chen <[email protected]>
Date: Sun Dec 27 18:48:29 2009 -0500

ALSA: hda: Add powerdown for Analog Devices HDA codecs

Could you try to revert it?


thanks,

Takashi

2010-04-19 12:14:59

by Takashi Iwai

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

At Mon, 19 Apr 2010 13:59:36 +0200,
I wrote:
>
> At Mon, 19 Apr 2010 13:38:14 +0200,
> Frans Pop wrote:
> >
> > On Monday 19 April 2010, Takashi Iwai wrote:
> > > Could you give alsa-info.sh on your machine, preferably before/after
> > > suspend on both working (2.6.33) and non-working kernels?
> >
> > See files in attached tarball. Contents are:
> > * system boot (docked)
> > => alsa-info.txt_3[34]_docked
> > * undock
> > => alsa-info.txt_3[34]_undocked
> > * suspend - dock (while suspended) - resume
> > => alsa-info.txt_3[34]_after_resume_docked
> > * undock - redock (this disables the internal speakers)
> > => alsa-info.txt_34_after_resume_redocked
> >
> > > Also, you can try to copy sound/pci/hda/patch_analog.c from 2.6.33 to
> > > 2.6.34 to check whether it works. There shouldn't be many changes in
> > > that file.
> >
> > That fixes the problem.
>
> Then my rough guess is
>
> commit ea52bf260ecbb175339af3178c15788df21b7516
> Author: Daniel T Chen <[email protected]>
> Date: Sun Dec 27 18:48:29 2009 -0500
>
> ALSA: hda: Add powerdown for Analog Devices HDA codecs
>
> Could you try to revert it?

Or how about the patch below?


Takashi

---
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 9cbd80c..2cf7d19 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -85,6 +85,9 @@ struct ad198x_spec {
const char **slave_sws;
};

+#define AD_HP_EVENT 0x01
+#define AD_MIC_EVENT 0x02
+
/*
* input MUX handling (common part)
*/
@@ -533,6 +536,11 @@ static int ad198x_resume(struct hda_codec *codec)
ad198x_init(codec);
snd_hda_codec_resume_amp(codec);
snd_hda_codec_resume_cache(codec);
+ if (codec->patch_ops.unsol_event) {
+ /* fake unsol events */
+ codec->patch_ops.unsol_event(codec, AD_HP_EVENT << 26);
+ codec->patch_ops.unsol_event(codec, AD_MIC_EVENT << 26);
+ }
return 0;
}
#endif
@@ -822,7 +830,7 @@ static void ad1986a_automic(struct hda_codec *codec)
present ? 0 : 2);
}

-#define AD1986A_MIC_EVENT 0x36
+#define AD1986A_MIC_EVENT AD_MIC_EVENT

static void ad1986a_automic_unsol_event(struct hda_codec *codec,
unsigned int res)
@@ -865,7 +873,7 @@ static void ad1986a_hp_automute(struct hda_codec *codec)
ad1986a_update_hp(codec);
}

-#define AD1986A_HP_EVENT 0x37
+#define AD1986A_HP_EVENT AD_HP_EVENT

static void ad1986a_hp_unsol_event(struct hda_codec *codec, unsigned int res)
{
@@ -1609,8 +1617,8 @@ static struct hda_amp_list ad1981_loopbacks[] = {
* speaker output enabled _and_ mute-LED off.
*/

-#define AD1981_HP_EVENT 0x37
-#define AD1981_MIC_EVENT 0x38
+#define AD1981_HP_EVENT AD_HP_EVENT
+#define AD1981_MIC_EVENT AD_MIC_EVENT

static struct hda_verb ad1981_hp_init_verbs[] = {
{0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x00 }, /* default off */
@@ -2599,7 +2607,7 @@ static struct hda_verb ad1988_laptop_hp_off[] = {
{ } /* end */
};

-#define AD1988_HP_EVENT 0x01
+#define AD1988_HP_EVENT AD_HP_EVENT

static struct hda_verb ad1988_laptop_init_verbs[] = {
/* Front, Surround, CLFE, side DAC; unmute as default */
@@ -3936,8 +3944,8 @@ static void ad1884a_hp_automic(struct hda_codec *codec)
present ? 0 : 1);
}

-#define AD1884A_HP_EVENT 0x37
-#define AD1884A_MIC_EVENT 0x36
+#define AD1884A_HP_EVENT AD_HP_EVENT
+#define AD1884A_MIC_EVENT AD_MIC_EVENT

/* unsolicited event for HP jack sensing */
static void ad1884a_hp_unsol_event(struct hda_codec *codec, unsigned int res)

2010-04-19 12:18:59

by Frans Pop

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

On Monday 19 April 2010, Takashi Iwai wrote:
> commit ea52bf260ecbb175339af3178c15788df21b7516
> Author: Daniel T Chen <[email protected]>
> Date: Sun Dec 27 18:48:29 2009 -0500
>
> ALSA: hda: Add powerdown for Analog Devices HDA codecs
>
> Could you try to revert it?

Yep, that's the culprit.

Let me know if a fix needs to be tested.

Thanks,
FJP

2010-04-19 12:39:51

by Frans Pop

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

On Monday 19 April 2010, Takashi Iwai wrote:
> Or how about the patch below?

That fixes the problem too.

Please add my:
Reported-and-tested-by: Frans Pop <[email protected]>

Cheers,
FJP

2010-04-19 12:53:32

by Takashi Iwai

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

At Mon, 19 Apr 2010 14:39:44 +0200,
Frans Pop wrote:
>
> On Monday 19 April 2010, Takashi Iwai wrote:
> > Or how about the patch below?
>
> That fixes the problem too.
>
> Please add my:
> Reported-and-tested-by: Frans Pop <[email protected]>

Thanks for a quick check. But I found that the patch isn't fully
correct.

The patch below should suffice instead of the previous one.
Could you check it again?


thanks,

Takashi

---
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 9cbd80c..afbe314 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -527,14 +527,6 @@ static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
ad198x_power_eapd(codec);
return 0;
}
-
-static int ad198x_resume(struct hda_codec *codec)
-{
- ad198x_init(codec);
- snd_hda_codec_resume_amp(codec);
- snd_hda_codec_resume_cache(codec);
- return 0;
-}
#endif

static struct hda_codec_ops ad198x_patch_ops = {
@@ -547,7 +539,6 @@ static struct hda_codec_ops ad198x_patch_ops = {
#endif
#ifdef SND_HDA_NEEDS_RESUME
.suspend = ad198x_suspend,
- .resume = ad198x_resume,
#endif
.reboot_notify = ad198x_shutup,
};

2010-04-19 14:58:43

by Frans Pop

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

On Monday 19 April 2010, Takashi Iwai wrote:
> Thanks for a quick check. But I found that the patch isn't fully
> correct.
>
> The patch below should suffice instead of the previous one.
> Could you check it again?

Works as well.

Reported-and-tested-by: Frans Pop <[email protected]>

2010-04-19 16:17:14

by Takashi Iwai

[permalink] [raw]
Subject: Re: [regression] Sound not transferred to docking station after resume from StR

At Mon, 19 Apr 2010 16:58:39 +0200,
Frans Pop wrote:
>
> On Monday 19 April 2010, Takashi Iwai wrote:
> > Thanks for a quick check. But I found that the patch isn't fully
> > correct.
> >
> > The patch below should suffice instead of the previous one.
> > Could you check it again?
>
> Works as well.
>
> Reported-and-tested-by: Frans Pop <[email protected]>

Thanks. Now applied to sound git tree.


Takashi