|
@@ -1516,91 +1516,6 @@ int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * hif_pm_runtime_prevent_suspend_timeout() - Prevent runtime suspend timeout
|
|
|
- * @ol_sc: HIF context
|
|
|
- * @lock: which lock is being acquired
|
|
|
- * @delay: Timeout in milliseconds
|
|
|
- *
|
|
|
- * Prevent runtime suspend with a timeout after which runtime suspend would be
|
|
|
- * allowed. This API uses a single timer to allow the suspend and timer is
|
|
|
- * modified if the timeout is changed before timer fires.
|
|
|
- * If the timeout is less than autosuspend_delay then use mark_last_busy instead
|
|
|
- * of starting the timer.
|
|
|
- *
|
|
|
- * It is wise to try not to use this API and correct the design if possible.
|
|
|
- *
|
|
|
- * Return: 0 on success and negative error code on failure
|
|
|
- */
|
|
|
-int hif_pm_runtime_prevent_suspend_timeout(struct hif_opaque_softc *ol_sc,
|
|
|
- struct hif_pm_runtime_lock *lock,
|
|
|
- unsigned int delay)
|
|
|
-{
|
|
|
- struct hif_softc *scn = HIF_GET_SOFTC(ol_sc);
|
|
|
- struct device *dev = hif_bus_get_dev(scn);
|
|
|
- struct hif_runtime_pm_ctx *rpm_ctx = hif_bus_get_rpm_ctx(scn);
|
|
|
-
|
|
|
- int ret = 0;
|
|
|
- unsigned long expires;
|
|
|
- struct hif_pm_runtime_lock *context = lock;
|
|
|
-
|
|
|
- if (hif_is_load_or_unload_in_progress(scn)) {
|
|
|
- HIF_ERROR("%s: Load/unload in progress, ignore!",
|
|
|
- __func__);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- if (hif_is_recovery_in_progress(scn)) {
|
|
|
- HIF_ERROR("%s: LOGP in progress, ignore!", __func__);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- if (!scn->hif_config.enable_runtime_pm)
|
|
|
- return 0;
|
|
|
-
|
|
|
- if (!context)
|
|
|
- return -EINVAL;
|
|
|
-
|
|
|
- if (in_irq())
|
|
|
- WARN_ON(1);
|
|
|
-
|
|
|
- /*
|
|
|
- * Don't use internal timer if the timeout is less than auto suspend
|
|
|
- * delay.
|
|
|
- */
|
|
|
- if (delay <= dev->power.autosuspend_delay) {
|
|
|
- hif_pm_request_resume(dev);
|
|
|
- hif_pm_runtime_mark_last_busy(ol_sc);
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
- expires = jiffies + msecs_to_jiffies(delay);
|
|
|
- expires += !expires;
|
|
|
-
|
|
|
- spin_lock_bh(&rpm_ctx->runtime_lock);
|
|
|
-
|
|
|
- context->timeout = delay;
|
|
|
- ret = __hif_pm_runtime_prevent_suspend(scn, context);
|
|
|
- rpm_ctx->pm_stats.prevent_suspend_timeout++;
|
|
|
-
|
|
|
- /* Modify the timer only if new timeout is after already configured
|
|
|
- * timeout
|
|
|
- */
|
|
|
- if (time_after(expires, rpm_ctx->runtime_timer_expires)) {
|
|
|
- qdf_timer_mod(&rpm_ctx->runtime_timer, delay);
|
|
|
- rpm_ctx->runtime_timer_expires = expires;
|
|
|
- }
|
|
|
-
|
|
|
- spin_unlock_bh(&rpm_ctx->runtime_lock);
|
|
|
-
|
|
|
- HIF_ERROR("%s: pm_state: %s delay: %dms ret: %d\n", __func__,
|
|
|
- hif_pm_runtime_state_to_string(
|
|
|
- qdf_atomic_read(&rpm_ctx->pm_state)),
|
|
|
- delay, ret);
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* hif_runtime_lock_init() - API to initialize Runtime PM context
|
|
|
* @name: Context name
|