[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230308235751.495-27-quic_wcheng@quicinc.com>
Date: Wed, 8 Mar 2023 15:57:49 -0800
From: Wesley Cheng <quic_wcheng@...cinc.com>
To: <srinivas.kandagatla@...aro.org>, <mathias.nyman@...el.com>,
<perex@...ex.cz>, <broonie@...nel.org>, <lgirdwood@...il.com>,
<krzysztof.kozlowski+dt@...aro.org>, <agross@...nel.org>,
<Thinh.Nguyen@...opsys.com>, <bgoswami@...cinc.com>,
<andersson@...nel.org>, <robh+dt@...nel.org>,
<gregkh@...uxfoundation.org>, <tiwai@...e.com>
CC: <linux-kernel@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
<alsa-devel@...a-project.org>, <devicetree@...r.kernel.org>,
<linux-usb@...r.kernel.org>, <quic_jackp@...cinc.com>,
<quic_plai@...cinc.com>, Wesley Cheng <quic_wcheng@...cinc.com>
Subject: [PATCH v3 26/28] sound: usb: qc_audio_offload: Use card and PCM index from QMI request
Utilize the card and PCM index coming from the USB QMI stream request.
This field follows what is set by the ASoC USB backend, and could
potentially carry information about a specific device selected through the
ASoC USB backend. The backend also has information about the last USB
sound device plugged in, so it can choose to select the last device plugged
in, accordingly.
Signed-off-by: Wesley Cheng <quic_wcheng@...cinc.com>
---
sound/usb/qcom/qc_audio_offload.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c
index 7d6e7f946a47..51241c4eafab 100644
--- a/sound/usb/qcom/qc_audio_offload.c
+++ b/sound/usb/qcom/qc_audio_offload.c
@@ -114,8 +114,6 @@ struct uaudio_qmi_dev {
bool er_mapped;
/* reference count to number of possible consumers */
atomic_t qdev_in_use;
- /* idx to last udev card number plugged in */
- unsigned int last_card_num;
};
struct uaudio_dev {
@@ -990,7 +988,7 @@ static int prepare_qmi_response(struct snd_usb_substream *subs,
assoc = iface->intf_assoc;
pcm_dev_num = (req_msg->usb_token & SND_PCM_DEV_NUM_MASK) >> 8;
xfer_buf_len = req_msg->xfer_buff_size;
- card_num = uaudio_qdev->last_card_num;
+ card_num = (req_msg->usb_token & SND_PCM_CARD_NUM_MASK) >> 16;
alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
altsd = get_iface_desc(alts);
@@ -1375,8 +1373,7 @@ static void handle_uaudio_stream_req(struct qmi_handle *handle,
direction = (req_msg->usb_token & SND_PCM_STREAM_DIRECTION);
pcm_dev_num = (req_msg->usb_token & SND_PCM_DEV_NUM_MASK) >> 8;
- pcm_card_num = req_msg->enable ? uaudio_qdev->last_card_num :
- ffs(uaudio_qdev->card_slot) - 1;
+ pcm_card_num = (req_msg->usb_token & SND_PCM_CARD_NUM_MASK) >> 16;
if (pcm_card_num >= SNDRV_CARDS) {
ret = -EINVAL;
goto response;
@@ -1560,7 +1557,6 @@ static void qc_usb_audio_offload_probe(struct snd_usb_audio *chip)
mutex_unlock(&qdev_mutex);
uadev[chip->card->number].chip = chip;
- uaudio_qdev->last_card_num = chip->card->number;
snd_soc_usb_connect(usb_get_usb_backend(udev), chip->card->number,
chip->index, chip->pcm_devs);
Powered by blists - more mailing lists