diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-12-01 00:02:05 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2011-12-01 21:47:40 +0100 |
commit | b02c999ac325e977585abeb4caf6e0a2ee21e30b (patch) | |
tree | 1ddec5f020a80b9df443b03ffb578ef7f882abb6 /drivers/base/power/domain_governor.c | |
parent | d23b9b00cdde5c93b914a172cecd57d5625fcd04 (diff) | |
download | op-kernel-dev-b02c999ac325e977585abeb4caf6e0a2ee21e30b.zip op-kernel-dev-b02c999ac325e977585abeb4caf6e0a2ee21e30b.tar.gz |
PM / Domains: Add device stop governor function (v4)
Add a function deciding whether or not devices should be stopped in
pm_genpd_runtime_suspend() depending on their PM QoS constraints
and stop/start timing values. Make it possible to add information
used by this function to device objects.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Magnus Damm <damm@opensource.se>
Diffstat (limited to 'drivers/base/power/domain_governor.c')
-rw-r--r-- | drivers/base/power/domain_governor.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c new file mode 100644 index 0000000..97b21c1 --- /dev/null +++ b/drivers/base/power/domain_governor.c @@ -0,0 +1,33 @@ +/* + * drivers/base/power/domain_governor.c - Governors for device PM domains. + * + * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp. + * + * This file is released under the GPLv2. + */ + +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/pm_domain.h> +#include <linux/pm_qos.h> + +/** + * default_stop_ok - Default PM domain governor routine for stopping devices. + * @dev: Device to check. + */ +bool default_stop_ok(struct device *dev) +{ + struct gpd_timing_data *td = &dev_gpd_data(dev)->td; + + dev_dbg(dev, "%s()\n", __func__); + + if (dev->power.max_time_suspended_ns < 0 || td->break_even_ns == 0) + return true; + + return td->stop_latency_ns + td->start_latency_ns < td->break_even_ns + && td->break_even_ns < dev->power.max_time_suspended_ns; +} + +struct dev_power_governor simple_qos_governor = { + .stop_ok = default_stop_ok, +}; |