diff options
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | clocks.c | 69 | ||||
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | doc.txt | 20 | ||||
-rw-r--r-- | powerdebug.c | 10 | ||||
-rw-r--r-- | powerdebug.h | 2 | ||||
-rw-r--r-- | regulator.c | 8 |
7 files changed, 101 insertions, 17 deletions
@@ -29,6 +29,6 @@ LOCAL_C_INCLUDES += external/stlport/stlport/ \ LOCAL_SRC_FILES += \ powerdebug.c sensor.c clocks.c regulator.c \ - display.c tree.c utils.c mainloop.c + display.c tree.c utils.c mainloop.c gpio.c include $(BUILD_EXECUTABLE) @@ -42,9 +42,19 @@ struct clock_info { int usecount; bool expanded; char *prefix; + int preparecount; + int enablecount; + int notifiercount; } *clocks_info; +enum clock_fw_type{ + CCF, /* common clock framework */ + OCF, /* old clock framework */ + MAX, +}; + static struct tree *clock_tree = NULL; +static int clock_fw; static int locate_debugfs(char *clk_path) { @@ -144,9 +154,18 @@ static inline int read_clock_cb(struct tree *t, void *data) { struct clock_info *clk = t->private; - file_read_value(t->path, "flags", "%x", &clk->flags); - file_read_value(t->path, "rate", "%d", &clk->rate); - file_read_value(t->path, "usecount", "%d", &clk->usecount); + if(clock_fw == CCF) { + file_read_value(t->path, "clk_flags", "%x", &clk->flags); + file_read_value(t->path, "clk_rate", "%d", &clk->rate); + file_read_value(t->path, "clk_prepare_count", "%d", &clk->preparecount); + file_read_value(t->path, "clk_enable_count", "%d", &clk->enablecount); + file_read_value(t->path, "clk_notifier_count", "%d", &clk->notifiercount); + } + else { + file_read_value(t->path, "flags", "%x", &clk->flags); + file_read_value(t->path, "rate", "%d", &clk->rate); + file_read_value(t->path, "usecount", "%d", &clk->usecount); + } return 0; } @@ -206,9 +225,17 @@ static char *clock_line(struct tree *t) if (asprintf(&clkrate, "%d%s", rate, clkunit) < 0) goto free_clkname; - if (asprintf(&clkline, "%-55s 0x%-16x %-12s %-9d %-8d", clkname, - clk->flags, clkrate, clk->usecount, t->nrchild) < 0) - goto free_clkrate; + if(clock_fw == CCF) { + if (asprintf(&clkline, "%-35s 0x%-8x %-12s %-10d %-11d %-15d %-14d %-10d", + clkname, clk->flags, clkrate, clk->usecount, t->nrchild, + clk->preparecount, clk->enablecount, clk->notifiercount) < 0) + goto free_clkrate; + } + else { + if (asprintf(&clkline, "%-55s 0x%-16x %-12s %-9d %-8d", + clkname, clk->flags, clkrate, clk->usecount, t->nrchild) < 0) + goto free_clkrate; + } free_clkrate: free(clkrate); @@ -259,9 +286,17 @@ static int clock_print_header(void) char *buf; int ret; - if (asprintf(&buf, "%-55s %-16s %-12s %-9s %-8s", + if(clock_fw == CCF) { + if (asprintf(&buf, "%-35s %-10s %-12s %-10s %-11s %-15s %-14s %-14s", + "Name", "Flags", "Rate", "Usecount", "Children", "Prepare_Count", + "Enable_Count", "Notifier_Count") < 0) + return -1; + } + else { + if (asprintf(&buf, "%-55s %-16s %-12s %-9s %-8s", "Name", "Flags", "Rate", "Usecount", "Children") < 0) return -1; + } ret = display_column_name(buf); @@ -384,17 +419,25 @@ static struct display_ops clock_ops = { */ int clock_init(void) { - char clk_dir_path[PATH_MAX]; + char clk_dir_path[MAX+1][PATH_MAX]; - if (locate_debugfs(clk_dir_path)) + if (locate_debugfs(clk_dir_path[CCF]) || locate_debugfs(clk_dir_path[OCF])) return -1; - sprintf(clk_dir_path, "%s/clock", clk_dir_path); - - if (access(clk_dir_path, F_OK)) + sprintf(clk_dir_path[CCF], "%s/clk", clk_dir_path[CCF]); + sprintf(clk_dir_path[OCF], "%s/clock", clk_dir_path[OCF]); + if (!access(clk_dir_path[CCF], F_OK)) { + clock_fw = CCF; + strcpy(clk_dir_path[MAX],clk_dir_path[CCF]); + } + else if(!access(clk_dir_path[OCF], F_OK)) { + clock_fw = OCF; + strcpy(clk_dir_path[MAX],clk_dir_path[OCF]); + } + else return -1; - clock_tree = tree_load(clk_dir_path, NULL, false); + clock_tree = tree_load(clk_dir_path[MAX], NULL, false); if (!clock_tree) return -1; diff --git a/debian/changelog b/debian/changelog index b7318a6..31937d4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +powerdebug (0.6.2-2013.02-0) precise; urgency=low + + * fixed lp: 1068108 + * added regulator related information + + -- Sanjay Singh Rawat <sanjay.rawat@linaro.org> Thu, 14 Feb 2013 16:21:52 +0530 + powerdebug (0.6.1-2011.10-0) natty; urgency=low * fixed lp: 857382 @@ -0,0 +1,20 @@ +Regulator related information +============================= +Regulator fields "state" and "status" give below information about the regulator. + +- state: field tell whether regulator is enabled or disabled. Following are the states + | - Enabled + | - Disabled + | - Unknown (if unable to determine) + | + | + ----> status: When enabled, depending on the regulator hardware capability(modes) and runtime requirement; regulators are set to specific modes. The status field gives a little + more specific information about the current "state" of the regulator, which operating modes it is in. Following can be the possible status: + - Idle + - Fast + - Normal + - Standby + - Bypass + - Error + - Undefined + - On/Off diff --git a/powerdebug.c b/powerdebug.c index cc9e871..073fd42 100644 --- a/powerdebug.c +++ b/powerdebug.c @@ -216,6 +216,16 @@ int main(int argc, char **argv) struct powerdebug_options *options; int ret; +#ifdef __ANDROID__ + if (setenv("TERM", "xterm", 1) < 0) { + fprintf(stderr, "setenv failure"); + return 1; + } + if (setenv("TERMINFO", "/system/etc/terminfo", 1) < 0) { + fprintf(stderr, "setenv failure"); + return 1; + } +#endif options = powerdebug_init(); if (!options) { fprintf(stderr, "not enough memory to allocate options\n"); diff --git a/powerdebug.h b/powerdebug.h index 09d3c1e..e2c1699 100644 --- a/powerdebug.h +++ b/powerdebug.h @@ -13,4 +13,4 @@ * - initial API and implementation *******************************************************************************/ -#define VERSION "0.6.1" +#define VERSION "0.6.2" diff --git a/regulator.c b/regulator.c index 55bd3e9..0da924a 100644 --- a/regulator.c +++ b/regulator.c @@ -90,13 +90,17 @@ static int regulator_dump_cb(struct tree *tree, void *data) printf("\n%s:\n", tree->name); for (i = 0; i < nregdata; i++) { + int val; if (file_read_value(tree->path, regdata[i].name, regdata[i].ifmt, buffer)) continue; - printf(regdata[i].ofmt, regdata[i].derefme ? - *((int *)buffer) : buffer); + if (regdata[i].derefme) { + val = atoi(buffer); + printf(regdata[i].ofmt, val); + } else + printf(regdata[i].ofmt, buffer); } return 0; |