]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: hda: Enhance pm_blacklist option
authorTakashi Iwai <tiwai@suse.de>
Mon, 29 Jul 2024 14:15:17 +0000 (16:15 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 30 Jul 2024 05:45:55 +0000 (07:45 +0200)
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/20240729141519.18398-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Documentation/sound/alsa-configuration.rst
sound/pci/hda/hda_intel.c

index 829c672d9fe6682ac05b455759d3c4aa74d97388..04254474fa048f0a0c9787c7b87e1a1349e918db 100644 (file)
@@ -1059,6 +1059,9 @@ power_save
     Automatic power-saving timeout (in second, 0 = disable)
 power_save_controller
     Reset HD-audio controller in power-saving mode (default = on)
+pm_blacklist
+    Enable / disable power-management deny-list (default = look up PM
+    deny-list, 0 = skip PM deny-list, 1 = force to turn off runtime PM)
 align_buffer_size
     Force rounding of buffer/period sizes to multiples of 128 bytes.
     This is more efficient in terms of memory access but isn't
index 440f1b37e071f6825a5c02c1da8f4a6f9b437f77..ca59534456360d43496c6c15ed0a73ba4ce27299 100644 (file)
@@ -175,8 +175,8 @@ module_param(power_save, xint, 0644);
 MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
                 "(in second, 0 = disable).");
 
-static bool pm_blacklist = true;
-module_param(pm_blacklist, bool, 0644);
+static int pm_blacklist = -1;
+module_param(pm_blacklist, bint, 0644);
 MODULE_PARM_DESC(pm_blacklist, "Enable power-management denylist");
 
 /* reset the HD-audio controller in power save mode.
@@ -188,7 +188,7 @@ module_param(power_save_controller, bool, 0644);
 MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
 #else /* CONFIG_PM */
 #define power_save     0
-#define pm_blacklist   false
+#define pm_blacklist   0
 #define power_save_controller  false
 #endif /* CONFIG_PM */
 
@@ -930,6 +930,9 @@ static int __maybe_unused param_set_xint(const char *val, const struct kernel_pa
        if (ret || prev == power_save)
                return ret;
 
+       if (pm_blacklist > 0)
+               return 0;
+
        mutex_lock(&card_list_lock);
        list_for_each_entry(hda, &card_list, list) {
                chip = &hda->chip;
@@ -2247,7 +2250,7 @@ static void set_default_power_save(struct azx *chip)
        struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
        int val = power_save;
 
-       if (pm_blacklist) {
+       if (pm_blacklist < 0) {
                const struct snd_pci_quirk *q;
 
                q = snd_pci_quirk_lookup(chip->pci, power_save_denylist);
@@ -2257,6 +2260,9 @@ static void set_default_power_save(struct azx *chip)
                        val = 0;
                        hda->runtime_pm_disabled = 1;
                }
+       } else if (pm_blacklist > 0) {
+               dev_info(chip->card->dev, "Forcing power_save to 0 via option\n");
+               val = 0;
        }
        snd_hda_set_power_save(&chip->bus, val * 1000);
 }