From e3e12f52b214121840b44c91de5b3e5af5d3eb84 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 06 Nov 2023 03:04:41 +0000
Subject: [PATCH] rk3568 rt init

---
 kernel/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/kernel/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c b/kernel/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c
index 260c2a8..6023495 100644
--- a/kernel/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c
+++ b/kernel/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c
@@ -12,6 +12,7 @@
 #include "mali_kernel_common.h"
 
 #include <linux/clk.h>
+#include <linux/clk-provider.h>
 #include <linux/devfreq.h>
 #include <linux/regulator/consumer.h>
 #include <linux/regulator/driver.h>
@@ -87,13 +88,17 @@
 		return 0;
 	}
 
+	err = clk_bulk_enable(mdev->num_clks, mdev->clks);
+	if (err)
+		return err;
+
 #ifdef CONFIG_REGULATOR
 	if (mdev->regulator && mdev->current_voltage != voltage &&
 	    old_freq < freq) {
 		err = regulator_set_voltage(mdev->regulator, voltage, INT_MAX);
 		if (err) {
 			MALI_PRINT_ERROR(("Failed to increase voltage (%d)\n", err));
-			return err;
+			goto err;
 		}
 	}
 #endif
@@ -101,8 +106,9 @@
 	err = clk_set_rate(mdev->clock, freq);
 	if (err) {
 		MALI_PRINT_ERROR(("Failed to set clock %lu (target %lu)\n", freq, *target_freq));
-		return err;
+		goto err;
 	}
+
 	*target_freq = freq;
 	mdev->current_freq = freq;
 	if (mdev->devfreq)
@@ -114,7 +120,7 @@
 		err = regulator_set_voltage(mdev->regulator, voltage, INT_MAX);
 		if (err) {
 			MALI_PRINT_ERROR(("Failed to decrease voltage (%d)\n", err));
-			return err;
+			goto err;
 		}
 	}
 #endif
@@ -122,6 +128,8 @@
 	mdev->current_voltage = voltage;
 
 	mali_pm_reset_dvfs_utilisation(mdev);
+err:
+	clk_bulk_disable(mdev->num_clks, mdev->clks);
 
 	return err;
 }

--
Gitblit v1.6.2