Lines Matching +full:qcom +full:- +full:cpufreq +full:- +full:nvmem
1 // SPDX-License-Identifier: GPL-2.0
7 * In Certain QCOM SoCs like apq8096 and msm8996 that have KRYO processors,
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>
29 #include <linux/soc/qcom/smem.h>
31 #include <dt-bindings/arm/qcom,ids.h>
107 /* 4 bits of PVS are in efuse register bits 31, 8-6. */ in get_krait_bin_format_b()
155 drv->versions = 1 << (unsigned int)(*speedbin); in qcom_cpufreq_kryo_name_version()
159 drv->versions = 1 << ((unsigned int)(*speedbin) + 4); in qcom_cpufreq_kryo_name_version()
195 dev_err(cpu_dev, "Unable to read nvmem data. Defaulting to 0!\n"); in qcom_cpufreq_krait_name_version()
196 ret = -ENODEV; in qcom_cpufreq_krait_name_version()
200 snprintf(*pvs_name, sizeof("speedXX-pvsXX-vXX"), "speed%d-pvs%d-v%d", in qcom_cpufreq_krait_name_version()
203 drv->versions = (1 << speed); in qcom_cpufreq_krait_name_version()
230 char pvs_name_buffer[] = "speedXX-pvsXX-vXX"; in qcom_cpufreq_probe()
238 return -ENODEV; in qcom_cpufreq_probe()
242 return -ENOENT; in qcom_cpufreq_probe()
244 ret = of_device_is_compatible(np, "operating-points-v2-kryo-cpu"); in qcom_cpufreq_probe()
247 return -ENOENT; in qcom_cpufreq_probe()
250 drv = devm_kzalloc(&pdev->dev, struct_size(drv, cpus, num_possible_cpus()), in qcom_cpufreq_probe()
254 return -ENOMEM; in qcom_cpufreq_probe()
257 match = pdev->dev.platform_data; in qcom_cpufreq_probe()
258 drv->data = match->data; in qcom_cpufreq_probe()
259 if (!drv->data) { in qcom_cpufreq_probe()
261 return -ENODEV; in qcom_cpufreq_probe()
264 if (drv->data->get_version) { in qcom_cpufreq_probe()
269 "Could not get nvmem cell\n"); in qcom_cpufreq_probe()
272 ret = drv->data->get_version(cpu_dev, in qcom_cpufreq_probe()
290 ret = -ENODEV; in qcom_cpufreq_probe()
294 if (drv->data->get_version) { in qcom_cpufreq_probe()
295 config.supported_hw = &drv->versions; in qcom_cpufreq_probe()
302 if (drv->data->genpd_names) { in qcom_cpufreq_probe()
303 config.genpd_names = drv->data->genpd_names; in qcom_cpufreq_probe()
308 drv->cpus[cpu].opp_token = dev_pm_opp_set_config(cpu_dev, &config); in qcom_cpufreq_probe()
309 if (drv->cpus[cpu].opp_token < 0) { in qcom_cpufreq_probe()
310 ret = drv->cpus[cpu].opp_token; in qcom_cpufreq_probe()
317 cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1, in qcom_cpufreq_probe()
329 dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); in qcom_cpufreq_probe()
341 dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); in qcom_cpufreq_remove()
348 .name = "qcom-cpufreq-nvmem",
353 { .compatible = "qcom,apq8096", .data = &match_data_kryo },
354 { .compatible = "qcom,msm8996", .data = &match_data_kryo },
355 { .compatible = "qcom,qcs404", .data = &match_data_qcs404 },
356 { .compatible = "qcom,ipq8064", .data = &match_data_krait },
357 { .compatible = "qcom,apq8064", .data = &match_data_krait },
358 { .compatible = "qcom,msm8974", .data = &match_data_krait },
359 { .compatible = "qcom,msm8960", .data = &match_data_krait },
365 * Since the driver depends on smem and nvmem drivers, which may
377 return -ENODEV; in qcom_cpufreq_init()
382 return -ENODEV; in qcom_cpufreq_init()
388 cpufreq_pdev = platform_device_register_data(NULL, "qcom-cpufreq-nvmem", in qcom_cpufreq_init()
389 -1, match, sizeof(*match)); in qcom_cpufreq_init()
406 MODULE_DESCRIPTION("Qualcomm Technologies, Inc. CPUfreq driver");