@@ -210,8 +210,8 @@ int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev,
210210}
211211
212212/* get next unused stream */
213- struct hdac_ext_stream *
214- hda_dsp_stream_get (struct snd_sof_dev * sdev , int direction , u32 flags )
213+ static struct hdac_ext_stream *
214+ _hda_dsp_stream_get (struct snd_sof_dev * sdev , int direction , u32 flags , bool pair )
215215{
216216 const struct sof_intel_dsp_desc * chip_info = get_chip_info (sdev -> pdata );
217217 struct sof_intel_hda_dev * hda = sdev -> pdata -> hw_pdata ;
@@ -233,7 +233,14 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags)
233233 if (hda_stream -> host_reserved )
234234 continue ;
235235
236+ if (pair && hext_stream -> link_locked )
237+ continue ;
238+
236239 s -> opened = true;
240+
241+ if (pair )
242+ hext_stream -> link_locked = true;
243+
237244 break ;
238245 }
239246 }
@@ -264,14 +271,27 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags)
264271 return hext_stream ;
265272}
266273
274+ struct hdac_ext_stream *
275+ hda_dsp_stream_get (struct snd_sof_dev * sdev , int direction , u32 flags )
276+ {
277+ return _hda_dsp_stream_get (sdev , direction , flags , false);
278+ }
279+
280+ struct hdac_ext_stream *
281+ hda_dsp_stream_pair_get (struct snd_sof_dev * sdev , int direction , u32 flags )
282+ {
283+ return _hda_dsp_stream_get (sdev , direction , flags , true);
284+ }
285+
267286/* free a stream */
268- int hda_dsp_stream_put (struct snd_sof_dev * sdev , int direction , int stream_tag )
287+ static int _hda_dsp_stream_put (struct snd_sof_dev * sdev , int direction , int stream_tag , bool pair )
269288{
270289 const struct sof_intel_dsp_desc * chip_info = get_chip_info (sdev -> pdata );
271290 struct sof_intel_hda_dev * hda = sdev -> pdata -> hw_pdata ;
272291 struct hdac_bus * bus = sof_to_bus (sdev );
273292 struct sof_intel_hda_stream * hda_stream ;
274293 struct hdac_ext_stream * hext_stream ;
294+ struct hdac_ext_stream * link_stream ;
275295 struct hdac_stream * s ;
276296 bool dmi_l1_enable = true;
277297 bool found = false;
@@ -292,6 +312,8 @@ int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
292312 if (s -> direction == direction && s -> stream_tag == stream_tag ) {
293313 s -> opened = false;
294314 found = true;
315+ if (pair )
316+ link_stream = hext_stream ;
295317 } else if (!(hda_stream -> flags & SOF_HDA_STREAM_DMI_L1_COMPATIBLE )) {
296318 dmi_l1_enable = false;
297319 }
@@ -312,9 +334,22 @@ int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
312334 return - ENODEV ;
313335 }
314336
337+ if (pair )
338+ snd_hdac_ext_stream_release (link_stream , HDAC_EXT_STREAM_TYPE_LINK );
339+
315340 return 0 ;
316341}
317342
343+ int hda_dsp_stream_put (struct snd_sof_dev * sdev , int direction , int stream_tag )
344+ {
345+ return _hda_dsp_stream_put (sdev , direction , stream_tag , false);
346+ }
347+
348+ int hda_dsp_stream_pair_put (struct snd_sof_dev * sdev , int direction , int stream_tag )
349+ {
350+ return _hda_dsp_stream_put (sdev , direction , stream_tag , true);
351+ }
352+
318353static int hda_dsp_stream_reset (struct snd_sof_dev * sdev , struct hdac_stream * hstream )
319354{
320355 int sd_offset = SOF_STREAM_SD_OFFSET (hstream );
0 commit comments