Re: [PATCH v5 19/21] ASoC: qdsp6: audioreach: add q6apm lpass dai support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  config SND_SOC_QDSP6_APM
>  	select SND_SOC_QDSP6_APM_DAI
> +	select SND_SOC_QDSP6_APM_LPASS_DAI
>  	tristate

tristate then select?

>
> +static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream,
> +			       struct snd_soc_dai *dai)
> +{
> +	struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev);
> +	struct audioreach_module_config *cfg = &dai_data->module_config[dai->id];
> +	int graph_id = dai->id;
> +	int rc;
> +	struct q6apm_graph *graph;
> +
> +	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> +		graph = q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id);
> +		if (IS_ERR(graph)) {
> +			dev_err(dai->dev, "Failed to open graph (%d)\n",
> +				graph_id);
> +			rc = PTR_ERR(graph);
> +			return rc;
> +		}
> +		dai_data->graph[graph_id] = graph;
> +	}

so you don't open a graph on capture?

How does the rest work if dai_data->graph is not initialized?
Or is it done somewhere else and it'd be worthy of a comment?

> +
> +	cfg->direction = substream->stream;
> +	rc = q6apm_graph_media_format_pcm(dai_data->graph[dai->id], cfg);
> +
> +	if (rc) {
> +		dev_err(dai->dev, "Failed to set media format %d\n", rc);
> +		return rc;
> +	}
> +
> +	rc = q6apm_graph_prepare(dai_data->graph[dai->id]);
> +	if (rc) {
> +		dev_err(dai->dev, "Failed to prepare Graph %d\n", rc);
> +		return rc;
> +	}
> +
> +	rc = q6apm_graph_start(dai_data->graph[dai->id]);
> +	if (rc < 0) {
> +		dev_err(dai->dev, "fail to start APM port %x\n", dai->id);
> +		return rc;
> +	}
> +	dai_data->is_port_started[dai->id] = true;
> +
> +	return 0;
> +}
> +
> +static int q6apm_lpass_dai_startup(struct snd_pcm_substream *substream,
> +				struct snd_soc_dai *dai)
> +{
> +	struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev);
> +	int graph_id = dai->id;
> +	struct q6apm_graph *graph;
> +
> +	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
> +		graph = q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id);
> +		if (IS_ERR(graph)) {
> +			dev_err(dai->dev, "Failed to open graph (%d)\n",
> +				graph_id);
> +			return PTR_ERR(graph);
> +		}
> +		dai_data->graph[graph_id] = graph;
> +	}

definitively need a comment on why the behavior is different from
capture and playback?

What prevents you from doing the same operations in .startup for capture
and playback?

> +
> +	return 0;
> +}
> +




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux