Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6dfece41 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Gerrit - the friendly Code Review server
Browse files

f_uac1: Remove unwanted descriptors for volume/mute support



Remove unwanted descriptors like dummy mic input descriptor and
related feature unit descriptor as those are not required for
volume/mute support for mic and speaker paths.

Change-Id: I93b2dbe114183212570229c3ccb89a36a4008917
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent b400e801
Loading
Loading
Loading
Loading
+6 −33
Original line number Diff line number Diff line
@@ -74,8 +74,8 @@ DECLARE_UAC_AC_HEADER_DESCRIPTOR(2);
#define UAC_DT_AC_HEADER_LENGTH	UAC_DT_AC_HEADER_SIZE(F_AUDIO_NUM_INTERFACES)
/* 2 input terminals and 2 output terminals */
#define UAC_DT_TOTAL_LENGTH (UAC_DT_AC_HEADER_LENGTH \
	+ 3*UAC_DT_INPUT_TERMINAL_SIZE + 2*UAC_DT_OUTPUT_TERMINAL_SIZE \
	+ 3*UAC_DT_FEATURE_UNIT_SIZE(0) + UAC_DT_MIXER_UNIT_SIZE)
	+ 2*UAC_DT_INPUT_TERMINAL_SIZE + 2*UAC_DT_OUTPUT_TERMINAL_SIZE \
	+ 2*UAC_DT_FEATURE_UNIT_SIZE(0) + UAC_DT_MIXER_UNIT_SIZE)
/* B.3.2  Class-Specific AC Interface Descriptor */
static struct uac1_ac_header_descriptor_2 ac_header_desc = {
	.bLength =		UAC_DT_AC_HEADER_LENGTH,
@@ -145,39 +145,16 @@ static struct uac_feature_unit_descriptor_0 feature_unit_desc = {
	.bmaControls[0]		= cpu_to_le16(UAC_FU_MUTE | UAC_FU_VOLUME),
};

#define MIC_IO_IN_IT_ID	7
static struct uac_input_terminal_descriptor mic_io_in_it_desc = {
	.bLength		= UAC_DT_INPUT_TERMINAL_SIZE,
	.bDescriptorType	= USB_DT_CS_INTERFACE,
	.bDescriptorSubtype	= UAC_INPUT_TERMINAL,
	.bTerminalID		= MIC_IO_IN_IT_ID,
	.wTerminalType		= cpu_to_le16(UAC_INPUT_TERMINAL_MICROPHONE),
	.bAssocTerminal		= 0,
	.bNrChannels		= 2,
	.wChannelConfig		= cpu_to_le16(0x3),
};

#define MID_FEATURE_UNIT_ID 10
static struct uac_feature_unit_descriptor_0 mid_feature_unit_desc = {
	.bLength		= UAC_DT_FEATURE_UNIT_SIZE(0),
	.bDescriptorType	= USB_DT_CS_INTERFACE,
	.bDescriptorSubtype	= UAC_FEATURE_UNIT,
	.bUnitID		= MID_FEATURE_UNIT_ID,
	.bSourceID		= MIC_IO_IN_IT_ID,
	.bControlSize		= 0x2,
	.bmaControls[0]		= cpu_to_le16(UAC_FU_MUTE | UAC_FU_VOLUME),
};

static struct uac_mixer_unit_descriptor mixer_unit_desc = {
static struct uac1_mixer_unit_descriptor mixer_unit_desc = {
	.bLength = UAC_DT_MIXER_UNIT_SIZE,
	.bDescriptorType = USB_DT_CS_INTERFACE,
	.bDescriptorSubtype = UAC_MIXER_UNIT,
	.bUnitID = MIXER_UNIT_ID,
	.bNrInPins = 2,
	.baSourceID[0] = USB_OUT_IT_ID,
	.baSourceID[1] = MID_FEATURE_UNIT_ID,
	.bNrChannels = 2,
	.wChannelConfig		= cpu_to_le16(0x3),
	.baSourceID[1] = MIC_FEATURE_UNIT_ID,
	.bNrChannels = 1,
	.wChannelConfig		= cpu_to_le16(0x1),
};

static struct uac_feature_unit_descriptor_0 mic_feature_unit_desc = {
@@ -387,9 +364,7 @@ static struct usb_descriptor_header *f_audio_desc[] = {

	(struct usb_descriptor_header *)&feature_unit_desc,
	(struct usb_descriptor_header *)&mic_feature_unit_desc,
	(struct usb_descriptor_header *)&mic_io_in_it_desc,
	(struct usb_descriptor_header *)&mixer_unit_desc,
	(struct usb_descriptor_header *)&mid_feature_unit_desc,

	(struct usb_descriptor_header *)&as_out_interface_alt_0_desc,
	(struct usb_descriptor_header *)&as_out_interface_alt_1_desc,
@@ -422,9 +397,7 @@ static struct usb_descriptor_header *f_audio_ss_desc[] = {

	(struct usb_descriptor_header *)&feature_unit_desc,
	(struct usb_descriptor_header *)&mic_feature_unit_desc,
	(struct usb_descriptor_header *)&mic_io_in_it_desc,
	(struct usb_descriptor_header *)&mixer_unit_desc,
	(struct usb_descriptor_header *)&mid_feature_unit_desc,

	(struct usb_descriptor_header *)&as_out_interface_alt_0_desc,
	(struct usb_descriptor_header *)&as_out_interface_alt_1_desc,
+16 −0
Original line number Diff line number Diff line
@@ -36,4 +36,20 @@ struct f_uac1_opts {
	int				refcnt;
};

#define UAC_DT_MIXER_UNIT_SIZE		13
/* 4.3.2.3 Mixer Unit Descriptor */
struct uac1_mixer_unit_descriptor {
	__u8 bLength;
	__u8 bDescriptorType;
	__u8 bDescriptorSubtype;
	__u8 bUnitID;
	__u8 bNrInPins;
	__u8 baSourceID[2];
	__u8  bNrChannels;
	__le16 wChannelConfig;
	__u8  iChannelNames;
	__u8 bmControls;
	__u8  iMixer;
} __packed;

#endif /* __U_UAC1_H */
+1 −6
Original line number Diff line number Diff line
@@ -254,7 +254,6 @@ struct uac_feature_unit_descriptor_##ch { \
	__u8  iFeature;						\
} __attribute__ ((packed))

#define UAC_DT_MIXER_UNIT_SIZE				13
/* 4.3.2.3 Mixer Unit Descriptor */
struct uac_mixer_unit_descriptor {
	__u8 bLength;
@@ -262,11 +261,7 @@ struct uac_mixer_unit_descriptor {
	__u8 bDescriptorSubtype;
	__u8 bUnitID;
	__u8 bNrInPins;
	__u8 baSourceID[2];
	__u8  bNrChannels;
	__le16 wChannelConfig;
	__u8  iChannelNames;
	__u8  iTerminal;
	__u8 baSourceID[];
} __attribute__ ((packed));

static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)