Re: [PATCH v26 14/33] ASoC: usb: Create SOC USB SND jack kcontrol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 8/29/24 21:40, Wesley Cheng wrote:
> Expose API for creation of a jack control for notifying of available
> devices that are plugged in/discovered, and that support offloading.  This
> allows for control names to be standardized across implementations of USB
> audio offloading.
> 
> Signed-off-by: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>

Some nit-picks below.

> diff --git a/include/sound/soc-usb.h b/include/sound/soc-usb.h
> index b550ee87b748..5c788cbfa82e 100644
> --- a/include/sound/soc-usb.h
> +++ b/include/sound/soc-usb.h
> @@ -6,6 +6,8 @@
>  #ifndef __LINUX_SND_SOC_USB_H
>  #define __LINUX_SND_SOC_USB_H
>  
> +#include <sound/soc.h>
> +

nit-pick: move this to patch 12/33


> diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c
> index 8ade2060d8fe..3d5354298206 100644
> --- a/sound/soc/soc-usb.c
> +++ b/sound/soc/soc-usb.c
> @@ -4,8 +4,10 @@
>   */
>  #include <linux/of.h>
>  #include <linux/usb.h>
> -#include <sound/soc.h>
> +

nit-pick: move this to patch 12/33

> +#include <sound/jack.h>
>  #include <sound/soc-usb.h>
> +
>  #include "../usb/card.h"
>  
>  static DEFINE_MUTEX(ctx_mutex);
> @@ -57,6 +59,64 @@ static struct snd_soc_usb *snd_soc_find_usb_ctx(struct device *dev)
>  	return ctx ? ctx : NULL;
>  }
>  
> +/* SOC USB sound kcontrols */
> +/**
> + * snd_soc_usb_setup_offload_jack() - Create USB offloading jack
> + * @component: USB DPCM backend DAI component
> + * @jack: jack structure to create
> + *
> + * Creates a jack device for notifying userspace of the availability
> + * of an offload capable device.
> + *
> + * Returns 0 on success, negative on error.
> + *
> + */
> +int snd_soc_usb_setup_offload_jack(struct snd_soc_component *component,
> +				   struct snd_soc_jack *jack)
> +{
> +	int ret;
> +
> +	ret = snd_soc_card_jack_new(component->card, "USB Offload Jack",
> +				    SND_JACK_USB, jack);
> +	if (ret < 0) {
> +		dev_err(component->card->dev, "Unable to add USB offload jack\n");

nit-pick: be consistent and return the code in the error log as done below.

> +		return ret;
> +	}
> +
> +	ret = snd_soc_component_set_jack(component, jack, NULL);
> +	if (ret) {
> +		dev_err(component->card->dev, "Failed to set jack: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux