Skip to content

Commit

Permalink
ASoC: SOF: ipc4: Switch to use the sof_debug:bit11 to dump message pa…
Browse files Browse the repository at this point in the history
…yload

Use the SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD flag to print the message payload
instead of the DEBUG_VERBOSE, which would need code modification and kernel
re-compilation.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230616100039.378150-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Jun 16, 2023
1 parent d01c763 commit c3d275e
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions sound/soc/sof/ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
#include "ipc4-priv.h"
#include "ops.h"

#ifdef DEBUG_VERBOSE
#define sof_ipc4_dump_payload(sdev, ipc_data, size) \
print_hex_dump_debug("Message payload: ", \
DUMP_PREFIX_OFFSET, \
16, 4, ipc_data, size, false)
#else
#define sof_ipc4_dump_payload(sdev, ipc_data, size) do { } while (0)
#endif

static const struct sof_ipc4_fw_status {
int status;
char *msg;
Expand Down Expand Up @@ -256,6 +247,13 @@ static void sof_ipc4_log_header(struct device *dev, u8 *text, struct sof_ipc4_ms
}
#endif

static void sof_ipc4_dump_payload(struct snd_sof_dev *sdev,
void *ipc_data, size_t size)
{
print_hex_dump_debug("Message payload: ", DUMP_PREFIX_OFFSET,
16, 4, ipc_data, size, false);
}

static int sof_ipc4_get_reply(struct snd_sof_dev *sdev)
{
struct snd_sof_ipc_msg *msg = sdev->msg;
Expand Down Expand Up @@ -362,9 +360,6 @@ static int sof_ipc4_tx_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_
void *reply_data, size_t reply_bytes, bool no_pm)
{
struct snd_sof_ipc *ipc = sdev->ipc;
#ifdef DEBUG_VERBOSE
struct sof_ipc4_msg *msg = NULL;
#endif
int ret;

if (!msg_data)
Expand All @@ -386,18 +381,20 @@ static int sof_ipc4_tx_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_

ret = ipc4_tx_msg_unlocked(ipc, msg_data, msg_bytes, reply_data, reply_bytes);

mutex_unlock(&ipc->tx_mutex);
if (sof_debug_check_flag(SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD)) {
struct sof_ipc4_msg *msg = NULL;

#ifdef DEBUG_VERBOSE
/* payload is indicated by non zero msg/reply_bytes */
if (msg_bytes)
msg = msg_data;
else if (reply_bytes)
msg = reply_data;
/* payload is indicated by non zero msg/reply_bytes */
if (msg_bytes)
msg = msg_data;
else if (reply_bytes)
msg = reply_data;

if (msg)
sof_ipc4_dump_payload(sdev, msg->data_ptr, msg->data_size);
#endif
if (msg)
sof_ipc4_dump_payload(sdev, msg->data_ptr, msg->data_size);
}

mutex_unlock(&ipc->tx_mutex);

return ret;
}
Expand Down Expand Up @@ -516,7 +513,8 @@ static int sof_ipc4_set_get_data(struct snd_sof_dev *sdev, void *data,
if (!set && payload_bytes != offset)
ipc4_msg->data_size = offset;

sof_ipc4_dump_payload(sdev, ipc4_msg->data_ptr, ipc4_msg->data_size);
if (sof_debug_check_flag(SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD))
sof_ipc4_dump_payload(sdev, ipc4_msg->data_ptr, ipc4_msg->data_size);

out:
mutex_unlock(&sdev->ipc->tx_mutex);
Expand Down

0 comments on commit c3d275e

Please sign in to comment.