#include <linux/bitops.h>
#include <linux/init.h>
#include <linux/string.h>
#include <linux/usb.h>
#include <linux/usb/audio.h>
#include <linux/usb/audio-v2.h>
#include <linux/usb/audio-v3.h>
#include <sound/core.h>
#include <sound/info.h>
#include <sound/pcm.h>
#include "usbaudio.h"
#include "card.h"
#include "helper.h"
#include "clock.h"
#include "quirks.h"
uac23_clock_source_desc;
uac23_clock_selector_desc;
uac23_clock_multiplier_desc;
#define GET_VAL(p, proto, field) …
static void *find_uac_clock_desc(struct usb_host_interface *iface, int id,
bool (*validator)(void *, int, int),
u8 type, int proto)
{ … }
static bool validate_clock_source(void *p, int id, int proto)
{ … }
static bool validate_clock_selector(void *p, int id, int proto)
{ … }
static bool validate_clock_multiplier(void *p, int id, int proto)
{ … }
#define DEFINE_FIND_HELPER(name, obj, validator, type2, type3) …
DEFINE_FIND_HELPER(snd_usb_find_clock_source,
union uac23_clock_source_desc, validate_clock_source,
UAC2_CLOCK_SOURCE, UAC3_CLOCK_SOURCE);
DEFINE_FIND_HELPER(snd_usb_find_clock_selector,
union uac23_clock_selector_desc, validate_clock_selector,
UAC2_CLOCK_SELECTOR, UAC3_CLOCK_SELECTOR);
DEFINE_FIND_HELPER(snd_usb_find_clock_multiplier,
union uac23_clock_multiplier_desc, validate_clock_multiplier,
UAC2_CLOCK_MULTIPLIER, UAC3_CLOCK_MULTIPLIER);
static int uac_clock_selector_get_val(struct snd_usb_audio *chip, int selector_id)
{ … }
static int uac_clock_selector_set_val(struct snd_usb_audio *chip, int selector_id,
unsigned char pin)
{ … }
static bool uac_clock_source_is_valid_quirk(struct snd_usb_audio *chip,
const struct audioformat *fmt,
int source_id)
{ … }
static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
const struct audioformat *fmt,
int source_id)
{ … }
static int __uac_clock_find_source(struct snd_usb_audio *chip,
const struct audioformat *fmt, int entity_id,
unsigned long *visited, bool validate)
{ … }
int snd_usb_clock_find_source(struct snd_usb_audio *chip,
const struct audioformat *fmt, bool validate)
{ … }
static int set_sample_rate_v1(struct snd_usb_audio *chip,
const struct audioformat *fmt, int rate)
{ … }
static int get_sample_rate_v2v3(struct snd_usb_audio *chip, int iface,
int altsetting, int clock)
{ … }
int snd_usb_set_sample_rate_v2v3(struct snd_usb_audio *chip,
const struct audioformat *fmt,
int clock, int rate)
{ … }
static int set_sample_rate_v2v3(struct snd_usb_audio *chip,
const struct audioformat *fmt, int rate)
{ … }
int snd_usb_init_sample_rate(struct snd_usb_audio *chip,
const struct audioformat *fmt, int rate)
{ … }