]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/panfrost: Enable devfreq to work without regulator
authorSteven Price <steven.price@arm.com>
Fri, 16 Aug 2019 09:31:05 +0000 (10:31 +0100)
committerRob Herring <robh@kernel.org>
Mon, 19 Aug 2019 16:37:02 +0000 (11:37 -0500)
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: Steven Price <steven.price@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190816093107.30518-1-steven.price@arm.com
drivers/gpu/drm/panfrost/panfrost_devfreq.c

index a7c18bceb7fd423329261455ffc75c21df61327c..77e1ad24de539ab0b7dc87ede7e1a837a1fbed9a 100644 (file)
@@ -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 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,
                                            target_volt);
                if (err) {
@@ -58,7 +58,7 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq,
                return err;
        }
 
-       if (old_clk_rate > target_rate) {
+       if (old_clk_rate > target_rate && pfdev->regulator) {
                err = regulator_set_voltage(pfdev->regulator, target_volt,
                                            target_volt);
                if (err)
@@ -136,9 +136,6 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
        int ret;
        struct dev_pm_opp *opp;
 
-       if (!pfdev->regulator)
-               return 0;
-
        ret = dev_pm_opp_of_add_table(&pfdev->pdev->dev);
        if (ret == -ENODEV) /* Optional, continue without devfreq */
                return 0;