Skip to content

Commit f423930

Browse files
committed
ASoC: SOF: Intel: hda-mlink: add helper to retrieve eml_lock
For SoundWire usages, we need to use the global eml_lock to serialize/protect all accesses to shared registers. Due to the split implementation across two subsystems, we need to pass a pointer around. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent 063588e commit f423930

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

include/sound/hda-mlink.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ int hda_bus_ml_suspend(struct hdac_bus *bus);
5252
struct hdac_ext_link *hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus);
5353
struct hdac_ext_link *hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus);
5454

55+
struct mutex *hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid);
56+
5557
int hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable);
5658

5759
#else
@@ -153,6 +155,9 @@ hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus) { return NULL; }
153155
static inline struct hdac_ext_link *
154156
hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus) { return NULL; }
155157

158+
static inline struct mutex *
159+
hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid) { return NULL; }
160+
156161
static inline int
157162
hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
158163
{

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,18 @@ int hda_bus_ml_suspend(struct hdac_bus *bus)
800800
}
801801
EXPORT_SYMBOL_NS(hda_bus_ml_suspend, SND_SOC_SOF_HDA_MLINK);
802802

803+
struct mutex *hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid)
804+
{
805+
struct hdac_ext2_link *h2link;
806+
807+
h2link = find_ext2_link(bus, alt, elid);
808+
if (!h2link)
809+
return NULL;
810+
811+
return &h2link->eml_lock;
812+
}
813+
EXPORT_SYMBOL_NS(hdac_bus_eml_get_mutex, SND_SOC_SOF_HDA_MLINK);
814+
803815
struct hdac_ext_link *hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus)
804816
{
805817
struct hdac_ext2_link *h2link;

0 commit comments

Comments
 (0)