[PATCH 2/2] cpufreq: mediatek-hw: add support for mt8188

jia-wei.chang
2022-08-05T09:44:53Z

MT8188 mediatek-cpufreq-hw uses different register layout so it requires
a new compatible and platform data.

Signed-off-by: Jia-Wei Chang <jia-wei.chang@mediatek.com>
---
drivers/cpufreq/mediatek-cpufreq-hw.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/cpufreq/mediatek-cpufreq-hw.c b/drivers/cpufreq/mediatek-cpufreq-hw.c
index f0e0a35c7f21..83ba87545ee7 100644
--- a/drivers/cpufreq/mediatek-cpufreq-hw.c
+++ b/drivers/cpufreq/mediatek-cpufreq-hw.c
@@ -50,6 +50,15 @@ static const u16 cpufreq_mtk_offsets[REG_ARRAY_SIZE] = {
[REG_FREQ_LATENCY] = 0x110,
};

+static const u16 cpufreq_mt8188_offsets[REG_ARRAY_SIZE] = {
+ [REG_FREQ_LUT_TABLE] = 0x0,
+ [REG_FREQ_ENABLE] = 0x84,
+ [REG_FREQ_PERF_STATE] = 0x88,
+ [REG_FREQ_HW_STATE] = 0x8c,
+ [REG_EM_POWER_TBL] = 0x90,
+ [REG_FREQ_LATENCY] = 0x114,
+};
+
static int __maybe_unused
mtk_cpufreq_get_cpu_power(struct device *cpu_dev, unsigned long *uW,
unsigned long *KHz)
@@ -318,6 +327,7 @@ static int mtk_cpufreq_hw_driver_remove(struct platform_device *pdev)

static const struct of_device_id mtk_cpufreq_hw_match[] = {
{ .compatible = "mediatek,cpufreq-hw", .data = &cpufreq_mtk_offsets },
+ { .compatible = "mediatek,mt8188-cpufreq-hw", .data = &cpufreq_mt8188_offsets },
{}
};