Power Save Modes and Configuration#

This section describes the power save features of the SiWx91x RCP Driver for Radio Co-processor (RCP) mode.

Power Save Modes#

The SiWx91x device support two types of power save modes. They are outlined below:

  • Ultra-low Power (ULP) Mode: A majority of the module is powered off except for a small section which has a timer and interrupts logic for waking up the module. The module cannot respond to the Host processor's commands/requests unless and until it gets wake up because of timeout or because of an interrupt asserted by Host processor. The sleep entry/exit procedures in this mode are indicated to the Host processor either through a packet based or signal based handshake. This mode is supported only for SDIO host interface.

Out of two ULP Handshake Modes (signal (GPIO) based or Packet (message) based), GPIO based mode is more effective in power save. If target platform does not have free/spare GPIO, they can use message based mode.

In Wi-Fi, only Client (Station) mode supports power save. By default, the module will be in power save disable state, user has to enable it explicitly.

Device Sleep Mode#

For each of the above power save modes, the module supports following sleep modes. They are outlined below:

  • Deep Sleep: The module is in deep sleep mode when it is not connected to an Access Point. The Deep Sleep is defined by the <deep_sleep_wakeup_period> parameter of the PS command.

  • Connected Sleep: In the connected state, the module can operate in Max PSP or U-APSD. These profiles are used by the module to decide when to enter and exit from power save modes on the fly. They have to be selected based on the performance and power consumption requirements of the end product.

  • Fast PSP: This profile is a variant of the Traffic Based PSP which exits power save mode even for a single packet and enters the power save mode if no packet is transferred for the <monitor_interval> amount of duration. This profile is enabled independently for the Transmit and Receive directions if the <tx_threshold> and <rx_threshold> parameters are assigned zero, respectively, while assigning a non-zero value to the <monitor_interval> parameter.

Wakeup Procedures and Data Retrieval#

Device acting as station in power save mode, the module wakes up at periodic intervals or due to certain events (like pending transmit packets from the Host). At every wake up, the module has to poll the Access Point and check whether there are any pending Rx packets destined for the module. The module uses different protocols to retrieve data from the Access Point based on the protocol supported by the Access Point. These data retrieval methods (protocol-based) are used to further classify the power save profiles described in the previous section into Max PSP, Periodic U-APSD and Transmit based U-APSD.

The MAX PSP and U-APSD modes are explained below:

  • Max PSP: In this mode, the module wakes up at the end of sleep period (Listen or DTIM interval) and retrieves pending Rx packets from the Access Point by sending a PS-POLL packet. It also transmits any packets received from the Host processor and then goes back to sleep. The parameters listed below are used by the module to decide the period of sleep during power save, in the same order of priority:

    • <listen_interval_duration>

    • <dtim_interval_duration>

    • <num_beacons_per_listen_interval>

    • <num_dtims_per_sleep>

  • U-APSD: Two types of U-APSD power save modes are supported as explained below. For using U-APSD, <enabled_U-APSD> module param has to be set to 1. Also <max_sp_len> module param needs to be configured as required while installing the modules. In addition to these configurations, <U-APSD_wakeup_period> can be configured using debugfs ps_params command to select one of the two variants of U-APSD as explained below.

    1. Periodic U-APSD: This mode is enabled by default if power save enabled by iw dev command (as given below) and takes <U-APSD_wakeup_period> as 100. This can be configured using the ps_params command with the non zero value in <U-APSD_wakeup_period> parameter . For this mode, the wakeup period can be assigned with a value ranging between 10 and 100 milliseconds. If it is supported by the Access Point, then in this mode, the module wakes up at the end of each sleep period and transmits pending data or a QoS Null packet in order to retrieve the data from the Access Point. The sleep period is governed by the parameter set in the ps_params command in addition to the <U-APSD_wakeup_period>. The sleep period has the minimum of the values programmed using the above command. If the Access Point does not support U-APSD, the module tries to mimic this mode by waking up at the end of the sleep period and transmits pending data and a PS_POLL packet to retrieve the data from the Access Point.

    2. Transmit based U-APSD: If <U-APSD_wakeup_period> parameter is set to 0 in the ps_params command, then Transmit based U-APSD mode is enabled. In ULP mode, the Transmit based U-APSD mode can be used only when the signal-based handshake is enabled (and not in packet-based handshake mode). In this mode, the module wakes up from sleep when the Host sends a packet to be transmitted and then retrieves the pending packets from the Access Point by transmitting the packet. The module also wakes up if there is no packet transmitted for the sleep duration programmed in the ps_params command. If the Access Point does not support U-APSD, the module mimics this mode by waking up whenever there is a packet to be transmitted. It generally transmits the packet and then retrieves the pending data from the Access Point by sending a PS_POLL packet.

