[Feature][ZXW-65]merged P49 base code

Change-Id: I3e09c0c3d47483bc645f02310380ecb7fc6f4041
diff --git a/ap/os/linux/linux-3.4.x/drivers/cpufreq/cpufreq.c b/ap/os/linux/linux-3.4.x/drivers/cpufreq/cpufreq.c
index cf864ef..811757a 100644
--- a/ap/os/linux/linux-3.4.x/drivers/cpufreq/cpufreq.c
+++ b/ap/os/linux/linux-3.4.x/drivers/cpufreq/cpufreq.c
@@ -1948,3 +1948,61 @@
 	return 0;
 }
 core_initcall(cpufreq_core_init);
+
+
+/* only for zx297520v3 */
+static int cpufreq_manual_adjust(unsigned int min_freq, unsigned int max_freq)
+{
+	unsigned int ret;
+	struct cpufreq_policy new_policy;
+	struct cpufreq_policy *data;
+
+	data = cpufreq_cpu_get(0);
+	if (!data)
+		return -EINVAL;
+
+	memcpy(&new_policy, data, sizeof(struct cpufreq_policy));
+
+	new_policy.min = min_freq;
+	new_policy.max = max_freq;
+
+	ret = __cpufreq_set_policy(data, &new_policy);
+	data->user_policy.min = data->min;
+	data->user_policy.max = data->max;
+
+	cpufreq_cpu_put(data);
+
+	return ret;
+}
+
+extern u32 zDrvTsCtrl_DfsEn(void);
+int cpufreq_performance(void)
+{
+	int ret;
+	
+	if (zDrvTsCtrl_DfsEn())
+		return 0;
+
+	ret = cpufreq_manual_adjust(312000, 624000);
+	if (ret)
+		return ret;
+
+	return cpufreq_manual_adjust(624000, 624000);
+}
+
+int cpufreq_powersave(void)
+{
+	int ret;
+
+	ret = cpufreq_manual_adjust(312000, 624000);
+	if (ret)
+		return ret;
+
+	return cpufreq_manual_adjust(312000, 312000);
+}
+
+int cpufreq_normal(void)
+{
+	return cpufreq_manual_adjust(312000, 624000);
+}
+