Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions src/include/sof/lib/notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,43 @@ struct notify_data {

struct notify **arch_notify_get(void);

int notifier_register(void *receiver, void *caller, enum notify_id type,
void (*cb)(void *arg, enum notify_id type, void *data),
/** Register a callback to be run when event 'type' happens.
*
* The identifier for un-registration is the tuple (receiver_data,
* caller_id_filter, event_type), the callback argument is not part of
* it.
*
* caller_data argument from notifier_event()
*
* @param receiver_data private data passed to the callback.
* @param caller_id_filter optional, can be used to be notified only by
* some specific notifier_event() calls when not NULL.
* @param event_type list of callbacks to be added to
* @param callback callback function
* @param flags see NOTIFIER_FLAG_* above
*/
int notifier_register(void *receiver_data, void *caller_id_filter, enum notify_id event_type,
void (*callback)(void *receiver_data, enum notify_id event_type,
void *caller_data),
uint32_t flags);
void notifier_unregister(void *receiver, void *caller, enum notify_id type);
void notifier_unregister_all(void *receiver, void *caller);

/** Unregister all callbacks matching that arguments tuple. NULL acts
* as a wildcard.
*/
void notifier_unregister(void *receiver_data_filter, void *caller_id_filter, enum notify_id type);

/** Unregister callbacks matching the arguments for every notify_id.
* A NULL parameter acts as a wildcard.
*/
void notifier_unregister_all(void *receiver_data_filter, void *caller_id_filter);

void notifier_notify_remote(void);
void notifier_event(const void *caller, enum notify_id type, uint32_t core_mask,
void *data, uint32_t data_size);

/* data_size is required to manage cache coherency for notifications
* across cores.
*/
void notifier_event(const void *caller_id, enum notify_id event_type, uint32_t core_mask,
void *caller_data, uint32_t data_size);

void init_system_notify(struct sof *sof);

Expand Down
13 changes: 13 additions & 0 deletions zephyr/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,15 @@ unsigned int _xtos_ints_off(unsigned int mask)
return 0;
}

void ipc_send_queued_msg(void);

static void ipc_send_queued_callback(void *private_data, enum notify_id event_type,
void *caller_data)
{
if (!ipc_get()->pm_prepare_D3)
ipc_send_queued_msg();
}

/*
* Audio components.
*
Expand Down Expand Up @@ -528,6 +537,10 @@ int task_main_start(struct sof *sof)
/* init pipeline position offsets */
pipeline_posn_init(sof);

(void)notifier_register(NULL, scheduler_get_data(SOF_SCHEDULE_LL_TIMER),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a comment here stating the long term solution so everyone knows this will be temporary. This can be another PR, feel free to create a feature for this too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitted in PR #4441

NOTIFIER_ID_LL_POST_RUN,
ipc_send_queued_callback, 0);

/* let host know DSP boot is complete */
ret = platform_boot_complete(0);

Expand Down