clk: qcom: clk-debug: Enable ftrace for clock frequency measurement

Enable ftrace support for clocks so that clients can measure
frequency of the clock through ftraces.

Change-Id: Ie923ac538b670598bb1be009e892a68c4f1e2a38
Signed-off-by: Kalpak Kawadkar <quic_kkawadka@quicinc.com>
This commit is contained in:
Kalpak Kawadkar 2022-06-13 14:18:12 +05:30 committed by Mike Tipton
parent aa899c2d1f
commit 6497e33a15
2 changed files with 30 additions and 0 deletions

View File

@ -480,6 +480,8 @@ static int clk_debug_measure_get(void *data, u64 *val)
*val *= get_mux_divs(measure);
disable_debug_clks(measure);
}
trace_clk_measure(clk_hw_get_name(hw), *val);
exit:
mutex_unlock(&clk_debug_lock);
clk_runtime_put_debug_mux(meas);

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#undef TRACE_SYSTEM
@ -47,6 +48,33 @@ DEFINE_EVENT(clk_state_dump, clk_state,
TP_ARGS(name, prepare_count, enable_count, rate, vdd_level)
);
DECLARE_EVENT_CLASS(clk_measure_support,
TP_PROTO(const char *name, unsigned long rate),
TP_ARGS(name, rate),
TP_STRUCT__entry(
__string(name, name)
__field(unsigned long, rate)
),
TP_fast_assign(
__assign_str(name, name);
__entry->rate = rate;
),
TP_printk("%s rate: %lu",
__get_str(name), (unsigned long)__entry->rate)
);
DEFINE_EVENT(clk_measure_support, clk_measure,
TP_PROTO(const char *name, unsigned long rate),
TP_ARGS(name, rate)
);
#endif /* _TRACE_CLOCK_QCOM */
/* This part must be outside protection */