mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-19 11:16:32 +00:00
ipq806x: update nvmem cpufreq driver
Rework the nvmem cpufreq driver to reflect changed in kernel 5.4 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
This commit is contained in:
parent
eaceb85ebc
commit
583111c124
@ -41,7 +41,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
# speedbin that is used to select the right frequency/voltage
|
# speedbin that is used to select the right frequency/voltage
|
||||||
--- a/drivers/cpufreq/Kconfig.arm
|
--- a/drivers/cpufreq/Kconfig.arm
|
||||||
+++ b/drivers/cpufreq/Kconfig.arm
|
+++ b/drivers/cpufreq/Kconfig.arm
|
||||||
@@ -112,7 +112,7 @@ config ARM_OMAP2PLUS_CPUFREQ
|
@@ -134,7 +134,7 @@ config ARM_OMAP2PLUS_CPUFREQ
|
||||||
|
|
||||||
config ARM_QCOM_CPUFREQ_NVMEM
|
config ARM_QCOM_CPUFREQ_NVMEM
|
||||||
tristate "Qualcomm nvmem based CPUFreq"
|
tristate "Qualcomm nvmem based CPUFreq"
|
||||||
@ -52,7 +52,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
select PM_OPP
|
select PM_OPP
|
||||||
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
|
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
|
||||||
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
|
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
|
||||||
@@ -128,6 +128,11 @@ static const struct of_device_id blackli
|
@@ -138,6 +138,11 @@ static const struct of_device_id blackli
|
||||||
{ .compatible = "ti,am43", },
|
{ .compatible = "ti,am43", },
|
||||||
{ .compatible = "ti,dra7", },
|
{ .compatible = "ti,dra7", },
|
||||||
|
|
||||||
@ -66,21 +66,23 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
|
|
||||||
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
|
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
|
||||||
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
|
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
|
||||||
@@ -48,17 +48,92 @@ struct qcom_cpufreq_drv;
|
@@ -49,12 +49,14 @@ struct qcom_cpufreq_drv;
|
||||||
struct qcom_cpufreq_match_data {
|
struct qcom_cpufreq_match_data {
|
||||||
int (*get_version)(struct device *cpu_dev,
|
int (*get_version)(struct device *cpu_dev,
|
||||||
struct nvmem_cell *speedbin_nvmem,
|
struct nvmem_cell *speedbin_nvmem,
|
||||||
+ char **pvs_name,
|
+ char **pvs_name,
|
||||||
struct qcom_cpufreq_drv *drv);
|
struct qcom_cpufreq_drv *drv);
|
||||||
|
const char **genpd_names;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct qcom_cpufreq_drv {
|
struct qcom_cpufreq_drv {
|
||||||
- struct opp_table **opp_tables;
|
- struct opp_table **opp_tables;
|
||||||
+ struct opp_table **opp_tables1;
|
+ struct opp_table **opp_tables1;
|
||||||
+ struct opp_table **opp_tables2;
|
+ struct opp_table **opp_tables2;
|
||||||
|
struct opp_table **genpd_opp_tables;
|
||||||
u32 versions;
|
u32 versions;
|
||||||
const struct qcom_cpufreq_match_data *data;
|
const struct qcom_cpufreq_match_data *data;
|
||||||
};
|
@@ -62,6 +64,79 @@ struct qcom_cpufreq_drv {
|
||||||
|
|
||||||
static struct platform_device *cpufreq_dt_pdev, *cpufreq_pdev;
|
static struct platform_device *cpufreq_dt_pdev, *cpufreq_pdev;
|
||||||
|
|
||||||
@ -160,7 +162,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
|
static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
@@ -90,11 +165,13 @@ static enum _msm8996_version qcom_cpufre
|
@@ -93,11 +168,13 @@ static enum _msm8996_version qcom_cpufre
|
||||||
|
|
||||||
static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
|
static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
|
||||||
struct nvmem_cell *speedbin_nvmem,
|
struct nvmem_cell *speedbin_nvmem,
|
||||||
@ -174,7 +176,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
|
|
||||||
msm8996_version = qcom_cpufreq_get_msm_id();
|
msm8996_version = qcom_cpufreq_get_msm_id();
|
||||||
if (NUM_OF_MSM8996_VERSIONS == msm8996_version) {
|
if (NUM_OF_MSM8996_VERSIONS == msm8996_version) {
|
||||||
@@ -122,16 +199,51 @@ static int qcom_cpufreq_kryo_name_versio
|
@@ -125,10 +202,44 @@ static int qcom_cpufreq_kryo_name_versio
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,9 +218,10 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
+ .get_version = qcom_cpufreq_krait_name_version,
|
+ .get_version = qcom_cpufreq_krait_name_version,
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
static int qcom_cpufreq_probe(struct platform_device *pdev)
|
static const char *qcs404_genpd_names[] = { "cpr", NULL };
|
||||||
{
|
|
||||||
struct qcom_cpufreq_drv *drv;
|
static const struct qcom_cpufreq_match_data match_data_qcs404 = {
|
||||||
|
@@ -141,6 +252,7 @@ static int qcom_cpufreq_probe(struct pla
|
||||||
struct nvmem_cell *speedbin_nvmem;
|
struct nvmem_cell *speedbin_nvmem;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
struct device *cpu_dev;
|
struct device *cpu_dev;
|
||||||
@ -226,7 +229,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
unsigned cpu;
|
unsigned cpu;
|
||||||
const struct of_device_id *match;
|
const struct of_device_id *match;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -144,7 +256,7 @@ static int qcom_cpufreq_probe(struct pla
|
@@ -153,7 +265,7 @@ static int qcom_cpufreq_probe(struct pla
|
||||||
if (!np)
|
if (!np)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
@ -235,7 +238,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
if (!ret) {
|
if (!ret) {
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
@@ -172,7 +284,7 @@ static int qcom_cpufreq_probe(struct pla
|
@@ -181,7 +293,7 @@ static int qcom_cpufreq_probe(struct pla
|
||||||
goto free_drv;
|
goto free_drv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +247,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
nvmem_cell_put(speedbin_nvmem);
|
nvmem_cell_put(speedbin_nvmem);
|
||||||
goto free_drv;
|
goto free_drv;
|
||||||
@@ -181,12 +293,18 @@ static int qcom_cpufreq_probe(struct pla
|
@@ -190,12 +302,18 @@ static int qcom_cpufreq_probe(struct pla
|
||||||
}
|
}
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
|
|
||||||
@ -263,9 +266,9 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
+ goto free_opp1;
|
+ goto free_opp1;
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
for_each_possible_cpu(cpu) {
|
drv->genpd_opp_tables = kcalloc(num_possible_cpus(),
|
||||||
cpu_dev = get_cpu_device(cpu);
|
sizeof(*drv->genpd_opp_tables),
|
||||||
@@ -196,11 +314,22 @@ static int qcom_cpufreq_probe(struct pla
|
@@ -213,11 +331,22 @@ static int qcom_cpufreq_probe(struct pla
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drv->data->get_version) {
|
if (drv->data->get_version) {
|
||||||
@ -291,51 +294,53 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
|
|||||||
+ ret = PTR_ERR(drv->opp_tables2[cpu]);
|
+ ret = PTR_ERR(drv->opp_tables2[cpu]);
|
||||||
dev_err(cpu_dev,
|
dev_err(cpu_dev,
|
||||||
"Failed to set supported hardware\n");
|
"Failed to set supported hardware\n");
|
||||||
goto free_opp;
|
goto free_genpd_opp;
|
||||||
@@ -220,11 +349,18 @@ static int qcom_cpufreq_probe(struct pla
|
@@ -259,11 +388,18 @@ free_genpd_opp:
|
||||||
|
kfree(drv->genpd_opp_tables);
|
||||||
free_opp:
|
free_opp:
|
||||||
for_each_possible_cpu(cpu) {
|
for_each_possible_cpu(cpu) {
|
||||||
- if (IS_ERR_OR_NULL(drv->opp_tables[cpu]))
|
- if (IS_ERR_OR_NULL(drv->opp_tables[cpu]))
|
||||||
+ if (IS_ERR_OR_NULL(drv->opp_tables1[cpu]))
|
+ if (IS_ERR_OR_NULL(drv->opp_tables1[cpu]))
|
||||||
break;
|
+ break;
|
||||||
- dev_pm_opp_put_supported_hw(drv->opp_tables[cpu]);
|
|
||||||
+ dev_pm_opp_put_prop_name(drv->opp_tables1[cpu]);
|
+ dev_pm_opp_put_prop_name(drv->opp_tables1[cpu]);
|
||||||
}
|
+ }
|
||||||
- kfree(drv->opp_tables);
|
|
||||||
+ for_each_possible_cpu(cpu) {
|
+ for_each_possible_cpu(cpu) {
|
||||||
+ if (IS_ERR_OR_NULL(drv->opp_tables2[cpu]))
|
+ if (IS_ERR_OR_NULL(drv->opp_tables2[cpu]))
|
||||||
+ break;
|
break;
|
||||||
|
- dev_pm_opp_put_supported_hw(drv->opp_tables[cpu]);
|
||||||
+ dev_pm_opp_put_supported_hw(drv->opp_tables2[cpu]);
|
+ dev_pm_opp_put_supported_hw(drv->opp_tables2[cpu]);
|
||||||
+ }
|
}
|
||||||
|
- kfree(drv->opp_tables);
|
||||||
+ kfree(drv->opp_tables2);
|
+ kfree(drv->opp_tables2);
|
||||||
+free_opp1:
|
+free_opp1:
|
||||||
+ kfree(drv->opp_tables1);
|
+ kfree(drv->opp_tables1);
|
||||||
free_drv:
|
free_drv:
|
||||||
kfree(drv);
|
kfree(drv);
|
||||||
|
|
||||||
@@ -239,10 +375,14 @@ static int qcom_cpufreq_remove(struct pl
|
@@ -278,13 +414,16 @@ static int qcom_cpufreq_remove(struct pl
|
||||||
platform_device_unregister(cpufreq_dt_pdev);
|
platform_device_unregister(cpufreq_dt_pdev);
|
||||||
|
|
||||||
for_each_possible_cpu(cpu)
|
for_each_possible_cpu(cpu) {
|
||||||
- if (drv->opp_tables[cpu])
|
- if (drv->opp_tables[cpu])
|
||||||
- dev_pm_opp_put_supported_hw(drv->opp_tables[cpu]);
|
- dev_pm_opp_put_supported_hw(drv->opp_tables[cpu]);
|
||||||
+ if (drv->opp_tables1[cpu])
|
+ if (drv->opp_tables1[cpu])
|
||||||
+ dev_pm_opp_put_prop_name(drv->opp_tables1[cpu]);
|
+ dev_pm_opp_put_supported_hw(drv->opp_tables1[cpu]);
|
||||||
+ for_each_possible_cpu(cpu)
|
|
||||||
+ if (drv->opp_tables2[cpu])
|
+ if (drv->opp_tables2[cpu])
|
||||||
+ dev_pm_opp_put_supported_hw(drv->opp_tables2[cpu]);
|
+ dev_pm_opp_put_supported_hw(drv->opp_tables2[cpu]);
|
||||||
|
if (drv->genpd_opp_tables[cpu])
|
||||||
|
dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
|
||||||
|
}
|
||||||
|
|
||||||
- kfree(drv->opp_tables);
|
- kfree(drv->opp_tables);
|
||||||
+ kfree(drv->opp_tables1);
|
+ kfree(drv->opp_tables1);
|
||||||
+ kfree(drv->opp_tables2);
|
+ kfree(drv->opp_tables2);
|
||||||
|
kfree(drv->genpd_opp_tables);
|
||||||
kfree(drv);
|
kfree(drv);
|
||||||
|
|
||||||
return 0;
|
@@ -303,6 +442,10 @@ static const struct of_device_id qcom_cp
|
||||||
@@ -259,6 +399,10 @@ static struct platform_driver qcom_cpufr
|
|
||||||
static const struct of_device_id qcom_cpufreq_match_list[] __initconst = {
|
|
||||||
{ .compatible = "qcom,apq8096", .data = &match_data_kryo },
|
{ .compatible = "qcom,apq8096", .data = &match_data_kryo },
|
||||||
{ .compatible = "qcom,msm8996", .data = &match_data_kryo },
|
{ .compatible = "qcom,msm8996", .data = &match_data_kryo },
|
||||||
|
{ .compatible = "qcom,qcs404", .data = &match_data_qcs404 },
|
||||||
+ { .compatible = "qcom,ipq8064", .data = &match_data_krait },
|
+ { .compatible = "qcom,ipq8064", .data = &match_data_krait },
|
||||||
+ { .compatible = "qcom,apq8064", .data = &match_data_krait },
|
+ { .compatible = "qcom,apq8064", .data = &match_data_krait },
|
||||||
+ { .compatible = "qcom,msm8974", .data = &match_data_krait },
|
+ { .compatible = "qcom,msm8974", .data = &match_data_krait },
|
||||||
|
Loading…
Reference in New Issue
Block a user