Skip to content

Commit

Permalink
drivers: wifi: Remove the RPU awake assumption in IRQ
Browse files Browse the repository at this point in the history
It was assumed that RPU would stay awake while servicing an interrupt,
but in few scenarios we had seen RPU entering sleep with a pending
interrupt, so, independent of the state (IRQ or not), wakeup RPU if its
asleep.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
  • Loading branch information
krish2718 committed Sep 6, 2024
1 parent a9c774a commit fa142f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
1 change: 0 additions & 1 deletion drivers/wifi/nrf700x/osal/hw_if/hal/inc/hal_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ struct nrf_wifi_hal_dev_ctx {
void *rpu_ps_timer;
void *rpu_ps_lock;
bool dbg_enable;
bool irq_ctx;
bool rpu_fw_booted;
#endif /* CONFIG_NRF_WIFI_LOW_POWER */
char *event_data;
Expand Down
35 changes: 3 additions & 32 deletions drivers/wifi/nrf700x/osal/hw_if/hal/src/hal_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,9 @@ enum nrf_wifi_status hal_rpu_ps_wake(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx)
#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY_PS_STATE_DEBUG */

out:
if (!hal_dev_ctx->irq_ctx) {
nrf_wifi_osal_timer_schedule(hal_dev_ctx->hpriv->opriv,
hal_dev_ctx->rpu_ps_timer,
CONFIG_NRF700X_RPU_PS_IDLE_TIMEOUT_MS);
}
nrf_wifi_osal_timer_schedule(hal_dev_ctx->hpriv->opriv,
hal_dev_ctx->rpu_ps_timer,
CONFIG_NRF700X_RPU_PS_IDLE_TIMEOUT_MS);
return status;
}

Expand Down Expand Up @@ -515,13 +513,6 @@ static void hal_rpu_ps_deinit(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx)
hal_dev_ctx->rpu_ps_lock);
}


static void hal_rpu_ps_set_state(struct nrf_wifi_hal_dev_ctx *hal_dev_ctx,
enum RPU_PS_STATE ps_state)
{
hal_dev_ctx->rpu_ps_state = ps_state;
}

enum nrf_wifi_status nrf_wifi_hal_get_rpu_ps_state(
struct nrf_wifi_hal_dev_ctx *hal_dev_ctx,
int *rpu_ps_ctrl_state)
Expand Down Expand Up @@ -1556,9 +1547,6 @@ enum nrf_wifi_status nrf_wifi_hal_irq_handler(void *data)
struct nrf_wifi_hal_dev_ctx *hal_dev_ctx = NULL;
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
unsigned long flags = 0;
#ifdef CONFIG_NRF_WIFI_LOW_POWER
enum RPU_PS_STATE ps_state = RPU_PS_STATE_ASLEEP;
#endif /* CONFIG_NRF_WIFI_LOW_POWER */
bool do_rpu_recovery = false;

hal_dev_ctx = (struct nrf_wifi_hal_dev_ctx *)data;
Expand All @@ -1578,25 +1566,8 @@ enum nrf_wifi_status nrf_wifi_hal_irq_handler(void *data)
goto unlock;
}

#ifdef CONFIG_NRF_WIFI_LOW_POWER
ps_state = hal_dev_ctx->rpu_ps_state;
hal_rpu_ps_set_state(hal_dev_ctx,
RPU_PS_STATE_AWAKE);
#ifdef CONFIG_NRF_WIFI_LOW_POWER_DBG
hal_dev_ctx->irq_ctx = true;
#endif /* CONFIG_NRF_WIFI_LOW_POWER_DBG */
#endif /* CONFIG_NRF_WIFI_LOW_POWER */

status = hal_rpu_irq_process(hal_dev_ctx, &do_rpu_recovery);

#ifdef CONFIG_NRF_WIFI_LOW_POWER
hal_rpu_ps_set_state(hal_dev_ctx,
ps_state);
#ifdef CONFIG_NRF_WIFI_LOW_POWER_DBG
hal_dev_ctx->irq_ctx = false;
#endif /* CONFIG_NRF_WIFI_LOW_POWER_DBG */
#endif /* CONFIG_NRF_WIFI_LOW_POWER */

if (status != NRF_WIFI_STATUS_SUCCESS) {
goto unlock;
}
Expand Down

0 comments on commit fa142f5

Please sign in to comment.