Skip to content

Commit a6e7d0a

Browse files
kv2019itiwai
authored andcommitted
ALSA: hda: fix jack detection with Realtek codecs when in D3
In case HDA controller becomes active, but codec is runtime suspended, jack detection is not successful and no interrupt is raised. This has been observed with multiple Realtek codecs and HDA controllers from different vendors. Bug does not occur if both codec and controller are active, or both are in suspend. Bug can be easily hit on desktop systems with no built-in speaker. The problem can be fixed by powering up the codec once after every controller runtime resume. Even if codec goes back to suspend later, the jack detection will continue to work. Add a flag to 'hda_codec' to describe codecs that require this flow from the controller driver. Modify __azx_runtime_resume() to use pm_request_resume() to make the intent clearer. Mark all Realtek codecs with the new forced_resume flag. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209379 Cc: Kailang Yang <kailang@realtek.com> Co-developed-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20201012102704.794423-1-kai.vehmanen@linux.intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent fe160a2 commit a6e7d0a

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

include/sound/hda_codec.h

+1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ struct hda_codec {
253253
unsigned int force_pin_prefix:1; /* Add location prefix */
254254
unsigned int link_down_at_suspend:1; /* link down at runtime suspend */
255255
unsigned int relaxed_resume:1; /* don't resume forcibly for jack */
256+
unsigned int forced_resume:1; /* forced resume for jack */
256257
unsigned int mst_no_extra_pcms:1; /* no backup PCMs for DP-MST */
257258

258259
#ifdef CONFIG_PM

sound/pci/hda/hda_intel.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -1002,12 +1002,14 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt)
10021002
azx_init_pci(chip);
10031003
hda_intel_init_chip(chip, true);
10041004

1005-
if (status && from_rt) {
1006-
list_for_each_codec(codec, &chip->bus)
1007-
if (!codec->relaxed_resume &&
1008-
(status & (1 << codec->addr)))
1009-
schedule_delayed_work(&codec->jackpoll_work,
1010-
codec->jackpoll_interval);
1005+
if (from_rt) {
1006+
list_for_each_codec(codec, &chip->bus) {
1007+
if (codec->relaxed_resume)
1008+
continue;
1009+
1010+
if (codec->forced_resume || (status & (1 << codec->addr)))
1011+
pm_request_resume(hda_codec_dev(codec));
1012+
}
10111013
}
10121014

10131015
/* power down again for link-controlled chips */

sound/pci/hda/patch_realtek.c

+1
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,7 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
11501150
codec->single_adc_amp = 1;
11511151
/* FIXME: do we need this for all Realtek codec models? */
11521152
codec->spdif_status_reset = 1;
1153+
codec->forced_resume = 1;
11531154
codec->patch_ops = alc_patch_ops;
11541155

11551156
err = alc_codec_rename_from_preset(codec);

0 commit comments

Comments
 (0)