Power management interface(PM API)

power management interface:
down: supply device related PM interface
up: supply uniform PM interface for PM core


device PM is the core of Linux PM:
in right time put device in right state.

struct dev_pm_ops:
PM core
PM domain
device types
classes
bus types

bus types:
A bus is represented by the bus_type structure, it contains the name, the default attributes, the bus' methods, PM operations, and the driver core's private data.

A bus is a channel between the processor and one or more devices.

bus_register/bus_unregister

class:
A class is higher-level view of a device that abstracts out low-level implementation details.
A class supply uniform interface to user for similar device sets, something like mtd/spi

device type:
The type of device, "struct device" is embedded in. A class or bus can contain devices of different types like "partitions" and "disks", "mouse" and "event". This identifies the device type and carries type-specific information , equivalent to the kobj_type of a kobject. If "name" is specified, the uevent will contain it in the DEVTYPE variable.

for some reason, there are some device without driver so how to process these device's PM, through by dev_pm_domain.


priority:
dev->pm_domain->ops/ dev->type->pm/ dev->class->pm/ dev->bus->pm/ dev->driver->pm


drivers/base/power/main.c
dpm_list
pm_verb: return string according to PM_EVENT_*

device_pm_add: Add a device to the PM core's list of active devices, which is maintained by dpm_list.
device_pm_remove: Remove a device from the PM core's list of active devices, which is maintained by dpm_list.
device_pm_move_before: Move device in the PM core's list of active devices, it have two parameters: deva and devb. it will delete deva from dpm_list and reinsert it before devb.
device_pm_move_after: Move device in the PM core's list of active devices, it have two parameters: deva and devb. it will delete deva from dpm_list and reinsert it after devb.
device_pm_move_last: Move device to the end of the PM core's list of devices.
pm_op: Return the PM operation appropriate for given PM event, according to PM event return it's PM callback.
pm_late_early_op:
pm_noirq_op:
dpm_run_callback: run the pm_callback_t

device_resume_noirq: Execute an "early resume" callback for given device. there is a check flow: dev->pm_domain/ dev->type->pm/ dev->class->pm/ dev->bus->pm/ dev->driver->pm

dpm_resume_noirq: Execute "noirq resume" callback for all devices, call the "noirq" resume handlers for all devices in dpm_noirq_list and enable device drivers to receive interrupts.

device_resume_early: Execute an "early resume" callback for given device. same order as device_resume_noirq.

dpm_resume_early: Execute "early resume" callback for all devices.

dpm_resume_start: Execute "noirq" and "early" device callbacks.

device_resume: Execute "resume" callbacks for given device.

dpm_resume: Execute "resume" callbacks for no-sysdev devices

device_complete: Complete a PM transition for given device.

dpm_complete: Complete a PM transition for all non-sysdev devices.

dpm_resume_end: Execute "resume" callbacks and complete system transition.

resume_event: Return a "resume" message for given "suspend" sleep state. return a PM message representing the resume event corresponding to given sleep state.

device_suspend_noirq: Execute a "later suspend" callback for given device. The driver of device will not receive interrupts while this function is being executed.

dpm_suspend_noirq: Execute "noirq suspend" callback for all devices.

"dpm_wait_for_children"

device_suspend_late: Execute "late suspend" callback for given device.

dpm_suspend_late: Execute "late suspend" callbacks for all devices.

dpm_suspend_end: Execute "late" and "noirq" device suspend callbacks.

__device_suspend: Execute "suspend" callbacks for given device

dpm_suspend: Execute "suspend" callbacks for all non-sysdev devices.

device_prepare: Prepare a device for system power transition

dpm_prepare: Prepare all non-sysdev devices for a system PM transition.

dpm_suspend_start: Prepare devices for PM transition and suspend them.

device_pm_wait_for_dev: Wait for suspend/resume of a device to complete.

dpm_for_each_dev: Device iterator. Iterate over devices in dpm_list, and call @fn for each device, passing it @data.


prepare—>suspend—>suspend_late—>suspend_noirq-------wakeup--------->resume_noirq—>resume_early—>resume-->complete

(dpm_suspend_start + dpm_suspend_end + dpm_resume_start + dpm_resume_end)
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值