Unverified Commit 6e1276a5 authored by Bard Liao's avatar Bard Liao Committed by Mark Brown
Browse files

ASoC: Return error if the function does not support multi-cpu

parent de6214a3
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -810,9 +810,10 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
	int playback = 0, capture = 0;
	int playback = 0, capture = 0;
	int i;
	int i;


	if (rtd->num_codecs > 1) {
	if (rtd->num_cpus > 1 ||
	    rtd->num_codecs > 1) {
		dev_err(rtd->card->dev,
		dev_err(rtd->card->dev,
			"Compress ASoC: Multicodec not supported\n");
			"Compress ASoC: Multi CPU/Codec not supported\n");
		return -EINVAL;
		return -EINVAL;
	}
	}


+18 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,12 @@ int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
	struct snd_dmaengine_dai_dma_data *dma_data;
	struct snd_dmaengine_dai_dma_data *dma_data;
	int ret;
	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);
	dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);


	ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config);
	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_dmaengine_dai_dma_data *dma_data;
	struct snd_pcm_hardware hw;
	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)
	if (pcm->config && pcm->config->pcm_hardware)
		return snd_soc_set_runtime_hwparams(substream,
		return snd_soc_set_runtime_hwparams(substream,
				pcm->config->pcm_hardware);
				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;
	struct snd_dmaengine_dai_dma_data *dma_data;
	dma_filter_fn fn = NULL;
	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);
	dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);


	if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0])
	if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0])
+18 −0
Original line number Original line Diff line number Diff line
@@ -125,6 +125,12 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf,
	int stream;
	int stream;
	char *buf;
	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);
	buf = kmalloc(out_count, GFP_KERNEL);
	if (!buf)
	if (!buf)
		return -ENOMEM;
		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;
	struct snd_soc_dai *cpu_dai = fe->cpu_dai;
	int paths;
	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 */
	/* get number of valid DAI paths and their widgets */
	paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list,
	paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, list,
			dpcm_end_walk_at_be);
			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 count, paths;
	int ret;
	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)
	if (!fe->dai_link->dynamic)
		return 0;
		return 0;