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

Commit 6064c741 authored by Mohit Khanna's avatar Mohit Khanna Committed by snandini
Browse files

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
parent de141922
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -5055,14 +5055,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;
@@ -5090,6 +5094,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,
@@ -5143,11 +5148,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;