aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-11-27 06:43:28 -0500
committerTakashi Iwai <tiwai@suse.de>2008-11-27 06:43:28 -0500
commitfee2fba3586f78762ecc5f432dfd3602765a31b3 (patch)
tree9435bc32c3e41ad74dbcb18d829d8c51227c16c3 /sound
parent986862bdf17655d012f9b0654925dccdcc4183c9 (diff)
ALSA: hda - Move power_save option to hda_intel.c
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_codec.c16
-rw-r--r--sound/pci/hda/hda_codec.h2
-rw-r--r--sound/pci/hda/hda_intel.c6
3 files changed, 13 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index f84874445b50..052a898a63ba 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -33,14 +33,6 @@
33#include <sound/hda_hwdep.h> 33#include <sound/hda_hwdep.h>
34#include "hda_patch.h" /* codec presets */ 34#include "hda_patch.h" /* codec presets */
35 35
36#ifdef CONFIG_SND_HDA_POWER_SAVE
37/* define this option here to hide as static */
38static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
39module_param(power_save, int, 0644);
40MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
41 "(in second, 0 = disable).");
42#endif
43
44/* 36/*
45 * vendor / preset table 37 * vendor / preset table
46 */ 38 */
@@ -519,6 +511,7 @@ int __devinit snd_hda_bus_new(struct snd_card *card,
519 bus->private_data = temp->private_data; 511 bus->private_data = temp->private_data;
520 bus->pci = temp->pci; 512 bus->pci = temp->pci;
521 bus->modelname = temp->modelname; 513 bus->modelname = temp->modelname;
514 bus->power_save = temp->power_save;
522 bus->ops = temp->ops; 515 bus->ops = temp->ops;
523 516
524 mutex_init(&bus->cmd_mutex); 517 mutex_init(&bus->cmd_mutex);
@@ -2694,15 +2687,18 @@ void snd_hda_power_up(struct hda_codec *codec)
2694 codec->power_transition = 0; 2687 codec->power_transition = 0;
2695} 2688}
2696 2689
2690#define power_save(codec) \
2691 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)
2692
2697void snd_hda_power_down(struct hda_codec *codec) 2693void snd_hda_power_down(struct hda_codec *codec)
2698{ 2694{
2699 --codec->power_count; 2695 --codec->power_count;
2700 if (!codec->power_on || codec->power_count || codec->power_transition) 2696 if (!codec->power_on || codec->power_count || codec->power_transition)
2701 return; 2697 return;
2702 if (power_save) { 2698 if (power_save(codec)) {
2703 codec->power_transition = 1; /* avoid reentrance */ 2699 codec->power_transition = 1; /* avoid reentrance */
2704 schedule_delayed_work(&codec->power_work, 2700 schedule_delayed_work(&codec->power_work,
2705 msecs_to_jiffies(power_save * 1000)); 2701 msecs_to_jiffies(power_save(codec) * 1000));
2706 } 2702 }
2707} 2703}
2708 2704
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index e1077df5e882..4034625b5997 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -585,6 +585,7 @@ struct hda_bus_template {
585 void *private_data; 585 void *private_data;
586 struct pci_dev *pci; 586 struct pci_dev *pci;
587 const char *modelname; 587 const char *modelname;
588 int *power_save;
588 struct hda_bus_ops ops; 589 struct hda_bus_ops ops;
589}; 590};
590 591
@@ -601,6 +602,7 @@ struct hda_bus {
601 void *private_data; 602 void *private_data;
602 struct pci_dev *pci; 603 struct pci_dev *pci;
603 const char *modelname; 604 const char *modelname;
605 int *power_save;
604 struct hda_bus_ops ops; 606 struct hda_bus_ops ops;
605 607
606 /* codec linked list */ 608 /* codec linked list */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index f13ec4c71f8a..f17ccd513350 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -83,7 +83,10 @@ module_param(enable_msi, int, 0444);
83MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)"); 83MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)");
84 84
85#ifdef CONFIG_SND_HDA_POWER_SAVE 85#ifdef CONFIG_SND_HDA_POWER_SAVE
86/* power_save option is defined in hda_codec.c */ 86static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
87module_param(power_save, int, 0644);
88MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
89 "(in second, 0 = disable).");
87 90
88/* reset the HD-audio controller in power save mode. 91/* reset the HD-audio controller in power save mode.
89 * this may give more power-saving, but will take longer time to 92 * 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,
1230 memset(&bus_temp, 0, sizeof(bus_temp)); 1233 memset(&bus_temp, 0, sizeof(bus_temp));
1231 bus_temp.private_data = chip; 1234 bus_temp.private_data = chip;
1232 bus_temp.modelname = model; 1235 bus_temp.modelname = model;
1236 bus_temp.power_save = &power_save;
1233 bus_temp.pci = chip->pci; 1237 bus_temp.pci = chip->pci;
1234 bus_temp.ops.command = azx_send_cmd; 1238 bus_temp.ops.command = azx_send_cmd;
1235 bus_temp.ops.get_response = azx_get_response; 1239 bus_temp.ops.get_response = azx_get_response;