Lines Matching +full:speed +full:- +full:bin
1 // SPDX-License-Identifier: GPL-2.0
10 * defines the voltage and frequency value based on the msm-id in SMEM
12 * The qcom-cpufreq-nvmem driver reads the msm-id and efuse value from the SoC
15 * operating-points-v2 table when it is parsed by the OPP framework.
23 #include <linux/nvmem-consumer.h>
33 #include <dt-bindings/arm/qcom,ids.h>
84 drv->versions = 1 << *speedbin; in qcom_cpufreq_simple_get_version()
90 int *speed, int *pvs, in get_krait_bin_format_a() argument
97 *speed = pte_efuse & 0xf; in get_krait_bin_format_a()
98 if (*speed == 0xf) in get_krait_bin_format_a()
99 *speed = (pte_efuse >> 4) & 0xf; in get_krait_bin_format_a()
101 if (*speed == 0xf) { in get_krait_bin_format_a()
102 *speed = 0; in get_krait_bin_format_a()
103 dev_warn(cpu_dev, "Speed bin: Defaulting to %d\n", *speed); in get_krait_bin_format_a()
105 dev_dbg(cpu_dev, "Speed bin: %d\n", *speed); in get_krait_bin_format_a()
114 dev_warn(cpu_dev, "PVS bin: Defaulting to %d\n", *pvs); in get_krait_bin_format_a()
116 dev_dbg(cpu_dev, "PVS bin: %d\n", *pvs); in get_krait_bin_format_a()
121 int *speed, int *pvs, int *pvs_ver, in get_krait_bin_format_b() argument
134 *speed = (pte_efuse >> 27) & 0xf; in get_krait_bin_format_b()
138 *speed = pte_efuse & 0x7; in get_krait_bin_format_b()
141 /* 4 bits of PVS are in efuse register bits 31, 8-6. */ in get_krait_bin_format_b()
143 *speed = pte_efuse & 0x7; in get_krait_bin_format_b()
148 dev_dbg(cpu_dev, "Speed bin: %d\n", *speed); in get_krait_bin_format_b()
150 dev_warn(cpu_dev, "Speed bin not set. Defaulting to 0!\n"); in get_krait_bin_format_b()
151 *speed = 0; in get_krait_bin_format_b()
158 dev_dbg(cpu_dev, "PVS bin: %d\n", *pvs); in get_krait_bin_format_b()
160 dev_warn(cpu_dev, "PVS bin not set. Defaulting to 0!\n"); in get_krait_bin_format_b()
200 drv->versions = 1 << (unsigned int)(*speedbin); in qcom_cpufreq_kryo_name_version()
204 drv->versions = 1 << ((unsigned int)(*speedbin) + 4); in qcom_cpufreq_kryo_name_version()
220 int speed = 0, pvs = 0, pvs_ver = 0; in qcom_cpufreq_krait_name_version() local
232 get_krait_bin_format_a(cpu_dev, &speed, &pvs, speedbin); in qcom_cpufreq_krait_name_version()
235 get_krait_bin_format_b(cpu_dev, &speed, &pvs, &pvs_ver, in qcom_cpufreq_krait_name_version()
240 ret = -ENODEV; in qcom_cpufreq_krait_name_version()
244 snprintf(*pvs_name, sizeof("speedXX-pvsXX-vXX"), "speed%d-pvs%d-v%d", in qcom_cpufreq_krait_name_version()
245 speed, pvs, pvs_ver); in qcom_cpufreq_krait_name_version()
247 drv->versions = (1 << speed); in qcom_cpufreq_krait_name_version()
259 int speed = 0, pvs = 0; in qcom_cpufreq_ipq8064_name_version() local
270 ret = -ENODEV; in qcom_cpufreq_ipq8064_name_version()
274 get_krait_bin_format_a(cpu_dev, &speed, &pvs, speedbin); in qcom_cpufreq_ipq8064_name_version()
282 drv->versions = BIT(IPQ8062_VERSION); in qcom_cpufreq_ipq8064_name_version()
287 drv->versions = BIT(IPQ8064_VERSION); in qcom_cpufreq_ipq8064_name_version()
291 drv->versions = BIT(IPQ8065_VERSION); in qcom_cpufreq_ipq8064_name_version()
297 drv->versions = BIT(IPQ8062_VERSION); in qcom_cpufreq_ipq8064_name_version()
301 /* IPQ8064 speed is never fused. Only pvs values are fused. */ in qcom_cpufreq_ipq8064_name_version()
302 snprintf(*pvs_name, sizeof("speed0-pvsXX"), "speed0-pvs%d", pvs); in qcom_cpufreq_ipq8064_name_version()
333 * --------------------------------- in qcom_cpufreq_ipq6018_name_version()
337 drv->versions = 1 << (unsigned int)(*speedbin); in qcom_cpufreq_ipq6018_name_version()
342 * speed-bin, but that is not enough for IPQ6000 which in qcom_cpufreq_ipq6018_name_version()
346 drv->versions = IPQ6000_VERSION; in qcom_cpufreq_ipq6018_name_version()
352 drv->versions = IPQ6000_VERSION; in qcom_cpufreq_ipq6018_name_version()
379 drv->versions = BIT(IPQ8074_ACORN_VERSION); in qcom_cpufreq_ipq8074_name_version()
385 drv->versions = BIT(IPQ8074_HAWKEYE_VERSION); in qcom_cpufreq_ipq8074_name_version()
391 drv->versions = BIT(IPQ8074_ACORN_VERSION); in qcom_cpufreq_ipq8074_name_version()
433 const char * const *name = drv->data->genpd_names; in qcom_cpufreq_suspend_virt_devs()
436 if (!drv->cpus[cpu].virt_devs) in qcom_cpufreq_suspend_virt_devs()
440 device_set_awake_path(drv->cpus[cpu].virt_devs[i]); in qcom_cpufreq_suspend_virt_devs()
445 const char * const *name = drv->data->genpd_names; in qcom_cpufreq_put_virt_devs()
448 if (!drv->cpus[cpu].virt_devs) in qcom_cpufreq_put_virt_devs()
452 pm_runtime_put(drv->cpus[cpu].virt_devs[i]); in qcom_cpufreq_put_virt_devs()
460 char pvs_name_buffer[] = "speedXX-pvsXX-vXX"; in qcom_cpufreq_probe()
468 return -ENODEV; in qcom_cpufreq_probe()
473 return -ENOENT; in qcom_cpufreq_probe()
475 ret = of_device_is_compatible(np, "operating-points-v2-kryo-cpu") || in qcom_cpufreq_probe()
476 of_device_is_compatible(np, "operating-points-v2-krait-cpu"); in qcom_cpufreq_probe()
478 return -ENOENT; in qcom_cpufreq_probe()
480 drv = devm_kzalloc(&pdev->dev, struct_size(drv, cpus, num_possible_cpus()), in qcom_cpufreq_probe()
483 return -ENOMEM; in qcom_cpufreq_probe()
485 match = pdev->dev.platform_data; in qcom_cpufreq_probe()
486 drv->data = match->data; in qcom_cpufreq_probe()
487 if (!drv->data) in qcom_cpufreq_probe()
488 return -ENODEV; in qcom_cpufreq_probe()
490 if (drv->data->get_version) { in qcom_cpufreq_probe()
496 ret = drv->data->get_version(cpu_dev, in qcom_cpufreq_probe()
513 ret = -ENODEV; in qcom_cpufreq_probe()
517 if (drv->data->get_version) { in qcom_cpufreq_probe()
518 config.supported_hw = &drv->versions; in qcom_cpufreq_probe()
525 if (drv->data->genpd_names) { in qcom_cpufreq_probe()
526 config.genpd_names = drv->data->genpd_names; in qcom_cpufreq_probe()
531 drv->cpus[cpu].opp_token = dev_pm_opp_set_config(cpu_dev, &config); in qcom_cpufreq_probe()
532 if (drv->cpus[cpu].opp_token < 0) { in qcom_cpufreq_probe()
533 ret = drv->cpus[cpu].opp_token; in qcom_cpufreq_probe()
557 drv->cpus[cpu].virt_devs = virt_devs; in qcom_cpufreq_probe()
561 cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1, in qcom_cpufreq_probe()
574 dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); in qcom_cpufreq_probe()
588 dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); in qcom_cpufreq_remove()
609 .name = "qcom-cpufreq-nvmem",
644 return -ENODEV; in qcom_cpufreq_init()
648 return -ENODEV; in qcom_cpufreq_init()
654 cpufreq_pdev = platform_device_register_data(NULL, "qcom-cpufreq-nvmem", in qcom_cpufreq_init()
655 -1, match, sizeof(*match)); in qcom_cpufreq_init()