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

Commit bdb92f0f authored by Devdutt Patnaik's avatar Devdutt Patnaik
Browse files

usb: f_gsi: Fix resume handling by making PM calls



Proper handling of RESUME in the GSI driver requires
a call to pm_runtime_get_noresume be made regardless
of remote wakeup flag sent from the host. Previously
a call to pm_runtime_get_noresume was missing in the
case of RESUME with remote wakeup disabled. Move all
pm_runtime_get_noresume calls to central place in
gsi_resume function.

CRs-Fixed: 998241
Change-Id: I9e0e7d41a959f31ec64700f51c8ab0f8410eb831
Signed-off-by: default avatarDevdutt Patnaik <dpatnaik@codeaurora.org>
parent 0b20839e
Loading
Loading
Loading
Loading
+10 −20
Original line number Diff line number Diff line
@@ -874,17 +874,7 @@ static void ipa_work_handler(struct work_struct *w)
		} else	if (event == EVT_RESUMED) {
			ipa_resume_work_handler(d_port);
			d_port->sm_state = STATE_CONNECTED;
			/*
			 * Increment usage count here to disallow gadget
			 * parent suspend. This counter will decrement
			 * after IPA disconnect is done in disconnect work
			 * (due to cable disconnect) or in suspended state.
			 */
			usb_gadget_autopm_get_noresume(d_port->gadget);
			log_event_dbg("%s: ST_SUS_IN_PROG_EVT_RES", __func__);
			log_event_dbg("%s: get_nores1 = %d", __func__,
					atomic_read(
						&gad_dev->power.usage_count));
		} else if (event == EVT_DISCONNECTED) {
			ipa_disconnect_work_handler(d_port);
			d_port->sm_state = STATE_INITIALIZED;
@@ -900,17 +890,7 @@ static void ipa_work_handler(struct work_struct *w)
		if (event == EVT_RESUMED) {
			ipa_resume_work_handler(d_port);
			d_port->sm_state = STATE_CONNECTED;
			/*
			 * Increment usage count here to disallow gadget
			 * parent suspend. This counter will decrement
			 * after IPA handshake is done in disconnect work
			 * (due to cable disconnect) or in suspended state.
			 */
			usb_gadget_autopm_get_noresume(d_port->gadget);
			log_event_dbg("%s: ST_SUS_EVT_RES", __func__);
			log_event_dbg("%s: get_nores2 = %d", __func__,
					atomic_read(
						&gad_dev->power.usage_count));
		} else if (event == EVT_DISCONNECTED) {
			ipa_disconnect_work_handler(d_port);
			d_port->sm_state = STATE_INITIALIZED;
@@ -2230,6 +2210,16 @@ static void gsi_resume(struct usb_function *f)
		f->func_is_suspended)
		return;

	/*
	 * Increment usage count here to disallow gadget
	 * parent suspend. This counter will decrement
	 * after IPA disconnect is done in disconnect work
	 * (due to cable disconnect) or in suspended state.
	 */
	usb_gadget_autopm_get_noresume(gsi->d_port.gadget);
	log_event_dbg("%s: get_noresume2 = %d", __func__,
			atomic_read(
			&gsi->d_port.gadget->dev.power.usage_count));
	if (f->config->cdev->gadget->speed == USB_SPEED_SUPER)
		remote_wakeup_allowed = f->func_wakeup_allowed;
	else