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

Commit e071f813 authored by Ajay Agarwal's avatar Ajay Agarwal
Browse files

USB: f_audio_source: Increase the IN endpoint buffer allocation



Some UDC may require allocation of some extra bytes for TX buffer
due to hardware requirement. Add necessary changes for the same.

Change-Id: I3cedcb6e63d2c8c08d17717fa0d8ce692381b1ea
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent 9d4600a1
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -337,14 +337,15 @@ static struct device_attribute *audio_source_function_attributes[] = {

/*--------------------------------------------------------------------------*/

static struct usb_request *audio_request_new(struct usb_ep *ep, int buffer_size)
static struct usb_request *audio_request_new(struct usb_ep *ep, int buffer_size,
					size_t extra_buf_alloc)
{
	struct usb_request *req = usb_ep_alloc_request(ep, GFP_KERNEL);

	if (!req)
		return NULL;

	req->buf = kmalloc(buffer_size, GFP_KERNEL);
	req->buf = kmalloc(buffer_size + extra_buf_alloc, GFP_KERNEL);
	if (!req->buf) {
		usb_ep_free_request(ep, req);
		return NULL;
@@ -748,7 +749,8 @@ audio_bind(struct usb_configuration *c, struct usb_function *f)
	f->ss_descriptors = ss_audio_desc;

	for (i = 0, status = 0; i < IN_EP_REQ_COUNT && status == 0; i++) {
		req = audio_request_new(ep, IN_EP_MAX_PACKET_SIZE);
		req = audio_request_new(ep, IN_EP_MAX_PACKET_SIZE,
						cdev->gadget->extra_buf_alloc);
		if (req) {
			req->context = audio;
			req->complete = audio_data_complete;