From eac82456bb9dc9d99258fd482d0dc45c04c4f605 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Mon, 11 Jun 2018 17:28:18 +0800 Subject: [PATCH] ASoC: rockchip: multi_dais_pcm: drop dma chan if channel map is zero Change-Id: I00606c0b5f57f6e3d10ab9c41fd51ce8f10e8b35 Signed-off-by: Sugar Zhang --- sound/soc/rockchip/rockchip_multi_dais_pcm.c | 23 +++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sound/soc/rockchip/rockchip_multi_dais_pcm.c b/sound/soc/rockchip/rockchip_multi_dais_pcm.c index fd3b4db3d12d..c2f8e45dc17b 100644 --- a/sound/soc/rockchip/rockchip_multi_dais_pcm.c +++ b/sound/soc/rockchip/rockchip_multi_dais_pcm.c @@ -491,10 +491,13 @@ int snd_dmaengine_mpcm_register(struct rk_mdais_dev *mdais) struct device *child; struct dmaengine_mpcm *pcm; struct dma_chan *chan; + unsigned int *tx_maps, *rx_maps; int ret, i, num; dev = mdais->dev; num = mdais->num_dais; + tx_maps = mdais->playback_channel_maps; + rx_maps = mdais->capture_channel_maps; pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); if (!pcm) return -ENOMEM; @@ -502,15 +505,19 @@ int snd_dmaengine_mpcm_register(struct rk_mdais_dev *mdais) pcm->mdais = mdais; for (i = 0; i < num; i++) { child = mdais->dais[i].dev; - chan = dma_request_slave_channel_reason(child, "tx"); - if (IS_ERR(chan)) - chan = NULL; - pcm->tx_chans[i] = chan; + if (tx_maps[i]) { + chan = dma_request_slave_channel_reason(child, "tx"); + if (IS_ERR(chan)) + chan = NULL; + pcm->tx_chans[i] = chan; + } - chan = dma_request_slave_channel_reason(child, "rx"); - if (IS_ERR(chan)) - chan = NULL; - pcm->rx_chans[i] = chan; + if (rx_maps[i]) { + chan = dma_request_slave_channel_reason(child, "rx"); + if (IS_ERR(chan)) + chan = NULL; + pcm->rx_chans[i] = chan; + } } ret = snd_soc_add_platform(dev, &pcm->platform,