2008-02-11 20:58:58

by Matěj Laitl

[permalink] [raw]
Subject: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

Hi,
after upgrading from 2.6.24 to 2.6.25-rc1, I lost headphone-out sound output
of my Intel HDA card - it is quiet no matter what the mixer settings are.

After playing wit git bisect a bit, I narrowed it down to commit
f889fa91ad47e "[ALSA] hda-codec - Improve the auto-configuration". [1]
It works okay with tree as of previous commit 69b1f1e8337fc9.

First lines from /proc/asound/Intel/codec#0:
Codec: Realtek ALC262
Address: 0
Vendor Id: 0x10ec0262
Subsystem Id: 0x17340000
Revision Id: 0x100202
No Modem Function Group found
Default PCM:
rates [0x560]: 44100 48000 96000 192000
bits [0xe]: 16 20 24
formats [0x1]: PCM
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
GPIO: io=4, o=0, i=0, unsolicited=1, wake=0
IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0
IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0
IO[2]: enable=0, dir=0, wake=0, sticky=0, data=0
IO[3]: enable=0, dir=0, wake=0, sticky=0, data=0

The box is Fujitsu-Siemens Esprimo Mobile M9400 laptop.

[1]
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f889fa91ad47e6fcb530abf1184ca9f1473d3c72

Regards,
Matej Laitl


2008-02-12 10:13:35

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Mon, 11 Feb 2008 21:58:41 +0100,
Matej Laitl wrote:
>
> Hi,
> after upgrading from 2.6.24 to 2.6.25-rc1, I lost headphone-out sound output
> of my Intel HDA card - it is quiet no matter what the mixer settings are.
>
> After playing wit git bisect a bit, I narrowed it down to commit
> f889fa91ad47e "[ALSA] hda-codec - Improve the auto-configuration". [1]
> It works okay with tree as of previous commit 69b1f1e8337fc9.
>
> First lines from /proc/asound/Intel/codec#0:
> Codec: Realtek ALC262
> Address: 0
> Vendor Id: 0x10ec0262
> Subsystem Id: 0x17340000
> Revision Id: 0x100202
> No Modem Function Group found
> Default PCM:
> rates [0x560]: 44100 48000 96000 192000
> bits [0xe]: 16 20 24
> formats [0x1]: PCM
> Default Amp-In caps: N/A
> Default Amp-Out caps: N/A
> GPIO: io=4, o=0, i=0, unsolicited=1, wake=0
> IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0
> IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0
> IO[2]: enable=0, dir=0, wake=0, sticky=0, data=0
> IO[3]: enable=0, dir=0, wake=0, sticky=0, data=0
>
> The box is Fujitsu-Siemens Esprimo Mobile M9400 laptop.

Could you give the output of alsa-info.sh for both working and
non-working kernels?
http://hg.alsa-project.org/alsa/raw-file/tip/alsa-info.sh


thanks,

Takashi

2008-02-12 10:50:52

by Matěj Laitl

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

Takashi Iwai wrote:
> Matej Laitl wrote:
> > after upgrading from 2.6.24 to 2.6.25-rc1, I lost headphone-out sound
> > output of my Intel HDA card - it is quiet no matter what the mixer
> > settings are.
> >
> > (...)
> >
> > The box is Fujitsu-Siemens Esprimo Mobile M9400 laptop.
>
> Could you give the output of alsa-info.sh for both working and
> non-working kernels?

The locations of alsa-info.sh outputs:
no sound in headphones: http://pastebin.ca/901022
sound ok: http://pastebin.ca/901016

Both kernels are Linus' tree snapshots as of commit cc13e442952a347f7, the one
with working sound has just the f889fa91ad47e commit reverted.

Matej Laitl

2008-02-12 11:02:28

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Tue, 12 Feb 2008 11:50:36 +0100,
Matej Laitl wrote:
>
> Takashi Iwai wrote:
> > Matej Laitl wrote:
> > > after upgrading from 2.6.24 to 2.6.25-rc1, I lost headphone-out sound
> > > output of my Intel HDA card - it is quiet no matter what the mixer
> > > settings are.
> > >
> > > (...)
> > >
> > > The box is Fujitsu-Siemens Esprimo Mobile M9400 laptop.
> >
> > Could you give the output of alsa-info.sh for both working and
> > non-working kernels?
>
> The locations of alsa-info.sh outputs:
> no sound in headphones: http://pastebin.ca/901022
> sound ok: http://pastebin.ca/901016
>
> Both kernels are Linus' tree snapshots as of commit cc13e442952a347f7, the one
> with working sound has just the f889fa91ad47e commit reverted.

Thanks. It seems that your device has two headphone jacks according
to the BIOS setup, and this seems to be the problem.

Could you show the kernel messages like "autoconfig: line_outs..." for
both cases? This appears when build with CONFIG_SND_DEBUG=y.


Takashi

2008-02-12 11:35:00

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Tue, 12 Feb 2008 12:02:16 +0100,
I wrote:
>
> At Tue, 12 Feb 2008 11:50:36 +0100,
> Matej Laitl wrote:
> >
> > Takashi Iwai wrote:
> > > Matej Laitl wrote:
> > > > after upgrading from 2.6.24 to 2.6.25-rc1, I lost headphone-out sound
> > > > output of my Intel HDA card - it is quiet no matter what the mixer
> > > > settings are.
> > > >
> > > > (...)
> > > >
> > > > The box is Fujitsu-Siemens Esprimo Mobile M9400 laptop.
> > >
> > > Could you give the output of alsa-info.sh for both working and
> > > non-working kernels?
> >
> > The locations of alsa-info.sh outputs:
> > no sound in headphones: http://pastebin.ca/901022
> > sound ok: http://pastebin.ca/901016
> >
> > Both kernels are Linus' tree snapshots as of commit cc13e442952a347f7, the one
> > with working sound has just the f889fa91ad47e commit reverted.
>
> Thanks. It seems that your device has two headphone jacks according
> to the BIOS setup, and this seems to be the problem.
>
> Could you show the kernel messages like "autoconfig: line_outs..." for
> both cases? This appears when build with CONFIG_SND_DEBUG=y.

