Skip to content

Commit

Permalink
ASoC: return error if the function is not support multi cpu yet.
Browse files Browse the repository at this point in the history
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: Bard liao <yung-chuan.liao@linux.intel.com>
  • Loading branch information
bardliao committed Jan 16, 2020
1 parent db7e328 commit 279476a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sound/soc/soc-compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
dev_err(rtd->card->dev,
"Compress ASoC: Multicodec not supported\n");
"Compress ASoC: Multi CPU/Codec not supported\n");
return -EINVAL;
}

Expand Down
18 changes: 18 additions & 0 deletions sound/soc/soc-generic-dmaengine-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -119,6 +125,12 @@ dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component,
struct snd_pcm_hardware hw;
int ret;

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);
Expand Down Expand Up @@ -183,6 +195,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 -EINVAL;
}

dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);

if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0])
Expand Down
18 changes: 18 additions & 0 deletions sound/soc/soc-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,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_warn(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);
Expand Down Expand Up @@ -2808,6 +2814,12 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
struct snd_soc_dapm_widget_list *list;
int count, paths;

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;

Expand Down Expand Up @@ -3364,6 +3376,12 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf,
ssize_t out_count = PAGE_SIZE, offset = 0, ret = 0;
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;
Expand Down

0 comments on commit 279476a

Please sign in to comment.