|
7 | 7 | #include <linux/types.h>
|
8 | 8 | #include <linux/io.h>
|
9 | 9 | #include <linux/delay.h>
|
| 10 | +#include <linux/pm_runtime.h> |
10 | 11 |
|
11 | 12 | #include "ipa.h"
|
12 |
| -#include "ipa_clock.h" |
13 | 13 | #include "ipa_uc.h"
|
14 | 14 |
|
15 | 15 | /**
|
@@ -154,7 +154,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id)
|
154 | 154 | case IPA_UC_RESPONSE_INIT_COMPLETED:
|
155 | 155 | if (ipa->uc_clocked) {
|
156 | 156 | ipa->uc_loaded = true;
|
157 |
| - (void)ipa_clock_put(ipa); |
| 157 | + (void)pm_runtime_put(dev); |
158 | 158 | ipa->uc_clocked = false;
|
159 | 159 | } else {
|
160 | 160 | dev_warn(dev, "unexpected init_completed response\n");
|
@@ -182,25 +182,29 @@ void ipa_uc_deconfig(struct ipa *ipa)
|
182 | 182 | ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1);
|
183 | 183 | ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0);
|
184 | 184 | if (ipa->uc_clocked)
|
185 |
| - (void)ipa_clock_put(ipa); |
| 185 | + (void)pm_runtime_put(&ipa->pdev->dev); |
186 | 186 | }
|
187 | 187 |
|
188 | 188 | /* Take a proxy clock reference for the microcontroller */
|
189 | 189 | void ipa_uc_clock(struct ipa *ipa)
|
190 | 190 | {
|
191 | 191 | static bool already;
|
| 192 | + struct device *dev; |
192 | 193 | int ret;
|
193 | 194 |
|
194 | 195 | if (already)
|
195 | 196 | return;
|
196 | 197 | already = true; /* Only do this on first boot */
|
197 | 198 |
|
198 |
| - /* This clock reference dropped in ipa_uc_response_hdlr() above */ |
199 |
| - ret = ipa_clock_get(ipa); |
200 |
| - if (WARN(ret < 0, "error %d getting proxy clock\n", ret)) |
201 |
| - (void)ipa_clock_put(ipa); |
202 |
| - |
203 |
| - ipa->uc_clocked = ret >= 0; |
| 199 | + /* This power reference dropped in ipa_uc_response_hdlr() above */ |
| 200 | + dev = &ipa->pdev->dev; |
| 201 | + ret = pm_runtime_get_sync(dev); |
| 202 | + if (ret < 0) { |
| 203 | + pm_runtime_put_noidle(dev); |
| 204 | + dev_err(dev, "error %d getting proxy power\n", ret); |
| 205 | + } else { |
| 206 | + ipa->uc_clocked = true; |
| 207 | + } |
204 | 208 | }
|
205 | 209 |
|
206 | 210 | /* Send a command to the microcontroller */
|
|
0 commit comments