summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/intel/hda-dai-ops.c
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2023-06-02 15:56:15 -0500
committerMark Brown <broonie@kernel.org>2023-06-05 14:00:55 +0100
commitd1bf58474d17a77a26bc27ff85a4e5c4fefc0934 (patch)
tree52632c336f52f4008b1f44a4e32923a2492c7db8 /sound/soc/sof/intel/hda-dai-ops.c
parent767cda3fdac0faec84dc3fd654bd9d09b55eef40 (diff)
downloadlinux-stable-d1bf58474d17a77a26bc27ff85a4e5c4fefc0934.tar.gz
linux-stable-d1bf58474d17a77a26bc27ff85a4e5c4fefc0934.tar.bz2
linux-stable-d1bf58474d17a77a26bc27ff85a4e5c4fefc0934.zip
ASoC: SOF: Intel: hda-dai: add get_hlink callback
The existing code for HDAudio DAIs cannot be extended to other types of DAIs, specific programming sequences need to be abstracted away. This patch hides the mechanism to determine the multi-link structure related to the DAI and program the LOSIDV register. An added benefit is that we can remove all references to the codec DAI from what should be a CPU dai configuration only. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230602205620.310879-5-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/intel/hda-dai-ops.c')
-rw-r--r--sound/soc/sof/intel/hda-dai-ops.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sound/soc/sof/intel/hda-dai-ops.c b/sound/soc/sof/intel/hda-dai-ops.c
index 88fee1e256b0..f3513796c189 100644
--- a/sound/soc/sof/intel/hda-dai-ops.c
+++ b/sound/soc/sof/intel/hda-dai-ops.c
@@ -209,6 +209,16 @@ static unsigned int hda_calc_stream_format(struct snd_sof_dev *sdev,
return format_val;
}
+static struct hdac_ext_link *hda_get_hlink(struct snd_sof_dev *sdev,
+ struct snd_pcm_substream *substream)
+{
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+ struct hdac_bus *bus = sof_to_bus(sdev);
+
+ return snd_hdac_ext_bus_get_hlink_by_name(bus, codec_dai->component->name);
+}
+
static int hda_ipc4_pre_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai,
struct snd_pcm_substream *substream, int cmd)
{
@@ -344,6 +354,7 @@ static const struct hda_dai_widget_dma_ops hda_ipc4_dma_ops = {
.post_trigger = hda_ipc4_post_trigger,
.codec_dai_set_stream = hda_codec_dai_set_stream,
.calc_stream_format = hda_calc_stream_format,
+ .get_hlink = hda_get_hlink,
};
static const struct hda_dai_widget_dma_ops hda_ipc4_chain_dma_ops = {
@@ -355,6 +366,7 @@ static const struct hda_dai_widget_dma_ops hda_ipc4_chain_dma_ops = {
.trigger = hda_trigger,
.codec_dai_set_stream = hda_codec_dai_set_stream,
.calc_stream_format = hda_calc_stream_format,
+ .get_hlink = hda_get_hlink,
};
static int hda_ipc3_post_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai,
@@ -390,6 +402,7 @@ static const struct hda_dai_widget_dma_ops hda_ipc3_dma_ops = {
.post_trigger = hda_ipc3_post_trigger,
.codec_dai_set_stream = hda_codec_dai_set_stream,
.calc_stream_format = hda_calc_stream_format,
+ .get_hlink = hda_get_hlink,
};
static struct hdac_ext_stream *
@@ -418,6 +431,7 @@ static const struct hda_dai_widget_dma_ops hda_dspless_dma_ops = {
.setup_hext_stream = hda_dspless_setup_hext_stream,
.codec_dai_set_stream = hda_codec_dai_set_stream,
.calc_stream_format = hda_calc_stream_format,
+ .get_hlink = hda_get_hlink,
};
#endif