GNU Linux-libre 6.8.7-gnu
[releases.git] / drivers / usb / gadget / function / u_uac1.h
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[32];
56
57         struct mutex                    lock;
58         int                             refcnt;
59 };
60
61 #endif /* __U_UAC1_H */