From 7367915c0bf89ce77187a1d850e7ce6f6cae9281 Mon Sep 17 00:00:00 2001 From: Skylar Chang Date: Thu, 5 May 2016 10:08:09 -0700 Subject: [PATCH] msm: ipa3: drain UL data for ECM/RNDIS tethering In some cases modem will delay USB uplink pipe for flow control. This will happen regardless of tethering protocol. This change sends a QMI message to modem to remove the delay on USB pipe in case of USB cable disconnect. CRs-Fixed: 1009199 Change-Id: I42cd716dcb87b814256a81418fecdff020f37d9d Acked-by: Ady Abraham Signed-off-by: Skylar Chang --- drivers/platform/msm/ipa/ipa_clients/ipa_usb.c | 14 ++++---------- drivers/platform/msm/ipa/ipa_v3/ipa_client.c | 9 ++++++--- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c b/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c index 3bcdf3e8454c..d7a987335dda 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c @@ -2125,16 +2125,13 @@ int ipa_usb_xdci_disconnect(u32 ul_clnt_hdl, u32 dl_clnt_hdl, flags); /* Stop UL channel */ result = ipa3_xdci_disconnect(ul_clnt_hdl, - (teth_prot == IPA_USB_RMNET || - teth_prot == IPA_USB_MBIM), + true, ipa3_usb_ctx->qmi_req_id); if (result) { IPA_USB_ERR("failed disconnect UL channel\n"); goto bad_params; } - if (teth_prot == IPA_USB_RMNET || - teth_prot == IPA_USB_MBIM) - ipa3_usb_ctx->qmi_req_id++; + ipa3_usb_ctx->qmi_req_id++; } else spin_unlock_irqrestore(&ipa3_usb_ctx->state_lock, flags); @@ -2363,16 +2360,13 @@ int ipa_usb_xdci_suspend(u32 ul_clnt_hdl, u32 dl_clnt_hdl, /* Stop UL channel & suspend DL/DPL EP */ result = ipa3_xdci_suspend(ul_clnt_hdl, dl_clnt_hdl, - (teth_prot == IPA_USB_RMNET || - teth_prot == IPA_USB_MBIM), + true, ipa3_usb_ctx->qmi_req_id, IPA3_USB_IS_TTYPE_DPL(ttype)); if (result) { IPA_USB_ERR("failed to suspend\n"); goto suspend_fail; } - if (teth_prot == IPA_USB_RMNET || - teth_prot == IPA_USB_MBIM) - ipa3_usb_ctx->qmi_req_id++; + ipa3_usb_ctx->qmi_req_id++; result = ipa3_usb_release_prod(ttype); if (result) { diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_client.c b/drivers/platform/msm/ipa/ipa_v3/ipa_client.c index 3496a0f4f5fc..c1a7fdbd12d4 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_client.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_client.c @@ -1404,7 +1404,10 @@ static int ipa3_xdci_stop_gsi_channel(u32 clnt_hdl, bool *stop_in_proc) return -EFAULT; } - *stop_in_proc = res; + if (res) + *stop_in_proc = true; + else + *stop_in_proc = false; IPADBG("xDCI channel is %s (result=%d)\n", res ? "STOP_IN_PROC/TimeOut" : "STOP", res); @@ -1509,7 +1512,7 @@ static int ipa3_stop_ul_chan_with_data_drain(u32 qmi_req_id, } /* if still stop_in_proc or not empty, activate force clear */ if (should_force_clear) { - result = ipa3_enable_force_clear(qmi_req_id, true, + result = ipa3_enable_force_clear(qmi_req_id, false, source_pipe_bitmask); if (result) goto exit; @@ -1536,7 +1539,7 @@ static int ipa3_stop_ul_chan_with_data_drain(u32 qmi_req_id, disable_force_clear_and_exit: if (should_force_clear) - result = ipa3_disable_force_clear(qmi_req_id); + ipa3_disable_force_clear(qmi_req_id); exit: return result; } -- 2.11.0