ASoC: SOF: Intel: hda: Create debugfs file to force a clean DSP boot
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Wed, 3 Apr 2024 10:52:04 +0000 (13:52 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 3 Apr 2024 11:04:23 +0000 (12:04 +0100)
When IMR boot is supported on a platform it is always going to be used to
boot the DSP unless some catastrophic event happens.
There is no way for a developer to force a clean DSP boot without removing
and re-inserting the modules.

Create a 'skip_imr_boot' debugfs file which can be used to force the
next DSP boot as clean (prune) boot.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240403105210.17949-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda-loader.c
sound/soc/sof/intel/hda.c
sound/soc/sof/intel/lnl.c
sound/soc/sof/intel/mtl.c

index b81f231abee3efa497f8bf1aec46c955f3c3b706..d5b9209beb5a63286dc1442dfdd9203f923b3711 100644 (file)
@@ -15,6 +15,7 @@
  * Hardware interface for HDA DSP code loader
  */
 
+#include <linux/debugfs.h>
 #include <linux/firmware.h>
 #include <sound/hdaudio_ext.h>
 #include <sound/hda_register.h>
@@ -643,8 +644,12 @@ int hda_dsp_post_fw_run(struct snd_sof_dev *sdev)
                /* Check if IMR boot is usable */
                if (!sof_debug_check_flag(SOF_DBG_IGNORE_D3_PERSISTENT) &&
                    (sdev->fw_ready.flags & SOF_IPC_INFO_D3_PERSISTENT ||
-                    sdev->pdata->ipc_type == SOF_IPC_TYPE_4))
+                    sdev->pdata->ipc_type == SOF_IPC_TYPE_4)) {
                        hdev->imrboot_supported = true;
+                       debugfs_create_bool("skip_imr_boot",
+                                           0644, sdev->debugfs_root,
+                                           &hdev->skip_imr_boot);
+               }
        }
 
        hda_sdw_int_enable(sdev, true);
index d38dc43c2f1c929184179c8e9a42a598fd6305d4..33721e817ef4298994a6dfb77164c53403e3da28 100644 (file)
@@ -19,6 +19,7 @@
 #include <sound/hda_register.h>
 
 #include <linux/acpi.h>
+#include <linux/debugfs.h>
 #include <linux/module.h>
 #include <linux/soundwire/sdw.h>
 #include <linux/soundwire/sdw_intel.h>
index 7ae017a00184e52371052c188d75f13fbfc053df..1365f86b7fb729500bdd980ed4bdd6a9b864fdc3 100644 (file)
@@ -6,6 +6,7 @@
  * Hardware interface for audio DSP on LunarLake.
  */
 
+#include <linux/debugfs.h>
 #include <linux/firmware.h>
 #include <sound/hda_register.h>
 #include <sound/sof/ipc4/header.h>
@@ -83,8 +84,12 @@ static int lnl_dsp_post_fw_run(struct snd_sof_dev *sdev)
                struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
 
                /* Check if IMR boot is usable */
-               if (!sof_debug_check_flag(SOF_DBG_IGNORE_D3_PERSISTENT))
+               if (!sof_debug_check_flag(SOF_DBG_IGNORE_D3_PERSISTENT)) {
                        hda->imrboot_supported = true;
+                       debugfs_create_bool("skip_imr_boot",
+                                           0644, sdev->debugfs_root,
+                                           &hda->skip_imr_boot);
+               }
        }
 
        return 0;
index df05dc77b8d5e3bef5f3e55ea7e82837b5a89504..8a55d5a2703e44f781426735e36f499de330180b 100644 (file)
@@ -9,6 +9,7 @@
  * Hardware interface for audio DSP on Meteorlake.
  */
 
+#include <linux/debugfs.h>
 #include <linux/firmware.h>
 #include <sound/sof/ipc4/header.h>
 #include <trace/events/sof_intel.h>
@@ -294,8 +295,12 @@ int mtl_dsp_post_fw_run(struct snd_sof_dev *sdev)
                }
 
                /* Check if IMR boot is usable */
-               if (!sof_debug_check_flag(SOF_DBG_IGNORE_D3_PERSISTENT))
+               if (!sof_debug_check_flag(SOF_DBG_IGNORE_D3_PERSISTENT)) {
                        hdev->imrboot_supported = true;
+                       debugfs_create_bool("skip_imr_boot",
+                                           0644, sdev->debugfs_root,
+                                           &hdev->skip_imr_boot);
+               }
        }
 
        hda_sdw_int_enable(sdev, true);