All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jian-Hong Pan <jhp@endlessos.org>
Cc: Takashi Iwai <tiwai@suse.com>, Kailang Yang <kailang@realtek.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	linux@endlessm.com
Subject: Re: [PATCH] ALSA: hda/realtek: Enable audio jacks of ASUS D700SA with ALC887
Date: Tue, 06 Oct 2020 14:24:41 +0200	[thread overview]
Message-ID: <s5hmu0z5ypi.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201006075334.92933-1-jhp@endlessos.org>

On Tue, 06 Oct 2020 09:53:35 +0200,
Jian-Hong Pan wrote:
> 
> The ASUS D700SA desktop's audio (1043:2390) with ALC887 cannot detect
> the headset microphone and another headphone jack until
> ALC887_FIXUP_ASUS_HMIC and ALC887_FIXUP_ASUS_AUDIO quirks are applied.
> The NID 0x15 maps as the headset microphone and NID 0x19 maps as another
> headphone jack. Also need the function like alc887_fixup_asus_jack to
> enable the audio jacks.
> 
> Signed-off-by: Jian-Hong Pan <jhp@endlessos.org>
> Signed-off-by: Kailang Yang <kailang@realtek.com>
> ---
>  sound/pci/hda/patch_realtek.c | 41 +++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index d4f17b465892..8d0928bdc9ff 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -1929,6 +1929,8 @@ enum {
>  	ALC1220_FIXUP_CLEVO_P950,
>  	ALC1220_FIXUP_CLEVO_PB51ED,
>  	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
> +	ALC887_FIXUP_ASUS_AUDIO,
> +	ALC887_FIXUP_ASUS_HMIC,
>  };
>  
>  static void alc889_fixup_coef(struct hda_codec *codec,
> @@ -2141,6 +2143,30 @@ static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
>  	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
>  }
>  
> +static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
> +					 struct hda_jack_callback *jack)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	int vref;
> +
> +	snd_hda_gen_hp_automute(codec, jack);
> +
> +	vref = spec->gen.hp_jack_present ? 0xc4 : 0xc0;

Use the AC_PINCTL_* instead of the raw numbers.  Some values are
shortened form in hda_local.h, too (e.g. 0xc0 = PIN_HP).


> +	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
> +			    vref);

Better to use snd_hda_set_pin_ctl().

> +}
> +
> +static void alc887_fixup_asus_jack(struct hda_codec *codec,
> +				     const struct hda_fixup *fix, int action)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	if (action != HDA_FIXUP_ACT_PROBE)
> +		return;
> +	snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
> +			    0xc0);

This one would be snd_hda_set_pin_ctl_cached(), so that it'll be
restored at resume.


thanks,

Takashi

WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Jian-Hong Pan <jhp@endlessos.org>
Cc: alsa-devel@alsa-project.org, Kailang Yang <kailang@realtek.com>,
	linux@endlessm.com, Takashi Iwai <tiwai@suse.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda/realtek: Enable audio jacks of ASUS D700SA with ALC887
Date: Tue, 06 Oct 2020 14:24:41 +0200	[thread overview]
Message-ID: <s5hmu0z5ypi.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201006075334.92933-1-jhp@endlessos.org>

On Tue, 06 Oct 2020 09:53:35 +0200,
Jian-Hong Pan wrote:
> 
> The ASUS D700SA desktop's audio (1043:2390) with ALC887 cannot detect
> the headset microphone and another headphone jack until
> ALC887_FIXUP_ASUS_HMIC and ALC887_FIXUP_ASUS_AUDIO quirks are applied.
> The NID 0x15 maps as the headset microphone and NID 0x19 maps as another
> headphone jack. Also need the function like alc887_fixup_asus_jack to
> enable the audio jacks.
> 
> Signed-off-by: Jian-Hong Pan <jhp@endlessos.org>
> Signed-off-by: Kailang Yang <kailang@realtek.com>
> ---
>  sound/pci/hda/patch_realtek.c | 41 +++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index d4f17b465892..8d0928bdc9ff 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -1929,6 +1929,8 @@ enum {
>  	ALC1220_FIXUP_CLEVO_P950,
>  	ALC1220_FIXUP_CLEVO_PB51ED,
>  	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
> +	ALC887_FIXUP_ASUS_AUDIO,
> +	ALC887_FIXUP_ASUS_HMIC,
>  };
>  
>  static void alc889_fixup_coef(struct hda_codec *codec,
> @@ -2141,6 +2143,30 @@ static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
>  	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
>  }
>  
> +static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
> +					 struct hda_jack_callback *jack)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	int vref;
> +
> +	snd_hda_gen_hp_automute(codec, jack);
> +
> +	vref = spec->gen.hp_jack_present ? 0xc4 : 0xc0;

Use the AC_PINCTL_* instead of the raw numbers.  Some values are
shortened form in hda_local.h, too (e.g. 0xc0 = PIN_HP).


> +	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
> +			    vref);

Better to use snd_hda_set_pin_ctl().

> +}
> +
> +static void alc887_fixup_asus_jack(struct hda_codec *codec,
> +				     const struct hda_fixup *fix, int action)
> +{
> +	struct alc_spec *spec = codec->spec;
> +	if (action != HDA_FIXUP_ACT_PROBE)
> +		return;
> +	snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
> +			    0xc0);

This one would be snd_hda_set_pin_ctl_cached(), so that it'll be
restored at resume.


thanks,

Takashi

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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06  7:53 [PATCH] ALSA: hda/realtek: Enable audio jacks of ASUS D700SA with ALC887 Jian-Hong Pan
2020-10-06  7:53 ` Jian-Hong Pan
2020-10-06 12:24 ` Takashi Iwai [this message]
2020-10-06 12:24   ` Takashi Iwai
2020-10-07  5:22   ` [PATCH v2] " Jian-Hong Pan
2020-10-07  5:22     ` Jian-Hong Pan
2020-10-07 15:31     ` Takashi Iwai
2020-10-07 15:31       ` Takashi Iwai

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=s5hmu0z5ypi.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=jhp@endlessos.org \
    --cc=kailang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@endlessm.com \
    --cc=tiwai@suse.com \
    /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.