Skip to content

Commit baa31e4

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. Signed-off-by: Peter Ujfalusi <[email protected]>
1 parent f9c0e38 commit baa31e4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,8 @@ int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
269269
{
270270
const struct sof_intel_dsp_desc *chip_info = get_chip_info(sdev->pdata);
271271
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
272+
struct hdac_ext_stream *hext_stream_match = NULL;
272273
struct hdac_bus *bus = sof_to_bus(sdev);
273-
struct sof_intel_hda_stream *hda_stream;
274-
struct hdac_ext_stream *hext_stream;
275274
struct hdac_stream *s;
276275
bool dmi_l1_enable = true;
277276
bool found = false;
@@ -283,20 +282,34 @@ int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
283282
* that are DMI L1 incompatible.
284283
*/
285284
list_for_each_entry(s, &bus->stream_list, list) {
285+
struct sof_intel_hda_stream *hda_stream;
286+
struct hdac_ext_stream *hext_stream;
287+
286288
hext_stream = stream_to_hdac_ext_stream(s);
287289
hda_stream = container_of(hext_stream, struct sof_intel_hda_stream, hext_stream);
288290

289291
if (!s->opened)
290292
continue;
291293

292294
if (s->direction == direction && s->stream_tag == stream_tag) {
295+
hext_stream_match = hext_stream;
293296
s->opened = false;
294297
found = true;
295298
} else if (!(hda_stream->flags & SOF_HDA_STREAM_DMI_L1_COMPATIBLE)) {
296299
dmi_l1_enable = false;
297300
}
298301
}
299302

303+
if (!sdev->dspless_mode_selected && hext_stream_match) {
304+
/* couple host and link DMA if link DMA channel is idle */
305+
if (!hext_stream_match->link_locked) {
306+
u32 mask = BIT(hext_stream_match->hstream.index);
307+
308+
snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR,
309+
SOF_HDA_REG_PP_PPCTL, mask, 0);
310+
}
311+
}
312+
300313
spin_unlock_irq(&bus->reg_lock);
301314

302315
/* Enable DMI L1 if permitted */

0 commit comments

Comments
 (0)