Skip to content
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

fixup! ASoC: SOF: Intel: hda-dai-ops: fix HDaudio link format #4665

Merged
merged 1 commit into from
Oct 27, 2023
Merged
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
14 changes: 10 additions & 4 deletions sound/soc/sof/intel/hda-dai-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,24 @@ static unsigned int generic_calc_stream_format(struct snd_sof_dev *sdev,
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *codec_dai;
unsigned int format_val;
u32 ch_mask = 0;
u32 ch_mask;
int num_channels;
int codec_dai_id;

/*
* if the multiple dais are handled by the same dailink, we may need to update the
* stream channel count - the params are modified in soc-pcm based on the codec_ch_maps info
*/
for_each_rtd_codec_dais(rtd, codec_dai_id, codec_dai)
ch_mask |= rtd->dai_link->codec_ch_maps[codec_dai_id].ch_mask;
num_channels = params_channels(params);
if (rtd->dai_link->codec_ch_maps) {
ch_mask = 0;
for_each_rtd_codec_dais(rtd, codec_dai_id, codec_dai) {
ch_mask |= rtd->dai_link->codec_ch_maps[codec_dai_id].ch_mask;
}
if (ch_mask)
num_channels = hweight_long(ch_mask);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this new check really needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

it doesn't really matter, all this code will have to be redone with the changes from Moritomo-san. See #4632

}

num_channels = hweight_long(ch_mask);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might be better convey the logic and line 251 and 257-258 can be dropped, and leave the ch_mask initialized at declaration (line 263 can be dropped)?

if (ch_mask)
	num_channels = hweight_long(ch_mask);
else
	num_channels = params_channels(params);

if (num_channels != params_channels(params))
dev_dbg(sdev->dev, "configuring stream format for %d channels, params_channels was %d\n",
num_channels, params_channels(params));
Expand Down