Commit 2205c63d authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: SOF: Intel: hda-dai: add codec_dai_set_stream callback

The existing code for HDAudio DAIs cannot be extended to other types
of DAIs, specific programming sequences need to be abstracted
away. Start here with hiding the stream_tag needed by the HDAudio
codec_dai.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230602205620.310879-3-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c4be6024
...@@ -175,6 +175,17 @@ static void hda_reset_hext_stream(struct snd_sof_dev *sdev, struct hdac_ext_stre ...@@ -175,6 +175,17 @@ static void hda_reset_hext_stream(struct snd_sof_dev *sdev, struct hdac_ext_stre
snd_hdac_ext_stream_reset(hext_stream); snd_hdac_ext_stream_reset(hext_stream);
} }
static void hda_codec_dai_set_stream(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream,
struct hdac_stream *hstream)
{
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
/* set the hdac_stream in the codec dai */
snd_soc_dai_set_stream(codec_dai, hstream, substream->stream);
}
static int hda_ipc4_pre_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai, static int hda_ipc4_pre_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai,
struct snd_pcm_substream *substream, int cmd) struct snd_pcm_substream *substream, int cmd)
{ {
...@@ -307,7 +318,8 @@ static const struct hda_dai_widget_dma_ops hda_ipc4_dma_ops = { ...@@ -307,7 +318,8 @@ static const struct hda_dai_widget_dma_ops hda_ipc4_dma_ops = {
.reset_hext_stream = hda_reset_hext_stream, .reset_hext_stream = hda_reset_hext_stream,
.pre_trigger = hda_ipc4_pre_trigger, .pre_trigger = hda_ipc4_pre_trigger,
.trigger = hda_trigger, .trigger = hda_trigger,
.post_trigger = hda_ipc4_post_trigger .post_trigger = hda_ipc4_post_trigger,
.codec_dai_set_stream = hda_codec_dai_set_stream,
}; };
static const struct hda_dai_widget_dma_ops hda_ipc4_chain_dma_ops = { static const struct hda_dai_widget_dma_ops hda_ipc4_chain_dma_ops = {
...@@ -317,6 +329,7 @@ static const struct hda_dai_widget_dma_ops hda_ipc4_chain_dma_ops = { ...@@ -317,6 +329,7 @@ static const struct hda_dai_widget_dma_ops hda_ipc4_chain_dma_ops = {
.setup_hext_stream = hda_setup_hext_stream, .setup_hext_stream = hda_setup_hext_stream,
.reset_hext_stream = hda_reset_hext_stream, .reset_hext_stream = hda_reset_hext_stream,
.trigger = hda_trigger, .trigger = hda_trigger,
.codec_dai_set_stream = hda_codec_dai_set_stream,
}; };
static int hda_ipc3_post_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai, static int hda_ipc3_post_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai,
...@@ -350,6 +363,7 @@ static const struct hda_dai_widget_dma_ops hda_ipc3_dma_ops = { ...@@ -350,6 +363,7 @@ static const struct hda_dai_widget_dma_ops hda_ipc3_dma_ops = {
.reset_hext_stream = hda_reset_hext_stream, .reset_hext_stream = hda_reset_hext_stream,
.trigger = hda_trigger, .trigger = hda_trigger,
.post_trigger = hda_ipc3_post_trigger, .post_trigger = hda_ipc3_post_trigger,
.codec_dai_set_stream = hda_codec_dai_set_stream,
}; };
static struct hdac_ext_stream * static struct hdac_ext_stream *
...@@ -376,6 +390,7 @@ static void hda_dspless_setup_hext_stream(struct snd_sof_dev *sdev, ...@@ -376,6 +390,7 @@ static void hda_dspless_setup_hext_stream(struct snd_sof_dev *sdev,
static const struct hda_dai_widget_dma_ops hda_dspless_dma_ops = { static const struct hda_dai_widget_dma_ops hda_dspless_dma_ops = {
.get_hext_stream = hda_dspless_get_hext_stream, .get_hext_stream = hda_dspless_get_hext_stream,
.setup_hext_stream = hda_dspless_setup_hext_stream, .setup_hext_stream = hda_dspless_setup_hext_stream,
.codec_dai_set_stream = hda_codec_dai_set_stream,
}; };
#endif #endif
......
...@@ -192,7 +192,8 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream, ...@@ -192,7 +192,8 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
snd_hdac_ext_bus_link_set_stream_id(hlink, stream_tag); snd_hdac_ext_bus_link_set_stream_id(hlink, stream_tag);
/* set the hdac_stream in the codec dai */ /* set the hdac_stream in the codec dai */
snd_soc_dai_set_stream(codec_dai, hdac_stream(hext_stream), substream->stream); if (ops->codec_dai_set_stream)
ops->codec_dai_set_stream(sdev, substream, hstream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
link_bps = codec_dai->driver->playback.sig_bits; link_bps = codec_dai->driver->playback.sig_bits;
......
...@@ -919,6 +919,7 @@ int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev, ...@@ -919,6 +919,7 @@ int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev,
* @pre_trigger: Function pointer for DAI DMA pre-trigger actions * @pre_trigger: Function pointer for DAI DMA pre-trigger actions
* @trigger: Function pointer for DAI DMA trigger actions * @trigger: Function pointer for DAI DMA trigger actions
* @post_trigger: Function pointer for DAI DMA post-trigger actions * @post_trigger: Function pointer for DAI DMA post-trigger actions
* @codec_dai_set_stream: Function pointer to set codec-side stream information
*/ */
struct hda_dai_widget_dma_ops { struct hda_dai_widget_dma_ops {
struct hdac_ext_stream *(*get_hext_stream)(struct snd_sof_dev *sdev, struct hdac_ext_stream *(*get_hext_stream)(struct snd_sof_dev *sdev,
...@@ -938,6 +939,9 @@ struct hda_dai_widget_dma_ops { ...@@ -938,6 +939,9 @@ struct hda_dai_widget_dma_ops {
struct snd_pcm_substream *substream, int cmd); struct snd_pcm_substream *substream, int cmd);
int (*post_trigger)(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai, int (*post_trigger)(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai,
struct snd_pcm_substream *substream, int cmd); struct snd_pcm_substream *substream, int cmd);
void (*codec_dai_set_stream)(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream,
struct hdac_stream *hstream);
}; };
const struct hda_dai_widget_dma_ops * const struct hda_dai_widget_dma_ops *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment