Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
e5779998 DM |
2 | #ifndef __USBAUDIO_HELPER_H |
3 | #define __USBAUDIO_HELPER_H | |
4 | ||
5 | unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size); | |
6 | ||
7 | void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype); | |
8 | void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype); | |
9 | ||
10 | int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, | |
11 | __u8 request, __u8 requesttype, __u16 value, __u16 index, | |
17d900c4 | 12 | void *data, __u16 size); |
e5779998 DM |
13 | |
14 | unsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip, | |
15 | struct usb_host_interface *alts); | |
16 | ||
e42a09bc TI |
17 | struct usb_host_interface * |
18 | snd_usb_get_host_interface(struct snd_usb_audio *chip, int ifnum, int altsetting); | |
19 | ||
e5779998 DM |
20 | /* |
21 | * retrieve usb_interface descriptor from the host interface | |
22 | * (conditional for compatibility with the older API) | |
23 | */ | |
e5779998 DM |
24 | #define get_iface_desc(iface) (&(iface)->desc) |
25 | #define get_endpoint(alt,ep) (&(alt)->endpoint[ep].desc) | |
26 | #define get_ep_desc(ep) (&(ep)->desc) | |
27 | #define get_cfg_desc(cfg) (&(cfg)->desc) | |
e5779998 | 28 | |
e5779998 | 29 | #define snd_usb_get_speed(dev) ((dev)->speed) |
e5779998 | 30 | |
11bcbc44 DM |
31 | static inline int snd_usb_ctrl_intf(struct snd_usb_audio *chip) |
32 | { | |
33 | return get_iface_desc(chip->ctrl_intf)->bInterfaceNumber; | |
34 | } | |
e5779998 | 35 | |
57f87706 TI |
36 | /* in validate.c */ |
37 | bool snd_usb_validate_audio_desc(void *p, int protocol); | |
38 | bool snd_usb_validate_midi_desc(void *p); | |
39 | ||
e5779998 | 40 | #endif /* __USBAUDIO_HELPER_H */ |