[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240610235808.22173-21-quic_wcheng@quicinc.com>
Date: Mon, 10 Jun 2024 16:57:56 -0700
From: Wesley Cheng <quic_wcheng@...cinc.com>
To: <srinivas.kandagatla@...aro.org>, <mathias.nyman@...el.com>,
<perex@...ex.cz>, <conor+dt@...nel.org>, <corbet@....net>,
<broonie@...nel.org>, <lgirdwood@...il.com>, <krzk+dt@...nel.org>,
<Thinh.Nguyen@...opsys.com>, <bgoswami@...cinc.com>, <tiwai@...e.com>,
<robh@...nel.org>, <gregkh@...uxfoundation.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>, Wesley Cheng <quic_wcheng@...cinc.com>
Subject: [PATCH v23 20/32] ASoC: qcom: qdsp6: Add support to track available USB PCM devices
The USB backend should know about which sound resources are being shared
between the ASoC and USB SND paths. This can be utilized to properly
select and maintain the offloading devices.
Signed-off-by: Wesley Cheng <quic_wcheng@...cinc.com>
---
sound/soc/qcom/qdsp6/q6usb.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/sound/soc/qcom/qdsp6/q6usb.c b/sound/soc/qcom/qdsp6/q6usb.c
index ab79a293083e..f1fa75c0ba5b 100644
--- a/sound/soc/qcom/qdsp6/q6usb.c
+++ b/sound/soc/qcom/qdsp6/q6usb.c
@@ -27,11 +27,18 @@
#define Q6_USB_SID_MASK 0xF
+struct q6usb_status {
+ struct snd_soc_usb_device *sdev;
+ unsigned int pcm_index;
+};
+
struct q6usb_port_data {
struct q6afe_usb_cfg usb_cfg;
struct snd_soc_usb *usb;
struct q6usb_offload priv;
int active_usb_chip_idx;
+ unsigned long available_card_slot;
+ struct q6usb_status status[SNDRV_CARDS];
};
static const struct snd_soc_dapm_widget q6usb_dai_widgets[] = {
@@ -113,6 +120,12 @@ static int q6usb_alsa_connection_cb(struct snd_soc_usb *usb,
if (connected) {
/* Selects the latest USB headset plugged in for offloading */
data->active_usb_chip_idx = sdev->card_idx;
+
+ set_bit(sdev->card_idx, &data->available_card_slot);
+ data->status[sdev->card_idx].sdev = sdev;
+ } else {
+ clear_bit(sdev->card_idx, &data->available_card_slot);
+ data->status[sdev->card_idx].sdev = NULL;
}
return 0;
Powered by blists - more mailing lists