Skip to content

Commit 37d65a2

Browse files
committed
Merge series "ASoC: more fixes for dpcm checks" from Pierre-Louis Bossart <[email protected]>:
This is hopefully the last set of fixes to avoid probe errors due to stricter checks of DAI capabilities introduced late in the 5.8 cycle. Daniel Baluta (1): ASoC: SOF: imx: add min/max channels for SAI/ESAI on i.MX8/i.MX8M Pierre-Louis Bossart (2): ASoC: soc-dai: set dai_link dpcm_ flags with a helper ASoC: Intel: bdw-rt5677: fix non BE conversion include/sound/soc-dai.h | 1 + sound/soc/generic/audio-graph-card.c | 4 +-- sound/soc/generic/simple-card.c | 4 +-- sound/soc/intel/boards/bdw-rt5677.c | 1 + sound/soc/soc-dai.c | 38 ++++++++++++++++++++++++++++ sound/soc/sof/imx/imx8.c | 8 ++++++ sound/soc/sof/imx/imx8m.c | 8 ++++++ 7 files changed, 60 insertions(+), 4 deletions(-) base-commit: a5911ac -- 2.25.1
2 parents 1e9c7ce + 4e7f8ca commit 37d65a2

File tree

7 files changed

+60
-4
lines changed

7 files changed

+60
-4
lines changed

include/sound/soc-dai.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ void snd_soc_dai_resume(struct snd_soc_dai *dai);
161161
int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
162162
struct snd_soc_pcm_runtime *rtd, int num);
163163
bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream);
164+
void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link);
164165
void snd_soc_dai_action(struct snd_soc_dai *dai,
165166
int stream, int action);
166167
static inline void snd_soc_dai_activate(struct snd_soc_dai *dai,

sound/soc/generic/audio-graph-card.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
317317
if (ret < 0)
318318
goto out_put_node;
319319

320-
dai_link->dpcm_playback = 1;
321-
dai_link->dpcm_capture = 1;
320+
snd_soc_dai_link_set_capabilities(dai_link);
321+
322322
dai_link->ops = &graph_ops;
323323
dai_link->init = asoc_simple_dai_init;
324324

sound/soc/generic/simple-card.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
231231
if (ret < 0)
232232
goto out_put_node;
233233

234-
dai_link->dpcm_playback = 1;
235-
dai_link->dpcm_capture = 1;
234+
snd_soc_dai_link_set_capabilities(dai_link);
235+
236236
dai_link->ops = &simple_ops;
237237
dai_link->init = asoc_simple_dai_init;
238238

sound/soc/intel/boards/bdw-rt5677.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ static struct snd_soc_dai_link bdw_rt5677_dais[] = {
354354
{
355355
.name = "Codec DSP",
356356
.stream_name = "Wake on Voice",
357+
.capture_only = 1,
357358
.ops = &bdw_rt5677_dsp_ops,
358359
SND_SOC_DAILINK_REG(dsp),
359360
},

sound/soc/soc-dai.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,44 @@ bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int dir)
391391
return stream->channels_min;
392392
}
393393

394+
/*
395+
* snd_soc_dai_link_set_capabilities() - set dai_link properties based on its DAIs
396+
*/
397+
void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link)
398+
{
399+
struct snd_soc_dai_link_component *cpu;
400+
struct snd_soc_dai_link_component *codec;
401+
struct snd_soc_dai *dai;
402+
bool supported[SNDRV_PCM_STREAM_LAST + 1];
403+
int direction;
404+
int i;
405+
406+
for_each_pcm_streams(direction) {
407+
supported[direction] = true;
408+
409+
for_each_link_cpus(dai_link, i, cpu) {
410+
dai = snd_soc_find_dai(cpu);
411+
if (!dai || !snd_soc_dai_stream_valid(dai, direction)) {
412+
supported[direction] = false;
413+
break;
414+
}
415+
}
416+
if (!supported[direction])
417+
continue;
418+
for_each_link_codecs(dai_link, i, codec) {
419+
dai = snd_soc_find_dai(codec);
420+
if (!dai || !snd_soc_dai_stream_valid(dai, direction)) {
421+
supported[direction] = false;
422+
break;
423+
}
424+
}
425+
}
426+
427+
dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK];
428+
dai_link->dpcm_capture = supported[SNDRV_PCM_STREAM_CAPTURE];
429+
}
430+
EXPORT_SYMBOL_GPL(snd_soc_dai_link_set_capabilities);
431+
394432
void snd_soc_dai_action(struct snd_soc_dai *dai,
395433
int stream, int action)
396434
{

sound/soc/sof/imx/imx8.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,14 @@ static int imx8_ipc_pcm_params(struct snd_sof_dev *sdev,
375375
static struct snd_soc_dai_driver imx8_dai[] = {
376376
{
377377
.name = "esai-port",
378+
.playback = {
379+
.channels_min = 1,
380+
.channels_max = 8,
381+
},
382+
.capture = {
383+
.channels_min = 1,
384+
.channels_max = 8,
385+
},
378386
},
379387
};
380388

sound/soc/sof/imx/imx8m.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,14 @@ static int imx8m_ipc_pcm_params(struct snd_sof_dev *sdev,
240240
static struct snd_soc_dai_driver imx8m_dai[] = {
241241
{
242242
.name = "sai-port",
243+
.playback = {
244+
.channels_min = 1,
245+
.channels_max = 32,
246+
},
247+
.capture = {
248+
.channels_min = 1,
249+
.channels_max = 32,
250+
},
243251
},
244252
};
245253

0 commit comments

Comments
 (0)