Skip to contentSkip to conversation

dma: tegra: add tracepoint for residual update

PATCH New Ben Dooks 1 participant 1 message Oct 12, 2018

Subsystems (4)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 6/6 dma: tegra: add tracepoint for residual update

Add a tracepoint in the residual update instead of using dev_dbg() to allow debugging via the trace pipe.

---
Cc: Ingo Molnar <[email protected]> (maintainer:TRACING)
Cc: Steven Rostedt <[email protected]> (maintainer:TRACING)

---
 drivers/dma/tegra20-apb-dma.c        |  5 ++---
 include/trace/events/tegra_apb_dma.h | 27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 3 deletions(-)
drivers/dma/tegra20-apb-dma.c +2 -3
index 96095a3b7edd..495cda6c21b9 100644
@@ -886,9 +886,8 @@ static unsigned int tegra_dma_update_residual(struct tegra_dma_channel *tdc,
 	}
 
 done:	
-	dev_dbg(tdc2dev(tdc), "residual: req %08lx, ahb@%08lx, wcount %08lx, done %d\n",
-		 sg_req->ch_regs.ahb_ptr, ahbptr, wcount, done);
-
+	trace_tegra_dma_tx_state(&tdc->dma_chan, ahbptr, status, result,
+				 tmp, residual);
 	return result;
 }
 
include/trace/events/tegra_apb_dma.h +27 -0
index 80d6f0cf4c36..a686f98a9c8b 100644
@@ -43,6 +43,33 @@ TRACE_EVENT(tegra_dma_complete_cb,
 		      __entry->count, __entry->ptr)
 );
 
+TRACE_EVENT(tegra_dma_tx_state,
+	    TP_PROTO(struct dma_chan *dc, unsigned long ahb,
+		     unsigned long wc, unsigned int done,
+		     unsigned long byte_count, unsigned int residual),
+	    TP_ARGS(dc, ahb, wc, done, byte_count, residual),
+	    TP_STRUCT__entry(
+		    __field(struct dma_chan *,	dc)
+		    __field(unsigned long,	ahb)
+		    __field(unsigned long,	wc)
+		    __field(unsigned long,	done)
+		    __field(unsigned int,	residual)
+		    __field(unsigned long,	byte_count)
+		    ),
+	    TP_fast_assign(
+		    __entry->dc = dc;
+		    __entry->ahb = ahb;
+		    __entry->wc = wc;
+		    __entry->done = done;
+		    __entry->residual = residual;
+		    __entry->byte_count = byte_count;
+		    ),
+	    TP_printk("%s: txresidual: ahb %08lx wc %08lx => done %lu bc %lu residual %u",
+		      dev_name(&__entry->dc->dev->device),
+		      __entry->ahb, __entry->wc, __entry->done,
+		      __entry->byte_count, __entry->residual)
+);
+
 TRACE_EVENT(tegra_dma_isr,
 	    TP_PROTO(struct dma_chan *dc, int irq),
 	    TP_ARGS(dc, irq),