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

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

UAC1: Add configfs attribute for changing ep max packet size



Currently UAC1 driver is setting to 200 which works in case of
2 channels and sample size of 16 bits. If sample size is changed
to 24 from 16, needs to change endpoint max packet size to fix
audio quality issues. Hence add configfs attribute through which it
can be changed before switching UAC composition.

Change-Id: I8061a9bed4a8894543399cf95cdb60b6ead97e62
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent c2bfb85b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -854,6 +854,10 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)

	status = -ENODEV;

	audio_opts->ep_maxp_size = clamp(audio_opts->ep_maxp_size, 1U, 1023U);
	as_out_ep_desc.wMaxPacketSize = cpu_to_le16(audio_opts->ep_maxp_size);
	as_in_ep_desc.wMaxPacketSize = cpu_to_le16(audio_opts->ep_maxp_size);

	/* allocate instance-specific endpoints */
	ep = usb_ep_autoconfig(cdev->gadget, &as_out_ep_desc);
	if (!ep)
@@ -1003,6 +1007,7 @@ UAC1_ATTRIBUTE(p_chmask);
UAC1_ATTRIBUTE(p_srate);
UAC1_ATTRIBUTE(p_ssize);
UAC1_ATTRIBUTE(req_number);
UAC1_ATTRIBUTE(ep_maxp_size);

static ssize_t f_uac1_opts_speaker_volume_show(struct config_item *item,
								char *page)
@@ -1139,6 +1144,7 @@ static struct configfs_attribute *f_uac1_attrs[] = {
	&f_uac1_opts_attr_mic_volume,
	&f_uac1_opts_attr_speaker_mute,
	&f_uac1_opts_attr_mic_mute,
	&f_uac1_opts_attr_ep_maxp_size,
	NULL,
};

@@ -1177,6 +1183,7 @@ static struct usb_function_instance *f_audio_alloc_inst(void)
	opts->p_srate = UAC1_DEF_PSRATE;
	opts->p_ssize = UAC1_DEF_PSSIZE;
	opts->req_number = UAC1_DEF_REQ_NUM;
	opts->ep_maxp_size = UAC1_OUT_EP_MAX_PACKET_SIZE;
	return &opts->func_inst;
}

+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ struct f_uac1_opts {
	int				p_srate;
	int				p_ssize;
	int				req_number;
	unsigned int			ep_maxp_size;
	unsigned			bound:1;

	struct mutex			lock;