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:
+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.