summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-20 09:26:04 +0100
committerTakashi Iwai <tiwai@suse.de>2015-02-26 15:36:52 +0100
commitbb573928e187fc5b1f91c3a7684791d5dfcca640 (patch)
treebc4877b0a4deaba4428bd6f73ada6152d181abb4 /sound/pci/hda/hda_codec.c
parentcc72da7d4d063ab9e690e56e0ef1ca1c24ee1635 (diff)
ALSA: hda - Drop power_save value indirection in hda_bus
We used to pass the power_save option value to hda_bus via a given pointer. This was needed to refer to the value from the HD-audio core side. However, after the transition to the runtime PM, this is no longer needed. This patch drops the power_save value indirection in hda_bus above, and let the controller driver reprograms the autosuspend value explicitly by a new helper, snd_hda_set_power_save(). Without this call, the HD-audio core doesn't set up the autosuspend and flip the runtime PM. (User may still be able to set up via sysfs, though.) Along with this change, the pointer argument of azx_bus_create() is dropped as well. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index d0dbc62c9147..36cebe0e76b2 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1175,10 +1175,8 @@ static int snd_hda_codec_dev_register(struct snd_device *device)
struct hda_codec *codec = device->device_data;
snd_hda_register_beep_device(codec);
- if (device_is_registered(hda_codec_dev(codec))) {
- snd_hda_power_sync(codec);
+ if (device_is_registered(hda_codec_dev(codec)))
pm_runtime_enable(hda_codec_dev(codec));
- }
return 0;
}
@@ -4778,21 +4776,10 @@ void snd_hda_power_down(struct hda_codec *codec)
}
EXPORT_SYMBOL_GPL(snd_hda_power_down);
-/**
- * snd_hda_power_sync - Synchronize the power_save option
- * @codec: HD-audio codec
- *
- * Synchronize the runtime PM autosuspend state from the power_save option.
- */
-void snd_hda_power_sync(struct hda_codec *codec)
+static void codec_set_power_save(struct hda_codec *codec, int delay)
{
struct device *dev = hda_codec_dev(codec);
- int delay;
- if (!codec->bus->power_save)
- return;
-
- delay = *codec->bus->power_save * 1000;
if (delay > 0) {
pm_runtime_set_autosuspend_delay(dev, delay);
pm_runtime_use_autosuspend(dev);
@@ -4804,7 +4791,22 @@ void snd_hda_power_sync(struct hda_codec *codec)
pm_runtime_forbid(dev);
}
}
-EXPORT_SYMBOL_GPL(snd_hda_power_sync);
+
+/**
+ * snd_hda_set_power_save - reprogram autosuspend for the given delay
+ * @bus: HD-audio bus
+ * @delay: autosuspend delay in msec, 0 = off
+ *
+ * Synchronize the runtime PM autosuspend state from the power_save option.
+ */
+void snd_hda_set_power_save(struct hda_bus *bus, int delay)
+{
+ struct hda_codec *c;
+
+ list_for_each_entry(c, &bus->codec_list, list)
+ codec_set_power_save(c, delay);
+}
+EXPORT_SYMBOL_GPL(snd_hda_set_power_save);
/**
* snd_hda_check_amp_list_power - Check the amp list and update the power