Skip to content

Commit 0e8ebb5

Browse files
committed
[DEBUG] Add debug logs for pipeline prepare failures
Add info-level logs to diagnose test failures: - aria: Log format/rate/channels before validation - ipc4: Log pipeline state during RESET transitions - pipeline: Log component state during prepare Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
1 parent 77790ce commit 0e8ebb5

File tree

4 files changed

+52
-11
lines changed

4 files changed

+52
-11
lines changed

src/audio/aria/aria.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ static int aria_prepare(struct processing_module *mod,
185185
struct comp_buffer *source, *sink;
186186
struct comp_dev *dev = mod->dev;
187187
struct aria_data *cd = module_get_private_data(mod);
188-
189-
comp_info(dev, "aria_prepare()");
188+
comp_info(dev, "entry: dev->state=%d", dev->state);
190189

191190
source = comp_dev_get_first_data_producer(dev);
192191
sink = comp_dev_get_first_data_consumer(dev);
@@ -198,9 +197,21 @@ static int aria_prepare(struct processing_module *mod,
198197
aria_set_stream_params(source, mod);
199198
aria_set_stream_params(sink, mod);
200199

200+
/* Log detailed format information before validation */
201+
comp_info(dev, "aria_prepare: source fmt=%d rate=%d channels=%d",
202+
audio_stream_get_valid_fmt(&source->stream),
203+
audio_stream_get_rate(&source->stream),
204+
audio_stream_get_channels(&source->stream));
205+
comp_info(dev, "aria_prepare: sink fmt=%d rate=%d channels=%d",
206+
audio_stream_get_valid_fmt(&sink->stream),
207+
audio_stream_get_rate(&sink->stream),
208+
audio_stream_get_channels(&sink->stream));
209+
201210
if (audio_stream_get_valid_fmt(&source->stream) != SOF_IPC_FRAME_S24_4LE ||
202211
audio_stream_get_valid_fmt(&sink->stream) != SOF_IPC_FRAME_S24_4LE) {
203-
comp_err(dev, "format is not supported");
212+
comp_err(dev, "format is not supported: source_fmt=%d (expected=%d), sink_fmt=%d (expected=%d)",
213+
audio_stream_get_valid_fmt(&source->stream), SOF_IPC_FRAME_S24_4LE,
214+
audio_stream_get_valid_fmt(&sink->stream), SOF_IPC_FRAME_S24_4LE);
204215
return -EINVAL;
205216
}
206217

@@ -209,7 +220,9 @@ static int aria_prepare(struct processing_module *mod,
209220
return 0;
210221
}
211222

223+
comp_info(dev, "calling comp_set_state: current state=%d", dev->state);
212224
ret = comp_set_state(dev, COMP_TRIGGER_PREPARE);
225+
comp_info(dev, "comp_set_state returned: ret=%d, new state=%d", ret, dev->state);
213226
if (ret < 0)
214227
return ret;
215228

src/audio/pipeline/pipeline-params.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ static int pipeline_comp_prepare(struct comp_dev *current,
262262
struct pipeline_data *ppl_data = ctx->comp_data;
263263
int err;
264264

265-
pipe_dbg(current->pipeline, "pipeline_comp_prepare(), current->comp.id = 0x%x, dir = %u",
266-
dev_comp_id(current), dir);
265+
pipe_info(current->pipeline, "pipeline_comp_prepare(), current->comp.id = 0x%x, dir = %u",
266+
dev_comp_id(current), dir);
267267

268268
if (!comp_is_single_pipeline(current, ppl_data->start)) {
269269
/* ipc4 module is only prepared in its parent pipeline */
@@ -282,9 +282,14 @@ static int pipeline_comp_prepare(struct comp_dev *current,
282282
return err;
283283
}
284284

285+
pipe_info(current->pipeline, "calling comp_prepare() for comp 0x%x (state=%d)",
286+
dev_comp_id(current), current->state);
285287
err = comp_prepare(current);
286-
if (err < 0 || err == PPL_STATUS_PATH_STOP)
288+
if (err < 0 || err == PPL_STATUS_PATH_STOP) {
289+
pipe_err(current->pipeline, "comp_prepare() failed for comp 0x%x: err=%d",
290+
dev_comp_id(current), err);
287291
return err;
292+
}
288293

289294
return pipeline_for_each_comp(current, ctx, dir);
290295
}

src/ipc/ipc4/handler.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,16 @@ static int ipc4_pcm_params(struct ipc_comp_dev *pcm_dev)
160160
}
161161

162162
/* prepare pipeline audio params */
163+
tr_info(&ipc_tr, "ipc: attempting to prepare pipe %d comp %d (state=%d)",
164+
pcm_dev->cd->pipeline->pipeline_id,
165+
pcm_dev->cd->pipeline->comp_id,
166+
pcm_dev->cd->pipeline->status);
163167
err = pipeline_prepare(pcm_dev->cd->pipeline, pcm_dev->cd);
164168
if (err < 0) {
165-
ipc_cmd_err(&ipc_tr, "ipc: pipe %d comp %d prepare failed %d",
169+
ipc_cmd_err(&ipc_tr, "ipc: pipe %d comp %d prepare failed %d (state=%d)",
166170
pcm_dev->cd->pipeline->pipeline_id,
167-
pcm_dev->cd->pipeline->comp_id, err);
171+
pcm_dev->cd->pipeline->comp_id, err,
172+
pcm_dev->cd->pipeline->status);
168173
goto error;
169174
}
170175

@@ -309,20 +314,29 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd)
309314
}
310315
break;
311316
case SOF_IPC4_PIPELINE_STATE_RESET:
317+
tr_info(&ipc_tr, "pipeline %d: attempting RESET from state %d", ppl_icd->id, status);
312318
switch (status) {
313319
case COMP_STATE_INIT:
314-
tr_dbg(&ipc_tr, "pipeline %d: reset from init", ppl_icd->id);
320+
tr_info(&ipc_tr, "pipeline %d: reset from init", ppl_icd->id);
315321
ret = ipc4_pipeline_complete(ipc, ppl_icd->id, cmd);
316322
break;
317323
case COMP_STATE_READY:
324+
tr_info(&ipc_tr, "pipeline %d: reset from ready (no action)", ppl_icd->id);
325+
/* No action needed */
326+
break;
318327
case COMP_STATE_ACTIVE:
328+
tr_info(&ipc_tr, "pipeline %d: reset from active (no action)", ppl_icd->id);
329+
/* No action needed */
330+
break;
319331
case COMP_STATE_PAUSED:
332+
tr_info(&ipc_tr, "pipeline %d: reset from paused (no action)", ppl_icd->id);
320333
/* No action needed */
321334
break;
322335
default:
323336
ipc_cmd_err(&ipc_tr,
324-
"pipeline %d: Invalid state for RESET: %d",
325-
ppl_icd->id, status);
337+
"pipeline %d: Invalid state for RESET: %d (valid: %d,%d,%d,%d)",
338+
ppl_icd->id, status, COMP_STATE_INIT, COMP_STATE_READY,
339+
COMP_STATE_ACTIVE, COMP_STATE_PAUSED);
326340
return IPC4_INVALID_REQUEST;
327341
}
328342

