Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 Google, Inc. |
Stephen Boyd | 3bbf346 | 2012-01-12 00:19:23 -0800 | [diff] [blame] | 3 | * Copyright (c) 2007-2012, Code Aurora Forum. All rights reserved. |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/ctype.h> |
| 19 | #include <linux/debugfs.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | #include <linux/seq_file.h> |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 21 | #include <linux/clk.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 22 | #include <linux/list.h> |
| 23 | #include <linux/clkdev.h> |
| 24 | |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 25 | #include "clock.h" |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 26 | |
| 27 | static int clock_debug_rate_set(void *data, u64 val) |
| 28 | { |
| 29 | struct clk *clock = data; |
| 30 | int ret; |
| 31 | |
| 32 | /* Only increases to max rate will succeed, but that's actually good |
| 33 | * for debugging purposes so we don't check for error. */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 34 | if (clock->flags & CLKFLAG_MAX) |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 35 | clk_set_max_rate(clock, val); |
Matt Wagantall | 8e6126f | 2011-11-08 13:34:19 -0800 | [diff] [blame] | 36 | ret = clk_set_rate(clock, val); |
| 37 | if (ret) |
Stephen Boyd | 753ab93 | 2012-08-02 13:14:38 -0700 | [diff] [blame] | 38 | pr_err("clk_set_rate(%s, %lu) failed (%d)\n", clock->dbg_name, |
| 39 | (unsigned long)val, ret); |
Matt Wagantall | 8e6126f | 2011-11-08 13:34:19 -0800 | [diff] [blame] | 40 | |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 41 | return ret; |
| 42 | } |
| 43 | |
| 44 | static int clock_debug_rate_get(void *data, u64 *val) |
| 45 | { |
| 46 | struct clk *clock = data; |
| 47 | *val = clk_get_rate(clock); |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_debug_rate_get, |
| 52 | clock_debug_rate_set, "%llu\n"); |
| 53 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 54 | static struct clk *measure; |
| 55 | |
| 56 | static int clock_debug_measure_get(void *data, u64 *val) |
| 57 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 58 | struct clk *clock = data; |
Stephen Boyd | a52d7e3 | 2011-11-10 11:59:00 -0800 | [diff] [blame] | 59 | int ret, is_hw_gated; |
| 60 | |
| 61 | /* Check to see if the clock is in hardware gating mode */ |
Stephen Boyd | 0f7e564 | 2012-08-02 12:59:33 -0700 | [diff] [blame] | 62 | if (clock->ops->in_hwcg_mode) |
Stephen Boyd | a52d7e3 | 2011-11-10 11:59:00 -0800 | [diff] [blame] | 63 | is_hw_gated = clock->ops->in_hwcg_mode(clock); |
| 64 | else |
| 65 | is_hw_gated = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 66 | |
| 67 | ret = clk_set_parent(measure, clock); |
Stephen Boyd | a52d7e3 | 2011-11-10 11:59:00 -0800 | [diff] [blame] | 68 | if (!ret) { |
| 69 | /* |
| 70 | * Disable hw gating to get accurate rate measurements. Only do |
| 71 | * this if the clock is explictly enabled by software. This |
| 72 | * allows us to detect errors where clocks are on even though |
| 73 | * software is not requesting them to be on due to broken |
| 74 | * hardware gating signals. |
| 75 | */ |
| 76 | if (is_hw_gated && clock->count) |
| 77 | clock->ops->disable_hwcg(clock); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 78 | *val = clk_get_rate(measure); |
Stephen Boyd | a52d7e3 | 2011-11-10 11:59:00 -0800 | [diff] [blame] | 79 | /* Reenable hwgating if it was disabled */ |
| 80 | if (is_hw_gated && clock->count) |
| 81 | clock->ops->enable_hwcg(clock); |
| 82 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 83 | |
| 84 | return ret; |
| 85 | } |
| 86 | |
| 87 | DEFINE_SIMPLE_ATTRIBUTE(clock_measure_fops, clock_debug_measure_get, |
| 88 | NULL, "%lld\n"); |
| 89 | |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 90 | static int clock_debug_enable_set(void *data, u64 val) |
| 91 | { |
| 92 | struct clk *clock = data; |
| 93 | int rc = 0; |
| 94 | |
| 95 | if (val) |
Stephen Boyd | 3bbf346 | 2012-01-12 00:19:23 -0800 | [diff] [blame] | 96 | rc = clk_prepare_enable(clock); |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 97 | else |
Stephen Boyd | 3bbf346 | 2012-01-12 00:19:23 -0800 | [diff] [blame] | 98 | clk_disable_unprepare(clock); |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 99 | |
| 100 | return rc; |
| 101 | } |
| 102 | |
| 103 | static int clock_debug_enable_get(void *data, u64 *val) |
| 104 | { |
| 105 | struct clk *clock = data; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 106 | int enabled; |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 107 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 108 | if (clock->ops->is_enabled) |
| 109 | enabled = clock->ops->is_enabled(clock); |
| 110 | else |
| 111 | enabled = !!(clock->count); |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 112 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 113 | *val = enabled; |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | DEFINE_SIMPLE_ATTRIBUTE(clock_enable_fops, clock_debug_enable_get, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 118 | clock_debug_enable_set, "%lld\n"); |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 119 | |
| 120 | static int clock_debug_local_get(void *data, u64 *val) |
| 121 | { |
| 122 | struct clk *clock = data; |
| 123 | |
Matt Wagantall | acb8d02 | 2012-02-14 15:28:23 -0800 | [diff] [blame] | 124 | if (!clock->ops->is_local) |
| 125 | *val = true; |
| 126 | else |
| 127 | *val = clock->ops->is_local(clock); |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 128 | |
| 129 | return 0; |
| 130 | } |
| 131 | |
| 132 | DEFINE_SIMPLE_ATTRIBUTE(clock_local_fops, clock_debug_local_get, |
| 133 | NULL, "%llu\n"); |
| 134 | |
Stephen Boyd | a52d7e3 | 2011-11-10 11:59:00 -0800 | [diff] [blame] | 135 | static int clock_debug_hwcg_get(void *data, u64 *val) |
| 136 | { |
| 137 | struct clk *clock = data; |
Stephen Boyd | 0f7e564 | 2012-08-02 12:59:33 -0700 | [diff] [blame] | 138 | if (clock->ops->in_hwcg_mode) |
| 139 | *val = !!clock->ops->in_hwcg_mode(clock); |
| 140 | else |
| 141 | *val = 0; |
Stephen Boyd | a52d7e3 | 2011-11-10 11:59:00 -0800 | [diff] [blame] | 142 | return 0; |
| 143 | } |
| 144 | |
| 145 | DEFINE_SIMPLE_ATTRIBUTE(clock_hwcg_fops, clock_debug_hwcg_get, |
| 146 | NULL, "%llu\n"); |
| 147 | |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 148 | static int fmax_rates_show(struct seq_file *m, void *unused) |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 149 | { |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 150 | struct clk *clock = m->private; |
| 151 | int level = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 152 | |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 153 | int vdd_level = find_vdd_level(clock, clock->rate); |
| 154 | if (vdd_level < 0) { |
| 155 | seq_printf(m, "could not find_vdd_level for %s, %ld\n", |
| 156 | clock->dbg_name, clock->rate); |
| 157 | return 0; |
| 158 | } |
| 159 | for (level = 0; level < ARRAY_SIZE(clock->fmax); level++) { |
| 160 | if (vdd_level == level) |
| 161 | seq_printf(m, "[%lu] ", clock->fmax[level]); |
| 162 | else |
| 163 | seq_printf(m, "%lu ", clock->fmax[level]); |
| 164 | } |
| 165 | seq_printf(m, "\n"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 166 | |
Stephen Boyd | 31c01e8 | 2012-04-13 15:22:00 -0700 | [diff] [blame] | 167 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 168 | } |
| 169 | |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 170 | static int fmax_rates_open(struct inode *inode, struct file *file) |
Stephen Boyd | cd50fae | 2011-11-03 11:05:42 -0700 | [diff] [blame] | 171 | { |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 172 | return single_open(file, fmax_rates_show, inode->i_private); |
Stephen Boyd | cd50fae | 2011-11-03 11:05:42 -0700 | [diff] [blame] | 173 | } |
| 174 | |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 175 | static const struct file_operations fmax_rates_fops = { |
| 176 | .open = fmax_rates_open, |
| 177 | .read = seq_read, |
| 178 | .llseek = seq_lseek, |
| 179 | .release = seq_release, |
| 180 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 181 | |
| 182 | static int list_rates_show(struct seq_file *m, void *unused) |
| 183 | { |
| 184 | struct clk *clock = m->private; |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 185 | int rate, level, fmax = 0, i = 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 186 | |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 187 | /* Find max frequency supported within voltage constraints. */ |
| 188 | if (!clock->vdd_class) { |
Matt Wagantall | e426f904 | 2011-11-01 16:21:34 -0700 | [diff] [blame] | 189 | fmax = INT_MAX; |
Matt Wagantall | e18bbc8 | 2011-10-06 10:07:28 -0700 | [diff] [blame] | 190 | } else { |
| 191 | for (level = 0; level < ARRAY_SIZE(clock->fmax); level++) |
| 192 | if (clock->fmax[level]) |
| 193 | fmax = clock->fmax[level]; |
| 194 | } |
| 195 | |
| 196 | /* |
| 197 | * List supported frequencies <= fmax. Higher frequencies may appear in |
| 198 | * the frequency table, but are not valid and should not be listed. |
| 199 | */ |
| 200 | while ((rate = clock->ops->list_rate(clock, i++)) >= 0) { |
| 201 | if (rate <= fmax) |
| 202 | seq_printf(m, "%u\n", rate); |
| 203 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 204 | |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 205 | return 0; |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 206 | } |
| 207 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 208 | static int list_rates_open(struct inode *inode, struct file *file) |
| 209 | { |
| 210 | return single_open(file, list_rates_show, inode->i_private); |
| 211 | } |
| 212 | |
| 213 | static const struct file_operations list_rates_fops = { |
| 214 | .open = list_rates_open, |
| 215 | .read = seq_read, |
| 216 | .llseek = seq_lseek, |
| 217 | .release = seq_release, |
| 218 | }; |
| 219 | |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 220 | static struct dentry *debugfs_base; |
| 221 | static u32 debug_suspend; |
Patrick Daly | 0a78a0e | 2012-07-23 13:18:59 -0700 | [diff] [blame] | 222 | |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 223 | struct clk_table { |
| 224 | struct list_head node; |
| 225 | struct clk_lookup *clocks; |
| 226 | size_t num_clocks; |
Patrick Daly | 0a78a0e | 2012-07-23 13:18:59 -0700 | [diff] [blame] | 227 | }; |
| 228 | |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 229 | static int clock_debug_add(struct clk *clock) |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 230 | { |
| 231 | char temp[50], *ptr; |
Stephen Boyd | 6e6d9b5 | 2011-01-26 16:20:55 -0800 | [diff] [blame] | 232 | struct dentry *clk_dir; |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 233 | |
Stephen Boyd | 6e6d9b5 | 2011-01-26 16:20:55 -0800 | [diff] [blame] | 234 | if (!debugfs_base) |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 235 | return -ENOMEM; |
| 236 | |
Saravana Kannan | 7f62698 | 2011-09-26 19:02:02 -0700 | [diff] [blame] | 237 | strlcpy(temp, clock->dbg_name, ARRAY_SIZE(temp)); |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 238 | for (ptr = temp; *ptr; ptr++) |
| 239 | *ptr = tolower(*ptr); |
| 240 | |
Stephen Boyd | 6e6d9b5 | 2011-01-26 16:20:55 -0800 | [diff] [blame] | 241 | clk_dir = debugfs_create_dir(temp, debugfs_base); |
| 242 | if (!clk_dir) |
| 243 | return -ENOMEM; |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 244 | |
Stephen Boyd | 6e6d9b5 | 2011-01-26 16:20:55 -0800 | [diff] [blame] | 245 | if (!debugfs_create_file("rate", S_IRUGO | S_IWUSR, clk_dir, |
| 246 | clock, &clock_rate_fops)) |
| 247 | goto error; |
| 248 | |
| 249 | if (!debugfs_create_file("enable", S_IRUGO | S_IWUSR, clk_dir, |
| 250 | clock, &clock_enable_fops)) |
| 251 | goto error; |
| 252 | |
| 253 | if (!debugfs_create_file("is_local", S_IRUGO, clk_dir, clock, |
| 254 | &clock_local_fops)) |
| 255 | goto error; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 256 | |
Stephen Boyd | a52d7e3 | 2011-11-10 11:59:00 -0800 | [diff] [blame] | 257 | if (!debugfs_create_file("has_hw_gating", S_IRUGO, clk_dir, clock, |
| 258 | &clock_hwcg_fops)) |
| 259 | goto error; |
| 260 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 261 | if (measure && |
| 262 | !clk_set_parent(measure, clock) && |
| 263 | !debugfs_create_file("measure", S_IRUGO, clk_dir, clock, |
| 264 | &clock_measure_fops)) |
| 265 | goto error; |
| 266 | |
| 267 | if (clock->ops->list_rate) |
| 268 | if (!debugfs_create_file("list_rates", |
| 269 | S_IRUGO, clk_dir, clock, &list_rates_fops)) |
| 270 | goto error; |
| 271 | |
Patrick Daly | 0a78a0e | 2012-07-23 13:18:59 -0700 | [diff] [blame] | 272 | if (clock->vdd_class && !debugfs_create_file("fmax_rates", |
| 273 | S_IRUGO, clk_dir, clock, &fmax_rates_fops)) |
| 274 | goto error; |
| 275 | |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 276 | return 0; |
Stephen Boyd | 6e6d9b5 | 2011-01-26 16:20:55 -0800 | [diff] [blame] | 277 | error: |
| 278 | debugfs_remove_recursive(clk_dir); |
| 279 | return -ENOMEM; |
Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 280 | } |
Matt Wagantall | 665f0cf | 2012-02-27 15:54:43 -0800 | [diff] [blame^] | 281 | static LIST_HEAD(clk_list); |
| 282 | static DEFINE_SPINLOCK(clk_list_lock); |
| 283 | |
| 284 | /** |
| 285 | * clock_debug_register() - Add additional clocks to clock debugfs hierarchy |
| 286 | * @table: Table of clocks to create debugfs nodes for |
| 287 | * @size: Size of @table |
| 288 | * |
| 289 | * Use this function to register additional clocks in debugfs. The clock debugfs |
| 290 | * hierarchy must have already been initialized with clock_debug_init() prior to |
| 291 | * calling this function. Unlike clock_debug_init(), this may be called multiple |
| 292 | * times with different clock lists and can be used after the kernel has |
| 293 | * finished booting. |
| 294 | */ |
| 295 | int clock_debug_register(struct clk_lookup *table, size_t size) |
| 296 | { |
| 297 | struct clk_table *clk_table; |
| 298 | unsigned long flags; |
| 299 | int i; |
| 300 | |
| 301 | clk_table = kmalloc(sizeof(*clk_table), GFP_KERNEL); |
| 302 | if (!clk_table) |
| 303 | return -ENOMEM; |
| 304 | |
| 305 | clk_table->clocks = table; |
| 306 | clk_table->num_clocks = size; |
| 307 | |
| 308 | spin_lock_irqsave(&clk_list_lock, flags); |
| 309 | list_add_tail(&clk_table->node, &clk_list); |
| 310 | spin_unlock_irqrestore(&clk_list_lock, flags); |
| 311 | |
| 312 | for (i = 0; i < size; i++) |
| 313 | clock_debug_add(table[i].clk); |
| 314 | |
| 315 | return 0; |
| 316 | } |
| 317 | |
| 318 | /** |
| 319 | * clock_debug_init() - Initialize clock debugfs |
| 320 | */ |
| 321 | int __init clock_debug_init(void) |
| 322 | { |
| 323 | debugfs_base = debugfs_create_dir("clk", NULL); |
| 324 | if (!debugfs_base) |
| 325 | return -ENOMEM; |
| 326 | if (!debugfs_create_u32("debug_suspend", S_IRUGO | S_IWUSR, |
| 327 | debugfs_base, &debug_suspend)) { |
| 328 | debugfs_remove_recursive(debugfs_base); |
| 329 | return -ENOMEM; |
| 330 | } |
| 331 | |
| 332 | measure = clk_get_sys("debug", "measure"); |
| 333 | if (IS_ERR(measure)) |
| 334 | measure = NULL; |
| 335 | |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | static int clock_debug_print_clock(struct clk *c) |
| 340 | { |
| 341 | char *start = ""; |
| 342 | |
| 343 | if (!c || !c->prepare_count) |
| 344 | return 0; |
| 345 | |
| 346 | pr_info("\t"); |
| 347 | do { |
| 348 | if (c->vdd_class) |
| 349 | pr_cont("%s%s:%u:%u [%ld, %lu]", start, c->dbg_name, |
| 350 | c->prepare_count, c->count, c->rate, |
| 351 | c->vdd_class->cur_level); |
| 352 | else |
| 353 | pr_cont("%s%s:%u:%u [%ld]", start, c->dbg_name, |
| 354 | c->prepare_count, c->count, c->rate); |
| 355 | start = " -> "; |
| 356 | } while ((c = clk_get_parent(c))); |
| 357 | |
| 358 | pr_cont("\n"); |
| 359 | |
| 360 | return 1; |
| 361 | } |
| 362 | |
| 363 | /** |
| 364 | * clock_debug_print_enabled() - Print names of enabled clocks for suspend debug |
| 365 | * |
| 366 | * Print the names of enabled clocks and their parents if debug_suspend is set |
| 367 | */ |
| 368 | void clock_debug_print_enabled(void) |
| 369 | { |
| 370 | struct clk_table *table; |
| 371 | unsigned long flags; |
| 372 | int i, cnt = 0; |
| 373 | |
| 374 | if (likely(!debug_suspend)) |
| 375 | return; |
| 376 | |
| 377 | pr_info("Enabled clocks:\n"); |
| 378 | spin_lock_irqsave(&clk_list_lock, flags); |
| 379 | list_for_each_entry(table, &clk_list, node) { |
| 380 | for (i = 0; i < table->num_clocks; i++) |
| 381 | cnt += clock_debug_print_clock(table->clocks[i].clk); |
| 382 | } |
| 383 | spin_unlock_irqrestore(&clk_list_lock, flags); |
| 384 | |
| 385 | if (cnt) |
| 386 | pr_info("Enabled clock count: %d\n", cnt); |
| 387 | else |
| 388 | pr_info("No clocks enabled.\n"); |
| 389 | |
| 390 | } |