diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-04-03 20:52:15 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-04-04 03:58:31 -0400 |
commit | c2c616021d64d952dc9d37793924ce57833d7754 (patch) | |
tree | e406472f2dd6df4f7f0cbb4f162bbf85f27a41e5 /sound/soc/generic | |
parent | 7297ba6c74c5b9e78d8e936af82eecfcf7d32dfb (diff) |
ASoC: audio-graph-card: don't select DPCM via audio-graph-card
commit ae3cb5790906b ("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: ae3cb5790906b ("ASoC: audio-graph-card: merge audio-graph-scu-card")
Reported-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic')
-rw-r--r-- | sound/soc/generic/audio-graph-card.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index bb12351330e8..69bc4848d787 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <sound/simple_card_utils.h> | 21 | #include <sound/simple_card_utils.h> |
22 | 22 | ||
23 | #define DPCM_SELECTABLE 1 | ||
24 | |||
23 | struct graph_priv { | 25 | struct graph_priv { |
24 | struct snd_soc_card snd_card; | 26 | struct snd_soc_card snd_card; |
25 | struct graph_dai_props { | 27 | struct graph_dai_props { |
@@ -440,6 +442,7 @@ static int graph_for_each_link(struct graph_priv *priv, | |||
440 | struct device_node *codec_port; | 442 | struct device_node *codec_port; |
441 | struct device_node *codec_port_old = NULL; | 443 | struct device_node *codec_port_old = NULL; |
442 | struct asoc_simple_card_data adata; | 444 | struct asoc_simple_card_data adata; |
445 | uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev); | ||
443 | int rc, ret; | 446 | int rc, ret; |
444 | 447 | ||
445 | /* loop for all listed CPU port */ | 448 | /* loop for all listed CPU port */ |
@@ -470,8 +473,9 @@ static int graph_for_each_link(struct graph_priv *priv, | |||
470 | * if Codec port has many endpoints, | 473 | * if Codec port has many endpoints, |
471 | * or has convert-xxx property | 474 | * or has convert-xxx property |
472 | */ | 475 | */ |
473 | if ((of_get_child_count(codec_port) > 1) || | 476 | if (dpcm_selectable && |
474 | adata.convert_rate || adata.convert_channels) | 477 | ((of_get_child_count(codec_port) > 1) || |
478 | adata.convert_rate || adata.convert_channels)) | ||
475 | ret = func_dpcm(priv, cpu_ep, codec_ep, li, | 479 | ret = func_dpcm(priv, cpu_ep, codec_ep, li, |
476 | (codec_port_old == codec_port)); | 480 | (codec_port_old == codec_port)); |
477 | /* else normal sound */ | 481 | /* else normal sound */ |
@@ -732,7 +736,8 @@ static int graph_remove(struct platform_device *pdev) | |||
732 | 736 | ||
733 | static const struct of_device_id graph_of_match[] = { | 737 | static const struct of_device_id graph_of_match[] = { |
734 | { .compatible = "audio-graph-card", }, | 738 | { .compatible = "audio-graph-card", }, |
735 | { .compatible = "audio-graph-scu-card", }, | 739 | { .compatible = "audio-graph-scu-card", |
740 | .data = (void *)DPCM_SELECTABLE }, | ||
736 | {}, | 741 | {}, |
737 | }; | 742 | }; |
738 | MODULE_DEVICE_TABLE(of, graph_of_match); | 743 | MODULE_DEVICE_TABLE(of, graph_of_match); |