src/ipc/ipc4/logging.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ int ipc4_logging_enable_logs(bool first_block,
121121
const struct log_backend *log_backend = log_backend_adsp_mtrace_get();
122122
const struct ipc4_log_state_info *log_state;
123123

124+
LOG_INF("ipc4_logging_enable_logs: entry first=%d last=%d size=%u", first_block, last_block, data_offset_or_size);
125+
124126
if (!(first_block && last_block)) {
125127
LOG_ERR("log_state data is expected to be sent as one chunk");
126128
return -EINVAL;
@@ -139,7 +141,10 @@ int ipc4_logging_enable_logs(bool first_block,
139141
*/
140142
log_state = (const struct ipc4_log_state_info *)data;
141143

144+
LOG_INF("ipc4_logging_enable_logs: enable=%d aging_timer=%u", log_state->enable, log_state->aging_timer_period);
145+
142146
if (log_state->enable) {
147+
LOG_INF("ipc4_logging_enable_logs: enabling logs");
143148
adsp_mtrace_log_init(mtrace_log_hook);
144149

145150
k_mutex_init(&log_mutex);
@@ -156,12 +161,16 @@ int ipc4_logging_enable_logs(bool first_block,
156161

157162
/* Logs enabled, this is the best place to run boot-tests */
158163
TEST_RUN_ONCE(sof_run_boot_tests);
164+
LOG_INF("ipc4_logging_enable_logs: logs enabled successfully");
159165
} else {
166+
LOG_INF("ipc4_logging_enable_logs: disabling logs");
160167
k_work_flush_delayable(&log_work, &ipc4_log_work_sync);
161168
adsp_mtrace_log_init(NULL);
162169
log_backend_disable(log_backend);
170+
LOG_INF("ipc4_logging_enable_logs: logs disabled successfully");
163171
}
164172

173+
LOG_INF("ipc4_logging_enable_logs: exit success");
165174
return 0;
166175
}
167176

0 commit comments

Comments
 (0)