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

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

Merge "ARM: msm: dts: Enable restarting usb host mode in HS for SDM660"

parents f543ef1d c03debd8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ Optional properties:
- qcom,default-sink-caps: List of 32-bit values representing the nominal sink
			capabilities in voltage (millivolts) and current
			(milliamps) pairs.
- qcom,no-usb3-dp-concurrency: If present, usb3 and dp concurrency is not supported.

Example:
	qcom,qpnp-pdphy@1700 {
+1 −0
Original line number Diff line number Diff line
@@ -365,6 +365,7 @@

			qcom,default-sink-caps = <5000 3000>, /* 5V @ 3A */
						 <9000 3000>; /* 9V @ 3A */
			qcom,no-usb3-dp-concurrency;
		};

		pm660_adc_tm: vadc@3400 {
+26 −0
Original line number Diff line number Diff line
@@ -388,6 +388,7 @@ struct usbpd {
	struct workqueue_struct	*wq;
	struct work_struct	sm_work;
	struct work_struct	start_periph_work;
	struct work_struct	restart_host_work;
	struct hrtimer		timer;
	bool			sm_queued;

@@ -415,6 +416,7 @@ struct usbpd {
	bool			peer_usb_comm;
	bool			peer_pr_swap;
	bool			peer_dr_swap;
	bool			no_usb3dp_concurrency;

	u32			sink_caps[7];
	int			num_sink_caps;
@@ -583,6 +585,26 @@ static void start_usb_peripheral_work(struct work_struct *w)
	dual_role_instance_changed(pd->dual_role);
}

static void restart_usb_host_work(struct work_struct *w)
{
	struct usbpd *pd = container_of(w, struct usbpd, restart_host_work);
	int ret;

	if (!pd->no_usb3dp_concurrency)
		return;

	stop_usb_host(pd);

	/* blocks until USB host is completely stopped */
	ret = extcon_blocking_sync(pd->extcon, EXTCON_USB_HOST, 0);
	if (ret) {
		usbpd_err(&pd->dev, "err(%d) stopping host", ret);
		return;
	}

	start_usb_host(pd, false);
}

/**
 * This API allows client driver to request for releasing SS lanes. It should
 * not be called from atomic context.
@@ -1889,6 +1911,7 @@ static void handle_vdm_rx(struct usbpd *pd, struct rx_msg *rx_msg)

		/* Set to USB and DP cocurrency mode */
		extcon_blocking_sync(pd->extcon, EXTCON_DISP_DP, 2);
		queue_work(pd->wq, &pd->restart_host_work);
	}

	/* if it's a supported SVID, pass the message to the handler */
@@ -4526,6 +4549,7 @@ struct usbpd *usbpd_create(struct device *parent)
	}
	INIT_WORK(&pd->sm_work, usbpd_sm);
	INIT_WORK(&pd->start_periph_work, start_usb_peripheral_work);
	INIT_WORK(&pd->restart_host_work, restart_usb_host_work);
	hrtimer_init(&pd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	pd->timer.function = pd_timeout;
	mutex_init(&pd->swap_lock);
@@ -4619,6 +4643,8 @@ struct usbpd *usbpd_create(struct device *parent)
		pd->num_sink_caps = ARRAY_SIZE(default_snk_caps);
	}

	if (device_property_read_bool(parent, "qcom,no-usb3-dp-concurrency"))
		pd->no_usb3dp_concurrency = true;
	/*
	 * Register the Android dual-role class (/sys/class/dual_role_usb/).
	 * The first instance should be named "otg_default" as that's what