CINXE.COM
LKML: Cristian Ciocaltea: [PATCH 1/4] ASoC: SOF: amd: Add post_fw_run_delay ACP quirk
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: Cristian Ciocaltea: [PATCH 1/4] ASoC: SOF: amd: Add post_fw_run_delay ACP quirk</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by Cristian Ciocaltea" href="/groupie.php?aid=" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2025"> [2025]</a> 聽 <a class="nb" href="/lkml/2025/2"> [Feb]</a> 聽 <a class="nb" href="/lkml/2025/2/7"> [7]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2025/2/7/709" onclick="this.href='/lkml/headers'+'/2025/2/7/709';">[headers]</a>聽 <a href="/lkml/bounce/2025/2/7/709">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2025/2/7/710">First message in thread</a></li><li><a href="/lkml/2025/2/7/710">Cristian Ciocaltea</a><ul><li class="origin"><a href="/lkml/2025/2/7/782">Cristian Ciocaltea</a><ul><li><a href="/lkml/2025/2/7/782">"Mukunda,Vijendar"</a><ul><li><a href="/lkml/2025/2/7/1280">Cristian Ciocaltea</a></li></ul></li></ul></li><li><a href="/lkml/2025/2/7/711">Cristian Ciocaltea</a><ul><li><a href="/lkml/2025/2/10/703">potturu venkata prasad</a></li></ul></li><li><a href="/lkml/2025/2/7/712">Cristian Ciocaltea</a><ul><li><a href="/lkml/2025/2/7/728">"Mukunda,Vijendar"</a><ul><li><a href="/lkml/2025/2/7/754">Cristian Ciocaltea</a><ul><li><a href="/lkml/2025/2/7/766">"Mukunda,Vijendar"</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2025/2/7/713">Cristian Ciocaltea</a><ul><li><a href="/lkml/2025/2/10/706">potturu venkata prasad</a></li></ul></li><li><a href="/lkml/2025/2/10/1224">Mark Brown</a></li></ul></li></ul><div class="threadlist">Patch in this message</div><ul class="threadlist"><li><a href="/lkml/diff/2025/2/7/709/1">Get diff 1</a></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">From</td><td class="rp" itemprop="author">Cristian Ciocaltea <></td></tr><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Fri, 07 Feb 2025 13:46:02 +0200</td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">[PATCH 1/4] ASoC: SOF: amd: Add post_fw_run_delay ACP quirk</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody">Stress testing resume from suspend on Valve Steam Deck OLED (Galileo)<br />revealed that the DSP firmware could enter an unrecoverable faulty<br />state, where the kernel ring buffer is flooded with IPC related error<br />messages:<br /><br />[ +0.017002] snd_sof_amd_vangogh 0000:04:00.5: acp_sof_ipc_send_msg: Failed to acquire HW lock<br />[ +0.000054] snd_sof_amd_vangogh 0000:04:00.5: ipc3_tx_msg_unlocked: ipc message send for 0x30100000 failed: -22<br />[ +0.000005] snd_sof_amd_vangogh 0000:04:00.5: Failed to setup widget PIPELINE.6.ACPHS1.IN<br />[ +0.000004] snd_sof_amd_vangogh 0000:04:00.5: Failed to restore pipeline after resume -22<br />[ +0.000003] snd_sof_amd_vangogh 0000:04:00.5: PM: dpm_run_callback(): pci_pm_resume returns -22<br />[ +0.000009] snd_sof_amd_vangogh 0000:04:00.5: PM: failed to resume async: error -22<br />[...]<br />[ +0.002582] PM: suspend exit<br />[ +0.065085] snd_sof_amd_vangogh 0000:04:00.5: ipc tx error for 0x30130000 (msg/reply size: 12/0): -22<br />[ +0.000499] snd_sof_amd_vangogh 0000:04:00.5: error: failed widget list set up for pcm 1 dir 0<br />[ +0.000011] snd_sof_amd_vangogh 0000:04:00.5: error: set pcm hw_params after resume<br />[ +0.000006] snd_sof_amd_vangogh 0000:04:00.5: ASoC: error at snd_soc_pcm_component_prepare on 0000:04:00.5: -22<br />[...]<br /><br />A system reboot would be necessary to restore the speakers<br />functionality.<br /><br />However, by delaying a bit any host to DSP transmission right after<br />the firmware boot completed, the issue could not be reproduced anymore<br />and sound continued to work flawlessly even after performing thousands<br />of suspend/resume cycles.<br /><br />Introduce the post_fw_run_delay ACP quirk to allow providing the<br />aforementioned delay via the snd_sof_dsp_ops->post_fw_run() callback for<br />the affected devices.<br /><br />Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com><br />---<br /> sound/soc/sof/amd/acp.c | 1 +<br /> sound/soc/sof/amd/acp.h | 1 +<br /> sound/soc/sof/amd/vangogh.c | 18 ++++++++++++++++++<br /> 3 files changed, 20 insertions(+)<br /><br />diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c<br />index 33648ff8b83365e76d7d90e52c2cb8f884a2fe72..9e13c96528be3371e063072513c118cfc8b93fe8 100644<br />--- a/sound/soc/sof/amd/acp.c<br />+++ b/sound/soc/sof/amd/acp.c<br />@@ -27,6 +27,7 @@ MODULE_PARM_DESC(enable_fw_debug, "Enable Firmware debug");<br /> static struct acp_quirk_entry quirk_valve_galileo = {<br /> .signed_fw_image = true,<br /> .skip_iram_dram_size_mod = true,<br />+ .post_fw_run_delay = true,<br /> };<br /> <br /> const struct dmi_system_id acp_sof_quirk_table[] = {<br />diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h<br />index 800594440f73914e7b8ccaf86369ac686e1da630..2a19d82d6200223cdfccd49fbcf1b52968ae1230 100644<br />--- a/sound/soc/sof/amd/acp.h<br />+++ b/sound/soc/sof/amd/acp.h<br />@@ -220,6 +220,7 @@ struct sof_amd_acp_desc {<br /> struct acp_quirk_entry {<br /> bool signed_fw_image;<br /> bool skip_iram_dram_size_mod;<br />+ bool post_fw_run_delay;<br /> };<br /> <br /> /* Common device data struct for ACP devices */<br />diff --git a/sound/soc/sof/amd/vangogh.c b/sound/soc/sof/amd/vangogh.c<br />index 8e2672106ac60a22824836a944503a05616f8661..d5f1dddd43e72dd62b3d031130193e6125edf9df 100644<br />--- a/sound/soc/sof/amd/vangogh.c<br />+++ b/sound/soc/sof/amd/vangogh.c<br />@@ -11,6 +11,7 @@<br /> * Hardware interface for Audio DSP on Vangogh platform<br /> */<br /> <br />+#include <linux/delay.h><br /> #include <linux/platform_device.h><br /> #include <linux/module.h><br /> <br />@@ -136,6 +137,20 @@ static struct snd_soc_dai_driver vangogh_sof_dai[] = {<br /> },<br /> };<br /> <br />+static int sof_vangogh_post_fw_run_delay(struct snd_sof_dev *sdev)<br />+{<br />+ /*<br />+ * Resuming from suspend in some cases my cause the DSP firmware<br />+ * to enter an unrecoverable faulty state. Delaying a bit any host<br />+ * to DSP transmission right after firmware boot completion seems<br />+ * to resolve the issue.<br />+ */<br />+ if (!sdev->first_boot)<br />+ usleep_range(100, 150);<br />+<br />+ return 0;<br />+}<br />+<br /> /* Vangogh ops */<br /> struct snd_sof_dsp_ops sof_vangogh_ops;<br /> EXPORT_SYMBOL_NS(sof_vangogh_ops, "SND_SOC_SOF_AMD_COMMON");<br />@@ -157,6 +172,9 @@ int sof_vangogh_ops_init(struct snd_sof_dev *sdev)<br /> <br /> if (quirks->signed_fw_image)<br /> sof_vangogh_ops.load_firmware = acp_sof_load_signed_firmware;<br />+<br />+ if (quirks->post_fw_run_delay)<br />+ sof_vangogh_ops.post_fw_run = sof_vangogh_post_fw_run_delay;<br /> }<br /> <br /> return 0;<br />-- <br />2.48.1<br /><br /><br /></pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2025-02-07 12:47 聽聽 [W:0.357 / U:0.423 seconds]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>