[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230418113459.12860-3-sumitg@nvidia.com>
Date: Tue, 18 Apr 2023 17:04:55 +0530
From: Sumit Gupta <sumitg@...dia.com>
To: <viresh.kumar@...aro.org>, <rafael@...nel.org>,
<ionela.voinescu@....com>, <mark.rutland@....com>,
<sudeep.holla@....com>, <lpieralisi@...nel.org>,
<catalin.marinas@....com>, <will@...nel.org>
CC: <linux-pm@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-tegra@...r.kernel.org>,
<treding@...dia.com>, <jonathanh@...dia.com>, <vsethi@...dia.com>,
<sdonthineni@...dia.com>, <sanjayc@...dia.com>,
<ksitaraman@...dia.com>, <bbasu@...dia.com>, <sumitg@...dia.com>
Subject: [Patch 2/6] cpufreq: CPPC: make workaround apply code generic
Expand the code which applies SoC workarounds to make it generic
and easy to reuse.
Signed-off-by: Sumit Gupta <sumitg@...dia.com>
---
drivers/cpufreq/cppc_cpufreq.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 022e3555407c..15c2cbb7a50e 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -43,10 +43,13 @@ static LIST_HEAD(cpu_data_list);
static bool boost_supported;
+static void cppc_check_hisi_workaround(void);
+
struct cppc_workaround_oem_info {
char oem_id[ACPI_OEM_ID_SIZE + 1];
char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
u32 oem_revision;
+ void (*apply_wa_func)(void);
};
static struct cppc_workaround_oem_info wa_info[] = {
@@ -54,10 +57,12 @@ static struct cppc_workaround_oem_info wa_info[] = {
.oem_id = "HISI ",
.oem_table_id = "HIP07 ",
.oem_revision = 0,
+ .apply_wa_func = cppc_check_hisi_workaround,
}, {
.oem_id = "HISI ",
.oem_table_id = "HIP08 ",
.oem_revision = 0,
+ .apply_wa_func = cppc_check_hisi_workaround,
}
};
@@ -938,6 +943,13 @@ static unsigned int hisi_cppc_cpufreq_get_rate(unsigned int cpu)
}
static void cppc_check_hisi_workaround(void)
+{
+ /* Overwrite the get() callback */
+ cppc_cpufreq_driver.get = hisi_cppc_cpufreq_get_rate;
+ fie_disabled = FIE_DISABLED;
+}
+
+static void cppc_apply_workarounds(void)
{
struct acpi_table_header *tbl;
acpi_status status = AE_OK;
@@ -951,9 +963,8 @@ static void cppc_check_hisi_workaround(void)
if (!memcmp(wa_info[i].oem_id, tbl->oem_id, ACPI_OEM_ID_SIZE) &&
!memcmp(wa_info[i].oem_table_id, tbl->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) &&
wa_info[i].oem_revision == tbl->oem_revision) {
- /* Overwrite the get() callback */
- cppc_cpufreq_driver.get = hisi_cppc_cpufreq_get_rate;
- fie_disabled = FIE_DISABLED;
+ /* call work around function which matched from the table */
+ wa_info[i].apply_wa_func();
break;
}
}
@@ -968,7 +979,7 @@ static int __init cppc_cpufreq_init(void)
if (!acpi_cpc_valid())
return -ENODEV;
- cppc_check_hisi_workaround();
+ cppc_apply_workarounds();
cppc_freq_invariance_init();
populate_efficiency_class();
--
2.17.1
Powered by blists - more mailing lists