Skip to content

Commit 0a26d6d

Browse files
morimotobroonie
authored andcommitted
ASoC: simple-scu-card: care multi DPCM codec_conf
Current simple-scu-card didn't care about codec_conf for multi DPCM case. This patch cares it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent e6a3ff2 commit 0a26d6d

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

sound/soc/generic/simple-scu-card.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,18 @@
2121

2222
struct simple_card_data {
2323
struct snd_soc_card snd_card;
24-
struct snd_soc_codec_conf codec_conf;
2524
struct simple_dai_props {
2625
struct asoc_simple_dai *cpu_dai;
2726
struct asoc_simple_dai *codec_dai;
2827
struct snd_soc_dai_link_component codecs;
2928
struct snd_soc_dai_link_component platform;
3029
struct asoc_simple_card_data adata;
30+
struct snd_soc_codec_conf *codec_conf;
3131
} *dai_props;
3232
struct snd_soc_dai_link *dai_link;
3333
struct asoc_simple_dai *dais;
3434
struct asoc_simple_card_data adata;
35+
struct snd_soc_codec_conf *codec_conf;
3536
};
3637

3738
#define simple_priv_to_card(priv) (&(priv)->snd_card)
@@ -116,7 +117,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *link,
116117
struct device_node *np,
117118
struct device_node *codec,
118119
struct simple_card_data *priv,
119-
int *dai_idx, int link_idx, int is_fe,
120+
int *dai_idx, int link_idx,
121+
int *conf_idx, int is_fe,
120122
bool is_top_level_node)
121123
{
122124
struct device *dev = simple_priv_to_dev(priv);
@@ -165,6 +167,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *link,
165167

166168
asoc_simple_card_canonicalize_cpu(dai_link, is_single_links);
167169
} else {
170+
struct snd_soc_codec_conf *cconf;
171+
168172
/* FE is dummy */
169173
dai_link->cpu_of_node = NULL;
170174
dai_link->cpu_dai_name = "snd-soc-dummy-dai";
@@ -177,6 +181,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *link,
177181
dai =
178182
dai_props->codec_dai = &priv->dais[(*dai_idx)++];
179183

184+
cconf =
185+
dai_props->codec_conf = &priv->codec_conf[(*conf_idx)++];
186+
180187
ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
181188
if (ret < 0)
182189
return ret;
@@ -192,14 +199,12 @@ static int asoc_simple_card_dai_link_of(struct device_node *link,
192199
return ret;
193200

194201
/* check "prefix" from top node */
195-
snd_soc_of_parse_audio_prefix(card,
196-
&priv->codec_conf,
202+
snd_soc_of_parse_audio_prefix(card, cconf,
197203
dai_link->codecs->of_node,
198204
PREFIX "prefix");
199205
/* check "prefix" from each node if top doesn't have */
200-
if (!priv->codec_conf.of_node)
201-
snd_soc_of_parse_node_prefix(np,
202-
&priv->codec_conf,
206+
if (!cconf->of_node)
207+
snd_soc_of_parse_node_prefix(np, cconf,
203208
dai_link->codecs->of_node,
204209
"prefix");
205210
}
@@ -238,7 +243,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
238243
struct snd_soc_card *card = simple_priv_to_card(priv);
239244
bool is_fe;
240245
int ret, loop;
241-
int dai_idx, link_idx;
246+
int dai_idx, link_idx, conf_idx;
242247

243248
if (!top)
244249
return -EINVAL;
@@ -256,6 +261,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
256261
loop = 1;
257262
link_idx = 0;
258263
dai_idx = 0;
264+
conf_idx = 0;
259265
node = of_get_child_by_name(top, PREFIX "dai-link");
260266
if (!node) {
261267
node = dev->of_node;
@@ -273,6 +279,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
273279

274280
ret = asoc_simple_card_dai_link_of(node, np, codec, priv,
275281
&dai_idx, link_idx++,
282+
&conf_idx,
276283
is_fe, !loop);
277284
if (ret < 0)
278285
return ret;
@@ -368,6 +375,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
368375
struct simple_dai_props *dai_props;
369376
struct asoc_simple_dai *dais;
370377
struct snd_soc_card *card;
378+
struct snd_soc_codec_conf *cconf;
371379
struct device *dev = &pdev->dev;
372380
int ret, i;
373381
int lnum = 0, dnum = 0, cnum = 0;
@@ -384,6 +392,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
384392
dai_props = devm_kcalloc(dev, lnum, sizeof(*dai_props), GFP_KERNEL);
385393
dai_link = devm_kcalloc(dev, lnum, sizeof(*dai_link), GFP_KERNEL);
386394
dais = devm_kcalloc(dev, dnum, sizeof(*dais), GFP_KERNEL);
395+
cconf = devm_kcalloc(dev, cnum, sizeof(*cconf), GFP_KERNEL);
387396
if (!dai_props || !dai_link || !dais)
388397
return -ENOMEM;
389398

@@ -402,15 +411,16 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
402411
priv->dai_props = dai_props;
403412
priv->dai_link = dai_link;
404413
priv->dais = dais;
414+
priv->codec_conf = cconf;
405415

406416
/* Init snd_soc_card */
407417
card = simple_priv_to_card(priv);
408418
card->owner = THIS_MODULE;
409419
card->dev = dev;
410420
card->dai_link = priv->dai_link;
411421
card->num_links = lnum;
412-
card->codec_conf = &priv->codec_conf;
413-
card->num_configs = 1;
422+
card->codec_conf = cconf;
423+
card->num_configs = cnum;
414424

415425
ret = asoc_simple_card_parse_of(priv);
416426
if (ret < 0) {

0 commit comments

Comments
 (0)