Rafael J. Wysocki | b02c999 | 2011-12-01 00:02:05 +0100 | [diff] [blame^] | 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 | */ |
| 18 | bool 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 | |
| 31 | struct dev_power_governor simple_qos_governor = { |
| 32 | .stop_ok = default_stop_ok, |
| 33 | }; |