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>
42 * the slowest bin. Expected efuse values are 1-3, slowest in sun50i_h6_efuse_xlate()
46 return efuse_value - 1; in sun50i_h6_efuse_xlate()
79 * returned speedbin index is 4 -> 0/2 -> 3 -> 1, from worst to best.
118 pr_warn("sun50i-cpufreq-nvmem: unknown speed bin 0x%x, using default bin 0\n", in sun50i_h616_efuse_xlate()
140 { .compatible = "allwinner,sun50i-h6-operating-points",
143 { .compatible = "allwinner,sun50i-a100-operating-points",
146 { .compatible = "allwinner,sun50i-h616-operating-points",
153 * dt_has_supported_hw() - Check if any OPPs use opp-supported-hw
155 * If we ask the cpufreq framework to use the opp-supported-hw feature, it
159 * Returns true if we have at least one OPP with the opp-supported-hw property.
176 if (of_property_present(opp, "opp-supported-hw")) { in dt_has_supported_hw()
186 * sun50i_cpufreq_get_efuse() - Determine speed grade from efuse value
188 * Returns non-negative speed bin index on success, a negative error
202 return -ENODEV; in sun50i_cpufreq_get_efuse()
207 return -ENOENT; in sun50i_cpufreq_get_efuse()
211 return -ENOENT; in sun50i_cpufreq_get_efuse()
213 opp_data = match->data; in sun50i_cpufreq_get_efuse()
225 ret = opp_data->efuse_xlate(*speedbin); in sun50i_cpufreq_get_efuse()
238 int speed; in sun50i_cpufreq_nvmem_probe() local
244 return -ENOMEM; in sun50i_cpufreq_nvmem_probe()
246 speed = sun50i_cpufreq_get_efuse(); in sun50i_cpufreq_nvmem_probe()
247 if (speed < 0) { in sun50i_cpufreq_nvmem_probe()
249 return speed; in sun50i_cpufreq_nvmem_probe()
253 * We need at least one OPP with the "opp-supported-hw" property, in sun50i_cpufreq_nvmem_probe()
257 supported_hw = 1U << speed; in sun50i_cpufreq_nvmem_probe()
262 snprintf(name, sizeof(name), "speed%d", speed); in sun50i_cpufreq_nvmem_probe()
269 ret = -ENODEV; in sun50i_cpufreq_nvmem_probe()
280 cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1, in sun50i_cpufreq_nvmem_probe()
315 .name = "sun50i-cpufreq-nvmem",
320 { .compatible = "allwinner,sun50i-h6" },
321 { .compatible = "allwinner,sun50i-a100" },
322 { .compatible = "allwinner,sun50i-h616" },
323 { .compatible = "allwinner,sun50i-h618" },
324 { .compatible = "allwinner,sun50i-h700" },
348 return -ENODEV; in sun50i_cpufreq_init()
355 platform_device_register_simple("sun50i-cpufreq-nvmem", in sun50i_cpufreq_init()
356 -1, NULL, 0); in sun50i_cpufreq_init()
373 MODULE_DESCRIPTION("Sun50i-h6 cpufreq driver");