Skip to content

Commit 3bb6682

Browse files
committed
ALSA: hda: Enhance pm_blacklist option
We want sometimes to keep the runtime PM disabled persistently just like we did for the PM deny-list in the previous change, e.g. for testing some buggy device. This patch enhances the existing pm_blacklist option for achieving it easily. The default behavior doesn't change -- the driver looks up the deny list and disables the runtime PM if matches. However, when pm_blacklist=1 option is set, now the driver disables the runtime PM completely, just like the deny-list does. Update the documentation for this option, too. Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 8abe042 commit 3bb6682

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Documentation/sound/alsa-configuration.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,9 @@ power_save
10591059
Automatic power-saving timeout (in second, 0 = disable)
10601060
power_save_controller
10611061
Reset HD-audio controller in power-saving mode (default = on)
1062+
pm_blacklist
1063+
Enable / disable power-management deny-list (default = look up PM
1064+
deny-list, 0 = skip PM deny-list, 1 = force to turn off runtime PM)
10621065
align_buffer_size
10631066
Force rounding of buffer/period sizes to multiples of 128 bytes.
10641067
This is more efficient in terms of memory access but isn't

sound/pci/hda/hda_intel.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ module_param(power_save, xint, 0644);
175175
MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
176176
"(in second, 0 = disable).");
177177

178-
static bool pm_blacklist = true;
179-
module_param(pm_blacklist, bool, 0644);
178+
static int pm_blacklist = -1;
179+
module_param(pm_blacklist, bint, 0644);
180180
MODULE_PARM_DESC(pm_blacklist, "Enable power-management denylist");
181181

182182
/* reset the HD-audio controller in power save mode.
@@ -188,7 +188,7 @@ module_param(power_save_controller, bool, 0644);
188188
MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
189189
#else /* CONFIG_PM */
190190
#define power_save 0
191-
#define pm_blacklist false
191+
#define pm_blacklist 0
192192
#define power_save_controller false
193193
#endif /* CONFIG_PM */
194194

@@ -930,6 +930,9 @@ static int __maybe_unused param_set_xint(const char *val, const struct kernel_pa
930930
if (ret || prev == power_save)
931931
return ret;
932932

933+
if (pm_blacklist > 0)
934+
return 0;
935+
933936
mutex_lock(&card_list_lock);
934937
list_for_each_entry(hda, &card_list, list) {
935938
chip = &hda->chip;
@@ -2247,7 +2250,7 @@ static void set_default_power_save(struct azx *chip)
22472250
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
22482251
int val = power_save;
22492252

2250-
if (pm_blacklist) {
2253+
if (pm_blacklist < 0) {
22512254
const struct snd_pci_quirk *q;
22522255

22532256
q = snd_pci_quirk_lookup(chip->pci, power_save_denylist);
@@ -2257,6 +2260,9 @@ static void set_default_power_save(struct azx *chip)
22572260
val = 0;
22582261
hda->runtime_pm_disabled = 1;
22592262
}
2263+
} else if (pm_blacklist > 0) {
2264+
dev_info(chip->card->dev, "Forcing power_save to 0 via option\n");
2265+
val = 0;
22602266
}
22612267
snd_hda_set_power_save(&chip->bus, val * 1000);
22622268
}

0 commit comments

Comments
 (0)