clk: qcom: Add gdsc_time trace

Add gdsc_time trace debugfs file to log gdsc state when they
are enabled/disabled. This trace also logs time taken for each
gdsc enable/disable call.

Also swap gdscr_status enum value to align gdsc enable/disable
trace as 1/0 respectively.

Change-Id: Ic57f7a0fc44df890e6418d257fe76dafacab55e9
Signed-off-by: Vivek Aknurwar <quic_viveka@quicinc.com>
This commit is contained in:
Vivek Aknurwar 2022-04-15 09:20:36 -07:00 committed by Mike Tipton
parent 7093f03092
commit 8d62f9855d
2 changed files with 59 additions and 2 deletions

View File

@ -29,6 +29,9 @@
#include "../../regulator/internal.h"
#include "gdsc-debug.h"
#define CREATE_TRACE_POINTS
#include "trace-gdsc.h"
/* GDSCR */
#define PWR_ON_MASK BIT(31)
#define CLK_DIS_WAIT_MASK (0xF << 12)
@ -100,8 +103,8 @@ struct gdsc {
};
enum gdscr_status {
ENABLED,
DISABLED,
ENABLED,
};
static inline u32 gdsc_mb(struct gdsc *gds)
@ -148,8 +151,11 @@ static int poll_gdsc_status(struct gdsc *sc, enum gdscr_status status)
break;
}
if (val)
if (val) {
trace_gdsc_time(sc->rdesc.name, status,
sc->gds_timeout - count, 0);
return 0;
}
/*
* There is no guarantee about the delay needed for the enable
* bit in the GDSCR to be set or reset after the GDSC state
@ -160,6 +166,8 @@ static int poll_gdsc_status(struct gdsc *sc, enum gdscr_status status)
udelay(1);
}
trace_gdsc_time(sc->rdesc.name, status,
sc->gds_timeout - count, 1);
return -ETIMEDOUT;
}

View File

@ -0,0 +1,49 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#undef TRACE_SYSTEM
#define TRACE_SYSTEM clk_gdsc
#if !defined(_TRACE_CLOCK_GDSC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_CLOCK_GDSC
#include <linux/tracepoint.h>
TRACE_EVENT(gdsc_time,
TP_PROTO(const char *name, u32 enabling, u32 time_us, u32 timed_out),
TP_ARGS(name, enabling, time_us, timed_out),
TP_STRUCT__entry(
__string(name, name)
__field(unsigned int, enabling)
__field(unsigned int, time_us)
__field(unsigned int, timed_out)
),
TP_fast_assign(
__assign_str(name, name);
__entry->enabling = enabling;
__entry->time_us = time_us;
__entry->timed_out = timed_out;
),
TP_printk("%s enabling:%d time_us:%d timed_out:%d",
__get_str(name), __entry->enabling,
__entry->time_us, __entry->timed_out)
);
#endif /* _TRACE_CLOCK_GDSC */
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace-gdsc
#include <trace/define_trace.h>