OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 30... | Line 30... | |||
30 | struct thermal_cooling_device *cdev; |
30 | struct thermal_cooling_device *cdev; |
|
31 | const char *reg_name; |
31 | const char *reg_name; |
|
32 | + struct notifier_block opp_nb; |
32 | + struct notifier_block opp_nb; |
|
33 | + struct mutex lock; |
33 | + struct mutex lock; |
|
34 | + unsigned long opp_freq; |
34 | + unsigned long opp_freq; |
|
35 | bool have_static_opps; |
- | ||
36 | }; |
35 | }; |
|
Line -... | Line 36... | |||
- | 36 | |
||
37 | |
37 | static struct freq_attr *cpufreq_dt_attr[] = { |
|
38 | @@ -44,9 +47,16 @@ static struct freq_attr *cpufreq_dt_attr |
38 | @@ -43,9 +46,16 @@ static struct freq_attr *cpufreq_dt_attr |
|
39 | static int set_target(struct cpufreq_policy *policy, unsigned int index) |
39 | static int set_target(struct cpufreq_policy *policy, unsigned int index) |
|
40 | { |
40 | { |
|
41 | struct private_data *priv = policy->driver_data; |
41 | struct private_data *priv = policy->driver_data; |
|
42 | + int ret; |
42 | + int ret; |
|
Line 52... | Line 52... | |||
52 | - policy->freq_table[index].frequency * 1000); |
52 | - policy->freq_table[index].frequency * 1000); |
|
53 | + return ret; |
53 | + return ret; |
|
54 | } |
54 | } |
|
Line 55... | Line 55... | |||
55 | |
55 | |
|
56 | /* |
56 | /* |
|
57 | @@ -87,6 +97,39 @@ node_put: |
57 | @@ -86,6 +96,39 @@ node_put: |
|
58 | return name; |
58 | return name; |
|
Line 59... | Line 59... | |||
59 | } |
59 | } |
|
60 | |
60 | |
|
Line 92... | Line 92... | |||
92 | +} |
92 | +} |
|
93 | + |
93 | + |
|
94 | static int resources_available(void) |
94 | static int resources_available(void) |
|
95 | { |
95 | { |
|
96 | struct device *cpu_dev; |
96 | struct device *cpu_dev; |
|
97 | @@ -153,6 +196,7 @@ static int cpufreq_init(struct cpufreq_p |
97 | @@ -152,6 +195,7 @@ static int cpufreq_init(struct cpufreq_p |
|
98 | bool fallback = false; |
98 | bool fallback = false; |
|
99 | const char *name; |
99 | const char *name; |
|
100 | int ret; |
100 | int ret; |
|
101 | + struct srcu_notifier_head *opp_srcu_head; |
101 | + struct srcu_notifier_head *opp_srcu_head; |
|
Line 102... | Line 102... | |||
102 | |
102 | |
|
103 | cpu_dev = get_cpu_device(policy->cpu); |
103 | cpu_dev = get_cpu_device(policy->cpu); |
|
104 | if (!cpu_dev) { |
104 | if (!cpu_dev) { |
|
105 | @@ -246,10 +290,13 @@ static int cpufreq_init(struct cpufreq_p |
105 | @@ -241,13 +285,16 @@ static int cpufreq_init(struct cpufreq_p |
|
106 | __func__, ret); |
106 | goto out_free_opp; |
|
Line 107... | Line 107... | |||
107 | } |
107 | } |
|
108 | |
108 | |
|
109 | + mutex_init(&priv->lock); |
109 | + mutex_init(&priv->lock); |
|
- | 110 | + dev_pm_opp_register_notifier(cpu_dev, &priv->opp_nb); |
||
- | 111 | + |
||
- | 112 | priv->reg_name = name; |
||
110 | + dev_pm_opp_register_notifier(cpu_dev, &priv->opp_nb); |
113 | priv->opp_table = opp_table; |
|
111 | + |
114 | |
|
112 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); |
115 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); |
|
113 | if (ret) { |
116 | if (ret) { |
|
114 | dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); |
117 | dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); |
|
115 | - goto out_free_opp; |
118 | - goto out_free_priv; |
|
Line 116... | Line 119... | |||
116 | + goto out_unregister_nb; |
119 | + goto out_unregister_nb; |
|
117 | } |
120 | } |
|
Line 118... | Line 121... | |||
118 | |
121 | |
|
119 | priv->cpu_dev = cpu_dev; |
122 | priv->cpu_dev = cpu_dev; |
|
120 | @@ -285,6 +332,8 @@ static int cpufreq_init(struct cpufreq_p |
123 | @@ -283,6 +330,8 @@ static int cpufreq_init(struct cpufreq_p |
|
121 | |
124 | |
|
- | 125 | out_free_cpufreq_table: |
||
- | 126 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); |
||
122 | out_free_cpufreq_table: |
127 | +out_unregister_nb: |
|
123 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); |
- | ||
124 | +out_unregister_nb: |
- |