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

Commit 1e270c3e authored by Devdutt Patnaik's avatar Devdutt Patnaik
Browse files

usb: f_gsi: Ignore supsend/resume events if data interface is not selected



Usually the GSI disconnect handler is invoked on disconnect
and bus suspend (with remote wakeup disabled) conditions.
However, for functions such as MBIM that support alternate
data interface, suspend/resume handling becomes a no-op
if the data interface is not selected. One such example
is disabling/enabling network device from device manager.
This operation explicitly disables data interface
and subsequent suspend/resume operations become no-ops.

CRs-Fixed: 946385

Change-Id: Idaf240ed5253f61880c05a1b11d87d4979d474c9
Signed-off-by: default avatarDevdutt Patnaik <dpatnaik@codeaurora.org>
parent b474e6d3
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -2055,6 +2055,10 @@ static int gsi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
			(gsi->d_port.out_ep &&
			!gsi->d_port.out_ep->driver_data))) {
				ipa_disconnect_handler(&gsi->d_port);
				post_event(&gsi->d_port, EVT_DISCONNECTED);
				queue_work(gsi->d_port.ipa_usb_wq,
						&gsi->d_port.usb_ipa_w);
				log_event_dbg("%s: Disconnecting\n", __func__);
			}

		gsi->data_interface_up = alt;
@@ -2116,6 +2120,11 @@ static void gsi_suspend(struct usb_function *f)
	struct f_gsi *gsi = func_to_gsi(f);
	bool remote_wakeup_allowed;

	if (!gsi->data_interface_up) {
		log_event_dbg("%s: Data interface not up\n", __func__);
		return;
	}

	/* Check if function is already suspended in gsi_func_suspend() */
	if (f->func_is_suspended) {
		log_event_dbg("%s: func already suspended, return\n", __func__);
@@ -2169,6 +2178,11 @@ static void gsi_resume(struct usb_function *f)

	log_event_dbg("%s", __func__);

	if (!gsi->data_interface_up) {
		log_event_dbg("%s: Data interface not up\n", __func__);
		return;
	}

	/*
	 * If the function is in USB3 Function Suspend state, resume is
	 * canceled. In this case resume is done by a Function Resume request.