Commit e21dd290 authored by Steven Price's avatar Steven Price Committed by Rob Herring

drm/panfrost: Enable devfreq to work without regulator

If there is no regulator defined for the GPU then still control the
frequency using the supplied clock.

Some boards have clock control but no (direct) control of the regulator.
For example the HiKey960 uses a mailbox protocol to a MCU to control
frequencies and doesn't directly control the voltage. This patch allows
frequency control of the GPU on this system.
Signed-off-by: default avatarSteven Price <steven.price@arm.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190816093107.30518-1-steven.price@arm.com
parent 7282f764
...@@ -39,7 +39,7 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, ...@@ -39,7 +39,7 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq,
* If frequency scaling from low to high, adjust voltage first. * If frequency scaling from low to high, adjust voltage first.
* If frequency scaling from high to low, adjust frequency first. * If frequency scaling from high to low, adjust frequency first.
*/ */
if (old_clk_rate < target_rate) { if (old_clk_rate < target_rate && pfdev->regulator) {
err = regulator_set_voltage(pfdev->regulator, target_volt, err = regulator_set_voltage(pfdev->regulator, target_volt,
target_volt); target_volt);
if (err) { if (err) {
...@@ -58,7 +58,7 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, ...@@ -58,7 +58,7 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq,
return err; return err;
} }
if (old_clk_rate > target_rate) { if (old_clk_rate > target_rate && pfdev->regulator) {
err = regulator_set_voltage(pfdev->regulator, target_volt, err = regulator_set_voltage(pfdev->regulator, target_volt,
target_volt); target_volt);
if (err) if (err)
...@@ -136,9 +136,6 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) ...@@ -136,9 +136,6 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
int ret; int ret;
struct dev_pm_opp *opp; struct dev_pm_opp *opp;
if (!pfdev->regulator)
return 0;
ret = dev_pm_opp_of_add_table(&pfdev->pdev->dev); ret = dev_pm_opp_of_add_table(&pfdev->pdev->dev);
if (ret == -ENODEV) /* Optional, continue without devfreq */ if (ret == -ENODEV) /* Optional, continue without devfreq */
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment