MALI: utgard: support sharing regulator with other devices

If the regulator is shared between several devices then the lowest
request voltage that meets the system constraints will be used.

Change-Id: I68536a8e9cc5a78c21b55564a2ed540b9c184cb8
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
Finley Xiao
2017-09-07 12:40:56 +08:00
committed by Huang, Tao
parent 002c83bd47
commit 21d227bdc2

View File

@@ -67,7 +67,7 @@ mali_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)
#ifdef CONFIG_REGULATOR
if (mdev->current_voltage == voltage)
return 0;
err = regulator_set_voltage(mdev->regulator, voltage, voltage);
err = regulator_set_voltage(mdev->regulator, voltage, INT_MAX);
if (err) {
dev_err(dev, "Failed to set voltage (%d)\n", err);
return err;
@@ -80,7 +80,7 @@ mali_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)
#ifdef CONFIG_REGULATOR
if (mdev->regulator && mdev->current_voltage != voltage &&
old_freq < freq) {
err = regulator_set_voltage(mdev->regulator, voltage, voltage);
err = regulator_set_voltage(mdev->regulator, voltage, INT_MAX);
if (err) {
MALI_PRINT_ERROR(("Failed to increase voltage (%d)\n", err));
return err;
@@ -99,7 +99,7 @@ mali_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)
#ifdef CONFIG_REGULATOR
if (mdev->regulator && mdev->current_voltage != voltage &&
old_freq > freq) {
err = regulator_set_voltage(mdev->regulator, voltage, voltage);
err = regulator_set_voltage(mdev->regulator, voltage, INT_MAX);
if (err) {
MALI_PRINT_ERROR(("Failed to decrease voltage (%d)\n", err));
return err;