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

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

Merge "usb: pd: Add extcon_blocking_sync in start_usb_host"

parents 20c5cd8b 9a15b7d1
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)