Skip to content

ASoC: soc-pcm: Preserve hw parameters from components in dpcm_runtime_setup_fe#5561

Closed
ujfalusi wants to merge 1 commit intothesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/propagate-params-to-fe
Closed

ASoC: soc-pcm: Preserve hw parameters from components in dpcm_runtime_setup_fe#5561
ujfalusi wants to merge 1 commit intothesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/propagate-params-to-fe

Conversation

@ujfalusi
Copy link
Copy Markdown
Collaborator

Component drivers can prepare snd_pcm_hardware struct based on the hardware capabilities which information should not be discarded.

Only touch the rates, channels_max and formats if they were left to 0, otherwise keep the provided configuration intact for the parameter cross checking decision.

@ujfalusi
Copy link
Copy Markdown
Collaborator Author

In essence this patch extends
083a25b ("ASoC: soc-pcm: fix hw->formats cleared by soc_pcm_hw_init() for dpcm")
to cover rates, rate_max and channels_max as well.

With IPC4 and 5.1 equipment (audio extractor) on HDMI:

./alsa_conformance_test/alsa_conformance_test -P hw:0,3 --dev_info_only
...
available channels: 2 4 6
...

With stereo:

./alsa_conformance_test/alsa_conformance_test -P hw:0,3 --dev_info_only
...
available channels: 2
...

With 7.1:

./alsa_conformance_test/alsa_conformance_test -P hw:0,3 --dev_info_only
...
available channels: 2 4 6 8
...

With IPC3 with stereo, 5.1 or 7.1:

./alsa_conformance_test/alsa_conformance_test -P hw:0,3 --dev_info_only
...
available channels: 2
...

@ujfalusi
Copy link
Copy Markdown
Collaborator Author

I will send this upstream for comments early next week, but I wanted to ask here opinions also.

bardliao
bardliao previously approved these changes Oct 20, 2025
kv2019i
kv2019i previously approved these changes Oct 20, 2025
Copy link
Copy Markdown
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Very good addition again!

Minor style nit, but upstream kernel is full of this "true/false in caller" usages, so it's probably just me.

int i;

soc_pcm_hw_init(hw);
soc_pcm_hw_init(hw, false);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Again, not a huge fan of these boolean parameters. The calling side readability suffers. Maybe soc_pcm_init_preserve_config() that hides the "true" case?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

or do this without a function, inline of dpcm_runtime_setup_fe()

…_setup_fe

Component drivers can prepare snd_pcm_hardware struct based on the hardware
capabilities which information should not be discarded.

Only touch the rates, channels_max and formats if they were left to 0,
otherwise keep the provided configuration intact for the parameter cross
checking decision.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
@ujfalusi ujfalusi dismissed stale reviews from kv2019i and bardliao via b5f4f02 October 21, 2025 10:12
@ujfalusi ujfalusi force-pushed the peter/sof/pr/propagate-params-to-fe branch from 6ada9f1 to b5f4f02 Compare October 21, 2025 10:12
@ujfalusi ujfalusi changed the title ASoC: soc-pcm: Use conditional PCM hardware parameter initialization ASoC: soc-pcm: Preserve hw parameters from components in dpcm_runtime_setup_fe Oct 21, 2025
@ujfalusi
Copy link
Copy Markdown
Collaborator Author

Changes since v1:

  • move the change local to dpcm_runtime_setup_fe()

Copy link
Copy Markdown
Collaborator

@singalsu singalsu left a comment

Choose a reason for hiding this comment

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

Worked OK in my test with HDA topology with all formats enabled.

@ujfalusi
Copy link
Copy Markdown
Collaborator Author

We will get this back from upstream if accepted, closing it here.

@ujfalusi ujfalusi closed this Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants