Uh oh!
There was an error while loading. Please reload this page.
forked from torvalds/linux
- Notifications
You must be signed in to change notification settings - Fork 150
SRC fixes#4341
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
plbossart
merged 3 commits into
thesofproject:topic/sof-dev
from
ranj063:fix/src_formatsMay 16, 2023
Uh oh!
There was an error while loading. Please reload this page.
Merged
SRC fixes #4341
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1344,25 +1344,6 @@ static int snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_s | ||
| } | ||
| #endif | ||
| static int ipc4_set_fmt_mask(struct snd_mask *fmt, unsigned int bit_depth) | ||
| { | ||
| switch (bit_depth) { | ||
| case 16: | ||
| snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); | ||
| break; | ||
| case 24: | ||
| snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE); | ||
| break; | ||
| case 32: | ||
| snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE); | ||
| break; | ||
| default: | ||
| return -EINVAL; | ||
| } | ||
| return 0; | ||
| } | ||
| static int | ||
| sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget, | ||
| struct snd_pcm_hw_params *fe_params, | ||
| @@ -1378,8 +1359,6 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget, | ||
| struct snd_sof_dai *dai; | ||
| u32 gtw_cfg_config_length; | ||
| u32 dma_config_tlv_size = 0; | ||
| struct snd_mask *fmt; | ||
| int out_sample_valid_bits; | ||
| void **ipc_config_data; | ||
| int *ipc_config_size; | ||
| u32 **data; | ||
| @@ -1659,11 +1638,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget, | ||
| } | ||
| /* modify the input params for the next widget */ | ||
| fmt = hw_param_mask(pipeline_params, SNDRV_PCM_HW_PARAM_FORMAT); | ||
| out_sample_valid_bits = | ||
| SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(copier_data->out_format.fmt_cfg); | ||
| snd_mask_none(fmt); | ||
| ret = ipc4_set_fmt_mask(fmt, out_sample_valid_bits); | ||
| ret = sof_ipc4_update_hw_params(sdev, pipeline_params, &copier_data->out_format); | ||
| if (ret) | ||
| return ret; | ||
| @@ -1827,37 +1802,54 @@ static int sof_ipc4_prepare_src_module(struct snd_sof_widget *swidget, | ||
| struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); | ||
| struct sof_ipc4_src *src = swidget->private; | ||
| struct sof_ipc4_available_audio_format *available_fmt = &src->available_fmt; | ||
| struct sof_ipc4_audio_format *in_fmt; | ||
| struct sof_ipc4_audio_format *out_audio_fmt; | ||
ranj063 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| u32 out_ref_rate, out_ref_channels, out_ref_valid_bits; | ||
| struct snd_interval *rate; | ||
| int ret; | ||
| int ret, output_format_index; | ||
plbossart marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ret = sof_ipc4_init_input_audio_fmt(sdev, swidget, &src->base_config, | ||
| pipeline_params, available_fmt); | ||
| if (ret < 0) | ||
| return ret; | ||
| in_fmt = &available_fmt->input_pin_fmts[ret].audio_fmt; | ||
plbossart marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| out_ref_rate = in_fmt->sampling_frequency; | ||
| out_ref_channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(in_fmt->fmt_cfg); | ||
| out_ref_valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(in_fmt->fmt_cfg); | ||
| /* | ||
| * For playback, the SRC sink rate will be configured based on the requested output | ||
| * format, which is restricted to only deal with DAI's with a single format for now. | ||
| */ | ||
| if (dir == SNDRV_PCM_STREAM_PLAYBACK && available_fmt->num_output_formats > 1) { | ||
| dev_err(sdev->dev, "Invalid number of output formats: %d for SRC %s\n", | ||
| available_fmt->num_output_formats, swidget->widget->name); | ||
| return -EINVAL; | ||
| } | ||
| ret = sof_ipc4_init_output_audio_fmt(sdev, &src->base_config, available_fmt, | ||
| out_ref_rate, out_ref_channels, out_ref_valid_bits); | ||
| if (ret < 0) { | ||
| /* | ||
| * For capture, the SRC module should convert the rate to match the rate requested by the | ||
| * PCM hw_params. Set the reference params based on the fe_params unconditionally as it | ||
| * will be ignored for playback anyway. | ||
| */ | ||
| out_ref_valid_bits = sof_ipc4_get_valid_bits(sdev, fe_params); | ||
| if (out_ref_valid_bits < 0) | ||
| return out_ref_valid_bits; | ||
| out_ref_rate = params_rate(fe_params); | ||
| out_ref_channels = params_channels(fe_params); | ||
| output_format_index = sof_ipc4_init_output_audio_fmt(sdev, &src->base_config, | ||
| available_fmt, out_ref_rate, | ||
| out_ref_channels, out_ref_valid_bits); | ||
| if (output_format_index < 0) { | ||
| dev_err(sdev->dev, "Failed to initialize output format for %s", | ||
| swidget->widget->name); | ||
| return output_format_index; | ||
| } | ||
| /* update pipeline memory usage */ | ||
| sof_ipc4_update_pipeline_mem_usage(sdev, swidget, &src->base_config); | ||
| /* update pipeline_params for sink widgets */ | ||
| rate = hw_param_interval(pipeline_params, SNDRV_PCM_HW_PARAM_RATE); | ||
| rate->min = src->sink_rate; | ||
| rate->max = rate->min; | ||
| out_audio_fmt = &available_fmt->output_pin_fmts[output_format_index].audio_fmt; | ||
| src->sink_rate = out_audio_fmt->sampling_frequency; | ||
| return 0; | ||
| /* update pipeline_params for sink widgets */ | ||
| return sof_ipc4_update_hw_params(sdev, pipeline_params, out_audio_fmt); | ||
| } | ||
| static int | ||
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.