Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^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 __USBMIXER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __USBMIXER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <sound/info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) struct media_mixer_ctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) struct usbmix_connector_map {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	u8 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 	u8 delegated_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 	u8 control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	u8 channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) struct usb_mixer_interface {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	struct snd_usb_audio *chip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	struct usb_host_interface *hostif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	unsigned int ignore_ctl_error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	struct urb *urb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	/* array[MAX_ID_ELEMS], indexed by unit id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	struct usb_mixer_elem_list **id_elems;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	/* the usb audio specification version this interface complies to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	int protocol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	/* optional connector delegation map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	const struct usbmix_connector_map *connector_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	/* Sound Blaster remote control stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	const struct rc_config *rc_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	u32 rc_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	wait_queue_head_t rc_waitq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	struct urb *rc_urb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	struct usb_ctrlrequest *rc_setup_packet;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	u8 rc_buffer[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct media_mixer_ctl *media_mixer_ctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	bool disconnected;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	void (*private_free)(struct usb_mixer_interface *mixer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	void (*private_suspend)(struct usb_mixer_interface *mixer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define MAX_CHANNELS	16	/* max logical channels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	USB_MIXER_BOOLEAN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	USB_MIXER_INV_BOOLEAN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	USB_MIXER_S8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	USB_MIXER_U8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	USB_MIXER_S16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	USB_MIXER_U16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	USB_MIXER_S32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	USB_MIXER_U32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	USB_MIXER_BESPOKEN,	/* non-standard type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) typedef void (*usb_mixer_elem_dump_func_t)(struct snd_info_buffer *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 					 struct usb_mixer_elem_list *list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) typedef int (*usb_mixer_elem_resume_func_t)(struct usb_mixer_elem_list *elem);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) struct usb_mixer_elem_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	struct usb_mixer_interface *mixer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	struct usb_mixer_elem_list *next_id_elem; /* list of controls with same id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	struct snd_kcontrol *kctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	unsigned int id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	bool is_std_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	usb_mixer_elem_dump_func_t dump;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	usb_mixer_elem_resume_func_t resume;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) /* iterate over mixer element list of the given unit id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) #define for_each_mixer_elem(list, mixer, id)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	for ((list) = (mixer)->id_elems[id]; (list); (list) = (list)->next_id_elem)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #define mixer_elem_list_to_info(list) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	container_of(list, struct usb_mixer_elem_info, head)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) struct usb_mixer_elem_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	struct usb_mixer_elem_list head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	unsigned int control;	/* CS or ICN (high byte) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	unsigned int cmask; /* channel mask bitmap: 0 = master */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	unsigned int idx_off; /* Control index offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	unsigned int ch_readonly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	unsigned int master_readonly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	int channels;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	int val_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	int min, max, res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	int dBmin, dBmax;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	int cached;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	int cache_val[MAX_CHANNELS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	u8 initialized;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	u8 min_mute;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			 int ignore_error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 				int request, int validx, int value_set);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			   struct snd_kcontrol *kctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			   bool is_std_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define snd_usb_mixer_add_control(list, kctl) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	snd_usb_mixer_add_list(list, kctl, true)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 				 struct usb_mixer_interface *mixer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 				 int unitid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			  unsigned int size, unsigned int __user *_tlv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #ifdef CONFIG_PM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) int snd_usb_mixer_suspend(struct usb_mixer_interface *mixer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int snd_usb_set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)                              int index, int value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) int snd_usb_get_cur_mix_value(struct usb_mixer_elem_info *cval,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)                              int channel, int index, int *value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) extern void snd_usb_mixer_elem_free(struct snd_kcontrol *kctl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) extern const struct snd_kcontrol_new *snd_usb_feature_unit_ctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #endif /* __USBMIXER_H */