diff options
| -rw-r--r-- | drivers/cpufreq/Kconfig.arm | 4 | ||||
| -rw-r--r-- | drivers/cpufreq/tegra124-cpufreq.c | 41 |
2 files changed, 4 insertions, 41 deletions
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 688f10227793..1a6778e81f90 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
| @@ -272,8 +272,8 @@ config ARM_TEGRA20_CPUFREQ | |||
| 272 | This adds the CPUFreq driver support for Tegra20 SOCs. | 272 | This adds the CPUFreq driver support for Tegra20 SOCs. |
| 273 | 273 | ||
| 274 | config ARM_TEGRA124_CPUFREQ | 274 | config ARM_TEGRA124_CPUFREQ |
| 275 | tristate "Tegra124 CPUFreq support" | 275 | bool "Tegra124 CPUFreq support" |
| 276 | depends on ARCH_TEGRA && CPUFREQ_DT && REGULATOR | 276 | depends on ARCH_TEGRA && CPUFREQ_DT |
| 277 | default y | 277 | default y |
| 278 | help | 278 | help |
| 279 | This adds the CPUFreq driver support for Tegra124 SOCs. | 279 | This adds the CPUFreq driver support for Tegra124 SOCs. |
diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c index 43530254201a..a1bfde0a7950 100644 --- a/drivers/cpufreq/tegra124-cpufreq.c +++ b/drivers/cpufreq/tegra124-cpufreq.c | |||
| @@ -22,11 +22,9 @@ | |||
| 22 | #include <linux/of.h> | 22 | #include <linux/of.h> |
| 23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
| 24 | #include <linux/pm_opp.h> | 24 | #include <linux/pm_opp.h> |
| 25 | #include <linux/regulator/consumer.h> | ||
| 26 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| 27 | 26 | ||
| 28 | struct tegra124_cpufreq_priv { | 27 | struct tegra124_cpufreq_priv { |
| 29 | struct regulator *vdd_cpu_reg; | ||
| 30 | struct clk *cpu_clk; | 28 | struct clk *cpu_clk; |
| 31 | struct clk *pllp_clk; | 29 | struct clk *pllp_clk; |
| 32 | struct clk *pllx_clk; | 30 | struct clk *pllx_clk; |
| @@ -60,14 +58,6 @@ out: | |||
| 60 | return ret; | 58 | return ret; |
| 61 | } | 59 | } |
| 62 | 60 | ||
| 63 | static void tegra124_cpu_switch_to_pllx(struct tegra124_cpufreq_priv *priv) | ||
| 64 | { | ||
| 65 | clk_set_parent(priv->cpu_clk, priv->pllp_clk); | ||
| 66 | clk_disable_unprepare(priv->dfll_clk); | ||
| 67 | regulator_sync_voltage(priv->vdd_cpu_reg); | ||
| 68 | clk_set_parent(priv->cpu_clk, priv->pllx_clk); | ||
| 69 | } | ||
| 70 | |||
| 71 | static int tegra124_cpufreq_probe(struct platform_device *pdev) | 61 | static int tegra124_cpufreq_probe(struct platform_device *pdev) |
| 72 | { | 62 | { |
| 73 | struct tegra124_cpufreq_priv *priv; | 63 | struct tegra124_cpufreq_priv *priv; |
| @@ -88,16 +78,10 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev) | |||
| 88 | if (!np) | 78 | if (!np) |
| 89 | return -ENODEV; | 79 | return -ENODEV; |
| 90 | 80 | ||
| 91 | priv->vdd_cpu_reg = regulator_get(cpu_dev, "vdd-cpu"); | ||
| 92 | if (IS_ERR(priv->vdd_cpu_reg)) { | ||
| 93 | ret = PTR_ERR(priv->vdd_cpu_reg); | ||
| 94 | goto out_put_np; | ||
| 95 | } | ||
| 96 | |||
| 97 | priv->cpu_clk = of_clk_get_by_name(np, "cpu_g"); | 81 | priv->cpu_clk = of_clk_get_by_name(np, "cpu_g"); |
| 98 | if (IS_ERR(priv->cpu_clk)) { | 82 | if (IS_ERR(priv->cpu_clk)) { |
| 99 | ret = PTR_ERR(priv->cpu_clk); | 83 | ret = PTR_ERR(priv->cpu_clk); |
| 100 | goto out_put_vdd_cpu_reg; | 84 | goto out_put_np; |
| 101 | } | 85 | } |
| 102 | 86 | ||
| 103 | priv->dfll_clk = of_clk_get_by_name(np, "dfll"); | 87 | priv->dfll_clk = of_clk_get_by_name(np, "dfll"); |
| @@ -129,15 +113,13 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev) | |||
| 129 | platform_device_register_full(&cpufreq_dt_devinfo); | 113 | platform_device_register_full(&cpufreq_dt_devinfo); |
| 130 | if (IS_ERR(priv->cpufreq_dt_pdev)) { | 114 | if (IS_ERR(priv->cpufreq_dt_pdev)) { |
| 131 | ret = PTR_ERR(priv->cpufreq_dt_pdev); | 115 | ret = PTR_ERR(priv->cpufreq_dt_pdev); |
| 132 | goto out_switch_to_pllx; | 116 | goto out_put_pllp_clk; |
| 133 | } | 117 | } |
| 134 | 118 | ||
| 135 | platform_set_drvdata(pdev, priv); | 119 | platform_set_drvdata(pdev, priv); |
| 136 | 120 | ||
| 137 | return 0; | 121 | return 0; |
| 138 | 122 | ||
| 139 | out_switch_to_pllx: | ||
| 140 | tegra124_cpu_switch_to_pllx(priv); | ||
| 141 | out_put_pllp_clk: | 123 | out_put_pllp_clk: |
| 142 | clk_put(priv->pllp_clk); | 124 | clk_put(priv->pllp_clk); |
| 143 | out_put_pllx_clk: | 125 | out_put_pllx_clk: |
| @@ -146,34 +128,15 @@ out_put_dfll_clk: | |||
| 146 | clk_put(priv->dfll_clk); | 128 | clk_put(priv->dfll_clk); |
| 147 | out_put_cpu_clk: | 129 | out_put_cpu_clk: |
| 148 | clk_put(priv->cpu_clk); | 130 | clk_put(priv->cpu_clk); |
| 149 | out_put_vdd_cpu_reg: | ||
| 150 | regulator_put(priv->vdd_cpu_reg); | ||
| 151 | out_put_np: | 131 | out_put_np: |
| 152 | of_node_put(np); | 132 | of_node_put(np); |
| 153 | 133 | ||
| 154 | return ret; | 134 | return ret; |
| 155 | } | 135 | } |
| 156 | 136 | ||
| 157 | static int tegra124_cpufreq_remove(struct platform_device *pdev) | ||
| 158 | { | ||
| 159 | struct tegra124_cpufreq_priv *priv = platform_get_drvdata(pdev); | ||
| 160 | |||
| 161 | platform_device_unregister(priv->cpufreq_dt_pdev); | ||
| 162 | tegra124_cpu_switch_to_pllx(priv); | ||
| 163 | |||
| 164 | clk_put(priv->pllp_clk); | ||
| 165 | clk_put(priv->pllx_clk); | ||
| 166 | clk_put(priv->dfll_clk); | ||
| 167 | clk_put(priv->cpu_clk); | ||
| 168 | regulator_put(priv->vdd_cpu_reg); | ||
| 169 | |||
| 170 | return 0; | ||
| 171 | } | ||
| 172 | |||
| 173 | static struct platform_driver tegra124_cpufreq_platdrv = { | 137 | static struct platform_driver tegra124_cpufreq_platdrv = { |
| 174 | .driver.name = "cpufreq-tegra124", | 138 | .driver.name = "cpufreq-tegra124", |
| 175 | .probe = tegra124_cpufreq_probe, | 139 | .probe = tegra124_cpufreq_probe, |
| 176 | .remove = tegra124_cpufreq_remove, | ||
| 177 | }; | 140 | }; |
| 178 | 141 | ||
| 179 | static int __init tegra_cpufreq_init(void) | 142 | static int __init tegra_cpufreq_init(void) |
