Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda - Disable Headphone Mic boost for ALC662
@ 2015-05-28  7:15 David Henningsson
  2015-05-28  7:18 ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: David Henningsson @ 2015-05-28  7:15 UTC (permalink / raw)
  To: tiwai, alsa-devel; +Cc: 14545235, David Henningsson

When headphone mic boost is above zero, some 10 - 20 second delay
might occur before the headphone mic is operational.
Therefore disable the headphone mic boost control (recording gain is
sufficient even without it).

(Note: this patch is not about the headset mic, it's about the less
common mic-in only mode.)

BugLink: https://bugs.launchpad.net/bugs/1454235
Suggested-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d0fa455..87605fc 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4240,6 +4240,10 @@ static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
+
+		/* Disable boost for mic-in permanently */
+		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
+		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
 	} else
 		alc_fixup_headset_mode(codec, fix, action);
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ALSA: hda - Disable Headphone Mic boost for ALC662
  2015-05-28  7:15 David Henningsson
@ 2015-05-28  7:18 ` Takashi Iwai
  2015-05-28  7:25   ` David Henningsson
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2015-05-28  7:18 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel, 14545235

At Thu, 28 May 2015 09:15:46 +0200,
David Henningsson wrote:
> 
> When headphone mic boost is above zero, some 10 - 20 second delay
> might occur before the headphone mic is operational.
> Therefore disable the headphone mic boost control (recording gain is
> sufficient even without it).
> 
> (Note: this patch is not about the headset mic, it's about the less
> common mic-in only mode.)
> 
> BugLink: https://bugs.launchpad.net/bugs/1454235
> Suggested-by: Kailang Yang <kailang@realtek.com>
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> ---
>  sound/pci/hda/patch_realtek.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index d0fa455..87605fc 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -4240,6 +4240,10 @@ static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
>  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
>  		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
>  		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
> +
> +		/* Disable boost for mic-in permanently */
> +		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
> +		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);

Can we really hard-code NID 0x1b here...?


Takashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ALSA: hda - Disable Headphone Mic boost for ALC662
  2015-05-28  7:18 ` Takashi Iwai
@ 2015-05-28  7:25   ` David Henningsson
  2015-05-28  7:30     ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: David Henningsson @ 2015-05-28  7:25 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, 1454235



On 2015-05-28 09:18, Takashi Iwai wrote:
> At Thu, 28 May 2015 09:15:46 +0200,
> David Henningsson wrote:
>>
>> When headphone mic boost is above zero, some 10 - 20 second delay
>> might occur before the headphone mic is operational.
>> Therefore disable the headphone mic boost control (recording gain is
>> sufficient even without it).
>>
>> (Note: this patch is not about the headset mic, it's about the less
>> common mic-in only mode.)
>>
>> BugLink: https://bugs.launchpad.net/bugs/1454235
>> Suggested-by: Kailang Yang <kailang@realtek.com>
>> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
>> ---
>>   sound/pci/hda/patch_realtek.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
>> index d0fa455..87605fc 100644
>> --- a/sound/pci/hda/patch_realtek.c
>> +++ b/sound/pci/hda/patch_realtek.c
>> @@ -4240,6 +4240,10 @@ static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
>>   	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
>>   		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
>>   		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
>> +
>> +		/* Disable boost for mic-in permanently */
>> +		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
>> +		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
>
> Can we really hard-code NID 0x1b here...?

alc_fixup_headset_mode_alc662 is currently only called from a pin fixup 
quirk (via ALC662_FIXUP_DELL_MIC_NO_PRESENCE), and that pin quirk has 
headphone at 0x1b, so yes.

It would we better if we could make it more generic, but I think doing 
this at HDA_FIXUP_PROBE instead would be too late (the boost control, 
paths, etc, would already be created)...?

Do you have a better suggestion?

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ALSA: hda - Disable Headphone Mic boost for ALC662
  2015-05-28  7:25   ` David Henningsson
@ 2015-05-28  7:30     ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2015-05-28  7:30 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel, 1454235

At Thu, 28 May 2015 09:25:41 +0200,
David Henningsson wrote:
> 
> 
> 
> On 2015-05-28 09:18, Takashi Iwai wrote:
> > At Thu, 28 May 2015 09:15:46 +0200,
> > David Henningsson wrote:
> >>
> >> When headphone mic boost is above zero, some 10 - 20 second delay
> >> might occur before the headphone mic is operational.
> >> Therefore disable the headphone mic boost control (recording gain is
> >> sufficient even without it).
> >>
> >> (Note: this patch is not about the headset mic, it's about the less
> >> common mic-in only mode.)
> >>
> >> BugLink: https://bugs.launchpad.net/bugs/1454235
> >> Suggested-by: Kailang Yang <kailang@realtek.com>
> >> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> >> ---
> >>   sound/pci/hda/patch_realtek.c | 4 ++++
> >>   1 file changed, 4 insertions(+)
> >>
> >> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> >> index d0fa455..87605fc 100644
> >> --- a/sound/pci/hda/patch_realtek.c
> >> +++ b/sound/pci/hda/patch_realtek.c
> >> @@ -4240,6 +4240,10 @@ static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
> >>   	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
> >>   		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
> >>   		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
> >> +
> >> +		/* Disable boost for mic-in permanently */
> >> +		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
> >> +		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
> >
> > Can we really hard-code NID 0x1b here...?
> 
> alc_fixup_headset_mode_alc662 is currently only called from a pin fixup 
> quirk (via ALC662_FIXUP_DELL_MIC_NO_PRESENCE), and that pin quirk has 
> headphone at 0x1b, so yes.

OK, then it'd be better to mention the assumption briefly in a
comment.

> It would we better if we could make it more generic, but I think doing 
> this at HDA_FIXUP_PROBE instead would be too late (the boost control, 
> paths, etc, would already be created)...?

Right.

> Do you have a better suggestion?

I think the current form is OK, but I wanted to make sure.


Takashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ALSA: hda - Disable Headphone Mic boost for ALC662
@ 2015-05-28  7:40 David Henningsson
  2015-05-28  8:07 ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: David Henningsson @ 2015-05-28  7:40 UTC (permalink / raw)
  To: tiwai, alsa-devel; +Cc: 1454235, David Henningsson

When headphone mic boost is above zero, some 10 - 20 second delay
might occur before the headphone mic is operational.
Therefore disable the headphone mic boost control (recording gain is
sufficient even without it).

(Note: this patch is not about the headset mic, it's about the less
common mic-in only mode.)

BugLink: https://bugs.launchpad.net/bugs/1454235
Suggested-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index d0fa455..da2d371 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4240,6 +4240,11 @@ static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
+
+		/* Disable boost for mic-in permanently. (This code is only called
+		   from quirks that guarantee that the headphone is at NID 0x1b.) */
+		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
+		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
 	} else
 		alc_fixup_headset_mode(codec, fix, action);
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ALSA: hda - Disable Headphone Mic boost for ALC662
  2015-05-28  7:40 [PATCH] ALSA: hda - Disable Headphone Mic boost for ALC662 David Henningsson
@ 2015-05-28  8:07 ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2015-05-28  8:07 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel, 1454235

At Thu, 28 May 2015 09:40:23 +0200,
David Henningsson wrote:
> 
> When headphone mic boost is above zero, some 10 - 20 second delay
> might occur before the headphone mic is operational.
> Therefore disable the headphone mic boost control (recording gain is
> sufficient even without it).
> 
> (Note: this patch is not about the headset mic, it's about the less
> common mic-in only mode.)
> 
> BugLink: https://bugs.launchpad.net/bugs/1454235
> Suggested-by: Kailang Yang <kailang@realtek.com>
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>

Applied, thanks.


Takashi

> ---
>  sound/pci/hda/patch_realtek.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index d0fa455..da2d371 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -4240,6 +4240,11 @@ static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
>  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
>  		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
>  		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
> +
> +		/* Disable boost for mic-in permanently. (This code is only called
> +		   from quirks that guarantee that the headphone is at NID 0x1b.) */
> +		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
> +		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
>  	} else
>  		alc_fixup_headset_mode(codec, fix, action);
>  }
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-28  8:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-28  7:40 [PATCH] ALSA: hda - Disable Headphone Mic boost for ALC662 David Henningsson
2015-05-28  8:07 ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2015-05-28  7:15 David Henningsson
2015-05-28  7:18 ` Takashi Iwai
2015-05-28  7:25   ` David Henningsson
2015-05-28  7:30     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox