21
21
22
22
struct simple_card_data {
23
23
struct snd_soc_card snd_card ;
24
- struct snd_soc_codec_conf codec_conf ;
25
24
struct simple_dai_props {
26
25
struct asoc_simple_dai * cpu_dai ;
27
26
struct asoc_simple_dai * codec_dai ;
28
27
struct snd_soc_dai_link_component codecs ;
29
28
struct snd_soc_dai_link_component platform ;
30
29
struct asoc_simple_card_data adata ;
30
+ struct snd_soc_codec_conf * codec_conf ;
31
31
} * dai_props ;
32
32
struct snd_soc_dai_link * dai_link ;
33
33
struct asoc_simple_dai * dais ;
34
34
struct asoc_simple_card_data adata ;
35
+ struct snd_soc_codec_conf * codec_conf ;
35
36
};
36
37
37
38
#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,
116
117
struct device_node * np ,
117
118
struct device_node * codec ,
118
119
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 ,
120
122
bool is_top_level_node )
121
123
{
122
124
struct device * dev = simple_priv_to_dev (priv );
@@ -165,6 +167,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *link,
165
167
166
168
asoc_simple_card_canonicalize_cpu (dai_link , is_single_links );
167
169
} else {
170
+ struct snd_soc_codec_conf * cconf ;
171
+
168
172
/* FE is dummy */
169
173
dai_link -> cpu_of_node = NULL ;
170
174
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,
177
181
dai =
178
182
dai_props -> codec_dai = & priv -> dais [(* dai_idx )++ ];
179
183
184
+ cconf =
185
+ dai_props -> codec_conf = & priv -> codec_conf [(* conf_idx )++ ];
186
+
180
187
ret = asoc_simple_card_parse_codec (np , dai_link , DAI , CELL );
181
188
if (ret < 0 )
182
189
return ret ;
@@ -192,14 +199,12 @@ static int asoc_simple_card_dai_link_of(struct device_node *link,
192
199
return ret ;
193
200
194
201
/* 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 ,
197
203
dai_link -> codecs -> of_node ,
198
204
PREFIX "prefix" );
199
205
/* 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 ,
203
208
dai_link -> codecs -> of_node ,
204
209
"prefix" );
205
210
}
@@ -238,7 +243,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
238
243
struct snd_soc_card * card = simple_priv_to_card (priv );
239
244
bool is_fe ;
240
245
int ret , loop ;
241
- int dai_idx , link_idx ;
246
+ int dai_idx , link_idx , conf_idx ;
242
247
243
248
if (!top )
244
249
return - EINVAL ;
@@ -256,6 +261,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
256
261
loop = 1 ;
257
262
link_idx = 0 ;
258
263
dai_idx = 0 ;
264
+ conf_idx = 0 ;
259
265
node = of_get_child_by_name (top , PREFIX "dai-link" );
260
266
if (!node ) {
261
267
node = dev -> of_node ;
@@ -273,6 +279,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
273
279
274
280
ret = asoc_simple_card_dai_link_of (node , np , codec , priv ,
275
281
& dai_idx , link_idx ++ ,
282
+ & conf_idx ,
276
283
is_fe , !loop );
277
284
if (ret < 0 )
278
285
return ret ;
@@ -368,6 +375,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
368
375
struct simple_dai_props * dai_props ;
369
376
struct asoc_simple_dai * dais ;
370
377
struct snd_soc_card * card ;
378
+ struct snd_soc_codec_conf * cconf ;
371
379
struct device * dev = & pdev -> dev ;
372
380
int ret , i ;
373
381
int lnum = 0 , dnum = 0 , cnum = 0 ;
@@ -384,6 +392,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
384
392
dai_props = devm_kcalloc (dev , lnum , sizeof (* dai_props ), GFP_KERNEL );
385
393
dai_link = devm_kcalloc (dev , lnum , sizeof (* dai_link ), GFP_KERNEL );
386
394
dais = devm_kcalloc (dev , dnum , sizeof (* dais ), GFP_KERNEL );
395
+ cconf = devm_kcalloc (dev , cnum , sizeof (* cconf ), GFP_KERNEL );
387
396
if (!dai_props || !dai_link || !dais )
388
397
return - ENOMEM ;
389
398
@@ -402,15 +411,16 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
402
411
priv -> dai_props = dai_props ;
403
412
priv -> dai_link = dai_link ;
404
413
priv -> dais = dais ;
414
+ priv -> codec_conf = cconf ;
405
415
406
416
/* Init snd_soc_card */
407
417
card = simple_priv_to_card (priv );
408
418
card -> owner = THIS_MODULE ;
409
419
card -> dev = dev ;
410
420
card -> dai_link = priv -> dai_link ;
411
421
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 ;
414
424
415
425
ret = asoc_simple_card_parse_of (priv );
416
426
if (ret < 0 ) {
0 commit comments