Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction...
Transcript of Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction...
![Page 1: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/1.jpg)
Runtime PMUpstream I/O Device Power Management
Magnus [email protected]
Renesas Electronics Corp.
April 2011
Magnus Damm ([email protected]) Runtime PM April 2011 1 / 40
![Page 2: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/2.jpg)
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 2 / 40
![Page 3: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/3.jpg)
Introduction
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 3 / 40
![Page 4: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/4.jpg)
Introduction Introduction & Motivation
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 4 / 40
![Page 5: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/5.jpg)
Introduction Introduction & Motivation
Introduction & Motivation
Power Management is becoming increasingly important for...I SoC vendorsI Embedded System designersI End users
Yet, Traditional Linux PM is not a perfect fit for Embedded Systems.
Magnus Damm ([email protected]) Runtime PM April 2011 5 / 40
![Page 6: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/6.jpg)
Introduction Introduction & Motivation
Introduction & Motivation
Why?I Linux kernel PM originally designed for PC use case.I Little feedback to community from Embedded vendors.I Embedded vendors treating PM as “secret sauce”.
This future is bright:I Linux kernel has Runtime PM upstream.I The Embedded vendors are slowly improving.
Magnus Damm ([email protected]) Runtime PM April 2011 6 / 40
![Page 7: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/7.jpg)
Introduction Target Hardware Platform
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 7 / 40
![Page 8: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/8.jpg)
Introduction Target Hardware Platform
Renesas AP4 board “Mackerel”:I LAN9220 Ethernet, Serial-over-USB, USB Function/HostI 256 MiB RAM, NOR Flash, 2 x MMC/SD/SDIO, 1 x MicroSDI WVGA LCD Panel, 8-bit YUV Camera, Audio In/Out
Magnus Damm ([email protected]) Runtime PM April 2011 8 / 40
![Page 9: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/9.jpg)
Introduction Target Hardware Platform
RTC CMT KEYSC
CPU MEM
SCIF TMU LCDC
RCLK
CLK
CPG
KEYPAD
SYSTEMMEMORY
LCDPANEL
RS-232
RTC CMT KEYSC
CPU MEM
SCIF TMU LCDC
RCLK
CLK
CPG
KEYPAD
SYSTEMMEMORY
LCDPANEL
RS-232
AP4 (sh7372) SoC Power Management properties:I 2 CPU Cores (AMP: Cortex-A8 + SH4AL-DSP)I ~30 Shared clocksI ~10 Power domains
Magnus Damm ([email protected]) Runtime PM April 2011 9 / 40
![Page 10: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/10.jpg)
System-Wide PM
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 10 / 40
![Page 11: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/11.jpg)
System-Wide PM Suspend-to-RAM / Suspend-to-Disk
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 11 / 40
![Page 12: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/12.jpg)
System-Wide PM Suspend-to-RAM / Suspend-to-Disk
System-Wide PM Overview
System-Wide PM is trivial in theory:I Suspend SystemI Wait for Wakeup EventI Resume System
But in practice:I Suspend-to-RAM and Suspend-to-Disk are quite different
Magnus Damm ([email protected]) Runtime PM April 2011 12 / 40
![Page 13: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/13.jpg)
System-Wide PM Suspend-to-RAM / Suspend-to-Disk
Suspend-to-Disk - CONFIG_HIBERNATION
CONFIG_HIBERNATION:I Freezes system activity, suspends devicesI Saves image to swap, turns power offI Power on, boots kernel, loads image from swapI Resumes devices, continues system activity
#echo disk >/sys/power/state
Suspend-to-Disk allows total system power down.
Magnus Damm ([email protected]) Runtime PM April 2011 13 / 40
![Page 14: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/14.jpg)
System-Wide PM Suspend-to-RAM / Suspend-to-Disk
Suspend-to-RAM - CONFIG_SUSPEND
CONFIG_SUSPEND:I Freezes system activity, suspends devicesI Enters sleep mode, waits for wakeup eventI Resumes devices, continues system activity
#echo mem >/sys/power/state
Wakeup latency of Suspend-to-RAM beats Suspend-to-Disk.
Magnus Damm ([email protected]) Runtime PM April 2011 14 / 40
![Page 15: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/15.jpg)
System-Wide PM Suspend-to-RAM / Suspend-to-Disk
Type of Device - Wakeup source or not?
For Suspend-to-RAM there are two types of devices:I Hardware device without wakeup sourceI Hardware device tied to wakeup source
An actual hardware device may have a wakeup source but..I Software support is missing/incompleteI Signal for wakeup is not connected
Typical wakeup devices:I Network interface, RTC, Keypad, Touchscreen
Magnus Damm ([email protected]) Runtime PM April 2011 15 / 40
![Page 16: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/16.jpg)
System-Wide PM Suspend-to-RAM / Suspend-to-Disk
Devices without wakeup source
Simple device driver example:
->probe():I Allocates memory, Maps I/O memory, Enables clocksI Requests IRQs, Starts hardware
->remove():I Stops hardware, Frees IRQsI Disables clocks, Unmaps I/O memory, Frees memory
->suspend():I Stops hardware
->resume():I Starts hardware
Magnus Damm ([email protected]) Runtime PM April 2011 16 / 40
![Page 17: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/17.jpg)
System-Wide PM Suspend-to-RAM / Suspend-to-Disk
Devices with wakeup source
Simple device driver example:
->probe():I Same as non-wakeup example plus device_init_wakeup()
->suspend():I Put hardware in low power mode if possibleI Checks device_may_wakeup()I Notifies IRQ controller with enable_irq_wake()
->resume():I Put hardware in regular mode of operationI Checks device_may_wakeup()I Notifies IRQ controller with disable_irq_wake()
Magnus Damm ([email protected]) Runtime PM April 2011 17 / 40
![Page 18: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/18.jpg)
System-Wide PM Suspend-to-RAM / Suspend-to-Disk
System Devices
IRQ controller software is at suspend() time expected to:I Disable all non-wakeup IRQsI Enable IRQs marked with enable_irq_wake()
Clock generator software is at suspend() time expected to:I Disable all non-wakeup clocks
Timers:I Are suspended late in the process.
Magnus Damm ([email protected]) Runtime PM April 2011 18 / 40
![Page 19: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/19.jpg)
System-Wide PM PC vs Embedded System
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 19 / 40
![Page 20: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/20.jpg)
System-Wide PM PC vs Embedded System
PC vs Embedded System
Traditional PC hardware is often associated with:I BIOS, ACPI and firmware interfacesI Focus on CPU core, Standardized hardware bussesI Limited number of wakeup sources
In suspended state, most of the PC hardware is shutdown, but...I At least one wakeup IRQs must be enabledI A subset of the clocks must be turned onI Devices with wakeup sources enabled must be kept on
Where are IRQ and clock dependencies for wakeup devices managed?
Most PC hardware is powered off during System-Wide suspend.
Magnus Damm ([email protected]) Runtime PM April 2011 20 / 40
![Page 21: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/21.jpg)
System-Wide PM PC vs Embedded System
PC vs Embedded System
Embedded Systems are often associated with:I Boot loaders with unreadable source codeI Device drivers programming bare metalI Focus on I/O devices on custom bussesI Any IRQ can be a wakeup source
In suspended state, most hardware is shutdown, but...I At least one wakeup IRQs must be enabledI A subset of the clocks must be turned onI Devices with wakeup sources enabled must be kept onI Wakeup device selection limits available sleep modes
No firmware to abstract IRQ and clock dependencies.
Magnus Damm ([email protected]) Runtime PM April 2011 21 / 40
![Page 22: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/22.jpg)
System-Wide PM PC vs Embedded System
Typical Japanese Cell Phone:I Even during standby some CPU cores need to be awake.I Vendor-specific code deals with wakeup dependencies.
System-Wide suspend provides no dependency information.
Magnus Damm ([email protected]) Runtime PM April 2011 22 / 40
![Page 23: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/23.jpg)
System-Wide PM Prototypes
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 23 / 40
![Page 25: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/25.jpg)
CPU Runtime PM
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 25 / 40
![Page 26: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/26.jpg)
CPU Runtime PM Linux Idle loop & CPUIdle
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 26 / 40
![Page 27: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/27.jpg)
CPU Runtime PM Linux Idle loop & CPUIdle
Linux Idle loop & CPUIdle
CPU Core power is managed by the idle loop:I Works well with light sleepI However, deep sleep comes with latency costs
CPUIdle replaces the idle loop and..I Keeps track of sleep modes and their latencyI Clock and power domain hierarchy limits availability
Magnus Damm ([email protected]) Runtime PM April 2011 27 / 40
![Page 28: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/28.jpg)
CPU Runtime PM Linux Idle loop & CPUIdle
CPUIdle Overview
Architecture independent overview:I Light: Low latency - Few dependencies - Basic Power SavingsI ...I ...I ...I Deep: High latency - Many dependencies - Best Power Savings
Theory: For best power savings, enter as deep mode as possible!
Magnus Damm ([email protected]) Runtime PM April 2011 28 / 40
![Page 29: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/29.jpg)
CPU Runtime PM Linux Idle loop & CPUIdle
sh7372 CPUIdle Support
sh7372 ARM CPUIdle Overview:I ARM WFI - Clock stoppedI Core Standby - ARM Core Power Off (L2 Cache Power On)I A3SM - ARM Core + L2 Cache Power OffI A4S - ARM Core + L2 Cache + I/O Devices Power Off
An ARM Core Standby prototype for sh7372 has been posted to:http://www.spinics.net/lists/linux-sh/msg07385.html
Magnus Damm ([email protected]) Runtime PM April 2011 29 / 40
![Page 30: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/30.jpg)
CPU Runtime PM Tickless timer
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 30 / 40
![Page 31: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/31.jpg)
CPU Runtime PM Tickless timer
Tickless CMT Timer
500
1000
1500
2000
2500
3000
0 20000 40000 60000 80000 100000 120000
Num
ber of
Tim
er In
terrup
ts (Acc
umul
ated
)
Time (4096 ticks/s, total 30s)
Number of SuperH CMT Interrupts (HZ=100, Tickless ON/OFF)
CONFIG_NO_HZ=nCONFIG_NO_HZ=y
Magnus Damm ([email protected]) Runtime PM April 2011 31 / 40
![Page 32: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/32.jpg)
I/O Device Runtime PM
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 32 / 40
![Page 33: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/33.jpg)
I/O Device Runtime PM Platform Device Runtime PM
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 33 / 40
![Page 34: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/34.jpg)
I/O Device Runtime PM Platform Device Runtime PM
Runtime PM for Platform Devices:I Give drivers a single interface for clock and power domains.I Allows drivers to notify architecure code of device idle state.I Provide drivers with PM callbacks for context save/restore.I Used in drivers by Renesas, TI, Intel, Qualcomm and Samsung.
Runtime PM allows architecture code to:I Track device driver idle state.I Let device idle state control power domains.I Adjust CPU sleep mode depending on idle state of devices.
Runtime PM allow drivers to export dependency information.
Magnus Damm ([email protected]) Runtime PM April 2011 34 / 40
![Page 35: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/35.jpg)
I/O Device Runtime PM Platform Device Runtime PM
Runtime PM exists thanks to:I Kevin Hilman & Paul Walmsley - Initial Runtime PM discussionsI Rafael Wysocki - Runtime PM ImplementationI CELF / Linux Foundation - For ELC and Collaboration space
Magnus Damm ([email protected]) Runtime PM April 2011 35 / 40
![Page 36: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/36.jpg)
I/O Device Runtime PM Platform Device Runtime PM
Runtime PM for Platform Devices - API
Functions from include/linux/pm_runtime.h:I pm_runtime_enable(device);
I pm_runtime_get_sync(device);
I pm_runtime_put_sync(device);
I pm_runtime_disable(device);
Each driver provide struct dev_pm_ops callbacks:I runtime_suspend(device);
I runtime_resume(device);
Magnus Damm ([email protected]) Runtime PM April 2011 36 / 40
![Page 37: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/37.jpg)
I/O Device Runtime PM Platform Device Runtime PM
Runtime PM Framework - API
RTC CMT KEYSC
CPU MEM
SCIF TMU LCDC
RCLK
CLK
CPG
KEYPAD
SYSTEMMEMORY
LCDPANEL
RS-232
RTC CMT KEYSC
CPU MEM
SCIF TMU LCDC
RCLK
CLK
CPG
KEYPAD
SYSTEMMEMORY
LCDPANEL
RS-232
Runtime PM usage in Platform Device Drivers:I Before accessing hardware, resume device withpm_runtime_get_sync();
I When done with hardware, notify device idle withpm_runtime_put_sync();
Magnus Damm ([email protected]) Runtime PM April 2011 37 / 40
![Page 38: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/38.jpg)
I/O Device Runtime PM Device Drivers
Outline
IntroductionIntroduction & MotivationTarget Hardware Platform
System-Wide PMSuspend-to-RAM / Suspend-to-DiskPC vs Embedded SystemPrototypes
CPU Runtime PMLinux Idle loop & CPUIdleTickless timer
I/O Device Runtime PMPlatform Device Runtime PMDevice Drivers
Magnus Damm ([email protected]) Runtime PM April 2011 38 / 40
![Page 39: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/39.jpg)
I/O Device Runtime PM Device Drivers
Device Drivers - Overview
Platform Device Drivers with Runtime PM from Renesas:I i2c-sh_mobile.c - Enabled during I2C transferI sh_mobile_ceu_camera.c - Enabled during Camera captureI sh_mobile_lcdcfb.c - Enabled during refresh with SYS panelsI sh_eth.c - Enabled when network interface is upI uio_pdrv_genirq.c - Enabled when UIO device is open()
Magnus Damm ([email protected]) Runtime PM April 2011 39 / 40
![Page 40: Runtime PM - Upstream I/O Device Power Management · I/O Device Runtime PM Outline Introduction Introduction & Motivation Target Hardware Platform System-Wide PM Suspend-to-RAM](https://reader034.fdocuments.in/reader034/viewer/2022050101/5f40a050e107503527489ed7/html5/thumbnails/40.jpg)
Summary
Summary
I System-Wide suspend provides no dependency information.I Runtime PM allow drivers to export dependency information.I The majority of all SoC vendors start using Runtime PM.
Magnus Damm ([email protected]) Runtime PM April 2011 40 / 40