Skip to content

Commit 20db974

Browse files
committed
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. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent b309a4a commit 20db974

3 files changed

Lines changed: 19 additions & 36 deletions

File tree

include/sound/hda-mlink.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct hdac_ext_link *hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus);
6060

6161
struct mutex *hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid);
6262

63-
int hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable);
63+
void hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable);
6464

6565
/* microphone privacy specific function supported by ACE3+ architecture */
6666
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; }
186186
static inline struct mutex *
187187
hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid) { return NULL; }
188188

189-
static inline int
189+
static inline void
190190
hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
191191
{
192-
return 0;
193192
}
194193

195194
static inline void

sound/soc/sof/intel/hda-mlink.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -988,24 +988,19 @@ struct hdac_ext_link *hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus)
988988
}
989989
EXPORT_SYMBOL_NS(hdac_bus_eml_sdw_get_hlink, "SND_SOC_SOF_HDA_MLINK");
990990

991-
int hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
991+
void hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
992992
{
993993
struct hdac_ext2_link *h2link;
994994
struct hdac_ext_link *hlink;
995995

996996
h2link = find_ext2_link(bus, alt, elid);
997-
if (!h2link)
998-
return -ENODEV;
999-
1000-
if (!h2link->ofls)
1001-
return 0;
997+
if (!h2link || !h2link->ofls)
998+
return;
1002999

10031000
hlink = &h2link->hext_link;
10041001

10051002
scoped_guard(mutex, &h2link->eml_lock)
10061003
hdaml_lctl_offload_enable(hlink->ml_addr + AZX_REG_ML_LCTL, enable);
1007-
1008-
return 0;
10091004
}
10101005
EXPORT_SYMBOL_NS(hdac_bus_eml_enable_offload, "SND_SOC_SOF_HDA_MLINK");
10111006

sound/soc/sof/intel/lnl.c

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,11 @@
2020
#include "lnl.h"
2121
#include <sound/hda-mlink.h>
2222

23-
/* this helps allows the DSP to setup DMIC/SSP */
24-
static int hdac_bus_offload_dmic_ssp(struct hdac_bus *bus, bool enable)
23+
/* Configure DSP offload for DMIC/SSP */
24+
static void hdac_bus_set_dsp_offload(struct hdac_bus *bus, bool enable)
2525
{
26-
int ret;
27-
28-
ret = hdac_bus_eml_enable_offload(bus, true,
29-
AZX_REG_ML_LEPTR_ID_INTEL_SSP, enable);
30-
if (ret < 0)
31-
return ret;
32-
33-
ret = hdac_bus_eml_enable_offload(bus, true,
34-
AZX_REG_ML_LEPTR_ID_INTEL_DMIC, enable);
35-
if (ret < 0)
36-
return ret;
37-
38-
return 0;
26+
hdac_bus_eml_enable_offload(bus, true, AZX_REG_ML_LEPTR_ID_INTEL_SSP, enable);
27+
hdac_bus_eml_enable_offload(bus, true, AZX_REG_ML_LEPTR_ID_INTEL_DMIC, enable);
3928
}
4029

4130
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)
4635
if (ret < 0)
4736
return ret;
4837

49-
return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), true);
38+
hdac_bus_set_dsp_offload(sof_to_bus(sdev), true);
39+
40+
return 0;
5041
}
5142

5243
static void lnl_hda_dsp_remove(struct snd_sof_dev *sdev)
5344
{
54-
int ret;
55-
56-
ret = hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), false);
57-
if (ret < 0)
58-
dev_warn(sdev->dev,
59-
"Failed to disable offload for DMIC/SSP: %d\n", ret);
60-
45+
hdac_bus_set_dsp_offload(sof_to_bus(sdev), false);
6146
hda_dsp_remove(sdev);
6247
}
6348

@@ -69,7 +54,9 @@ static int lnl_hda_dsp_resume(struct snd_sof_dev *sdev)
6954
if (ret < 0)
7055
return ret;
7156

72-
return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), true);
57+
hdac_bus_set_dsp_offload(sof_to_bus(sdev), true);
58+
59+
return 0;
7360
}
7461

7562
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)
8067
if (ret < 0)
8168
return ret;
8269

83-
return hdac_bus_offload_dmic_ssp(sof_to_bus(sdev), true);
70+
hdac_bus_set_dsp_offload(sof_to_bus(sdev), true);
71+
72+
return 0;
8473
}
8574

8675
static int lnl_dsp_post_fw_run(struct snd_sof_dev *sdev)

0 commit comments

Comments
 (0)