ASoC: Return error if the function does not support multi-cpu
authorBard Liao <yung-chuan.liao@linux.intel.com>
Tue, 25 Feb 2020 13:39:16 +0000 (21:39 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 26 Feb 2020 17:35:04 +0000 (17:35 +0000)
Multi cpu is not supported by all functions yet. Add an error message
and return.

Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20200225133917.21314-6-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-compress.c
sound/soc/soc-generic-dmaengine-pcm.c
sound/soc/soc-pcm.c

index 392a1c5..50062eb 100644 (file)
@@ -810,9 +810,10 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
        int playback = 0, capture = 0;
        int i;
 
-       if (rtd->num_codecs > 1) {
+       if (rtd->num_cpus > 1 ||
+           rtd->num_codecs > 1) {
                dev_err(rtd->card->dev,
-                       "Compress ASoC: Multicodec not supported\n");
+                       "Compress ASoC: Multi CPU/Codec not supported\n");
                return -EINVAL;
        }
 
index d6b4831..facf192 100644 (file)
@@ -62,6 +62,12 @@ int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
        struct snd_dmaengine_dai_dma_data *dma_data;
        int ret;
 
+       if (rtd->num_cpus > 1) {
+               dev_err(rtd->dev,
+                       "%s doesn't support Multi CPU yet\n", __func__);
+               return -EINVAL;
+       }
+
        dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
 
        ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config);
@@ -118,6 +124,12 @@ dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component,
        struct snd_dmaengine_dai_dma_data *dma_data;
        struct snd_pcm_hardware hw;
 
+       if (rtd->num_cpus > 1) {
+               dev_err(rtd->dev,
+                       "%s doesn't support Multi CPU yet\n", __func__);
+               return -EINVAL;
+       }
+
        if (pcm->config && pcm->config->pcm_hardware)
                return snd_soc_set_runtime_hwparams(substream,
                                pcm->config->pcm_hardware);
@@ -185,6 +197,12 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel(
        struct snd_dmaengine_dai_dma_data *dma_data;
        dma_filter_fn fn = NULL;
 
+       if (rtd->num_cpus > 1) {
+               dev_err(rtd->dev,
+                       "%s doesn't support Multi CPU yet\n", __func__);
+               return NULL;
+       }
+
        dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
 
        if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0])
index 44694e6..adbceaf 100644 (file)
@@ -125,6 +125,12 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf,
        int stream;
        char *buf;
 
+       if (fe->num_cpus > 1) {
+               dev_err(fe->dev,
+                       "%s doesn't support Multi CPU yet\n", __func__);
+               return -EINVAL;
+       }
+
        buf = kmalloc(out_count, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
@@ -1550,6 +1556,12 @@ int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
        struct snd_soc_dai *cpu_dai = fe->cpu_dai;
        int paths;
 
+       if (fe->num_cpus > 1) {
+               dev_err(fe->dev,
+                       "%s doesn't support Multi CPU yet\n", __func__);
+               return -EINVAL;
+       }
+
        /* get number of valid DAI paths and their widgets */
        paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list,
                        dpcm_end_walk_at_be);
@@ -2834,6 +2846,12 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
        int count, paths;
        int ret;
 
+       if (fe->num_cpus > 1) {
+               dev_err(fe->dev,
+                       "%s doesn't support Multi CPU yet\n", __func__);
+               return -EINVAL;
+       }
+
        if (!fe->dai_link->dynamic)
                return 0;