lkml.org 
[lkml]   [2024]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v20 33/41] ASoC: usb: Create SOC USB SND jack kcontrol
From
On 4/25/2024 11:51 PM, 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@quicinc.com>
> ---

(...)

> /* 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 Playback Jack",
> + SND_JACK_HEADPHONE, jack);
> + if (ret < 0) {
> + dev_err(component->card->dev, "Unable to add USB offload jack\n");
> + return ret;
> + }
> +
> + ret = snd_soc_component_set_jack(component, jack, NULL);
> + if (ret) {
> + dev_warn(component->card->dev, "Failed to set jack: %d\n", ret);
> + return ret;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(snd_soc_usb_setup_offload_jack);
> +
> static int snd_soc_usb_get_offload_card_status(struct snd_kcontrol *kcontrol,
> struct snd_ctl_elem_value *ucontrol)
> {
>

I'm not sure if this should be handled in generic USB API, this feels
like something that should be handled in specific device driver side,
like all users currently do.

Anyway I think there should also be some function that tears jack down,
by calling:
snd_soc_component_set_jack(component, NULL, NULL);
so it can get cleaned up properly?

\
 
 \ /
  Last update: 2024-05-27 18:04    [W:0.251 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site