Skip to content

Commit 6e0e7a8

Browse files
finley1226rkhuangtao
authored andcommitted
MALI: bifrost: Avoid GPU voltage domain keeping the initial voltage
If there is only one opp whose frequency is equal to the initial value in opp table list, the GPU voltage domain will keep the initial voltage, it may be too large. Change-Id: If2ae1c876de185d810e05296b1b9e98855c3ef48 Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
1 parent 2fcb17d commit 6e0e7a8

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/gpu/arm/bifrost/backend/gpu/mali_kbase_devfreq.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ kbase_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)
103103
*/
104104
if (kbdev->current_nominal_freq == nominal_freq) {
105105
*target_freq = nominal_freq;
106+
#ifdef CONFIG_REGULATOR
107+
if (kbdev->current_voltage == voltage)
108+
return 0;
109+
err = regulator_set_voltage(kbdev->regulator, voltage, voltage);
110+
if (err) {
111+
dev_err(dev, "Failed to set voltage (%d)\n", err);
112+
return err;
113+
}
114+
kbdev->current_voltage = voltage;
115+
#endif
106116
return 0;
107117
}
108118

@@ -318,6 +328,11 @@ int kbase_devfreq_init(struct kbase_device *kbdev)
318328

319329
kbdev->current_freq = clk_get_rate(kbdev->clock);
320330
kbdev->current_nominal_freq = kbdev->current_freq;
331+
#ifdef CONFIG_REGULATOR
332+
if (kbdev->regulator)
333+
kbdev->current_voltage =
334+
regulator_get_voltage(kbdev->regulator);
335+
#endif
321336

322337
dp = &kbdev->devfreq_profile;
323338

0 commit comments

Comments
 (0)