And the patch below may fix your problem. Give it a try.


Takashi

---

diff -r e84ee72676f0 sound/pci/hda/hda_codec.c
--- a/sound/pci/hda/hda_codec.c Tue Feb 12 12:11:36 2008 +0100
+++ b/sound/pci/hda/hda_codec.c Tue Feb 12 12:31:37 2008 +0100
@@ -2821,6 +2821,30 @@ int snd_hda_parse_pin_def_config(struct
}
}

+ /* FIX-UP:
+ * If no line-out is defined but multiple HPs are found,
+ * some of them might be the real line-outs.
+ */
+ if (!cfg->line_outs && cfg->hp_outs > 1) {
+ int i = 0;
+ while (i < cfg->hp_outs) {
+ /* The real HPs should have the sequence 0x0f */
+ if ((sequences_hp[i] & 0x0f) == 0x0f) {
+ i++;
+ continue;
+ }
+ /* Move it to the line-out table */
+ cfg->line_out_pins[cfg->line_outs] = cfg->hp_pins[i];
+ sequences_line_out[cfg->line_outs] = sequences_hp[i];
+ cfg->line_outs++;
+ cfg->hp_outs--;
+ memmove(cfg->hp_pins + i, cfg->hp_pins + i + 1,
+ sizeof(cfg->hp_pins[0]) * (cfg->hp_outs - i));
+ memmove(sequences_hp + i - 1, sequences_hp + i,
+ sizeof(sequences_hp[0]) * (cfg->hp_outs - i));
+ }
+ }
+
/* sort by sequence */
sort_pins_by_sequence(cfg->line_out_pins, sequences_line_out,
cfg->line_outs);

2008-02-12 11:37:01

by Matěj Laitl

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

Takashi Iwai wrote:
> Thanks. It seems that your device has two headphone jacks according
> to the BIOS setup, and this seems to be the problem.
>
> Could you show the kernel messages like "autoconfig: line_outs..." for
> both cases? This appears when build with CONFIG_SND_DEBUG=y.

Kernel with broken sound:
hda_codec: Unknown model for ALC262, trying auto-probe from BIOS...
autoconfig: line_outs=1 (0x14/0x0/0x0/0x0/0x0)
speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
hp_outs=2 (0x1b/0x15/0x0/0x0/0x0)
mono: mono_out=0x0
inputs: mic=0x18, fmic=0x19, line=0x0, fline=0x0, cd=0x0, aux=0x0

Kernel with fine sound:
hda_codec: Unknown model for ALC262, trying auto-probe from BIOS...
autoconfig: line_outs=1 (0x14/0x0/0x0/0x0/0x0)
speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
hp_outs=2 (0x15/0x1b/0x0/0x0/0x0)
mono: mono_out=0x0
inputs: mic=0x18, fmic=0x19, line=0x0, fline=0x0, cd=0x0, aux=0x0

The machine has just headphone-out and mic-in audio connector, but it is
equipped with port replicator connector, which may feature additional audio
ports. (and which I unfortunately do not own)

Thanks, Matej

2008-02-12 12:06:26

by Matěj Laitl

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

Takashi Iwai wrote:
> I wrote:
> > Thanks. ?It seems that your device has two headphone jacks according
> > to the BIOS setup, and this seems to be the problem.
> >
> > Could you show the kernel messages like "autoconfig: line_outs..." for
> > both cases? ?This appears when build with CONFIG_SND_DEBUG=y.
>
> And the patch below may fix your problem. ?Give it a try.

With your patch, the sound in headphone-out is working again, but surprisingly
the integrated loudspeakers stopped working! ;)

Also, new on/of control appeared in alsamixer - "Speaker", but unmuting it
(and unmuting all playback controls, plugging-out headphones) didn't have an
effect on non-working integrated loudspeakers.

Some kernel mesgs with your patch:
hda_codec: Unknown model for ALC262, trying auto-probe from BIOS...
autoconfig: line_outs=1 (0x1b/0x0/0x0/0x0/0x0)
speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
hp_outs=1 (0x15/0x1b/0x0/0x0/0x0)
mono: mono_out=0x0
inputs: mic=0x18, fmic=0x19, line=0x0, fline=0x0, cd=0x0, aux=0x0

alsa-info.sh output:
http://pastebin.ca/901089

Matej

2008-02-12 14:02:20

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Tue, 12 Feb 2008 13:06:08 +0100,
Matej Laitl wrote:
>
> Takashi Iwai wrote:
> > I wrote:
> > > Thanks. ?It seems that your device has two headphone jacks according
> > > to the BIOS setup, and this seems to be the problem.
> > >
> > > Could you show the kernel messages like "autoconfig: line_outs..." for
> > > both cases? ?This appears when build with CONFIG_SND_DEBUG=y.
> >
> > And the patch below may fix your problem. ?Give it a try.
>
> With your patch, the sound in headphone-out is working again, but surprisingly
> the integrated loudspeakers stopped working! ;)
>
> Also, new on/of control appeared in alsamixer - "Speaker", but unmuting it
> (and unmuting all playback controls, plugging-out headphones) didn't have an
> effect on non-working integrated loudspeakers.
>
> Some kernel mesgs with your patch:
> hda_codec: Unknown model for ALC262, trying auto-probe from BIOS...
> autoconfig: line_outs=1 (0x1b/0x0/0x0/0x0/0x0)
> speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
> hp_outs=1 (0x15/0x1b/0x0/0x0/0x0)
> mono: mono_out=0x0
> inputs: mic=0x18, fmic=0x19, line=0x0, fline=0x0, cd=0x0, aux=0x0
>
> alsa-info.sh output:
> http://pastebin.ca/901089

Thanks. There seems a couple of bugs in this auto-configuration
code. Try the additional patch below. This will unmute the
speaker-pin.

