diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-04-19 08:07:59 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-04-22 15:05:44 +0200 |
commit | b0334a3f662d09cbe07e518835f463e1f8e95cc7 (patch) | |
tree | ef8dfda667577c0e3ea5c58545fd155a34708a0d /commands | |
parent | 540dc8437d46177438cd2e633a07f1f745664685 (diff) | |
download | barebox-b0334a3f662d09cbe07e518835f463e1f8e95cc7.tar.gz barebox-b0334a3f662d09cbe07e518835f463e1f8e95cc7.tar.xz |
commands: clk_dump: add json output option
This formats the clock tree and the enable_count and rate of each clock
into the JSON format. This is useful to run validation scripts against
it that were originally written for Linux' /sys/kernel/debug/clk/clk_dump.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240419060759.2590652-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/clk.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/commands/clk.c b/commands/clk.c index 290acd842e..210b61306a 100644 --- a/commands/clk.c +++ b/commands/clk.c @@ -166,11 +166,14 @@ static int do_clk_dump(int argc, char *argv[]) int opt, flags = 0; struct clk *clk; - while ((opt = getopt(argc, argv, "v")) > 0) { + while ((opt = getopt(argc, argv, "vj")) > 0) { switch(opt) { case 'v': flags |= CLK_DUMP_VERBOSE; break; + case 'j': + flags |= CLK_DUMP_JSON; + break; default: return -EINVAL; @@ -194,12 +197,13 @@ static int do_clk_dump(int argc, char *argv[]) BAREBOX_CMD_HELP_START(clk_dump) BAREBOX_CMD_HELP_TEXT("Options:") BAREBOX_CMD_HELP_OPT ("-v", "verbose") +BAREBOX_CMD_HELP_OPT ("-j", "json output") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(clk_dump) .cmd = do_clk_dump, BAREBOX_CMD_DESC("show information about registered clocks") - BAREBOX_CMD_OPTS("[-v] [clkname]") + BAREBOX_CMD_OPTS("[-vj] [clkname]") BAREBOX_CMD_GROUP(CMD_GRP_INFO) BAREBOX_CMD_HELP(cmd_clk_dump_help) BAREBOX_CMD_COMPLETE(clk_name_complete) |