@@ -92,17 +92,24 @@ static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
92
92
return 0 ;
93
93
}
94
94
95
- static int asoc_simple_card_dai_link_of (struct device_node * np ,
95
+ static int asoc_simple_card_dai_link_of (struct device_node * link ,
96
+ struct device_node * np ,
97
+ struct device_node * codec ,
96
98
struct simple_card_data * priv ,
97
- unsigned int daifmt ,
98
- int idx , bool is_fe )
99
+ int idx , bool is_fe ,
100
+ bool is_top_level_node )
99
101
{
100
102
struct device * dev = simple_priv_to_dev (priv );
101
103
struct snd_soc_dai_link * dai_link = simple_priv_to_link (priv , idx );
102
104
struct simple_dai_props * dai_props = simple_priv_to_props (priv , idx );
103
105
struct snd_soc_card * card = simple_priv_to_card (priv );
106
+ char * prefix = "" ;
104
107
int ret ;
105
108
109
+ /* For single DAI link & old style of DT node */
110
+ if (is_top_level_node )
111
+ prefix = PREFIX ;
112
+
106
113
if (is_fe ) {
107
114
int is_single_links = 0 ;
108
115
struct snd_soc_dai_link_component * codecs ;
@@ -178,7 +185,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
178
185
if (ret < 0 )
179
186
return ret ;
180
187
181
- dai_link -> dai_fmt = daifmt ;
188
+ ret = asoc_simple_card_parse_daifmt (dev , link , codec ,
189
+ prefix , & dai_link -> dai_fmt );
190
+ if (ret < 0 )
191
+ return ret ;
192
+
182
193
dai_link -> dpcm_playback = 1 ;
183
194
dai_link -> dpcm_capture = 1 ;
184
195
dai_link -> ops = & asoc_simple_card_ops ;
@@ -191,10 +202,10 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
191
202
192
203
{
193
204
struct device * dev = simple_priv_to_dev (priv );
205
+ struct device_node * node = dev -> of_node ;
194
206
struct device_node * np ;
207
+ struct device_node * codec ;
195
208
struct snd_soc_card * card = simple_priv_to_card (priv );
196
- struct device_node * node = dev -> of_node ;
197
- unsigned int daifmt = 0 ;
198
209
bool is_fe ;
199
210
int ret , i ;
200
211
@@ -211,22 +222,18 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
211
222
212
223
asoc_simple_card_parse_convert (dev , node , PREFIX , & priv -> adata );
213
224
214
- /* find 1st codec */
215
- np = of_get_child_by_name (node , PREFIX "codec" );
216
- if (!np )
225
+ i = 0 ;
226
+ codec = of_get_child_by_name (node , PREFIX "codec" );
227
+ if (!codec )
217
228
return - ENODEV ;
218
229
219
- ret = asoc_simple_card_parse_daifmt (dev , node , np , PREFIX , & daifmt );
220
- if (ret < 0 )
221
- return ret ;
222
-
223
- i = 0 ;
224
230
for_each_child_of_node (node , np ) {
225
231
is_fe = false;
226
232
if (of_node_name_eq (np , PREFIX "cpu" ))
227
233
is_fe = true;
228
234
229
- ret = asoc_simple_card_dai_link_of (np , priv , daifmt , i , is_fe );
235
+ ret = asoc_simple_card_dai_link_of (node , np , codec , priv ,
236
+ i , is_fe , true);
230
237
if (ret < 0 )
231
238
return ret ;
232
239
i ++ ;
0 commit comments