xref: /linux/drivers/usb/gadget/function/u_uac1.h (revision 06a130e42a5bfc84795464bff023bff4c16f58c5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * u_uac1.h - Utility definitions for UAC1 function
4  *
5  * Copyright (C) 2016 Ruslan Bilovol <ruslan.bilovol@gmail.com>
6  */
7 
8 #ifndef __U_UAC1_H
9 #define __U_UAC1_H
10 
11 #include <linux/usb/composite.h>
12 #include "uac_common.h"
13 
14 #define UAC1_OUT_EP_MAX_PACKET_SIZE	200
15 #define UAC1_DEF_CCHMASK	0x3
16 #define UAC1_DEF_CSRATE		48000
17 #define UAC1_DEF_CSSIZE		2
18 #define UAC1_DEF_PCHMASK	0x3
19 #define UAC1_DEF_PSRATE		48000
20 #define UAC1_DEF_PSSIZE		2
21 #define UAC1_DEF_REQ_NUM	2
22 #define UAC1_DEF_INT_REQ_NUM	10
23 
24 #define UAC1_DEF_MUTE_PRESENT	1
25 #define UAC1_DEF_VOLUME_PRESENT 1
26 #define UAC1_DEF_MIN_DB		(-100*256)	/* -100 dB */
27 #define UAC1_DEF_MAX_DB		0		/* 0 dB */
28 #define UAC1_DEF_RES_DB		(1*256)	/* 1 dB */
29 
30 
31 struct f_uac1_opts {
32 	struct usb_function_instance	func_inst;
33 	int				c_chmask;
34 	int				c_srates[UAC_MAX_RATES];
35 	int				c_ssize;
36 	int				p_chmask;
37 	int				p_srates[UAC_MAX_RATES];
38 	int				p_ssize;
39 
40 	bool			p_mute_present;
41 	bool			p_volume_present;
42 	s16				p_volume_min;
43 	s16				p_volume_max;
44 	s16				p_volume_res;
45 
46 	bool			c_mute_present;
47 	bool			c_volume_present;
48 	s16				c_volume_min;
49 	s16				c_volume_max;
50 	s16				c_volume_res;
51 
52 	int				req_number;
53 	unsigned			bound:1;
54 
55 	char			function_name[USB_MAX_STRING_LEN];
56 
57 	char			p_it_name[USB_MAX_STRING_LEN];
58 	char			p_it_ch_name[USB_MAX_STRING_LEN];
59 	char			p_ot_name[USB_MAX_STRING_LEN];
60 	char			p_fu_vol_name[USB_MAX_STRING_LEN];
61 
62 	char			c_it_name[USB_MAX_STRING_LEN];
63 	char			c_it_ch_name[USB_MAX_STRING_LEN];
64 	char			c_ot_name[USB_MAX_STRING_LEN];
65 	char			c_fu_vol_name[USB_MAX_STRING_LEN];
66 
67 	struct mutex			lock;
68 	int				refcnt;
69 };
70 
71 #endif /* __U_UAC1_H */
72