Lines Matching +full:speed +full:- +full:bin
1 // SPDX-License-Identifier: GPL-2.0
5 * The sun50i-cpufreq-nvmem driver reads the efuse value from the SoC to
13 #include <linux/arm-smccc.h>
16 #include <linux/nvmem-consumer.h>
39 * the slowest bin. Expected efuse values are 1-3, slowest in sun50i_h6_efuse_xlate()
43 return efuse_value - 1; in sun50i_h6_efuse_xlate()
59 * returned speedbin index is 4 -> 0/2 -> 3 -> 1, from worst to best.
98 pr_warn("sun50i-cpufreq-nvmem: unknown speed bin 0x%x, using default bin 0\n", in sun50i_h616_efuse_xlate()
116 { .compatible = "allwinner,sun50i-h6-operating-points",
119 { .compatible = "allwinner,sun50i-h616-operating-points",
126 * dt_has_supported_hw() - Check if any OPPs use opp-supported-hw
128 * If we ask the cpufreq framework to use the opp-supported-hw feature, it
132 * Returns true if we have at least one OPP with the opp-supported-hw property.
149 if (of_property_present(opp, "opp-supported-hw")) { in dt_has_supported_hw()
159 * sun50i_cpufreq_get_efuse() - Determine speed grade from efuse value
161 * Returns non-negative speed bin index on success, a negative error
175 return -ENODEV; in sun50i_cpufreq_get_efuse()
180 return -ENOENT; in sun50i_cpufreq_get_efuse()
184 return -ENOENT; in sun50i_cpufreq_get_efuse()
186 opp_data = match->data; in sun50i_cpufreq_get_efuse()
198 ret = opp_data->efuse_xlate(*speedbin); in sun50i_cpufreq_get_efuse()
211 int speed; in sun50i_cpufreq_nvmem_probe() local
217 return -ENOMEM; in sun50i_cpufreq_nvmem_probe()
219 speed = sun50i_cpufreq_get_efuse(); in sun50i_cpufreq_nvmem_probe()
220 if (speed < 0) { in sun50i_cpufreq_nvmem_probe()
222 return speed; in sun50i_cpufreq_nvmem_probe()
226 * We need at least one OPP with the "opp-supported-hw" property, in sun50i_cpufreq_nvmem_probe()
230 supported_hw = 1U << speed; in sun50i_cpufreq_nvmem_probe()
235 snprintf(name, sizeof(name), "speed%d", speed); in sun50i_cpufreq_nvmem_probe()
242 ret = -ENODEV; in sun50i_cpufreq_nvmem_probe()
253 cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1, in sun50i_cpufreq_nvmem_probe()
288 .name = "sun50i-cpufreq-nvmem",
293 { .compatible = "allwinner,sun50i-h6" },
294 { .compatible = "allwinner,sun50i-h616" },
295 { .compatible = "allwinner,sun50i-h618" },
296 { .compatible = "allwinner,sun50i-h700" },
320 return -ENODEV; in sun50i_cpufreq_init()
327 platform_device_register_simple("sun50i-cpufreq-nvmem", in sun50i_cpufreq_init()
328 -1, NULL, 0); in sun50i_cpufreq_init()
345 MODULE_DESCRIPTION("Sun50i-h6 cpufreq driver");