WHC Wi-Fi Low Power

WHC Low Power Introduction

When the Host is idle, power consumption can be reduced via standby mode. The core interaction flow is shown below:

../../_images/fullmac_powersave.svg

The interaction between Device and Host in low-power mode consists of 3 parts:

Device Wowlan Cmd

Host can trigger Device to enter low-power state via interrupts or messages through CUST_PATH:

../../_images/fullmac_powersavecmd.svg

Trigger Type

Interface

Description

CUST_PATH

ALL

Sends customized commands via CUST_PATH

RPWM INT

SDIO

Triggered by SDIO-specific interrupt

Other INT

ALL

Uses GPIO general external interrupt (high compatibility)

CUST_PATH

For implementation, refer to the tickps command in the slim host demo.

../../_images/fullmac_powersave_custpath.svg

RPWM INT

Ameba SDK automatically triggers RPWM interrupt during host suspend to notify Device to enter low-power mode. Implementation function: whc_sdio_host_rpwm_notify .

../../_images/fullmac_powersave_sleeprpwm.svg

Other INT

For other interrupts (e.g., GPIO), refer to: RPWM INT .

Host wake Device

Host selects interrupt type based on Device’s low-power mode (CG/PG):

../../_images/fullmac_powersave_hostwakedev.svg

Interrupt

Device State

Interface

Description

CUST_PATH

Active

None

CUST_PATH only responds when Device is Active

RPWM INT

CG

SDIO

Triggers RPWM interrupt via SDIO-specific signal

Other INT

CG/PG

ALL

Uses GPIO or other interrupts

RPWM INT

Ameba SDK automatically triggers RPWM interrupt during host resume to wake Device from CG state. Implementation function: whc_sdio_host_rpwm_notify .

../../_images/fullmac_powersave_wakeprpwm.svg

Other INT

For other interrupts (e.g., GPIO), refer to: RPWM INT

Device wake Host

Device wakes Host via interrupts, with methods depending on Host hardware support:

../../_images/fullmac_powersave_devwakehost.svg

Interrupt

Description

SDIO INT

Standard packet trigger (no additional code adaptation required)

Other INT

Uses GPIO or other interrupts (high compatibility)

WHC Low Power API

API Header Files

component/wifi/whc/whc_dev/whc_dev_powersave.h

API Reference

void whc_host_set_ps_cmd(struct whc_dev_ps_cmd *pcmd, char *cmd_arg)
{
   if (strcmp(cmd_arg, "r") == 0) {
      pcmd->type = WHC_CMD_TICKPS_R;
   } else if (strcmp(cmd_arg, "a") == 0) {
      pcmd->type = WHC_CMD_TICKPS_A;
   } else if (strcmp(cmd_arg, "cg") == 0) {
      pcmd->type = WHC_CMD_TICKPS_TYPE_CG;
   } else if (strcmp(cmd_arg, "pg") == 0) {
      pcmd->type = WHC_CMD_TICKPS_TYPE_PG;
   }

   return;
}

Item

Description

Function

Parses user input and fills the low-power command structure

Parameters

pcmd: Pointer to the command structure,cmd_arg: Input string

Return

None

WHC Low Power Operation Flow

  1. To configure the sleep type of the device, refer to the tickps command in the slim host demo.

  2. Identify wireless physical interface(find “phy” field): rfkill list .

  3. Enable any-packet wakeup: sudo iw phy <phyname> wowlan enable any (replace actual phyname).

  4. Verify WoWLAN configuration: sudo iw phy wowlan show .

  5. Initiate system suspend echo mem | sudo tee /sys/power/state .

Note

phyname may change to phy1/phyN after rmmod, Re-validate steps 1-3 after module reload.