@@ -277,12 +277,36 @@ static const struct snd_soc_dai_ops avs_dai_hda_be_ops;
277277
278278static int avs_dai_hda_be_startup (struct snd_pcm_substream * substream , struct snd_soc_dai * dai )
279279{
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 ;
281299}
282300
283301static void avs_dai_hda_be_shutdown (struct snd_pcm_substream * substream , struct snd_soc_dai * dai )
284302{
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 );
286310}
287311
288312static 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,
15761600 struct snd_pcm_substream * substream )
15771601{
15781602 struct snd_soc_pcm_runtime * rtd = snd_soc_substream_to_rtd (substream );
1579- struct hdac_ext_stream * link_stream ;
1580- struct hda_codec * codec ;
15811603
15821604 if (!rtd -> dai_link -> no_pcm ) {
15831605 struct snd_pcm_hardware hwparams = avs_pcm_hardware ;
@@ -1609,30 +1631,6 @@ static int avs_component_hda_open(struct snd_soc_component *component,
16091631 return snd_soc_set_runtime_hwparams (substream , & hwparams );
16101632 }
16111633
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-
16361634 return 0 ;
16371635}
16381636
@@ -1643,7 +1641,6 @@ static const struct snd_soc_component_driver avs_hda_component_driver = {
16431641 .suspend = avs_component_suspend ,
16441642 .resume = avs_component_resume ,
16451643 .open = avs_component_hda_open ,
1646- .close = avs_component_hda_close ,
16471644 .pointer = avs_component_pointer ,
16481645 .mmap = avs_component_mmap ,
16491646 .pcm_construct = avs_component_construct ,
0 commit comments