Lines Matching +full:loongson +full:- +full:3
1 // SPDX-License-Identifier: GPL-2.0-only
3 * CPUFreq driver for the Loongson-3 processors.
5 * All revisions of Loongson-3 processor support cpu_has_scalefreq feature.
7 * Author: Huacai Chen <chenhuacai@loongson.cn>
8 * Copyright (C) 2024 Loongson Technology Corporation Limited
18 #include <asm/loongson.h>
37 #define CMD_INVAL 3 /* Invalid Parameter */
41 * CMD_GET_VERSION - Get interface version
49 * CMD_GET_FEATURE - Get feature state
56 * CMD_SET_FEATURE - Set feature state
79 #define FEATURE_DVFS_SINGLE_BOOST BIT(3)
83 * CMD_GET_SENSOR_NUM - Get number of sensors
90 * CMD_GET_SENSOR_STATUS - Get sensor status
102 * CMD_GET_FAN_NUM - Get number of fans
109 * CMD_GET_FAN_INFO - Get fan status
116 * CMD_SET_FAN_INFO - Set fan status
127 * CMD_GET_FREQ_LEVEL_NUM - Get number of freq levels
134 * CMD_GET_FREQ_BOOST_LEVEL - Get the first boost level
141 * CMD_GET_FREQ_LEVEL_INFO - Get freq level info
148 * CMD_GET_FREQ_INFO - Get freq info
155 * CMD_SET_FREQ_INFO - Set freq info
188 return -EPERM; in do_service_request()
212 return -EPERM; in do_service_request()
233 ret = do_service_request(cpu_data[policy->cpu].core, in loongson3_cpufreq_target()
259 data = devm_kzalloc(&pdev->dev, struct_size(data, table, freq_level + 1), GFP_KERNEL); in configure_freq_table()
261 return -ENOMEM; in configure_freq_table()
263 data->def_freq_level = boost_level - 1; in configure_freq_table()
268 devm_kfree(&pdev->dev, data); in configure_freq_table()
272 data->table[i].frequency = ret * KILO; in configure_freq_table()
273 data->table[i].flags = (i >= boost_level) ? CPUFREQ_BOOST_FREQ : 0; in configure_freq_table()
276 data->table[freq_level].flags = 0; in configure_freq_table()
277 data->table[freq_level].frequency = CPUFREQ_TABLE_END; in configure_freq_table()
286 int i, ret, cpu = policy->cpu; in loongson3_cpufreq_cpu_init()
292 policy->cpuinfo.transition_latency = 10000; in loongson3_cpufreq_cpu_init()
293 policy->freq_table = per_cpu(freq_data, cpu)->table; in loongson3_cpufreq_cpu_init()
294 policy->suspend_freq = policy->freq_table[per_cpu(freq_data, cpu)->def_freq_level].frequency; in loongson3_cpufreq_cpu_init()
295 cpumask_copy(policy->cpus, topology_sibling_cpumask(cpu)); in loongson3_cpufreq_cpu_init()
297 for_each_cpu(i, policy->cpus) { in loongson3_cpufreq_cpu_init()
316 int cpu = policy->cpu; in loongson3_cpufreq_cpu_exit()
318 loongson3_cpufreq_target(policy, per_cpu(freq_data, cpu)->def_freq_level); in loongson3_cpufreq_cpu_exit()
350 devm_mutex_init(&pdev->dev, &cpufreq_mutex[i]); in loongson3_cpufreq_probe()
354 return -EPERM; in loongson3_cpufreq_probe()
359 return -EPERM; in loongson3_cpufreq_probe()
367 pr_info("cpufreq: Loongson-3 CPU frequency driver.\n"); in loongson3_cpufreq_probe()
393 MODULE_AUTHOR("Huacai Chen <chenhuacai@loongson.cn>");
394 MODULE_DESCRIPTION("CPUFreq driver for Loongson-3 processors");