ALSA: hda - Move power_save option to hda_intel.c
authorTakashi Iwai <tiwai@suse.de>
Thu, 27 Nov 2008 11:43:28 +0000 (12:43 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 27 Nov 2008 11:43:28 +0000 (12:43 +0100)
Move power_save option into hda_intel.c, and make a field in hda_bus,
instead of keeping module parameters in separate files.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_intel.c

index f84874445b5091dd36833cba1c8ad8d3d4a2149f..052a898a63ba68b43af99cd9b4539acfc37a696e 100644 (file)
 #include <sound/hda_hwdep.h>
 #include "hda_patch.h" /* codec presets */
 
-#ifdef CONFIG_SND_HDA_POWER_SAVE
-/* define this option here to hide as static */
-static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
-module_param(power_save, int, 0644);
-MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
-                "(in second, 0 = disable).");
-#endif
-
 /*
  * vendor / preset table
  */
@@ -519,6 +511,7 @@ int __devinit snd_hda_bus_new(struct snd_card *card,
        bus->private_data = temp->private_data;
        bus->pci = temp->pci;
        bus->modelname = temp->modelname;
+       bus->power_save = temp->power_save;
        bus->ops = temp->ops;
 
        mutex_init(&bus->cmd_mutex);
@@ -2694,15 +2687,18 @@ void snd_hda_power_up(struct hda_codec *codec)
        codec->power_transition = 0;
 }
 
+#define power_save(codec)      \
+       ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)
+
 void snd_hda_power_down(struct hda_codec *codec)
 {
        --codec->power_count;
        if (!codec->power_on || codec->power_count || codec->power_transition)
                return;
-       if (power_save) {
+       if (power_save(codec)) {
                codec->power_transition = 1; /* avoid reentrance */
                schedule_delayed_work(&codec->power_work,
-                                     msecs_to_jiffies(power_save * 1000));
+                               msecs_to_jiffies(power_save(codec) * 1000));
        }
 }
 
index e1077df5e882f3d9a5503cb5a3a9d06e1c5a21c5..4034625b5997ba43bf355bea455cd70113af157c 100644 (file)
@@ -585,6 +585,7 @@ struct hda_bus_template {
        void *private_data;
        struct pci_dev *pci;
        const char *modelname;
+       int *power_save;
        struct hda_bus_ops ops;
 };
 
@@ -601,6 +602,7 @@ struct hda_bus {
        void *private_data;
        struct pci_dev *pci;
        const char *modelname;
+       int *power_save;
        struct hda_bus_ops ops;
 
        /* codec linked list */
index f13ec4c71f8a3eca980d5aa553ded92922050bb1..f17ccd51335047f5b2682809188778aaaf9551ce 100644 (file)
@@ -83,7 +83,10 @@ module_param(enable_msi, int, 0444);
 MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)");
 
 #ifdef CONFIG_SND_HDA_POWER_SAVE
-/* power_save option is defined in hda_codec.c */
+static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
+module_param(power_save, int, 0644);
+MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
+                "(in second, 0 = disable).");
 
 /* reset the HD-audio controller in power save mode.
  * this may give more power-saving, but will take longer time to
@@ -1230,6 +1233,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
        memset(&bus_temp, 0, sizeof(bus_temp));
        bus_temp.private_data = chip;
        bus_temp.modelname = model;
+       bus_temp.power_save = &power_save;
        bus_temp.pci = chip->pci;
        bus_temp.ops.command = azx_send_cmd;
        bus_temp.ops.get_response = azx_get_response;
This page took 0.033965 seconds and 5 git commands to generate.