Lines Matching +full:drv +full:- +full:1

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>
54 struct qcom_cpufreq_drv *drv);
74 struct qcom_cpufreq_drv *drv) in qcom_cpufreq_simple_get_version() argument
84 drv->versions = 1 << *speedbin; in qcom_cpufreq_simple_get_version()
132 case 1: 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()
155 pte_efuse = *(((u32 *)buf) + 1); in get_krait_bin_format_b()
170 struct qcom_cpufreq_drv *drv) in qcom_cpufreq_kryo_name_version() argument
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()
218 struct qcom_cpufreq_drv *drv) in qcom_cpufreq_krait_name_version() argument
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()
247 drv->versions = (1 << speed); in qcom_cpufreq_krait_name_version()
257 struct qcom_cpufreq_drv *drv) in qcom_cpufreq_ipq8064_name_version() argument
270 ret = -ENODEV; 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()
302 snprintf(*pvs_name, sizeof("speed0-pvsXX"), "speed0-pvs%d", pvs); in qcom_cpufreq_ipq8064_name_version()
312 struct qcom_cpufreq_drv *drv) in qcom_cpufreq_ipq6018_name_version() argument
333 * --------------------------------- in qcom_cpufreq_ipq6018_name_version()
335 * 2’b1 1.5 GHz BIT(1) 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()
363 struct qcom_cpufreq_drv *drv) in qcom_cpufreq_ipq8074_name_version() argument
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()
431 static void qcom_cpufreq_suspend_virt_devs(struct qcom_cpufreq_drv *drv, unsigned int cpu) in qcom_cpufreq_suspend_virt_devs() argument
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()
443 static void qcom_cpufreq_put_virt_devs(struct qcom_cpufreq_drv *drv, unsigned int cpu) in qcom_cpufreq_put_virt_devs() argument
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()
457 struct qcom_cpufreq_drv *drv; in qcom_cpufreq_probe() local
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()
482 if (!drv) 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()
497 speedbin_nvmem, &pvs_name, drv); 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()
519 config.supported_hw_count = 1; 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()
564 platform_set_drvdata(pdev, drv); in qcom_cpufreq_probe()
573 qcom_cpufreq_put_virt_devs(drv, cpu); in qcom_cpufreq_probe()
574 dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); in qcom_cpufreq_probe()
581 struct qcom_cpufreq_drv *drv = platform_get_drvdata(pdev); in qcom_cpufreq_remove() local
587 qcom_cpufreq_put_virt_devs(drv, cpu); in qcom_cpufreq_remove()
588 dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); in qcom_cpufreq_remove()
594 struct qcom_cpufreq_drv *drv = dev_get_drvdata(dev); in qcom_cpufreq_suspend() local
598 qcom_cpufreq_suspend_virt_devs(drv, cpu); in qcom_cpufreq_suspend()
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()