BTW, if the subsystem id were properly set by BIOS, you would have
also the speaker auto-mute feature, but yours doesn't have it. Blame
HP :)


Takashi

---

diff -r e84ee72676f0 sound/pci/hda/patch_realtek.c
--- a/sound/pci/hda/patch_realtek.c Tue Feb 12 12:11:36 2008 +0100
+++ b/sound/pci/hda/patch_realtek.c Tue Feb 12 14:54:51 2008 +0100
@@ -746,7 +746,6 @@ static void alc_sku_automute(struct hda_
static void alc_sku_automute(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
- unsigned int mute;
unsigned int present;
unsigned int hp_nid = spec->autocfg.hp_pins[0];
unsigned int sp_nid = spec->autocfg.speaker_pins[0];
@@ -756,16 +755,8 @@ static void alc_sku_automute(struct hda_
present = snd_hda_codec_read(codec, hp_nid, 0,
AC_VERB_GET_PIN_SENSE, 0);
spec->jack_present = (present & 0x80000000) != 0;
- if (spec->jack_present) {
- /* mute internal speaker */
- snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
- HDA_AMP_MUTE, HDA_AMP_MUTE);
- } else {
- /* unmute internal speaker if necessary */
- mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
- snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
- HDA_AMP_MUTE, mute);
- }
+ snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+ spec->jack_present ? 0 : PIN_OUT);
}

/* unsolicited event for HP jack sensing */
@@ -3486,15 +3477,20 @@ static int alc880_auto_create_analog_inp
return 0;
}

-static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
- hda_nid_t nid, int pin_type,
- int dac_idx)
-{
- /* set as output */
+static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
+ unsigned int pin_type)
+{
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
pin_type);
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
AMP_OUT_UNMUTE);
+}
+
+static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
+ hda_nid_t nid, int pin_type,
+ int dac_idx)
+{
+ alc_set_pin_output(codec, nid, pin_type);
/* need the manual connection? */
if (alc880_is_multi_pin(nid)) {
struct alc_spec *spec = codec->spec;
@@ -3616,9 +3612,12 @@ static int alc880_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc880_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc880_auto_init_multi_out(codec);
alc880_auto_init_extra_out(codec);
alc880_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

/*
@@ -4814,11 +4813,7 @@ static void alc260_auto_set_output_and_u
hda_nid_t nid, int pin_type,
int sel_idx)
{
- /* set as output */
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
- pin_type);
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
- AMP_OUT_UNMUTE);
+ alc_set_pin_output(codec, nid, pin_type);
/* need the manual connection? */
if (nid >= 0x12) {
int idx = nid - 0x12;
@@ -4965,8 +4960,11 @@ static int alc260_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc260_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc260_auto_init_multi_out(codec);
alc260_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -6201,15 +6199,11 @@ static void alc882_auto_set_output_and_u
struct alc_spec *spec = codec->spec;
int idx;

+ alc_set_pin_output(codec, nid, pin_type);
if (spec->multiout.dac_nids[dac_idx] == 0x25)
idx = 4;
else
idx = spec->multiout.dac_nids[dac_idx] - 2;
-
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
- pin_type);
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
- AMP_OUT_UNMUTE);
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);

}
@@ -6238,6 +6232,9 @@ static void alc882_auto_init_hp_out(stru
if (pin) /* connect to front */
/* use dac 0 */
alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

#define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -6313,9 +6310,12 @@ static int alc882_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc882_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc882_auto_init_multi_out(codec);
alc882_auto_init_hp_out(codec);
alc882_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

static int patch_alc882(struct hda_codec *codec)
@@ -7878,15 +7878,11 @@ static void alc883_auto_set_output_and_u
struct alc_spec *spec = codec->spec;
int idx;

+ alc_set_pin_output(codec, nid, pin_type);
if (spec->multiout.dac_nids[dac_idx] == 0x25)
idx = 4;
else
idx = spec->multiout.dac_nids[dac_idx] - 2;
-
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
- pin_type);
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
- AMP_OUT_UNMUTE);
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);

}
@@ -7915,6 +7911,9 @@ static void alc883_auto_init_hp_out(stru
if (pin) /* connect to front */
/* use dac 0 */
alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

#define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -7966,9 +7965,12 @@ static int alc883_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc883_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc883_auto_init_multi_out(codec);
alc883_auto_init_hp_out(codec);
alc883_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

static int patch_alc883(struct hda_codec *codec)
@@ -9144,9 +9146,12 @@ static int alc262_parse_auto_config(stru
/* init callback for auto-configuration model -- overriding the default init */
static void alc262_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc262_auto_init_multi_out(codec);
alc262_auto_init_hp_out(codec);
alc262_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

/*
@@ -10032,10 +10037,13 @@ static int alc268_parse_auto_config(stru
/* init callback for auto-configuration model -- overriding the default init */
static void alc268_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc268_auto_init_multi_out(codec);
alc268_auto_init_hp_out(codec);
alc268_auto_init_mono_speaker_out(codec);
alc268_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

/*
@@ -10504,9 +10512,12 @@ static int alc269_parse_auto_config(stru
/* init callback for auto-configuration model -- overriding the default init */
static void alc269_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc269_auto_init_multi_out(codec);
alc269_auto_init_hp_out(codec);
alc269_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

/*
@@ -11428,13 +11439,7 @@ static void alc861_auto_set_output_and_u
hda_nid_t nid,
int pin_type, int dac_idx)
{
- /* set as output */
-
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
- pin_type);
- snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
- AMP_OUT_UNMUTE);
-
+ alc_set_pin_output(codec, nid, pin_type);
}

static void alc861_auto_init_multi_out(struct hda_codec *codec)
@@ -11461,6 +11466,9 @@ static void alc861_auto_init_hp_out(stru
if (pin) /* connect to front */
alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
spec->multiout.dac_nids[0]);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

