mmc: core: Log MMC clock frequency transitions
Use kernel's ftrace support to capture MMC clock frequency transitions which can be useful for debugging issues related to power consumption. Usage: mount -t debugfs none /sys/kernel/debug echo 1 > /sys/kernel/debug/tracing/events/mmc/mmc_clk/enable cat /sys/kernel/debug/tracing/trace_pipe Change-Id: I25c4ee39dcbe30e7665902a9f723a5a421b55ca3 Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
This commit is contained in:
parent
553d6cb4e2
commit
b4b98fb480
3 changed files with 34 additions and 1 deletions
|
@ -1122,6 +1122,19 @@ void mmc_set_ios(struct mmc_host *host)
|
||||||
if (ios->clock > 0)
|
if (ios->clock > 0)
|
||||||
mmc_set_ungated(host);
|
mmc_set_ungated(host);
|
||||||
host->ops->set_ios(host, ios);
|
host->ops->set_ios(host, ios);
|
||||||
|
if (ios->old_rate != ios->clock) {
|
||||||
|
if (likely(ios->clk_ts)) {
|
||||||
|
char trace_info[80];
|
||||||
|
snprintf(trace_info, 80,
|
||||||
|
"%s: freq_KHz %d --> %d | t = %d",
|
||||||
|
mmc_hostname(host), ios->old_rate / 1000,
|
||||||
|
ios->clock / 1000, jiffies_to_msecs(
|
||||||
|
(long)jiffies - (long)ios->clk_ts));
|
||||||
|
trace_mmc_clk(trace_info);
|
||||||
|
}
|
||||||
|
ios->old_rate = ios->clock;
|
||||||
|
ios->clk_ts = jiffies;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mmc_set_ios);
|
EXPORT_SYMBOL(mmc_set_ios);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
struct mmc_ios {
|
struct mmc_ios {
|
||||||
unsigned int clock; /* clock rate */
|
unsigned int clock; /* clock rate */
|
||||||
|
unsigned int old_rate; /* saved clock rate */
|
||||||
|
unsigned long clk_ts; /* time stamp of last updated clock */
|
||||||
unsigned short vdd;
|
unsigned short vdd;
|
||||||
|
|
||||||
/* vdd stores the bit number of the selected voltage range from below. */
|
/* vdd stores the bit number of the selected voltage range from below. */
|
||||||
|
|
|
@ -158,7 +158,25 @@ DEFINE_EVENT(mmc_adma_class, mmc_adma_table_post,
|
||||||
TP_PROTO(unsigned int cmd, unsigned int len),
|
TP_PROTO(unsigned int cmd, unsigned int len),
|
||||||
TP_ARGS(cmd, len));
|
TP_ARGS(cmd, len));
|
||||||
|
|
||||||
#endif /* _TRACE_MMC_H */
|
TRACE_EVENT(mmc_clk,
|
||||||
|
TP_PROTO(char *print_info),
|
||||||
|
|
||||||
|
TP_ARGS(print_info),
|
||||||
|
|
||||||
|
TP_STRUCT__entry(
|
||||||
|
__string(print_info, print_info)
|
||||||
|
),
|
||||||
|
|
||||||
|
TP_fast_assign(
|
||||||
|
__assign_str(print_info, print_info);
|
||||||
|
),
|
||||||
|
|
||||||
|
TP_printk("%s",
|
||||||
|
__get_str(print_info)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif /* if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ) */
|
||||||
|
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|
Loading…
Add table
Reference in a new issue