[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5695d0ec-af07-4d8e-993f-d435537ea503@linux.intel.com>
Date: Mon, 19 Aug 2024 08:26:17 +0200
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: Wesley Cheng <quic_wcheng@...cinc.com>, srinivas.kandagatla@...aro.org,
mathias.nyman@...el.com, perex@...ex.cz, conor+dt@...nel.org,
corbet@....net, broonie@...nel.org, lgirdwood@...il.com, krzk+dt@...nel.org,
Thinh.Nguyen@...opsys.com, bgoswami@...cinc.com, tiwai@...e.com,
gregkh@...uxfoundation.org, robh@...nel.org
Cc: linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-sound@...r.kernel.org, linux-usb@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-doc@...r.kernel.org,
alsa-devel@...a-project.org
Subject: Re: [PATCH v24 09/34] ASoC: Add SOC USB APIs for adding an USB
backend
>>>>>> +/**
>>>>>> + * snd_soc_usb_allocate_port() - allocate a SOC USB device
>>>>> USB port?
>>>> Noted, refer to the last comment.
>>>>>> + * @component: USB DPCM backend DAI component
>>>>>> + * @num_streams: number of offloading sessions supported
>>>>> same comment, is this direction-specific or not?
>>>> Depending on what you think about my first comment above, I'll also fix or remove the concept of direction entirely.
>>>>>> + * @data: private data
>>>>>> + *
>>>>>> + * Allocate and initialize a SOC USB device. This will populate parameters that
>>>>>> + * are used in subsequent sequences.
>>>>>> + *
>>>>>> + */
>>>>>> +struct snd_soc_usb *snd_soc_usb_allocate_port(struct snd_soc_component *component,
>>>>>> + int num_streams, void *data)
>>>>>> +{
>>>>>> + struct snd_soc_usb *usb;
>>>>>> +
>>>>>> + usb = kzalloc(sizeof(*usb), GFP_KERNEL);
>>>>>> + if (!usb)
>>>>>> + return ERR_PTR(-ENOMEM);
>>>>>> +
>>>>>> + usb->component = component;
>>>>>> + usb->priv_data = data;
>>>>>> + usb->num_supported_streams = num_streams;
>>>>>> +
>>>>>> + return usb;
>>>>>> +}
>>>>>> +EXPORT_SYMBOL_GPL(snd_soc_usb_allocate_port);
>>>>>> +
>>>>>> +/**
>>>>>> + * snd_soc_usb_free_port() - free a SOC USB device
>>>>>> + * @usb: allocated SOC USB device
>>>>>> +
>>>>>> + * Free and remove the SOC USB device from the available list of devices.
>>>>> Now I am lost again on the device:port relationship. I am sure you've
>>>>> explained this before but I forget things and the code isn't
>>>>> self-explanatory.
>>>>>
>>>> Ok, I think the problem is that I'm interchanging the port and device terminology, because from the USB perspective its one device connected to a USB port, so its a one-to-one relation. Removing that mindset, I think the proper term here would still be "port," because in the end SOC USB is always only servicing a port. If this is the case, do you have any objections using this terminology in the Q6AFE as well as ASoC? I will use consistent wording throughout SOC USB if so.
>>> I am not sure USB uses 'port' at all. If by 'port' you meant 'connector'
>>> it's not quite right, USB audio works across hubs.
>>>
>> Remember, this is technically the term used to explain the channel created for ASoC to communicate w/ USB. If we use a term like "device," USB devices come and go, but this ASoC path won't be unallocated along with the USB device, since it does service/know about all the available USB devices connected to the system. (ie through usb hubs)
>>
> How about snd_soc_usb_allocate_link()? This is technically allocating the soc-usb structure which is the entity that connects the ASoC to ALSA.
oh, so if this has nothing to do with a USB device proper, it'd be fine
to use 'port', but explain it in the comments, e.g. something along
those lines:
snd_soc_usb_allocate_port() - allocate a soc-usb port for offload support.
The soc-usb port may be used to stream data with ASoC support to
different connected USB devices. Plug-unplug events are signaled with a
notification but don't directly impact the soc-usb alloc/free.
Powered by blists - more mailing lists