diff --git a/drivers/clk/qcom/gdsc-regulator.c b/drivers/clk/qcom/gdsc-regulator.c index 7c9d80dacf2c..60f4b7695a47 100644 --- a/drivers/clk/qcom/gdsc-regulator.c +++ b/drivers/clk/qcom/gdsc-regulator.c @@ -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; } diff --git a/drivers/clk/qcom/trace-gdsc.h b/drivers/clk/qcom/trace-gdsc.h new file mode 100644 index 000000000000..e5314df67d50 --- /dev/null +++ b/drivers/clk/qcom/trace-gdsc.h @@ -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 + +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