| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * cpufreq driver for the cell processor |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007 |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Christian Krafft <krafft@de.ibm.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2, or (at your option) |
|---|
| 11 | | - * any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; if not, write to the Free Software |
|---|
| 20 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 21 | 8 | */ |
|---|
| 22 | 9 | |
|---|
| 23 | 10 | #include <linux/cpufreq.h> |
|---|
| .. | .. |
|---|
| 123 | 110 | #endif |
|---|
| 124 | 111 | |
|---|
| 125 | 112 | policy->freq_table = cbe_freqs; |
|---|
| 113 | + cbe_cpufreq_pmi_policy_init(policy); |
|---|
| 114 | + return 0; |
|---|
| 115 | +} |
|---|
| 116 | + |
|---|
| 117 | +static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) |
|---|
| 118 | +{ |
|---|
| 119 | + cbe_cpufreq_pmi_policy_exit(policy); |
|---|
| 126 | 120 | return 0; |
|---|
| 127 | 121 | } |
|---|
| 128 | 122 | |
|---|
| .. | .. |
|---|
| 142 | 136 | .verify = cpufreq_generic_frequency_table_verify, |
|---|
| 143 | 137 | .target_index = cbe_cpufreq_target, |
|---|
| 144 | 138 | .init = cbe_cpufreq_cpu_init, |
|---|
| 139 | + .exit = cbe_cpufreq_cpu_exit, |
|---|
| 145 | 140 | .name = "cbe-cpufreq", |
|---|
| 146 | 141 | .flags = CPUFREQ_CONST_LOOPS, |
|---|
| 147 | 142 | }; |
|---|
| .. | .. |
|---|
| 152 | 147 | |
|---|
| 153 | 148 | static int __init cbe_cpufreq_init(void) |
|---|
| 154 | 149 | { |
|---|
| 150 | + int ret; |
|---|
| 151 | + |
|---|
| 155 | 152 | if (!machine_is(cell)) |
|---|
| 156 | 153 | return -ENODEV; |
|---|
| 157 | 154 | |
|---|
| 158 | | - return cpufreq_register_driver(&cbe_cpufreq_driver); |
|---|
| 155 | + cbe_cpufreq_pmi_init(); |
|---|
| 156 | + |
|---|
| 157 | + ret = cpufreq_register_driver(&cbe_cpufreq_driver); |
|---|
| 158 | + if (ret) |
|---|
| 159 | + cbe_cpufreq_pmi_exit(); |
|---|
| 160 | + |
|---|
| 161 | + return ret; |
|---|
| 159 | 162 | } |
|---|
| 160 | 163 | |
|---|
| 161 | 164 | static void __exit cbe_cpufreq_exit(void) |
|---|
| 162 | 165 | { |
|---|
| 163 | 166 | cpufreq_unregister_driver(&cbe_cpufreq_driver); |
|---|
| 167 | + cbe_cpufreq_pmi_exit(); |
|---|
| 164 | 168 | } |
|---|
| 165 | 169 | |
|---|
| 166 | 170 | module_init(cbe_cpufreq_init); |
|---|