Commit 7adee60e authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: simple-card: add 1 CPU : 1 Codec support again

simple-card is now supporting normal sound and DPCM sound.
For DPCM sound, original sound card (= simple-scu-card) had been
supported 1 CPU : 1 Codec connection which uses hw_params_fixup()
for convert-rate/channel.
But, merged simple-card is completely forgeting about it.

This patch re-support it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7e5e1f8b
...@@ -453,6 +453,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) ...@@ -453,6 +453,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
struct device_node *node; struct device_node *node;
struct device_node *np; struct device_node *np;
struct device_node *codec; struct device_node *codec;
struct asoc_simple_card_data adata;
bool is_fe; bool is_fe;
int ret, loop; int ret, loop;
int dai_idx, link_idx, conf_idx; int dai_idx, link_idx, conf_idx;
...@@ -480,8 +481,13 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) ...@@ -480,8 +481,13 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
} }
do { do {
memset(&adata, 0, sizeof(adata));
for_each_child_of_node(node, np)
asoc_simple_card_get_conversion(dev, np, &adata);
/* DPCM */ /* DPCM */
if (of_get_child_count(node) > 2) { if (of_get_child_count(node) > 2 ||
adata.convert_rate || adata.convert_channels) {
for_each_child_of_node(node, np) { for_each_child_of_node(node, np) {
codec = of_get_child_by_name(node, codec = of_get_child_by_name(node,
loop ? "codec" : loop ? "codec" :
...@@ -495,14 +501,16 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) ...@@ -495,14 +501,16 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
top, node, np, codec, priv, top, node, np, codec, priv,
&dai_idx, link_idx++, &conf_idx, &dai_idx, link_idx++, &conf_idx,
is_fe, !loop); is_fe, !loop);
if (ret < 0)
return ret;
} }
} else { } else {
ret = asoc_simple_card_dai_link_of( ret = asoc_simple_card_dai_link_of(
top, node, priv, top, node, priv,
&dai_idx, link_idx++, !loop); &dai_idx, link_idx++, !loop);
if (ret < 0)
return ret;
} }
if (ret < 0)
return ret;
node = of_get_next_child(top, node); node = of_get_next_child(top, node);
} while (loop && node); } while (loop && node);
...@@ -523,6 +531,8 @@ static void asoc_simple_card_get_dais_count(struct device *dev, ...@@ -523,6 +531,8 @@ static void asoc_simple_card_get_dais_count(struct device *dev,
{ {
struct device_node *top = dev->of_node; struct device_node *top = dev->of_node;
struct device_node *node; struct device_node *node;
struct device_node *np;
struct asoc_simple_card_data adata;
int loop; int loop;
int num; int num;
...@@ -562,6 +572,15 @@ static void asoc_simple_card_get_dais_count(struct device *dev, ...@@ -562,6 +572,15 @@ static void asoc_simple_card_get_dais_count(struct device *dev,
* => 6 links = 0xCPU-Codec + 4xCPU-dummy + 2xdummy-Codec * => 6 links = 0xCPU-Codec + 4xCPU-dummy + 2xdummy-Codec
* => 6 DAIs = 4xCPU + 2xCodec * => 6 DAIs = 4xCPU + 2xCodec
* => 2 ccnf = 2xdummy-Codec * => 2 ccnf = 2xdummy-Codec
*
* ex4)
* CPU0 --- Codec0 (convert-rate) link : 3
* CPU1 --- Codec1 dais : 4
* ccnf : 1
*
* => 3 links = 1xCPU-Codec + 1xCPU-dummy + 1xdummy-Codec
* => 4 DAIs = 2xCPU + 2xCodec
* => 1 ccnf = 1xdummy-Codec
*/ */
if (!top) { if (!top) {
(*link_num) = 1; (*link_num) = 1;
...@@ -578,9 +597,14 @@ static void asoc_simple_card_get_dais_count(struct device *dev, ...@@ -578,9 +597,14 @@ static void asoc_simple_card_get_dais_count(struct device *dev,
} }
do { do {
memset(&adata, 0, sizeof(adata));
for_each_child_of_node(node, np)
asoc_simple_card_get_conversion(dev, np, &adata);
num = of_get_child_count(node); num = of_get_child_count(node);
(*dais_num) += num; (*dais_num) += num;
if (num > 2) { if (num > 2 ||
adata.convert_rate || adata.convert_channels) {
(*link_num) += num; (*link_num) += num;
(*ccnf_num)++; (*ccnf_num)++;
} else { } else {
......
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