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