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

Commit 917f4c3e authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Gerrit - the friendly Code Review server
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>
Signed-off-by: default avatarChetan C R <cchinnad@codeaurora.org>
parent 91eff369
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -408,6 +408,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;
@@ -2129,6 +2130,10 @@ static int usbpd_startup_common(struct usbpd *pd,
		 * support up to PD 3.0; if peer is 2.0
		 * phy_msg_received() will handle the downgrade.
		 */
		if ((pd->pd20_source_only) &&
			pd->current_state == PE_SRC_STARTUP)
			pd->spec_rev = USBPD_REV_20;
		else
			pd->spec_rev = USBPD_REV_30;

		if (pd->pd_phy_opened) {
@@ -2257,6 +2262,9 @@ static void handle_state_src_startup_wait_for_vdm_resp(struct usbpd *pd,
	 * 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;
@@ -4798,6 +4806,9 @@ struct usbpd *usbpd_create(struct device *parent)
		pd->num_sink_caps = ARRAY_SIZE(default_snk_caps);
	}

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

	/*
	 * Register a Type-C class instance (/sys/class/typec/portX).
	 * Note this is different than the /sys/class/usbpd/ created above.