[alsa-devel] Samsung P50 Heaphone Jack-Sense not working with latest ALSA
Hi,
last year Takashi did help me to get the digital output and the internal/external mic up and running on my Samsung P50 notebook with an integrated Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller.
Some time ago I switched from Ubuntu 7.10 to 8.10 and a new problem with the soundcard occurred. The Headphone/Line-Out Jack-Sense is not working. When I plug in my Headphones the internal speakers of the notebook aren't switched off. I've ignored that problem for a long time but now I'm willing to change this.
I've already upgraded my system to ALSA 1.0.20 with a script provided in the Ubuntu Forums [2]. I've used the build-in support for the latest snapshots provided at [3] of the script. But the problem still exists.
Can anyone (perhaps Takashi again) help me?
You can find all ALSA related information about my system at [4].
Regards, Martin
[1] http://tinyurl.com/mkw8mz [2] http://ubuntuforums.org/showthread.php?p=6589810#post6589810 [3] http://tinyurl.com/5ux2nf [4] http://pastebin.ca/1471032
At Tue, 23 Jun 2009 14:25:39 +0200, Martin Egge wrote:
Hi,
last year Takashi did help me to get the digital output and the internal/external mic up and running on my Samsung P50 notebook with an integrated Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller.
Some time ago I switched from Ubuntu 7.10 to 8.10 and a new problem with the soundcard occurred. The Headphone/Line-Out Jack-Sense is not working. When I plug in my Headphones the internal speakers of the notebook aren't switched off. I've ignored that problem for a long time but now I'm willing to change this.
I've already upgraded my system to ALSA 1.0.20 with a script provided in the Ubuntu Forums [2]. I've used the build-in support for the latest snapshots provided at [3] of the script. But the problem still exists.
Can anyone (perhaps Takashi again) help me?
Does the patch below work? It's against the latest alsa-driver, not 1.0.20 nor 2.6.30. ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
Takashi
--- diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 0d8d235..939a3dd 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -240,6 +240,7 @@ AD1986A laptop-automute 2-channel with EAPD and HP-automute (Lenovo N100) ultra 2-channel with EAPD (Samsung Ultra tablet PC) samsung 2-channel with EAPD (Samsung R65) + samsung-p50 2-channel with HP-automute (Samsung P50)
AD1988/AD1988B/AD1989A/AD1989B ============================== diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 84cc49c..1988582 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -72,6 +72,7 @@ struct ad198x_spec { hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
unsigned int jack_present :1; + unsigned int inv_jack_detect:1;
#ifdef CONFIG_SND_HDA_POWER_SAVE struct hda_loopback_check loopback; @@ -669,39 +670,13 @@ static struct hda_input_mux ad1986a_automic_capture_source = { }, };
-static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { +static struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = { HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), - HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Source", - .info = ad198x_mux_enum_info, - .get = ad198x_mux_enum_get, - .put = ad198x_mux_enum_put, - }, - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "External Amplifier", - .info = ad198x_eapd_info, - .get = ad198x_eapd_get, - .put = ad198x_eapd_put, - .private_value = 0x1b | (1 << 8), /* port-D, inversed */ - }, { } /* end */ };
-static struct snd_kcontrol_new ad1986a_samsung_mixers[] = { - HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), - HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), +static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), @@ -727,6 +702,12 @@ static struct snd_kcontrol_new ad1986a_samsung_mixers[] = { { } /* end */ };
+static struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = { + HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT), + HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT), + { } /* end */ +}; + /* re-connect the mic boost input according to the jack sensing */ static void ad1986a_automic(struct hda_codec *codec) { @@ -776,8 +757,9 @@ static void ad1986a_hp_automute(struct hda_codec *codec) unsigned int present;
present = snd_hda_codec_read(codec, 0x1a, 0, AC_VERB_GET_PIN_SENSE, 0); - /* Lenovo N100 seems to report the reversed bit for HP jack-sensing */ - spec->jack_present = !(present & 0x80000000); + spec->jack_present = !!(present & 0x80000000); + if (spec->inv_jack_detect) + spec->jack_present = !spec->jack_present; ad1986a_update_hp(codec); }
@@ -816,7 +798,7 @@ static int ad1986a_hp_master_sw_put(struct snd_kcontrol *kcontrol, return change; }
-static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = { +static struct snd_kcontrol_new ad1986a_automute_master_mixers[] = { HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -826,33 +808,10 @@ static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = { .put = ad1986a_hp_master_sw_put, .private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT), }, - HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Source", - .info = ad198x_mux_enum_info, - .get = ad198x_mux_enum_get, - .put = ad198x_mux_enum_put, - }, - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "External Amplifier", - .info = ad198x_eapd_info, - .get = ad198x_eapd_get, - .put = ad198x_eapd_put, - .private_value = 0x1b | (1 << 8), /* port-D, inversed */ - }, { } /* end */ };
+ /* * initialization verbs */ @@ -981,6 +940,27 @@ static struct hda_verb ad1986a_hp_init_verbs[] = { {} };
+static void ad1986a_samsung_p50_unsol_event(struct hda_codec *codec, + unsigned int res) +{ + switch (res >> 26) { + case AD1986A_HP_EVENT: + ad1986a_hp_automute(codec); + break; + case AD1986A_MIC_EVENT: + ad1986a_automic(codec); + break; + } +} + +static int ad1986a_samsung_p50_init(struct hda_codec *codec) +{ + ad198x_init(codec); + ad1986a_hp_automute(codec); + ad1986a_automic(codec); + return 0; +} +
/* models */ enum { @@ -991,6 +971,7 @@ enum { AD1986A_LAPTOP_AUTOMUTE, AD1986A_ULTRA, AD1986A_SAMSUNG, + AD1986A_SAMSUNG_P50, AD1986A_MODELS };
@@ -1002,6 +983,7 @@ static const char *ad1986a_models[AD1986A_MODELS] = { [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute", [AD1986A_ULTRA] = "ultra", [AD1986A_SAMSUNG] = "samsung", + [AD1986A_SAMSUNG_P50] = "samsung-p50", };
static struct snd_pci_quirk ad1986a_cfg_tbl[] = { @@ -1024,6 +1006,7 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = { SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD), SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), + SND_PCI_QUIRK(0x144d, 0xc024, "Samsung P50", AD1986A_SAMSUNG_P50), SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_SAMSUNG), SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), @@ -1111,7 +1094,10 @@ static int patch_ad1986a(struct hda_codec *codec) spec->multiout.dac_nids = ad1986a_laptop_dac_nids; break; case AD1986A_LAPTOP_EAPD: - spec->mixers[0] = ad1986a_laptop_eapd_mixers; + spec->num_mixers = 3; + spec->mixers[0] = ad1986a_laptop_master_mixers; + spec->mixers[1] = ad1986a_laptop_eapd_mixers; + spec->mixers[2] = ad1986a_laptop_intmic_mixers; spec->num_init_verbs = 2; spec->init_verbs[1] = ad1986a_eapd_init_verbs; spec->multiout.max_channels = 2; @@ -1122,7 +1108,9 @@ static int patch_ad1986a(struct hda_codec *codec) spec->input_mux = &ad1986a_laptop_eapd_capture_source; break; case AD1986A_SAMSUNG: - spec->mixers[0] = ad1986a_samsung_mixers; + spec->num_mixers = 2; + spec->mixers[0] = ad1986a_laptop_master_mixers; + spec->mixers[1] = ad1986a_laptop_eapd_mixers; spec->num_init_verbs = 3; spec->init_verbs[1] = ad1986a_eapd_init_verbs; spec->init_verbs[2] = ad1986a_automic_verbs; @@ -1135,8 +1123,28 @@ static int patch_ad1986a(struct hda_codec *codec) codec->patch_ops.unsol_event = ad1986a_automic_unsol_event; codec->patch_ops.init = ad1986a_automic_init; break; + case AD1986A_SAMSUNG_P50: + spec->num_mixers = 2; + spec->mixers[0] = ad1986a_automute_master_mixers; + spec->mixers[1] = ad1986a_laptop_eapd_mixers; + spec->num_init_verbs = 4; + spec->init_verbs[1] = ad1986a_eapd_init_verbs; + spec->init_verbs[2] = ad1986a_automic_verbs; + spec->init_verbs[3] = ad1986a_hp_init_verbs; + spec->multiout.max_channels = 2; + spec->multiout.num_dacs = 1; + spec->multiout.dac_nids = ad1986a_laptop_dac_nids; + if (!is_jack_available(codec, 0x25)) + spec->multiout.dig_out_nid = 0; + spec->input_mux = &ad1986a_automic_capture_source; + codec->patch_ops.unsol_event = ad1986a_samsung_p50_unsol_event; + codec->patch_ops.init = ad1986a_samsung_p50_init; + break; case AD1986A_LAPTOP_AUTOMUTE: - spec->mixers[0] = ad1986a_laptop_automute_mixers; + spec->num_mixers = 3; + spec->mixers[0] = ad1986a_automute_master_mixers; + spec->mixers[1] = ad1986a_laptop_eapd_mixers; + spec->mixers[2] = ad1986a_laptop_intmic_mixers; spec->num_init_verbs = 3; spec->init_verbs[1] = ad1986a_eapd_init_verbs; spec->init_verbs[2] = ad1986a_hp_init_verbs; @@ -1148,6 +1156,10 @@ static int patch_ad1986a(struct hda_codec *codec) spec->input_mux = &ad1986a_laptop_eapd_capture_source; codec->patch_ops.unsol_event = ad1986a_hp_unsol_event; codec->patch_ops.init = ad1986a_hp_init; + /* Lenovo N100 seems to report the reversed bit + * for HP jack-sensing + */ + spec->inv_jack_detect = 1; break; case AD1986A_ULTRA: spec->mixers[0] = ad1986a_laptop_eapd_mixers;
Hi Takashi,
Am Mittwoch 24 Juni 2009 schrieb Takashi Iwai:
Does the patch below work? It's against the latest alsa-driver, not 1.0.20 nor 2.6.30.
ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-sna pshot.tar.gz
The patch could not be applied.
patching file sound/pci/hda/patch_analog.c Hunk #1 FAILED at 72. Hunk #2 FAILED at 670. Hunk #3 succeeded at 702 with fuzz 1. Hunk #4 FAILED at 757. Hunk #5 FAILED at 798. Hunk #6 FAILED at 808. Hunk #7 succeeded at 940 with fuzz 1. Hunk #8 FAILED at 971. Hunk #9 FAILED at 983. Hunk #10 FAILED at 1006. Hunk #11 FAILED at 1094. Hunk #12 FAILED at 1108. Hunk #13 FAILED at 1123. Hunk #14 FAILED at 1156. 12 out of 14 hunks FAILED -- saving rejects to file sound/pci/hda/patch_analog.c.rej
Regards Martin
P.S.: See [1] for patch_analog.c.rej
At Wed, 24 Jun 2009 17:14:38 +0200, Martin Egge wrote:
Hi Takashi,
Am Mittwoch 24 Juni 2009 schrieb Takashi Iwai:
Does the patch below work? It's against the latest alsa-driver, not 1.0.20 nor 2.6.30.
ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-sna pshot.tar.gz
The patch could not be applied.
It's a patch to the kernel tree. Apply it on alsa-kernel directory with -p2.
Takashi
Hi Takashi,
Am Mittwoch 24 Juni 2009 schrieb Takashi Iwai:
At Wed, 24 Jun 2009 17:14:38 +0200, Martin Egge wrote:
Am Mittwoch 24 Juni 2009 schrieb Takashi Iwai:
Does the patch below work? It's against the latest alsa-driver, not 1.0.20 nor 2.6.30.
ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver -sna pshot.tar.gz
The patch could not be applied.
It's a patch to the kernel tree. Apply it on alsa-kernel directory with -p2.
That's what I did some minutes ago:
$> wget --no-cache -nd ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver- snapshot.tar.gz $> tar xzf alsa-driver-snapshot.tar.gz $> cd alsa-driver/alsa-kernel/ $> patch -p2 < ../../patch.txt
That's what I get:
patching file pci/hda/patch_analog.c Hunk #1 FAILED at 72. Hunk #2 FAILED at 670. Hunk #3 succeeded at 702 with fuzz 1. Hunk #4 FAILED at 757. Hunk #5 FAILED at 798. Hunk #6 FAILED at 808. Hunk #7 succeeded at 940 with fuzz 1. Hunk #8 FAILED at 971. Hunk #9 FAILED at 983. Hunk #10 FAILED at 1006. Hunk #11 FAILED at 1094. Hunk #12 FAILED at 1108. Hunk #13 FAILED at 1123. Hunk #14 FAILED at 1156. 12 out of 14 hunks FAILED -- saving rejects to file pci/hda/patch_analog.c.rej
So, what went wrong?
Martin
At Thu, 25 Jun 2009 08:35:08 +0200, Martin Egge wrote:
Hi Takashi,
Am Mittwoch 24 Juni 2009 schrieb Takashi Iwai:
At Wed, 24 Jun 2009 17:14:38 +0200, Martin Egge wrote:
Am Mittwoch 24 Juni 2009 schrieb Takashi Iwai:
Does the patch below work? It's against the latest alsa-driver, not 1.0.20 nor 2.6.30.
ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver -sna pshot.tar.gz
The patch could not be applied.
It's a patch to the kernel tree. Apply it on alsa-kernel directory with -p2.
That's what I did some minutes ago:
$> wget --no-cache -nd ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver- snapshot.tar.gz $> tar xzf alsa-driver-snapshot.tar.gz $> cd alsa-driver/alsa-kernel/ $> patch -p2 < ../../patch.txt
That's what I get:
patching file pci/hda/patch_analog.c Hunk #1 FAILED at 72. Hunk #2 FAILED at 670. Hunk #3 succeeded at 702 with fuzz 1. Hunk #4 FAILED at 757. Hunk #5 FAILED at 798. Hunk #6 FAILED at 808. Hunk #7 succeeded at 940 with fuzz 1. Hunk #8 FAILED at 971. Hunk #9 FAILED at 983. Hunk #10 FAILED at 1006. Hunk #11 FAILED at 1094. Hunk #12 FAILED at 1108. Hunk #13 FAILED at 1123. Hunk #14 FAILED at 1156. 12 out of 14 hunks FAILED -- saving rejects to file pci/hda/patch_analog.c.rej
So, what went wrong?
You must have saved the patch file wrongly. Maybe your MUA broke text lines badly.
I checked your procedure above and it works for me well. (patch gives an error regarding sound/alsa/HD-Audio-Model.txt, but it doesn't matter.)
Below is an attachment of the same patch. Try this again.
Takashi
Hi Takashi,
Am Donnerstag 25 Juni 2009 schrieb Takashi Iwai:
At Thu, 25 Jun 2009 08:35:08 +0200,
Martin Egge wrote: [...]
So, what went wrong?
You must have saved the patch file wrongly. Maybe your MUA broke text lines badly.
It seems that my webmail interface (Squirrelmail) has messed up spaces and tabulators.
Below is an attachment of the same patch. Try this again.
Great Thanks. This time I could apply the patch. The patch has solved my problem.
Martin
At Mon, 29 Jun 2009 08:43:05 +0200, Martin Egge wrote:
Hi Takashi,
Am Donnerstag 25 Juni 2009 schrieb Takashi Iwai:
At Thu, 25 Jun 2009 08:35:08 +0200,
Martin Egge wrote: [...]
So, what went wrong?
You must have saved the patch file wrongly. Maybe your MUA broke text lines badly.
It seems that my webmail interface (Squirrelmail) has messed up spaces and tabulators.
Below is an attachment of the same patch. Try this again.
Great Thanks. This time I could apply the patch. The patch has solved my problem.
Thanks for checking. Now I merged back to the main sound git repository.
Takashi
participants (2)
-
Martin Egge
-
Takashi Iwai