Configuring ULP device power save for SDIO interface#

Install the driver as follow to enable ULP power save

# insmod rsi_91x.ko rsi_zone_enabled=1 dev_oper_mode=<value> ps_sleep_type=2 ulp_handshake_mode=<value1> 

For No handshake : ulp_handshake_mode = 0

For GPIO based handshake : ulp_handshake_mode = 1

For Packet based handshake : ulp_handshake_mode = 2 (Default)

# insmod rsi_sdio.ko

Configuration of ULP GPIO Handshake and GPIO Numbers#

For GPIO handshake driver requires two GPIO pins. These pins need to be configured by the user as module params.

Install the driver as follow to enable GPIO handshake

# insmod rsi_91x.ko ps_sleep_type=<value> ulp_handshake_mode=1 ulp_gpio_read=X ulp_gpio_write=Y 
  • For ULP power save : ps_sleep_type = 2

ULP GPIO handshake supported for sdio interface only.

  • In this case, X and Y are the platform GPIO’s used for the GPIO handshake.

  • Platform GPIO X should be connected with UULP3 /UULP0 in the rsi_EVB (a particular PIN can be selected using sleep_ind_gpio_sel module param).

  • Platform GPIO Y should be connected with UULP2 in the rsi_EVB.

Enabling Power Save#

Power save can be enabled or disabled through command line using iw commands. By default 802.11 default power save is enabled if Coex mode is enabled. U-APSD is enabled based on AP’s U-APSD configuration.

Following are the commands used in power save configuration.

  1. Enable the power save:

    # iw dev <interface_name> set power_save on 
  2. Disable power save:

    # iw dev <interface_name> set power_save off 
  3. Check the power save status:

    # iw dev <interface_name> get power_save
    • In this case, interface_name will vary from one host to the other.

    • To find out the interface_name, run the following command:

      # iw dev

Configure Power Save Parameters/Profiles through debugfs Dynamically#

Driver supports dynamic configuration of power save type and profile parameters using debugfs as explained below.

To update power save parameter, run the following command:

echo <sleep_type> <tx_threshold> <rx_threhold> <tx_hysteresis> < rx_hysteresis> <monitor_interval> <listen_interval_duration> <num_beacons_per_listen_interval> <dtim_interval_duration> <num_dtims_per_sleep> <deep_sleep_wakeup_period> <U-APSD_wakeup_period> >/sys/kernel/debug/phy<X>/ ps_params

The input parameters of the power save command are explained below.

  • <sleep_type>: This parameter is used to select the sleep mode 2- ULP sleep mode.

  • <tx_threshold>: If a non-zero value is assigned, this parameter is used to set a threshold for the Transmit throughput computed during the <monitor_interval> period so that the module can decide to enter (throughput ≤ threshold) or exit (throughput > threshold) the power save mode. The value is in Mbps and Supported TX threshold is 0 to 10Mbps

  • <rx_threshold>: If a non-zero value is assigned, this parameter is used to set a threshold for the Receive throughput computed during the <monitor_interval> period so that the module can decide to enter (throughput ≤ threshold) or exit (throughput > threshold) the power save mode. The value is in Mbps and Supported RX threshold is 0 to 10Mbps

  • <tx_hysteresis>: The decision to enter or exit power save mode based on the Transmit throughput alone can result in frequent switching between the power save and non-power save modes. If this is not beneficial, the <tx_hysteresis> parameter can used to make the module re-enter the power save mode only when the throughput falls below the difference between the <tx_threshold> and <tx_hysteresis> values. The value is in Mbps and minimum value is 0 Mbps. This parameter should be assigned a value which is less than the value assigned to the <tx_threshold> parameter.

  • <rx_hysteresis>: The decision to enter or exit power save mode based on the Receive throughput which alone can result in frequent switching between the power save and non-power save modes. If this is not beneficial, the <rx_hysteresis> parameter can be used to make the module re-enter the power save mode only when the throughput falls below the difference between the <rx_threshold> and <rx_hysteresis> values. The value is in Mbps and minimum value is 0 Mbps. This parameter should be assigned a value which is less than the value assigned to the <rx_threshold> parameter.

  • <monitor_interval>: This parameter specifies the duration (in milliseconds) over which the Transmit and Receive throughputs are computed to compare with the <tx_threshold>, <rx_threshold>, <tx_hysteresis> and <rx_hysteresis> values. The maximum value of this parameter is 30000 ms (30 seconds).

  • <listen_interval_duration>: This parameter specifies the duration (in milliseconds) for which the module sleeps in the connected state power save modes. If a non-zero value is assigned to this parameter it takes precedence over the other sleep duration parameters that follow (<num_beacons_per_listen_interval>, <dtim_interval_duration>, <num_dtims_per_sleep>). The maximum duration for which the device supports sleep is 4095 times the duration of the beacon interval considering the listen interval parameters of the access point. The maximum value for this parameter can be 65535, but the duration should be the deciding factor in the beacon interval of the access point. This parameter is considered only after the module is connected to the access point. For example, if the beacon interval of the AP is 100 ms and listen interval of AP is 8 beacons, then the maximum time the device can sleep without any data loss is 800 ms (8 * 100). Hence, the listen_interval_duration can be up to 800 ms.

    Note: Listen interval duration greater than one sec (> 1sec ) is not supported

  • <num_beacons_per_listen_interval>: This parameter specifies the number of beacon intervals for which the module sleeps in the connected state power save modes. Here, the device will wake up for the nth beacon, where n is the listen interval value programmed by the user. If a non-zero value is assigned to this parameter it takes precedence over the other sleep duration parameters that follow (<dtim_interval_duration>, <num_dtims_per_sleep>). This parameter is used only when the above parameter is assigned to 0. The maximum value for this parameter is 4095. The value for this parameter also has to be chosen keeping in mind the listen interval of the access point. . This parameter is considered only after the module is connected to the access point.

  • <dtim_interval_duration>: This parameter specifies the duration (in milliseconds) for which the module sleeps in the connected state power save modes. The device will wake up for the nearest DTIM beacon after the time which the user has programmed expires. This parameter can be used when DTIM information is not available. If a non-zero value is assigned to this parameter, then it takes precedence over the other sleep duration parameter that follows (<num_dtims_per_sleep>). This parameter is used only when the above parameters are assigned 0. The maximum value for this parameter can be 10000 ms. This parameter is considered only after the module is connected to the access point.

  • <num_dtims_per_sleep>: This parameter specifies the number of DTIM intervals for which the module sleeps in the connected state power save modes. This parameter has least priority compared to the ones above and is used only if the above parameters are assigned to 0. The maximum value for this parameter is 10. This parameter is considered only after the module is connected to the access point.

  • <deep_sleep_wakeup_period>: This parameter specifies the duration (in milliseconds) for which the module sleeps in the Deep Sleep mode. The value of 0 is invalid for ULP mode and should not be used. The maximum value for this parameter can be 65535.

  • <U-APSD_wakeup_period>: This parameter specifies the duration (in milliseconds) for which the module sleeps after connection if the AP supports U-APSD. For value 10-100 milliseconds it will work as periodic U-APSD and for value 0 it will work as transmit based U-APSD.

Note: In Wi-Fi + BLE coexistence mode, User need to give both Wi-Fi power save command and BLE power save command in order to enable power save. See the BLE Power Save Modes section for information about BLE power save modes.