External devices

AYAN KUMAR HALDER ayankumarh at gmail.com
Fri Sep 5 07:03:59 EDT 2014


Hi Ran,

Please find my replies as follows:-

> How does the driver invokes moving to idle state ?

The driver uses numerous apis to send its device to idle state. Some
of them are as follows:-
1. pm_runtime_put/pm_runtime_put_sync - which decreases the usage
count and ultimately calls pm_runtime_idle.
2. pm_runtime_idle - which calls the corresponding
driver->runtime_idle after checking the usage count
3. pm_request_idle - calls pm_runtime_idle

Is it the same as
> invoking runtime suspend by the driver ?

In some cases, eg In platform subsystem drivers , runtime_suspend gets
called from runtime_idle. eg Refer drivers/base/platform.c, the
runtime operations assigned are :-
static const struct dev_pm_ops platform_dev_pm_ops = {
        .runtime_suspend = pm_generic_runtime_suspend,
        .runtime_resume = pm_generic_runtime_resume,
        .runtime_idle = pm_generic_runtime_idle,
        USE_PLATFORM_PM_SLEEP_OPS
};
Here pm_generic_runtime_idle() after calling the driver specific
runtime_idle api, calls pm_runtime_suspend -->
pm_generic_runtime_suspend  ---> driver specific runtime suspend call.

> What is the difference between idle state to runtime suspend ?

I don't clearly understand the difference between idle state and
runtime suspend as in case of most devices (eg platform devices, usb
devices)
, I see that runtime_idle eventually calls runtime_suspend. eg
drivers/usb/core/usb.c , usb_runtime_idle() -----> pm_runtime_autosuspend()

> Are you familiar with any character device example for using PM ?

Check drivers/usb/core/usb.c.

Regards,
Ayan Kumar Halder



More information about the Kernelnewbies mailing list