STMicroelectronics Power management User Manual
Advertisement
Advertisement
UM1130
User manual
Power management
Overview
This document is the user manual for the STPOWER power management driver for
STAPI SDK.
●
●
●
The power consumption of consumer electronics devices has become an important concern in recent years. This is because: governments have introduced legislation to enforce lower power consumption manufacturer specifications place constraints upon power requirements consumer electronics customers have a preference for “greener” products
The power consumption of an electronic device is controlled by two elements, a power management profile and a power management policy.
A power management profile provides a list of drivers and their power states. There are different predefined power management profiles for different power management modes, for example: “active standby” or “passive standby”.
A power management policy decides which power management profile is to be activated under which conditions.
An application defines a number of power management profiles and implements the power management policy.
The STPOWER driver acts as a profile manager. This means that the application instructs
STPOWER to switch to a different power management profile, and STPOWER then instructs each STAPI driver to switch to the power state as defined by the power management profile. To achieve this, each STAPI driver must register with the STPOWER driver.
August 2012 8300955 Rev 2 1/31 www.st.com
Contents
Contents
UM1130
STPOWER architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Generic rules for power management . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Compile time feature selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Low power modes supported by STAPI SDK . . . . . . . . . . . . . . . . . . . . . 7
Host passive standby mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Controller passive standby mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Wakeup triggers supported by STAPI SDK . . . . . . . . . . . . . . . . . . . . . . . 9
Low power block details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Power management profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Creating a power management profile . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Registering a power management profile . . . . . . . . . . . . . . . . . . . . . . . . . 16
Setting a power management profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Implementing active standby mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
IR (Infrared remote control) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2/31 8300955 Rev 2
UM1130
Contents
Implementing host passive standby mode . . . . . . . . . . . . . . . . . . . . . . 23
IR (Infrared remote control) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Front panel (key scanner) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Set CPU and DDR to low power mode . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Manage power of on-board components . . . . . . . . . . . . . . . . . . . . . . . . . 25
Implementing controller passive standby mode . . . . . . . . . . . . . . . . . 26
STAPI SDK commands for low power mode . . . . . . . . . . . . . . . . . . . . . 28
STi7108-HDK board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8300955 Rev 2 3/31
STPOWER architecture UM1130
Figure 1
describes the power management architecture in STAPI SDK.
Figure 1.
Power management architecture in STAPI SDK
Application
Set power level
Set device power state
Set the clock
STAPI drivers
STCLOCK
STPOWER
Linux DPM
Native Linux device
Low level APIs
DMO
Hardware
Audio Video Transport Clock Host CPU
Sys Services
User
Kernel
4/31 8300955 Rev 2
UM1130
2
Generic rules for power management
Generic rules for power management
●
●
The following rules must be taken into account when using the power management subsystem with an application.
● Use the correct dependencies.
– Use the ST40 Micro Toolset and OSPlus releases recommended in the
SDK/drivers release note.
●
●
– Use the kernel version recommended in the SDK/drivers release note.
– Use the kernel configuration recommended by the SDK release for your SoC or platform.
In order to activate power management support in the SDK, build the SDK with the environment variable STPOWER_SUPPORTED set.
To get optimum power saving, activate clock support by building the SDK with the
DVD_STCLOCK flag set.
●
In the ST TargetPack, either scale down or power down the unused clocks.
Ensure that the application follows the correct sequence of STAPI calls when switching between low power and normal power mode.
Power measurement rules
– Measure the power at the outlet of the power supply source of the product under test.
●
●
– The power measurement instrument must measure the average true power (in watts) of the product under test.
– When performing measurements to self-certify a product model, make sure that the product under test is in the original condition (that is, configuration and settings) as shipped to the customer.
– If the product is designed for a network environment, it must be tested whilst connected to the network to ensure that all power consumption and performance criteria are met.
Power adapter selection: use an adapter with the ENERGY STAR, as this meets the strict energy efficiency guidelines set by the US Environmental Protection Agency
(EPA) and the US Department of Energy (DOE). Good power adapters are 30% more efficient than conventional models.
Make sure that error codes returned by the STAPI drivers are properly handled in the application.
8300955 Rev 2 5/31
Compile time feature selection
3 Compile time feature selection
UM1130
The STPOWER driver exposes a number of environment flags to the user through the make system.
Table 1
describes these flags and their functions.
Table 1.
Make environment flags
Flag
STPOWER_SUPPORTED
STPOWER_DUAL_CPU
DVD_STCLOCK
STCLOCK_DUAL_CPU
Description
Set this flag to enable power management support in STAPI SDK.
Set this flag in order to run power management in a multi-core environment, such as an STi7141 or STi7108.
Set this flag to enable STCLOCK support. This flag must be set.
Set this flag to run STCLOCK on an STi7108.
This flag is valid for the STi7108 only.
6/31 8300955 Rev 2
UM1130
4
Low power modes supported by STAPI SDK
Low power modes supported by STAPI SDK
STAPI SDK supports two low power modes, active standby mode and passive standby mode.
4.1
Note:
4.2
4.2.1
Note:
Active standby mode
In this mode, the device is in a minimal processing state. The set top box is connected to a power source and can receive, send, process, translate or record signals and data. Some set top box components and functionality can be in low power mode whilst others may be fully functional. In this mode, the CPU is active but may operate with a reduced frequency.
This mode is supported by all SoCs that have support for power management.
Passive standby mode
In this mode, the set top box is inactive and waiting a wakeup trigger. When the device receives the trigger, it resumes normal operation.
There are two varieties of passive standby mode, host passive standby and controller passive standby.
Host passive standby mode
●
●
●
●
●
●
When in host passive standby mode: all drivers (except wakeup devices) are in low power mode the host core is in sleep mode, waiting for a wakeup trigger co-processor clocks are disabled unused SoC IPs and associated clocks are switched off external components mounted on the board are disconnected from all power sources the DDR is in self-refresh mode
This mode is supported by all SoCs that have support for power management.
●
●
●
In this mode, power consumption of less than one watt has been achieved on the following:
STi7111 SoC on an SAT7111 board running OS21
STi7111 SoC on an SAT7111 board running STLinux
STi7105 SoC on an SDK7105 board running OS21
8300955 Rev 2 7/31
Low power modes supported by STAPI SDK
4.2.2
Note:
Controller passive standby mode
UM1130
This mode is supported on the STi7108 SoC cut 2.0 from SDK-35 onwards (STi7108-HDK
V2.2 board), On STxH207 family, this mode will be fully supported from SDK-39 onwards. It is not currently supported on the STi7111, STi7105, STi5289, STi7106, STi7141, STi5197 or STi7108 cut 1.0.
When in controller passive standby mode:
●
●
●
● power sources for all IPs in the SoC are switched off an external or an on-chip microcontroller processes the wakeup trigger external components mounted on the board are disconnected from all power sources the DDR is in self-refresh mode
On receiving a valid wakeup trigger, the microcontroller restores the power supply to the
SoC and the external components mounted on the board.
On the STiH207, the SBC power controller is internal to the SoC. This device is in the
“always on” domain.
Controller passive standby is supported under STLinux only.
8/31 8300955 Rev 2
UM1130
5
Wakeup triggers supported by STAPI SDK
Wakeup triggers supported by STAPI SDK
The core is woken up only on receipt of a valid wake up trigger. STAPI SDK currently supports the wake up triggers listed in
Table 2
Table 2.
Supported wake up triggers
Trigger Description
IR (infrared)
Front panel
HDMI
GPIO
Press the power key on the remote control to cause the set top box to enter standby mode or exit from standby mode.
To achieve this, the application must parse the IR key code. For every IR key press, the core wakes up and the application checks for the IR key code. If the pressed key is not the power key, then the application sets the
SoC back to low power mode. The SoC goes into normal mode only on receipt of a power key code.
Press the power button on the front panel to cause the set top box to enter standby mode or exit from standby mode. (This assumes that the front panel is connected to the keyscan IP.)
As in the case of IR, the application must check which button is pressed in the front panel.
Timer
The set top box can exit from standby mode on the expiry of a preprogrammed timer. Generally, the timer wakes up the set top box for predefined events like a scheduled recording.
WOL (Wake up on LAN)
The set top box can exit standby on receipt of an Ethernet magic packet across a network.
The set top box can exit from standby when it receives the appropriate
HDMI CEC or HDMI HPD message.
If required, the set top box can exit from standby on receipt of some predefined GPIO activity. To achieve this, the application must configure the
GPIO before going into standby. This enables the GPIO to generate a wakeup interrupt, and the customer can then connect the front panel (or any other interface that might be used) directly to the GPIO.
8300955 Rev 2 9/31
Supported features UM1130
Table 3
Table 4
lists the features supported by different environments (STAPI SDK
OS21 or STAPI SDK STLinux) for a range of different SoCs.
Table 3.
SoC
Supported features, OS21 environment
Active standby
Host passive standby
Controller passive standby
Wake up supported
STi5197
STi5206
STi7105
STi7111
STi7141
STiH207
No
No
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
No
No
No
Timer, IR, GPIO (as external interrupt)
Timer, IR, GPIO
Timer, IR, GPIO, HDMI, Front panel
(keyscan)
Timer, IR, GPIO, HDMI, Front panel
(keyscan)
Timer, IR, GPIO, HDMI
Timer, IR, GPIO, HDMI, Front panel
(keyscan)
Table 4.
SoC
Supported features, STLinux environment
Active standby
Host passive standby
Controller passive standby
STi5197
STi5206
No
No
Yes
Yes
No
No
STi7105
STi7108
STi7111
STi7141
STiH207
No
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
Wake up supported
Timer, IR
Timer, IR, GPIO, WOL
Timer, IR, GPIO, WOL, HDMI, Front panel (keyscan)
Timer, IR, GPIO, WOL, HDMI, Front panel (keyscan)
(For controller passive standby, supported wakeup triggers are IR,
Timer and Front panel keys.)
Timer, IR, GPIO, WOL, HDMI, Front panel (keyscan)
Timer, IR, GPIO, WOL
Timer, IR, GPIO, WOL, Front panel
(keyscan)
(These wakeup triggers will be supported by the STiH207 for controller passive standby.
Supported currently are Timer and
IR only.)
10/31 8300955 Rev 2
UM1130
7 Low power block details
Low power block details
Table 5.
Sub system
Audio
Video
Low power block details
Hardware block
Customer code or STAPI driver or OS21/OSPLUS or Linux kernel
Active standby
Audio DACs staudlx
ST231 audio core staudlx
S/PDIF player staudlx
HDMI S/PDIF player stvout
User option
User option
User option
User option
DVP (Digital video port)
ST231 video core stvin stvid
User option
User option
Ethernet MAC
OSPlus TCP/IP extension or Linux kernel
User option
Ethernet
Table 5
assumes that (when in host passive standby mode) all the devices on the chip are in low-power state.
The boards can be exposed with the following blocks (not an exhaustive list):
Ethernet PHY
OSPlus TCP/IP extension or Linux kernel
User option
Ethernet magnetics
User option
Host passive standby
Low power
Controller passive standby
(internal)
Power off
Controller passive standby
(external)
Power off
Low power
Low power
Low power
Low power
Low power
Low power or wakeup device
If WOL, in low power or off
(board dependant)
If WOL, in low power or off
(board dependant)
Power off
Power off
Power off
Power off
Power off
Power off
Power off
Power off
Power off
Power off
Low power or wakeup device
Power off
If WOL, in low power or off
(board dependant)
Power off
If WOL, in low power or off
(board dependant)
Power off
USB controller
OSPlus or
Linux kernel
User option Low power Power off Power off
USB
USB power
Switch
OSPlus or
Linux kernel
User option
Check carefully:
OS21 cuts the power; Linux kernel keeps it
Power off Power off
SATA SATA statapi or
Linux kernel
User option Low power Power off Power off
Video ouput stage
Compositor
HD video
DACs stvout
SD video
DACs (DENC) stvout
User option
User option
Low power
Low power
Power off
Power off
Power off
Power off
8300955 Rev 2 11/31
Low power block details UM1130
Table 5.
Sub system
Graphics
LMI
CPU
EMI
Periph
Low power block details (continued)
Hardware block
Customer code or STAPI driver or OS21/OSPLUS or Linux kernel
Active standby
Display compositor
Blitter stvmix stblit stlayer
User option
Host passive standby
Controller passive standby
(internal)
Controller passive standby
(external)
HDMI sthdmi stvout
Low power
Low power
User option
Low power Power off
Power off Power off
Low power or wakeup (HPD or CEC)
Low power or wakeup (HPD or CEC)
I
LMI controller
DDR pCode in stpower for OS21 or Linux kernel
On
On
ST40 CPU
OS21 or Linux kernel
EMI controller stpower for OS21 or Linux kernel
On
On
PCI controller stpower for OS21 or Linux kernel
On
Flash, NOR,
NAND or
SERIAL
On
IR Tx/Rx &
UHF Rx
Smart card interface
MAFE interface stblast stsmart
User option stuart
User option
SSC/I
2
2
C
C devices
UART
PWM stspi or Linux kernel
Customer code
(sti2c dependant) stuart stpwm
User option
User option
User option
CPU sleep : On
CPU standby:
Low power
CPU sleep : On
CPU standby:
Self refresh
Low power
(Sleep)
Low power
Low power
On
On at crystal clock as wakeup device
Low power
Low power sti2c for OS21 Low power
Low power
Low power
Low power
Low power
Self refresh mode
Power off
Power off
Power off
Power off
Wakeup device
Low power
Power off
Low power
Self refresh mode
Power off
Power off
Power off
Power off
Wakeup device
(1)
Power off
Power off
Low power
Currently power off but can be on
Currently power off but can be on
Power off
On
Power off
Power off
Power off
12/31 8300955 Rev 2
UM1130 Low power block details
Table 5.
Sub system
Low power block details (continued)
Hardware block
General PIOs
Customer code or STAPI driver or OS21/OSPLUS or Linux kernel stpio
Active standby
User option
Host passive standby
On or Low power
Controller passive standby
(internal)
On
Controller passive standby
(external)
Those are in the “always on” domain.
Remainder are Off
Wakeup device
Periph
KeyScan stkeyscan User option On or Low power
Wakeup device
Fdma
Front-end
Temperature sensor
FDMA
TS merger
PTI
LNB
Demod (sat, cab, ter)
Tuners
Customer code or
Linux kernel stfdma stmerge stpti4 stfrontend or stuner stfrontend or stuner stfrontend or stuner
User option
User option
User option
User option
User option
User option
User option
Low power Power off
Low power
Low power
Low power
Power off
Power off
Power off
Low power or Off
(board dependant)
Power off
Low power or Off
(board dependant)
Power off
Low power or Off
(board dependant)
Power off
1.
These wakeup triggers are available on an external SBC controller. They are external to the SOC.
Power off
Power off
Power off
Power off
Power off
Power off
Power off
Note: In
Table 5
, “User option” means either on, off or low power state.
8300955 Rev 2 13/31
Power management profile
8 Power management profile
UM1130
A power management profile is a list of set top box drivers and their power states.
Table 6
describes the three attributes that are recorded in the profile for each driver. The application needs all three attributes for all devices in order to create a power management profile.
Table 6.
Power management profile entry
Attribute
Device name
Device type
Power state
Description
In the case of STAPI drivers, the device name is the same as the name given in the STXXX_Init call.
In the case of a Linux device, the device name is the path to the device in the Linux /sys/ interface.
Each device is either a STAPI device ( STPOWER_DEVICE ) or a Linux device ( STPOWER_DEVICE_NATIVE_LINUX ).
The power state is one of the following.
– Normal ( STPOWER_DEVICE_STATE_D0 ). This is the active state.
The device is powered on and operating in the default state.
– Standby ( STPOWER_DEVICE_STATE_D1 ). The device is in a lowpower state. The device is not operating, but the contents of the registers are preserved.
– Controller passive standby ( STPOWER_DEVICE_STATE_D2 ). The device is powered down. The contents of the registers are not preserved. The driver is responsible for saving the hardware context and restoring it when power is resumed. (This state is not supported by the STAPI drivers.)
8.1 Power state of STB
The actual power state of the STB (that is, active standby, host passive standby or controller passive standby) is determined by a combination of the device profile and CPU state. See
Table 7
Table 7.
Power state of the STB
Power state
Device state and CPU state
Active
Active standby
Host passive standby
Controller passive standby
DDR state
D0 and CPU normal Normal or APPD
D1 and CPU in reduced clock
Normal or APPD
D1 and CPU standby Self-refresh
D2 and CPU off
As the D2 state is not supported by STAPI drivers, the STAPI drivers must be terminated or removed
( rmmod )
Self-refresh
Yes
Yes
Yes
Yes
SDK support
14/31 8300955 Rev 2
UM1130
8.2
Note:
Power management profile
Creating a power management profile
The application is responsible for creating the power management profiles. Since STAPI drivers do not support the D2 state, the creation of profiles is valid for active standby, active and host passive standby modes.
The power management profile is an array of STPOWER_ProfileEntry_t structures.
The order in which the devices are added to the power management profile is very important.
● For a standby power management profile , high level drivers must appear in the list ahead of any low level drivers that are dependent upon them. This is to ensure that when a low level driver transitions to standby mode, there are no pending actions that have been requested by a high level driver that is still waiting to transition.
●
For example, the audio driver uses the FDMA driver, therefore the audio driver must appear ahead of the FDMA driver in the profile list.
An active power management profile requires opposite arrangement. The low level drivers must appear in the list ahead of the high level drivers that depend upon them.
This is to ensure that when a high level driver switches to active mode, the low level drivers that it depends upon are ready in their respective active modes.
For example, the audio driver uses the FDMA driver, therefore the audio driver must appear after of the FDMA driver in the profile list.
Figure 2
shows an example of two simple power management profiles,
ActiveProfile and PassiveProfile .
Figure 2.
Example power profile
STPOWER_ProfileEntry_t ActiveProfile [2]
= {"/platform/stpio1.0", STPOWER_DEVICE_NATIVE_LINUX, STPOWER_DEVICE_STATE_D0,
"AUD0", STPOWER_DEVICE, STPOWER_DEVICE_STATE_D0}
STPOWER_ProfileEntry_t PassiveProfile [2]
= {"/platform/stpio1.0", STPOWER_DEVICE_NATIVE_LINUX, STPOWER_DEVICE_STATE_D1,
"AUD0", STPOWER_DEVICE, STPOWER_DEVICE_STATE_D1}
The profiles include one Linux device ( stpio1.0
) and one STAPI audio device (the
STAUD_Init() call references this device as AUD0 ). STPOWER uses the profile
ActiveProfile to switch both devices to an active ( STPOWER_DEVICE_STATE_D0 ) state and the profile PassiveProfile to switch both devices to active standby
( STPOWER_DEVICE_STATE_D1 ).
STPOWER switches the devices in the same order in which they appear in the profile list. In this example, the two devices have no dependencies upon each other, so the order in which they appear is not significant.
In the case of a SoC with dual CPUs, the application running on the host CPU can control devices running on the other CPU. Therefore, there is an additional requirement when setting up the power management profile list: the application must add the devices running on the other CPU to its own profile list.
8300955 Rev 2 15/31
Power management profile
8.3
UM1130
Registering a power management profile
After the application has created a set of power management profiles, it must next register those profiles using the STPOWER_RegisterProfile() API. This API returns a Profile ID to the application if the profile has been registered successfully, or an error code if there has
Figure 3
Figure 3.
Example profile registration code
ErrorCode=STPOWER_RegisterProfile (POWER_Handle[PowerIndex],
ActiveProfiles, 2, &ActiveProfileID);
ErrorCode=STPOWER_RegisterProfile (POWER_Handle[PowerIndex],
PassiveProfiles, 2, &PassiveProfileID);
Figure 4
shows the processes involved in power management registration.
Figure 4.
Register profile
Application Profiles Register Power Function
Profile 1
Device 0
Device 1
Device 2
State
State
State
Profile 2
Device 0
Device 1
State
State
Register Profile
STPOWER Driver
STAPI Driver 0
Device 0 CallBack A
STAPI Driver 0
Device 1 CallBack B
STAPI Driver 1
Device 2 CallBack C
Profile 1 Linked List
Device 0 State CallBackA
CallBackB Device 1 State
Device 2 State CallBackC
Profile 2 Linked List
Device
Device
0
State CallBackA
1
State CallBackB
When the individual device drivers are initialized, they register a power management callback function with STPOWER. STPOWER associates each entry in the power management profile with the callback function of the relevant driver: this enables STPOWER to control the power state of each driver directly, according to the requirements of the registered power management profiles.
16/31 8300955 Rev 2
UM1130
8.4
Power management profile
Setting a power management profile
After registering the power management profiles, the application can switch to any power management profile by using the STPOWER_SetProfile() API and passing the appropriate Profile ID. For example, to switch to the active profile, this could be:
ErrCode=STPOWER_SetProfile(POWER_Handle [Index], ActiveProfileID);
This function causes the STPOWER driver to look up the power management profile associated with the Profile ID and use that to call the registered power management
callback function of each relevant driver. See
Figure 5
.
Figure 5.
Setting power management profile
Application
STPOWER Driver
Set Profile
Device 1 Callback Fn
Device 2 Callback Fn
Device 3 Callback Fn
For dual CPU SoCs, the device driver may be running on the other CPU. If this occurs, then
STPOWER sends a message to the other CPU with a request to put that device into the desired state. On receipt of a message from the host CPU, the other CPU executes the power management function for the selected device.
8.4.1 Errors
There may be situations in which a driver is unable to transition to a different power mode. If this happens, the device driver returns an error code to STPOWER which it consequently returns to the application. The application can then call the
STPOWER_GetDeviceErrorInProfile() API to identify the device that caused the original error. See
Figure 6
8300955 Rev 2 17/31
Power management profile UM1130
Figure 6.
Error detection code
ErrCode=STPOWER_SetProfile (POWER_Handle [PowerIndex], ActiveProfileID); if (ErrCode)
{
STPOWER_ErrorCode_t ProfileErorr;
ErrCode = STPOWER_GetDeviceErrorInProfile (POWER_Handle[Index],
ActiveProfileID, &ProfileError);
}
STPOWER uses the concept of a virtual device to allow an application to set low power modes on certain hardware components or clocks for which there are no associated device drivers either from STAPI or from the operating system. STPOWER registers each of these virtual devices as it does all other STAPI devices and implements their power management internally. This means that the application can treat these virtual devices as STAPI devices when creating the profile.
STPOWER registers the following virtual devices by default.
● Power virtual device , which is registered with the name passed in the
STPOWER_Init() API, and handles unused clocks.
● LMIVID , for the power management of LMI VID.
●
●
●
STPOWER uses the following virtual devices for the STi7141 only, in order to handle the clocks for that SoC.
● ClkStandbyAct : used to set clocks in active standby mode as defined in the STi7141 power specification.
ClkDocOnly : used for the docsis only mode.
ClkNormal : used for the normal clock mode.
ClkStandbyFast : used to scale clocks in the standby fast mode of the STi7141.
The application must always use the names given in bold when adding the virtual device to the profile list.
18/31 8300955 Rev 2
UM1130
8.5
Power management profile
Example code for profile
Figure 7
gives example code for creating a power management profile.
Figure 7.
Example code
STPOWER_ProfileEntry_t PowerProfile[100];
}
..
..
..
for (i=0;i<ATAPI_MAX_NUMBER;i++)
{ strncpy(PowerProfile[NumOfDevices].DeviceName,ATAPI_DeviceName[i], sizeof(STPOWER_DeviceName_t));
PowerProfile[NumOfDevices].DeviceState = POWER_State;
PowerProfile[NumOfDevices].DeviceType = STPOWER_DEVICE; NumOfDevices++;
#if defined(VTG_MAX_NUMBER) for (i=0;i<VTG_MAX_NUMBER;i++)
{ strncpy(PowerProfile[NumOfDevices].DeviceName,
VTG_DeviceName[i],sizeof(STPOWER_DeviceName_t));
PowerProfile[NumOfDevices].DeviceState = POWER_State;
PowerProfile[NumOfDevices].DeviceType = STPOWER_DEVICE;
NumOfDevices++;
}
#endif
/*ADD VIRTUAL DEVICE IN PROFILE*/ strncpy(PowerProfile[NumOfDevices].DeviceName,"LMIVID"
,sizeof(STPOWER_DeviceName_t));
PowerProfile[NumOfDevices].DeviceState = POWER_State;
PowerProfile[NumOfDevices].DeviceType = STPOWER_DEVICE;
NumOfDevices++;
/*Register Profile */
ErrorCode=STPOWER_RegisterProfile (POWER_Handle[Index], PowerProfile, NumOfDevices,
&ProfileID);
/*Set Profile*/
ErrCode=STPOWER_SetProfile (POWER_Handle[Index], ProfileID);
8300955 Rev 2 19/31
Implementing active standby mode
9 Implementing active standby mode
UM1130
●
●
●
To perform a transition to active standby mode, the application must take care of the following:
create, register and set a power management profile (see
set the host CPU frequency set and track wake up devices
Chapter 8
9.1 Set frequency
After placing devices into low power, the next step is to scale down the CPU frequency. This is done with the STPOWER_SetCPUFrequency() API. The API expects the application to pass the required frequency (in Hz) and a CPU ID. For a single core device (such as an
STi7111), the CPU is always 0.
Figure 8
STPOWER_SetCPUFrequency() .
Figure 8.
Set CPU frequency
ErrCode=STPOWER_SetCPUFrequency(POWER_Handle[Index], STTHIS_CPU,
NormalFreq/32);
Note:
ErrCode=STPOWER_SetCPUFrequency(POWER_Handle[Index], STOTHER_CPU,
NormalFreq/32);
For the STi7108, an application running on the host can set the frequency of the other CPU, but a program running on the other CPU cannot set the frequency of the host.
9.2 Set wakeup devices
The application is responsible for handling the wake up triggers, using the
STPOWER_SetWakeUpDevice() API.
●
●
●
Depending upon the type of trigger provided by the wakeup device, the application can ask
STPOWER to: set normal profile set some other profile, such as active standby stay in current mode and do nothing.
In order that the application can recognize a wake up event, it must first subscribe to that event. If the device triggers a wakeup callback function, then the application must provide and register that callback function.
20/31 8300955 Rev 2
UM1130 Implementing active standby mode
9.2.2 HDMI-CEC
An HDMI-CEC enabled TV can exchange messages with a STB over the HDMI cable. The messages sent by the TV can act as a trigger to wake up the system. The driver that handles these messages is STVOUT . This driver has been designed so that it can process
CEC messages even when in a low power state.
Subscribe to an event
The events generated are STVOUT_CEC_MESSAGE_EVT and
STVOUT_CHANGE_STATE_EVT . The application can subscribe to these events using the
STEVT_SubscribeDeviceEvent() API.
Receive a callback
The event callback is invoked as soon as the TV is turned on or off, or when the HDMI cable is plugged in. The application may parse the CEC message in the event data of
STVOUT_CEC_MESSAGE_EVT to determine whether the TV was turned on or off. The HDMI plug in event is reported by STVOUT_CHANGE_STATE_EVT .
9.2.3
The IR remote control sends signals that are received by the blast IP on the board and reported to the application as an event. The driver controlling the blast IP is STBLAST. In order to receive the IR wakeup trigger, the blast device should stay in normal mode. This is because it is needed for interrupt processing and event notification.
Subscribe to an event
The event generated by receiving an IR trigger is STBLAST_READ_DONE_EVT . The application can subscribe to this event using the STEVT_SubscribeDeviceEvent() API.
Receive a callback
The event is unusual in that it is generated only when the application makes a call to
STBLAST_Receive() . After this call, the application waits for the event notification. The event data includes information of the IR signal, if any, that was received. The IR signal is stored in the variable referenced by the out parameter of STBLAST_Receive() .
The application must check the key symbols received and perform the action applicable to the key.
Front panel or PIO
Front panel keys are usually mapped to dedicated PIO pins. To use the front panel as a wakeup trigger, the mapping on the target board is required.
The application has to generate a wakeup interrupt on the PIO line. The driver that handles interrupts on PIO lines is STPIO.
Install an interrupt handler
First, identify the PIO bank and the PIO bit that acts as the wakeup trigger. In OS21, use the
STPIO_Open() API to attach an interrupt handler to a given PIO and PIO bit. Use the API
STPIO_SetCompare() to set the value of the PIO line to a default value. This is required for generating the interrupt on the PIO line.
8300955 Rev 2 21/31
Implementing active standby mode
9.2.4
UM1130
In STLinux, the application registers a callback function with the Linux kernel.
Receive the interrupt
Whenever an interrupt occurs on the selected PIO line, the interrupt handler is invoked. The interrupt handler restores the system by setting the appropriate power management profile.
Wake up on LAN
An Ethernet MAC device can receive a wakeup signal over a LAN. This is done by sending a packet of information called a “magic packet” address to the MAC device.
A magic packet consists of six bytes of all “1” followed by the GMAC Ethernet address repeated 16 times.
When the device receives a magic packet, it raises an interrupt to switch the device into normal mode.
Subscribe to an event
In OS21, the Ethernet device is controlled by the OSPlus drivers. OSPlus enables the
Ethernet device to be put into low power mode using specific IOCTLs. See the
OSPlus User
Manual
(ADCS 7702033) for more information.
1.
Set the Ethernet MAC address with the IOCTL OSPLUS_IOCTL_ETH_SET_MAC
IOCTL.
the IOCTL to set the power management wakeup on LAN to magic packet mode, and to register the callback function that is to be called whenever the magic packet is received. As this callback function is to be called from an OSPlus ISR context, the function must be as small as possible and should not contain any blocking statements like DEBUGPRINT .
3. Set the power mode of the device to active standby with the
OSPLUS_IOCTL_SET_POWER_MODE IOCTL.
In STLinux, the application registers a callback function for wake up on LAN with the Linux kernel, and then switches the Ethernet device to the STPOWER_DEVICE_STATE_D1 power state.
Receive a callback
When the device receives a magic packet, the PMT interrupt is raised. OSPlus handles this interrupt and turns the Ethernet driver’s power profile to normal. On returning to normal power, the Ethernet driver calls the callback function that was registered at step
2
above.
22/31 8300955 Rev 2
UM1130
10
Implementing host passive standby mode
Implementing host passive standby mode
●
●
●
●
To perform a transition to host passive standby mode, the application must take care of the following:
create, register and set a power management profile (see
set the wakeup conditions set the CPU and DDR in low power mode manage the power level of on-board components
Chapter 8
Before entering this mode, always ensure that playback or record has been stopped.
10.1 Set wakeup conditions
When in host passive standby, the CPU is in sleep mode waiting for a signal from a wakeup device. Before entering standby, the application must take care of configuring the wakeup device so that it is capable of issuing the wakeup signal. This is done either using the
STPOWER API or the operating system API, as described in the following sections.
10.1.1 IR (Infrared remote control)
If wakeup from IR is required, the application must not use the STBLAST driver while creating the profile for host passive standby.
It is possible to use the LIRC driver (the native Linux driver) as a wake up device.
To configure LIRC as the wake up device, the application calls the
STPOWER_SetWakeupDevice() API, passing the path of the LIRC driver as a parameter.
The front panel keys can be connected to the SoC using either the key scanner or GPIO.
In the case where the front panel is connected with the key scanner, the application must not set the STKEYSCN driver in low power whilst setting the profile to host passive standby.
10.1.3 GPIO
The front panel keys (or any other device capable of waking the SoC) can also be connected to the SoC using GPIOs. To do this, the application must call the
STPOWER_SetWakeupDevice() API to set STPOWER_WAKEUP_GPIO as the wake up device.
On OS21, the application passes the PIO port number to the
STPOWER_SetWakeupDevice() API, whereas on STLinux the application must provide the path of the PIO device to which the front panel keys are connected.
8300955 Rev 2 23/31
Implementing host passive standby mode UM1130
10.1.4 Timer
Note:
To configure a timer event to wakeup the device, the application uses the
STPOWER_SetWakeUpDevice() API to set STPOWER_WAKEUP_TIMER as the wake up device. The application also passes the time in seconds that the timer is to run before waking the SoC. The wakeup occurs when the timer has expired, unless another wakeup trigger has already woken up the SoC.
The timer is always reset to zero on wakeup, irrespective of the device that performed the wakeup. This means that the application must always call STPOWER_SetWakeUpDevice() to set the time again following a successful wakeup.
10.1.5 Ethernet
The steps required to configure the device to be woken up using an Ethernet “magic packet” are described in
Section 9.2.4: Wake up on LAN on page 22
.
For OS21, the application must configure the OSPlus Ethernet driver to accept the magic packet.
For STLinux, the application must pass the path of the Ethernet device to the
STPOWER_SetWakeUpDevice() API.
10.1.6 HDMI-CEC
The steps required to configure the device to be woken up using HDMI-CEC are described in
Section 9.2.2: HDMI-CEC on page 21
Neither OS21 nor STLinux require any additional parameters to be defined.
10.2 Set CPU and DDR to low power mode
After putting the peripheral devices into low power mode and configuring the wakeup devices, the application can put the CPU into sleep mode and the DDR into self-refresh mode. To do this, call the STPOWER_SetCPUState() API passing the parameter
STPOWER_CPU_STATE_STANDBY . For example:
ErrCode=STPOWER_SetCPUState(POWER_Handle[Index], STPOWER_CPU_STATE_STANDBY,
&wakeupreason); // To put only CPU in sleep mode and DDR in self-refresh mode
This puts the CPU into sleep mode. The API does not return until the device has been woken by a pre-configured wakeup trigger. On receiving that trigger, the CPU comes out of sleep mode and takes the DDR out of self-refresh mode.
The STPOWER_SetCPUState() API returns the reason for the wakeup in the parameter
&wakeupreason . For example, if the device was woken up by the infrared remote control, this parameter indicates which key was pressed. If the device was woken up by an HDMI-
CEC message, then the parameter identifies the message received.
The application can use the returned wakeup reason to determine how to proceed. The application can either switch the rest of the system back into normal power mode, or return it to low power mode by calling the STPOWER_SetCPUState() API again.
To put the DDR into self-refresh mode, a piece of code that contains the DDR self-refresh mode implementation and a small interrupt dispatcher is moved into the cache of the CPU.
24/31 8300955 Rev 2
UM1130 Implementing host passive standby mode
The code performs the following actions.
1.
Sets the DDR into self-refresh mode by programming the configuration registers and disabling the DDR PLL. The DDR is no longer available to the CPU after this step.
2. It puts the CPU into sleep mode.
3. On receipt of a wakeup trigger, the CPU comes out of sleep.
4. The wakeup interrupt is processed by the interrupt dispatcher which has already been placed in the cache.
5. The CPU programs the configuration registers and enables the PLLs so that the DDR is now available to the system.
10.3 Manage power of on-board components
To control the power supply to external board components, connect the power supply enable bit to an unused GPIO. When the application takes the system into low power mode, it can trigger this GPIO to disable the power supply whilst the system is in standby.
When coming out of standby, the application can use the same GPIO to reinstate the power again.
8300955 Rev 2 25/31
Implementing controller passive standby mode
11 Implementing controller passive standby mode
UM1130
●
●
●
To perform a transition to controller passive standby mode, make sure that the following prerequisites have been completed.
perform hardware modifications (if required) set up the software set the wakeup conditions
●
●
On the STi7108-HDK V2.2 board, the following resisters must be modified with resisters of the following value:
RK26 - 10 K
RK30 - 33 K
On the STiH207-HDK board, the only requirement is to provide a permanent 1.5 V external power supply. For this, remove LP5 and LP6 and connect the external 1.5V supply between
LP5 and ground.
●
●
The following software modifications must be made:
● board should be flashed with the correct version of U-Boot (see
Section 11.2.1
) the kernel must be built with the CONFIG_HIBERNATION option the kernel must be booted with the DETACH=1 option
26/31 8300955 Rev 2
UM1130 Implementing controller passive standby mode
11.2.1 U-Boot
Prepare the U-Boot boot loader software as follows.
1.
Enable the flags CONFIG_HIBERNATION_ON_MEMORY and
CONFIG_HOM_TAG_VIRTUAL_ADDRESS for your board in the
$UBOOTDIR/include/config/<
xxxx
>.h
configuration file, where <
xxxx
> is the configuration name of the board.
2. STMicroelectronics recommend that you generate a custom romgen for U-Boot. This is because the romgen shipped with U-Boot is generated using a legacy target pack.
3. Compile and program u-boot.bin
on the Flash memory of the board.
11.2.2 Firmware
Note:
For internal SBC, by default the firmware is shipped with STAPI LDDE. If this firmware needs to be updated, replace the firmware file at $LINUX_SERVERDIR/lib/firmware .
The name of the file containing the new firmware must be lpm_fwSTxH205.elf
.
For external SBC, HDK7108 ver 2.2 uses default version 0.8.0 firmware. If the firmware needs to be updated, then it can be programmed using STLink hardware and the STVD tool.
STLPM generic IR parsing version 0.4 can set the wakeup trigger for any SoC with an internal SBC.
8300955 Rev 2 27/31
STAPI SDK commands for low power mode
12 STAPI SDK commands for low power mode
STAPI SDK supports to use of testtool commands for power management.
UM1130
Refer to the
STAPI SDK user manual
(8214357) for details of the active standby testtool commands.
Refer to the
STAPI SDK user manual
(8214357) for details of the host passive standby testtool commands.
The operation of putting the board into controller passive standby and taking it out of controller passive standby is slightly different depending upon which board is being used.
On the STi7108-HDK V2.2, the standby button on the front panel is intercepted by the SDK application. If this button is pressed when the board is in active mode, the SDK application terminates all drivers, unloads the STAPI modules and signals the kernel to enter controller passive standby mode. At that step, the STM8 powers down the board.
●
●
●
Whilst in the controller passive standby state, use any one of the following triggers to wake up the board: pressing the standby button on the front panel pressing the power key on the STM PVR1 remote control wait for the timer to reach zero (if this function has already been configured for the board, using the stpower API)
Any one of these triggers causes the STM8 to repower the SoC. On power up, U-Boot restores the kernel image and control returns to the SDK application. The SDK application loads all STAPI modules and initializes the STAPI drivers.
On the STiH207 board, putting the board into and bringing the board out of standby is controlled by using the wake up timer.
First, apply the power package release on top of the latest STAPI SDK release.
Use the following command to put the board into standby:
POWER_SETMODE 0 1 PM_CPU_OFF PM_CPU_END PM_WAKEUP_TIMER xxx where
xxx
is the number of seconds that the board is to remain in standby.
28/31 8300955 Rev 2
UM1130 STAPI SDK commands for low power mode
This command immediately terminates all drivers, unloads the STAPI modules and signals the kernel to enter controller passive standby mode. At this point, SBC powers down the board.
The timer counts down the number of seconds set in the testtool command. When it reaches zero, the SBC powers up the SoC. On power up, U-Boot restores the kernel image and control returns to the SDK application. The SDK application loads all STAPI modules and initializes the STAPI drivers.
For an SoC with an internal SBC, refer to the application note
stlpm-app-note_v0.4.docx
for information on how to configure other wakeup triggers. This application note can be provided by your ST FAE.
8300955 Rev 2 29/31
Revision history UM1130
Table 8.
Date
Document revision history
16-Nov-2010
20-Aug-2012
Revision
A
2
Changes
Initial release.
Updated Section 4.2.2: Controller passive standby mode on page 8
.
Updated Table 3: Supported features, OS21 environment
and
Table 4: Supported features, STLinux environment on page 10 .
Added
Chapter 7: Low power block details on page 11
.
Updated Table 6: Power management profile entry on page 14 .
Updated Section 8.1: Power state of STB on page 14 .
Added
Chapter 11: Implementing controller passive standby mode on page 26
.
Added
Chapter 12: STAPI SDK commands for low power mode on page 28 .
30/31 8300955 Rev 2
UM1130
Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY TWO AUTHORIZED ST REPRESENTATIVES, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING
APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY,
DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE
GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
© 2012 STMicroelectronics - All rights reserved
STMicroelectronics group of companies
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan -
Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com
8300955 Rev 2 31/31
Download
Advertisement