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

Commit a197a1ee authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: pd: Add support for enabling PD2.0 only as source



Some platforms doesn't support PD3.0 as source and only
PD2.0 needs to be supported as source. Else might see dp over
usb functionality not working as expected. Fix this by adding
support for PD2.0 only as source.

Change-Id: I39d5f008871e0914c4ca757e03fa4938f5d574a0
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent bf8e2cbe
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ Optional properties:
			capabilities in voltage (millivolts) and current
			(milliamps) pairs.
- qcom,no-usb3-dp-concurrency: If present, usb3 and dp concurrency is not supported.
- qcom,pd-20-source-only: If present, only PD2.0 is supported as source.

Example:
	qcom,qpnp-pdphy@1700 {
+13 −2
Original line number Diff line number Diff line
@@ -417,6 +417,7 @@ struct usbpd {
	bool			peer_pr_swap;
	bool			peer_dr_swap;
	bool			no_usb3dp_concurrency;
	bool			pd20_source_only;

	u32			sink_caps[7];
	int			num_sink_caps;
@@ -1400,6 +1401,9 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state)
			 * support up to PD 3.0; if peer is 2.0
			 * phy_msg_received() will handle the downgrade.
			 */
			if (pd->pd20_source_only)
				pd->spec_rev = USBPD_REV_20;
			else
				pd->spec_rev = USBPD_REV_30;

			if (pd->pd_phy_opened) {
@@ -2700,6 +2704,9 @@ static void usbpd_sm(struct work_struct *w)
		 * Emarker may have negotiated down to rev 2.0.
		 * Reset to 3.0 to begin SOP communication with sink
		 */
		if (pd->pd20_source_only)
			pd->spec_rev = USBPD_REV_20;
		else
			pd->spec_rev = USBPD_REV_30;

		pd->current_state = PE_SRC_SEND_CAPABILITIES;
@@ -4647,6 +4654,10 @@ struct usbpd *usbpd_create(struct device *parent)

	if (device_property_read_bool(parent, "qcom,no-usb3-dp-concurrency"))
		pd->no_usb3dp_concurrency = true;

	if (device_property_read_bool(parent, "qcom,pd-20-source-only"))
		pd->pd20_source_only = true;

	/*
	 * Register the Android dual-role class (/sys/class/dual_role_usb/).
	 * The first instance should be named "otg_default" as that's what