@@ -275,8 +275,10 @@ static int hda_suspend(struct snd_sof_dev *sdev, int state)
275275 struct hdac_bus * bus = sof_to_bus (sdev );
276276 int ret = 0 ;
277277
278+ #if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA )
278279 /* power down all hda link */
279280 snd_hdac_ext_bus_link_power_down_all (bus );
281+ #endif
280282
281283 /* power down DSP */
282284 ret = hda_dsp_core_reset_power_down (sdev , chip -> cores_mask );
@@ -286,18 +288,25 @@ static int hda_suspend(struct snd_sof_dev *sdev, int state)
286288 return ret ;
287289 }
288290
291+ #if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA )
289292 /* disable ppcap interrupt */
290293 snd_hdac_ext_bus_ppcap_int_enable (bus , false);
291294 snd_hdac_ext_bus_ppcap_enable (bus , false);
292295
293296 /* disable hda bus irw and i/o */
294297 snd_hdac_bus_stop_chip (bus );
298+ #endif
295299
296300 /* disable LP retention mode */
297301 snd_sof_pci_update_bits (sdev , PCI_TCSEL ,
298302 PCI_CGCTL_LSRMD_MASK , PCI_CGCTL_LSRMD_MASK );
299303
300- return 0 ;
304+ /* reset HDA controller */
305+ ret = hda_dsp_ctrl_link_reset (sdev );
306+ if (ret < 0 )
307+ dev_err (sdev -> dev , "error: failed to reset HDA controller\n" );
308+
309+ return ret ;
301310}
302311
303312static int hda_resume (struct snd_sof_dev * sdev )
@@ -313,6 +322,7 @@ static int hda_resume(struct snd_sof_dev *sdev)
313322 */
314323 snd_sof_pci_update_bits (sdev , PCI_TCSEL , 0x07 , 0 );
315324
325+ #if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA )
316326 /* reset and start hda controller */
317327 ret = hda_dsp_ctrl_init_chip (sdev , true);
318328 if (ret < 0 ) {
@@ -332,6 +342,7 @@ static int hda_resume(struct snd_sof_dev *sdev)
332342 /* enable ppcap interrupt */
333343 snd_hdac_ext_bus_ppcap_enable (bus , true);
334344 snd_hdac_ext_bus_ppcap_int_enable (bus , true);
345+ #endif
335346
336347 /* power up the DSP */
337348 ret = hda_dsp_core_power_up (sdev , chip -> cores_mask );
@@ -341,6 +352,7 @@ static int hda_resume(struct snd_sof_dev *sdev)
341352 return ret ;
342353 }
343354
355+ #if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA )
344356 /* turn off the links that were off before suspend */
345357 list_for_each_entry (hlink , & bus -> hlink_list , list ) {
346358 if (!hlink -> ref_count )
@@ -350,6 +362,7 @@ static int hda_resume(struct snd_sof_dev *sdev)
350362 /* check dma status and clean up CORB/RIRB buffers */
351363 if (!bus -> cmd_dma_state )
352364 snd_hdac_bus_stop_cmd_io (bus );
365+ #endif
353366
354367 return 0 ;
355368}
0 commit comments