qcacmn: Use zero timeout in non interrupt mode during force wake

Currently we use a single timeout value of FORCE_WAKE_DELAY_TIMEOUT_MS
during hif_force_wake_request. A 50ms value is not enough in some cases
to bring MHI to M0 from M2/M3_fast states. This can result in a write
failure.

In certain cases, when not in an interrupt context, it should be okay
to wait slightly longer for MHI to transition into M0.
Hence, pass 0 as the timeout value to pld_force_wake_request_sync.
This API calls CNSS API which uses a blocking call -  mhi_device_get_sync,
to transition MHI to M0, when a value of zero is passed.

Change-Id: I738bf9c4a9a83c943186445cba0174df18a45c74
CRs-Fixed: 2766674
This commit is contained in:
Mohit Khanna
2020-09-10 01:46:21 -07:00
gecommit door snandini
bovenliggende bc64bbccf3
commit 8e57f126b5

Bestand weergeven

@@ -3588,14 +3588,18 @@ bool hif_pci_needs_bmi(struct hif_softc *scn)
#ifdef DEVICE_FORCE_WAKE_ENABLE
int hif_force_wake_request(struct hif_opaque_softc *hif_handle)
{
uint32_t timeout = 0, value;
uint32_t timeout, value;
struct hif_softc *scn = (struct hif_softc *)hif_handle;
struct hif_pci_softc *pci_scn = HIF_GET_PCI_SOFTC(scn);
HIF_STATS_INC(pci_scn, mhi_force_wake_request_vote, 1);
if (pld_force_wake_request_sync(scn->qdf_dev->dev,
FORCE_WAKE_DELAY_TIMEOUT_MS * 1000)) {
if (qdf_in_interrupt())
timeout = FORCE_WAKE_DELAY_TIMEOUT_MS * 1000;
else
timeout = 0;
if (pld_force_wake_request_sync(scn->qdf_dev->dev, timeout)) {
hif_err("force wake request send failed");
HIF_STATS_INC(pci_scn, mhi_force_wake_failure, 1);
return -EINVAL;
@@ -3623,6 +3627,7 @@ int hif_force_wake_request(struct hif_opaque_softc *hif_handle)
* do not reset the timeout
* total_wake_time = MHI_WAKE_TIME + PCI_WAKE_TIME < 50 ms
*/
timeout = 0;
do {
value =
hif_read32_mb(scn,
@@ -3654,11 +3659,16 @@ int hif_force_wake_request(struct hif_opaque_softc *hif_handle)
{
struct hif_softc *scn = (struct hif_softc *)hif_handle;
struct hif_pci_softc *pci_scn = HIF_GET_PCI_SOFTC(scn);
uint32_t timeout;
HIF_STATS_INC(pci_scn, mhi_force_wake_request_vote, 1);
if (pld_force_wake_request_sync(scn->qdf_dev->dev,
FORCE_WAKE_DELAY_TIMEOUT_MS * 1000)) {
if (qdf_in_interrupt())
timeout = FORCE_WAKE_DELAY_TIMEOUT_MS * 1000;
else
timeout = 0;
if (pld_force_wake_request_sync(scn->qdf_dev->dev, timeout)) {
hif_err("force wake request send failed");
HIF_STATS_INC(pci_scn, mhi_force_wake_failure, 1);
return -EINVAL;