@@ -24,6 +24,11 @@
static struct common_dbs_data cs_dbs_cdata;
static DEFINE_PER_CPU(struct cs_cpu_dbs_info_s, cs_cpu_dbs_info);
+#ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
+static
+#endif
+struct cpufreq_governor cpufreq_gov_conservative;
+
static inline unsigned int get_freq_target(struct cs_dbs_tuners *cs_tuners,
struct cpufreq_policy *policy)
{
@@ -120,8 +125,17 @@ static int dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
struct cpufreq_freqs *freq = data;
struct cs_cpu_dbs_info_s *dbs_info =
&per_cpu(cs_cpu_dbs_info, freq->cpu);
- struct cpu_common_dbs_info *ccdbs = dbs_info->cdbs.ccdbs;
- struct cpufreq_policy *policy = ccdbs->policy;
+ struct cpufreq_policy *policy = cpufreq_cpu_get_raw(freq->cpu);
+ struct cpu_common_dbs_info *ccdbs;
+
+ if (WARN_ON(!policy))
+ return -EINVAL;
+
+ /* policy isn't governed by conservative governor */
+ if (policy->governor != &cpufreq_gov_conservative)
+ return 0;
+
+ ccdbs = dbs_info->cdbs.ccdbs;
mutex_lock(&cs_dbs_cdata.mutex);
if (!ccdbs->enabled)
@@ -273,4 +273,5 @@ void od_register_powersave_bias_handler(unsigned int (*f)
(struct cpufreq_policy *, unsigned int, unsigned int),
unsigned int powersave_bias);
void od_unregister_powersave_bias_handler(void);
+struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu);
#endif /* _CPUFREQ_GOVERNOR_H */