[[bc10]] [[bc10-router]] [[bc10]]~ [[bc10-router]]~ #contents ** Suspend /Resume [#y10c3145] > OMAP 3530 is capable of handling Suspend/Resume.~ When no CPU power is required such as no communications, the CPU goes to the sleep state. It will be expected to reduce its consumption of energy and to conserve its energy.~ ~ To enter the suspend mode, apply the command shown below.~ # echo mem > /sys/power/state As the following messages appear on console, the CPU goes to the sleep state. [ 132.186309] PM: Syncing filesystems ... done. [ 132.400665] Freezing user space processes ... (elapsed 0.01 seconds) done. [ 132.424591] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) done. [ 132.455871] Suspending console(s) (use no_console_suspend to debug) To go back to Resume, type any key from the serial console or input a signal from its preconfigured wakeup sources (the keypad, touch screen, and other sources that has configured before).~ [ 132.464385] phy0 -> rt2x00lib_suspend: Notice - Going to sleep. [ 132.648376] PM: suspend of devices complete after 185.180 msecs [ 132.649017] PM: late suspend of devices complete after 0.610 msecs [ 132.649902] PM: noirq suspend of devices complete after 0.854 msecs [ 132.650177] Successfully put all powerdomains to target state [ 132.651367] PM: noirq resume of devices complete after 0.915 msecs [ 132.651916] PM: early resume of devices complete after 0.396 msecs [ 133.305328] PM: resume of devices complete after 653.289 msecs [ 133.357299] Restarting tasks ... [ 133.361206] usb 1-2: USB disconnect, device number 2 [ 133.366424] usb 1-2.2: USB disconnect, device number 3 done. [ 133.386016] usb 1-2.3: USB disconnect, device number 4 [ 133.391784] asix 1-2.3:1.0 eth0: unregister 'asix' usb-ehci-omap.0-2.3, ASIX AX88772 USB 2.0 Ethernet In the messages shown above, the 5th line, which starts with “Successfully put...,” is the last message at Suspend state. The 6th line is the beginning of Resume since it says to “resume” some devices. The 6th line or later describes the active state (in Resume).~ ~ Once rt2x00, the driver USB connected Wi-Fi module, sleeps correctly, USB is kept disconnecting even though bc10 is resumed and re-energized. In this case, USB connected devices can not work after resuming the operation.~ **no_console_suspend [#gea0a31e] > As going to Suspend mode at the configuration above, the message shown below appears. Suspending console(s) (use no_console_suspend to debug) As seen in the message above, debugging Suspend/Resume itself, no_console_suspend is treated as an option of the booting process of kernel. As this option is effective, the console never goes to sleep mode.~ ~ The contents of uEnv.txt used here are shown below. According to uEnv.txt, u-boot is configured to be placed at FAT partition and to be booted from the partition.~ console=ttyO2,115200n8 mpurate=auto buddy=none vram=12M dvimode=640x480MR-16@60 defaultdisplay=dvi loadaddr=0x80200000 mmcroot=/dev/mmcblk0p2 rw mmcrootfstype=ext3 rootwait mmcargs=setenv bootargs console=${console} ${optargs} mpurate=${mpurate} buddy=${buddy} camera=${camera} vram=${vram} omapfb.mode=dvi:${dvimode} omapdss.def_disp=${defaultdisplay} root=${mmcroot} rootfstype=${mmcrootfstype} no_console_suspend mmcboot=echo Booting from mmc (uEnv.txt configuration) ...; run mmcargs; bootm ${loadaddr} loaduimagefat=fatload mmc ${mmcdev} ${loadaddr} uImage uenvcmd=run loaduimagefat; run mmcboot At the end of mmcargs, no_console_suspend is added.~ Boot u-boot with this new uEnv.txt, then go to the sleep state.~ # echo mem > /sys/power/state [ 119.239715] PM: Syncing filesystems ... done. [ 119.283752] Freezing user space processes ... (elapsed 0.02 seconds) done. [ 119.314239] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) done. [ 119.347229] phy0 -> rt2x00lib_suspend: Notice - Going to sleep. [ 119.537750] PM: suspend of devices complete after 191.711 msecs [ 119.544555] PM: late suspend of devices complete after 0.610 msecs [ 119.552093] PM: noirq suspend of devices complete after 0.854 msecs Since the console never goes to sleep, the messages the messages continuously describe whole process in real time. As it goes to Suspend or to Resume, the messages explain the process of shifting from the active state to sleep state or vice versa. (As no_console_suspend is NOT set, the messages explain the conditions only after the system is resumed. The process are NOT defined in real time. They are delayed due to the console is in sleep state.)~ As making system Resume by typing any key from the console, the following messages are displayed.~ [ 119.559051] Powerdomain (per_pwrdm) didn't enter target state 1 [ 119.559051] Powerdomain (core_pwrdm) didn't enter target state 1 [ 119.559051] Could not enter target state in pm_suspend [ 119.560211] PM: noirq resume of devices complete after 0.854 msecs [ 119.567443] PM: early resume of devices complete after 0.427 msecs [ 120.226074] PM: resume of devices complete after 651.977 msecs [ 120.233032] Restarting tasks ... [ 120.236968] usb 1-2: USB disconnect, device number 2 [ 120.242340] usb 1-2.2: USB disconnect, device number 3 done. [ 120.271697] usb 1-2.3: USB disconnect, device number 4 [ 120.277496] asix 1-2.3:1.0 eth0: unregister 'asix' usb-ehci-omap.0-2.3, ASIX AX88772 USB 2.0 Ethernet As no_console_suspend is set, per_pwrdm and core_pwrdm are not going to the sleep sate, and the serial console display the debug outputs from kernel.~ ** debugfs [#b49a80cf] > The information of the power management of OMAP3530 is obtained from debugfs.~ First, debugfs is mounted. In the following example, a debug directory is previously made.~ Then, mount the debug directory.~ # mount -t debugfs debugfs /debug The information of power management is described below the directory of pm_debug/~ # cat /debug/pm_debug/ /debug/pm_debug/cam_pwrdm/ /debug/pm_debug/mpu_pwrdm/ /debug/pm_debug/core_pwrdm/ /debug/pm_debug/neon_pwrdm/ /debug/pm_debug/count /debug/pm_debug/per_pwrdm/ /debug/pm_debug/dss_pwrdm/ /debug/pm_debug/sgx_pwrdm/ /debug/pm_debug/emu_pwrdm/ /debug/pm_debug/time /debug/pm_debug/enable_off_mode /debug/pm_debug/usbhost_pwrdm/ /debug/pm_debug/iva2_pwrdm/ /debug/pm_debug/wkup_pwrdm/ A directory, which attaches _pwrdm at the end, has the information and configuration of power domain. OMAP3530 divides the power management system into several power domains by the functions of SoC. Each power domain turns on/off the power independently by its need.~ ~ count defines the numbers of shifts between on mode and off mode at each power domain. () indicates the present mode.~ # cat /debug/pm_debug/count usbhost_pwrdm (ON),OFF:0,RET:0,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 sgx_pwrdm (OFF),OFF:1,RET:0,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 core_pwrdm (ON),OFF:0,RET:0,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0,RET-MEMBANK2-OFF:0 per_pwrdm (ON),OFF:0,RET:0,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 dss_pwrdm (ON),OFF:0,RET:130993,INA:0,ON:130994,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 cam_pwrdm (RET),OFF:0,RET:1,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 neon_pwrdm (ON),OFF:0,RET:149943,INA:3926,ON:153870,RET-LOGIC-OFF:0 mpu_pwrdm (ON),OFF:0,RET:149943,INA:3926,ON:153870,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 iva2_pwrdm (RET),OFF:0,RET:1,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0,RET-MEMBANK2-OFF:0,RET-MEMBANK3-OFF:0,RET-MEMBANK4-OFF:0 usbhost_clkdm->usbhost_pwrdm (3) sgx_clkdm->sgx_pwrdm (0) per_clkdm->per_pwrdm (20) cam_clkdm->cam_pwrdm (0) dss_clkdm->dss_pwrdm (1) core_l4_clkdm->core_pwrdm (25) core_l3_clkdm->core_pwrdm (5) d2d_clkdm->core_pwrdm (0) iva2_clkdm->iva2_pwrdm (0) neon_clkdm->neon_pwrdm (0) mpu_clkdm->mpu_pwrdm (0) prm_clkdm->wkup_pwrdm (0) cm_clkdm->core_pwrdm (0) time defines the duration of each mode.~ # cat /debug/pm_debug/time usbhost_pwrdm (ON),OFF:0,RET:0,INA:0,ON:3059305603026 sgx_pwrdm (OFF),OFF:3055783935546,RET:0,INA:0,ON:3521697998 core_pwrdm (ON),OFF:0,RET:0,INA:0,ON:3059305633544 per_pwrdm (ON),OFF:0,RET:0,INA:0,ON:3059305541992 dss_pwrdm (ON),OFF:0,RET:2148355531323,INA:0,ON:910950041186 cam_pwrdm (RET),OFF:0,RET:3055757873534,INA:0,ON:3547698975 neon_pwrdm (ON),OFF:0,RET:3033790375457,INA:481475839,ON:25033721213 mpu_pwrdm (ON),OFF:0,RET:3033876709697,INA:482116696,ON:24946746116 iva2_pwrdm (RET),OFF:0,RET:3055783935546,INA:0,ON:3521606445 enable_off_mode is the configuration for off mode.~ The default setting of this mode is 0, and it means it maintains the condition of sleep as it is in Suspend.~ # echo 1 > enable_off_mode Making off mode effective, it goes to deeper sleep condition than Suspend. It reduces the power consumption and conserves the power. To see the difference between these modes, check at /debug/pm_debug/count after going back to Resume.~ > - As enable_off_mode is 0~ Since the device is booted, the power domains of unused video function and SGX are not in OFF, they are sifted into RET.~ # cat /debug/pm_debug/count usbhost_pwrdm (ON),OFF:0,RET:1,INA:0,ON:2,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 sgx_pwrdm (OFF),OFF:1,RET:0,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 core_pwrdm (ON),OFF:0,RET:1,INA:0,ON:2,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0,RET-MEMBANK2-OFF:0 per_pwrdm (ON),OFF:0,RET:1,INA:0,ON:2,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 dss_pwrdm (ON),OFF:0,RET:5,INA:0,ON:6,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 cam_pwrdm (RET),OFF:0,RET:1,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 neon_pwrdm (ON),OFF:0,RET:8263,INA:538,ON:8802,RET-LOGIC-OFF:0 mpu_pwrdm (ON),OFF:0,RET:8263,INA:538,ON:8802,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 iva2_pwrdm (RET),OFF:0,RET:1,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0,RET-MEMBANK2-OFF:0,RET-MEMBANK3-OFF:0,RET-MEMBANK4-OFF:0 usbhost_clkdm->usbhost_pwrdm (3) sgx_clkdm->sgx_pwrdm (0) per_clkdm->per_pwrdm (17) cam_clkdm->cam_pwrdm (0) dss_clkdm->dss_pwrdm (2) d2d_clkdm->core_pwrdm (0) iva2_clkdm->iva2_pwrdm (0) mpu_clkdm->mpu_pwrdm (0) core_l4_clkdm->core_pwrdm (25) core_l3_clkdm->core_pwrdm (4) neon_clkdm->neon_pwrdm (0) > - As enable_off_mode is 1~ As the device goes to Suspend, it is shifted into OFF.~ # cat /debug/pm_debug/count usbhost_pwrdm (ON),OFF:1,RET:0,INA:0,ON:2,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 sgx_pwrdm (OFF),OFF:1,RET:0,INA:0,ON:1,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 core_pwrdm (ON),OFF:1,RET:0,INA:0,ON:2,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0,RET-MEMBANK2-OFF:0 per_pwrdm (ON),OFF:1,RET:0,INA:0,ON:2,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 dss_pwrdm (ON),OFF:497,RET:157983,INA:0,ON:158481,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 cam_pwrdm (OFF),OFF:1,RET:1,INA:0,ON:2,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 neon_pwrdm (ON),OFF:527,RET:178339,INA:2174,ON:181041,RET-LOGIC-OFF:0 mpu_pwrdm (ON),OFF:527,RET:178339,INA:2174,ON:181041,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0 iva2_pwrdm (OFF),OFF:1,RET:1,INA:0,ON:2,RET-LOGIC-OFF:0,RET-MEMBANK1-OFF:0,RET-MEMBANK2-OFF:0,RET-MEMBANK3-OFF:0,RET-MEMBANK4-OFF:0 usbhost_clkdm->usbhost_pwrdm (3) sgx_clkdm->sgx_pwrdm (0) per_clkdm->per_pwrdm (17) cam_clkdm->cam_pwrdm (0) dss_clkdm->dss_pwrdm (2) d2d_clkdm->core_pwrdm (0) iva2_clkdm->iva2_pwrdm (0) mpu_clkdm->mpu_pwrdm (0) core_l4_clkdm->core_pwrdm (25) core_l3_clkdm->core_pwrdm (4) neon_clkdm->neon_pwrdm (0) ** wakeup_timer [#w7a04176] > The power management of linux-omap 2.6x branches has wakeup_timer function, which allows the device to the sleep state for the preset duration. wakeup_timer lets the device wake up after the preset duration passes.~ ~ Via sysfs interface, wakeup time is configured as it seen below. Then, make it Suspend.~ # echo 5 > /sys/kernel/debug/pm_debug/wakeup_timer_seconds # echo -n “mem” > /sys/power/state The configuration above faces it to sleep 5 seconds. Then, it goes to Resume.~ ~ To debug the code of power management, this gptimer_wakeup as removed temporally, and there was a plan to bring back a function, which highly resembles gptimer_wakeup after the arrangment of code was completed. However, this plan has not been materialized and the function or gptimer_wakeup has not been added back since then.~ ~ omap2+: Remobe gptimer_wakeup for now~ [[https://patchwork.kernel.org/patch/896572]]~ ~ Bring back gptimer_wakeup~ [[http://www.spinics.net/lists/linux-omap/msg72142.html]]~ See the listed threads.~ ~ * Revision History [#cb9d3d03] > - 2013-08-09~ This article is initially published.