lkml.org 
[lkml]   [2024]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v20 27/41] ALSA: usb-audio: qcom: Populate PCM and USB chip information
    Date
    Currently, only the index to the USB SND card array is passed to the USB
    backend. Pass through more information, specifically the USB SND card
    number and the number of PCM devices available. This allows for the DPCM
    backend to determine what USB resources are available during situations,
    such as USB audio offloading.

    Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
    ---
    sound/usb/qcom/qc_audio_offload.c | 17 +++++++++++++++++
    1 file changed, 17 insertions(+)

    diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c
    index db68c6c605eb..4deec0b6fc08 100644
    --- a/sound/usb/qcom/qc_audio_offload.c
    +++ b/sound/usb/qcom/qc_audio_offload.c
    @@ -170,6 +170,21 @@ enum usb_qmi_audio_format {
    USB_QMI_PCM_FORMAT_U32_BE,
    };

    +static int usb_qmi_get_pcm_num(struct snd_usb_audio *chip, int direction)
    +{
    + struct snd_usb_substream *subs = NULL;
    + struct snd_usb_stream *as;
    + int count = 0;
    +
    + list_for_each_entry(as, &chip->pcm_list, list) {
    + subs = &as->substream[direction];
    + if (subs->ep_num)
    + count++;
    + }
    +
    + return count;
    +}
    +
    static enum usb_qmi_audio_device_speed_enum_v01
    get_speed_info(enum usb_device_speed udev_speed)
    {
    @@ -1638,6 +1653,8 @@ static void qc_usb_audio_offload_probe(struct snd_usb_audio *chip)

    sdev->card_idx = chip->card->number;
    sdev->chip_idx = chip->index;
    + sdev->num_playback = usb_qmi_get_pcm_num(chip, 0);
    + sdev->num_capture = usb_qmi_get_pcm_num(chip, 1);
    uadev[chip->card->number].sdev = sdev;

    uaudio_qdev->last_card_num = chip->card->number;
    \
     
     \ /
      Last update: 2024-05-27 18:04    [W:4.316 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site