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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a1115d39-b60e-a5da-5c7e-79266d6ced17@quicinc.com>
Date: Tue, 30 Apr 2024 17:32:24 -0700
From: Wesley Cheng <quic_wcheng@...cinc.com>
To: Amadeusz Sławiński
	<amadeuszx.slawinski@...ux.intel.com>,
        <srinivas.kandagatla@...aro.org>, <mathias.nyman@...el.com>,
        <perex@...ex.cz>, <conor+dt@...nel.org>, <corbet@....net>,
        <lgirdwood@...il.com>, <andersson@...nel.org>,
        <krzysztof.kozlowski+dt@...aro.org>, <gregkh@...uxfoundation.org>,
        <Thinh.Nguyen@...opsys.com>, <broonie@...nel.org>,
        <bgoswami@...cinc.com>, <tiwai@...e.com>, <robh@...nel.org>,
        <konrad.dybcio@...aro.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 v20 33/41] ASoC: usb: Create SOC USB SND jack kcontrol

Hi Amadeusz,

On 4/26/2024 6:26 AM, Amadeusz Sławiński wrote:
> 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@...cinc.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.
> 

In some of the previous comments, it was mentioned that maybe it was 
better to have more consistent/defined naming across devices that do 
have support for audio offload.  Initially, I did have these within our 
vendor specific ASoC platform driver also.

> 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?

I can add that.  I didn't realize there were some situations where maybe 
components would want to disable the jack.  I will leave the cleanup 
part to ASoC when the platform card is removed.

Thanks
Wesley Cheng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