diff mbox series

[v2,2/3] ASoC: SOF: Intel: hda: use hdac_ext fine-grained link management

Message ID 20210205184630.1938761-3-kai.vehmanen@linux.intel.com
State Accepted
Commit 87fc20e4a0cbc01fdfc23aeba93f8ce2fc3dccda
Headers show
Series ALSA: hda: add link_power op to hdac_bus_ops | expand

Commit Message

Kai Vehmanen Feb. 5, 2021, 6:46 p.m. UTC
Opt-in to use snd_hdac_ext_bus_link_power() to manage HDA link
power up/down events.

This allows to reduce power consumption in cases where some HDA codecs
are suspended, but other child devices (HDA or non-HDA codecs) remain
active and controller itself remains in active state.

By using snd_hdac_ext_bus_link_power(), the individual HDA links can be
powered off and if all HDA codecs are powered down, the command DMA can
also be shut down.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/soc/sof/intel/hda-bus.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/sof/intel/hda-bus.c b/sound/soc/sof/intel/hda-bus.c
index 789148e5584b..1ac6e79d7e62 100644
--- a/sound/soc/sof/intel/hda-bus.c
+++ b/sound/soc/sof/intel/hda-bus.c
@@ -19,13 +19,21 @@ 
 #define sof_hda_ext_ops	NULL
 #endif
 
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
+static const struct hdac_bus_ops bus_core_ops = {
+	.command = snd_hdac_bus_send_cmd,
+	.get_response = snd_hdac_bus_get_response,
+	.link_power = snd_hdac_ext_bus_link_power,
+};
+#endif
+
 /*
  * This can be used for both with/without hda link support.
  */
 void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev)
 {
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
-	snd_hdac_ext_bus_init(bus, dev, NULL, sof_hda_ext_ops);
+	snd_hdac_ext_bus_init(bus, dev, &bus_core_ops, sof_hda_ext_ops);
 #else /* CONFIG_SND_SOC_SOF_HDA */
 	memset(bus, 0, sizeof(*bus));
 	bus->dev = dev;