14d49d352SNishad Kamdar /* SPDX-License-Identifier: GPL-2.0 */ 283374e03SChunfeng Yun /** 383374e03SChunfeng Yun * mtu3_trace.h - trace support 483374e03SChunfeng Yun * 583374e03SChunfeng Yun * Copyright (C) 2019 MediaTek Inc. 683374e03SChunfeng Yun * 783374e03SChunfeng Yun * Author: Chunfeng Yun <chunfeng.yun@mediatek.com> 883374e03SChunfeng Yun */ 983374e03SChunfeng Yun 1083374e03SChunfeng Yun #undef TRACE_SYSTEM 1183374e03SChunfeng Yun #define TRACE_SYSTEM mtu3 1283374e03SChunfeng Yun 1383374e03SChunfeng Yun #if !defined(__MTU3_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ) 1483374e03SChunfeng Yun #define __MTU3_TRACE_H__ 1583374e03SChunfeng Yun 1683374e03SChunfeng Yun #include <linux/types.h> 1783374e03SChunfeng Yun #include <linux/tracepoint.h> 1883374e03SChunfeng Yun 1983374e03SChunfeng Yun #include "mtu3.h" 2083374e03SChunfeng Yun 2183374e03SChunfeng Yun TRACE_EVENT(mtu3_log, 2283374e03SChunfeng Yun TP_PROTO(struct device *dev, struct va_format *vaf), 2383374e03SChunfeng Yun TP_ARGS(dev, vaf), 2483374e03SChunfeng Yun TP_STRUCT__entry( 2583374e03SChunfeng Yun __string(name, dev_name(dev)) 26*730dbb8dSSteven Rostedt (Google) __vstring(msg, vaf->fmt, vaf->va) 2783374e03SChunfeng Yun ), 2883374e03SChunfeng Yun TP_fast_assign( 2983374e03SChunfeng Yun __assign_str(name, dev_name(dev)); 30*730dbb8dSSteven Rostedt (Google) __assign_vstr(msg, vaf->fmt, vaf->va); 3183374e03SChunfeng Yun ), 3283374e03SChunfeng Yun TP_printk("%s: %s", __get_str(name), __get_str(msg)) 3383374e03SChunfeng Yun ); 3483374e03SChunfeng Yun 3583374e03SChunfeng Yun TRACE_EVENT(mtu3_u3_ltssm_isr, 3683374e03SChunfeng Yun TP_PROTO(u32 intr), 3783374e03SChunfeng Yun TP_ARGS(intr), 3883374e03SChunfeng Yun TP_STRUCT__entry( 3983374e03SChunfeng Yun __field(u32, intr) 4083374e03SChunfeng Yun ), 4183374e03SChunfeng Yun TP_fast_assign( 4283374e03SChunfeng Yun __entry->intr = intr; 4383374e03SChunfeng Yun ), 4483374e03SChunfeng Yun TP_printk("(%08x) %s %s %s %s %s %s", __entry->intr, 4583374e03SChunfeng Yun __entry->intr & HOT_RST_INTR ? "HOT_RST" : "", 4683374e03SChunfeng Yun __entry->intr & WARM_RST_INTR ? "WARM_RST" : "", 4783374e03SChunfeng Yun __entry->intr & ENTER_U3_INTR ? "ENT_U3" : "", 4883374e03SChunfeng Yun __entry->intr & EXIT_U3_INTR ? "EXIT_U3" : "", 4983374e03SChunfeng Yun __entry->intr & VBUS_RISE_INTR ? "VBUS_RISE" : "", 5083374e03SChunfeng Yun __entry->intr & VBUS_FALL_INTR ? "VBUS_FALL" : "" 5183374e03SChunfeng Yun ) 5283374e03SChunfeng Yun ); 5383374e03SChunfeng Yun 5483374e03SChunfeng Yun TRACE_EVENT(mtu3_u2_common_isr, 5583374e03SChunfeng Yun TP_PROTO(u32 intr), 5683374e03SChunfeng Yun TP_ARGS(intr), 5783374e03SChunfeng Yun TP_STRUCT__entry( 5883374e03SChunfeng Yun __field(u32, intr) 5983374e03SChunfeng Yun ), 6083374e03SChunfeng Yun TP_fast_assign( 6183374e03SChunfeng Yun __entry->intr = intr; 6283374e03SChunfeng Yun ), 6383374e03SChunfeng Yun TP_printk("(%08x) %s %s %s", __entry->intr, 6483374e03SChunfeng Yun __entry->intr & SUSPEND_INTR ? "SUSPEND" : "", 6583374e03SChunfeng Yun __entry->intr & RESUME_INTR ? "RESUME" : "", 6683374e03SChunfeng Yun __entry->intr & RESET_INTR ? "RESET" : "" 6783374e03SChunfeng Yun ) 6883374e03SChunfeng Yun ); 6983374e03SChunfeng Yun 7083374e03SChunfeng Yun TRACE_EVENT(mtu3_qmu_isr, 7183374e03SChunfeng Yun TP_PROTO(u32 done_intr, u32 exp_intr), 7283374e03SChunfeng Yun TP_ARGS(done_intr, exp_intr), 7383374e03SChunfeng Yun TP_STRUCT__entry( 7483374e03SChunfeng Yun __field(u32, done_intr) 7583374e03SChunfeng Yun __field(u32, exp_intr) 7683374e03SChunfeng Yun ), 7783374e03SChunfeng Yun TP_fast_assign( 7883374e03SChunfeng Yun __entry->done_intr = done_intr; 7983374e03SChunfeng Yun __entry->exp_intr = exp_intr; 8083374e03SChunfeng Yun ), 8183374e03SChunfeng Yun TP_printk("done (tx %04x, rx %04x), exp (%08x)", 8283374e03SChunfeng Yun __entry->done_intr & 0xffff, 8383374e03SChunfeng Yun __entry->done_intr >> 16, 8483374e03SChunfeng Yun __entry->exp_intr 8583374e03SChunfeng Yun ) 8683374e03SChunfeng Yun ); 8783374e03SChunfeng Yun 8883374e03SChunfeng Yun DECLARE_EVENT_CLASS(mtu3_log_setup, 8983374e03SChunfeng Yun TP_PROTO(struct usb_ctrlrequest *setup), 9083374e03SChunfeng Yun TP_ARGS(setup), 9183374e03SChunfeng Yun TP_STRUCT__entry( 9283374e03SChunfeng Yun __field(__u8, bRequestType) 9383374e03SChunfeng Yun __field(__u8, bRequest) 9483374e03SChunfeng Yun __field(__u16, wValue) 9583374e03SChunfeng Yun __field(__u16, wIndex) 9683374e03SChunfeng Yun __field(__u16, wLength) 9783374e03SChunfeng Yun ), 9883374e03SChunfeng Yun TP_fast_assign( 9983374e03SChunfeng Yun __entry->bRequestType = setup->bRequestType; 10083374e03SChunfeng Yun __entry->bRequest = setup->bRequest; 10183374e03SChunfeng Yun __entry->wValue = le16_to_cpu(setup->wValue); 10283374e03SChunfeng Yun __entry->wIndex = le16_to_cpu(setup->wIndex); 10383374e03SChunfeng Yun __entry->wLength = le16_to_cpu(setup->wLength); 10483374e03SChunfeng Yun ), 10583374e03SChunfeng Yun TP_printk("setup - %02x %02x %04x %04x %04x", 10683374e03SChunfeng Yun __entry->bRequestType, __entry->bRequest, 10783374e03SChunfeng Yun __entry->wValue, __entry->wIndex, __entry->wLength 10883374e03SChunfeng Yun ) 10983374e03SChunfeng Yun ); 11083374e03SChunfeng Yun 11183374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_setup, mtu3_handle_setup, 11283374e03SChunfeng Yun TP_PROTO(struct usb_ctrlrequest *setup), 11383374e03SChunfeng Yun TP_ARGS(setup) 11483374e03SChunfeng Yun ); 11583374e03SChunfeng Yun 11683374e03SChunfeng Yun DECLARE_EVENT_CLASS(mtu3_log_request, 11783374e03SChunfeng Yun TP_PROTO(struct mtu3_request *mreq), 11883374e03SChunfeng Yun TP_ARGS(mreq), 11983374e03SChunfeng Yun TP_STRUCT__entry( 12083374e03SChunfeng Yun __string(name, mreq->mep->name) 12183374e03SChunfeng Yun __field(struct mtu3_request *, mreq) 12283374e03SChunfeng Yun __field(struct qmu_gpd *, gpd) 12383374e03SChunfeng Yun __field(unsigned int, actual) 12483374e03SChunfeng Yun __field(unsigned int, length) 12583374e03SChunfeng Yun __field(int, status) 12683374e03SChunfeng Yun __field(int, zero) 12783374e03SChunfeng Yun __field(int, no_interrupt) 12883374e03SChunfeng Yun ), 12983374e03SChunfeng Yun TP_fast_assign( 13083374e03SChunfeng Yun __assign_str(name, mreq->mep->name); 13183374e03SChunfeng Yun __entry->mreq = mreq; 13283374e03SChunfeng Yun __entry->gpd = mreq->gpd; 13383374e03SChunfeng Yun __entry->actual = mreq->request.actual; 13483374e03SChunfeng Yun __entry->length = mreq->request.length; 13583374e03SChunfeng Yun __entry->status = mreq->request.status; 13683374e03SChunfeng Yun __entry->zero = mreq->request.zero; 13783374e03SChunfeng Yun __entry->no_interrupt = mreq->request.no_interrupt; 13883374e03SChunfeng Yun ), 13983374e03SChunfeng Yun TP_printk("%s: req %p gpd %p len %u/%u %s%s --> %d", 14083374e03SChunfeng Yun __get_str(name), __entry->mreq, __entry->gpd, 14183374e03SChunfeng Yun __entry->actual, __entry->length, 14283374e03SChunfeng Yun __entry->zero ? "Z" : "z", 14383374e03SChunfeng Yun __entry->no_interrupt ? "i" : "I", 14483374e03SChunfeng Yun __entry->status 14583374e03SChunfeng Yun ) 14683374e03SChunfeng Yun ); 14783374e03SChunfeng Yun 14883374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_request, mtu3_alloc_request, 14983374e03SChunfeng Yun TP_PROTO(struct mtu3_request *req), 15083374e03SChunfeng Yun TP_ARGS(req) 15183374e03SChunfeng Yun ); 15283374e03SChunfeng Yun 15383374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_request, mtu3_free_request, 15483374e03SChunfeng Yun TP_PROTO(struct mtu3_request *req), 15583374e03SChunfeng Yun TP_ARGS(req) 15683374e03SChunfeng Yun ); 15783374e03SChunfeng Yun 15883374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_request, mtu3_gadget_queue, 15983374e03SChunfeng Yun TP_PROTO(struct mtu3_request *req), 16083374e03SChunfeng Yun TP_ARGS(req) 16183374e03SChunfeng Yun ); 16283374e03SChunfeng Yun 16383374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_request, mtu3_gadget_dequeue, 16483374e03SChunfeng Yun TP_PROTO(struct mtu3_request *req), 16583374e03SChunfeng Yun TP_ARGS(req) 16683374e03SChunfeng Yun ); 16783374e03SChunfeng Yun 16883374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_request, mtu3_req_complete, 16983374e03SChunfeng Yun TP_PROTO(struct mtu3_request *req), 17083374e03SChunfeng Yun TP_ARGS(req) 17183374e03SChunfeng Yun ); 17283374e03SChunfeng Yun 17383374e03SChunfeng Yun DECLARE_EVENT_CLASS(mtu3_log_gpd, 17483374e03SChunfeng Yun TP_PROTO(struct mtu3_ep *mep, struct qmu_gpd *gpd), 17583374e03SChunfeng Yun TP_ARGS(mep, gpd), 17683374e03SChunfeng Yun TP_STRUCT__entry( 17783374e03SChunfeng Yun __string(name, mep->name) 17883374e03SChunfeng Yun __field(struct qmu_gpd *, gpd) 17983374e03SChunfeng Yun __field(u32, dw0) 18083374e03SChunfeng Yun __field(u32, dw1) 18183374e03SChunfeng Yun __field(u32, dw2) 18283374e03SChunfeng Yun __field(u32, dw3) 18383374e03SChunfeng Yun ), 18483374e03SChunfeng Yun TP_fast_assign( 18583374e03SChunfeng Yun __assign_str(name, mep->name); 18683374e03SChunfeng Yun __entry->gpd = gpd; 18783374e03SChunfeng Yun __entry->dw0 = le32_to_cpu(gpd->dw0_info); 18883374e03SChunfeng Yun __entry->dw1 = le32_to_cpu(gpd->next_gpd); 18983374e03SChunfeng Yun __entry->dw2 = le32_to_cpu(gpd->buffer); 19083374e03SChunfeng Yun __entry->dw3 = le32_to_cpu(gpd->dw3_info); 19183374e03SChunfeng Yun ), 19283374e03SChunfeng Yun TP_printk("%s: gpd %p - %08x %08x %08x %08x", 19383374e03SChunfeng Yun __get_str(name), __entry->gpd, 19483374e03SChunfeng Yun __entry->dw0, __entry->dw1, 19583374e03SChunfeng Yun __entry->dw2, __entry->dw3 19683374e03SChunfeng Yun ) 19783374e03SChunfeng Yun ); 19883374e03SChunfeng Yun 19983374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_gpd, mtu3_prepare_gpd, 20083374e03SChunfeng Yun TP_PROTO(struct mtu3_ep *mep, struct qmu_gpd *gpd), 20183374e03SChunfeng Yun TP_ARGS(mep, gpd) 20283374e03SChunfeng Yun ); 20383374e03SChunfeng Yun 20483374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_gpd, mtu3_complete_gpd, 20583374e03SChunfeng Yun TP_PROTO(struct mtu3_ep *mep, struct qmu_gpd *gpd), 20683374e03SChunfeng Yun TP_ARGS(mep, gpd) 20783374e03SChunfeng Yun ); 20883374e03SChunfeng Yun 20983374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_gpd, mtu3_zlp_exp_gpd, 21083374e03SChunfeng Yun TP_PROTO(struct mtu3_ep *mep, struct qmu_gpd *gpd), 21183374e03SChunfeng Yun TP_ARGS(mep, gpd) 21283374e03SChunfeng Yun ); 21383374e03SChunfeng Yun 21483374e03SChunfeng Yun DECLARE_EVENT_CLASS(mtu3_log_ep, 21583374e03SChunfeng Yun TP_PROTO(struct mtu3_ep *mep), 21683374e03SChunfeng Yun TP_ARGS(mep), 21783374e03SChunfeng Yun TP_STRUCT__entry( 21883374e03SChunfeng Yun __string(name, mep->name) 21983374e03SChunfeng Yun __field(unsigned int, type) 22083374e03SChunfeng Yun __field(unsigned int, slot) 22183374e03SChunfeng Yun __field(unsigned int, maxp) 22283374e03SChunfeng Yun __field(unsigned int, mult) 22383374e03SChunfeng Yun __field(unsigned int, maxburst) 22483374e03SChunfeng Yun __field(unsigned int, flags) 22583374e03SChunfeng Yun __field(unsigned int, direction) 22683374e03SChunfeng Yun __field(struct mtu3_gpd_ring *, gpd_ring) 22783374e03SChunfeng Yun ), 22883374e03SChunfeng Yun TP_fast_assign( 22983374e03SChunfeng Yun __assign_str(name, mep->name); 23083374e03SChunfeng Yun __entry->type = mep->type; 23183374e03SChunfeng Yun __entry->slot = mep->slot; 23283374e03SChunfeng Yun __entry->maxp = mep->ep.maxpacket; 23383374e03SChunfeng Yun __entry->mult = mep->ep.mult; 23483374e03SChunfeng Yun __entry->maxburst = mep->ep.maxburst; 23583374e03SChunfeng Yun __entry->flags = mep->flags; 23683374e03SChunfeng Yun __entry->direction = mep->is_in; 23783374e03SChunfeng Yun __entry->gpd_ring = &mep->gpd_ring; 23883374e03SChunfeng Yun ), 2393cb79822SChunfeng Yun TP_printk("%s: type %s maxp %d slot %d mult %d burst %d ring %p/%pad flags %c:%c%c%c:%c", 2403cb79822SChunfeng Yun __get_str(name), usb_ep_type_string(__entry->type), 24183374e03SChunfeng Yun __entry->maxp, __entry->slot, 24283374e03SChunfeng Yun __entry->mult, __entry->maxburst, 24383374e03SChunfeng Yun __entry->gpd_ring, &__entry->gpd_ring->dma, 24483374e03SChunfeng Yun __entry->flags & MTU3_EP_ENABLED ? 'E' : 'e', 24583374e03SChunfeng Yun __entry->flags & MTU3_EP_STALL ? 'S' : 's', 24683374e03SChunfeng Yun __entry->flags & MTU3_EP_WEDGE ? 'W' : 'w', 24783374e03SChunfeng Yun __entry->flags & MTU3_EP_BUSY ? 'B' : 'b', 24883374e03SChunfeng Yun __entry->direction ? '<' : '>' 24983374e03SChunfeng Yun ) 25083374e03SChunfeng Yun ); 25183374e03SChunfeng Yun 25283374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_ep, mtu3_gadget_ep_enable, 25383374e03SChunfeng Yun TP_PROTO(struct mtu3_ep *mep), 25483374e03SChunfeng Yun TP_ARGS(mep) 25583374e03SChunfeng Yun ); 25683374e03SChunfeng Yun 25783374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_ep, mtu3_gadget_ep_disable, 25883374e03SChunfeng Yun TP_PROTO(struct mtu3_ep *mep), 25983374e03SChunfeng Yun TP_ARGS(mep) 26083374e03SChunfeng Yun ); 26183374e03SChunfeng Yun 26283374e03SChunfeng Yun DEFINE_EVENT(mtu3_log_ep, mtu3_gadget_ep_set_halt, 26383374e03SChunfeng Yun TP_PROTO(struct mtu3_ep *mep), 26483374e03SChunfeng Yun TP_ARGS(mep) 26583374e03SChunfeng Yun ); 26683374e03SChunfeng Yun 26783374e03SChunfeng Yun #endif /* __MTU3_TRACE_H__ */ 26883374e03SChunfeng Yun 26983374e03SChunfeng Yun /* this part has to be here */ 27083374e03SChunfeng Yun 27183374e03SChunfeng Yun #undef TRACE_INCLUDE_PATH 27283374e03SChunfeng Yun #define TRACE_INCLUDE_PATH . 27383374e03SChunfeng Yun 27483374e03SChunfeng Yun #undef TRACE_INCLUDE_FILE 27583374e03SChunfeng Yun #define TRACE_INCLUDE_FILE mtu3_trace 27683374e03SChunfeng Yun 27783374e03SChunfeng Yun #include <trace/define_trace.h> 278