Skip to content

Commit 79dc660

Browse files
committed
ASoC: SOF: Intel: Make sure that link and host DMA is coupled after use
Couple the Host and Link DMA when the stream is put. When the hda_dsp_stream_hw_free() is called the Link DMA might be still locked and we would leave the DMAs decoupled. hda_dsp_stream_hw_free() is not called for code loader use or in case of probes or trace use for example. Signed-off-by: Peter Ujfalusi <[email protected]>
1 parent 964c624 commit 79dc660

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,8 @@ static int _hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stre
288288
{
289289
const struct sof_intel_dsp_desc *chip_info = get_chip_info(sdev->pdata);
290290
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
291+
struct hdac_ext_stream *hext_stream_match = NULL;
291292
struct hdac_bus *bus = sof_to_bus(sdev);
292-
struct sof_intel_hda_stream *hda_stream;
293-
struct hdac_ext_stream *hext_stream;
294293
struct hdac_ext_stream *link_stream;
295294
struct hdac_stream *s;
296295
bool dmi_l1_enable = true;
@@ -303,13 +302,17 @@ static int _hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stre
303302
* that are DMI L1 incompatible.
304303
*/
305304
list_for_each_entry(s, &bus->stream_list, list) {
305+
struct sof_intel_hda_stream *hda_stream;
306+
struct hdac_ext_stream *hext_stream;
307+
306308
hext_stream = stream_to_hdac_ext_stream(s);
307309
hda_stream = container_of(hext_stream, struct sof_intel_hda_stream, hext_stream);
308310

309311
if (!s->opened)
310312
continue;
311313

312314
if (s->direction == direction && s->stream_tag == stream_tag) {
315+
hext_stream_match = hext_stream;
313316
s->opened = false;
314317
found = true;
315318
if (pair)
@@ -319,6 +322,20 @@ static int _hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stre
319322
}
320323
}
321324

325+
if (!sdev->dspless_mode_selected && !pair && hext_stream_match) {
326+
/*
327+
* Couple host and link DMA if link DMA is unused
328+
* In case of channel pair the snd_hdac_ext_stream_release() will
329+
* take care of coupling te HDA channel.
330+
*/
331+
if (!hext_stream_match->link_locked) {
332+
u32 mask = BIT(hext_stream_match->hstream.index);
333+
334+
snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR,
335+
SOF_HDA_REG_PP_PPCTL, mask, 0);
336+
}
337+
}
338+
322339
spin_unlock_irq(&bus->reg_lock);
323340

324341
/* Enable DMI L1 if permitted */

0 commit comments

Comments
 (0)