Skip to content

Commit

Permalink
ALSA: usb-audio: Add quirk bits for enabling/disabling generic implic…
Browse files Browse the repository at this point in the history
…it fb

[ Upstream commit 0f1f7a6 ]

For making easier to test, add the new quirk_flags bits 17 and 18 to
enable and disable the generic implicit feedback mode.  The bit 17 is
equivalent with implicit_fb=1 option, applying the generic implicit
feedback sync mode.  OTOH, the bit 18 disables the implicit fb mode
forcibly.

Link: https://lore.kernel.org/r/20220421064101.12456-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tiwai authored and gregkh committed Jun 9, 2022
1 parent 4b9185f commit 07ddf6f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Documentation/sound/alsa-configuration.rst
Expand Up @@ -2237,7 +2237,7 @@ implicit_fb
Apply the generic implicit feedback sync mode. When this is set
and the playback stream sync mode is ASYNC, the driver tries to
tie an adjacent ASYNC capture stream as the implicit feedback
source.
source. This is equivalent with quirk_flags bit 17.
use_vmalloc
Use vmalloc() for allocations of the PCM buffers (default: yes).
For architectures with non-coherent memory like ARM or MIPS, the
Expand Down Expand Up @@ -2279,6 +2279,8 @@ quirk_flags
* bit 14: Ignore errors for mixer access
* bit 15: Support generic DSD raw U32_BE format
* bit 16: Set up the interface at first like UAC1
* bit 17: Apply the generic implicit feedback sync mode
* bit 18: Don't apply implicit feedback sync mode

This module supports multiple devices, autoprobe and hotplugging.

Expand Down
5 changes: 4 additions & 1 deletion sound/usb/implicit.c
Expand Up @@ -350,7 +350,8 @@ static int audioformat_implicit_fb_quirk(struct snd_usb_audio *chip,
}

/* Try the generic implicit fb if available */
if (chip->generic_implicit_fb)
if (chip->generic_implicit_fb ||
(chip->quirk_flags & QUIRK_FLAG_GENERIC_IMPLICIT_FB))
return add_generic_implicit_fb(chip, fmt, alts);

/* No quirk */
Expand Down Expand Up @@ -387,6 +388,8 @@ int snd_usb_parse_implicit_fb_quirk(struct snd_usb_audio *chip,
struct audioformat *fmt,
struct usb_host_interface *alts)
{
if (chip->quirk_flags & QUIRK_FLAG_SKIP_IMPLICIT_FB)
return 0;
if (fmt->endpoint & USB_DIR_IN)
return audioformat_capture_quirk(chip, fmt, alts);
else
Expand Down
6 changes: 6 additions & 0 deletions sound/usb/usbaudio.h
Expand Up @@ -164,6 +164,10 @@ extern bool snd_usb_skip_validation;
* Support generic DSD raw U32_BE format
* QUIRK_FLAG_SET_IFACE_FIRST:
* Set up the interface at first like UAC1
* QUIRK_FLAG_GENERIC_IMPLICIT_FB
* Apply the generic implicit feedback sync mode (same as implicit_fb=1 option)
* QUIRK_FLAG_SKIP_IMPLICIT_FB
* Don't apply implicit feedback sync mode
*/

#define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
Expand All @@ -183,5 +187,7 @@ extern bool snd_usb_skip_validation;
#define QUIRK_FLAG_IGNORE_CTL_ERROR (1U << 14)
#define QUIRK_FLAG_DSD_RAW (1U << 15)
#define QUIRK_FLAG_SET_IFACE_FIRST (1U << 16)
#define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17)
#define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18)

#endif /* __USBAUDIO_H */

0 comments on commit 07ddf6f

Please sign in to comment.