Skip to content

Commit 73d3988

Browse files
committed
pipeline: Add data process error notification
Add functionality to send notifications when a data processing function in a module reports an error. Add notifications for both ll and dp modules. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 9a3e658 commit 73d3988

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

src/audio/pipeline/pipeline-schedule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,10 @@ static enum task_state dp_task_run(void *data)
372372
{
373373
struct processing_module *mod = data;
374374

375-
module_process_sink_src(mod, mod->sources, mod->num_of_sources,
376-
mod->sinks, mod->num_of_sinks);
375+
int ret = module_process_sink_src(mod, mod->sources, mod->num_of_sources,
376+
mod->sinks, mod->num_of_sinks);
377+
if (ret)
378+
pipeline_comp_copy_error_notify(mod->dev, ret);
377379

378380
return SOF_TASK_STATE_RESCHEDULE;
379381
}

src/audio/pipeline/pipeline-stream.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <rtos/kernel.h>
2222
#include <sof/audio/module_adapter/module/generic.h>
2323
#include <sof/lib/cpu-clk-manager.h>
24+
#include <sof/ipc/notification_pool.h>
25+
#include <ipc4/notification.h>
2426

2527
#include <errno.h>
2628
#include <stdbool.h>
@@ -88,6 +90,15 @@ pipeline_should_report_enodata_on_trigger(struct comp_dev *rsrc,
8890
return false;
8991
}
9092

93+
void pipeline_comp_copy_error_notify(const struct comp_dev *component, int err)
94+
{
95+
struct ipc_msg *notify = ipc_notification_pool_get(IPC4_RESOURCE_EVENT_SIZE);
96+
if (!notify)
97+
return;
98+
process_data_error_notif_msg_init(notify, component->ipc_config.id, err);
99+
ipc_msg_send(notify, notify->tx_data, false);
100+
}
101+
91102
static int pipeline_comp_copy(struct comp_dev *current,
92103
struct comp_buffer *calling_buf,
93104
struct pipeline_walk_context *ctx, int dir)
@@ -113,16 +124,23 @@ static int pipeline_comp_copy(struct comp_dev *current,
113124
/* copy to downstream immediately */
114125
if (dir == PPL_DIR_DOWNSTREAM) {
115126
err = comp_copy(current);
116-
if (err < 0 || err == PPL_STATUS_PATH_STOP)
127+
if (err < 0) {
128+
pipeline_comp_copy_error_notify(current, err);
129+
return err;
130+
}
131+
if (err == PPL_STATUS_PATH_STOP)
117132
return err;
118133
}
119134

120135
err = pipeline_for_each_comp(current, ctx, dir);
121136
if (err < 0 || err == PPL_STATUS_PATH_STOP)
122137
return err;
123138

124-
if (dir == PPL_DIR_UPSTREAM)
139+
if (dir == PPL_DIR_UPSTREAM) {
125140
err = comp_copy(current);
141+
if (err < 0)
142+
pipeline_comp_copy_error_notify(current, err);
143+
}
126144

127145
return err;
128146
}

src/include/sof/audio/pipeline.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,11 @@ void pipeline_xrun(struct pipeline *p, struct comp_dev *dev, int32_t bytes);
431431
*/
432432
int pipeline_xrun_set_limit(struct pipeline *p, uint32_t xrun_limit_usecs);
433433

434+
/**
435+
* \brief Sends an ipc notification that an error occurred in the module's processing function.
436+
* \param[in] component The component in which the error occurred.
437+
* \param[in] error_code Error code.
438+
*/
439+
void pipeline_comp_copy_error_notify(const struct comp_dev *component, int err);
440+
434441
#endif /* __SOF_AUDIO_PIPELINE_H__ */

0 commit comments

Comments
 (0)