xref: /openbmc/linux/drivers/usb/gadget/function/u_uac2.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
12e759738SNishad Kamdar /* SPDX-License-Identifier: GPL-2.0 */
2f8f93d24SAndrzej Pietrasiewicz /*
3f8f93d24SAndrzej Pietrasiewicz  * u_uac2.h
4f8f93d24SAndrzej Pietrasiewicz  *
5f8f93d24SAndrzej Pietrasiewicz  * Utility definitions for UAC2 function
6f8f93d24SAndrzej Pietrasiewicz  *
7f8f93d24SAndrzej Pietrasiewicz  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
8f8f93d24SAndrzej Pietrasiewicz  *		http://www.samsung.com
9f8f93d24SAndrzej Pietrasiewicz  *
101b4a3b51SAndrzej Pietrasiewicz  * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
11f8f93d24SAndrzej Pietrasiewicz  */
12f8f93d24SAndrzej Pietrasiewicz 
13f8f93d24SAndrzej Pietrasiewicz #ifndef U_UAC2_H
14f8f93d24SAndrzej Pietrasiewicz #define U_UAC2_H
15f8f93d24SAndrzej Pietrasiewicz 
16f8f93d24SAndrzej Pietrasiewicz #include <linux/usb/composite.h>
17a7339e4fSJulian Scheel #include "uac_common.h"
18f8f93d24SAndrzej Pietrasiewicz 
19065a107cSAndrzej Pietrasiewicz #define UAC2_DEF_PCHMASK 0x3
20065a107cSAndrzej Pietrasiewicz #define UAC2_DEF_PSRATE 48000
21065a107cSAndrzej Pietrasiewicz #define UAC2_DEF_PSSIZE 2
22*355a05dcSPavel Hofman #define UAC2_DEF_PHSBINT 0
23065a107cSAndrzej Pietrasiewicz #define UAC2_DEF_CCHMASK 0x3
24065a107cSAndrzej Pietrasiewicz #define UAC2_DEF_CSRATE 64000
25065a107cSAndrzej Pietrasiewicz #define UAC2_DEF_CSSIZE 2
26*355a05dcSPavel Hofman #define UAC2_DEF_CHSBINT 0
2740c73b30SRuslan Bilovol #define UAC2_DEF_CSYNC		USB_ENDPOINT_SYNC_ASYNC
28eaf6cbe0SRuslan Bilovol 
29eaf6cbe0SRuslan Bilovol #define UAC2_DEF_MUTE_PRESENT	1
30eaf6cbe0SRuslan Bilovol #define UAC2_DEF_VOLUME_PRESENT 1
31eaf6cbe0SRuslan Bilovol #define UAC2_DEF_MIN_DB		(-100*256)	/* -100 dB */
32eaf6cbe0SRuslan Bilovol #define UAC2_DEF_MAX_DB		0		/* 0 dB */
33eaf6cbe0SRuslan Bilovol #define UAC2_DEF_RES_DB		(1*256)		/* 1 dB */
34eaf6cbe0SRuslan Bilovol 
35e92b9d44SPeter Chen #define UAC2_DEF_REQ_NUM 2
36eaf6cbe0SRuslan Bilovol #define UAC2_DEF_INT_REQ_NUM	10
37065a107cSAndrzej Pietrasiewicz 
38f8f93d24SAndrzej Pietrasiewicz struct f_uac2_opts {
39f8f93d24SAndrzej Pietrasiewicz 	struct usb_function_instance	func_inst;
40f8f93d24SAndrzej Pietrasiewicz 	int				p_chmask;
41a7339e4fSJulian Scheel 	int				p_srates[UAC_MAX_RATES];
42f8f93d24SAndrzej Pietrasiewicz 	int				p_ssize;
434ed941a9SPavel Hofman 	u8				p_hs_bint;
44f8f93d24SAndrzej Pietrasiewicz 	int				c_chmask;
45a7339e4fSJulian Scheel 	int				c_srates[UAC_MAX_RATES];
46f8f93d24SAndrzej Pietrasiewicz 	int				c_ssize;
4740c73b30SRuslan Bilovol 	int				c_sync;
484ed941a9SPavel Hofman 	u8				c_hs_bint;
49eaf6cbe0SRuslan Bilovol 
50eaf6cbe0SRuslan Bilovol 	bool			p_mute_present;
51eaf6cbe0SRuslan Bilovol 	bool			p_volume_present;
52eaf6cbe0SRuslan Bilovol 	s16				p_volume_min;
53eaf6cbe0SRuslan Bilovol 	s16				p_volume_max;
54eaf6cbe0SRuslan Bilovol 	s16				p_volume_res;
55eaf6cbe0SRuslan Bilovol 
56eaf6cbe0SRuslan Bilovol 	bool			c_mute_present;
57eaf6cbe0SRuslan Bilovol 	bool			c_volume_present;
58eaf6cbe0SRuslan Bilovol 	s16				c_volume_min;
59eaf6cbe0SRuslan Bilovol 	s16				c_volume_max;
60eaf6cbe0SRuslan Bilovol 	s16				c_volume_res;
61eaf6cbe0SRuslan Bilovol 
62e92b9d44SPeter Chen 	int				req_number;
63e89bb428SRuslan Bilovol 	int				fb_max;
64f8f93d24SAndrzej Pietrasiewicz 	bool			bound;
653aeea3c5SAndrzej Pietrasiewicz 
66993a44faSYunhao Tian 	char			function_name[32];
67993a44faSYunhao Tian 
683aeea3c5SAndrzej Pietrasiewicz 	struct mutex			lock;
693aeea3c5SAndrzej Pietrasiewicz 	int				refcnt;
70f8f93d24SAndrzej Pietrasiewicz };
71f8f93d24SAndrzej Pietrasiewicz 
72f8f93d24SAndrzej Pietrasiewicz #endif
73