mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
MALI: rockchip: Ensure that set voltage when update devfreq for the first time
Sometimes the regulator is shared between several devices, if target rate and target voltage are equal to initial rate and iniital voltage , the min_uV and max_uV of regulator will be always equal to zero, other devices may set a low voltage. Change-Id: Ibf82f335ce0739776286e3733be5415f84bf035b Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
@@ -349,11 +349,6 @@ int kbase_devfreq_init(struct kbase_device *kbdev)
|
||||
|
||||
kbdev->current_freq = clk_get_rate(kbdev->clock);
|
||||
kbdev->current_nominal_freq = kbdev->current_freq;
|
||||
#ifdef CONFIG_REGULATOR
|
||||
if (kbdev->regulator)
|
||||
kbdev->current_voltage =
|
||||
regulator_get_voltage(kbdev->regulator);
|
||||
#endif
|
||||
|
||||
dp = &kbdev->devfreq_profile;
|
||||
|
||||
|
||||
@@ -329,11 +329,6 @@ int kbase_devfreq_init(struct kbase_device *kbdev)
|
||||
|
||||
kbdev->current_freq = clk_get_rate(kbdev->clock);
|
||||
kbdev->current_nominal_freq = kbdev->current_freq;
|
||||
#ifdef CONFIG_REGULATOR
|
||||
if (kbdev->regulator)
|
||||
kbdev->current_voltage =
|
||||
regulator_get_voltage(kbdev->regulator);
|
||||
#endif
|
||||
|
||||
dp = &kbdev->devfreq_profile;
|
||||
|
||||
|
||||
@@ -237,8 +237,6 @@ int mali_devfreq_init(struct mali_device *mdev)
|
||||
return -ENODEV;
|
||||
|
||||
mdev->current_freq = clk_get_rate(mdev->clock);
|
||||
if (mdev->regulator)
|
||||
mdev->current_voltage = regulator_get_voltage(mdev->regulator);
|
||||
|
||||
dp = &mdev->devfreq_profile;
|
||||
|
||||
|
||||
@@ -108,6 +108,16 @@ kbase_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)
|
||||
*/
|
||||
if (kbdev->current_nominal_freq == nominal_freq) {
|
||||
*target_freq = nominal_freq;
|
||||
#ifdef CONFIG_REGULATOR
|
||||
if (kbdev->current_voltage == voltage)
|
||||
return 0;
|
||||
err = regulator_set_voltage(kbdev->regulator, voltage, INT_MAX);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to set voltage (%d)\n", err);
|
||||
return err;
|
||||
}
|
||||
kbdev->current_voltage = voltage;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,16 @@ kbase_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)
|
||||
*/
|
||||
if (kbdev->current_freq == freq) {
|
||||
*target_freq = freq;
|
||||
#ifdef CONFIG_REGULATOR
|
||||
if (kbdev->current_voltage == voltage)
|
||||
return 0;
|
||||
err = regulator_set_voltage(kbdev->regulator, voltage, INT_MAX);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to set voltage (%d)\n", err);
|
||||
return err;
|
||||
}
|
||||
kbdev->current_voltage = voltage;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user