1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#undef DEBUG
19
20#include <linux/init.h>
21#include <linux/cpufreq.h>
22#include <linux/device.h>
23#include <linux/platform_device.h>
24
25#include "omap_device.h"
26#include "omap-pm.h"
27
28static bool off_mode_enabled;
29static int dummy_context_loss_counter;
30
31
32
33
34
35int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t)
36{
37 if (!dev || t < -1) {
38 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__);
39 return -EINVAL;
40 }
41
42 if (t == -1)
43 pr_debug("OMAP PM: remove max MPU wakeup latency constraint: dev %s\n",
44 dev_name(dev));
45 else
46 pr_debug("OMAP PM: add max MPU wakeup latency constraint: dev %s, t = %ld usec\n",
47 dev_name(dev), t);
48
49
50
51
52
53
54
55
56
57
58
59
60 return 0;
61}
62
63int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r)
64{
65 if (!dev || (agent_id != OCP_INITIATOR_AGENT &&
66 agent_id != OCP_TARGET_AGENT)) {
67 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__);
68 return -EINVAL;
69 }
70
71 if (r == 0)
72 pr_debug("OMAP PM: remove min bus tput constraint: dev %s for agent_id %d\n",
73 dev_name(dev), agent_id);
74 else
75 pr_debug("OMAP PM: add min bus tput constraint: dev %s for agent_id %d: rate %ld KiB\n",
76 dev_name(dev), agent_id, r);
77
78
79
80
81
82
83
84
85
86 return 0;
87}
88
89
90
91
92
93
94
95
96
97
98
99
100void omap_pm_enable_off_mode(void)
101{
102 off_mode_enabled = true;
103}
104
105
106
107
108
109
110
111void omap_pm_disable_off_mode(void)
112{
113 off_mode_enabled = false;
114}
115
116
117
118
119
120#ifdef CONFIG_ARCH_OMAP2PLUS
121
122int omap_pm_get_dev_context_loss_count(struct device *dev)
123{
124 struct platform_device *pdev = to_platform_device(dev);
125 int count;
126
127 if (WARN_ON(!dev))
128 return -ENODEV;
129
130 if (dev->pm_domain == &omap_device_pm_domain) {
131 count = omap_device_get_context_loss_count(pdev);
132 } else {
133 WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device",
134 dev_name(dev));
135
136 count = dummy_context_loss_counter;
137
138 if (off_mode_enabled) {
139 count++;
140
141
142
143
144
145 count &= INT_MAX;
146 dummy_context_loss_counter = count;
147 }
148 }
149
150 pr_debug("OMAP PM: context loss count for dev %s = %d\n",
151 dev_name(dev), count);
152
153 return count;
154}
155
156#else
157
158int omap_pm_get_dev_context_loss_count(struct device *dev)
159{
160 return dummy_context_loss_counter;
161}
162
163#endif
164
165
166int __init omap_pm_if_early_init(void)
167{
168 return 0;
169}
170
171
172int __init omap_pm_if_init(void)
173{
174 return 0;
175}
176