aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorManoj Iyer <manoj.iyer@canonical.com>2009-12-18 01:57:47 +0100
committerJohn Rigby <john.rigby@linaro.org>2012-06-20 20:23:01 -0600
commit8d95f1a0eef26b2dc86cb039261848382217f228 (patch)
treec10eb0ada2dfdc9150c55e132858d07b66dc0c26 /drivers
parentf027a31378e58220906a4a5d2d35d8dd61035f73 (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')
-rw-r--r--drivers/base/Kconfig8
-rw-r--r--drivers/base/power/main.c26
2 files changed, 34 insertions, 0 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 9aa618acfe9..1cd76916804 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -192,4 +192,12 @@ config DMA_SHARED_BUFFER
APIs extension; the file's descriptor can then be passed on to other
driver.
+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 b462c0e341c..3b97a067512 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -352,6 +352,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;
@@ -404,6 +422,7 @@ static int device_resume_noirq(struct device *dev, pm_message_t state)
pm_callback_t callback = NULL;
char *info = NULL;
int error = 0;
+ ktime_t starttime = ktime_get();
TRACE_DEVICE(dev);
TRACE_RESUME(0);
@@ -411,6 +430,7 @@ static int device_resume_noirq(struct device *dev, pm_message_t state)
if (dev->pm_domain) {
info = "noirq power domain ";
callback = pm_noirq_op(&dev->pm_domain->ops, state);
+ device_show_time(dev, starttime, state, "early");
} else if (dev->type && dev->type->pm) {
info = "noirq type ";
callback = pm_noirq_op(dev->type->pm, state);
@@ -565,6 +585,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
char *info = NULL;
int error = 0;
bool put = false;
+ ktime_t starttime = ktime_get();
TRACE_DEVICE(dev);
TRACE_RESUME(0);
@@ -625,6 +646,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
callback = pm_op(dev->driver->pm, state);
}
+ device_show_time(dev, starttime, state, NULL);
End:
error = dpm_run_callback(callback, dev, state, info);
dev->power.is_suspended = false;
@@ -832,6 +854,7 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state)
{
pm_callback_t callback = NULL;
char *info = NULL;
+ ktime_t starttime = ktime_get();
if (dev->pm_domain) {
info = "noirq power domain ";
@@ -845,6 +868,7 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state)
} else if (dev->bus && dev->bus->pm) {
info = "noirq bus ";
callback = pm_noirq_op(dev->bus->pm, state);
+ device_show_time(dev, starttime, state, "late");
}
if (!callback && dev->driver && dev->driver->pm) {
@@ -1017,6 +1041,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
pm_callback_t callback = NULL;
char *info = NULL;
int error = 0;
+ ktime_t starttime = ktime_get();
dpm_wait_for_children(dev, async);
@@ -1078,6 +1103,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
error = dpm_run_callback(callback, dev, state, info);
+ device_show_time(dev, starttime, state, NULL);
End:
if (!error) {
dev->power.is_suspended = true;