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

Commit 692cc05e authored by Houston Hoffman's avatar Houston Hoffman Committed by Akash Patel
Browse files

qcacld-3.0: Log runtime suspend resume occurances

Keep track of how many times supesend resume succeeds and fails
also mark last busy on a failed runtime suspend or a successful
runtime resume.

Change-Id: I04df805429e3a9ce91bc3d7f27bfd598396257c9
CRs-Fixed: 935300
parent 1dd22769
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -541,11 +541,14 @@ static int __wlan_hdd_runtime_suspend(void)
	void *hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
	int status = wlan_hdd_validate_context(hdd_ctx);

	if (0 != status)
	if (0 != status) {
		hif_log_runtime_suspend_failure();
		return status;
	}

	if (!hif_can_suspend_link()) {
		hdd_err("Runtime PM not supported for link up suspend");
		hif_log_runtime_suspend_failure();
		return -EINVAL;
	}

@@ -567,6 +570,7 @@ static int __wlan_hdd_runtime_suspend(void)
		goto resume_hif;

	hif_runtime_pm_set_state_suspended();
	hif_log_runtime_suspend_success();
	return status;

resume_hif:
@@ -576,6 +580,7 @@ static int __wlan_hdd_runtime_suspend(void)
resume_htc:
	CDF_BUG(!htc_runtime_resume());
set_state:
	hif_log_runtime_suspend_failure();
	hif_runtime_pm_set_state_on();
	return status;
}
@@ -615,6 +620,7 @@ static int __wlan_hdd_runtime_resume(void)
	CDF_BUG(!hif_runtime_resume());
	CDF_BUG(!wma_runtime_resume());
	CDF_BUG(!htc_runtime_resume());
	hif_log_runtime_resume_success();
	hif_runtime_pm_set_state_on();
	return 0;
}
+7 −0
Original line number Diff line number Diff line
@@ -694,6 +694,13 @@ bool hif_can_suspend_link(void);
void hif_runtime_pm_set_state_inprogress(void);
void hif_runtime_pm_set_state_on(void);
void hif_runtime_pm_set_state_suspended(void);

#ifdef FEATURE_RUNTIME_PM
void hif_log_runtime_suspend_success(void);
void hif_log_runtime_suspend_failure(void);
void hif_log_runtime_resume_success(void);
#endif

int dump_ce_register(struct ol_softc *scn);
int ol_copy_ramdump(struct ol_softc *scn);
void hif_pktlogmod_exit(void *hif_ctx);
+61 −0
Original line number Diff line number Diff line
@@ -1883,6 +1883,67 @@ void hif_runtime_pm_set_state_suspended(void)
	__hif_runtime_pm_set_state(HIF_PM_RUNTIME_STATE_SUSPENDED);
}


#ifdef FEATURE_RUNTIME_PM
static inline struct hif_pci_softc *get_sc(void)
{
	struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);

	if (NULL == scn) {
		HIF_ERROR("%s: Could not disable ASPM scn is null",
		       __func__);
		return NULL;
	}

	return scn->hif_sc;
}

/**
 * hif_log_runtime_suspend_success() - log a successful runtime suspend
 */
void hif_log_runtime_suspend_success(void)
{
	struct hif_pci_softc *sc = get_sc();
	if (sc == NULL)
		return;

	sc->pm_stats.suspended++;
	sc->pm_stats.suspend_jiffies = jiffies;
}

/**
 * hif_log_runtime_suspend_failure() - log a failed runtime suspend
 *
 * log a failed runtime suspend
 * mark last busy to prevent immediate runtime suspend
 */
void hif_log_runtime_suspend_failure(void)
{
	struct hif_pci_softc *sc = get_sc();
	if (sc == NULL)
		return;

	sc->pm_stats.suspend_err++;
	hif_pm_runtime_mark_last_busy(sc->dev);
}

/**
 * hif_log_runtime_resume_success() - log a successful runtime resume
 *
 * log a successfull runtime resume
 * mark last busy to prevent immediate runtime suspend
 */
void hif_log_runtime_resume_success(void)
{
	struct hif_pci_softc *sc = get_sc();
	if (sc == NULL)
		return;

	sc->pm_stats.resumed++;
	hif_pm_runtime_mark_last_busy(sc->dev);
}
#endif

/**
 * hif_runtime_suspend() - do the bus suspend part of a runtime suspend
 *