mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
ASoC: rockchip: multi_dais_pcm: skip the device that has no channel
Example: dais = <&i2s1_8ch>, <&pdm>; capture,channel-mapping = <2 4>; playback,channel-mapping = <2 0>; The pdm has no playback channel. It cannot be set as master_chan. Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com> Change-Id: I8e1dd679f99d3b60074f12a6b1c8f880bcad35c4
This commit is contained in:
@@ -119,6 +119,18 @@ static void dmaengine_mpcm_dma_complete(void *arg)
|
||||
snd_pcm_period_elapsed(substream);
|
||||
}
|
||||
|
||||
static void dmaengine_mpcm_get_master_chan(struct dmaengine_mpcm_runtime_data *prtd)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = prtd->num_chans; i > 0; i--) {
|
||||
if (prtd->chans[i - 1]) {
|
||||
prtd->master_chan = i - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int dmaengine_mpcm_prepare_and_submit(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct dmaengine_mpcm_runtime_data *prtd = substream_to_prtd(substream);
|
||||
@@ -157,7 +169,9 @@ static int dmaengine_mpcm_prepare_and_submit(struct snd_pcm_substream *substream
|
||||
if (desc) {
|
||||
desc->callback = dmaengine_mpcm_dma_complete;
|
||||
desc->callback_param = substream;
|
||||
prtd->master_chan = i - 1;
|
||||
dmaengine_mpcm_get_master_chan(prtd);
|
||||
} else {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user