18c2ecf20Sopenharmony_ci#undef TRACE_SYSTEM
28c2ecf20Sopenharmony_ci#define TRACE_SYSTEM rtc
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#if !defined(_TRACE_RTC_H) || defined(TRACE_HEADER_MULTI_READ)
58c2ecf20Sopenharmony_ci#define _TRACE_RTC_H
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <linux/rtc.h>
88c2ecf20Sopenharmony_ci#include <linux/tracepoint.h>
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciDECLARE_EVENT_CLASS(rtc_time_alarm_class,
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci	TP_PROTO(time64_t secs, int err),
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci	TP_ARGS(secs, err),
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
178c2ecf20Sopenharmony_ci		__field(time64_t, secs)
188c2ecf20Sopenharmony_ci		__field(int, err)
198c2ecf20Sopenharmony_ci	),
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	TP_fast_assign(
228c2ecf20Sopenharmony_ci		__entry->secs = secs;
238c2ecf20Sopenharmony_ci		__entry->err = err;
248c2ecf20Sopenharmony_ci	),
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	TP_printk("UTC (%lld) (%d)",
278c2ecf20Sopenharmony_ci		  __entry->secs, __entry->err
288c2ecf20Sopenharmony_ci	)
298c2ecf20Sopenharmony_ci);
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDEFINE_EVENT(rtc_time_alarm_class, rtc_set_time,
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	TP_PROTO(time64_t secs, int err),
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	TP_ARGS(secs, err)
368c2ecf20Sopenharmony_ci);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciDEFINE_EVENT(rtc_time_alarm_class, rtc_read_time,
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	TP_PROTO(time64_t secs, int err),
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	TP_ARGS(secs, err)
438c2ecf20Sopenharmony_ci);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciDEFINE_EVENT(rtc_time_alarm_class, rtc_set_alarm,
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci	TP_PROTO(time64_t secs, int err),
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	TP_ARGS(secs, err)
508c2ecf20Sopenharmony_ci);
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ciDEFINE_EVENT(rtc_time_alarm_class, rtc_read_alarm,
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci	TP_PROTO(time64_t secs, int err),
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci	TP_ARGS(secs, err)
578c2ecf20Sopenharmony_ci);
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciTRACE_EVENT(rtc_irq_set_freq,
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci	TP_PROTO(int freq, int err),
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	TP_ARGS(freq, err),
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
668c2ecf20Sopenharmony_ci		__field(int, freq)
678c2ecf20Sopenharmony_ci		__field(int, err)
688c2ecf20Sopenharmony_ci	),
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	TP_fast_assign(
718c2ecf20Sopenharmony_ci		__entry->freq = freq;
728c2ecf20Sopenharmony_ci		__entry->err = err;
738c2ecf20Sopenharmony_ci	),
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	TP_printk("set RTC periodic IRQ frequency:%u (%d)",
768c2ecf20Sopenharmony_ci		  __entry->freq, __entry->err
778c2ecf20Sopenharmony_ci	)
788c2ecf20Sopenharmony_ci);
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ciTRACE_EVENT(rtc_irq_set_state,
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci	TP_PROTO(int enabled, int err),
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	TP_ARGS(enabled, err),
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
878c2ecf20Sopenharmony_ci		__field(int, enabled)
888c2ecf20Sopenharmony_ci		__field(int, err)
898c2ecf20Sopenharmony_ci	),
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci	TP_fast_assign(
928c2ecf20Sopenharmony_ci		__entry->enabled = enabled;
938c2ecf20Sopenharmony_ci		__entry->err = err;
948c2ecf20Sopenharmony_ci	),
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci	TP_printk("%s RTC 2^N Hz periodic IRQs (%d)",
978c2ecf20Sopenharmony_ci		  __entry->enabled ? "enable" : "disable",
988c2ecf20Sopenharmony_ci		  __entry->err
998c2ecf20Sopenharmony_ci	)
1008c2ecf20Sopenharmony_ci);
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ciTRACE_EVENT(rtc_alarm_irq_enable,
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci	TP_PROTO(unsigned int enabled, int err),
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci	TP_ARGS(enabled, err),
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
1098c2ecf20Sopenharmony_ci		__field(unsigned int, enabled)
1108c2ecf20Sopenharmony_ci		__field(int, err)
1118c2ecf20Sopenharmony_ci	),
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	TP_fast_assign(
1148c2ecf20Sopenharmony_ci		__entry->enabled = enabled;
1158c2ecf20Sopenharmony_ci		__entry->err = err;
1168c2ecf20Sopenharmony_ci	),
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci	TP_printk("%s RTC alarm IRQ (%d)",
1198c2ecf20Sopenharmony_ci		  __entry->enabled ? "enable" : "disable",
1208c2ecf20Sopenharmony_ci		  __entry->err
1218c2ecf20Sopenharmony_ci	)
1228c2ecf20Sopenharmony_ci);
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ciDECLARE_EVENT_CLASS(rtc_offset_class,
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	TP_PROTO(long offset, int err),
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci	TP_ARGS(offset, err),
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
1318c2ecf20Sopenharmony_ci		__field(long, offset)
1328c2ecf20Sopenharmony_ci		__field(int, err)
1338c2ecf20Sopenharmony_ci	),
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci	TP_fast_assign(
1368c2ecf20Sopenharmony_ci		__entry->offset = offset;
1378c2ecf20Sopenharmony_ci		__entry->err = err;
1388c2ecf20Sopenharmony_ci	),
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci	TP_printk("RTC offset: %ld (%d)",
1418c2ecf20Sopenharmony_ci		  __entry->offset, __entry->err
1428c2ecf20Sopenharmony_ci	)
1438c2ecf20Sopenharmony_ci);
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ciDEFINE_EVENT(rtc_offset_class, rtc_set_offset,
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci	TP_PROTO(long offset, int err),
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci	TP_ARGS(offset, err)
1508c2ecf20Sopenharmony_ci);
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ciDEFINE_EVENT(rtc_offset_class, rtc_read_offset,
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci	TP_PROTO(long offset, int err),
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci	TP_ARGS(offset, err)
1578c2ecf20Sopenharmony_ci);
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ciDECLARE_EVENT_CLASS(rtc_timer_class,
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci	TP_PROTO(struct rtc_timer *timer),
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci	TP_ARGS(timer),
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
1668c2ecf20Sopenharmony_ci		__field(struct rtc_timer *, timer)
1678c2ecf20Sopenharmony_ci		__field(ktime_t, expires)
1688c2ecf20Sopenharmony_ci		__field(ktime_t, period)
1698c2ecf20Sopenharmony_ci	),
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci	TP_fast_assign(
1728c2ecf20Sopenharmony_ci		__entry->timer = timer;
1738c2ecf20Sopenharmony_ci		__entry->expires = timer->node.expires;
1748c2ecf20Sopenharmony_ci		__entry->period = timer->period;
1758c2ecf20Sopenharmony_ci	),
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci	TP_printk("RTC timer:(%p) expires:%lld period:%lld",
1788c2ecf20Sopenharmony_ci		  __entry->timer, __entry->expires, __entry->period
1798c2ecf20Sopenharmony_ci	)
1808c2ecf20Sopenharmony_ci);
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ciDEFINE_EVENT(rtc_timer_class, rtc_timer_enqueue,
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci	TP_PROTO(struct rtc_timer *timer),
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci	TP_ARGS(timer)
1878c2ecf20Sopenharmony_ci);
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ciDEFINE_EVENT(rtc_timer_class, rtc_timer_dequeue,
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci	TP_PROTO(struct rtc_timer *timer),
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci	TP_ARGS(timer)
1948c2ecf20Sopenharmony_ci);
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ciDEFINE_EVENT(rtc_timer_class, rtc_timer_fired,
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci	TP_PROTO(struct rtc_timer *timer),
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci	TP_ARGS(timer)
2018c2ecf20Sopenharmony_ci);
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci#endif /* _TRACE_RTC_H */
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci/* This part must be outside protection */
2068c2ecf20Sopenharmony_ci#include <trace/define_trace.h>
207