Re: [PATCH v30 28/30] ALSA: usb-audio: Add USB offload route kcontrol

Cezary Rojewski
2024-12-06T09:09:55Z

On 2024-12-04 12:15 AM, Wesley Cheng wrote:
>
> On 12/3/2024 8:13 AM, Cezary Rojewski wrote:
>> On 2024-11-06 8:34 PM, Wesley Cheng wrote:
>>> In order to allow userspace/applications know about USB offloading status,
>>> expose a sound kcontrol that fetches information about which sound card
>>> and PCM index the USB device is mapped to for supporting offloading.  In
>>> the USB audio offloading framework, the ASoC BE DAI link is the entity
>>> responsible for registering to the SOC USB layer.

...

>> R) += mixer_usb_offload.o
>>> diff --git a/sound/usb/mixer_usb_offload.c b/sound/usb/mixer_usb_offload.c
>>> new file mode 100644
>>> index 000000000000..e0689a3b9b86
>>> --- /dev/null
>>> +++ b/sound/usb/mixer_usb_offload.c
>>> @@ -0,0 +1,102 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +/*
>>> + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
>>> + */
>>> +
>>> +#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.