Commit c2c61602 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: audio-graph-card: don't select DPCM via audio-graph-card

commit ae3cb579 ("ASoC: audio-graph-card: merge
audio-graph-scu-card") merged audio-graph-scu-card which can
handle DPCM into audio-graph-card.

By this patch, the judgement to select "normal sound card" or
"DPCM sound card" is based on its OF-graph endpoint connection.
But, because of it, existing "audio-graph-card" user who is
assuming "normal sound card" might select DPCM unintentionally.

To solve this issue, this patch allows "audio-graph-card" user
can select "normal sound card", and "audio-graph-scu-card" user
can select both "normal sound card" and "DPCM sound card".
This keeps compatibility collectry.

Fixes: ae3cb579 ("ASoC: audio-graph-card: merge audio-graph-scu-card")
Reported-by: default avatarArnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: default avatarArnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7297ba6c
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <linux/string.h> #include <linux/string.h>
#include <sound/simple_card_utils.h> #include <sound/simple_card_utils.h>
#define DPCM_SELECTABLE 1
struct graph_priv { struct graph_priv {
struct snd_soc_card snd_card; struct snd_soc_card snd_card;
struct graph_dai_props { struct graph_dai_props {
...@@ -440,6 +442,7 @@ static int graph_for_each_link(struct graph_priv *priv, ...@@ -440,6 +442,7 @@ static int graph_for_each_link(struct graph_priv *priv,
struct device_node *codec_port; struct device_node *codec_port;
struct device_node *codec_port_old = NULL; struct device_node *codec_port_old = NULL;
struct asoc_simple_card_data adata; struct asoc_simple_card_data adata;
uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev);
int rc, ret; int rc, ret;
/* loop for all listed CPU port */ /* loop for all listed CPU port */
...@@ -470,8 +473,9 @@ static int graph_for_each_link(struct graph_priv *priv, ...@@ -470,8 +473,9 @@ static int graph_for_each_link(struct graph_priv *priv,
* if Codec port has many endpoints, * if Codec port has many endpoints,
* or has convert-xxx property * or has convert-xxx property
*/ */
if ((of_get_child_count(codec_port) > 1) || if (dpcm_selectable &&
adata.convert_rate || adata.convert_channels) ((of_get_child_count(codec_port) > 1) ||
adata.convert_rate || adata.convert_channels))
ret = func_dpcm(priv, cpu_ep, codec_ep, li, ret = func_dpcm(priv, cpu_ep, codec_ep, li,
(codec_port_old == codec_port)); (codec_port_old == codec_port));
/* else normal sound */ /* else normal sound */
...@@ -732,7 +736,8 @@ static int graph_remove(struct platform_device *pdev) ...@@ -732,7 +736,8 @@ static int graph_remove(struct platform_device *pdev)
static const struct of_device_id graph_of_match[] = { static const struct of_device_id graph_of_match[] = {
{ .compatible = "audio-graph-card", }, { .compatible = "audio-graph-card", },
{ .compatible = "audio-graph-scu-card", }, { .compatible = "audio-graph-scu-card",
.data = (void *)DPCM_SELECTABLE },
{}, {},
}; };
MODULE_DEVICE_TABLE(of, graph_of_match); MODULE_DEVICE_TABLE(of, graph_of_match);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment