@@ -43,4 +43,6 @@ Description:
c_it_ch_name capture channels name
c_ot_name capture output terminal name
c_fu_vol_name capture mute/volume functional unit name
+ c_terminal_type code of the capture terminal type
+ p_terminal_type code of the playback terminal type
===================== =======================================
@@ -980,6 +980,8 @@ The uac1 function provides these attributes in its function directory:
c_it_ch_name capture channels name
c_ot_name capture output terminal name
c_fu_vol_name capture mute/volume functional unit name
+ c_terminal_type code of the capture terminal type
+ p_terminal_type code of the playback terminal type
================ ====================================================
The attributes have sane default values.
@@ -1277,6 +1277,8 @@ static void setup_descriptor(struct f_uac1_opts *opts)
as_out_header_desc.bTerminalLink = usb_out_it_desc.bTerminalID;
as_in_header_desc.bTerminalLink = usb_in_ot_desc.bTerminalID;
+ io_in_it_desc.wTerminalType = cpu_to_le16(opts->c_terminal_type);
+ io_out_ot_desc.wTerminalType = cpu_to_le16(opts->p_terminal_type);
ac_header_desc->wTotalLength = cpu_to_le16(ac_header_desc->bLength);
if (EPIN_EN(opts)) {
@@ -1898,6 +1900,9 @@ UAC1_ATTRIBUTE_STRING(c_it_ch_name);
UAC1_ATTRIBUTE_STRING(c_ot_name);
UAC1_ATTRIBUTE_STRING(c_fu_vol_name);
+UAC1_ATTRIBUTE(s16, p_terminal_type);
+UAC1_ATTRIBUTE(s16, c_terminal_type);
+
static struct configfs_attribute *f_uac1_attrs[] = {
&f_uac1_opts_attr_c_chmask,
&f_uac1_opts_attr_c_srate,
@@ -1935,6 +1940,9 @@ static struct configfs_attribute *f_uac1_attrs[] = {
&f_uac1_opts_attr_c_ot_name,
&f_uac1_opts_attr_c_fu_vol_name,
+ &f_uac1_opts_attr_p_terminal_type,
+ &f_uac1_opts_attr_c_terminal_type,
+
NULL,
};
@@ -2003,6 +2011,9 @@ static struct usb_function_instance *f_audio_alloc_inst(void)
scnprintf(opts->c_ot_name, sizeof(opts->c_ot_name), "Playback Output terminal");
scnprintf(opts->c_fu_vol_name, sizeof(opts->c_fu_vol_name), "Playback Volume");
+ opts->p_terminal_type = UAC1_DEF_P_TERM_TYPE;
+ opts->c_terminal_type = UAC1_DEF_C_TERM_TYPE;
+
return &opts->func_inst;
}
@@ -30,6 +30,8 @@
#define UAC1_DEF_MAX_DB 0 /* 0 dB */
#define UAC1_DEF_RES_DB (1*256) /* 1 dB */
+#define UAC1_DEF_P_TERM_TYPE UAC_INPUT_TERMINAL_MICROPHONE
+#define UAC1_DEF_C_TERM_TYPE UAC_OUTPUT_TERMINAL_SPEAKER
struct f_uac1_opts {
struct usb_function_instance func_inst;
@@ -71,6 +73,9 @@ struct f_uac1_opts {
char c_ot_name[USB_MAX_STRING_LEN];
char c_fu_vol_name[USB_MAX_STRING_LEN];
+ s16 p_terminal_type;
+ s16 c_terminal_type;
+
struct mutex lock;
int refcnt;
};