diff options
author | Manoj Iyer <manoj.iyer@canonical.com> | 2009-12-18 01:57:47 +0100 |
---|---|---|
committer | John Rigby <john.rigby@linaro.org> | 2011-08-21 21:28:49 -0600 |
commit | fc4d915b8e2d4b89abedbfc3b61921b59b03dd97 (patch) | |
tree | f61ed0c58c76d1665b3d2ef3aabbe66b12142106 /drivers/base | |
parent | b38bac45cbef9611955d6ef94a6c942d982787eb (diff) |
UBUNTU: SAUCE: (no-up) PM report driver and device suspend/resume times.
Based on a patch from Rafael J. Wysocki. This patch prints suspend/resume
information for each driver/device to dmesg.
[apw@canonical.com: rejigged to split config updates]
[apw@canonical.com: move the configuration item fix build when full PM
is not enabled]
Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/Kconfig | 8 | ||||
-rw-r--r-- | drivers/base/power/main.c | 26 |
2 files changed, 34 insertions, 0 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index d57e8d0fb82..fbd221f7494 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -168,4 +168,12 @@ config SYS_HYPERVISOR bool default n +config SR_REPORT_TIME_LIMIT + int "Default low threshold" + depends on PM + default 100 + help + Print suspend/resume information for driver/device for time greater + then default msec, ie 100 msec. + endmenu diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 06f09bf89cb..11366960cd7 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -391,6 +391,24 @@ static void pm_dev_err(struct device *dev, pm_message_t state, char *info, dev_name(dev), pm_verb(state.event), info, error); } +static void device_show_time(struct device *dev, ktime_t starttime, pm_message_t state, char *info) +{ + ktime_t calltime; + s64 usecs64; + int usecs; + + calltime = ktime_get(); + usecs64 = ktime_to_ns(ktime_sub(calltime, starttime)); + do_div(usecs64, NSEC_PER_USEC); + usecs = usecs64; + if (usecs == 0) + usecs = 1; + if ((usecs / USEC_PER_MSEC) > CONFIG_SR_REPORT_TIME_LIMIT) + pr_info("PM: %s%s%s of drv:%s dev:%s complete after %ld.%03ld msecs\n", info ?: "", info ? " " : "", pm_verb(state.event), + dev_driver_string(dev), dev_name(dev), usecs / USEC_PER_MSEC, + usecs % USEC_PER_MSEC); +} + static void dpm_show_time(ktime_t starttime, pm_message_t state, char *info) { ktime_t calltime; @@ -421,6 +439,7 @@ static void dpm_show_time(ktime_t starttime, pm_message_t state, char *info) static int device_resume_noirq(struct device *dev, pm_message_t state) { int error = 0; + ktime_t starttime = ktime_get(); TRACE_DEVICE(dev); TRACE_RESUME(0); @@ -428,6 +447,7 @@ static int device_resume_noirq(struct device *dev, pm_message_t state) if (dev->pwr_domain) { pm_dev_dbg(dev, state, "EARLY power domain "); error = pm_noirq_op(dev, &dev->pwr_domain->ops, state); + device_show_time(dev, starttime, state, "early"); } else if (dev->type && dev->type->pm) { pm_dev_dbg(dev, state, "EARLY type "); error = pm_noirq_op(dev, dev->type->pm, state); @@ -505,6 +525,7 @@ static int legacy_resume(struct device *dev, int (*cb)(struct device *dev)) static int device_resume(struct device *dev, pm_message_t state, bool async) { int error = 0; + ktime_t starttime = ktime_get(); TRACE_DEVICE(dev); TRACE_RESUME(0); @@ -555,6 +576,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) } } + device_show_time(dev, starttime, state, NULL); End: dev->power.is_suspended = false; @@ -743,6 +765,7 @@ static pm_message_t resume_event(pm_message_t sleep_state) static int device_suspend_noirq(struct device *dev, pm_message_t state) { int error; + ktime_t starttime = ktime_get(); if (dev->pwr_domain) { pm_dev_dbg(dev, state, "LATE power domain "); @@ -764,6 +787,7 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state) error = pm_noirq_op(dev, dev->bus->pm, state); if (error) return error; + device_show_time(dev, starttime, state, "late"); } return 0; @@ -841,6 +865,7 @@ static int legacy_suspend(struct device *dev, pm_message_t state, static int __device_suspend(struct device *dev, pm_message_t state, bool async) { int error = 0; + ktime_t starttime = ktime_get(); dpm_wait_for_children(dev, async); device_lock(dev); @@ -887,6 +912,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) } } + device_show_time(dev, starttime, state, NULL); End: dev->power.is_suspended = !error; |