Re: [PATCH v7 29/33] ASoC: qcom: qdsp6: Add SND kcontrol for fetching offload status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux