diff options
author | Zhang Jiejing <jiejing.zhang@freescale.com> | 2010-11-22 17:14:32 +0800 |
---|---|---|
committer | Zhang Jiejing <jiejing.zhang@freescale.com> | 2010-11-24 10:22:29 +0800 |
commit | 70df9e557c59c346f257a9b21418abf20045a571 (patch) | |
tree | f005aa5752041a8389f08c21ba71f4eb81f6e8a4 /kernel | |
parent | 838705ba857ca22c7c512331b6431651ed5a303d (diff) |
ENGR00133978 PM: add time sensitive debug function to suspend & resume
There was some driver is slow on suspend/resume,
but some embeded system like eReader,Cellphone
are time sensitive,this commit will report the slow
driver on suspend/resume, the default value is 500us(0.5ms)
Also, the threshold can be change by modify
'/sys/power/device_suspend_time_threshold' to change the threshold,
it is in microsecond.
The output is like:
PM: device platform:soc-audio.2 suspend too slow, takes 606.696 msecs
PM: device platform:mxc_sdc_fb.1 suspend too slow, takes 7.708 msecs
Signed-off-by: Zhang Jiejing <jiejing.zhang@freescale.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/Kconfig | 14 | ||||
-rw-r--r-- | kernel/power/main.c | 32 |
2 files changed, 46 insertions, 0 deletions
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index ca6066a6952e..631de1141247 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig @@ -123,6 +123,20 @@ config PM_TEST_SUSPEND You probably want to have your system's RTC driver statically linked, ensuring that it's available when this test runs. +config SUSPEND_DEVICE_TIME_DEBUG + bool "Warnning device suspend/resume takes too much time" + depends on SUSPEND && PM_DEBUG + default n + ---help--- + This option will enable a timing function to check device + suspend time consumption, If the device takes more time that + the threshold(default 0.5 ms), it will print the device and + bus name on the console. You can change the threshold + on-the-fly by modify /sys/power/time_threshold the time unit + is in microsecond. + + This options only for debug proprose, If in doubt, say N. + config SUSPEND_FREEZER bool "Enable freezer for suspend to RAM/standby" \ if ARCH_WANTS_FREEZER_CONTROL || BROKEN diff --git a/kernel/power/main.c b/kernel/power/main.c index b58800b21fc0..0b9497851a9a 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -229,11 +229,43 @@ pm_trace_store(struct kobject *kobj, struct kobj_attribute *attr, power_attr(pm_trace); #endif /* CONFIG_PM_TRACE */ +#ifdef CONFIG_SUSPEND_DEVICE_TIME_DEBUG +/* + * threshold of device suspend time consumption in microsecond(0.5ms), the + * driver suspend/resume time longer than this threshold will be + * print to console, 0 to disable */ +int device_suspend_time_threshold = 500; + +static ssize_t +device_suspend_time_threshold_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", device_suspend_time_threshold); +} + +static ssize_t +device_suspend_time_threshold_store(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t n) +{ + int val; + if (sscanf(buf, "%d", &val) > 0) { + device_suspend_time_threshold = val; + return n; + } + return -EINVAL; +} +power_attr(device_suspend_time_threshold); +#endif + static struct attribute * g[] = { &state_attr.attr, #ifdef CONFIG_PM_TRACE &pm_trace_attr.attr, #endif +#ifdef CONFIG_SUSPEND_DEVICE_TIME_DEBUG + &device_suspend_time_threshold_attr.attr, +#endif #ifdef CONFIG_PM_SLEEP &pm_async_attr.attr, #ifdef CONFIG_PM_DEBUG |