Skip to content

Commit 95f295f

Browse files
bjdooks-ctvinodkoul
authored andcommitted
dmaengine: tegra: add tracepoints to driver
Add some trace-points to the driver to allow for debuging via the trace pipe. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 65c383c commit 95f295f

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

drivers/dma/tegra20-apb-dma.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838

3939
#include "dmaengine.h"
4040

41+
#define CREATE_TRACE_POINTS
42+
#include <trace/events/tegra_apb_dma.h>
43+
4144
#define TEGRA_APBDMA_GENERAL 0x0
4245
#define TEGRA_APBDMA_GENERAL_ENABLE BIT(31)
4346

@@ -672,6 +675,8 @@ static void tegra_dma_tasklet(unsigned long data)
672675
dmaengine_desc_get_callback(&dma_desc->txd, &cb);
673676
cb_count = dma_desc->cb_count;
674677
dma_desc->cb_count = 0;
678+
trace_tegra_dma_complete_cb(&tdc->dma_chan, cb_count,
679+
cb.callback);
675680
spin_unlock_irqrestore(&tdc->lock, flags);
676681
while (cb_count--)
677682
dmaengine_desc_callback_invoke(&cb, NULL);
@@ -688,6 +693,7 @@ static irqreturn_t tegra_dma_isr(int irq, void *dev_id)
688693

689694
spin_lock_irqsave(&tdc->lock, flags);
690695

696+
trace_tegra_dma_isr(&tdc->dma_chan, irq);
691697
status = tdc_read(tdc, TEGRA_APBDMA_CHAN_STATUS);
692698
if (status & TEGRA_APBDMA_STATUS_ISE_EOC) {
693699
tdc_write(tdc, TEGRA_APBDMA_CHAN_STATUS, status);
@@ -846,6 +852,7 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc,
846852
dma_set_residue(txstate, residual);
847853
}
848854

855+
trace_tegra_dma_tx_status(&tdc->dma_chan, cookie, txstate);
849856
spin_unlock_irqrestore(&tdc->lock, flags);
850857
return ret;
851858
}

include/trace/events/tegra_apb_dma.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#if !defined(_TRACE_TEGRA_APB_DMA_H) || defined(TRACE_HEADER_MULTI_READ)
2+
#define _TRACE_TEGRA_APM_DMA_H
3+
4+
#include <linux/tracepoint.h>
5+
#include <linux/dmaengine.h>
6+
7+
#undef TRACE_SYSTEM
8+
#define TRACE_SYSTEM tegra_apb_dma
9+
10+
TRACE_EVENT(tegra_dma_tx_status,
11+
TP_PROTO(struct dma_chan *dc, dma_cookie_t cookie, struct dma_tx_state *state),
12+
TP_ARGS(dc, cookie, state),
13+
TP_STRUCT__entry(
14+
__string(chan, dev_name(&dc->dev->device))
15+
__field(dma_cookie_t, cookie)
16+
__field(__u32, residue)
17+
),
18+
TP_fast_assign(
19+
__assign_str(chan, dev_name(&dc->dev->device));
20+
__entry->cookie = cookie;
21+
__entry->residue = state ? state->residue : (u32)-1;
22+
),
23+
TP_printk("channel %s: dma cookie %d, residue %u",
24+
__get_str(chan), __entry->cookie, __entry->residue)
25+
);
26+
27+
TRACE_EVENT(tegra_dma_complete_cb,
28+
TP_PROTO(struct dma_chan *dc, int count, void *ptr),
29+
TP_ARGS(dc, count, ptr),
30+
TP_STRUCT__entry(
31+
__string(chan, dev_name(&dc->dev->device))
32+
__field(int, count)
33+
__field(void *, ptr)
34+
),
35+
TP_fast_assign(
36+
__assign_str(chan, dev_name(&dc->dev->device));
37+
__entry->count = count;
38+
__entry->ptr = ptr;
39+
),
40+
TP_printk("channel %s: done %d, ptr %p",
41+
__get_str(chan), __entry->count, __entry->ptr)
42+
);
43+
44+
TRACE_EVENT(tegra_dma_isr,
45+
TP_PROTO(struct dma_chan *dc, int irq),
46+
TP_ARGS(dc, irq),
47+
TP_STRUCT__entry(
48+
__string(chan, dev_name(&dc->dev->device))
49+
__field(int, irq)
50+
),
51+
TP_fast_assign(
52+
__assign_str(chan, dev_name(&dc->dev->device));
53+
__entry->irq = irq;
54+
),
55+
TP_printk("%s: irq %d\n", __get_str(chan), __entry->irq)
56+
);
57+
58+
#endif /* _TRACE_TEGRADMA_H */
59+
60+
/* This part must be outside protection */
61+
#include <trace/define_trace.h>

0 commit comments

Comments
 (0)