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

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

Merge "usb: dwc3-msm: Add support for default none mode if extcon absent"

parents b240176c be53d5c4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -84,6 +84,8 @@ Optional properties :
- qcom,host-poweroff-in-pm-suspend: If present, allow PM suspend to happen
	irrespective of runtimePM state of host and power collapse the core.
	This also leads to reset-resume of connected devices on PM resume.
- qcom,default-mode-none: If present, do not start any mode on probe for an OTG
	capable DWC3 which does not have extcon handle.
- qcom,default-mode-host: If present, start host mode on probe for an OTG
	capable DWC3 which does not have extcon handle.

+23 −8
Original line number Diff line number Diff line
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -3753,16 +3753,31 @@ static int dwc3_msm_probe(struct platform_device *pdev)
			queue_delayed_work(mdwc->sm_usb_wq, &mdwc->sm_work, 0);
		}
	} else {
		if ((dwc->dr_mode == USB_DR_MODE_OTG &&
		     !of_property_read_bool(node, "qcom,default-mode-host")) ||
		     dwc->dr_mode == USB_DR_MODE_PERIPHERAL) {
			dev_dbg(mdwc->dev, "%s: no extcon, start peripheral mode\n",
		switch (dwc->dr_mode) {
		case USB_DR_MODE_OTG:
			if (of_property_read_bool(node,
						"qcom,default-mode-host")) {
				dev_dbg(mdwc->dev, "%s: start host mode\n",
								__func__);
				mdwc->id_state = DWC3_ID_GROUND;
			} else if (of_property_read_bool(node,
						"qcom,default-mode-none")) {
				dev_dbg(mdwc->dev, "%s: stay in none mode\n",
								__func__);
			mdwc->vbus_active = true;
			} else {
			dev_dbg(mdwc->dev, "%s: no extcon, start host mode\n",
				dev_dbg(mdwc->dev, "%s: start peripheral mode\n",
								__func__);
				mdwc->vbus_active = true;
			}
			break;
		case USB_DR_MODE_HOST:
			mdwc->id_state = DWC3_ID_GROUND;
			break;
		case USB_DR_MODE_PERIPHERAL:
			/* fall through */
		default:
			mdwc->vbus_active = true;
			break;
		}

		dwc3_ext_event_notify(mdwc);