Amit Arora | ed3e565 | 2010-10-27 12:02:53 +0530 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (C) 2010, Linaro |
| 3 | * Copyright (C) 2010, IBM Corporation |
| 4 | * |
| 5 | * This file is part of PowerDebug. |
| 6 | * |
| 7 | * All rights reserved. This program and the accompanying materials |
| 8 | * are made available under the terms of the Eclipse Public License v1.0 |
| 9 | * which accompanies this distribution, and is available at |
| 10 | * http://www.eclipse.org/legal/epl-v10.html |
| 11 | * |
| 12 | * Contributors: |
| 13 | * Amit Arora <amit.arora@linaro.org> (IBM Corporation) |
| 14 | * - initial API and implementation |
| 15 | *******************************************************************************/ |
| 16 | |
| 17 | #include <sys/stat.h> |
| 18 | #include <sys/vfs.h> |
Amit Arora | ac4e865 | 2010-11-09 11:16:53 +0530 | [diff] [blame^] | 19 | #include <errno.h> |
| 20 | #include <sys/stat.h> |
Amit Arora | ed3e565 | 2010-10-27 12:02:53 +0530 | [diff] [blame] | 21 | #include <linux/magic.h> |
| 22 | |
Amit Arora | 031263a | 2010-11-09 11:12:41 +0530 | [diff] [blame] | 23 | #define MAX_LINES 80 |
| 24 | |
Amit Arora | ed3e565 | 2010-10-27 12:02:53 +0530 | [diff] [blame] | 25 | struct clock_info { |
Amit Arora | 6e774cd | 2010-10-28 11:31:24 +0530 | [diff] [blame] | 26 | char name[NAME_MAX]; |
| 27 | int flags; |
| 28 | int rate; |
| 29 | int usecount; |
| 30 | int num_children; |
| 31 | int last_child; |
Amit Arora | 031263a | 2010-11-09 11:12:41 +0530 | [diff] [blame] | 32 | int expanded; |
Amit Arora | ac4e865 | 2010-11-09 11:16:53 +0530 | [diff] [blame^] | 33 | int level; |
Amit Arora | 6e774cd | 2010-10-28 11:31:24 +0530 | [diff] [blame] | 34 | struct clock_info *parent; |
| 35 | struct clock_info **children; |
Amit Arora | ed3e565 | 2010-10-27 12:02:53 +0530 | [diff] [blame] | 36 | } *clocks_info; |
| 37 | |
| 38 | char debugfs_mntpoint[1024]; |
Amit Arora | 031263a | 2010-11-09 11:12:41 +0530 | [diff] [blame] | 39 | char clock_lines[MAX_LINES][128]; |
| 40 | int clock_line_no; |
Amit Arora | ac4e865 | 2010-11-09 11:16:53 +0530 | [diff] [blame^] | 41 | int old_clock_line_no; |
Amit Arora | ed3e565 | 2010-10-27 12:02:53 +0530 | [diff] [blame] | 42 | |
| 43 | char *likely_mpoints[] = { |
Amit Arora | 6e774cd | 2010-10-28 11:31:24 +0530 | [diff] [blame] | 44 | "/sys/kernel/debug", |
| 45 | "/debug", |
| 46 | NULL |
Amit Arora | ed3e565 | 2010-10-27 12:02:53 +0530 | [diff] [blame] | 47 | }; |
Amit Arora | 031263a | 2010-11-09 11:12:41 +0530 | [diff] [blame] | 48 | |
Amit Arora | ac4e865 | 2010-11-09 11:16:53 +0530 | [diff] [blame^] | 49 | void add_clock_details_recur(struct clock_info *clk, int hrow, int selected); |
Amit Arora | 031263a | 2010-11-09 11:12:41 +0530 | [diff] [blame] | 50 | void destroy_clocks_info(void); |
| 51 | void destroy_clocks_info_recur(struct clock_info *clock); |
Amit Arora | ac4e865 | 2010-11-09 11:16:53 +0530 | [diff] [blame^] | 52 | void collapse_all_subclocks(struct clock_info *clock); |