static int __init cpu_core_voltage_init(void) { struct clk *cpu_clk; struct cpu_core_voltage *pcore = &cpu_core_vol; pcore->down_wq = alloc_workqueue("voltage_down", 0, 1); if (!pcore->down_wq) return -ENOMEM; INIT_DELAYED_WORK(&pcore->vol_down_work, cpu_core_vol_down); pcore->core_vcc = regulator_get(NULL, CPU_CORE_NAME); if(IS_ERR(pcore->core_vcc)) return -1; cpu_clk = clk_get(NULL, CLK_NAME_CCLK); if (IS_ERR(cpu_clk)) return -1; pcore->current_rate = clk_get_rate(cpu_clk); clk_put(cpu_clk); if(pcore->current_rate <= 0) { return -1; } pcore->msc_adj = 0; pcore->gpu_adj = 0; pcore->vpu_adj = 0; pcore->all_adj = 0; atomic_set(&pcore->qwork_atomic, 0); mutex_init(&pcore->mutex); pcore->current_vol = regulator_get_voltage(pcore->core_vcc); pcore->target_vol = pcore->current_vol; pcore->clk_prechange.jz_notify = clk_prechange_notify; pcore->clk_prechange.level = NOTEFY_PROI_HIGH; pcore->clk_prechange.msg = JZ_CLK_PRECHANGE; jz_notifier_register(&pcore->clk_prechange, NOTEFY_PROI_HIGH); pcore->clkgate_change.jz_notify = clkgate_change_notify; pcore->clkgate_change.level = NOTEFY_PROI_HIGH; pcore->clkgate_change.msg = JZ_CLKGATE_CHANGE; jz_notifier_register(&pcore->clkgate_change, NOTEFY_PROI_HIGH); register_pm_notifier(&cpu_core_sleep_pm_notifier); return 0; }
static int ricoh61x_register_reset_notifier(struct jz_notifier *nb) { return jz_notifier_register(nb, NOTEFY_PROI_HIGH); }