summaryrefslogtreecommitdiffstats
path: root/sound/soc/generic
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2019-04-03 20:52:52 -0400
committerMark Brown <broonie@kernel.org>2019-04-04 03:59:09 -0400
commit42bf029a55a9bb8036f1d738a28dba2f7ec1e79d (patch)
tree870782068abdaec564f80eb28a9d792057e2dc5e /sound/soc/generic
parentc2c616021d64d952dc9d37793924ce57833d7754 (diff)
ASoC: simple-card: don't select DPCM via simple-audio-card
commit da215354eb55c ("ASoC: simple-card: merge simple-scu-card") merged simple-scu-audio-card which can handle DPCM into simple-audio-card. By this patch, the judgement to select "normal sound card" or "DPCM sound card" is based on its CPU/Codec DAI count. But, because of it, existing "simple-audio-card" user who is assuming "normal sound card" might select DPCM unintentionally. To solve this issue, this patch allows "simple-audio-card" user can select "normal sound card", and "simple-scu-audio-card" user can select both "normal sound card" and "DPCM sound card". This keeps compatibility collectry. Fixes: da215354eb55c ("ASoC: simple-card: merge simple-scu-card") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic')
-rw-r--r--sound/soc/generic/simple-card.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 7147bba45a2a..34de32efc4c4 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -9,12 +9,15 @@
9#include <linux/device.h> 9#include <linux/device.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/of.h> 11#include <linux/of.h>
12#include <linux/of_device.h>
12#include <linux/platform_device.h> 13#include <linux/platform_device.h>
13#include <linux/string.h> 14#include <linux/string.h>
14#include <sound/simple_card.h> 15#include <sound/simple_card.h>
15#include <sound/soc-dai.h> 16#include <sound/soc-dai.h>
16#include <sound/soc.h> 17#include <sound/soc.h>
17 18
19#define DPCM_SELECTABLE 1
20
18struct simple_priv { 21struct simple_priv {
19 struct snd_soc_card snd_card; 22 struct snd_soc_card snd_card;
20 struct simple_dai_props { 23 struct simple_dai_props {
@@ -441,6 +444,7 @@ static int simple_for_each_link(struct simple_priv *priv,
441 struct device *dev = simple_priv_to_dev(priv); 444 struct device *dev = simple_priv_to_dev(priv);
442 struct device_node *top = dev->of_node; 445 struct device_node *top = dev->of_node;
443 struct device_node *node; 446 struct device_node *node;
447 uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev);
444 bool is_top = 0; 448 bool is_top = 0;
445 int ret = 0; 449 int ret = 0;
446 450
@@ -480,8 +484,9 @@ static int simple_for_each_link(struct simple_priv *priv,
480 * if it has many CPUs, 484 * if it has many CPUs,
481 * or has convert-xxx property 485 * or has convert-xxx property
482 */ 486 */
483 if (num > 2 || 487 if (dpcm_selectable &&
484 adata.convert_rate || adata.convert_channels) 488 (num > 2 ||
489 adata.convert_rate || adata.convert_channels))
485 ret = func_dpcm(priv, np, codec, li, is_top); 490 ret = func_dpcm(priv, np, codec, li, is_top);
486 /* else normal sound */ 491 /* else normal sound */
487 else 492 else
@@ -822,7 +827,8 @@ static int simple_remove(struct platform_device *pdev)
822 827
823static const struct of_device_id simple_of_match[] = { 828static const struct of_device_id simple_of_match[] = {
824 { .compatible = "simple-audio-card", }, 829 { .compatible = "simple-audio-card", },
825 { .compatible = "simple-scu-audio-card", }, 830 { .compatible = "simple-scu-audio-card",
831 .data = (void *)DPCM_SELECTABLE },
826 {}, 832 {},
827}; 833};
828MODULE_DEVICE_TABLE(of, simple_of_match); 834MODULE_DEVICE_TABLE(of, simple_of_match);