.clksel_maxdiv = 4,
};
+/* for vpu power on notify */
+static struct clk clk_vpu = {
+ .name = "vpu",
+};
+
static struct clk *xpu_parents[4] = { &general_pll_clk, &ddr_pll_clk, &codec_pll_clk, &arm_pll_clk };
static struct clk aclk_vepu = {
CLK(NULL, "aclk_lcdc", &aclk_lcdc),
CLK(NULL, "hclk_lcdc", &hclk_lcdc),
+ CLK1(vpu),
CLK(NULL, "aclk_vepu", &aclk_vepu),
CLK(NULL, "hclk_vepu", &hclk_vepu),
CLK(NULL, "aclk_vdpu", &aclk_vdpu),
int r;
struct clk *clkp;
- if (!clk || !nb)
+ if (!clk || IS_ERR(clk) || !nb)
return -EINVAL;
mutex_lock(&clocks_mutex);
struct clk *clkp;
int r = -EINVAL;
- if (!clk || !nb)
+ if (!clk || IS_ERR(clk) || !nb)
return -EINVAL;
mutex_lock(&clocks_mutex);
module_param(limit_vpu_enabled, bool, 0644);
module_param(limit_gpu_enabled, bool, 0644);
module_param(limit_gpu_high, bool, 0644);
-static struct clk* aclk_vepu;
+static struct clk* clk_vpu;
static struct clk* clk_gpu;
#define GPU_LOW_RATE (300 * MHZ)
static unsigned long limit_gpu_low_rate = GPU_LOW_RATE;
queue_delayed_work(wq, &rk29_cpufreq_limit_by_temp_work, WORK_DELAY);
}
-static int rk29_cpufreq_aclk_vepu_notifier_event(struct notifier_block *this,
+static int rk29_cpufreq_vpu_notifier_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
switch (event) {
return NOTIFY_OK;
}
-static struct notifier_block rk29_cpufreq_aclk_vepu_notifier = {
- .notifier_call = rk29_cpufreq_aclk_vepu_notifier_event,
+static struct notifier_block rk29_cpufreq_vpu_notifier = {
+ .notifier_call = rk29_cpufreq_vpu_notifier_event,
};
-static int rk29_cpufreq_clk_gpu_notifier_event(struct notifier_block *this,
+static int rk29_cpufreq_gpu_notifier_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
struct clk_notifier_data *cnd = ptr;
return NOTIFY_OK;
}
-static struct notifier_block rk29_cpufreq_clk_gpu_notifier = {
- .notifier_call = rk29_cpufreq_clk_gpu_notifier_event,
+static struct notifier_block rk29_cpufreq_gpu_notifier = {
+ .notifier_call = rk29_cpufreq_gpu_notifier_event,
};
#endif
cpufreq_register_notifier(¬ifier_policy_block, CPUFREQ_POLICY_NOTIFIER);
if (limit_max_freq > 1008000) {
clk_gpu = clk_get(NULL, "gpu");
- aclk_vepu = clk_get(NULL, "aclk_vepu");
- clk_notifier_register(clk_gpu, &rk29_cpufreq_clk_gpu_notifier);
- clk_notifier_register(aclk_vepu, &rk29_cpufreq_aclk_vepu_notifier);
+ clk_vpu = clk_get(NULL, "vpu");
+ clk_notifier_register(clk_gpu, &rk29_cpufreq_gpu_notifier);
+ clk_notifier_register(clk_vpu, &rk29_cpufreq_vpu_notifier);
}
#endif
#ifdef CONFIG_RK29_CPU_FREQ_LIMIT_BY_DISP
#endif
#ifdef CONFIG_RK29_CPU_FREQ_LIMIT_BY_TEMP
if (limit_max_freq > 1008000) {
- clk_notifier_unregister(clk_gpu, &rk29_cpufreq_clk_gpu_notifier);
- clk_notifier_unregister(aclk_vepu, &rk29_cpufreq_aclk_vepu_notifier);
+ clk_notifier_unregister(clk_gpu, &rk29_cpufreq_gpu_notifier);
+ clk_notifier_unregister(clk_vpu, &rk29_cpufreq_vpu_notifier);
clk_put(clk_gpu);
- clk_put(aclk_vepu);
+ clk_put(clk_vpu);
}
cpufreq_unregister_notifier(¬ifier_policy_block, CPUFREQ_POLICY_NOTIFIER);
if (wq)
unsigned long size;
} vpu_request;
+static struct clk *clk_vpu; /* for power on notify */
static struct clk *aclk_vepu;
static struct clk *hclk_vepu;
static struct clk *aclk_ddr_vepu;
static void vpu_get_clk(void)
{
+ clk_vpu = clk_get(NULL, "vpu");
aclk_vepu = clk_get(NULL, "aclk_vepu");
hclk_vepu = clk_get(NULL, "hclk_vepu");
aclk_ddr_vepu = clk_get(NULL, "aclk_ddr_vepu");
static void vpu_put_clk(void)
{
+ clk_put(clk_vpu);
clk_put(aclk_vepu);
clk_put(hclk_vepu);
clk_put(aclk_ddr_vepu);
clk_disable(aclk_ddr_vepu);
clk_disable(hclk_vepu);
clk_disable(aclk_vepu);
+ clk_disable(clk_vpu);
printk("done\n");
}
static void vpu_service_power_on(void)
{
+ clk_enable(clk_vpu); /* notify vpu on without lock. */
+
spin_lock_bh(&service.lock);
if (!service.enabled) {
service.enabled = true;
printk("vpu: power on\n");
+ clk_enable(clk_vpu);
clk_enable(aclk_vepu);
clk_enable(hclk_vepu);
clk_enable(hclk_cpu_vcodec);
spin_unlock_bh(&service.lock);
vpu_service_power_maintain();
}
+
+ clk_disable(clk_vpu);
}
static vpu_reg *reg_init(vpu_session *session, void __user *src, unsigned long size)