On 18. 09. 23 15:55, Cezary Rojewski wrote:
+ if (!runtime->subformat_constraint) {
I'd try to avoid another special-bit in the runtime space. But I might be wrong here and it's unavoidable. Let me ask though, why cannot we do the constraint unconditionally?
This is for a special case when the drivers do not set snd_pcm_hw_constraint_subformats (all current drivers). In this case, the default is to handle STD and MAX subformat bits.
This constraint should be applied only one time. So this prevents to install it twice.
I believe we could avoid special-case approach. Have a copy/intersection helpers in place and utilize iterations-with-sentinel-entry. Provided such in v2 of my series.
I don't think that it's required to carry the format->subformat map in struct snd_pcm_hardware. Only few drivers will use it, so the separate constraint is fine. Also, you can remove a lot of your added code to the pcm_misc and ASoC core (copy, masking, allocating) when the affected drivers install the map using the constraint call.
Few points:
1) PCM API interface changes should be separate, you mixing unused helpers and separating vital functionality for drivers
2) if you copy 90% of my code, I don't think that Suggested-by: tag is fine
Could you do your work on top of my patch?
Jaroslav