diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 206e5aff30..550de8fe70 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -12082,46 +12082,6 @@ static struct cdp_mesh_latency_ops dp_ops_mesh_latency = { #endif #ifdef FEATURE_RUNTIME_PM -/** - * dp_runtime_suspend() - ensure DP is ready to runtime suspend - * @soc_hdl: Datapath soc handle - * @pdev_id: id of data path pdev handle - * - * DP is ready to runtime suspend if there are no pending TX packets. - * - * Return: QDF_STATUS - */ -static QDF_STATUS dp_runtime_suspend(struct cdp_soc_t *soc_hdl, uint8_t pdev_id) -{ - struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl); - struct dp_pdev *pdev; - - pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id); - if (!pdev) { - dp_err("pdev is NULL"); - return QDF_STATUS_E_INVAL; - } - - /* Abort if there are any pending TX packets */ - if (dp_get_tx_pending(dp_pdev_to_cdp_pdev(pdev)) > 0) { - dp_init_info("%pK: Abort suspend due to pending TX packets", soc); - return QDF_STATUS_E_AGAIN; - } - - if (dp_runtime_get_refcount(soc)) { - dp_init_info("refcount: %d", dp_runtime_get_refcount(soc)); - - return QDF_STATUS_E_AGAIN; - } - - if (soc->intr_mode == DP_INTR_POLL) - qdf_timer_stop(&soc->int_timer); - - dp_rx_fst_update_pm_suspend_status(soc, true); - - return QDF_STATUS_SUCCESS; -} - /** * dp_flush_ring_hptp() - Update ring shadow * register HP/TP address when runtime @@ -12145,6 +12105,55 @@ void dp_flush_ring_hptp(struct dp_soc *soc, hal_ring_handle_t hal_srng) } } +/** + * dp_runtime_suspend() - ensure DP is ready to runtime suspend + * @soc_hdl: Datapath soc handle + * @pdev_id: id of data path pdev handle + * + * DP is ready to runtime suspend if there are no pending TX packets. + * + * Return: QDF_STATUS + */ +static QDF_STATUS dp_runtime_suspend(struct cdp_soc_t *soc_hdl, uint8_t pdev_id) +{ + struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl); + struct dp_pdev *pdev; + uint8_t i; + + pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id); + if (!pdev) { + dp_err("pdev is NULL"); + return QDF_STATUS_E_INVAL; + } + + /* Abort if there are any pending TX packets */ + if (dp_get_tx_pending(dp_pdev_to_cdp_pdev(pdev)) > 0) { + dp_init_info("%pK: Abort suspend due to pending TX packets", soc); + + /* perform a force flush if tx is pending */ + for (i = 0; i < soc->num_tcl_data_rings; i++) { + hal_srng_set_event(soc->tcl_data_ring[i].hal_srng, + HAL_SRNG_FLUSH_EVENT); + dp_flush_ring_hptp(soc, soc->tcl_data_ring[i].hal_srng); + } + + return QDF_STATUS_E_AGAIN; + } + + if (dp_runtime_get_refcount(soc)) { + dp_init_info("refcount: %d", dp_runtime_get_refcount(soc)); + + return QDF_STATUS_E_AGAIN; + } + + if (soc->intr_mode == DP_INTR_POLL) + qdf_timer_stop(&soc->int_timer); + + dp_rx_fst_update_pm_suspend_status(soc, true); + + return QDF_STATUS_SUCCESS; +} + #define DP_FLUSH_WAIT_CNT 10 #define DP_RUNTIME_SUSPEND_WAIT_MS 10 /**