Skip to content

Commit e581f3d

Browse files
committed
ALSA: hda - Add post_suspend patch ops
Add a new ops, post_suspend(), which is called after suspend() ops is performed. This is called only in the case of the real PM suspend, and the codec driver can use this for further changing of D-state or clearing the LED, etc. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 2a43952 commit e581f3d

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

‎sound/pci/hda/hda_codec.c‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset);
9191
#ifdef CONFIG_SND_HDA_POWER_SAVE
9292
static void hda_power_work(struct work_struct *work);
9393
static void hda_keep_power_on(struct hda_codec *codec);
94+
#define hda_codec_is_power_on(codec) ((codec)->power_on)
9495
#else
9596
static inline void hda_keep_power_on(struct hda_codec *codec) {}
97+
#define hda_codec_is_power_on(codec) 1
9698
#endif
9799

98100
/**
@@ -4376,11 +4378,8 @@ void snd_hda_bus_reboot_notify(struct hda_bus *bus)
43764378
if (!bus)
43774379
return;
43784380
list_for_each_entry(codec, &bus->codec_list, list) {
4379-
#ifdef CONFIG_SND_HDA_POWER_SAVE
4380-
if (!codec->power_on)
4381-
continue;
4382-
#endif
4383-
if (codec->patch_ops.reboot_notify)
4381+
if (hda_codec_is_power_on(codec) &&
4382+
codec->patch_ops.reboot_notify)
43844383
codec->patch_ops.reboot_notify(codec);
43854384
}
43864385
}
@@ -5079,11 +5078,10 @@ int snd_hda_suspend(struct hda_bus *bus)
50795078
struct hda_codec *codec;
50805079

50815080
list_for_each_entry(codec, &bus->codec_list, list) {
5082-
#ifdef CONFIG_SND_HDA_POWER_SAVE
5083-
if (!codec->power_on)
5084-
continue;
5085-
#endif
5086-
hda_call_codec_suspend(codec);
5081+
if (hda_codec_is_power_on(codec))
5082+
hda_call_codec_suspend(codec);
5083+
if (codec->patch_ops.post_suspend)
5084+
codec->patch_ops.post_suspend(codec);
50875085
}
50885086
return 0;
50895087
}

‎sound/pci/hda/hda_codec.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ struct hda_codec_ops {
702702
void (*unsol_event)(struct hda_codec *codec, unsigned int res);
703703
#ifdef CONFIG_PM
704704
int (*suspend)(struct hda_codec *codec, pm_message_t state);
705+
int (*post_suspend)(struct hda_codec *codec);
705706
int (*pre_resume)(struct hda_codec *codec);
706707
int (*resume)(struct hda_codec *codec);
707708
#endif

0 commit comments

Comments
 (0)