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

Commit 015edd29 authored by Ajay Agarwal's avatar Ajay Agarwal Committed by Hemant Kumar
Browse files

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



On some platforms, the objective is to keep the controller in
'none' mode if it is dual role capable and extcon is absent. User
can later switch to required mode from userspace or via sysfs.
Add required support for default 'none' mode based on DT property
'qcom,default-mode-none'.

Change-Id: I5ef968d02b9292eb6779615ee3cc8edc6ac13c3a
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent fa2de4e8
Loading
Loading
Loading
Loading
+22 −7
Original line number Diff line number Diff line
@@ -3675,16 +3675,31 @@ static int dwc3_msm_probe(struct platform_device *pdev)
			queue_delayed_work(mdwc->sm_usb_wq, &mdwc->sm_work, 0);
		}
	} else {
		if ((dwc3_is_otg_or_drd(dwc) &&
		     !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_DRD:
			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);