Commit 42bf029a authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

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

commit da215354 ("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: da215354 ("ASoC: simple-card: merge simple-scu-card")
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c2c61602
...@@ -9,12 +9,15 @@ ...@@ -9,12 +9,15 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/string.h> #include <linux/string.h>
#include <sound/simple_card.h> #include <sound/simple_card.h>
#include <sound/soc-dai.h> #include <sound/soc-dai.h>
#include <sound/soc.h> #include <sound/soc.h>
#define DPCM_SELECTABLE 1
struct simple_priv { struct simple_priv {
struct snd_soc_card snd_card; struct snd_soc_card snd_card;
struct simple_dai_props { struct simple_dai_props {
...@@ -441,6 +444,7 @@ static int simple_for_each_link(struct simple_priv *priv, ...@@ -441,6 +444,7 @@ static int simple_for_each_link(struct simple_priv *priv,
struct device *dev = simple_priv_to_dev(priv); struct device *dev = simple_priv_to_dev(priv);
struct device_node *top = dev->of_node; struct device_node *top = dev->of_node;
struct device_node *node; struct device_node *node;
uintptr_t dpcm_selectable = (uintptr_t)of_device_get_match_data(dev);
bool is_top = 0; bool is_top = 0;
int ret = 0; int ret = 0;
...@@ -480,8 +484,9 @@ static int simple_for_each_link(struct simple_priv *priv, ...@@ -480,8 +484,9 @@ static int simple_for_each_link(struct simple_priv *priv,
* if it has many CPUs, * if it has many CPUs,
* or has convert-xxx property * or has convert-xxx property
*/ */
if (num > 2 || if (dpcm_selectable &&
adata.convert_rate || adata.convert_channels) (num > 2 ||
adata.convert_rate || adata.convert_channels))
ret = func_dpcm(priv, np, codec, li, is_top); ret = func_dpcm(priv, np, codec, li, is_top);
/* else normal sound */ /* else normal sound */
else else
...@@ -822,7 +827,8 @@ static int simple_remove(struct platform_device *pdev) ...@@ -822,7 +827,8 @@ static int simple_remove(struct platform_device *pdev)
static const struct of_device_id simple_of_match[] = { static const struct of_device_id simple_of_match[] = {
{ .compatible = "simple-audio-card", }, { .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); MODULE_DEVICE_TABLE(of, simple_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