[alsa-devel] patch_realtek: support Vaio Type G
Hi Takashi,
my laptop (Vaio Type G) used to work (although the valume was pretty low) with model=hippo until 2.6.29 then from 2.6.30 it stopped being supported throwing this message: hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x01570900
I recently found this rather old post[1] that has a patch to patch_realtek.c that adds an additional model and actually makes my soundcard happy again.
I forward ported to the current kernel (2.6.32-rc7) and renamed variables/functions a little bit to make it less specific. There might be better way of supporting my soundcard anyway this is one as far as I can say. I attached the output of alsa-info.sh just in case.
Not sure how signing-off or attribution could work in this case and honestly my japanese language is quite weak to be able to contact the author. If you want I can send a properly signed-off version, in any case it would be great if you could merge it and push it to Linus.
Thanks [1]: http://blog.livedoor.jp/yoyo_real/archives/51872668.html --- diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ff20048..d47f5f5 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -99,6 +99,7 @@ enum { ALC262_HP_RP5700, ALC262_BENQ_ED8, ALC262_SONY_ASSAMD, + ALC262_SONY_VGN_G, ALC262_BENQ_T31, ALC262_ULTRA, ALC262_LENOVO_3000, @@ -10329,6 +10330,17 @@ static struct snd_kcontrol_new alc262_sony_mixer[] = { { } /* end */ };
+static struct snd_kcontrol_new alc262_sony_vgn_g_mixer[] = { + HDA_CODEC_VOLUME_MONO("Front Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE_MONO("Front Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), + HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), + { } /* end */ +}; + static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), ALC262_HIPPO_MASTER_SWITCH, @@ -10459,7 +10471,6 @@ static struct hda_verb alc262_init_verbs[] = { {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, - { } };
@@ -10489,6 +10500,52 @@ static struct hda_verb alc262_sony_unsol_verbs[] = { {} };
+static struct hda_verb alc262_sony_vgn_g_unsol_verbs[] = { + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, + {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + {} +}; + +static struct hda_input_mux alc262_sony_vgn_g_capture_source = { + .num_items = 1, + .items = { + { "Mic", 0x0 }, + }, +}; + +/* mute/unmute sony VGN-G 0x16 internal speaker 0x15 headphone */ +static void alc262_sony_vgn_g_automute(struct hda_codec *codec) +{ + struct alc_spec *spec = codec->spec; + unsigned int mute; + unsigned int present; + + /* need to execute and sync at first */ + snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); + present = snd_hda_codec_read(codec, 0x15, 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, 0x16, HDA_OUTPUT, 0, + HDA_AMP_MUTE, HDA_AMP_MUTE); + } else { + /* unmute internal speaker if necessary */ + mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); + snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, + HDA_AMP_MUTE, mute); + } +} + +static void alc262_sony_vgn_g_unsol_event(struct hda_codec *codec, + unsigned int res) +{ + if ((res >> 26) != ALC880_HP_EVENT) + return; + alc262_sony_vgn_g_automute(codec); +} + static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), @@ -11423,6 +11480,7 @@ static const char *alc262_models[ALC262_MODEL_LAST] = { [ALC262_BENQ_ED8] = "benq", [ALC262_BENQ_T31] = "benq-t31", [ALC262_SONY_ASSAMD] = "sony-assamd", + [ALC262_SONY_VGN_G] = "sony-vgn-g", [ALC262_TOSHIBA_S06] = "toshiba-s06", [ALC262_TOSHIBA_RX1] = "toshiba-rx1", [ALC262_ULTRA] = "ultra", @@ -11456,6 +11514,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { ALC262_HP_TC_T5735), SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), + SND_PCI_QUIRK(0x104d, 0x8208, "Sony VGN-G", ALC262_SONY_VGN_G), SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ @@ -11613,6 +11672,18 @@ static struct alc_config_preset alc262_presets[] = { .setup = alc262_hippo_setup, .init_hook = alc262_hippo_automute, }, + [ALC262_SONY_VGN_G] = { + .mixers = { alc262_sony_vgn_g_mixer }, + .init_verbs = { alc262_init_verbs, alc262_sony_vgn_g_unsol_verbs }, + .num_dacs = ARRAY_SIZE(alc262_dac_nids), + .dac_nids = alc262_dac_nids, + .hp_nid = 0x03, + .num_channel_mode = ARRAY_SIZE(alc262_modes), + .channel_mode = alc262_modes, + .input_mux = &alc262_sony_vgn_g_capture_source, + .unsol_event = alc262_sony_vgn_g_unsol_event, + .init_hook = alc262_sony_vgn_g_automute, + }, [ALC262_BENQ_T31] = { .mixers = { alc262_benq_t31_mixer }, .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
At Mon, 16 Nov 2009 23:02:27 +0900, Mattia Dongili wrote:
Hi Takashi,
my laptop (Vaio Type G) used to work (although the valume was pretty low) with model=hippo until 2.6.29 then from 2.6.30 it stopped being supported throwing this message: hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x01570900
Still doesn't work 2.6.32-rc7 without your patch?
thanks,
Takashi
On Mon, Nov 16, 2009 at 03:42:03PM +0100, Takashi Iwai wrote:
At Mon, 16 Nov 2009 23:02:27 +0900, Mattia Dongili wrote:
Hi Takashi,
my laptop (Vaio Type G) used to work (although the valume was pretty low) with model=hippo until 2.6.29 then from 2.6.30 it stopped being supported throwing this message: hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x01570900
Still doesn't work 2.6.32-rc7 without your patch?
No, now tested on .32-rc7 and model=hippo still doesn't work. I have to admit thought that I see
[ 286.236022] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21 [ 286.236114] HDA Intel 0000:00:1b.0: setting latency timer to 64 [ 287.392510] hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x015b8000
even with my patch. But at least I get sound.
Thanks
At Tue, 17 Nov 2009 07:47:56 +0900, Mattia Dongili wrote:
On Mon, Nov 16, 2009 at 03:42:03PM +0100, Takashi Iwai wrote:
At Mon, 16 Nov 2009 23:02:27 +0900, Mattia Dongili wrote:
Hi Takashi,
my laptop (Vaio Type G) used to work (although the valume was pretty low) with model=hippo until 2.6.29 then from 2.6.30 it stopped being supported throwing this message: hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x01570900
Still doesn't work 2.6.32-rc7 without your patch?
No, now tested on .32-rc7 and model=hippo still doesn't work.
What about model=auto?
I have to admit thought that I see
[ 286.236022] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21 [ 286.236114] HDA Intel 0000:00:1b.0: setting latency timer to 64 [ 287.392510] hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x015b8000
even with my patch. But at least I get sound.
The message above is usually pretty harmless, and unlikely relevant with your problem.
Could you give alsa-info.sh outputs on both vanilla 2.6.32-rc7 kernel, with model=auto, and with your patch?
thanks,
Takashi
On Tue, Nov 17, 2009 at 07:40:12AM +0100, Takashi Iwai wrote:
At Tue, 17 Nov 2009 07:47:56 +0900, Mattia Dongili wrote:
On Mon, Nov 16, 2009 at 03:42:03PM +0100, Takashi Iwai wrote:
At Mon, 16 Nov 2009 23:02:27 +0900, Mattia Dongili wrote:
Hi Takashi,
my laptop (Vaio Type G) used to work (although the valume was pretty low) with model=hippo until 2.6.29 then from 2.6.30 it stopped being supported throwing this message: hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x01570900
Still doesn't work 2.6.32-rc7 without your patch?
No, now tested on .32-rc7 and model=hippo still doesn't work.
What about model=auto?
err hmmm... well it works! I thought that model=auto was the same as no parameter at all so haven't tried it. Sorry about the noise.
I have to admit thought that I see
[ 286.236022] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21 [ 286.236114] HDA Intel 0000:00:1b.0: setting latency timer to 64 [ 287.392510] hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x015b8000
even with my patch. But at least I get sound.
The message above is usually pretty harmless, and unlikely relevant with your problem.
Could you give alsa-info.sh outputs on both vanilla 2.6.32-rc7 kernel, with model=auto, and with your patch?
in case you still want it, it's attached
Thanks again
At Tue, 17 Nov 2009 20:15:37 +0900, Mattia Dongili wrote:
On Tue, Nov 17, 2009 at 07:40:12AM +0100, Takashi Iwai wrote:
At Tue, 17 Nov 2009 07:47:56 +0900, Mattia Dongili wrote:
On Mon, Nov 16, 2009 at 03:42:03PM +0100, Takashi Iwai wrote:
At Mon, 16 Nov 2009 23:02:27 +0900, Mattia Dongili wrote:
Hi Takashi,
my laptop (Vaio Type G) used to work (although the valume was pretty low) with model=hippo until 2.6.29 then from 2.6.30 it stopped being supported throwing this message: hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x01570900
Still doesn't work 2.6.32-rc7 without your patch?
No, now tested on .32-rc7 and model=hippo still doesn't work.
What about model=auto?
err hmmm... well it works! I thought that model=auto was the same as no parameter at all so haven't tried it. Sorry about the noise.
Good to hear. You are partly right -- the model=auto isn't always the default. If a quirk is already defined in the driver, another model is picked up.
I guess the problem is that current quirk for your device doesn't work.
I have to admit thought that I see
[ 286.236022] HDA Intel 0000:00:1b.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21 [ 286.236114] HDA Intel 0000:00:1b.0: setting latency timer to 64 [ 287.392510] hda-intel: azx_get_response timeout, switching to polling mode: last cmd=0x015b8000
even with my patch. But at least I get sound.
The message above is usually pretty harmless, and unlikely relevant with your problem.
Could you give alsa-info.sh outputs on both vanilla 2.6.32-rc7 kernel, with model=auto, and with your patch?
in case you still want it, it's attached
Thanks.
The fix patch is below. Could you test it without model option?
I think we can get rid of the fallback of model=sony-assamd since now model=auto works almost well as long as the BIOS pins are correct.
Takashi
--- diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ef7d210..ba339d7 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -11470,6 +11470,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), + SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
On Tue, Nov 17, 2009 at 12:21:17PM +0100, Takashi Iwai wrote:
At Tue, 17 Nov 2009 20:15:37 +0900, Mattia Dongili wrote:
On Tue, Nov 17, 2009 at 07:40:12AM +0100, Takashi Iwai wrote:
At Tue, 17 Nov 2009 07:47:56 +0900, Mattia Dongili wrote:
On Mon, Nov 16, 2009 at 03:42:03PM +0100, Takashi Iwai wrote:
...
What about model=auto?
err hmmm... well it works! I thought that model=auto was the same as no parameter at all so haven't tried it. Sorry about the noise.
Good to hear. You are partly right -- the model=auto isn't always the default. If a quirk is already defined in the driver, another model is picked up.
I guess the problem is that current quirk for your device doesn't work.
...
The fix patch is below. Could you test it without model option?
I think we can get rid of the fallback of model=sony-assamd since now model=auto works almost well as long as the BIOS pins are correct.
Great, this works fine for me, I can't speak for sony-assamd specific models. Feel free to ad my Tested-by: Mattia Dongili malattia@linux.it Thanks
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ef7d210..ba339d7 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -11470,6 +11470,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
- SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
participants (2)
-
Mattia Dongili
-
Takashi Iwai