]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: Intel: hda-mlink/lnl: Convert offload enable functions to void
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Wed, 20 May 2026 15:06:38 +0000 (18:06 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 21 May 2026 23:16:31 +0000 (00:16 +0100)
hdac_bus_eml_enable_offload() can only fail in case the IP is not enabled
in the platform, which is not really an error as the ACE IP can be
configured differently when integrated into a specific SoC.

While it is unlikely, but it is a valid configuration that for example the
DMIC is disabled.
In this case we will just skip setting the offload for a link that is not
present.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://patch.msgid.link/20260520150639.25301-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/hda-mlink.h
sound/soc/sof/intel/hda-mlink.c
sound/soc/sof/intel/lnl.c

index 4327317be6afa6f6c057d6ce8332829cbb52da19..fed69998c93f7f4116d5547c647e4669d0ac640f 100644 (file)
@@ -60,7 +60,7 @@ struct hdac_ext_link *hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus);
 
 struct mutex *hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid);
 
-int hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable);
+void hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable);
 
 /* microphone privacy specific function supported by ACE3+ architecture */
 void hdac_bus_eml_set_mic_privacy_mask(struct hdac_bus *bus, bool alt, int elid,
@@ -186,10 +186,9 @@ hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus) { return NULL; }
 static inline struct mutex *
 hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid) { return NULL; }
 
-static inline int
+static inline void
 hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
 {
-       return 0;
 }
 
 static inline void
index ce603a2343de1d61222718e1a48d22995e8dbb87..92314e3b568aa02ad04b15c2d08149d4e581c4c5 100644 (file)
@@ -988,24 +988,19 @@ struct hdac_ext_link *hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus)
 }
 EXPORT_SYMBOL_NS(hdac_bus_eml_sdw_get_hlink, "SND_SOC_SOF_HDA_MLINK");
 
-int hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
+void hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
 {
        struct hdac_ext2_link *h2link;
        struct hdac_ext_link *hlink;
 
        h2link = find_ext2_link(bus, alt, elid);
-       if (!h2link)
-               return -ENODEV;
-
-       if (!h2link->ofls)
-               return 0;
+       if (!h2link || !h2link->ofls)
+               return;
 
        hlink = &h2link->hext_link;
 
        scoped_guard(mutex, &h2link->eml_lock)
                hdaml_lctl_offload_enable(hlink->ml_addr + AZX_REG_ML_LCTL, enable);
-
-       return 0;
 }
 EXPORT_SYMBOL_NS(hdac_bus_eml_enable_offload, "SND_SOC_SOF_HDA_MLINK");
 
index c01ea7e731aabf84e3849c8f4bf77a698345059c..19f753dca30b1db25ba8fcd9c8863bb9b7bee999 100644 (file)
 #include "lnl.h"
 #include <sound/hda-mlink.h>
 
-/* this helps allows the DSP to setup DMIC/SSP */
-static int hdac_bus_offload_dmic_ssp(struct hdac_bus *bus, bool enable)
+/* Configure DSP offload for DMIC/SSP */
+static void hdac_bus_set_dsp_offload(struct hdac_bus *bus, bool enable)
 {
-       int ret;
-
-       ret = hdac_bus_eml_enable_offload(bus, true,
-                                         AZX_REG_ML_LEPTR_ID_INTEL_SSP, enable);
-       if (ret < 0)
-               return ret;
-
-       ret = hdac_bus_eml_enable_offload(bus, true,
-                                         AZX_REG_ML_LEPTR_ID_INTEL_DMIC, enable);
-       if (ret < 0)
-               return ret;
-
-       return 0;
+       hdac_bus_eml_enable_offload(bus, true, AZX_REG_ML_LEPTR_ID_INTEL_SSP, enable);
+       hdac_bus_eml_enable_offload(bus, true, AZX_REG_ML_LEPTR_ID_INTEL_DMIC, enable);
 }
 
 static int lnl_hda_dsp_probe(struct snd_sof_dev *sdev)
@@ -46,18 +35,14 @@ static int lnl_hda_dsp_probe(struct snd_sof_dev *sdev)
        if (ret < 0)
                return ret;
 
-       return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), true);
+       hdac_bus_set_dsp_offload(sof_to_bus(sdev), true);
+
+       return 0;
 }
 
 static void lnl_hda_dsp_remove(struct snd_sof_dev *sdev)
 {
-       int ret;
-
-       ret = hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), false);
-       if (ret < 0)
-               dev_warn(sdev->dev,
-                        "Failed to disable offload for DMIC/SSP: %d\n", ret);
-
+       hdac_bus_set_dsp_offload(sof_to_bus(sdev), false);
        hda_dsp_remove(sdev);
 }
 
@@ -69,7 +54,9 @@ static int lnl_hda_dsp_resume(struct snd_sof_dev *sdev)
        if (ret < 0)
                return ret;
 
-       return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), true);
+       hdac_bus_set_dsp_offload(sof_to_bus(sdev), true);
+
+       return 0;
 }
 
 static int lnl_hda_dsp_runtime_resume(struct snd_sof_dev *sdev)
@@ -80,7 +67,9 @@ static int lnl_hda_dsp_runtime_resume(struct snd_sof_dev *sdev)
        if (ret < 0)
                return ret;
 
-       return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), true);
+       hdac_bus_set_dsp_offload(sof_to_bus(sdev), true);
+
+       return 0;
 }
 
 static int lnl_dsp_post_fw_run(struct snd_sof_dev *sdev)