Lines Matching refs:s3c_freq

89 	struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;  in s3c2416_cpufreq_get_speed()  local
95 if (s3c_freq->is_dvs) in s3c2416_cpufreq_get_speed()
98 return clk_get_rate(s3c_freq->armclk) / 1000; in s3c2416_cpufreq_get_speed()
101 static int s3c2416_cpufreq_set_armdiv(struct s3c2416_data *s3c_freq, in s3c2416_cpufreq_set_armdiv() argument
106 if (clk_get_rate(s3c_freq->armdiv) / 1000 != freq) { in s3c2416_cpufreq_set_armdiv()
107 ret = clk_set_rate(s3c_freq->armdiv, freq * 1000); in s3c2416_cpufreq_set_armdiv()
118 static int s3c2416_cpufreq_enter_dvs(struct s3c2416_data *s3c_freq, int idx) in s3c2416_cpufreq_enter_dvs() argument
125 if (s3c_freq->is_dvs) { in s3c2416_cpufreq_enter_dvs()
131 clk_get_rate(s3c_freq->hclk) / 1000); in s3c2416_cpufreq_enter_dvs()
132 ret = clk_set_parent(s3c_freq->armclk, s3c_freq->hclk); in s3c2416_cpufreq_enter_dvs()
140 if (s3c_freq->vddarm) { in s3c2416_cpufreq_enter_dvs()
145 ret = regulator_set_voltage(s3c_freq->vddarm, in s3c2416_cpufreq_enter_dvs()
155 s3c_freq->is_dvs = 1; in s3c2416_cpufreq_enter_dvs()
160 static int s3c2416_cpufreq_leave_dvs(struct s3c2416_data *s3c_freq, int idx) in s3c2416_cpufreq_leave_dvs() argument
167 if (!s3c_freq->is_dvs) { in s3c2416_cpufreq_leave_dvs()
173 if (s3c_freq->vddarm) { in s3c2416_cpufreq_leave_dvs()
178 ret = regulator_set_voltage(s3c_freq->vddarm, in s3c2416_cpufreq_leave_dvs()
189 if (clk_get_rate(s3c_freq->armdiv) > clk_get_rate(s3c_freq->hclk)) { in s3c2416_cpufreq_leave_dvs()
191 clk_get_rate(s3c_freq->hclk) / 1000); in s3c2416_cpufreq_leave_dvs()
192 ret = s3c2416_cpufreq_set_armdiv(s3c_freq, in s3c2416_cpufreq_leave_dvs()
193 clk_get_rate(s3c_freq->hclk) / 1000); in s3c2416_cpufreq_leave_dvs()
196 clk_get_rate(s3c_freq->hclk) / 1000, ret); in s3c2416_cpufreq_leave_dvs()
202 clk_get_rate(s3c_freq->armdiv) / 1000); in s3c2416_cpufreq_leave_dvs()
204 ret = clk_set_parent(s3c_freq->armclk, s3c_freq->armdiv); in s3c2416_cpufreq_leave_dvs()
211 s3c_freq->is_dvs = 0; in s3c2416_cpufreq_leave_dvs()
219 struct s3c2416_data *s3c_freq = &s3c2416_cpufreq; in s3c2416_cpufreq_set_target() local
225 idx = s3c_freq->freq_table[index].driver_data; in s3c2416_cpufreq_set_target()
231 if (to_dvs && s3c_freq->disable_dvs) { in s3c2416_cpufreq_set_target()
241 new_freq = (s3c_freq->is_dvs && !to_dvs) in s3c2416_cpufreq_set_target()
242 ? clk_get_rate(s3c_freq->hclk) / 1000 in s3c2416_cpufreq_set_target()
243 : s3c_freq->freq_table[index].frequency; in s3c2416_cpufreq_set_target()
247 ret = s3c2416_cpufreq_enter_dvs(s3c_freq, idx); in s3c2416_cpufreq_set_target()
248 } else if (s3c_freq->is_dvs) { in s3c2416_cpufreq_set_target()
250 ret = s3c2416_cpufreq_leave_dvs(s3c_freq, idx); in s3c2416_cpufreq_set_target()
253 ret = s3c2416_cpufreq_set_armdiv(s3c_freq, new_freq); in s3c2416_cpufreq_set_target()
263 static void s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq) in s3c2416_cpufreq_cfg_regulator() argument
269 count = regulator_count_voltages(s3c_freq->vddarm); in s3c2416_cpufreq_cfg_regulator()
278 cpufreq_for_each_valid_entry(pos, s3c_freq->freq_table) { in s3c2416_cpufreq_cfg_regulator()
284 v = regulator_list_voltage(s3c_freq->vddarm, i); in s3c2416_cpufreq_cfg_regulator()
298 s3c_freq->regulator_latency = 1 * 1000 * 1000; in s3c2416_cpufreq_cfg_regulator()
305 struct s3c2416_data *s3c_freq = &s3c2416_cpufreq; in s3c2416_cpufreq_reboot_notifier_evt() local
312 s3c_freq->disable_dvs = 1; in s3c2416_cpufreq_reboot_notifier_evt()
320 if (s3c_freq->is_dvs) { in s3c2416_cpufreq_reboot_notifier_evt()
345 struct s3c2416_data *s3c_freq = &s3c2416_cpufreq; in s3c2416_cpufreq_driver_init() local
370 s3c_freq->freq_table = s3c2416_freq_table; in s3c2416_cpufreq_driver_init()
375 s3c_freq->freq_table = s3c2450_freq_table; in s3c2416_cpufreq_driver_init()
382 if (s3c_freq->freq_table == NULL) { in s3c2416_cpufreq_driver_init()
388 s3c_freq->is_dvs = 0; in s3c2416_cpufreq_driver_init()
390 s3c_freq->armdiv = clk_get(NULL, "armdiv"); in s3c2416_cpufreq_driver_init()
391 if (IS_ERR(s3c_freq->armdiv)) { in s3c2416_cpufreq_driver_init()
392 ret = PTR_ERR(s3c_freq->armdiv); in s3c2416_cpufreq_driver_init()
397 s3c_freq->hclk = clk_get(NULL, "hclk"); in s3c2416_cpufreq_driver_init()
398 if (IS_ERR(s3c_freq->hclk)) { in s3c2416_cpufreq_driver_init()
399 ret = PTR_ERR(s3c_freq->hclk); in s3c2416_cpufreq_driver_init()
407 rate = clk_get_rate(s3c_freq->hclk); in s3c2416_cpufreq_driver_init()
414 s3c_freq->armclk = clk_get(NULL, "armclk"); in s3c2416_cpufreq_driver_init()
415 if (IS_ERR(s3c_freq->armclk)) { in s3c2416_cpufreq_driver_init()
416 ret = PTR_ERR(s3c_freq->armclk); in s3c2416_cpufreq_driver_init()
422 s3c_freq->vddarm = regulator_get(NULL, "vddarm"); in s3c2416_cpufreq_driver_init()
423 if (IS_ERR(s3c_freq->vddarm)) { in s3c2416_cpufreq_driver_init()
424 ret = PTR_ERR(s3c_freq->vddarm); in s3c2416_cpufreq_driver_init()
429 s3c2416_cpufreq_cfg_regulator(s3c_freq); in s3c2416_cpufreq_driver_init()
431 s3c_freq->regulator_latency = 0; in s3c2416_cpufreq_driver_init()
434 cpufreq_for_each_entry(pos, s3c_freq->freq_table) { in s3c2416_cpufreq_driver_init()
437 if (!s3c_freq->hclk) { in s3c2416_cpufreq_driver_init()
447 rate = clk_round_rate(s3c_freq->armdiv, in s3c2416_cpufreq_driver_init()
460 cpufreq_generic_init(policy, s3c_freq->freq_table, in s3c2416_cpufreq_driver_init()
461 (500 * 1000) + s3c_freq->regulator_latency); in s3c2416_cpufreq_driver_init()
468 clk_put(s3c_freq->armclk); in s3c2416_cpufreq_driver_init()
471 clk_put(s3c_freq->hclk); in s3c2416_cpufreq_driver_init()
473 clk_put(s3c_freq->armdiv); in s3c2416_cpufreq_driver_init()