From e06eeb1d57be0a2b855c00ef8b00cb07392aac32 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Sat, 6 Jul 2024 16:44:54 +0800 Subject: [PATCH] ASoC: rockchip: Add debug for TRCM Used for measure the time cost between dma guard and stream. Change-Id: I626f6b892faa31fbf06e7b1100fdf0b0fa3347f7 Signed-off-by: Sugar Zhang --- sound/soc/rockchip/rockchip_trcm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/rockchip/rockchip_trcm.c b/sound/soc/rockchip/rockchip_trcm.c index 73f60f6f1016..a8df0022cf57 100644 --- a/sound/soc/rockchip/rockchip_trcm.c +++ b/sound/soc/rockchip/rockchip_trcm.c @@ -303,6 +303,11 @@ static int dmaengine_trcm_trigger(struct snd_soc_component *component, struct snd_pcm_runtime *runtime = substream->runtime; int ret; +#ifdef TRCM_DEBUG + ktime_t start_time, stop_time, diff_time; + + start_time = ktime_get(); +#endif switch (cmd) { case SNDRV_PCM_TRIGGER_START: dmaengine_terminate_async(prtd->dma_chan); @@ -332,6 +337,13 @@ static int dmaengine_trcm_trigger(struct snd_soc_component *component, return -EINVAL; } +#ifdef TRCM_DEBUG + stop_time = ktime_get(); + diff_time = ktime_sub(stop_time, start_time); + dev_dbg(component->dev, "cmd: %d time cost %lld\n", + cmd, ktime_to_us(diff_time)); +#endif + return 0; }