Skip to content

Commit c3d275e

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: ipc4: Switch to use the sof_debug:bit11 to dump message payload
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>
1 parent d01c763 commit c3d275e

1 file changed

Lines changed: 21 additions & 23 deletions

File tree

sound/soc/sof/ipc4.c

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@
1717
#include "ipc4-priv.h"
1818
#include "ops.h"
1919

20-
#ifdef DEBUG_VERBOSE
21-
#define sof_ipc4_dump_payload(sdev, ipc_data, size) \
22-
print_hex_dump_debug("Message payload: ", \
23-
DUMP_PREFIX_OFFSET, \
24-
16, 4, ipc_data, size, false)
25-
#else
26-
#define sof_ipc4_dump_payload(sdev, ipc_data, size) do { } while (0)
27-
#endif
28-
2920
static const struct sof_ipc4_fw_status {
3021
int status;
3122
char *msg;
@@ -256,6 +247,13 @@ static void sof_ipc4_log_header(struct device *dev, u8 *text, struct sof_ipc4_ms
256247
}
257248
#endif
258249

250+
static void sof_ipc4_dump_payload(struct snd_sof_dev *sdev,
251+
void *ipc_data, size_t size)
252+
{
253+
print_hex_dump_debug("Message payload: ", DUMP_PREFIX_OFFSET,
254+
16, 4, ipc_data, size, false);
255+
}
256+
259257
static int sof_ipc4_get_reply(struct snd_sof_dev *sdev)
260258
{
261259
struct snd_sof_ipc_msg *msg = sdev->msg;
@@ -362,9 +360,6 @@ static int sof_ipc4_tx_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_
362360
void *reply_data, size_t reply_bytes, bool no_pm)
363361
{
364362
struct snd_sof_ipc *ipc = sdev->ipc;
365-
#ifdef DEBUG_VERBOSE
366-
struct sof_ipc4_msg *msg = NULL;
367-
#endif
368363
int ret;
369364

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

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

389-
mutex_unlock(&ipc->tx_mutex);
384+
if (sof_debug_check_flag(SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD)) {
385+
struct sof_ipc4_msg *msg = NULL;
390386

391-
#ifdef DEBUG_VERBOSE
392-
/* payload is indicated by non zero msg/reply_bytes */
393-
if (msg_bytes)
394-
msg = msg_data;
395-
else if (reply_bytes)
396-
msg = reply_data;
387+
/* payload is indicated by non zero msg/reply_bytes */
388+
if (msg_bytes)
389+
msg = msg_data;
390+
else if (reply_bytes)
391+
msg = reply_data;
397392

398-
if (msg)
399-
sof_ipc4_dump_payload(sdev, msg->data_ptr, msg->data_size);
400-
#endif
393+
if (msg)
394+
sof_ipc4_dump_payload(sdev, msg->data_ptr, msg->data_size);
395+
}
396+
397+
mutex_unlock(&ipc->tx_mutex);
401398

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

519-
sof_ipc4_dump_payload(sdev, ipc4_msg->data_ptr, ipc4_msg->data_size);
516+
if (sof_debug_check_flag(SOF_DBG_DUMP_IPC_MESSAGE_PAYLOAD))
517+
sof_ipc4_dump_payload(sdev, ipc4_msg->data_ptr, ipc4_msg->data_size);
520518

521519
out:
522520
mutex_unlock(&sdev->ipc->tx_mutex);

0 commit comments

Comments
 (0)