@@ -277,12 +277,36 @@ static const struct snd_soc_dai_ops avs_dai_hda_be_ops;
277
277
278
278
static int avs_dai_hda_be_startup (struct snd_pcm_substream * substream , struct snd_soc_dai * dai )
279
279
{
280
- return avs_dai_startup (substream , dai , false, & avs_dai_hda_be_ops );
280
+ struct snd_soc_pcm_runtime * rtd = snd_soc_substream_to_rtd (substream );
281
+ struct hdac_ext_stream * link_stream ;
282
+ struct hda_codec * codec ;
283
+ int ret ;
284
+
285
+ ret = avs_dai_startup (substream , dai , false, & avs_dai_hda_be_ops );
286
+ if (ret )
287
+ return ret ;
288
+
289
+ codec = dev_to_hda_codec (snd_soc_rtd_to_codec (rtd , 0 )-> dev );
290
+ link_stream = snd_hdac_ext_stream_assign (& codec -> bus -> core , substream ,
291
+ HDAC_EXT_STREAM_TYPE_LINK );
292
+ if (!link_stream ) {
293
+ avs_dai_nonhda_be_shutdown (substream , dai );
294
+ return - EBUSY ;
295
+ }
296
+
297
+ substream -> runtime -> private_data = link_stream ;
298
+ return 0 ;
281
299
}
282
300
283
301
static void avs_dai_hda_be_shutdown (struct snd_pcm_substream * substream , struct snd_soc_dai * dai )
284
302
{
285
- return avs_dai_nonhda_be_shutdown (substream , dai );
303
+ struct hdac_ext_stream * link_stream ;
304
+
305
+ link_stream = substream -> runtime -> private_data ;
306
+ snd_hdac_ext_stream_release (link_stream , HDAC_EXT_STREAM_TYPE_LINK );
307
+ substream -> runtime -> private_data = NULL ;
308
+
309
+ avs_dai_nonhda_be_shutdown (substream , dai );
286
310
}
287
311
288
312
static int avs_dai_hda_be_hw_params (struct snd_pcm_substream * substream ,
@@ -1576,8 +1600,6 @@ static int avs_component_hda_open(struct snd_soc_component *component,
1576
1600
struct snd_pcm_substream * substream )
1577
1601
{
1578
1602
struct snd_soc_pcm_runtime * rtd = snd_soc_substream_to_rtd (substream );
1579
- struct hdac_ext_stream * link_stream ;
1580
- struct hda_codec * codec ;
1581
1603
1582
1604
if (!rtd -> dai_link -> no_pcm ) {
1583
1605
struct snd_pcm_hardware hwparams = avs_pcm_hardware ;
@@ -1609,30 +1631,6 @@ static int avs_component_hda_open(struct snd_soc_component *component,
1609
1631
return snd_soc_set_runtime_hwparams (substream , & hwparams );
1610
1632
}
1611
1633
1612
- codec = dev_to_hda_codec (snd_soc_rtd_to_codec (rtd , 0 )-> dev );
1613
- link_stream = snd_hdac_ext_stream_assign (& codec -> bus -> core , substream ,
1614
- HDAC_EXT_STREAM_TYPE_LINK );
1615
- if (!link_stream )
1616
- return - EBUSY ;
1617
-
1618
- substream -> runtime -> private_data = link_stream ;
1619
- return 0 ;
1620
- }
1621
-
1622
- static int avs_component_hda_close (struct snd_soc_component * component ,
1623
- struct snd_pcm_substream * substream )
1624
- {
1625
- struct snd_soc_pcm_runtime * rtd = snd_soc_substream_to_rtd (substream );
1626
- struct hdac_ext_stream * link_stream ;
1627
-
1628
- /* only BE DAI links are handled here */
1629
- if (!rtd -> dai_link -> no_pcm )
1630
- return 0 ;
1631
-
1632
- link_stream = substream -> runtime -> private_data ;
1633
- snd_hdac_ext_stream_release (link_stream , HDAC_EXT_STREAM_TYPE_LINK );
1634
- substream -> runtime -> private_data = NULL ;
1635
-
1636
1634
return 0 ;
1637
1635
}
1638
1636
@@ -1643,7 +1641,6 @@ static const struct snd_soc_component_driver avs_hda_component_driver = {
1643
1641
.suspend = avs_component_suspend ,
1644
1642
.resume = avs_component_resume ,
1645
1643
.open = avs_component_hda_open ,
1646
- .close = avs_component_hda_close ,
1647
1644
.pointer = avs_component_pointer ,
1648
1645
.mmap = avs_component_mmap ,
1649
1646
.pcm_construct = avs_component_construct ,
0 commit comments