Commit 708181c5 authored by Rander Wang's avatar Rander Wang Committed by Mark Brown

ASoC: SOF: mtrace: rework mtrace timestamp setting

The original timestamp is built base on windows epoch time which is not
fit for Linux system and difficult to be used for kernel debugging. This
patch adopts syslog timestamp so that we can simply use dmesg to check
the timestamp between fw and kernel.
Signed-off-by: default avatarRander Wang <rander.wang@intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240322112703.4549-1-peter.ujfalusi@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e2d7ad71
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/sched/signal.h> #include <linux/sched/signal.h>
#include <linux/sched/clock.h>
#include <sound/sof/ipc4/header.h> #include <sound/sof/ipc4/header.h>
#include "sof-priv.h" #include "sof-priv.h"
#include "ipc4-priv.h" #include "ipc4-priv.h"
...@@ -412,7 +413,6 @@ static int ipc4_mtrace_enable(struct snd_sof_dev *sdev) ...@@ -412,7 +413,6 @@ static int ipc4_mtrace_enable(struct snd_sof_dev *sdev)
const struct sof_ipc_ops *iops = sdev->ipc->ops; const struct sof_ipc_ops *iops = sdev->ipc->ops;
struct sof_ipc4_msg msg; struct sof_ipc4_msg msg;
u64 system_time; u64 system_time;
ktime_t kt;
int ret; int ret;
if (priv->mtrace_state != SOF_MTRACE_DISABLED) if (priv->mtrace_state != SOF_MTRACE_DISABLED)
...@@ -424,9 +424,12 @@ static int ipc4_mtrace_enable(struct snd_sof_dev *sdev) ...@@ -424,9 +424,12 @@ static int ipc4_mtrace_enable(struct snd_sof_dev *sdev)
msg.primary |= SOF_IPC4_MOD_INSTANCE(SOF_IPC4_MOD_INIT_BASEFW_INSTANCE_ID); msg.primary |= SOF_IPC4_MOD_INSTANCE(SOF_IPC4_MOD_INIT_BASEFW_INSTANCE_ID);
msg.extension = SOF_IPC4_MOD_EXT_MSG_PARAM_ID(SOF_IPC4_FW_PARAM_SYSTEM_TIME); msg.extension = SOF_IPC4_MOD_EXT_MSG_PARAM_ID(SOF_IPC4_FW_PARAM_SYSTEM_TIME);
/* The system time is in usec, UTC, epoch is 1601-01-01 00:00:00 */ /*
kt = ktime_add_us(ktime_get_real(), FW_EPOCH_DELTA * USEC_PER_SEC); * local_clock() is used to align with dmesg, so both kernel and firmware logs have
system_time = ktime_to_us(kt); * the same base and a minor delta due to the IPC. system time is in us format but
* local_clock() returns the time in ns, so convert to ns.
*/
system_time = div64_u64(local_clock(), NSEC_PER_USEC);
msg.data_size = sizeof(system_time); msg.data_size = sizeof(system_time);
msg.data_ptr = &system_time; msg.data_ptr = &system_time;
ret = iops->set_get_data(sdev, &msg, msg.data_size, true); ret = iops->set_get_data(sdev, &msg, msg.data_size, true);
......
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