| .. | .. |
|---|
| 12 | 12 | #include "mali_kernel_common.h" |
|---|
| 13 | 13 | |
|---|
| 14 | 14 | #include <linux/clk.h> |
|---|
| 15 | +#include <linux/clk-provider.h> |
|---|
| 15 | 16 | #include <linux/devfreq.h> |
|---|
| 16 | 17 | #include <linux/regulator/consumer.h> |
|---|
| 17 | 18 | #include <linux/regulator/driver.h> |
|---|
| .. | .. |
|---|
| 87 | 88 | return 0; |
|---|
| 88 | 89 | } |
|---|
| 89 | 90 | |
|---|
| 91 | + err = clk_bulk_enable(mdev->num_clks, mdev->clks); |
|---|
| 92 | + if (err) |
|---|
| 93 | + return err; |
|---|
| 94 | + |
|---|
| 90 | 95 | #ifdef CONFIG_REGULATOR |
|---|
| 91 | 96 | if (mdev->regulator && mdev->current_voltage != voltage && |
|---|
| 92 | 97 | old_freq < freq) { |
|---|
| 93 | 98 | err = regulator_set_voltage(mdev->regulator, voltage, INT_MAX); |
|---|
| 94 | 99 | if (err) { |
|---|
| 95 | 100 | MALI_PRINT_ERROR(("Failed to increase voltage (%d)\n", err)); |
|---|
| 96 | | - return err; |
|---|
| 101 | + goto err; |
|---|
| 97 | 102 | } |
|---|
| 98 | 103 | } |
|---|
| 99 | 104 | #endif |
|---|
| .. | .. |
|---|
| 101 | 106 | err = clk_set_rate(mdev->clock, freq); |
|---|
| 102 | 107 | if (err) { |
|---|
| 103 | 108 | MALI_PRINT_ERROR(("Failed to set clock %lu (target %lu)\n", freq, *target_freq)); |
|---|
| 104 | | - return err; |
|---|
| 109 | + goto err; |
|---|
| 105 | 110 | } |
|---|
| 111 | + |
|---|
| 106 | 112 | *target_freq = freq; |
|---|
| 107 | 113 | mdev->current_freq = freq; |
|---|
| 108 | 114 | if (mdev->devfreq) |
|---|
| .. | .. |
|---|
| 114 | 120 | err = regulator_set_voltage(mdev->regulator, voltage, INT_MAX); |
|---|
| 115 | 121 | if (err) { |
|---|
| 116 | 122 | MALI_PRINT_ERROR(("Failed to decrease voltage (%d)\n", err)); |
|---|
| 117 | | - return err; |
|---|
| 123 | + goto err; |
|---|
| 118 | 124 | } |
|---|
| 119 | 125 | } |
|---|
| 120 | 126 | #endif |
|---|
| .. | .. |
|---|
| 122 | 128 | mdev->current_voltage = voltage; |
|---|
| 123 | 129 | |
|---|
| 124 | 130 | mali_pm_reset_dvfs_utilisation(mdev); |
|---|
| 131 | +err: |
|---|
| 132 | + clk_bulk_disable(mdev->num_clks, mdev->clks); |
|---|
| 125 | 133 | |
|---|
| 126 | 134 | return err; |
|---|
| 127 | 135 | } |
|---|