static void alc861_auto_init_analog_input(struct hda_codec *codec)
@@ -11533,9 +11541,12 @@ static int alc861_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc861_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc861_auto_init_multi_out(codec);
alc861_auto_init_hp_out(codec);
alc861_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -12396,11 +12407,7 @@ static void alc861vd_auto_set_output_and
static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
hda_nid_t nid, int pin_type, int dac_idx)
{
- /* set as output */
- snd_hda_codec_write(codec, nid, 0,
- AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
- snd_hda_codec_write(codec, nid, 0,
- AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
+ alc_set_pin_output(codec, nid, pin_type);
}

static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
@@ -12427,6 +12434,9 @@ static void alc861vd_auto_init_hp_out(st
pin = spec->autocfg.hp_pins[0];
if (pin) /* connect to front and use dac 0 */
alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

#define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -12630,9 +12640,12 @@ static int alc861vd_parse_auto_config(st
/* additional initialization for auto-configuration model */
static void alc861vd_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc861vd_auto_init_multi_out(codec);
alc861vd_auto_init_hp_out(codec);
alc861vd_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

static int patch_alc861vd(struct hda_codec *codec)
@@ -13452,11 +13465,7 @@ static void alc662_auto_set_output_and_u
hda_nid_t nid, int pin_type,
int dac_idx)
{
- /* set as output */
- snd_hda_codec_write(codec, nid, 0,
- AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
- snd_hda_codec_write(codec, nid, 0,
- AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
+ alc_set_pin_output(codec, nid, pin_type);
/* need the manual connection? */
if (alc880_is_multi_pin(nid)) {
struct alc_spec *spec = codec->spec;
@@ -13491,6 +13500,9 @@ static void alc662_auto_init_hp_out(stru
if (pin) /* connect to front */
/* use dac 0 */
alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

#define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -13568,9 +13580,12 @@ static int alc662_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc662_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc662_auto_init_multi_out(codec);
alc662_auto_init_hp_out(codec);
alc662_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

static int patch_alc662(struct hda_codec *codec)

2008-02-12 14:14:15

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Tue, 12 Feb 2008 15:02:09 +0100,
I wrote:
>
> At Tue, 12 Feb 2008 13:06:08 +0100,
> Matej Laitl wrote:
> >
> > Takashi Iwai wrote:
> > > I wrote:
> > > > Thanks. ?It seems that your device has two headphone jacks according
> > > > to the BIOS setup, and this seems to be the problem.
> > > >
> > > > Could you show the kernel messages like "autoconfig: line_outs..." for
> > > > both cases? ?This appears when build with CONFIG_SND_DEBUG=y.
> > >
> > > And the patch below may fix your problem. ?Give it a try.
> >
> > With your patch, the sound in headphone-out is working again, but surprisingly
> > the integrated loudspeakers stopped working! ;)
> >
> > Also, new on/of control appeared in alsamixer - "Speaker", but unmuting it
> > (and unmuting all playback controls, plugging-out headphones) didn't have an
> > effect on non-working integrated loudspeakers.
> >
> > Some kernel mesgs with your patch:
> > hda_codec: Unknown model for ALC262, trying auto-probe from BIOS...
> > autoconfig: line_outs=1 (0x1b/0x0/0x0/0x0/0x0)
> > speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
> > hp_outs=1 (0x15/0x1b/0x0/0x0/0x0)
> > mono: mono_out=0x0
> > inputs: mic=0x18, fmic=0x19, line=0x0, fline=0x0, cd=0x0, aux=0x0
> >
> > alsa-info.sh output:
> > http://pastebin.ca/901089
>
> Thanks. There seems a couple of bugs in this auto-configuration
> code. Try the additional patch below. This will unmute the
> speaker-pin.

This version might be slightly better...


Takashi

---

diff -r e84ee72676f0 sound/pci/hda/patch_realtek.c
--- a/sound/pci/hda/patch_realtek.c Tue Feb 12 12:11:36 2008 +0100
+++ b/sound/pci/hda/patch_realtek.c Tue Feb 12 15:14:17 2008 +0100
@@ -746,7 +746,6 @@ static void alc_sku_automute(struct hda_
static void alc_sku_automute(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
- unsigned int mute;
unsigned int present;
unsigned int hp_nid = spec->autocfg.hp_pins[0];
unsigned int sp_nid = spec->autocfg.speaker_pins[0];
@@ -756,16 +755,8 @@ static void alc_sku_automute(struct hda_
present = snd_hda_codec_read(codec, hp_nid, 0,
AC_VERB_GET_PIN_SENSE, 0);
spec->jack_present = (present & 0x80000000) != 0;
- if (spec->jack_present) {
- /* mute internal speaker */
- snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
- HDA_AMP_MUTE, HDA_AMP_MUTE);
- } else {
- /* unmute internal speaker if necessary */
- mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0);
- snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0,
- HDA_AMP_MUTE, mute);
- }
+ snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+ spec->jack_present ? 0 : PIN_OUT);
}

/* unsolicited event for HP jack sensing */
@@ -3486,15 +3477,20 @@ static int alc880_auto_create_analog_inp
return 0;
}

+static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
+ unsigned int pin_type)
+{
+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+ pin_type);
+ /* unmute pin */
+ snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, 0xff, 0x00);
+}
+
static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
hda_nid_t nid, int pin_type,
int dac_idx)
{
- /* set as output */
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
- pin_type);
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
- AMP_OUT_UNMUTE);
+ alc_set_pin_output(codec, nid, pin_type);
/* need the manual connection? */
if (alc880_is_multi_pin(nid)) {
struct alc_spec *spec = codec->spec;
@@ -3616,9 +3612,12 @@ static int alc880_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc880_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc880_auto_init_multi_out(codec);
alc880_auto_init_extra_out(codec);
alc880_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

/*
@@ -4814,11 +4813,7 @@ static void alc260_auto_set_output_and_u
hda_nid_t nid, int pin_type,
int sel_idx)
{
- /* set as output */
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
- pin_type);
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
- AMP_OUT_UNMUTE);
+ alc_set_pin_output(codec, nid, pin_type);
/* need the manual connection? */
if (nid >= 0x12) {
int idx = nid - 0x12;
@@ -4965,8 +4960,11 @@ static int alc260_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc260_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc260_auto_init_multi_out(codec);
alc260_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -6201,15 +6199,11 @@ static void alc882_auto_set_output_and_u
struct alc_spec *spec = codec->spec;
int idx;

+ alc_set_pin_output(codec, nid, pin_type);
if (spec->multiout.dac_nids[dac_idx] == 0x25)
idx = 4;
else
idx = spec->multiout.dac_nids[dac_idx] - 2;
-
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
- pin_type);
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
- AMP_OUT_UNMUTE);
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);

}
@@ -6238,6 +6232,9 @@ static void alc882_auto_init_hp_out(stru
if (pin) /* connect to front */
/* use dac 0 */
alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

#define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -6313,9 +6310,12 @@ static int alc882_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc882_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc882_auto_init_multi_out(codec);
alc882_auto_init_hp_out(codec);
alc882_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

static int patch_alc882(struct hda_codec *codec)
@@ -7878,15 +7878,11 @@ static void alc883_auto_set_output_and_u
struct alc_spec *spec = codec->spec;
int idx;

+ alc_set_pin_output(codec, nid, pin_type);
if (spec->multiout.dac_nids[dac_idx] == 0x25)
idx = 4;
else
idx = spec->multiout.dac_nids[dac_idx] - 2;
-
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
- pin_type);
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
- AMP_OUT_UNMUTE);
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);

}
@@ -7915,6 +7911,9 @@ static void alc883_auto_init_hp_out(stru
if (pin) /* connect to front */
/* use dac 0 */
alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

#define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -7966,9 +7965,12 @@ static int alc883_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc883_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc883_auto_init_multi_out(codec);
alc883_auto_init_hp_out(codec);
alc883_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

static int patch_alc883(struct hda_codec *codec)
@@ -9144,9 +9146,12 @@ static int alc262_parse_auto_config(stru
/* init callback for auto-configuration model -- overriding the default init */
static void alc262_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc262_auto_init_multi_out(codec);
alc262_auto_init_hp_out(codec);
alc262_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

/*
@@ -10032,10 +10037,13 @@ static int alc268_parse_auto_config(stru
/* init callback for auto-configuration model -- overriding the default init */
static void alc268_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc268_auto_init_multi_out(codec);
alc268_auto_init_hp_out(codec);
alc268_auto_init_mono_speaker_out(codec);
alc268_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

/*
@@ -10504,9 +10512,12 @@ static int alc269_parse_auto_config(stru
/* init callback for auto-configuration model -- overriding the default init */
static void alc269_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc269_auto_init_multi_out(codec);
alc269_auto_init_hp_out(codec);
alc269_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

/*
@@ -11428,13 +11439,7 @@ static void alc861_auto_set_output_and_u
hda_nid_t nid,
int pin_type, int dac_idx)
{
- /* set as output */
-
- snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
- pin_type);
- snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
- AMP_OUT_UNMUTE);
-
+ alc_set_pin_output(codec, nid, pin_type);
}

