All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: hda/conexant: Fix missing headphone node after reboot from Windows
Date: Tue, 23 Jun 2020 12:11:52 +0200	[thread overview]
Message-ID: <s5hk0zyozvb.wl-tiwai@suse.de> (raw)
In-Reply-To: <20200623062510.27499-1-tiwai@suse.de>

On Tue, 23 Jun 2020 08:25:10 +0200,
Takashi Iwai wrote:
> 
> When Lenovo Thinkpad E495 is rebooted from Windows, the headphone
> control is lost.  This seems because BIOS doesn't initialize the
> headphone node (NID 0x16) properly after the reboot from Windows, as
> Windows likely turns off the power at its exit.  The node is left
> as a vendor-specific unknown node and ignored by the HD-audio parser.
> 
> This patch forcibly initializes the node at the probe time, by
> overriding the widget caps and the connection list, so that the
> headphone control is detected always at probe time.
> 
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207741
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

This turned out to be not effective, the audio stream itself doesn't
work as expected.


thanks,

Takashi

> ---
>  sound/pci/hda/patch_conexant.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
> index 396b5503038a..37c8add48791 100644
> --- a/sound/pci/hda/patch_conexant.c
> +++ b/sound/pci/hda/patch_conexant.c
> @@ -215,6 +215,7 @@ enum {
>  	CXT_FIXUP_MUTE_LED_GPIO,
>  	CXT_FIXUP_HEADSET_MIC,
>  	CXT_FIXUP_HP_MIC_NO_PRESENCE,
> +	CXT_FIXUP_THINKPAD_E495,
>  };
>  
>  /* for hda_fixup_thinkpad_acpi() */
> @@ -673,6 +674,22 @@ static void cxt_fixup_mute_led_gpio(struct hda_codec *codec,
>  				    spec->gpio_led);
>  }
>  
> +static void cxt_fixup_thinkpad_e495(struct hda_codec *codec,
> +				    const struct hda_fixup *fix,
> +				    int action)
> +{
> +	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
> +		static const hda_nid_t conns[] = { 0x10, 0x11 };
> +		/* BIOS invalidates the headphone pin NID 0x16 when rebooted
> +		 * after Windows by some reason;
> +		 * forcibly restoring the whole setup
> +		 */
> +		snd_hda_override_wcaps(codec, 0x16, 0x400581);
> +		snd_hda_codec_set_pincfg(codec, 0x16, 0x03211040);
> +		snd_hda_override_conn_list(codec, 0x16, ARRAY_SIZE(conns),
> +					   conns);
> +	}
> +}
>  
>  /* ThinkPad X200 & co with cxt5051 */
>  static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = {
> @@ -846,6 +863,12 @@ static const struct hda_fixup cxt_fixups[] = {
>  		.chained = true,
>  		.chain_id = CXT_FIXUP_HEADSET_MIC,
>  	},
> +	[CXT_FIXUP_THINKPAD_E495] = {
> +		.type = HDA_FIXUP_FUNC,
> +		.v.func = cxt_fixup_thinkpad_e495,
> +		.chained = true,
> +		.chain_id = CXT_FIXUP_THINKPAD_ACPI,
> +	},
>  };
>  
>  static const struct snd_pci_quirk cxt5045_fixups[] = {
> @@ -932,6 +955,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
>  	SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
>  	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
>  	SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
> +	SND_PCI_QUIRK(0x17aa, 0x5124, "Lenovo Thinkpad E495", CXT_FIXUP_THINKPAD_E495),
>  	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI),
>  	SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
>  	SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205),
> -- 
> 2.16.4
> 

      reply	other threads:[~2020-06-23 10:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  6:25 [PATCH] ALSA: hda/conexant: Fix missing headphone node after reboot from Windows Takashi Iwai
2020-06-23 10:11 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hk0zyozvb.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.