[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fe01d7f6-fd85-41ca-9b53-f13cc82096ed@linux.intel.com>
Date: Fri, 30 Aug 2024 10:46:08 +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,
dmitry.torokhov@...il.com, corbet@....net, broonie@...nel.org,
lgirdwood@...il.com, tiwai@...e.com, krzk+dt@...nel.org,
Thinh.Nguyen@...opsys.com, bgoswami@...cinc.com, robh@...nel.org,
gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-sound@...r.kernel.org, linux-input@...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 v26 14/33] ASoC: usb: Create SOC USB SND jack kcontrol
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@...cinc.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
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;
> +}
Powered by blists - more mailing lists