aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq806x
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2020-01-26 04:29:56 +0100
committerPetr Štetiar <ynezz@true.cz>2020-03-03 23:38:23 +0100
commit583111c1245b8db982c160f501e5c3f61332a40f (patch)
tree001139da690bc838e392ffa8859a82d60874a532 /target/linux/ipq806x
parenteaceb85ebc01895d153a687123cf5d050d0f148b (diff)
downloadupstream-583111c1245b8db982c160f501e5c3f61332a40f.tar.gz
upstream-583111c1245b8db982c160f501e5c3f61332a40f.tar.bz2
upstream-583111c1245b8db982c160f501e5c3f61332a40f.zip
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>
Diffstat (limited to 'target/linux/ipq806x')
-rw-r--r--target/linux/ipq806x/patches-5.4/0038-qcom-cpufreq-nvmem-Add-support-for-krait-based-socs.patch67
1 files changed, 36 insertions, 31 deletions
diff --git a/target/linux/ipq806x/patches-5.4/0038-qcom-cpufreq-nvmem-Add-support-for-krait-based-socs.patch b/target/linux/ipq806x/patches-5.4/0038-qcom-cpufreq-nvmem-Add-support-for-krait-based-socs.patch
index b8895231d8..1df38578d8 100644
--- a/target/linux/ipq806x/patches-5.4/0038-qcom-cpufreq-nvmem-Add-support-for-krait-based-socs.patch
+++ b/target/linux/ipq806x/patches-5.4/0038-qcom-cpufreq-nvmem-Add-support-for-krait-based-socs.patch
@@ -41,7 +41,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
# speedbin that is used to select the right frequency/voltage
--- a/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
tristate "Qualcomm nvmem based CPUFreq"
@@ -52,7 +52,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
select PM_OPP
--- a/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,dra7", },
@@ -66,21 +66,23 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
--- a/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 {
int (*get_version)(struct device *cpu_dev,
struct nvmem_cell *speedbin_nvmem,
+ char **pvs_name,
struct qcom_cpufreq_drv *drv);
+ const char **genpd_names;
};
struct qcom_cpufreq_drv {
- struct opp_table **opp_tables;
+ struct opp_table **opp_tables1;
+ struct opp_table **opp_tables2;
+ struct opp_table **genpd_opp_tables;
u32 versions;
const struct qcom_cpufreq_match_data *data;
- };
+@@ -62,6 +64,79 @@ struct qcom_cpufreq_drv {
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)
{
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,
struct nvmem_cell *speedbin_nvmem,
@@ -174,7 +176,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
msm8996_version = qcom_cpufreq_get_msm_id();
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;
}
@@ -216,9 +218,10 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
+ .get_version = qcom_cpufreq_krait_name_version,
+};
+
- static int qcom_cpufreq_probe(struct platform_device *pdev)
- {
- struct qcom_cpufreq_drv *drv;
+ static const char *qcs404_genpd_names[] = { "cpr", NULL };
+
+ 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 device_node *np;
struct device *cpu_dev;
@@ -226,7 +229,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
unsigned cpu;
const struct of_device_id *match;
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)
return -ENOENT;
@@ -235,7 +238,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
if (!ret) {
of_node_put(np);
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;
}
@@ -244,7 +247,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
if (ret) {
nvmem_cell_put(speedbin_nvmem);
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);
@@ -263,9 +266,9 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
+ goto free_opp1;
+ }
- for_each_possible_cpu(cpu) {
- cpu_dev = get_cpu_device(cpu);
-@@ -196,11 +314,22 @@ static int qcom_cpufreq_probe(struct pla
+ drv->genpd_opp_tables = kcalloc(num_possible_cpus(),
+ sizeof(*drv->genpd_opp_tables),
+@@ -213,11 +331,22 @@ static int qcom_cpufreq_probe(struct pla
}
if (drv->data->get_version) {
@@ -291,51 +294,53 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
+ ret = PTR_ERR(drv->opp_tables2[cpu]);
dev_err(cpu_dev,
"Failed to set supported hardware\n");
- goto free_opp;
-@@ -220,11 +349,18 @@ static int qcom_cpufreq_probe(struct pla
-
+ goto free_genpd_opp;
+@@ -259,11 +388,18 @@ free_genpd_opp:
+ kfree(drv->genpd_opp_tables);
free_opp:
for_each_possible_cpu(cpu) {
- if (IS_ERR_OR_NULL(drv->opp_tables[cpu]))
+ if (IS_ERR_OR_NULL(drv->opp_tables1[cpu]))
- break;
-- dev_pm_opp_put_supported_hw(drv->opp_tables[cpu]);
++ break;
+ dev_pm_opp_put_prop_name(drv->opp_tables1[cpu]);
- }
-- kfree(drv->opp_tables);
++ }
+ for_each_possible_cpu(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]);
-+ }
+ }
+- kfree(drv->opp_tables);
+ kfree(drv->opp_tables2);
+free_opp1:
+ kfree(drv->opp_tables1);
free_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);
- for_each_possible_cpu(cpu)
+ for_each_possible_cpu(cpu) {
- if (drv->opp_tables[cpu])
- dev_pm_opp_put_supported_hw(drv->opp_tables[cpu]);
+ if (drv->opp_tables1[cpu])
-+ dev_pm_opp_put_prop_name(drv->opp_tables1[cpu]);
-+ for_each_possible_cpu(cpu)
++ dev_pm_opp_put_supported_hw(drv->opp_tables1[cpu]);
+ if (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_tables1);
+ kfree(drv->opp_tables2);
+ kfree(drv->genpd_opp_tables);
kfree(drv);
- return 0;
-@@ -259,6 +399,10 @@ static struct platform_driver qcom_cpufr
- static const struct of_device_id qcom_cpufreq_match_list[] __initconst = {
+@@ -303,6 +442,10 @@ static const struct of_device_id qcom_cp
{ .compatible = "qcom,apq8096", .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,apq8064", .data = &match_data_krait },
+ { .compatible = "qcom,msm8974", .data = &match_data_krait },