From 02070de48e42d30eeb6dfa4ea2d3aeff1a0a980f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 20 Dec 2008 13:14:03 +0100 Subject: v4l2-dbg: get-chip-ident has no arguments From: Hans Verkuil get-chip-ident expected an argument when none was needed. Priority: normal Signed-off-by: Hans Verkuil --- v4l2-apps/util/v4l2-dbg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index e0d6153fe..31206a562 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -136,7 +136,7 @@ static struct option long_options[] = { {"set-register", required_argument, 0, OptSetRegister}, {"chip", required_argument, 0, OptChip}, {"scan-chip-idents", no_argument, 0, OptScanChipIdents}, - {"get-chip-ident", required_argument, 0, OptGetChipIdent}, + {"get-chip-ident", no_argument, 0, OptGetChipIdent}, {"info", no_argument, 0, OptGetDriverInfo}, {"verbose", no_argument, 0, OptVerbose}, {"log-status", no_argument, 0, OptLogStatus}, -- cgit v1.2.3 From eb7bc99b0b15c28d8d0bd3dd4be26710d03dac2a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Dec 2008 09:36:29 -0200 Subject: v4l2-dbg: fix --list-symbols option From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index 31206a562..c1e107de1 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -706,9 +706,9 @@ list_done: else { printf("Symbols for driver %s:\n", vcap.driver); for (int i = 0; i < curr_bd->regs_size; i++) - printf("0x%08x: %s\n", curr_bd->regs[i], curr_bd->regs[i].name); + printf("0x%08x: %s\n", curr_bd->regs[i].reg, curr_bd->regs[i].name); for (int i = 0; i < curr_bd->alt_regs_size; i++) - printf("0x%08x: %s\n", curr_bd->alt_regs[i], curr_bd->alt_regs[i].name); + printf("0x%08x: %s\n", curr_bd->alt_regs[i].reg, curr_bd->alt_regs[i].name); } } -- cgit v1.2.3 From d0dd746a466cef43b09aba57033f390dcc417967 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Dec 2008 09:53:53 -0200 Subject: v4l2-dbg: print register name when known From: Mauro Carvalho Chehab Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index c1e107de1..87044e851 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -293,6 +293,21 @@ static unsigned long long parse_reg(const struct board_list *curr_bd, const std: return strtoull(reg.c_str(), NULL, 0); } +static const char *reg_name(const struct board_list *curr_bd, unsigned long long reg) +{ + if (curr_bd) { + for (int i = 0; i < curr_bd->regs_size; i++) { + if (reg == curr_bd->regs[i].reg) + return curr_bd->regs[i].name; + } + for (int i = 0; i < curr_bd->alt_regs_size; i++) { + if (reg == curr_bd->regs[i].reg) + return curr_bd->regs[i].name; + } + } + return NULL; +} + static const char *binary(unsigned long long val) { static char bin[80]; @@ -582,9 +597,19 @@ int main(int argc, char **argv) if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &get_reg) < 0) fprintf(stderr, "ioctl: VIDIOC_DBG_G_REGISTER " "failed for 0x%llx\n", get_reg.reg); - else - printf("%llx = %llxh = %lldd = %sb\n", get_reg.reg, + else { + const char *name = reg_name(curr_bd, get_reg.reg); + + printf("Register "); + + if (name) + printf("%s", name); + else + printf("0x%08llx", get_reg.reg); + + printf(" = %llxh (%lldd %sb)\n", get_reg.val, get_reg.val, binary(get_reg.val)); + } } } -- cgit v1.2.3 From 585b4e51209e77b24d2d03f4dd30af1ec34e9002 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Dec 2008 10:17:16 -0200 Subject: v4l2-dbg: print register name and fix doioctl check From: Mauro Carvalho Chehab Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index 87044e851..620702858 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -549,8 +549,21 @@ int main(int argc, char **argv) while (optind < argc) { set_reg.val = strtoull(argv[optind++], NULL, 0); if (doioctl(fd, VIDIOC_DBG_S_REGISTER, &set_reg, - "VIDIOC_DBG_S_REGISTER") == 0) - printf("register 0x%llx set to 0x%llx\n", set_reg.reg, set_reg.val); + "VIDIOC_DBG_S_REGISTER") >= 0) { + const char *name = reg_name(curr_bd, set_reg.reg); + + printf("Register "); + + if (name) + printf("%s", name); + else + printf("0x%08llx", set_reg.reg); + + printf(" set to 0x%llx\n", set_reg.val); + } else { + printf("Failed to set register 0x%08llx value 0x%llx\n", + set_reg.reg, set_reg.val); + } set_reg.reg++; } } -- cgit v1.2.3 From b041d4c5cfa27296e25d7719299bb0e745fc45cf Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Dec 2008 10:19:13 -0200 Subject: v4l2-dbg: print also register number when name is available From: Mauro Carvalho Chehab Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index 620702858..1841e677b 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -555,7 +555,7 @@ int main(int argc, char **argv) printf("Register "); if (name) - printf("%s", name); + printf("%s (0x%08llx)", name, set_reg.reg); else printf("0x%08llx", set_reg.reg); @@ -616,7 +616,7 @@ int main(int argc, char **argv) printf("Register "); if (name) - printf("%s", name); + printf("%s (0x%08llx)", name, get_reg.reg); else printf("0x%08llx", get_reg.reg); -- cgit v1.2.3 From 71447659e72af9641c95885d7b92a568e7ce8dfc Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Dec 2008 10:22:42 -0200 Subject: v4l2-dbg: em2800 registers are not very common nowadays. Use it as alternate names From: Mauro Carvalho Chehab Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index 1841e677b..dfeae8cea 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -79,8 +79,8 @@ static const struct board_list boards[] = { sizeof(EM28XX_PREFIX) - 1, em28xx_regs, ARRAY_SIZE(em28xx_regs), - NULL, - 0, + em28xx_alt_regs, + ARRAY_SIZE(em28xx_alt_regs), }, }; -- cgit v1.2.3 From 1d183a32a6fbcd8812f35d0eeca02347de4223bf Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Dec 2008 14:49:07 -0200 Subject: em28xx: update regiters on v4l2-dbg debug util From: Mauro Carvalho Chehab Some ac97 registers where presented as if they are em28xx ones. Also, add mising em2874 registers. The code were generated by the following command: $ more em28xx-reg.h |perl -ne 'if (m/(EM2[A-Z0-9]..)_R.._([^\s]+)\s+(0x[0-9A-Fa-f].)/) { printf "\t{$3, $1_PREFIX \"$2\", 1},\n"; }' |grep -v EM2800_PREFIX|sort >/tmp/registers Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index dfeae8cea..e05be1f03 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -158,6 +158,7 @@ static void usage(void) " It can be one of:\n" " I2C driver ID (see --list-driverids)\n" " I2C 7-bit address\n" + " AC97: for ac97 anciliary mixer\n" " host: host chip number \n" " host (default): same as host0\n" " -l, --list-registers[=min=[,max=]]\n" @@ -448,6 +449,11 @@ int main(int argc, char **argv) match_chip = strtoul(optarg + 4, NULL, 0); break; } + if (!strcasecmp(optarg, "ac97")) { + match_type = V4L2_CHIP_MATCH_AC97; + match_chip = strtoul(optarg + 4, NULL, 0); + break; + } match_type = V4L2_CHIP_MATCH_I2C_DRIVER; match_chip = parse_chip(optarg); if (!match_chip) { -- cgit v1.2.3 From 5b8cbae207001dd7cd7e4a4f09a987b4194d0a8f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Dec 2008 15:06:33 -0200 Subject: v4l2-dbg: Add support for get/set ac97 registers From: Mauro Carvalho Chehab em28xx devices can have an ac97 anciliary chip. This patch allows get/set ac97 registers Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index e05be1f03..412d3bea5 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -45,6 +45,7 @@ #include "v4l2-dbg-bttv.h" #include "v4l2-dbg-saa7134.h" #include "v4l2-dbg-em28xx.h" +#include "v4l2-dbg-ac97.h" #define ARRAY_SIZE(arr) ((int)(sizeof(arr) / sizeof((arr)[0]))) @@ -58,6 +59,15 @@ struct board_list { }; static const struct board_list boards[] = { +#define AC97_BOARD 0 + { /* From ac97-dbg.h */ + AC97_IDENT, + sizeof(AC97_PREFIX) - 1, + ac97_regs, + ARRAY_SIZE(ac97_regs), + NULL, + 0, + }, { /* From bttv-dbg.h */ BTTV_IDENT, sizeof(BTTV_PREFIX) - 1, @@ -451,7 +461,6 @@ int main(int argc, char **argv) } if (!strcasecmp(optarg, "ac97")) { match_type = V4L2_CHIP_MATCH_AC97; - match_chip = strtoul(optarg + 4, NULL, 0); break; } match_type = V4L2_CHIP_MATCH_I2C_DRIVER; @@ -537,10 +546,14 @@ int main(int argc, char **argv) printf("%s", cap2s(vcap.capabilities).c_str()); } - for (int board = ARRAY_SIZE(boards) - 1; board >= 0; board--) { - if (!strcasecmp((char *)vcap.driver, boards[board].name)) { - curr_bd = &boards[board]; - break; + if (match_type == V4L2_CHIP_MATCH_AC97) { + curr_bd = &boards[AC97_BOARD]; + } else { + for (int board = ARRAY_SIZE(boards) - 1; board >= 0; board--) { + if (!strcasecmp((char *)vcap.driver, boards[board].name)) { + curr_bd = &boards[board]; + break; + } } } -- cgit v1.2.3 From 508d4c2d232f61a3ffc92c05bee7a9afe7559081 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Dec 2008 16:01:46 -0200 Subject: v4l2-dbg: Use aliases for debug, on available chips From: Mauro Carvalho Chehab Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index 412d3bea5..c7ef1206b 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -487,6 +487,7 @@ int main(int argc, char **argv) subs = optarg; if (subs == NULL) break; + while (*subs != '\0') { static const char * const subopts[] = { "min", @@ -658,6 +659,43 @@ int main(int argc, char **argv) } printf("ioctl: VIDIOC_DBG_G_REGISTER\n"); + if (curr_bd) { + if (reg_min_arg.empty()) + reg_min = 0; + else + reg_min = parse_reg(curr_bd, reg_min_arg); + + + if (reg_max_arg.empty()) + reg_max = 1<<31 - 1; + else + reg_max = parse_reg(curr_bd, reg_max_arg); + + for (int i = 0; i < curr_bd->regs_size; i++) { + if (reg_min_arg.empty() || ((curr_bd->regs[i].reg >= reg_min) && curr_bd->regs[i].reg <= reg_max)) { + get_reg.reg = curr_bd->regs[i].reg; + + if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &get_reg) < 0) + fprintf(stderr, "ioctl: VIDIOC_DBG_G_REGISTER " + "failed for 0x%llx\n", get_reg.reg); + else { + const char *name = reg_name(curr_bd, get_reg.reg); + + printf("Register "); + + if (name) + printf("%s (0x%08llx)", name, get_reg.reg); + else + printf("0x%08llx", get_reg.reg); + + printf(" = %llxh (%lldd %sb)\n", + get_reg.val, get_reg.val, binary(get_reg.val)); + } + } + } + goto list_done; + } + if (!reg_min_arg.empty()) { reg_min = parse_reg(curr_bd, reg_min_arg); if (reg_max_arg.empty()) @@ -668,6 +706,7 @@ int main(int argc, char **argv) print_regs(fd, &get_reg, reg_min, reg_max, stride); goto list_done; } + /* try to match the i2c chip */ switch (get_reg.match_chip) { case I2C_DRIVERID_SAA711X: -- cgit v1.2.3 From 43e99e5ec6d0b7bc9249119867ff553cba80b0ee Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Dec 2008 22:00:03 -0200 Subject: v4l2-dbg: allow debug tvp5150 registers From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/v4l2-dbg.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'v4l2-apps/util/v4l2-dbg.cpp') diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index c7ef1206b..577c8585e 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -46,6 +46,7 @@ #include "v4l2-dbg-saa7134.h" #include "v4l2-dbg-em28xx.h" #include "v4l2-dbg-ac97.h" +#include "v4l2-dbg-tvp5150.h" #define ARRAY_SIZE(arr) ((int)(sizeof(arr) / sizeof((arr)[0]))) @@ -92,6 +93,14 @@ static const struct board_list boards[] = { em28xx_alt_regs, ARRAY_SIZE(em28xx_alt_regs), }, + { /* From tvp5150-dbg.h */ + TVP5150_IDENT, + sizeof(TVP5150_PREFIX) - 1, + tvp5150_regs, + ARRAY_SIZE(tvp5150_regs), + NULL, + 0, + }, }; struct driverid { @@ -406,6 +415,7 @@ int main(int argc, char **argv) std::vector get_regs; int match_type = V4L2_CHIP_MATCH_HOST; int match_chip = 0; + char driver[255]; memset(&set_reg, 0, sizeof(set_reg)); memset(&get_reg, 0, sizeof(get_reg)); @@ -464,6 +474,7 @@ int main(int argc, char **argv) break; } match_type = V4L2_CHIP_MATCH_I2C_DRIVER; + strcpy(driver, optarg); match_chip = parse_chip(optarg); if (!match_chip) { fprintf(stderr, "unknown driver ID %s\n", optarg); @@ -549,13 +560,20 @@ int main(int argc, char **argv) if (match_type == V4L2_CHIP_MATCH_AC97) { curr_bd = &boards[AC97_BOARD]; - } else { + } else if (match_type == V4L2_CHIP_MATCH_HOST) { for (int board = ARRAY_SIZE(boards) - 1; board >= 0; board--) { if (!strcasecmp((char *)vcap.driver, boards[board].name)) { curr_bd = &boards[board]; break; } } + } else if (match_type == V4L2_CHIP_MATCH_I2C_DRIVER) { + for (int board = ARRAY_SIZE(boards) - 1; board >= 0; board--) { + if (!strcasecmp(driver, boards[board].name)) { + curr_bd = &boards[board]; + break; + } + } } /* Set options */ @@ -651,6 +669,7 @@ int main(int argc, char **argv) get_reg.match_type = match_type; get_reg.match_chip = match_chip; + if (forcedstride) { stride = forcedstride; } else { -- cgit v1.2.3