hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/gpu/arm/mali400/mali/linux/mali_devfreq.c
....@@ -12,6 +12,7 @@
1212 #include "mali_kernel_common.h"
1313
1414 #include <linux/clk.h>
15
+#include <linux/clk-provider.h>
1516 #include <linux/devfreq.h>
1617 #include <linux/regulator/consumer.h>
1718 #include <linux/regulator/driver.h>
....@@ -87,13 +88,17 @@
8788 return 0;
8889 }
8990
91
+ err = clk_bulk_enable(mdev->num_clks, mdev->clks);
92
+ if (err)
93
+ return err;
94
+
9095 #ifdef CONFIG_REGULATOR
9196 if (mdev->regulator && mdev->current_voltage != voltage &&
9297 old_freq < freq) {
9398 err = regulator_set_voltage(mdev->regulator, voltage, INT_MAX);
9499 if (err) {
95100 MALI_PRINT_ERROR(("Failed to increase voltage (%d)\n", err));
96
- return err;
101
+ goto err;
97102 }
98103 }
99104 #endif
....@@ -101,8 +106,9 @@
101106 err = clk_set_rate(mdev->clock, freq);
102107 if (err) {
103108 MALI_PRINT_ERROR(("Failed to set clock %lu (target %lu)\n", freq, *target_freq));
104
- return err;
109
+ goto err;
105110 }
111
+
106112 *target_freq = freq;
107113 mdev->current_freq = freq;
108114 if (mdev->devfreq)
....@@ -114,7 +120,7 @@
114120 err = regulator_set_voltage(mdev->regulator, voltage, INT_MAX);
115121 if (err) {
116122 MALI_PRINT_ERROR(("Failed to decrease voltage (%d)\n", err));
117
- return err;
123
+ goto err;
118124 }
119125 }
120126 #endif
....@@ -122,6 +128,8 @@
122128 mdev->current_voltage = voltage;
123129
124130 mali_pm_reset_dvfs_utilisation(mdev);
131
+err:
132
+ clk_bulk_disable(mdev->num_clks, mdev->clks);
125133
126134 return err;
127135 }