Thread (65 messages) 65 messages, 2 authors, 2024-09-04
STALE634d
Revisions (37)
  1. v4 [diff vs current]
  2. v5 [diff vs current]
  3. v6 [diff vs current]
  4. v7 [diff vs current]
  5. v8 [diff vs current]
  6. v9 [diff vs current]
  7. v10 [diff vs current]
  8. v11 [diff vs current]
  9. v12 [diff vs current]
  10. v13 [diff vs current]
  11. v14 [diff vs current]
  12. v15 [diff vs current]
  13. v16 [diff vs current]
  14. v17 [diff vs current]
  15. v18 [diff vs current]
  16. v19 [diff vs current]
  17. v20 [diff vs current]
  18. v21 [diff vs current]
  19. v22 [diff vs current]
  20. v23 [diff vs current]
  21. v24 [diff vs current]
  22. v25 [diff vs current]
  23. v26 current
  24. v27 [diff vs current]
  25. v28 [diff vs current]
  26. v28 [diff vs current]
  27. v28 [diff vs current]
  28. v29 [diff vs current]
  29. v30 [diff vs current]
  30. v31 [diff vs current]
  31. v32 [diff vs current]
  32. v33 [diff vs current]
  33. v34 [diff vs current]
  34. v35 [diff vs current]
  35. v36 [diff vs current]
  36. v37 [diff vs current]
  37. v38 [diff vs current]

[PATCH v26 30/33] ALSA: usb-audio: qcom: Use card and PCM index from QMI request

From: Wesley Cheng <hidden>
Date: 2024-08-29 19:41:50
Also in: alsa-devel, linux-arm-msm, linux-devicetree, linux-doc, linux-sound, linux-usb, lkml
Subsystem: sound, the rest · Maintainers: Jaroslav Kysela, Takashi Iwai, Linus Torvalds

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 <redacted>
---
 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 0bd533f539e4..a7ad15404fd1 100644
--- a/sound/usb/qcom/qc_audio_offload.c
+++ b/sound/usb/qcom/qc_audio_offload.c
@@ -106,8 +106,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 {
@@ -1261,7 +1259,7 @@ static int prepare_qmi_response(struct snd_usb_substream *subs,
 
 	pcm_dev_num = (req_msg->usb_token & QMI_STREAM_REQ_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 & QMI_STREAM_REQ_CARD_NUM_MASK) >> 16;
 
 	if (!uadev[card_num].ctrl_intf) {
 		dev_err(&subs->dev->dev, "audio ctrl intf info not cached\n");
@@ -1455,8 +1453,7 @@ static void handle_uaudio_stream_req(struct qmi_handle *handle,
 
 	direction = (req_msg->usb_token & QMI_STREAM_REQ_DIRECTION);
 	pcm_dev_num = (req_msg->usb_token & QMI_STREAM_REQ_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 & QMI_STREAM_REQ_CARD_NUM_MASK) >> 16;
 	if (pcm_card_num >= SNDRV_CARDS) {
 		ret = -EINVAL;
 		goto response;
@@ -1706,7 +1703,6 @@ static void qc_usb_audio_offload_probe(struct snd_usb_audio *chip)
 		sdev->card_idx = chip->card->number;
 		sdev->chip_idx = chip->index;
 
-		uaudio_qdev->last_card_num = chip->card->number;
 		snd_soc_usb_connect(usb_get_usb_backend(udev), sdev);
 	}
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help