Skip to content

Commit

Permalink
ASoC: SOF: Intel: hda-dai: Add setup_hext_stream/reset_hext_stream DM…
Browse files Browse the repository at this point in the history
…A ops

Define and use the setup_hext_stream/reset_hext_stream DMA ops during link
hw_params and cleanup.

Signed-off-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Péter Ujfalusi <[email protected]>
Reviewed-by: Rander Wang <[email protected]>
Signed-off-by: Peter Ujfalusi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
ranj063 authored and broonie committed Mar 7, 2023
1 parent 80afde3 commit e2d6569
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 13 additions & 0 deletions sound/soc/sof/intel/hda-dai-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,23 @@ static void hda_release_hext_stream(struct snd_sof_dev *sdev, struct snd_soc_dai
snd_hdac_ext_stream_release(hext_stream, HDAC_EXT_STREAM_TYPE_LINK);
}

static void hda_setup_hext_stream(struct snd_sof_dev *sdev, struct hdac_ext_stream *hext_stream,
unsigned int format_val)
{
snd_hdac_ext_stream_setup(hext_stream, format_val);
}

static void hda_reset_hext_stream(struct snd_sof_dev *sdev, struct hdac_ext_stream *hext_stream)
{
snd_hdac_ext_stream_reset(hext_stream);
}

static const struct hda_dai_widget_dma_ops hda_dma_ops = {
.get_hext_stream = hda_get_hext_stream,
.assign_hext_stream = hda_assign_hext_stream,
.release_hext_stream = hda_release_hext_stream,
.setup_hext_stream = hda_setup_hext_stream,
.reset_hext_stream = hda_reset_hext_stream,
};

#endif
Expand Down
6 changes: 4 additions & 2 deletions sound/soc/sof/intel/hda-dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,17 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
else
link_bps = codec_dai->driver->capture.sig_bits;

snd_hdac_ext_stream_reset(hext_stream);
if (ops->reset_hext_stream)
ops->reset_hext_stream(sdev, hext_stream);

format_val = snd_hdac_calc_stream_format(params_rate(params), params_channels(params),
params_format(params), link_bps, 0);

dev_dbg(bus->dev, "format_val=%d, rate=%d, ch=%d, format=%d\n",
format_val, params_rate(params), params_channels(params), params_format(params));

snd_hdac_ext_stream_setup(hext_stream, format_val);
if (ops->setup_hext_stream)
ops->setup_hext_stream(sdev, hext_stream, format_val);

hext_stream->link_prepared = 1;

Expand Down

0 comments on commit e2d6569

Please sign in to comment.