All of lore.kernel.org
 help / color / mirror / Atom feed
* Change Dell headset mode rule
@ 2019-05-22  8:45 Kailang
  2019-05-22 12:10 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Kailang @ 2019-05-22  8:45 UTC (permalink / raw)
  To: Takashi Iwai (tiwai@suse.de); +Cc:  (alsa-devel@alsa-project.org)

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

Hi Takashi,

In Dell headset mode, it will recheck during runtime resume when headset was plugged.
This patch will move check headset type on unplug and system resume.
Many Thanks.

BR,
Kailang

[-- Attachment #2: 0000-fix-check-headset-type.patch --]
[-- Type: application/octet-stream, Size: 1904 bytes --]

From 250a09e42bbd3e4d32abab29afabfa74bd7730b7 Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Thu, 16 May 2019 16:10:44 +0800
Subject: [PATCH] ALSA: hda/realtek - Check headset type by unplug and resume

When system enable HDA power save mode.
This issue will happen on new platform which DMIC connect to PCH.
In Dell headset mode, it will recheck during runtime resume when headset was plugged.
This patch will move check headset type on unplug and system resume.

Signed-off-by: Kailang Yang <kailang@realtek.com>

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index f83f21d64dd4..4508ab838b71 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4901,6 +4901,8 @@ static void alc_update_headset_mode(struct hda_codec *codec)
 	switch (new_headset_mode) {
 	case ALC_HEADSET_MODE_UNPLUGGED:
 		alc_headset_mode_unplugged(codec);
+		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
+		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
 		spec->gen.hp_jack_present = false;
 		break;
 	case ALC_HEADSET_MODE_HEADSET:
@@ -4943,8 +4945,6 @@ static void alc_update_headset_mode_hook(struct hda_codec *codec,
 static void alc_update_headset_jack_cb(struct hda_codec *codec,
 				       struct hda_jack_callback *jack)
 {
-	struct alc_spec *spec = codec->spec;
-	spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
 	snd_hda_gen_hp_automute(codec, jack);
 }
 
@@ -4981,7 +4981,11 @@ static void alc_fixup_headset_mode(struct hda_codec *codec,
 		alc_probe_headset_mode(codec);
 		break;
 	case HDA_FIXUP_ACT_INIT:
-		spec->current_headset_mode = 0;
+		if (codec->core.dev.power.power_state.event == PM_EVENT_RESUME ||
+				codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
+			spec->current_headset_mode = 0;
+			spec->current_headset_type = 0;
+		}
 		alc_update_headset_mode(codec);
 		break;
 	}

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: Change Dell headset mode rule
  2019-05-22  8:45 Change Dell headset mode rule Kailang
@ 2019-05-22 12:10 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2019-05-22 12:10 UTC (permalink / raw)
  To: Kailang; +Cc:  (alsa-devel@alsa-project.org)

On Wed, 22 May 2019 10:45:35 +0200,
Kailang wrote:
> 
> Hi Takashi,
> 
> In Dell headset mode, it will recheck during runtime resume when headset was plugged.
> This patch will move check headset type on unplug and system resume.
> Many Thanks.

Thanks, applied now with slight cleanups.


Takashi

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

end of thread, other threads:[~2019-05-22 12:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22  8:45 Change Dell headset mode rule Kailang
2019-05-22 12:10 ` Takashi Iwai

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.