xref: /linux/drivers/usb/gadget/function/u_uac1.h (revision 3ca3af7d1f230d1f93ba4cd8cd9d054870f2406f)
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 
13 #define UAC1_OUT_EP_MAX_PACKET_SIZE	200
14 #define UAC1_DEF_CCHMASK	0x3
15 #define UAC1_DEF_CSRATE		48000
16 #define UAC1_DEF_CSSIZE		2
17 #define UAC1_DEF_PCHMASK	0x3
18 #define UAC1_DEF_PSRATE		48000
19 #define UAC1_DEF_PSSIZE		2
20 #define UAC1_DEF_REQ_NUM	2
21 #define UAC1_DEF_INT_REQ_NUM	10
22 
23 #define UAC1_DEF_MUTE_PRESENT	1
24 #define UAC1_DEF_VOLUME_PRESENT 1
25 #define UAC1_DEF_MIN_DB		(-100*256)	/* -100 dB */
26 #define UAC1_DEF_MAX_DB		0		/* 0 dB */
27 #define UAC1_DEF_RES_DB		(1*256)	/* 1 dB */
28 
29 
30 struct f_uac1_opts {
31 	struct usb_function_instance	func_inst;
32 	int				c_chmask;
33 	int				c_srate;
34 	int				c_ssize;
35 	int				p_chmask;
36 	int				p_srate;
37 	int				p_ssize;
38 
39 	bool			p_mute_present;
40 	bool			p_volume_present;
41 	s16				p_volume_min;
42 	s16				p_volume_max;
43 	s16				p_volume_res;
44 
45 	bool			c_mute_present;
46 	bool			c_volume_present;
47 	s16				c_volume_min;
48 	s16				c_volume_max;
49 	s16				c_volume_res;
50 
51 	int				req_number;
52 	unsigned			bound:1;
53 
54 	struct mutex			lock;
55 	int				refcnt;
56 };
57 
58 #endif /* __U_UAC1_H */
59