Skip to contentSkip to conversation

ASoC: SOF: Intel: Enable offload for UAOL for LNL+

PATCH In review Peter Ujfalusi 2 participants 4 messages May 20 – May 22

Subsystems (3)
lore
Share & tools
lore

Peter Ujfalusi

author maintainer
#0 lore raw

cover ASoC: SOF: Intel: Enable offload for UAOL for LNL+

Hi,

The USB Audio Offload (UAOL) can only be used from the DSP side and on Lunar Lake (ACE2) and newer platforms the access to it's register space must be granted by the host, just like for SSP or DMIC.

This series enable the offload for UAOL for LNL or newer devices.

Regards,
Peter
---
Peter Ujfalusi (2):
ASoC: SOF: Intel: hda-mlink/lnl: Convert offload enable functions to
void
ASoC: SOF: Intel: lnl: Enable offload for UAOL link

 include/sound/hda-mlink.h       |  5 ++---
 sound/soc/sof/intel/hda-mlink.c | 11 +++------
 sound/soc/sof/intel/lnl.c       | 40 +++++++++++++--------------------
 3 files changed, 20 insertions(+), 36 deletions(-)
Signature · 1 line
2.54.0
author maintainer
#1 lore raw

PATCH 1/2 ASoC: SOF: Intel: hda-mlink/lnl: Convert offload enable functions to void

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.

---
 include/sound/hda-mlink.h       |  5 ++---
 sound/soc/sof/intel/hda-mlink.c | 11 +++-------
 sound/soc/sof/intel/lnl.c       | 39 ++++++++++++---------------------
 3 files changed, 19 insertions(+), 36 deletions(-)
include/sound/hda-mlink.h +2 -3
index 4327317be6af..fed69998c93f 100644
@@ -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
sound/soc/sof/intel/hda-mlink.c +3 -8
index ce603a2343de..92314e3b568a 100644
@@ -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");
 
sound/soc/sof/intel/lnl.c +14 -25
index c01ea7e731aa..19f753dca30b 100644
@@ -20,22 +20,11 @@
 #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)
Signature · 1 line
2.54.0
author maintainer
#2 lore raw

PATCH 2/2 ASoC: SOF: Intel: lnl: Enable offload for UAOL link

In reply to Peter Ujfalusi

The handling of UAOL (USB Audio Offload Link) is similar to SSP and DMIC, it is handled by the DSP firmware.
Set the offload enable for it similar to SSP and DMIC.

---
 sound/soc/sof/intel/lnl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/sof/intel/lnl.c +2 -1
index 19f753dca30b..83703ebc6385 100644
@@ -20,11 +20,12 @@
 #include "lnl.h"
 #include <sound/hda-mlink.h>
 
-/* Configure DSP offload for DMIC/SSP */
+/* Configure DSP offload for DMIC/SSP/UAOL */
 static void hdac_bus_set_dsp_offload(struct hdac_bus *bus, bool enable)
 {
 	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);
+	hdac_bus_eml_enable_offload(bus, true, AZX_REG_ML_LEPTR_ID_INTEL_UAOL, enable);
 }
 
 static int lnl_hda_dsp_probe(struct snd_sof_dev *sdev)
Signature · 1 line
2.54.0
maintainer
#3 lore raw
In reply to Peter Ujfalusi
Quoted 9 lines · Peter Ujfalusi

ASoC: SOF: Intel: Enable offload for UAOL for LNL+

Hi,

The USB Audio Offload (UAOL) can only be used from the DSP side and on Lunar Lake (ACE2) and newer platforms the access to it's register space must be granted by the host, just like for SSP or DMIC.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2

Thanks!

[1/2] ASoC: SOF: Intel: hda-mlink/lnl: Convert offload enable functions to void

      https://git.kernel.org/broonie/sound/c/978152b2cab5
[2/2] ASoC: SOF: Intel: lnl: Enable offload for UAOL link
      https://git.kernel.org/broonie/sound/c/fdfbd9ff86a1

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark