On 2024-12-06 9:43 PM, Wesley Cheng wrote:
On 12/6/2024 1:09 AM, Cezary Rojewski wrote:
...
+#include <linux/usb.h>
+
+#include <sound/core.h>
+#include <sound/control.h>
+#include <sound/soc-usb.h>
ALSA-components should not be dependent on ASoC ones. It should be done the other way around: ALSA <- ASoC.
At least for this kcontrol, we need to know the status of the ASoC state, so that we can communicate the proper path to userspace. If the ASoC path is not probed or ready, then this module isn't blocked. It will just communicate that there isn't a valid offload path.
I'm not asking _why_ you need soc-usb.h header, your reasoning is probably perfectly fine. The code hierarchy is not though. If a sound module is dependent on soc-xxx.h i.e. ASoC symbols, it shall be part of sound/soc/ space.
That would basically require a significant change in the current design. Was that requirement documented somewhere, where ALSA components should not be dependent on ASoC? What was the reasoning for making it one direction, but not the other?
Well, some may call this a common sense. ASoC is founded on ALSA. There
are no ALSA-core components which I'm aware of which have a dependency
on ASoC components. You may not get compilation problems now, but such
approach does not scale and will hit circular dependency problem sooner
or later.
Kind regards,
Czarek