1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * u_uac2.h
4  *
5  * Utility definitions for UAC2 function
6  *
7  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
8  *		http://www.samsung.com
9  *
10  * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
11  */
12 
13 #ifndef U_UAC2_H
14 #define U_UAC2_H
15 
16 #include <linux/usb/composite.h>
17 
18 #define UAC2_DEF_PCHMASK 0x3
19 #define UAC2_DEF_PSRATE 48000
20 #define UAC2_DEF_PSSIZE 2
21 #define UAC2_DEF_CCHMASK 0x3
22 #define UAC2_DEF_CSRATE 64000
23 #define UAC2_DEF_CSSIZE 2
24 #define UAC2_DEF_CSYNC		USB_ENDPOINT_SYNC_ASYNC
25 
26 #define UAC2_DEF_MUTE_PRESENT	1
27 #define UAC2_DEF_VOLUME_PRESENT 1
28 #define UAC2_DEF_MIN_DB		(-100*256)	/* -100 dB */
29 #define UAC2_DEF_MAX_DB		0		/* 0 dB */
30 #define UAC2_DEF_RES_DB		(1*256)		/* 1 dB */
31 
32 #define UAC2_DEF_REQ_NUM 2
33 #define UAC2_DEF_INT_REQ_NUM	10
34 
35 struct f_uac2_opts {
36 	struct usb_function_instance	func_inst;
37 	int				p_chmask;
38 	int				p_srate;
39 	int				p_ssize;
40 	int				c_chmask;
41 	int				c_srate;
42 	int				c_ssize;
43 	int				c_sync;
44 
45 	bool			p_mute_present;
46 	bool			p_volume_present;
47 	s16				p_volume_min;
48 	s16				p_volume_max;
49 	s16				p_volume_res;
50 
51 	bool			c_mute_present;
52 	bool			c_volume_present;
53 	s16				c_volume_min;
54 	s16				c_volume_max;
55 	s16				c_volume_res;
56 
57 	int				req_number;
58 	int				fb_max;
59 	bool			bound;
60 
61 	struct mutex			lock;
62 	int				refcnt;
63 };
64 
65 #endif
66