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

Commit d7006445 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: dwc3-msm: Prevent switch to peripheral for host-mode only core"

parents 4918c41c 83e10419
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3869,8 +3869,14 @@ static ssize_t mode_store(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{
	struct dwc3_msm *mdwc = dev_get_drvdata(dev);
	struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);

	if (sysfs_streq(buf, "peripheral")) {
		if (dwc->dr_mode == USB_DR_MODE_HOST) {
			dev_err(dev, "Core supports host mode only.\n");
			return -EINVAL;
		}

		mdwc->vbus_active = true;
		mdwc->id_state = DWC3_ID_FLOAT;
	} else if (sysfs_streq(buf, "host")) {