Repository navigation
copier code refine and module parameter simplify #7958
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2118292
copier: refine host creation
btian1 16b879d
copier: rename parent_dev to dev
btian1 24476a4
copier-host: remove duplicated frame format assignment
btian1 f8a127d
copier: refine dai init code
btian1 fcaa478
copier-dai: remove duplicated frame format assignment
btian1 0314da7
aria: simplify aria parameter update
btian1 1519a74
google-rtc: simplify google-rtc parameters
btian1 765e38f
mux: simplify set mux parameters
btian1 8548bc3
selector: simplify selector parameters
btian1 830a9b3
smart_amp: simplify smart amp parameters
btian1 dfee093
copier:simplify ipcgtw create parameters
btian1 f9e6328
copier: remove redundant parameters when create endpoint buffer
btian1 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
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 |
|---|---|---|
|
|
@@ -31,18 +31,18 @@ static uint32_t bitmask_to_nibble_channel_map(uint8_t bitmask) | |
| return nibble_map; | ||
| } | ||
|
|
||
| static int copier_set_alh_multi_gtw_channel_map(struct comp_dev *parent_dev, | ||
|
Collaborator
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. a part of this is in the previous commit. Can you please reorganize to move all of the same change to the same patch?
Contributor
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. done |
||
| static int copier_set_alh_multi_gtw_channel_map(struct comp_dev *dev, | ||
| const struct ipc4_copier_module_cfg *copier_cfg, | ||
| int index) | ||
| { | ||
| struct processing_module *mod = comp_get_drvdata(parent_dev); | ||
| struct processing_module *mod = comp_get_drvdata(dev); | ||
| struct copier_data *cd = module_get_private_data(mod); | ||
| const struct sof_alh_configuration_blob *alh_blob; | ||
| uint8_t chan_bitmask; | ||
| int channels; | ||
|
|
||
| if (!copier_cfg->gtw_cfg.config_length) { | ||
| comp_err(parent_dev, "No ipc4_alh_multi_gtw_cfg found in blob!"); | ||
| comp_err(dev, "No ipc4_alh_multi_gtw_cfg found in blob!"); | ||
| return -EINVAL; | ||
| } | ||
|
|
||
|
|
@@ -54,7 +54,7 @@ static int copier_set_alh_multi_gtw_channel_map(struct comp_dev *parent_dev, | |
|
|
||
| channels = popcount(chan_bitmask); | ||
| if (channels < 1 || channels > SOF_IPC_MAX_CHANNELS) { | ||
| comp_err(parent_dev, "Invalid channels mask: 0x%x", chan_bitmask); | ||
| comp_err(dev, "Invalid channels mask: 0x%x", chan_bitmask); | ||
| return -EINVAL; | ||
| } | ||
|
|
||
|
|
@@ -64,15 +64,15 @@ static int copier_set_alh_multi_gtw_channel_map(struct comp_dev *parent_dev, | |
| return 0; | ||
| } | ||
|
|
||
| static int copier_dai_init(struct comp_dev *parent_dev, | ||
| static int copier_dai_init(struct comp_dev *dev, | ||
| struct comp_ipc_config *config, | ||
| const struct ipc4_copier_module_cfg *copier, | ||
| struct pipeline *pipeline, | ||
| struct ipc_config_dai *dai, | ||
| enum ipc4_gateway_type type, | ||
| int index, int dai_count) | ||
| { | ||
| struct processing_module *mod = comp_get_drvdata(parent_dev); | ||
| struct processing_module *mod = comp_get_drvdata(dev); | ||
| struct copier_data *cd = module_get_private_data(mod); | ||
| struct dai_data *dd; | ||
| int ret; | ||
|
|
@@ -86,7 +86,7 @@ static int copier_dai_init(struct comp_dev *parent_dev, | |
| &out_valid_fmt, | ||
| copier->out_fmt.s_type); | ||
| config->frame_fmt = out_frame_fmt; | ||
| pipeline->sink_comp = parent_dev; | ||
| pipeline->sink_comp = dev; | ||
| cd->bsource_buffer = true; | ||
| } else { | ||
| enum sof_ipc_frame in_frame_fmt, in_valid_fmt; | ||
|
|
@@ -96,14 +96,12 @@ static int copier_dai_init(struct comp_dev *parent_dev, | |
| &in_frame_fmt, &in_valid_fmt, | ||
| copier->base.audio_fmt.s_type); | ||
| config->frame_fmt = in_frame_fmt; | ||
| pipeline->source_comp = parent_dev; | ||
| pipeline->source_comp = dev; | ||
| } | ||
|
|
||
| parent_dev->ipc_config.frame_fmt = config->frame_fmt; | ||
|
|
||
| /* save the channel map and count for ALH multi-gateway */ | ||
| if (type == ipc4_gtw_alh && is_multi_gateway(copier->gtw_cfg.node_id)) { | ||
| ret = copier_set_alh_multi_gtw_channel_map(parent_dev, copier, index); | ||
| ret = copier_set_alh_multi_gtw_channel_map(dev, copier, index); | ||
| if (ret < 0) | ||
| return ret; | ||
| } | ||
|
|
@@ -112,14 +110,14 @@ static int copier_dai_init(struct comp_dev *parent_dev, | |
| if (!dd) | ||
| return -ENOMEM; | ||
|
|
||
| ret = dai_common_new(dd, parent_dev, dai); | ||
| ret = dai_common_new(dd, dev, dai); | ||
| if (ret < 0) | ||
| goto free_dd; | ||
|
|
||
| pipeline->sched_id = config->id; | ||
|
|
||
| cd->dd[index] = dd; | ||
| ret = comp_dai_config(cd->dd[index], parent_dev, dai, copier); | ||
| ret = comp_dai_config(cd->dd[index], dev, dai, copier); | ||
| if (ret < 0) | ||
| goto e_zephyr_free; | ||
|
|
||
|
|
@@ -137,12 +135,12 @@ static int copier_dai_init(struct comp_dev *parent_dev, | |
| * ssp, dmic or alh. Sof dai component can support this case so copier | ||
| * reuses dai component to support non-host gateway. | ||
| */ | ||
| int copier_dai_create(struct comp_dev *parent_dev, struct copier_data *cd, | ||
| struct comp_ipc_config *config, | ||
| int copier_dai_create(struct comp_dev *dev, struct copier_data *cd, | ||
| const struct ipc4_copier_module_cfg *copier, | ||
| struct pipeline *pipeline) | ||
| { | ||
| struct processing_module *mod = comp_get_drvdata(parent_dev); | ||
| struct processing_module *mod = comp_get_drvdata(dev); | ||
| struct comp_ipc_config *config = &dev->ipc_config; | ||
| int dai_index[IPC4_ALH_MAX_NUMBER_OF_GTW]; | ||
| union ipc4_connector_node_id node_id; | ||
| enum ipc4_gateway_type type; | ||
|
|
@@ -177,7 +175,7 @@ int copier_dai_create(struct comp_dev *parent_dev, struct copier_data *cd, | |
| ret = ipc4_find_dma_config(&dai, (uint8_t *)copier->gtw_cfg.config_data, | ||
| copier->gtw_cfg.config_length * 4); | ||
| if (ret != 0) { | ||
| comp_err(parent_dev, "No ssp dma_config found in blob!"); | ||
| comp_err(dev, "No ssp dma_config found in blob!"); | ||
| return -EINVAL; | ||
| } | ||
| dai.out_fmt = &copier->out_fmt; | ||
|
|
@@ -214,14 +212,14 @@ int copier_dai_create(struct comp_dev *parent_dev, struct copier_data *cd, | |
|
|
||
| dai_count = alh_blob->alh_cfg.count; | ||
| if (dai_count > IPC4_ALH_MAX_NUMBER_OF_GTW || dai_count < 0) { | ||
| comp_err(parent_dev, "Invalid dai_count: %d", dai_count); | ||
| comp_err(dev, "Invalid dai_count: %d", dai_count); | ||
| return -EINVAL; | ||
| } | ||
| for (i = 0; i < dai_count; i++) | ||
| dai_index[i] = | ||
| IPC4_ALH_DAI_INDEX(alh_blob->alh_cfg.mapping[i].alh_id); | ||
| } else { | ||
| comp_err(parent_dev, "No ipc4_alh_multi_gtw_cfg found in blob!"); | ||
| comp_err(dev, "No ipc4_alh_multi_gtw_cfg found in blob!"); | ||
| return -EINVAL; | ||
| } | ||
| } else { | ||
|
|
@@ -237,7 +235,7 @@ int copier_dai_create(struct comp_dev *parent_dev, struct copier_data *cd, | |
| ret = ipc4_find_dma_config(&dai, (uint8_t *)copier->gtw_cfg.config_data, | ||
| copier->gtw_cfg.config_length * 4); | ||
| if (ret != 0) { | ||
| comp_err(parent_dev, "No dmic dma_config found in blob!"); | ||
| comp_err(dev, "No dmic dma_config found in blob!"); | ||
| return -EINVAL; | ||
| } | ||
| dai.out_fmt = &copier->out_fmt; | ||
|
|
@@ -248,10 +246,10 @@ int copier_dai_create(struct comp_dev *parent_dev, struct copier_data *cd, | |
|
|
||
| for (i = 0; i < dai_count; i++) { | ||
| dai.dai_index = dai_index[i]; | ||
| ret = copier_dai_init(parent_dev, config, copier, pipeline, &dai, type, i, | ||
| ret = copier_dai_init(dev, config, copier, pipeline, &dai, type, i, | ||
| dai_count); | ||
| if (ret) { | ||
| comp_err(parent_dev, "failed to create dai"); | ||
| comp_err(dev, "failed to create dai"); | ||
| return ret; | ||
| } | ||
| } | ||
|
|
@@ -260,22 +258,22 @@ int copier_dai_create(struct comp_dev *parent_dev, struct copier_data *cd, | |
| get_converter_func(&copier->base.audio_fmt, &copier->out_fmt, type, | ||
| IPC4_DIRECTION(dai.direction)); | ||
| if (!cd->converter[IPC4_COPIER_GATEWAY_PIN]) { | ||
| comp_err(parent_dev, "failed to get converter type %d, dir %d", | ||
| comp_err(dev, "failed to get converter type %d, dir %d", | ||
| type, dai.direction); | ||
| return -EINVAL; | ||
| } | ||
|
|
||
| /* create multi_endpoint_buffer for ALH multi-gateway case */ | ||
| if (dai_count > 1) { | ||
| ret = create_endpoint_buffer(parent_dev, cd, config, copier, type, true, 0); | ||
| ret = create_endpoint_buffer(dev, cd, copier, true); | ||
| if (ret < 0) | ||
| return ret; | ||
| } | ||
|
|
||
| if (cd->direction == SOF_IPC_STREAM_PLAYBACK) { | ||
| pipeline->sink_comp = parent_dev; | ||
| pipeline->sink_comp = dev; | ||
| } else { | ||
| pipeline->source_comp = parent_dev; | ||
| pipeline->source_comp = dev; | ||
|
|
||
| /* set max sink count for capture */ | ||
| mod->max_sinks = IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT; | ||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.