ALSA: hdac: Add snd_hdac_ext_bus_link_power_down_all()
[firefly-linux-kernel-4.4.55.git] / sound / hda / ext / hdac_ext_controller.c
index d3bb112754f23a20ff33ee6d1afb5379bfa4d36f..63215b17247c8e98e456ff588f96ed5f9bb1cf26 100644 (file)
@@ -280,3 +280,23 @@ int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link)
        return check_hdac_link_power_active(link, false);
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down);
+
+/**
+ * snd_hdac_ext_bus_link_power_down_all -power down all hda link
+ * @ebus: HD-audio extended bus
+ */
+int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus)
+{
+       struct hdac_ext_link *hlink = NULL;
+       int ret;
+
+       list_for_each_entry(hlink, &ebus->hlink_list, list) {
+               snd_hdac_updatel(hlink->ml_addr, AZX_REG_ML_LCTL, AZX_MLCTL_SPA, 0);
+               ret = check_hdac_link_power_active(hlink, false);
+               if (ret < 0)
+                       return ret;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all);