ASoC: SOF: Intel: start moving multi-link handling in dedicated file
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 27 Oct 2022 19:35:24 +0000 (15:35 -0400)
committerMark Brown <broonie@kernel.org>
Fri, 28 Oct 2022 12:04:45 +0000 (13:04 +0100)
The multi-link handling needs to be handled with dedicated helpers
before cleanups and extensions.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/Makefile
sound/soc/sof/intel/hda-mlink.c [new file with mode: 0644]
sound/soc/sof/intel/hda.c
sound/soc/sof/intel/hda.h

index 8b8ea03..8201cbd 100644 (file)
@@ -5,7 +5,7 @@ snd-sof-acpi-intel-bdw-objs := bdw.o
 
 snd-sof-intel-hda-common-objs := hda.o hda-loader.o hda-stream.o hda-trace.o \
                                 hda-dsp.o hda-ipc.o hda-ctrl.o hda-pcm.o \
-                                hda-dai.o hda-bus.o \
+                                hda-dai.o hda-bus.o hda-mlink.o \
                                 skl.o hda-loader-skl.o \
                                 apl.o cnl.o tgl.o icl.o mtl.o hda-common-ops.o
 
diff --git a/sound/soc/sof/intel/hda-mlink.c b/sound/soc/sof/intel/hda-mlink.c
new file mode 100644 (file)
index 0000000..228ec35
--- /dev/null
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
+//
+// This file is provided under a dual BSD/GPLv2 license.  When using or
+// redistributing this file, you may do so under either license.
+//
+// Copyright(c) 2022 Intel Corporation. All rights reserved.
+//
+
+/*
+ * Management of HDaudio multi-link (capabilities, power, coupling)
+ */
+
+#include <sound/hdaudio_ext.h>
+#include <sound/hda_register.h>
+
+#include <linux/acpi.h>
+#include <linux/module.h>
+#include <linux/soundwire/sdw.h>
+#include <linux/soundwire/sdw_intel.h>
+#include <sound/intel-dsp-config.h>
+#include <sound/intel-nhlt.h>
+#include <sound/sof.h>
+#include <sound/sof/xtensa.h>
+#include "../sof-audio.h"
+#include "../sof-pci-dev.h"
+#include "../ops.h"
+#include "hda.h"
+
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
+
+void hda_bus_ml_get_capabilities(struct hdac_bus *bus)
+{
+       if (bus->mlcap)
+               snd_hdac_ext_bus_get_ml_capabilities(bus);
+}
+
+void hda_bus_ml_put_all(struct hdac_bus *bus)
+{
+       struct hdac_ext_link *hlink;
+
+       list_for_each_entry(hlink, &bus->hlink_list, list)
+               snd_hdac_ext_bus_link_put(bus, hlink);
+}
+
+#endif
index fe2f1e4..6a1ee7f 100644 (file)
@@ -871,9 +871,6 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
 {
        struct hdac_bus *bus = sof_to_bus(sdev);
        struct snd_sof_pdata *pdata = sdev->pdata;
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
-       struct hdac_ext_link *hlink;
-#endif
        struct sof_intel_hda_dev *hdev = pdata->hw_pdata;
        u32 link_mask;
        int ret = 0;
@@ -918,9 +915,7 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
 
 skip_soundwire:
 
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
-       if (bus->mlcap)
-               snd_hdac_ext_bus_get_ml_capabilities(bus);
+       hda_bus_ml_get_capabilities(bus);
 
        /* create codec instances */
        hda_codec_probe_bus(sdev);
@@ -928,12 +923,8 @@ skip_soundwire:
        if (!HDA_IDISP_CODEC(bus->codec_mask))
                hda_codec_i915_display_power(sdev, false);
 
-       /*
-        * we are done probing so decrement link counts
-        */
-       list_for_each_entry(hlink, &bus->hlink_list, list)
-               snd_hdac_ext_bus_link_put(bus, hlink);
-#endif
+       hda_bus_ml_put_all(bus);
+
        return 0;
 }
 
index e593276..c40364a 100644 (file)
@@ -742,6 +742,18 @@ static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; }
 
 #endif
 
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
+
+void hda_bus_ml_get_capabilities(struct hdac_bus *bus);
+void hda_bus_ml_put_all(struct hdac_bus *bus);
+
+#else
+
+static inline void hda_bus_ml_get_capabilities(struct hdac_bus *bus) { }
+static inline void hda_bus_ml_put_all(struct hdac_bus *bus) { }
+
+#endif /* CONFIG_SND_SOC_SOF_HDA */
+
 /*
  * Trace Control.
  */