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

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

Merge "dwc3-msm: Move override usb speed functionality outside edev check"

parents 01bf131a 2965c6b6
Loading
Loading
Loading
Loading
+16 −20
Original line number Diff line number Diff line
@@ -2977,7 +2977,6 @@ static void dwc3_resume_work(struct work_struct *w)
	struct extcon_dev *edev = NULL;
	const char *edev_name;
	char *eud_str;
	bool eud_connected = false;
	int ret = 0;

	dev_dbg(mdwc->dev, "%s: dwc3 resume work\n", __func__);
@@ -2995,32 +2994,17 @@ static void dwc3_resume_work(struct work_struct *w)
		/* Skip querying speed and cc_state for EUD edev */
		eud_str = strnstr(edev_name, "eud", strlen(edev_name));
		if (eud_str)
			eud_connected = true;
			goto skip_update;
	}

	/* Check speed and Type-C polarity values in order to configure PHY */
	if (!eud_connected && edev && extcon_get_state(edev, extcon_id)) {
	dwc->maximum_speed = dwc->max_hw_supp_speed;
		dwc->gadget.max_speed = dwc->maximum_speed;

	/* Check speed and Type-C polarity values in order to configure PHY */
	if (edev && extcon_get_state(edev, extcon_id)) {
		ret = extcon_get_property(edev, extcon_id,
				EXTCON_PROP_USB_SS, &val);

		if (!ret && val.intval == 0) {
		if (!ret && val.intval == 0)
			dwc->maximum_speed = USB_SPEED_HIGH;
			dwc->gadget.max_speed = dwc->maximum_speed;
		}

		if (mdwc->override_usb_speed &&
			mdwc->override_usb_speed <= dwc->maximum_speed) {
			dwc->maximum_speed = mdwc->override_usb_speed;
			dwc->gadget.max_speed = dwc->maximum_speed;
			dbg_event(0xFF, "override_speed",
					mdwc->override_usb_speed);
			mdwc->override_usb_speed = 0;
		}

		dbg_event(0xFF, "speed", dwc->maximum_speed);

		ret = extcon_get_property(edev, extcon_id,
				EXTCON_PROP_USB_TYPEC_POLARITY, &val);
@@ -3040,6 +3024,18 @@ static void dwc3_resume_work(struct work_struct *w)
			dwc->gadget.is_selfpowered = 0;
	}

skip_update:
	dbg_log_string("max_speed:%d hw_supp_speed:%d override_speed:%d",
		dwc->maximum_speed, dwc->max_hw_supp_speed,
		mdwc->override_usb_speed);
	if (mdwc->override_usb_speed &&
			mdwc->override_usb_speed <= dwc->maximum_speed) {
		dwc->maximum_speed = mdwc->override_usb_speed;
		dwc->gadget.max_speed = dwc->maximum_speed;
	}

	dbg_event(0xFF, "speed", dwc->maximum_speed);

	/*
	 * Skip scheduling sm work if no work is pending. When boot-up
	 * with USB cable connected, usb state m/c is skipped to avoid