Skip to content

Commit

Permalink
drivers: wifi: Hook RPU power off
Browse files Browse the repository at this point in the history
The API to power off RPU was unused, hook it to the higher level APIs
and tie to QSPI bus removal.

This reduces current consumption on interface down from ~13uA to ~2uA.

Implements SHEL-1672.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
  • Loading branch information
krish2718 committed Jun 25, 2023
1 parent 8260cb5 commit af0b54d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions drivers/wifi/nrf700x/osal/bus_if/bus/qspi/src/qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ static void wifi_nrf_bus_qspi_dev_rem(void *bus_dev_ctx)
wifi_nrf_osal_bus_qspi_dev_intr_unreg(qspi_dev_ctx->qspi_priv->opriv,
qspi_dev_ctx->os_qspi_dev_ctx);

wifi_nrf_osal_bus_qspi_dev_rem(qspi_dev_ctx->qspi_priv->opriv,
qspi_dev_ctx->os_qspi_dev_ctx);

wifi_nrf_osal_mem_free(qspi_dev_ctx->qspi_priv->opriv,
qspi_dev_ctx);
}
Expand Down
1 change: 1 addition & 0 deletions drivers/wifi/nrf700x/zephyr/src/qspi/inc/rpu_hw_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ int rpu_write(unsigned int addr, const void *data, int len);

int rpu_gpio_config(void);
int rpu_pwron(void);
int rpu_pwroff(void);
int rpu_qspi_init(void);
int rpu_sleep(void);
int rpu_wakeup(void);
Expand Down
12 changes: 10 additions & 2 deletions drivers/wifi/nrf700x/zephyr/src/qspi/src/rpu_hw_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ int rpu_pwron(void)
return 0;
}

int rpu_pwroff(void)
{
gpio_pin_set_dt(&bucken_spec, 0); /* BUCKEN = 0 */
gpio_pin_set_dt(&iovdd_ctrl_spec, 0); /* IOVDD CNTRL = 0 */

return 0;
}

#if defined(CONFIG_BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP) || \
defined(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP)
int ble_ant_switch(unsigned int ant_switch)
Expand Down Expand Up @@ -351,7 +359,7 @@ int rpu_enable(void)

int rpu_disable(void)
{
gpio_pin_set_dt(&bucken_spec, 0); /* BUCKEN = 0 */
gpio_pin_set_dt(&iovdd_ctrl_spec, 0); /* IOVDD CNTRL = 0 */
rpu_pwroff();

return 0;
}
1 change: 1 addition & 0 deletions drivers/wifi/nrf700x/zephyr/src/shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ static void zep_shim_bus_qspi_dev_rem(void *os_qspi_dev_ctx)
dev = os_qspi_dev_ctx;

/* TODO: Make qspi_dev a dynamic instance and remove it here */
rpu_disable();
}

static void *zep_shim_bus_qspi_init(void)
Expand Down

0 comments on commit af0b54d

Please sign in to comment.