On 4 January 2011 09:58, Amit Kucheria amit.kucheria@linaro.org wrote:
CC'ing linaro-dev
On Tue, Jan 4, 2011 at 1:18 PM, Yong Shen yong.shen@linaro.org wrote:
hi there,
In last weekly meeting, we talked about the real time display of clock information in powerdebug.
What do you mean by real-time display?
powerdebug will only refresh it's information every 'n' seconds. At that point, the 'show' function for the sysfs rate entry should call get_rate() for the clock.
Actually, this feature can be easily supported. if you found some clocks' information stay unchanged after your drivers change clock setting, it may be caused by the wrong way of clock information exposing.
In the last several weeks, Jeremy and I reviewed the clock debug code based on common clock struct. In this code, I used below code to expose clock information:
ok for the clock rate but how do you manage a change of the clock's parent ? I mean , if a driver sets a new parent of a clock with clk_set_parent, we should also update the debugfs clock tree in order to reflect this modification. I'm not sure that we need to update the debugfs clock tree in a real time manner but we should be able to force a refresh of the clock debugfs.
+static int clk_debug_rate_get(void *data, u64 *val) +{
- struct clk *clk = data;
- *val = (u64)clk_get_rate(clk);
- return 0;
+} +DEFINE_SIMPLE_ATTRIBUTE(clk_debug_rate_fops, clk_debug_rate_get, NULL,
- "%llu\n");
.....
- d = debugfs_create_file("rate", S_IRUGO, clk->dentry, (void *)clk,
- &clk_debug_rate_fops);
Therefore, whenever the clock information is accessed, it can reflect the truth, since it calls clk interface like clk_get_rate() to get the right value.
Why is it called clk_debug_rate_get()? Is there not a standard clk_rate_get() that we can use?
Previously, some of you might use a variable to store clock information like rate or count, and expose these variable to sysfs, which is why they are not updated when the real clock information is changing.
Right, storing in variables will give wrong results if you're in the middle of a rate refresh.
linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev