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

Commit a9c26b07 authored by Chandana Kishori Chiluveru's avatar Chandana Kishori Chiluveru
Browse files

USB: dwc3-msm: Add module parameter to disable host mode



Non-compliant type-c cables may result in continuous ID change
between high and low. This results in controller driver continuously
performing start_host and stop_host. There are some issue in USB core
causing crashes when this happens continuously for longer times. Until
these issues are fixed expose a module parameter for users to
disable host mode to avoid crashes:

Use below command to disable USB host mode through module parameter:
echo 1 > /sys/module/dwc3_msm/parameters/disable_host_mode

Change-Id: I3e286f7a9ef9dc5a1131a04a72d4819a58d4e9e3
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
parent fc23af4e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -66,6 +66,10 @@ static int cpu_to_affin;
module_param(cpu_to_affin, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(cpu_to_affin, "affin usb irq to this cpu");

static bool disable_host_mode;
module_param(disable_host_mode, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(disable_host_mode, "To stop HOST mode detection");

static int override_phy_init;
module_param(override_phy_init, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(override_phy_init, "Override HSPHY Init Seq");
@@ -2372,6 +2376,12 @@ static int dwc3_msm_power_set_property_usb(struct power_supply *psy,
		if (mdwc->id_state == id)
			break;

		if (disable_host_mode && !id) {
			dev_dbg(mdwc->dev, "%s: Ignoring ID change event :%d\n",
						__func__, mdwc->id_state);
			break;
		}

		/* Let OTG know about ID detection */
		mdwc->id_state = id;
		dbg_event(0xFF, "id_state", mdwc->id_state);