]>
git.ipfire.org Git - thirdparty/kernel/stable.git/blob - drivers/cpufreq/s3c24xx-cpufreq-debugfs.c
0df87b6480fe7d54b108f551a36136a245634508
2 * Copyright (c) 2009 Simtec Electronics
3 * http://armlinux.simtec.co.uk/
4 * Ben Dooks <ben@simtec.co.uk>
6 * S3C24XX CPU Frequency scaling - debugfs status support
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15 #include <linux/init.h>
16 #include <linux/export.h>
17 #include <linux/interrupt.h>
18 #include <linux/ioport.h>
19 #include <linux/cpufreq.h>
20 #include <linux/debugfs.h>
21 #include <linux/seq_file.h>
22 #include <linux/err.h>
24 #include <plat/cpu-freq-core.h>
26 static struct dentry
*dbgfs_root
;
27 static struct dentry
*dbgfs_file_io
;
28 static struct dentry
*dbgfs_file_info
;
29 static struct dentry
*dbgfs_file_board
;
31 #define print_ns(x) ((x) / 10), ((x) % 10)
33 static void show_max(struct seq_file
*seq
, struct s3c_freq
*f
)
35 seq_printf(seq
, "MAX: F=%lu, H=%lu, P=%lu, A=%lu\n",
36 f
->fclk
, f
->hclk
, f
->pclk
, f
->armclk
);
39 static int board_show(struct seq_file
*seq
, void *p
)
41 struct s3c_cpufreq_config
*cfg
;
42 struct s3c_cpufreq_board
*brd
;
44 cfg
= s3c_cpufreq_getconfig();
46 seq_printf(seq
, "no configuration registered\n");
52 seq_printf(seq
, "no board definition set?\n");
56 seq_printf(seq
, "SDRAM refresh %u ns\n", brd
->refresh
);
57 seq_printf(seq
, "auto_io=%u\n", brd
->auto_io
);
58 seq_printf(seq
, "need_io=%u\n", brd
->need_io
);
60 show_max(seq
, &brd
->max
);
66 DEFINE_SHOW_ATTRIBUTE(board
);
68 static int info_show(struct seq_file
*seq
, void *p
)
70 struct s3c_cpufreq_config
*cfg
;
72 cfg
= s3c_cpufreq_getconfig();
74 seq_printf(seq
, "no configuration registered\n");
78 seq_printf(seq
, " FCLK %ld Hz\n", cfg
->freq
.fclk
);
79 seq_printf(seq
, " HCLK %ld Hz (%lu.%lu ns)\n",
80 cfg
->freq
.hclk
, print_ns(cfg
->freq
.hclk_tns
));
81 seq_printf(seq
, " PCLK %ld Hz\n", cfg
->freq
.hclk
);
82 seq_printf(seq
, "ARMCLK %ld Hz\n", cfg
->freq
.armclk
);
83 seq_printf(seq
, "\n");
85 show_max(seq
, &cfg
->max
);
87 seq_printf(seq
, "Divisors: P=%d, H=%d, A=%d, dvs=%s\n",
88 cfg
->divs
.h_divisor
, cfg
->divs
.p_divisor
,
89 cfg
->divs
.arm_divisor
, cfg
->divs
.dvs
? "on" : "off");
90 seq_printf(seq
, "\n");
92 seq_printf(seq
, "lock_pll=%u\n", cfg
->lock_pll
);
97 DEFINE_SHOW_ATTRIBUTE(info
);
99 static int io_show(struct seq_file
*seq
, void *p
)
101 void (*show_bank
)(struct seq_file
*, struct s3c_cpufreq_config
*, union s3c_iobank
*);
102 struct s3c_cpufreq_config
*cfg
;
103 struct s3c_iotimings
*iot
;
104 union s3c_iobank
*iob
;
107 cfg
= s3c_cpufreq_getconfig();
109 seq_printf(seq
, "no configuration registered\n");
113 show_bank
= cfg
->info
->debug_io_show
;
115 seq_printf(seq
, "no code to show bank timing\n");
119 iot
= s3c_cpufreq_getiotimings();
121 seq_printf(seq
, "no io timings registered\n");
125 seq_printf(seq
, "hclk period is %lu.%lu ns\n", print_ns(cfg
->freq
.hclk_tns
));
127 for (bank
= 0; bank
< MAX_BANKS
; bank
++) {
128 iob
= &iot
->bank
[bank
];
130 seq_printf(seq
, "bank %d: ", bank
);
133 seq_printf(seq
, "nothing set\n");
137 show_bank(seq
, cfg
, iob
);
143 DEFINE_SHOW_ATTRIBUTE(io
);
145 static int __init
s3c_freq_debugfs_init(void)
147 dbgfs_root
= debugfs_create_dir("s3c-cpufreq", NULL
);
148 if (IS_ERR(dbgfs_root
)) {
149 pr_err("%s: error creating debugfs root\n", __func__
);
150 return PTR_ERR(dbgfs_root
);
153 dbgfs_file_io
= debugfs_create_file("io-timing", S_IRUGO
, dbgfs_root
,
156 dbgfs_file_info
= debugfs_create_file("info", S_IRUGO
, dbgfs_root
,
159 dbgfs_file_board
= debugfs_create_file("board", S_IRUGO
, dbgfs_root
,
165 late_initcall(s3c_freq_debugfs_init
);