|
13 | 13 | #include <linux/of_address.h>
|
14 | 14 | #include <linux/of_platform.h>
|
15 | 15 | #include <linux/pm_opp.h>
|
| 16 | +#include <linux/pm_qos.h> |
16 | 17 | #include <linux/slab.h>
|
17 | 18 | #include <linux/spinlock.h>
|
18 | 19 | #include <linux/units.h>
|
@@ -56,6 +57,8 @@ struct qcom_cpufreq_data {
|
56 | 57 | struct cpufreq_policy *policy;
|
57 | 58 |
|
58 | 59 | bool per_core_dcvs;
|
| 60 | + |
| 61 | + struct freq_qos_request throttle_freq_req; |
59 | 62 | };
|
60 | 63 |
|
61 | 64 | static unsigned long cpu_hw_rate, xo_rate;
|
@@ -321,6 +324,8 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
|
321 | 324 |
|
322 | 325 | throttled_freq = freq_hz / HZ_PER_KHZ;
|
323 | 326 |
|
| 327 | + freq_qos_update_request(&data->throttle_freq_req, throttled_freq); |
| 328 | + |
324 | 329 | /* Update thermal pressure (the boost frequencies are accepted) */
|
325 | 330 | arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
|
326 | 331 |
|
@@ -413,6 +418,14 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
|
413 | 418 | if (data->throttle_irq < 0)
|
414 | 419 | return data->throttle_irq;
|
415 | 420 |
|
| 421 | + ret = freq_qos_add_request(&policy->constraints, |
| 422 | + &data->throttle_freq_req, FREQ_QOS_MAX, |
| 423 | + FREQ_QOS_MAX_DEFAULT_VALUE); |
| 424 | + if (ret < 0) { |
| 425 | + dev_err(&pdev->dev, "Failed to add freq constraint (%d)\n", ret); |
| 426 | + return ret; |
| 427 | + } |
| 428 | + |
416 | 429 | data->cancel_throttle = false;
|
417 | 430 | data->policy = policy;
|
418 | 431 |
|
@@ -479,6 +492,7 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
|
479 | 492 | if (data->throttle_irq <= 0)
|
480 | 493 | return;
|
481 | 494 |
|
| 495 | + freq_qos_remove_request(&data->throttle_freq_req); |
482 | 496 | free_irq(data->throttle_irq, data);
|
483 | 497 | }
|
484 | 498 |
|
|
0 commit comments