Skip to content

Commit c79e2c5

Browse files
committed
ASoC: SOF: Intel: get a stream that both host and link DMAs are available
Add a flag to indicate we are looking for a stream that both host and link DMAs are available. The stream will be used by the SoundWire BRA and the same host and link DMA IDs will be used. Signed-off-by: Bard Liao <[email protected]>
1 parent 3bdeb93 commit c79e2c5

File tree

6 files changed

+14
-6
lines changed

6 files changed

+14
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ hda_cl_prepare(struct device *dev, unsigned int format, unsigned int size,
5858
struct hdac_stream *hstream;
5959
int ret;
6060

61-
hext_stream = hda_dsp_stream_get(sdev, direction, 0);
61+
hext_stream = hda_dsp_stream_get(sdev, direction, 0, true);
6262

6363
if (!hext_stream) {
6464
dev_err(sdev->dev, "error: no stream available\n");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
260260
spcm->stream[substream->stream].d0i3_compatible)
261261
flags |= SOF_HDA_STREAM_DMI_L1_COMPATIBLE;
262262

263-
dsp_stream = hda_dsp_stream_get(sdev, direction, flags);
263+
dsp_stream = hda_dsp_stream_get(sdev, direction, flags, false);
264264
if (!dsp_stream) {
265265
dev_err(sdev->dev, "error: no stream available\n");
266266
return -ENODEV;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static int hda_probes_compr_startup(struct sof_client_dev *cdev,
3232
struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev);
3333
struct hdac_ext_stream *hext_stream;
3434

35-
hext_stream = hda_dsp_stream_get(sdev, cstream->direction, 0);
35+
hext_stream = hda_dsp_stream_get(sdev, cstream->direction, 0, false);
3636
if (!hext_stream)
3737
return -EBUSY;
3838

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev,
211211

212212
/* get next unused stream */
213213
struct hdac_ext_stream *
214-
hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags)
214+
hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags, bool same_host_link_dma)
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,6 +233,13 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags)
233233
if (hda_stream->host_reserved)
234234
continue;
235235

236+
/*
237+
* check if the link stream is available if the same host
238+
* and link dma is used
239+
*/
240+
if (same_host_link_dma && hext_stream->link_locked)
241+
continue;
242+
236243
s->opened = true;
237244
break;
238245
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
4343
int ret;
4444

4545
hda->dtrace_stream = hda_dsp_stream_get(sdev, SNDRV_PCM_STREAM_CAPTURE,
46-
SOF_HDA_STREAM_DMI_L1_COMPATIBLE);
46+
SOF_HDA_STREAM_DMI_L1_COMPATIBLE, false);
4747

4848
if (!hda->dtrace_stream) {
4949
dev_err(sdev->dev,

sound/soc/sof/intel/hda.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,8 @@ u64 hda_dsp_get_stream_ldp(struct snd_sof_dev *sdev,
693693
struct snd_pcm_substream *substream);
694694

695695
struct hdac_ext_stream *
696-
hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags);
696+
hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags,
697+
bool same_host_link_dma);
697698
int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag);
698699
int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev,
699700
struct hdac_ext_stream *hext_stream,

0 commit comments

Comments
 (0)