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

Commit 9a15b7d1 authored by Rohith Kollalsi's avatar Rohith Kollalsi Committed by Gerrit - the friendly Code Review server
Browse files

usb: pd: Add extcon_blocking_sync in start_usb_host



Currently dp_notifier is getting called before usb
host mode is setup which is causing issue in setting
up usb_dp_combo mode due to which timeouts from dp
driver are seen.

This change blocks everything until usb host is
completely started ensuring usb_dp_combo mode is
successfully set, thus fixing the issue.

Change-Id: Iabddfbdf7f97edd3e4b655c833df246100892c2c
Signed-off-by: default avatarRohith Kollalsi <rkollals@codeaurora.org>
parent f8b00cea
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/completion.h>
@@ -539,6 +539,7 @@ static inline void start_usb_host(struct usbpd *pd, bool ss)
{
	enum plug_orientation cc = usbpd_get_plug_orientation(pd);
	union extcon_property_value val;
	int ret = 0;

	val.intval = (cc == ORIENTATION_CC2);
	extcon_set_property(pd->extcon, EXTCON_USB_HOST,
@@ -549,6 +550,13 @@ static inline void start_usb_host(struct usbpd *pd, bool ss)
			EXTCON_PROP_USB_SS, val);

	extcon_set_state_sync(pd->extcon, EXTCON_USB_HOST, 1);

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

static inline void stop_usb_peripheral(struct usbpd *pd)