Skip to content

Commit de9d279

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 4bef5ea commit de9d279

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-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: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
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+
26+
#ifdef CONFIG_IPC_MAJOR_4
27+
#include <ipc4/notification.h>
28+
#endif
2429

2530
#include <errno.h>
2631
#include <stdbool.h>
@@ -88,6 +93,20 @@ pipeline_should_report_enodata_on_trigger(struct comp_dev *rsrc,
8893
return false;
8994
}
9095

96+
void pipeline_comp_copy_error_notify(const struct comp_dev *component, int err)
97+
{
98+
#ifdef CONFIG_IPC_MAJOR_4
99+
struct ipc_msg *notify;
100+
101+
notify = ipc_notification_pool_get(IPC4_RESOURCE_EVENT_SIZE);
102+
if (!notify)
103+
return;
104+
105+
process_data_error_notif_msg_init(notify, component->ipc_config.id, err);
106+
ipc_msg_send(notify, notify->tx_data, false);
107+
#endif
108+
}
109+
91110
static int pipeline_comp_copy(struct comp_dev *current,
92111
struct comp_buffer *calling_buf,
93112
struct pipeline_walk_context *ctx, int dir)
@@ -113,16 +132,23 @@ static int pipeline_comp_copy(struct comp_dev *current,
113132
/* copy to downstream immediately */
114133
if (dir == PPL_DIR_DOWNSTREAM) {
115134
err = comp_copy(current);
116-
if (err < 0 || err == PPL_STATUS_PATH_STOP)
135+
if (err < 0) {
136+
pipeline_comp_copy_error_notify(current, err);
137+
return err;
138+
}
139+
if (err == PPL_STATUS_PATH_STOP)
117140
return err;
118141
}
119142

120143
err = pipeline_for_each_comp(current, ctx, dir);
121144
if (err < 0 || err == PPL_STATUS_PATH_STOP)
122145
return err;
123146

124-
if (dir == PPL_DIR_UPSTREAM)
147+
if (dir == PPL_DIR_UPSTREAM) {
125148
err = comp_copy(current);
149+
if (err < 0)
150+
pipeline_comp_copy_error_notify(current, err);
151+
}
126152

127153
return err;
128154
}

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 error_code);
440+
434441
#endif /* __SOF_AUDIO_PIPELINE_H__ */

0 commit comments

Comments
 (0)