[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <191e6429-bb47-625b-a074-fa67ee052f03@quicinc.com>
Date: Wed, 27 Sep 2023 13:10:40 -0700
From: Wesley Cheng <quic_wcheng@...cinc.com>
To: Mark Brown <broonie@...nel.org>
CC: <mathias.nyman@...el.com>, <gregkh@...uxfoundation.org>,
<lgirdwood@...il.com>, <perex@...ex.cz>, <tiwai@...e.com>,
<agross@...nel.org>, <andersson@...nel.org>,
<konrad.dybcio@...aro.org>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <conor+dt@...nel.org>,
<srinivas.kandagatla@...aro.org>, <bgoswami@...cinc.com>,
<Thinh.Nguyen@...opsys.com>, <linux-kernel@...r.kernel.org>,
<linux-usb@...r.kernel.org>, <alsa-devel@...a-project.org>,
<linux-arm-msm@...r.kernel.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH v7 29/33] ASoC: qcom: qdsp6: Add SND kcontrol for fetching
offload status
Hi Mark,
On 9/27/2023 8:02 AM, Mark Brown wrote:
> On Thu, Sep 21, 2023 at 02:48:39PM -0700, Wesley Cheng wrote:
>
>> Add a kcontrol to the platform sound card to fetch the current offload
>> status. This can allow for userspace to ensure/check which USB SND
>> resources are actually busy versus having to attempt opening the USB SND
>> devices, which will result in an error if offloading is active.
>
>> +static int q6usb_prepare(struct snd_pcm_substream *substream,
>> + struct snd_soc_dai *dai)
>> +{
>> + struct q6usb_port_data *data = dev_get_drvdata(dai->dev);
>> +
>> + mutex_lock(&data->mutex);
>> + data->status[data->sel_card_idx].running = true;
>> + mutex_unlock(&data->mutex);
>
> These updates of running should really have a snd_ctl_notify() so that
> UIs can know to update when the value changes while they're open.
>
Sure, me review some of the APIs again and add the notify call where
necessary.
>> +static int q6usb_mixer_get_offload_status(struct snd_kcontrol *kcontrol,
>> + struct snd_ctl_elem_value *ucontrol)
>> +{
>
>> + running = q6usb_find_running(data);
>> + if (running < 0) {
>> + card_idx = -1;
>> + pcm_idx = -1;
>> + } else {
>> + card_idx = running;
>> + pcm_idx = data->status[running].pcm_index;
>> + }
>> +
>> + ucontrol->value.integer.value[0] = card_idx;
>> + ucontrol->value.integer.value[1] = pcm_idx;
>
> This feels a bit messy but I'm not sure what we'd do that's better so
> unless someone else has better ideas let's go with this. Possibly we
> should standardise this as a new control type for joining cards up so at
> least if there's further needs for this we can use the same solution?
I'm all ears for any suggestions from other users :). I think its a bit
difficult to tell since this is the first iteration of adding this
feature. Pierre gave me some great feedback from the
userspace/application level, and tried my best to accommodate for those
requirements since it would be the main entity interacting with these
controls.
Thanks
Wesley Cheng
Powered by blists - more mailing lists