soc: qcom: Add snapshot of msm_show_epoch driver

Add snapshot of msm_show_epoch driver from msm-5.15
'commit<0ed881f5ef4b> ("soc: qcom: Add snapshot of
msm_show_epoch driver for kalama")'.

Change-Id: If75c26099a244e04f227ce14fede0fe7b7814a3c
Signed-off-by: Minghao Zhang <quic_minghao@quicinc.com>
This commit is contained in:
Minghao Zhang 2023-06-21 18:24:51 +08:00
parent ad66be77b5
commit f0b5d4de0e
3 changed files with 55 additions and 0 deletions

View File

@ -80,6 +80,16 @@ config QCOM_CPUSS_SLEEP_STATS
low power modes. This driver creates debugfs entry which provide
provision to read those counters.
config SHOW_SUSPEND_EPOCH
tristate "Show epoch values in suspend resume cycles"
depends on ARCH_QCOM
help
Show epoch values when device enter and exit out of suspend
and resume. These epoch values are useful to know how long
the device is in suspend state. These values can be used to
synchronize various subsystem timestamps and have an unique
timestamp to correlate between various subsystems.
config QCOM_CRM
tristate "Qualcomm Technologies, Inc. (QTI) CRM driver"
depends on QCOM_RPMH && (ARCH_QCOM || COMPILE_TEST)

View File

@ -77,6 +77,7 @@ obj-$(CONFIG_QCOM_LOGBUF_BOOTLOG) += qcom_logbuf_boot_log.o
obj-$(CONFIG_QCOM_HUNG_TASK_ENH) += hung_task_enh.o
obj-$(CONFIG_QCOM_AOP_SET_DDR) += aop-set-ddr.o
obj-$(CONFIG_QCOM_MEM_OFFLINE) += mem-offline.o
obj-$(CONFIG_SHOW_SUSPEND_EPOCH) += msm_show_epoch.o
obj-$(CONFIG_GH_TLMM_VM_MEM_ACCESS) += gh_tlmm_vm_mem_access.o
obj-$(CONFIG_GH_CPUSYS_VM_MEM_ACCESS) += gh_cpusys_vm_mem_access.o
obj-$(CONFIG_SPS) += sps/

View File

@ -0,0 +1,44 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
#include <trace/hooks/epoch.h>
static u64 suspend_ns;
static u64 suspend_cycles;
static u64 resume_cycles;
static void msm_show_suspend_epoch_val(void *data, u64 ns, u64 cycles)
{
suspend_ns = ns;
suspend_cycles = cycles;
pr_info("suspend ns:%17llu suspend cycles:%17llu\n",
suspend_ns, suspend_cycles);
}
static void msm_show_resume_epoch_val(void *data, u64 cycles)
{
resume_cycles = cycles;
pr_info("resume cycles:%17llu\n", resume_cycles);
}
static int __init msm_show_epoch_init(void)
{
register_trace_android_vh_show_suspend_epoch_val(
msm_show_suspend_epoch_val, NULL);
register_trace_android_vh_show_resume_epoch_val(
msm_show_resume_epoch_val, NULL);
return 0;
}
#if IS_MODULE(CONFIG_SHOW_SUSPEND_EPOCH)
module_init(msm_show_epoch_init);
#else
pure_initcall(msm_show_epoch_init);
#endif
MODULE_DESCRIPTION("Qualcomm Technologies, Inc. show epoch values driver");
MODULE_LICENSE("GPL");