• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "uac_common.h"
18 
19 #define UAC2_DEF_PCHMASK 0x3
20 #define UAC2_DEF_PSRATE 48000
21 #define UAC2_DEF_PSSIZE 2
22 #define UAC2_DEF_PHSBINT 0
23 #define UAC2_DEF_CCHMASK 0x3
24 #define UAC2_DEF_CSRATE 64000
25 #define UAC2_DEF_CSSIZE 2
26 #define UAC2_DEF_CHSBINT 0
27 #define UAC2_DEF_CSYNC		USB_ENDPOINT_SYNC_ASYNC
28 
29 #define UAC2_DEF_MUTE_PRESENT	1
30 #define UAC2_DEF_VOLUME_PRESENT 1
31 #define UAC2_DEF_MIN_DB		(-100*256)	/* -100 dB */
32 #define UAC2_DEF_MAX_DB		0		/* 0 dB */
33 #define UAC2_DEF_RES_DB		(1*256)		/* 1 dB */
34 
35 #define UAC2_DEF_REQ_NUM 2
36 #define UAC2_DEF_INT_REQ_NUM	10
37 
38 struct f_uac2_opts {
39 	struct usb_function_instance	func_inst;
40 	int				p_chmask;
41 	int				p_srates[UAC_MAX_RATES];
42 	int				p_ssize;
43 	u8				p_hs_bint;
44 	int				c_chmask;
45 	int				c_srates[UAC_MAX_RATES];
46 	int				c_ssize;
47 	int				c_sync;
48 	u8				c_hs_bint;
49 
50 	bool			p_mute_present;
51 	bool			p_volume_present;
52 	s16				p_volume_min;
53 	s16				p_volume_max;
54 	s16				p_volume_res;
55 
56 	bool			c_mute_present;
57 	bool			c_volume_present;
58 	s16				c_volume_min;
59 	s16				c_volume_max;
60 	s16				c_volume_res;
61 
62 	int				req_number;
63 	int				fb_max;
64 	bool			bound;
65 
66 	char			function_name[32];
67 
68 	struct mutex			lock;
69 	int				refcnt;
70 };
71 
72 #endif
73