[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZRRD8eFZugh/+dex@finisterre.sirena.org.uk>
Date: Wed, 27 Sep 2023 17:02:09 +0200
From: Mark Brown <broonie@...nel.org>
To: Wesley Cheng <quic_wcheng@...cinc.com>
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
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.
> +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?
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists