Skip to content

Commit eac8245

Browse files
Sugar Zhangrkhuangtao
authored andcommitted
ASoC: rockchip: multi_dais_pcm: drop dma chan if channel map is zero
Change-Id: I00606c0b5f57f6e3d10ab9c41fd51ce8f10e8b35 Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
1 parent 576b831 commit eac8245

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

sound/soc/rockchip/rockchip_multi_dais_pcm.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -491,26 +491,33 @@ int snd_dmaengine_mpcm_register(struct rk_mdais_dev *mdais)
491491
struct device *child;
492492
struct dmaengine_mpcm *pcm;
493493
struct dma_chan *chan;
494+
unsigned int *tx_maps, *rx_maps;
494495
int ret, i, num;
495496

496497
dev = mdais->dev;
497498
num = mdais->num_dais;
499+
tx_maps = mdais->playback_channel_maps;
500+
rx_maps = mdais->capture_channel_maps;
498501
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
499502
if (!pcm)
500503
return -ENOMEM;
501504

502505
pcm->mdais = mdais;
503506
for (i = 0; i < num; i++) {
504507
child = mdais->dais[i].dev;
505-
chan = dma_request_slave_channel_reason(child, "tx");
506-
if (IS_ERR(chan))
507-
chan = NULL;
508-
pcm->tx_chans[i] = chan;
509-
510-
chan = dma_request_slave_channel_reason(child, "rx");
511-
if (IS_ERR(chan))
512-
chan = NULL;
513-
pcm->rx_chans[i] = chan;
508+
if (tx_maps[i]) {
509+
chan = dma_request_slave_channel_reason(child, "tx");
510+
if (IS_ERR(chan))
511+
chan = NULL;
512+
pcm->tx_chans[i] = chan;
513+
}
514+
515+
if (rx_maps[i]) {
516+
chan = dma_request_slave_channel_reason(child, "rx");
517+
if (IS_ERR(chan))
518+
chan = NULL;
519+
pcm->rx_chans[i] = chan;
520+
}
514521
}
515522

516523
ret = snd_soc_add_platform(dev, &pcm->platform,

0 commit comments

Comments
 (0)