MALI: midgard: 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: I7dda43b24c7e19098db65b51ae0c4386b46ee0b7
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
Finley Xiao
2016-11-28 19:40:09 +08:00
parent b8a2dcfd13
commit 85b4e1dffa

View File

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