forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 147
ASoC: SOF: ipc4: Add decoder for RESOURCE_EVENT notifications from fi… #5842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ujfalusi
wants to merge
1
commit into
thesofproject:topic/sof-dev
Choose a base branch
from
ujfalusi:peter/sof/pr/ipc4-resource_event_decode
base: topic/sof-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+136
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -290,6 +290,89 @@ static void sof_ipc4_dump_payload(struct snd_sof_dev *sdev, | |
| 16, 4, ipc_data, size, false); | ||
| } | ||
|
|
||
| static const char *sof_ipc4_resource_type_str(u32 type) | ||
| { | ||
| switch (type) { | ||
| case SOF_IPC4_MODULE_INSTANCE: | ||
| return "resource: MODULE_INSTANCE"; | ||
| case SOF_IPC4_PIPELINE: | ||
| return "resource: PIPELINE"; | ||
| case SOF_IPC4_GATEWAY: | ||
| return "resource: GATEWAY"; | ||
| case SOF_IPC4_EDF_TASK: | ||
| return "resource: EDF_TASK"; | ||
| case SOF_IPC4_INVALID_RESOURCE_TYPE: | ||
| return "Resource is invalid"; | ||
| default: | ||
| return "Unknown resource type"; | ||
| } | ||
| } | ||
|
|
||
| static const char *sof_ipc4_resource_event_type_str(u32 event_type) | ||
| { | ||
| switch (event_type) { | ||
| case SOF_IPC4_MIXER_UNDERRUN_DETECTED: | ||
| return "event: MIXER_UNDERRUN_DETECTED"; | ||
| case SOF_IPC4_PROCESS_DATA_ERROR: | ||
| return "event: PROCESS_DATA_ERROR"; | ||
| case SOF_IPC4_GATEWAY_UNDERRUN_DETECTED: | ||
| return "event: GATEWAY_UNDERRUN_DETECTED"; | ||
| case SOF_IPC4_GATEWAY_OVERRUN_DETECTED: | ||
| return "event: GATEWAY_OVERRUN_DETECTED"; | ||
| default: | ||
| return "Unknown event type"; | ||
| } | ||
| } | ||
|
|
||
| static void sof_ipc4_resource_event_handler(struct snd_sof_dev *sdev, | ||
| struct sof_ipc4_msg *ipc4_msg) | ||
| { | ||
| struct sof_ipc4_notify_resource_data *data = ipc4_msg->data_ptr; | ||
|
|
||
| /* Print event details */ | ||
| switch (data->event_type) { | ||
| case SOF_IPC4_MIXER_UNDERRUN_DETECTED: | ||
| dev_dbg(sdev->dev, "%s (%u): eos %u, mixed %u, expected %u\n", | ||
| sof_ipc4_resource_event_type_str(data->event_type), | ||
| data->event_type, data->data.mixer_underrun.eos_flag, | ||
| data->data.mixer_underrun.data_mixed, | ||
| data->data.mixer_underrun.expected_data_mixed); | ||
| break; | ||
| case SOF_IPC4_PROCESS_DATA_ERROR: | ||
| dev_dbg(sdev->dev, "%s (%u): error_code %#x\n", | ||
| sof_ipc4_resource_event_type_str(data->event_type), | ||
| data->event_type, data->data.process_data_error.error_code); | ||
| break; | ||
| case SOF_IPC4_GATEWAY_UNDERRUN_DETECTED: | ||
| case SOF_IPC4_GATEWAY_OVERRUN_DETECTED: | ||
| dev_dbg(sdev->dev, "%s (%u)\n", | ||
| sof_ipc4_resource_event_type_str(data->event_type), | ||
| data->event_type); | ||
| break; | ||
| default: | ||
| dev_dbg(sdev->dev, "%s (%u): raw dws %#x %#x %#x %#x %#x %#x\n", | ||
| sof_ipc4_resource_event_type_str(data->event_type), | ||
| data->event_type, | ||
| data->data.dws[0], data->data.dws[1], data->data.dws[2], | ||
| data->data.dws[3], data->data.dws[4], data->data.dws[5]); | ||
| break; | ||
| } | ||
|
|
||
| /* Print resource details */ | ||
| if (data->resource_type == SOF_IPC4_MODULE_INSTANCE) { | ||
| u32 module_id = SOF_IPC4_MOD_ID_GET(data->resource_id); | ||
| u32 instance_id = SOF_IPC4_MOD_INSTANCE_GET(data->resource_id); | ||
|
|
||
| dev_dbg(sdev->dev, "%s (%u), module_id %u, instance_id %u\n", | ||
| sof_ipc4_resource_type_str(data->resource_type), | ||
| data->resource_type, module_id, instance_id); | ||
| } else if (data->resource_type != SOF_IPC4_INVALID_RESOURCE_TYPE) { | ||
| dev_dbg(sdev->dev, "%s (%u), id %u\n", | ||
| sof_ipc4_resource_type_str(data->resource_type), | ||
| data->resource_type, data->resource_id); | ||
| } | ||
|
Comment on lines
+369
to
+373
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't agree, this is on purpose, if needed one can enable the payload dump for full information. |
||
| } | ||
|
|
||
| static int sof_ipc4_get_reply(struct snd_sof_dev *sdev) | ||
| { | ||
| struct snd_sof_ipc_msg *msg = sdev->msg; | ||
|
|
@@ -740,6 +823,7 @@ static void sof_ipc4_rx_msg(struct snd_sof_dev *sdev) | |
| break; | ||
| case SOF_IPC4_NOTIFY_RESOURCE_EVENT: | ||
| data_size = sizeof(struct sof_ipc4_notify_resource_data); | ||
| handler_func = sof_ipc4_resource_event_handler; | ||
| break; | ||
| case SOF_IPC4_NOTIFY_LOG_BUFFER_STATUS: | ||
| sof_ipc4_mtrace_update_pos(sdev, SOF_IPC4_LOG_CORE_GET(ipc4_msg->primary)); | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, enums are enums.