aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/domain_governor.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-11-30 18:02:05 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2011-12-01 15:47:40 -0500
commitb02c999ac325e977585abeb4caf6e0a2ee21e30b (patch)
tree1ddec5f020a80b9df443b03ffb578ef7f882abb6 /drivers/base/power/domain_governor.c
parentd23b9b00cdde5c93b914a172cecd57d5625fcd04 (diff)
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.c33
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 000000000000..97b21c10c496
--- /dev/null
+++ b/drivers/base/power/domain_governor.c
@@ -0,0 +1,33 @@
1/*
2 * drivers/base/power/domain_governor.c - Governors for device PM domains.
3 *
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
5 *
6 * This file is released under the GPLv2.
7 */
8
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/pm_domain.h>
12#include <linux/pm_qos.h>
13
14/**
15 * default_stop_ok - Default PM domain governor routine for stopping devices.
16 * @dev: Device to check.
17 */
18bool default_stop_ok(struct device *dev)
19{
20 struct gpd_timing_data *td = &dev_gpd_data(dev)->td;
21
22 dev_dbg(dev, "%s()\n", __func__);
23
24 if (dev->power.max_time_suspended_ns < 0 || td->break_even_ns == 0)
25 return true;
26
27 return td->stop_latency_ns + td->start_latency_ns < td->break_even_ns
28 && td->break_even_ns < dev->power.max_time_suspended_ns;
29}
30
31struct dev_power_governor simple_qos_governor = {
32 .stop_ok = default_stop_ok,
33};