lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c9eb02d-3669-4e29-b83a-db2c3b15497a@quicinc.com>
Date: Thu, 1 Aug 2024 15:46:33 -0700
From: Wesley Cheng <quic_wcheng@...cinc.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.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 11/34] ASoC: usb: Fetch ASoC card and pcm device
 information

Hi Pierre,

On 8/1/2024 1:11 AM, Pierre-Louis Bossart wrote:
>
> On 8/1/24 03:17, Wesley Cheng wrote:
>> USB SND needs to know how the USB offload path is being routed.  This would
>> allow for applications to open the corresponding sound card and pcm device
>> when it wants to take the audio offload path.  This callback should return
>> the mapped indexes based on the USB SND device information.
>>
>> Signed-off-by: Wesley Cheng <quic_wcheng@...cinc.com>
>> ---
>>  include/sound/soc-usb.h | 16 ++++++++++++++++
>>  sound/soc/soc-usb.c     | 28 ++++++++++++++++++++++++++++
>>  2 files changed, 44 insertions(+)
>>
>> diff --git a/include/sound/soc-usb.h b/include/sound/soc-usb.h
>> index d6b576f971ae..a167e3de0a78 100644
>> --- a/include/sound/soc-usb.h
>> +++ b/include/sound/soc-usb.h
>> @@ -8,6 +8,11 @@
>>  
>>  #include <sound/soc.h>
>>  
>> +enum snd_soc_usb_kctl {
>> +	SND_SOC_USB_KCTL_CARD_ROUTE,
>> +	SND_SOC_USB_KCTL_PCM_ROUTE,
>> +};
>> +
>>  /**
>>   * struct snd_soc_usb_device
>>   * @card_idx - sound card index associated with USB device
>> @@ -32,6 +37,7 @@ struct snd_soc_usb_device {
>>   * @component - reference to ASoC component
>>   * @num_supported_streams - number of supported concurrent sessions
>>   * @connection_status_cb - callback to notify connection events
>> + * @get_offload_dev - callback to fetch mapped ASoC device
>>   * @priv_data - driver data
>>   **/
>>  struct snd_soc_usb {
>> @@ -40,6 +46,8 @@ struct snd_soc_usb {
>>  	unsigned int num_supported_streams;
>>  	int (*connection_status_cb)(struct snd_soc_usb *usb,
>>  			struct snd_soc_usb_device *sdev, bool connected);
>> +	int (*get_offload_dev)(struct snd_soc_component *component,
>> +				int card, int pcm, enum snd_soc_usb_kctl route);
>>  	void *priv_data;
>>  };
>>  
>> @@ -51,6 +59,8 @@ void *snd_soc_usb_find_priv_data(struct device *dev);
>>  int snd_soc_usb_setup_offload_jack(struct snd_soc_component *component,
>>  					struct snd_soc_jack *jack);
>>  int snd_soc_usb_disable_offload_jack(struct snd_soc_component *component);
>> +int soc_usb_get_offload_device(struct device *dev, int card, int pcm,
>> +				enum snd_soc_usb_kctl route);
>>  
>>  struct snd_soc_usb *snd_soc_usb_allocate_port(struct snd_soc_component *component,
>>  					      int num_streams, void *data);
>> @@ -86,6 +96,12 @@ static inline int snd_soc_usb_disable_offload_jack(struct snd_soc_component *com
>>  	return -ENODEV;
>>  }
>>  
>> +static int soc_usb_get_offload_device(struct device *dev, int card, int pcm,
>> +					enum snd_soc_usb_kctl route)
>> +{
>> +	return -ENODEV;
>> +}
>> +
>>  static inline struct snd_soc_usb *snd_soc_usb_allocate_port(
>>  					      struct snd_soc_component *component,
>>  					      int num_streams, void *data)
>> diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c
>> index fe2a75a28af4..3c217ac67c57 100644
>> --- a/sound/soc/soc-usb.c
>> +++ b/sound/soc/soc-usb.c
>> @@ -117,6 +117,34 @@ int snd_soc_usb_disable_offload_jack(struct snd_soc_component *component)
>>  }
>>  EXPORT_SYMBOL_GPL(snd_soc_usb_disable_offload_jack);
>>  
>> +/**
>> + * soc_usb_get_offload_device - Set active USB offload path
> get or set?
Sorry, get.
>
>> + * @dev - USB device to get offload status
>> + * @card - USB card index
>> + * @pcm - USB PCM device index
>> + *> + * Fetch the current status for the USB SND card and PCM device
> indexes
Done.
>> + * specified.
> the function returns an integer, how does this return the 'mapped indices"?
Will assume that based on your comments on patch#19, you were able to see what this does.  Will respond accordingly on patch#19, so we don't lose track of things.
>> + */
>> +int soc_usb_get_offload_device(struct device *dev, int card, int pcm,
>> +				enum snd_soc_usb_kctl route)
> missing route in kernel doc.

Will add.

Thanks

Wesley Cheng

>> +{
>> +	struct snd_soc_usb *ctx;
>> +	int ret;
>> +
>> +	ctx = snd_soc_find_usb_ctx(dev);
>> +	if (!ctx)
>> +		return -ENODEV;
>> +
>> +	mutex_lock(&ctx_mutex);
>> +	if (ctx && ctx->get_offload_dev)
>> +		ret = ctx->get_offload_dev(ctx->component, card, pcm, route);
>> +	mutex_unlock(&ctx_mutex);
>> +
>> +	return ret;
>> +}
>> +EXPORT_SYMBOL_GPL(soc_usb_get_offload_device);
>> +
>>  /**
>>   * snd_soc_usb_find_priv_data() - Retrieve private data stored
>>   * @dev: device reference

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