static void alc861_auto_init_multi_out(struct hda_codec *codec)
@@ -11461,6 +11466,9 @@ static void alc861_auto_init_hp_out(stru
if (pin) /* connect to front */
alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
spec->multiout.dac_nids[0]);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

static void alc861_auto_init_analog_input(struct hda_codec *codec)
@@ -11533,9 +11541,12 @@ static int alc861_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc861_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc861_auto_init_multi_out(codec);
alc861_auto_init_hp_out(codec);
alc861_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -12396,11 +12407,7 @@ static void alc861vd_auto_set_output_and
static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
hda_nid_t nid, int pin_type, int dac_idx)
{
- /* set as output */
- snd_hda_codec_write(codec, nid, 0,
- AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
- snd_hda_codec_write(codec, nid, 0,
- AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
+ alc_set_pin_output(codec, nid, pin_type);
}

static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
@@ -12427,6 +12434,9 @@ static void alc861vd_auto_init_hp_out(st
pin = spec->autocfg.hp_pins[0];
if (pin) /* connect to front and use dac 0 */
alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

#define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -12630,9 +12640,12 @@ static int alc861vd_parse_auto_config(st
/* additional initialization for auto-configuration model */
static void alc861vd_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc861vd_auto_init_multi_out(codec);
alc861vd_auto_init_hp_out(codec);
alc861vd_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

static int patch_alc861vd(struct hda_codec *codec)
@@ -13452,11 +13465,7 @@ static void alc662_auto_set_output_and_u
hda_nid_t nid, int pin_type,
int dac_idx)
{
- /* set as output */
- snd_hda_codec_write(codec, nid, 0,
- AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type);
- snd_hda_codec_write(codec, nid, 0,
- AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
+ alc_set_pin_output(codec, nid, pin_type);
/* need the manual connection? */
if (alc880_is_multi_pin(nid)) {
struct alc_spec *spec = codec->spec;
@@ -13491,6 +13500,9 @@ static void alc662_auto_init_hp_out(stru
if (pin) /* connect to front */
/* use dac 0 */
alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
+ pin = spec->autocfg.speaker_pins[0];
+ if (pin)
+ alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
}

#define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
@@ -13568,9 +13580,12 @@ static int alc662_parse_auto_config(stru
/* additional initialization for auto-configuration model */
static void alc662_auto_init(struct hda_codec *codec)
{
+ struct alc_spec *spec = codec->spec;
alc662_auto_init_multi_out(codec);
alc662_auto_init_hp_out(codec);
alc662_auto_init_analog_input(codec);
+ if (spec->unsol_event)
+ alc_sku_automute(codec);
}

static int patch_alc662(struct hda_codec *codec)

2008-02-12 15:27:59

by Matěj Laitl

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

Takashi Iwai wrote:
> Takashi Iwai wrote:
> > Matej Laitl wrote:
> > > With your patch, the sound in headphone-out is working again, but
> > > surprisingly the integrated loudspeakers stopped working! ;)
> > >
> > > Also, new on/of control appeared in alsamixer - "Speaker", but unmuting
> > > it (and unmuting all playback controls, plugging-out headphones) didn't
> > > have an effect on non-working integrated loudspeakers.
> > >
> > > Some kernel mesgs with your patch:
> > > hda_codec: Unknown model for ALC262, trying auto-probe from BIOS...
> > > autoconfig: line_outs=1 (0x1b/0x0/0x0/0x0/0x0)
> > > ? ?speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
> > > ? ?hp_outs=1 (0x15/0x1b/0x0/0x0/0x0)
> > > ? ?mono: mono_out=0x0
> > > ? ?inputs: mic=0x18, fmic=0x19, line=0x0, fline=0x0, cd=0x0, aux=0x0
> > >
> > > alsa-info.sh output:
> > > http://pastebin.ca/901089
> >
> > Thanks. ?There seems a couple of bugs in this auto-configuration
> > code. ?Try the additional patch below. ?This will unmute the
> > speaker-pin.
>
> This version might be slightly better...

Yes, this "slightly better" patch applied on top of your first patch against
hda_codec.c did the trick, but with some side-effects:
* the "Speaker" switch now mutes/unmutes speakers
* muting/unmuting "Front" channel now has zero effect (in 2.6.24 it had the
same effect as the "Speaker" switch now has)
* changing volume on "Front" channel now affects volume in headphones (was not
so in 2.6.24)

So there are now 3 vol controls that affect both speakers and headphones:
* Master (which appeared somewhere between 2.6.24 and .25-rc1), when set to
zero, the sound is still audible in speakers and headphones
* PCM, working as expected (0 volume = no sound)
* Front (0 volume = still audible sound)

So it is usable now (and those Speaker and Headphones on/off switches make
sense), but kinda suboptimal. (is it my BIOS who is to blame?)

Thanks, Matej

2008-02-12 17:15:27

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Tue, 12 Feb 2008 16:27:44 +0100,
Matej Laitl wrote:
>
> Takashi Iwai wrote:
> > Takashi Iwai wrote:
> > > Matej Laitl wrote:
> > > > With your patch, the sound in headphone-out is working again, but
> > > > surprisingly the integrated loudspeakers stopped working! ;)
> > > >
> > > > Also, new on/of control appeared in alsamixer - "Speaker", but unmuting
> > > > it (and unmuting all playback controls, plugging-out headphones) didn't
> > > > have an effect on non-working integrated loudspeakers.
> > > >
> > > > Some kernel mesgs with your patch:
> > > > hda_codec: Unknown model for ALC262, trying auto-probe from BIOS...
> > > > autoconfig: line_outs=1 (0x1b/0x0/0x0/0x0/0x0)
> > > > ? ?speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
> > > > ? ?hp_outs=1 (0x15/0x1b/0x0/0x0/0x0)
> > > > ? ?mono: mono_out=0x0
> > > > ? ?inputs: mic=0x18, fmic=0x19, line=0x0, fline=0x0, cd=0x0, aux=0x0
> > > >
> > > > alsa-info.sh output:
> > > > http://pastebin.ca/901089
> > >
> > > Thanks. ?There seems a couple of bugs in this auto-configuration
> > > code. ?Try the additional patch below. ?This will unmute the
> > > speaker-pin.
> >
> > This version might be slightly better...
>
> Yes, this "slightly better" patch applied on top of your first patch against
> hda_codec.c did the trick, but with some side-effects:
> * the "Speaker" switch now mutes/unmutes speakers
> * muting/unmuting "Front" channel now has zero effect (in 2.6.24 it had the
> same effect as the "Speaker" switch now has)
> * changing volume on "Front" channel now affects volume in headphones (was not
> so in 2.6.24)

This is what your BIOS sets up. The main output is connected to the
docking station. That's why "Front" (a silly name for ALC262; it
should read "Line Out", maybe will be renamed in later versions)
switch doesn't work.
OTOH, all outputs (speaker, headphone and line-outs) use the same DAC,
and this is controlled via line-out volume, i.e. "Front" volume.

> So there are now 3 vol controls that affect both speakers and headphones:
> * Master (which appeared somewhere between 2.6.24 and .25-rc1), when set to
> zero, the sound is still audible in speakers and headphones

This must be the behavior of the codec chip... Did "Front" volume 0
mute in the earlier version? If not, it actually doesn't mute with
the lowest volume. Use the master switch to mute.

Anyway, attach the alsa-info.sh output at the moment Master volume is
zero.

> * PCM, working as expected (0 volume = no sound)
> * Front (0 volume = still audible sound)
>
> So it is usable now (and those Speaker and Headphones on/off switches make
> sense), but kinda suboptimal. (is it my BIOS who is to blame?)

Yep. For the perfect solution, you'd need to create a static "patch"
for this particular model instead of auto-configuration. Then you can
adjust everything as you like.


Takashi

2008-02-12 18:24:55

by Matěj Laitl

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

Takashi Iwai wrote:
> Matej Laitl wrote:
> > Yes, this "slightly better" patch applied on top of your first patch
> > against hda_codec.c did the trick, but with some side-effects:
> > * the "Speaker" switch now mutes/unmutes speakers
> > * muting/unmuting "Front" channel now has zero effect (in 2.6.24 it had
> > the same effect as the "Speaker" switch now has)
> > * changing volume on "Front" channel now affects volume in headphones
> > (was not so in 2.6.24)
>
> This is what your BIOS sets up. The main output is connected to the
> docking station. That's why "Front" (a silly name for ALC262; it
> should read "Line Out", maybe will be renamed in later versions)
> switch doesn't work.
> OTOH, all outputs (speaker, headphone and line-outs) use the same DAC,
> and this is controlled via line-out volume, i.e. "Front" volume.

I was actually wrong when saying the "Front" channel did not influence HP-out
in 2.6.24 - it did, so no regressions here.

> > So there are now 3 vol controls that affect both speakers and headphones:
> > * Master (which appeared somewhere between 2.6.24 and .25-rc1), when set
> > to zero, the sound is still audible in speakers and headphones
>
> This must be the behavior of the codec chip... Did "Front" volume 0
> mute in the earlier version? If not, it actually doesn't mute with
> the lowest volume. Use the master switch to mute.
>
> Anyway, attach the alsa-info.sh output at the moment Master volume is
> zero.

No, setting Master and/or Front channel to 0% did not mute audio in any
version I used.

I'm now listening to music with Master=0% and Front=0%, the sound is at well
audible volume. Pastebin for this configuraion is here:
http://pastebin.ca/901459

However I don't consider it a problem, it's mutable by PCM and HP/Speaker
switches. Funny thing is that resulting volume of those 3 setting is equal:
* Master=0, Front=0
* Master=100%, Front=0
* Master=0, Front=100%
But when both set to let's say 50, changing one of these audibly affects
resulting volume.

> > * PCM, working as expected (0 volume = no sound)
> > * Front (0 volume = still audible sound)
> >
> > So it is usable now (and those Speaker and Headphones on/off switches
> > make sense), but kinda suboptimal. (is it my BIOS who is to blame?)
>
> Yep. For the perfect solution, you'd need to create a static "patch"
> for this particular model instead of auto-configuration. Then you can
> adjust everything as you like.

Would it be easy to do this in a robust way? If not, it's not worth it.

On a side note, I experience increased noise when not playing anything during
2.6.24 -> .25-rc1 upgrade, but this is probably completly unrelated to
today's problem.

Anyways, thanks for your effort and patches, Takashi.

Matej Laitl

2008-02-12 22:58:06

by Matěj Laitl

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

On Tuesday 12 of February 2008 19:24:35 Matej Laitl wrote:
> > > Yes, this "slightly better" patch applied on top of your first patch
> > > against hda_codec.c did the trick, but with some side-effects:
> > > (...)

Now I just found that the new "Speaker" switch forgets it's value from time to
time, ie. it's muted, you go and have lunch, and when you get back and start
the music, it's unmuted. It is probably related to aggressive hda-codec
powersaving, which I have enabled and set to 20 secs.

Matej

2008-02-13 11:00:19

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Tue, 12 Feb 2008 23:57:46 +0100,
Matej Laitl wrote:
>
> On Tuesday 12 of February 2008 19:24:35 Matej Laitl wrote:
> > > > Yes, this "slightly better" patch applied on top of your first patch
> > > > against hda_codec.c did the trick, but with some side-effects:
> > > > (...)
>
> Now I just found that the new "Speaker" switch forgets it's value from time to
> time, ie. it's muted, you go and have lunch, and when you get back and start
> the music, it's unmuted. It is probably related to aggressive hda-codec
> powersaving, which I have enabled and set to 20 secs.

Hm, does the patch below have any influence?
If the problem still persists, please take alsa-info.sh snapshots
before and after power-saving.


Takashi

---

diff -r f4f3c5e8931a sound/pci/hda/patch_realtek.c
--- a/sound/pci/hda/patch_realtek.c Tue Feb 12 18:37:26 2008 +0100
+++ b/sound/pci/hda/patch_realtek.c Wed Feb 13 12:01:09 2008 +0100
@@ -2306,6 +2306,23 @@ static int alc_init(struct hda_codec *co
return 0;
}

+#ifdef CONFIG_PM
+static int alc_resume(struct hda_codec *codec)
+{
+ struct alc_spec *spec = codec->spec;
+ unsigned int i;
+
+ for (i = 0; i < spec->num_init_verbs; i++)
+ snd_hda_sequence_write(codec, spec->init_verbs[i]);
+ snd_hda_codec_resume_amp(codec);
+ snd_hda_codec_resume_cache(codec);
+ /* call init hook at last */
+ if (spec->init_hook)
+ spec->init_hook(codec);
+ return 0;
+}
+#endif
+
static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
{
struct alc_spec *spec = codec->spec;
@@ -2584,6 +2601,9 @@ static struct hda_codec_ops alc_patch_op
.init = alc_init,
.free = alc_free,
.unsol_event = alc_unsol_event,
+#ifdef CONFIG_PM
+ .resume = alc_resume,
+#endif
#ifdef CONFIG_SND_HDA_POWER_SAVE
.check_power_status = alc_check_power_status,
#endif

2008-02-13 11:01:48

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Tue, 12 Feb 2008 19:24:35 +0100,
Matej Laitl wrote:
>
> > > So there are now 3 vol controls that affect both speakers and headphones:
> > > * Master (which appeared somewhere between 2.6.24 and .25-rc1), when set
> > > to zero, the sound is still audible in speakers and headphones
> >
> > This must be the behavior of the codec chip... Did "Front" volume 0
> > mute in the earlier version? If not, it actually doesn't mute with
> > the lowest volume. Use the master switch to mute.
> >
> > Anyway, attach the alsa-info.sh output at the moment Master volume is
> > zero.
>
> No, setting Master and/or Front channel to 0% did not mute audio in any
> version I used.
>
> I'm now listening to music with Master=0% and Front=0%, the sound is at well
> audible volume. Pastebin for this configuraion is here:
> http://pastebin.ca/901459

Thanks. The amp values in the codec are indeed set to zero, so this
is the minimal volume level, but the codec chip apparently doesn't
mute the sound.

> However I don't consider it a problem, it's mutable by PCM and HP/Speaker
> switches. Funny thing is that resulting volume of those 3 setting is equal:
> * Master=0, Front=0
> * Master=100%, Front=0
> * Master=0, Front=100%
> But when both set to let's say 50, changing one of these audibly affects
> resulting volume.

It's because the master volume is implemented virtually to bind
several mixer volumes together. The codec chip has no corresponding
functionality.


Takashi

2008-02-13 12:06:10

by Matěj Laitl

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

On Wednesday 13 of February 2008 11:59:58 Takashi Iwai wrote:
> > Now I just found that the new "Speaker" switch forgets it's value from
> > time to time, ie. it's muted, you go and have lunch, and when you get
> > back and start the music, it's unmuted. It is probably related to
> > aggressive hda-codec powersaving, which I have enabled and set to 20
> > secs.
>
> Hm, does the patch below have any influence?
> If the problem still persists, please take alsa-info.sh snapshots
> before and after power-saving.

This patch did not have any effect. (i haven't tested suspend-to-ram)

alsa-info before powersaving (speaker silent, mixer says: Speaker=MM):
http://pastebin.ca/902330

alsa-info after powersaving (speaker loud, mixer says: Speaker=MM):
http://pastebin.ca/902332

2008-02-13 13:06:44

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Wed, 13 Feb 2008 13:05:48 +0100,
Matej Laitl wrote:
>
> On Wednesday 13 of February 2008 11:59:58 Takashi Iwai wrote:
> > > Now I just found that the new "Speaker" switch forgets it's value from
> > > time to time, ie. it's muted, you go and have lunch, and when you get
> > > back and start the music, it's unmuted. It is probably related to
> > > aggressive hda-codec powersaving, which I have enabled and set to 20
> > > secs.
> >
> > Hm, does the patch below have any influence?
> > If the problem still persists, please take alsa-info.sh snapshots
> > before and after power-saving.
>
> This patch did not have any effect. (i haven't tested suspend-to-ram)
>
> alsa-info before powersaving (speaker silent, mixer says: Speaker=MM):
> http://pastebin.ca/902330
>
> alsa-info after powersaving (speaker loud, mixer says: Speaker=MM):
> http://pastebin.ca/902332

Oh, it's my thinko. The init routine shouldn't update the amp cache.

The patch below should fix this problem. Actually it reverts the code
to my first patch.


Takashi

---

diff -r f4f3c5e8931a pci/hda/patch_realtek.c
--- a/pci/hda/patch_realtek.c Tue Feb 12 18:37:26 2008 +0100
+++ b/pci/hda/patch_realtek.c Wed Feb 13 14:06:44 2008 +0100
@@ -3489,7 +3489,8 @@ static void alc_set_pin_output(struct hd
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
pin_type);
/* unmute pin */
- snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, 0xff, 0x00);
+ snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
+ AMP_OUT_UNMUTE);
}

static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,

2008-02-13 15:00:45

by Matěj Laitl

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

On Wednesday 13 of February 2008 14:06:20 Takashi Iwai wrote:
> > This patch did not have any effect. (i haven't tested suspend-to-ram)
> >
> > alsa-info before powersaving (speaker silent, mixer says: Speaker=MM):
> > http://pastebin.ca/902330
> >
> > alsa-info after powersaving (speaker loud, mixer says: Speaker=MM):
> > http://pastebin.ca/902332
>
> Oh, it's my thinko. ?The init routine shouldn't update the amp cache.
>
> The patch below should fix this problem. ?Actually it reverts the code
> to my first patch.

Eh, this one wasn't successful. The symptoms are the same, and the diff
between alsa-info before and after powersaving remained also the same:
--- alsa-info.1.txt 2008-02-13 15:56:18.000000000 +0100
+++ alsa-info.2.txt 2008-02-13 15:58:15.000000000 +0100
@@ -3,7 +3,7 @@
!!ALSA Information Script v 0.4.36
!!################################

-!!Script ran on: St ?no 13 15:56:18 CET 2008
+!!Script ran on: St ?no 13 15:58:14 CET 2008


!!Linux Distribution
@@ -200,7 +200,7 @@
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
Amp-In vals: [0x00 0x00] [0x00 0x00]
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
- Amp-Out vals: [0x80 0x80]
+ Amp-Out vals: [0x00 0x00]
Pincap 0x083e: IN OUT HP Detect Trigger
Pin Default 0x99130120: [Fixed] Speaker at Int ATAPI
Conn = ATAPI, Color = Unknown
@@ -356,7 +356,7 @@

crw-rw---- 1 root audio 116, 0 2008-02-13 15:48 /dev/snd/controlC0
crw-rw---- 1 root audio 116, 24 2008-02-13 15:48 /dev/snd/pcmC0D0c
-crw-rw---- 1 root audio 116, 16 2008-02-13 15:55 /dev/snd/pcmC0D0p
+crw-rw---- 1 root audio 116, 16 2008-02-13 15:58 /dev/snd/pcmC0D0p
crw-rw---- 1 root audio 116, 30 2008-02-13 15:48 /dev/snd/pcmC0D6c
crw-rw---- 1 root audio 116, 22 2008-02-13 15:48 /dev/snd/pcmC0D6p
crw-rw---- 1 root audio 116, 1 2008-02-13 15:49 /dev/snd/seq

2008-02-13 15:26:00

by Takashi Iwai

[permalink] [raw]
Subject: Re: [ALSA] HDA: no sound in headphone-out caused by commit f889fa91ad47e (2.6.25-rc1 regression)

At Wed, 13 Feb 2008 16:00:21 +0100,
Matej Laitl wrote:
>
> On Wednesday 13 of February 2008 14:06:20 Takashi Iwai wrote:
> > > This patch did not have any effect. (i haven't tested suspend-to-ram)
> > >
> > > alsa-info before powersaving (speaker silent, mixer says: Speaker=MM):
> > > http://pastebin.ca/902330
> > >
> > > alsa-info after powersaving (speaker loud, mixer says: Speaker=MM):
> > > http://pastebin.ca/902332
> >
> > Oh, it's my thinko. ?The init routine shouldn't update the amp cache.
> >
> > The patch below should fix this problem. ?Actually it reverts the code
> > to my first patch.
>
> Eh, this one wasn't successful. The symptoms are the same, and the diff
> between alsa-info before and after powersaving remained also the same:

Did you revert the test patch (http://lkml.org/lkml/2008/2/13/165)
before the last patch? That test patch is just harmful.


Takashi