All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: simple-card: don't select DPCM via simple-audio-card
@ 2019-04-02  1:51 Kuninori Morimoto
  2019-04-04  0:20 ` Kuninori Morimoto
  0 siblings, 1 reply; 2+ messages in thread
From: Kuninori Morimoto @ 2019-04-02  1:51 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 7147bba..34de32e 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -9,12 +9,15 @@
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
 #include <sound/simple_card.h>
 #include <sound/soc-dai.h>
 #include <sound/soc.h>
 
+#define DPCM_SELECTABLE 1
+
 struct simple_priv {
 	struct snd_soc_card snd_card;
 	struct simple_dai_props {
@@ -441,6 +444,7 @@ static int simple_for_each_link(struct simple_priv *priv,
 	struct device *dev = simple_priv_to_dev(priv);
 	struct device_node *top = dev->of_node;
 	struct device_node *node;
+	uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev);
 	bool is_top = 0;
 	int ret = 0;
 
@@ -480,8 +484,9 @@ static int simple_for_each_link(struct simple_priv *priv,
 			 * if it has many CPUs,
 			 * or has convert-xxx property
 			 */
-			if (num > 2 ||
-			    adata.convert_rate || adata.convert_channels)
+			if (dpcm_selectable &&
+			    (num > 2 ||
+			     adata.convert_rate || adata.convert_channels))
 				ret = func_dpcm(priv, np, codec, li, is_top);
 			/* else normal sound */
 			else
@@ -822,7 +827,8 @@ static int simple_remove(struct platform_device *pdev)
 
 static const struct of_device_id simple_of_match[] = {
 	{ .compatible = "simple-audio-card", },
-	{ .compatible = "simple-scu-audio-card", },
+	{ .compatible = "simple-scu-audio-card",
+	  .data = (void *)DPCM_SELECTABLE },
 	{},
 };
 MODULE_DEVICE_TABLE(of, simple_of_match);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: simple-card: don't select DPCM via simple-audio-card
  2019-04-02  1:51 [PATCH] ASoC: simple-card: don't select DPCM via simple-audio-card Kuninori Morimoto
@ 2019-04-04  0:20 ` Kuninori Morimoto
  0 siblings, 0 replies; 2+ messages in thread
From: Kuninori Morimoto @ 2019-04-04  0:20 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


Hi Mark

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> 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.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---

This patch is for v5.1, too

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-04  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02  1:51 [PATCH] ASoC: simple-card: don't select DPCM via simple-audio-card Kuninori Morimoto
2019-04-04  0:20 ` Kuninori Morimoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.