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 #define UAC2_DEF_P_TERM_TYPE 0x301 39 /* UAC_OUTPUT_TERMINAL_SPEAKER */ 40 #define UAC2_DEF_C_TERM_TYPE 0x201 41 /* UAC_INPUT_TERMINAL_MICROPHONE*/ 42 43 struct f_uac2_opts { 44 struct usb_function_instance func_inst; 45 int p_chmask; 46 int p_srates[UAC_MAX_RATES]; 47 int p_ssize; 48 u8 p_hs_bint; 49 int c_chmask; 50 int c_srates[UAC_MAX_RATES]; 51 int c_ssize; 52 int c_sync; 53 u8 c_hs_bint; 54 55 bool p_mute_present; 56 bool p_volume_present; 57 s16 p_volume_min; 58 s16 p_volume_max; 59 s16 p_volume_res; 60 61 bool c_mute_present; 62 bool c_volume_present; 63 s16 c_volume_min; 64 s16 c_volume_max; 65 s16 c_volume_res; 66 67 int req_number; 68 int fb_max; 69 bool bound; 70 71 char function_name[USB_MAX_STRING_LEN]; 72 char if_ctrl_name[USB_MAX_STRING_LEN]; 73 char clksrc_in_name[USB_MAX_STRING_LEN]; 74 char clksrc_out_name[USB_MAX_STRING_LEN]; 75 76 char p_it_name[USB_MAX_STRING_LEN]; 77 char p_it_ch_name[USB_MAX_STRING_LEN]; 78 char p_ot_name[USB_MAX_STRING_LEN]; 79 char p_fu_vol_name[USB_MAX_STRING_LEN]; 80 81 char c_it_name[USB_MAX_STRING_LEN]; 82 char c_it_ch_name[USB_MAX_STRING_LEN]; 83 char c_ot_name[USB_MAX_STRING_LEN]; 84 char c_fu_vol_name[USB_MAX_STRING_LEN]; 85 86 s16 p_terminal_type; 87 s16 c_terminal_type; 88 89 struct mutex lock; 90 int refcnt; 91 }; 92 93 #endif 94