mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
cpufreq: rockchip: implement rockchip_cpufreq_check_rate_volt()
Change-Id: I707c88d217725e66119aa28e8823ce68ac3abfba Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
@@ -32,8 +32,6 @@
|
||||
#include <soc/rockchip/rockchip_opp_select.h>
|
||||
#endif
|
||||
|
||||
#define MAX_CLUSTERS 2
|
||||
|
||||
struct private_data {
|
||||
struct device *cpu_dev;
|
||||
struct thermal_cooling_device *cdev;
|
||||
@@ -161,7 +159,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
|
||||
bool opp_v1 = false;
|
||||
const char *name;
|
||||
int ret, scale;
|
||||
static int check_init;
|
||||
|
||||
cpu_dev = get_cpu_device(policy->cpu);
|
||||
if (!cpu_dev) {
|
||||
@@ -312,10 +309,9 @@ static int cpufreq_init(struct cpufreq_policy *policy)
|
||||
policy->up_transition_delay_us = transition_latency / NSEC_PER_USEC;
|
||||
policy->down_transition_delay_us = 50000; /* 50ms */
|
||||
|
||||
if (check_init < MAX_CLUSTERS) {
|
||||
dev_pm_opp_check_rate_volt(cpu_dev, true);
|
||||
check_init++;
|
||||
}
|
||||
#ifdef CONFIG_ARCH_ROCKCHIP
|
||||
rockchip_cpufreq_check_rate_volt(cpu_dev);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ struct cluster_info {
|
||||
bool offline;
|
||||
bool rebooting;
|
||||
bool freq_limit;
|
||||
bool is_check_init;
|
||||
};
|
||||
static LIST_HEAD(cluster_info_list);
|
||||
|
||||
@@ -172,6 +173,22 @@ int rockchip_cpufreq_set_scale_rate(struct device *dev, unsigned long rate)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rockchip_cpufreq_set_scale_rate);
|
||||
|
||||
int rockchip_cpufreq_check_rate_volt(struct device *dev)
|
||||
{
|
||||
struct cluster_info *cluster;
|
||||
|
||||
cluster = rockchip_cluster_lookup_by_dev(dev);
|
||||
if (!cluster)
|
||||
return -EINVAL;
|
||||
if (cluster->is_check_init)
|
||||
return 0;
|
||||
dev_pm_opp_check_rate_volt(dev, true);
|
||||
cluster->is_check_init = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rockchip_cpufreq_check_rate_volt);
|
||||
|
||||
static int rockchip_cpufreq_cluster_init(int cpu, struct cluster_info *cluster)
|
||||
{
|
||||
struct device_node *np;
|
||||
|
||||
@@ -699,6 +699,7 @@ unsigned long cpufreq_scale_max_freq_capacity(int cpu);
|
||||
unsigned int rockchip_cpufreq_adjust_target(int cpu, unsigned int freq);
|
||||
int rockchip_cpufreq_get_scale(int cpu);
|
||||
int rockchip_cpufreq_set_scale_rate(struct device *dev, unsigned long rate);
|
||||
int rockchip_cpufreq_check_rate_volt(struct device *dev);
|
||||
#else
|
||||
static inline unsigned int rockchip_cpufreq_adjust_target(int cpu,
|
||||
unsigned int freq)
|
||||
@@ -716,5 +717,10 @@ static inline int rockchip_cpufreq_set_scale_rate(struct device *dev,
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int rockchip_cpufreq_check_rate_volt(struct device *dev)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
#endif /* _LINUX_CPUFREQ_H */
|
||||
|
||||
Reference in New Issue
Block a user