10 #include <linux/kernel.h>
13 #include <linux/hrtimer.h>
15 #ifdef CONFIG_PM_RUNTIME
17 static int dev_update_qos_constraint(
struct device *
dev,
void *
data)
20 s32 constraint_ns = -1;
22 if (dev->
power.subsys_data && dev->
power.subsys_data->domain_data)
23 constraint_ns = dev_gpd_data(dev)->td.effective_constraint_ns;
25 if (constraint_ns < 0) {
29 if (constraint_ns == 0)
36 if (constraint_ns < *constraint_ns_p || *constraint_ns_p == 0)
37 *constraint_ns_p = constraint_ns;
52 dev_dbg(dev,
"%s()\n", __func__);
59 spin_unlock_irqrestore(&dev->
power.lock, flags);
67 spin_unlock_irqrestore(&dev->
power.lock, flags);
69 if (constraint_ns < 0)
78 if (!dev->
power.ignore_children)
80 dev_update_qos_constraint);
82 if (constraint_ns > 0) {
84 if (constraint_ns == 0)
123 genpd->max_off_time_changed =
false;
124 genpd->cached_power_down_ok = false;
125 genpd->max_off_time_ns = -1;
140 if (pdd->
dev->driver)
142 to_gpd_data(pdd)->td.save_state_latency_ns;
145 min_off_time_ns = -1;
155 if (sd_max_off_ns < 0)
163 if (sd_max_off_ns <= off_on_time_ns)
166 if (min_off_time_ns > sd_max_off_ns || min_off_time_ns < 0)
167 min_off_time_ns = sd_max_off_ns;
177 if (!pdd->
dev->driver)
185 td = &to_gpd_data(pdd)->td;
188 if (constraint_ns < 0) {
192 if (constraint_ns == 0)
200 if (constraint_ns <= off_on_time_ns)
203 if (min_off_time_ns > constraint_ns || min_off_time_ns < 0)
204 min_off_time_ns = constraint_ns;
214 if (min_off_time_ns < 0)
238 #define default_power_down_ok NULL
239 #define always_on_power_down_ok NULL