Add common interface for clock debug information
Yong Shen
yong.shen at linaro.org
Tue Nov 9 07:31:19 UTC 2010
Hi Jeremy,
In power management group of linaro, we want to export debug information of
clock to user space and make a common interface to all the SOC platform.
Currently, each SOC platform has their own way to export clock information,
like freesale and TI, which is not ideal.
To do so, I need to make somethings done, and some of them are related to
common clock code, for which I am more than happy to hear your comments.
1. Create clock information based on common clock device, more specific,
based on struct clk_lookup. Since platform drivers are supposed to register
their clock
using 'void clkdev_add(struct clk_lookup *cl)', clk_lookup should contain
enough information for clock display, like clock name and platform clk
definition 'struck clk'. An extra field need to be added into clk_lookup is
a 'struct dentry *' to store a pointer of the dentry node which will be
exported in debug fs, like below:
struct clk_lookup {
struct list_head node;
const char *dev_id;
const char *con_id;
struct clk *clk;
+
+#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
+ struct dentry *dent;
+#endif
};
2. clock names is a little bit fuzzy, cause there are two names in the
clk_lookup, they are dev_id and con_id. And there is no name checking in
clkdev_add, which means that two clock with the same name could be register
into system and it is not reasonable. Also, it is impossible to create clock
information with two clocks having the same name, since user will be
confused about that. So, I plan to
add name checking to avoid name confilt in clkdev_add.
To avoid confusion, I am going to use the combination of dev name and
connection name togather to display clock. It goes like dev-id_con-id.
3. Currently, 'struct clk' is defined in platform related code, common
clk interface did not impose any assumption on how each platform define
their own 'struct clk', therefore, clock debug interface can not make any
assumption on how much information the platform defined clock contains as
well. So far, only clk_get_rate is there as a common defined interface which
I can use to export clock rate information, and I plan to add some optional
interface like clk_get_count, clk_get_flag, so more useful information can
be displayed.
I also attached a draft patch and the clock information displayed on the
console is a tree pattern like below(generated by powerdebug, a user
space application which can display clock information based on the debug
interface I made in the kernel).
|-- NULL-osc <flags=0x0:rate=24000000:usecount=0>
| |-- NULL-spdif_xtal_clk <flags=0x0:rate=24000000:usecount=0>
| | |-- mxc_alsa_spdif.0-NULL <flags=0x0:rate=24000000:usecount=0>
| |-- NULL-usb_phy1_clk <flags=0x0:rate=24000000:usecount=0>
| |-- NULL-lp_apm <flags=0x0:rate=24000000:usecount=0>
| | |-- NULL-ssi_lp_apm_clk <flags=0x0:rate=24000000:usecount=0>
| | | |-- mxc_ssi.1-NULL <flags=0x0:rate=12000000:usecount=0>
| | | | |-- NULL-ssi_ext2_clk <flags=0x0:rate=12000000:usecount=0>
| | | |-- mxc_ssi.0-NULL <flags=0x0:rate=12000000:usecount=0>
| | | | |-- NULL-ssi_ext1_clk <flags=0x0:rate=12000000:usecount=0>
Yong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linaro.org/pipermail/linaro-dev/attachments/20101109/2b290c8c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clock_debug.patch
Type: text/x-patch
Size: 4411 bytes
Desc: not available
URL: <http://lists.linaro.org/pipermail/linaro-dev/attachments/20101109/2b290c8c/attachment-0001.bin>
More information about the linaro-dev
mailing list