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>
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()
78 * Judging by the OPP tables in the vendor BSP, the quality order of the
79 * returned speedbin index is 4 -> 0/2 -> 3 -> 1, from worst to best.
80 * 0 and 2 seem identical from the OPP tables' point of view.
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
156 * will ignore every OPP node without that DT property. If none of the OPPs
159 * Returns true if we have at least one OPP with the opp-supported-hw property.
175 for_each_child_of_node_scoped(np, opp) { in dt_has_supported_hw()
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()
244 return -ENOMEM; in sun50i_cpufreq_nvmem_probe()
253 * We need at least one OPP with the "opp-supported-hw" property, in sun50i_cpufreq_nvmem_probe()
254 * or else the upper layers will ignore every OPP and will bail out. 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");