Skip to content
Snippets Groups Projects
  1. Nov 25, 2024
  2. Aug 12, 2024
    • Karol Kosik's avatar
      ALSA: usb-audio: Support multiple control interfaces · 6aa87001
      Karol Kosik authored
      Registering Numark Party Mix II fails with error 'bogus bTerminalLink 1'.
      The problem stems from the driver not being able to find input/output
      terminals required to configure audio streaming. The information about
      those terminals is stored in AudioControl Interface. Numark device
      contains 2 AudioControl Interfaces and the driver checks only one of them.
      
      According to the USB standard, a device can have multiple audio functions,
      each represented by Audio Interface Collection. Every audio function is
      considered to be closed box and will contain unique AudioControl Interface
      and zero or more AudioStreaming and MIDIStreaming Interfaces.
      
      The Numark device adheres to the standard and defines two audio functions:
      - MIDIStreaming function
      - AudioStreaming function
      It starts with MIDI function, followed by the audio function. The driver
      saves the first AudioControl Interface in `snd_usb_audio` structure
      associated with the entire device. It then attempts to use this interface
      to query for terminals and clocks. However, this fails because the correct
      information is stored in the second AudioControl Interface, defined in the
      second Audio Interface Collection.
      
      This patch introduces a structure holding association between each
      MIDI/Audio Interface and its corresponding AudioControl Interface,
      instead of relying on AudioControl Interface defined for the entire
      device. This structure is populated during usb probing phase and leveraged
      later when querying for terminals and when sending USB requests.
      
      Alternative solutions considered include:
      - defining a quirk for Numark where the order of interface is manually
      changed, or terminals are hardcoded in the driver. This solution would
      have fixed only this model, though it seems that device is USB compliant,
      and it also seems that other devices from this company may be affected.
      What's more, it looks like products from other manufacturers have similar
      problems, i.e. Rane One DJ console
      - keeping a list of all AudioControl Interfaces and querying all of them
      to find required information. That would have solved my problem and have
      low probability of breaking other devices, as we would always start with
      the same logic of querying first AudioControl Interface. This solution
      would not have followed the standard though.
      
      This patch preserves the `snd_usb_audio.ctrl_intf` variable, which holds
      the first AudioControl Interface, and uses it as a fallback when some
      interfaces are not parsed correctly and lack an associated AudioControl
      Interface, i.e., when configured via quirks.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217865
      
      
      Signed-off-by: default avatarKarol Kosik <k.kosik@outlook.com>
      Link: https://patch.msgid.link/AS8P190MB1285893F4735C8B32AD3886BEC852@AS8P190MB1285.EURP190.PROD.OUTLOOK.COM
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6aa87001
  3. Feb 01, 2024
  4. Jan 29, 2024
  5. Jan 26, 2024
  6. Jan 23, 2024
  7. May 31, 2022
  8. May 21, 2022
    • Takashi Iwai's avatar
      ALSA: usb-audio: Workaround for clock setup on TEAC devices · 5ce0b06a
      Takashi Iwai authored
      
      Maris reported that TEAC UD-501 (0644:8043) doesn't work with the
      typical "clock source 41 is not valid, cannot use" errors on the
      recent kernels.  The currently known workaround so far is to restore
      (partially) what we've done unconditionally at the clock setup;
      namely, re-setup the USB interface immediately after the clock is
      changed.  This patch re-introduces the behavior conditionally for TEAC
      devices.
      
      Further notes:
      - The USB interface shall be set later in
        snd_usb_endpoint_configure(), but this seems to be too late.
      - Even calling  usb_set_interface() right after
        sne_usb_init_sample_rate() doesn't help; so this must be related
        with the clock validation, too.
      - The device may still spew the "clock source 41 is not valid" error
        at the first clock setup.  This seems happening at the very first
        try of clock setup, but it disappears at later attempts.
        The error is likely harmless because the driver retries the clock
        setup (such an error is more or less expected on some devices).
      
      Fixes: bf6313a0 ("ALSA: usb-audio: Refactor endpoint management")
      Reported-and-tested-by: default avatarMaris Abele <maris7abele@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220521064627.29292-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5ce0b06a
  9. Oct 26, 2021
  10. Sep 28, 2021
  11. Aug 02, 2021
  12. Jul 24, 2021
    • chihhao.chen's avatar
      ALSA: usb-audio: fix incorrect clock source setting · 4511781f
      chihhao.chen authored
      
      The following scenario describes an echo test for
      Samsung USBC Headset (AKG) with VID/PID (0x04e8/0xa051).
      
      We first start a capture stream(USB IN transfer) in 96Khz/24bit/1ch mode.
      In clock find source function, we get value 0x2 for clock selector
      and 0x1 for clock source.
      
      Kernel-4.14 behavior
      Since clock source is valid so clock selector was not set again.
      We pass through this function and start a playback stream(USB OUT transfer)
      in 48Khz/32bit/2ch mode. This time we get value 0x1 for clock selector
      and 0x1 for clock source. Finally clock id with this setting is 0x9.
      
      Kernel-5.10 behavior
      Clock selector was always set one more time even it is valid.
      When we start a playback stream, we will get 0x2 for clock selector
      and 0x1 for clock source. In this case clock id becomes 0xA.
      This is an incorrect clock source setting and results in severe noises.
      We see wrong data rate in USB IN transfer.
      (From 288 bytes/ms becomes 144 bytes/ms) It should keep in 288 bytes/ms.
      
      This earphone works fine on older kernel version load because
      this is a newly-added behavior.
      
      Fixes: d2e8f641 ("ALSA: usb-audio: Explicitly set up the clock selector")
      Signed-off-by: default avatarchihhao.chen <chihhao.chen@mediatek.com>
      Link: https://lore.kernel.org/r/1627100621-19225-1-git-send-email-chihhao.chen@mediatek.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      4511781f
  13. Jun 10, 2021
  14. May 21, 2021
  15. May 19, 2021
  16. Apr 13, 2021
  17. Feb 27, 2021
  18. Jan 21, 2021
  19. Jan 18, 2021
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix UAC1 rate setup for secondary endpoints · 87cb9af9
      Takashi Iwai authored
      The current sample rate setup function for UAC1 assumes only the first
      endpoint retrieved from the interface:altset pair, but the rate set up
      may be needed also for the secondary endpoint.  Also, retrieving the
      endpoint number from the interface descriptor is redundant; we have
      already the target endpoint in the given audioformat object.
      
      This patch simplifies the code and corrects the target endpoint as
      described in the above.  It simply refers to fmt->endpoint directly.
      
      Also, this patch drops the pioneer_djm_set_format_quirk() that is
      caleld from snd_usb_set_format_quirk(); this function does the sample
      rate setup but for the capture endpoint (0x82), and that's exactly
      what the change above fixes.
      
      Link: https://lore.kernel.org/r/20210118075816.25068-2-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      87cb9af9
  20. Dec 18, 2020
  21. Nov 23, 2020
  22. Jul 09, 2020
  23. Mar 06, 2020
  24. Feb 13, 2020
  25. Oct 30, 2019
  26. Aug 22, 2019
  27. May 30, 2019
  28. Jul 19, 2018
  29. May 28, 2018
  30. May 13, 2018
    • Ruslan Bilovol's avatar
      ALSA: usb: add UAC3 BADD profiles support · 17156f23
      Ruslan Bilovol authored
      
      Recently released USB Audio Class 3.0 specification
      contains BADD (Basic Audio Device Definition) document
      which describes pre-defined UAC3 configurations.
      
      BADD support is mandatory for UAC3 devices, it should be
      implemented as a separate USB device configuration.
      As per BADD document, class-specific descriptors
      shall not be included in the Device’s Configuration
      descriptor ("inferred"), but host can guess them
      from BADD profile number, number of endpoints and
      their max packed sizes.
      
      This patch adds support of all BADD profiles from the spec
      
      Signed-off-by: default avatarRuslan Bilovol <ruslan.bilovol@gmail.com>
      Tested-by: default avatarJorge Sanjuan <jorge.sanjuan@codethink.co.uk>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      17156f23
  31. Apr 07, 2018
  32. Mar 23, 2018
    • Andrew Chant's avatar
      ALSA: usb-audio: fix uac control query argument · 21e9b3e9
      Andrew Chant authored
      
      This patch fixes code readability and should have no functional change.
      
      Correct uac control query functions to account for the 1-based indexing
      of USB Audio Class control identifiers.
      
      The function parameter, u8 control, should be the
      constant defined in audio-v2.h to identify the control to be checked for
      readability or writeability.
      
      This patch fixes all callers that had adjusted, and makes explicit
      the mapping between audio_feature_info[] array index and the associated
      control identifier.
      
      Signed-off-by: default avatarAndrew Chant <achant@google.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      21e9b3e9
Loading