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

Commit aaac570a authored by Sriharsha Allenki's avatar Sriharsha Allenki Committed by Gerrit - the friendly Code Review server
Browse files

usb: gadget: Add support for fifo resize of user specified IN endpoint



Add support for high bandwidth transfer on Isochronous IN
endpoint by allowing fifo_resize on a particular endpoint using
high_bw_ep_in_num module parameter.
To enable fifo resize so as to support high bandwidth transfers
on Isoc IN endpoint:
1. echo 0 > /sys/class/android_usb/android0/enable
2. echo <ep_num> > /sys/module/dwc3/parameters/high_bw_ep_in_num
3. echo 1 > /sys/class/android_usb/android0/enable

CRs-fixed: 2043149
Change-Id: I2bae02cb5e33ccd15622acf4a4e160452b670d96
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
parent 9e0838c6
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -41,6 +43,16 @@
static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc, bool remote_wakeup);
static int dwc3_gadget_wakeup_int(struct dwc3 *dwc);

/*
 * Some USB functions' endpoints are not enabled at set config stage.
 * So fifo_resize cannot happen for these endpoints.
 * So, user can specify Isochronous IN endpoint using high_bw_ep_in_num
 * to enable fifo_resize to support high bandwidth transfers.
 */
static int high_bw_ep_in_num;
module_param(high_bw_ep_in_num, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(high_bw_ep_in_num,
		"Isoc ep number to support for HS high bandwidth transfer");
/**
 * dwc3_gadget_set_test_mode - Enables USB2 Test Modes
 * @dwc: pointer to our context structure
@@ -216,6 +228,9 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc)
				dep->endpoint.endless)
			mult = 3;

		if (num == high_bw_ep_in_num)
			mult = 3;

		if (!(dep->flags & DWC3_EP_ENABLED)) {
			dev_dbg(dwc->dev, "ep%dIn not enabled", num);
			goto resize_fifo;