ASoC: SOF: Intel: hda: Use DEBUG log level for optional prints
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 23 Dec 2021 11:36:28 +0000 (13:36 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 23 Dec 2021 13:38:30 +0000 (13:38 +0000)
If the user requested to see all dumps (even the optional ones) then use
KERN_DEBUG level for the optional dumps as they are only for debugging
purposes.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-21-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda.c

index 97027530ecef9c884e1accffd521d1bd357dc285..18abbd13d593765ab9bb566f5fab1547304f454e 100644 (file)
@@ -474,7 +474,7 @@ static const struct hda_dsp_msg_code hda_dsp_rom_msg[] = {
        {HDA_DSP_ROM_NULL_FW_ENTRY,     "error: null FW entry point"},
 };
 
-static void hda_dsp_get_status(struct snd_sof_dev *sdev)
+static void hda_dsp_get_status(struct snd_sof_dev *sdev, const char *level)
 {
        u32 status;
        int i;
@@ -484,8 +484,8 @@ static void hda_dsp_get_status(struct snd_sof_dev *sdev)
 
        for (i = 0; i < ARRAY_SIZE(hda_dsp_rom_msg); i++) {
                if (status == hda_dsp_rom_msg[i].code) {
-                       dev_err(sdev->dev, "%s - code %8.8x\n",
-                               hda_dsp_rom_msg[i].msg, status);
+                       dev_printk(level, sdev->dev, "%s - code %8.8x\n",
+                                  hda_dsp_rom_msg[i].msg, status);
                        return;
                }
        }
@@ -523,7 +523,8 @@ static void hda_dsp_get_registers(struct snd_sof_dev *sdev,
 }
 
 /* dump the first 8 dwords representing the extended ROM status */
-static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, u32 flags)
+static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, const char *level,
+                                       u32 flags)
 {
        char msg[128];
        int len = 0;
@@ -535,18 +536,19 @@ static void hda_dsp_dump_ext_rom_status(struct snd_sof_dev *sdev, u32 flags)
                len += snprintf(msg + len, sizeof(msg) - len, " 0x%x", value);
        }
 
-       dev_err(sdev->dev, "extended rom status: %s", msg);
+       dev_printk(level, sdev->dev, "extended rom status: %s", msg);
 
 }
 
 void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
 {
+       char *level = flags & SOF_DBG_DUMP_OPTIONAL ? KERN_DEBUG : KERN_ERR;
        struct sof_ipc_dsp_oops_xtensa xoops;
        struct sof_ipc_panic_info panic_info;
        u32 stack[HDA_DSP_STACK_DUMP_SIZE];
 
        /* print ROM/FW status */
-       hda_dsp_get_status(sdev);
+       hda_dsp_get_status(sdev, level);
 
        if (flags & SOF_DBG_DUMP_REGS) {
                u32 status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_FW_STATUS);
@@ -554,10 +556,10 @@ void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
 
                hda_dsp_get_registers(sdev, &xoops, &panic_info, stack,
                                      HDA_DSP_STACK_DUMP_SIZE);
-               sof_print_oops_and_stack(sdev, KERN_ERR, status, panic, &xoops,
+               sof_print_oops_and_stack(sdev, level, status, panic, &xoops,
                                         &panic_info, stack, HDA_DSP_STACK_DUMP_SIZE);
        } else {
-               hda_dsp_dump_ext_rom_status(sdev, flags);
+               hda_dsp_dump_ext_rom_status(sdev, level, flags);
        }
 }