Lines Matching +full:opp +full:- +full:supported +full:- +full:hw
1 // SPDX-License-Identifier: GPL-2.0
5 * The sun50i-cpufreq-nvmem driver reads the efuse value from the SoC to
6 * provide the OPP framework with required information.
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()
58 * Judging by the OPP tables in the vendor BSP, the quality order of the
59 * returned speedbin index is 4 -> 0/2 -> 3 -> 1, from worst to best.
60 * 0 and 2 seem identical from the OPP tables' point of view.
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
129 * will ignore every OPP node without that DT property. If none of the OPPs
132 * Returns true if we have at least one OPP with the opp-supported-hw property.
148 for_each_child_of_node_scoped(np, opp) { in dt_has_supported_hw()
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()
217 return -ENOMEM; in sun50i_cpufreq_nvmem_probe()
226 * We need at least one OPP with the "opp-supported-hw" property, in sun50i_cpufreq_nvmem_probe()
227 * or else the upper layers will ignore every OPP and will bail out. 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");