Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120508
b: refs/heads/master
c: fee2fba
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai committed Nov 27, 2008
1 parent 32cd672 commit e684470
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 986862bdf17655d012f9b0654925dccdcc4183c9
refs/heads/master: fee2fba3586f78762ecc5f432dfd3602765a31b3
16 changes: 6 additions & 10 deletions trunk/sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@
#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
*/
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/sound/pci/hda/hda_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -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 */
Expand Down
6 changes: 5 additions & 1 deletion trunk/sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e684470

Please sign in to comment.