Commit 8ba1edb9 authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

ASoC: Intel: catpt: Event tracing

Define tracing macros for easy catpt debug. These cover all IPC message
types: requests, replies and notifications.
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-9-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7a10b66a
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include "core.h" #include "core.h"
#include "registers.h" #include "registers.h"
#define CREATE_TRACE_POINTS
#include "trace.h"
static int __maybe_unused catpt_suspend(struct device *dev) static int __maybe_unused catpt_suspend(struct device *dev)
{ {
struct catpt_dev *cdev = dev_get_drvdata(dev); struct catpt_dev *cdev = dev_get_drvdata(dev);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "core.h" #include "core.h"
#include "messages.h" #include "messages.h"
#include "registers.h" #include "registers.h"
#include "trace.h"
#define CATPT_IPC_TIMEOUT_MS 300 #define CATPT_IPC_TIMEOUT_MS 300
...@@ -56,6 +57,9 @@ static void catpt_dsp_send_tx(struct catpt_dev *cdev, ...@@ -56,6 +57,9 @@ static void catpt_dsp_send_tx(struct catpt_dev *cdev,
{ {
u32 header = tx->header | CATPT_IPCC_BUSY; u32 header = tx->header | CATPT_IPCC_BUSY;
trace_catpt_ipc_request(header);
trace_catpt_ipc_payload(tx->data, tx->size);
memcpy_toio(catpt_outbox_addr(cdev), tx->data, tx->size); memcpy_toio(catpt_outbox_addr(cdev), tx->data, tx->size);
catpt_writel_shim(cdev, IPCC, header); catpt_writel_shim(cdev, IPCC, header);
} }
...@@ -155,12 +159,14 @@ catpt_dsp_notify_stream(struct catpt_dev *cdev, union catpt_notify_msg msg) ...@@ -155,12 +159,14 @@ catpt_dsp_notify_stream(struct catpt_dev *cdev, union catpt_notify_msg msg)
switch (msg.notify_reason) { switch (msg.notify_reason) {
case CATPT_NOTIFY_POSITION_CHANGED: case CATPT_NOTIFY_POSITION_CHANGED:
memcpy_fromio(&pos, catpt_inbox_addr(cdev), sizeof(pos)); memcpy_fromio(&pos, catpt_inbox_addr(cdev), sizeof(pos));
trace_catpt_ipc_payload((u8 *)&pos, sizeof(pos));
catpt_stream_update_position(cdev, stream, &pos); catpt_stream_update_position(cdev, stream, &pos);
break; break;
case CATPT_NOTIFY_GLITCH_OCCURRED: case CATPT_NOTIFY_GLITCH_OCCURRED:
memcpy_fromio(&glitch, catpt_inbox_addr(cdev), sizeof(glitch)); memcpy_fromio(&glitch, catpt_inbox_addr(cdev), sizeof(glitch));
trace_catpt_ipc_payload((u8 *)&glitch, sizeof(glitch));
dev_warn(cdev->dev, "glitch %d at pos: 0x%08llx, wp: 0x%08x\n", dev_warn(cdev->dev, "glitch %d at pos: 0x%08llx, wp: 0x%08x\n",
glitch.type, glitch.presentation_pos, glitch.type, glitch.presentation_pos,
...@@ -183,6 +189,7 @@ static void catpt_dsp_copy_rx(struct catpt_dev *cdev, u32 header) ...@@ -183,6 +189,7 @@ static void catpt_dsp_copy_rx(struct catpt_dev *cdev, u32 header)
return; return;
memcpy_fromio(ipc->rx.data, catpt_outbox_addr(cdev), ipc->rx.size); memcpy_fromio(ipc->rx.data, catpt_outbox_addr(cdev), ipc->rx.size);
trace_catpt_ipc_payload(ipc->rx.data, ipc->rx.size);
} }
static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header) static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header)
...@@ -196,6 +203,7 @@ static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header) ...@@ -196,6 +203,7 @@ static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header)
u32 off = msg.mailbox_address << 3; u32 off = msg.mailbox_address << 3;
memcpy_fromio(&config, cdev->lpe_ba + off, sizeof(config)); memcpy_fromio(&config, cdev->lpe_ba + off, sizeof(config));
trace_catpt_ipc_payload((u8 *)&config, sizeof(config));
catpt_ipc_arm(ipc, &config); catpt_ipc_arm(ipc, &config);
complete(&cdev->fw_ready); complete(&cdev->fw_ready);
...@@ -236,6 +244,7 @@ irqreturn_t catpt_dsp_irq_thread(int irq, void *dev_id) ...@@ -236,6 +244,7 @@ irqreturn_t catpt_dsp_irq_thread(int irq, void *dev_id)
u32 ipcd; u32 ipcd;
ipcd = catpt_readl_shim(cdev, IPCD); ipcd = catpt_readl_shim(cdev, IPCD);
trace_catpt_ipc_notify(ipcd);
/* ensure there is delayed reply or notification to process */ /* ensure there is delayed reply or notification to process */
if (!(ipcd & CATPT_IPCD_BUSY)) if (!(ipcd & CATPT_IPCD_BUSY))
...@@ -259,6 +268,7 @@ irqreturn_t catpt_dsp_irq_handler(int irq, void *dev_id) ...@@ -259,6 +268,7 @@ irqreturn_t catpt_dsp_irq_handler(int irq, void *dev_id)
u32 isc, ipcc; u32 isc, ipcc;
isc = catpt_readl_shim(cdev, ISC); isc = catpt_readl_shim(cdev, ISC);
trace_catpt_irq(isc);
/* immediate reply */ /* immediate reply */
if (isc & CATPT_ISC_IPCCD) { if (isc & CATPT_ISC_IPCCD) {
...@@ -266,6 +276,7 @@ irqreturn_t catpt_dsp_irq_handler(int irq, void *dev_id) ...@@ -266,6 +276,7 @@ irqreturn_t catpt_dsp_irq_handler(int irq, void *dev_id)
catpt_updatel_shim(cdev, IMC, CATPT_IMC_IPCCD, CATPT_IMC_IPCCD); catpt_updatel_shim(cdev, IMC, CATPT_IMC_IPCCD, CATPT_IMC_IPCCD);
ipcc = catpt_readl_shim(cdev, IPCC); ipcc = catpt_readl_shim(cdev, IPCC);
trace_catpt_ipc_reply(ipcc);
catpt_dsp_copy_rx(cdev, ipcc); catpt_dsp_copy_rx(cdev, ipcc);
complete(&cdev->ipc.done_completion); complete(&cdev->ipc.done_completion);
......
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright(c) 2020 Intel Corporation. All rights reserved.
*
* Author: Cezary Rojewski <cezary.rojewski@intel.com>
*/
#undef TRACE_SYSTEM
#define TRACE_SYSTEM intel_catpt
#if !defined(__SND_SOC_INTEL_CATPT_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
#define __SND_SOC_INTEL_CATPT_TRACE_H
#include <linux/types.h>
#include <linux/tracepoint.h>
DECLARE_EVENT_CLASS(catpt_ipc_msg,
TP_PROTO(u32 header),
TP_ARGS(header),
TP_STRUCT__entry(
__field(u32, header)
),
TP_fast_assign(
__entry->header = header;
),
TP_printk("0x%08x", __entry->header)
);
DEFINE_EVENT(catpt_ipc_msg, catpt_irq,
TP_PROTO(u32 header),
TP_ARGS(header)
);
DEFINE_EVENT(catpt_ipc_msg, catpt_ipc_request,
TP_PROTO(u32 header),
TP_ARGS(header)
);
DEFINE_EVENT(catpt_ipc_msg, catpt_ipc_reply,
TP_PROTO(u32 header),
TP_ARGS(header)
);
DEFINE_EVENT(catpt_ipc_msg, catpt_ipc_notify,
TP_PROTO(u32 header),
TP_ARGS(header)
);
TRACE_EVENT_CONDITION(catpt_ipc_payload,
TP_PROTO(const u8 *data, size_t size),
TP_ARGS(data, size),
TP_CONDITION(data && size),
TP_STRUCT__entry(
__dynamic_array(u8, buf, size)
),
TP_fast_assign(
memcpy(__get_dynamic_array(buf), data, size);
),
TP_printk("%u byte(s)%s",
__get_dynamic_array_len(buf),
__print_hex_dump("", DUMP_PREFIX_NONE, 16, 4,
__get_dynamic_array(buf),
__get_dynamic_array_len(buf), false))
);
#endif /* __SND_SOC_INTEL_CATPT_TRACE_H */
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#define TRACE_INCLUDE_FILE trace
#include <trace/define_trace.h>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment