Skip to content

Commit 4914da2

Browse files
committed
ALSA: hda - Don't resume forcibly i915 HDMI/DP codec
We apply the codec resume forcibly at system resume callback for updating and syncing the jack detection state that may have changed during sleeping. This is, however, superfluous for the codec like Intel HDMI/DP, where the jack detection is managed via the audio component notification; i.e. the jack state change shall be reported sooner or later from the graphics side at mode change. This patch changes the codec resume callback to avoid the forcible resume conditionally with a new flag, codec->relaxed_resume, for reducing the resume time. The flag is set in the codec probe. Although this doesn't fix the entire bug mentioned in the bugzilla entry below, it's still a good optimization and some improvements are seen. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201901 Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 3140aaf commit 4914da2

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

include/sound/hda_codec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ struct hda_codec {
252252
unsigned int auto_runtime_pm:1; /* enable automatic codec runtime pm */
253253
unsigned int force_pin_prefix:1; /* Add location prefix */
254254
unsigned int link_down_at_suspend:1; /* link down at runtime suspend */
255+
unsigned int relaxed_resume:1; /* don't resume forcibly for jack */
256+
255257
#ifdef CONFIG_PM
256258
unsigned long power_on_acct;
257259
unsigned long power_off_acct;

sound/pci/hda/hda_codec.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2941,15 +2941,19 @@ static int hda_codec_runtime_resume(struct device *dev)
29412941
#ifdef CONFIG_PM_SLEEP
29422942
static int hda_codec_force_resume(struct device *dev)
29432943
{
2944+
struct hda_codec *codec = dev_to_hda_codec(dev);
2945+
bool forced_resume = !codec->relaxed_resume;
29442946
int ret;
29452947

29462948
/* The get/put pair below enforces the runtime resume even if the
29472949
* device hasn't been used at suspend time. This trick is needed to
29482950
* update the jack state change during the sleep.
29492951
*/
2950-
pm_runtime_get_noresume(dev);
2952+
if (forced_resume)
2953+
pm_runtime_get_noresume(dev);
29512954
ret = pm_runtime_force_resume(dev);
2952-
pm_runtime_put(dev);
2955+
if (forced_resume)
2956+
pm_runtime_put(dev);
29532957
return ret;
29542958
}
29552959

sound/pci/hda/patch_hdmi.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2292,8 +2292,10 @@ static void generic_hdmi_free(struct hda_codec *codec)
22922292
struct hdmi_spec *spec = codec->spec;
22932293
int pin_idx, pcm_idx;
22942294

2295-
if (codec_has_acomp(codec))
2295+
if (codec_has_acomp(codec)) {
22962296
snd_hdac_acomp_register_notifier(&codec->bus->core, NULL);
2297+
codec->relaxed_resume = 0;
2298+
}
22972299

22982300
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
22992301
struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
@@ -2579,6 +2581,8 @@ static void register_i915_notifier(struct hda_codec *codec)
25792581
spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify;
25802582
snd_hdac_acomp_register_notifier(&codec->bus->core,
25812583
&spec->drm_audio_ops);
2584+
/* no need for forcible resume for jack check thanks to notifier */
2585+
codec->relaxed_resume = 1;
25822586
}
25832587

25842588
/* setup_stream ops override for HSW+ */

0 commit comments

Comments
 (0)