Power management interface(PM API)

来源:互联网 发布:成都gis软件培训班 编辑:程序博客网 时间:2024/06/05 20:32
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)
 

0 0
原创粉丝点击