Commit 0152b8a2 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: SOF: debug: Use DEBUG log level for optional prints

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: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarChao Song <chao.song@intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-20-peter.ujfalusi@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent beb6ade1
...@@ -943,38 +943,42 @@ static const struct soc_fw_state_info { ...@@ -943,38 +943,42 @@ static const struct soc_fw_state_info {
{SOF_FW_CRASHED, "SOF_FW_CRASHED"}, {SOF_FW_CRASHED, "SOF_FW_CRASHED"},
}; };
static void snd_sof_dbg_print_fw_state(struct snd_sof_dev *sdev) static void snd_sof_dbg_print_fw_state(struct snd_sof_dev *sdev, const char *level)
{ {
int i; int i;
for (i = 0; i < ARRAY_SIZE(fw_state_dbg); i++) { for (i = 0; i < ARRAY_SIZE(fw_state_dbg); i++) {
if (sdev->fw_state == fw_state_dbg[i].state) { if (sdev->fw_state == fw_state_dbg[i].state) {
dev_err(sdev->dev, "fw_state: %s (%d)\n", fw_state_dbg[i].name, i); dev_printk(level, sdev->dev, "fw_state: %s (%d)\n",
fw_state_dbg[i].name, i);
return; return;
} }
} }
dev_err(sdev->dev, "fw_state: UNKNOWN (%d)\n", sdev->fw_state); dev_printk(level, sdev->dev, "fw_state: UNKNOWN (%d)\n", sdev->fw_state);
} }
void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, const char *msg, u32 flags) void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, const char *msg, u32 flags)
{ {
char *level = flags & SOF_DBG_DUMP_OPTIONAL ? KERN_DEBUG : KERN_ERR;
bool print_all = sof_debug_check_flag(SOF_DBG_PRINT_ALL_DUMPS); bool print_all = sof_debug_check_flag(SOF_DBG_PRINT_ALL_DUMPS);
if (flags & SOF_DBG_DUMP_OPTIONAL && !print_all) if (flags & SOF_DBG_DUMP_OPTIONAL && !print_all)
return; return;
if (sof_ops(sdev)->dbg_dump && !sdev->dbg_dump_printed) { if (sof_ops(sdev)->dbg_dump && !sdev->dbg_dump_printed) {
dev_err(sdev->dev, "------------[ DSP dump start ]------------\n"); dev_printk(level, sdev->dev,
"------------[ DSP dump start ]------------\n");
if (msg) if (msg)
dev_err(sdev->dev, "%s\n", msg); dev_printk(level, sdev->dev, "%s\n", msg);
snd_sof_dbg_print_fw_state(sdev); snd_sof_dbg_print_fw_state(sdev, level);
sof_ops(sdev)->dbg_dump(sdev, flags); sof_ops(sdev)->dbg_dump(sdev, flags);
dev_err(sdev->dev, "------------[ DSP dump end ]------------\n"); dev_printk(level, sdev->dev,
"------------[ DSP dump end ]------------\n");
if (!print_all) if (!print_all)
sdev->dbg_dump_printed = true; sdev->dbg_dump_printed = true;
} else if (msg) { } else if (msg) {
dev_err(sdev->dev, "%s\n", msg); dev_printk(level, sdev->dev, "%s\n", msg);
} }
} }
EXPORT_SYMBOL(snd_sof_dsp_dbg_dump); EXPORT_SYMBOL(snd_sof_dsp_dbg_dump);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment