diff options
Diffstat (limited to 'v4l2-apps')
-rw-r--r-- | v4l2-apps/util/v4l2-dbg-ac97.h | 67 | ||||
-rw-r--r-- | v4l2-apps/util/v4l2-dbg-em28xx.h | 15 | ||||
-rw-r--r-- | v4l2-apps/util/v4l2-dbg-tvp5150.h | 97 | ||||
-rw-r--r-- | v4l2-apps/util/v4l2-dbg.cpp | 85 |
4 files changed, 255 insertions, 9 deletions
diff --git a/v4l2-apps/util/v4l2-dbg-ac97.h b/v4l2-apps/util/v4l2-dbg-ac97.h new file mode 100644 index 000000000..809abe469 --- /dev/null +++ b/v4l2-apps/util/v4l2-dbg-ac97.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2008 Mauro Carvalho Chehab <mchehab@infradead.org> + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "v4l2-dbg.h" + +#define AC97_IDENT "ac97" + +/* Register name prefix */ +#define AC97_PREFIX "AC97_" +#define EM202_PREFIX "EM202_" + +static struct board_regs ac97_regs[] = { + /* general ac97 registers */ + {0x00, AC97_PREFIX "RESET", 2}, + {0x02, AC97_PREFIX "MASTER_VOL", 2}, + {0x04, AC97_PREFIX "LINE_LEVEL_VOL", 2}, + {0x06, AC97_PREFIX "MASTER_MONO_VOL", 2}, + {0x0a, AC97_PREFIX "PC_BEEP_VOL", 2}, + {0x0c, AC97_PREFIX "PHONE_VOL", 2}, + {0x0e, AC97_PREFIX "MIC_VOL", 2}, + {0x10, AC97_PREFIX "LINEIN_VOL", 2}, + {0x12, AC97_PREFIX "CD_VOL", 2}, + {0x14, AC97_PREFIX "VIDEO_VOL", 2}, + {0x16, AC97_PREFIX "AUX_VOL", 2}, + {0x18, AC97_PREFIX "PCM_OUT_VOL", 2}, + {0x1a, AC97_PREFIX "RECORD_SELECT", 2}, + {0x1c, AC97_PREFIX "RECORD_GAIN", 2}, + {0x20, AC97_PREFIX "GENERAL_PURPOSE", 2}, + {0x22, AC97_PREFIX "3D_CTRL", 2}, + {0x24, AC97_PREFIX "AUD_INT_AND_PAG", 2}, + {0x26, AC97_PREFIX "POWER_DOWN_CTRL", 2}, + {0x28, AC97_PREFIX "EXT_AUD_ID", 2}, + {0x2a, AC97_PREFIX "EXT_AUD_CTRL", 2}, + {0x2c, AC97_PREFIX "PCM_OUT_FRONT_SRATE", 2}, + {0x2e, AC97_PREFIX "PCM_OUT_SURR_SRATE", 2}, + {0x30, AC97_PREFIX "PCM_OUT_LFE_SRATE", 2}, + {0x32, AC97_PREFIX "PCM_IN_SRATE", 2}, + {0x36, AC97_PREFIX "LFE_MASTER_VOL", 2}, + {0x38, AC97_PREFIX "SURR_MASTER_VOL", 2}, + {0x3a, AC97_PREFIX "SPDIF_OUT_CTRL", 2}, + {0x7c, AC97_PREFIX "VENDOR_ID1", 2}, + {0x7e, AC97_PREFIX "VENDOR_ID2", 2}, + + /* em202 vendor specific registers */ + {0x3e, EM202_PREFIX "EXT_MODEM_CTRL", 2}, + {0x4c, EM202_PREFIX "GPIO_CONF", 2}, + {0x4e, EM202_PREFIX "GPIO_POLARITY", 2}, + {0x50, EM202_PREFIX "GPIO_STICKY", 2}, + {0x52, EM202_PREFIX "GPIO_MASK", 2}, + {0x54, EM202_PREFIX "GPIO_STATUS", 2}, + {0x6a, EM202_PREFIX "SPDIF_OUT_SEL", 2}, + {0x72, EM202_PREFIX "ANTIPOP", 2}, + {0x74, EM202_PREFIX "EAPD_GPIO_ACCESS", 2}, +}; diff --git a/v4l2-apps/util/v4l2-dbg-em28xx.h b/v4l2-apps/util/v4l2-dbg-em28xx.h index 3a0413b70..ae83a3181 100644 --- a/v4l2-apps/util/v4l2-dbg-em28xx.h +++ b/v4l2-apps/util/v4l2-dbg-em28xx.h @@ -20,10 +20,13 @@ /* Register name prefix */ #define EM2800_PREFIX "EM2800_" +#define EM2874_PREFIX "EM2874_" #define EM2880_PREFIX "EM2880_" #define EM28XX_PREFIX "EM28XX_" static struct board_regs em28xx_regs[] = { + {0x00, EM28XX_PREFIX "CHIPCFG", 1}, + {0x04, EM2880_PREFIX "GPO", 1}, {0x08, EM28XX_PREFIX "GPIO", 1}, {0x06, EM28XX_PREFIX "I2C_CLK", 1}, @@ -76,12 +79,14 @@ static struct board_regs em28xx_regs[] = { {0x42, EM28XX_PREFIX "AC97ADDR", 1}, {0x43, EM28XX_PREFIX "AC97BUSY", 1}, - {0x02, EM28XX_PREFIX "MASTER_AC97", 1}, - {0x10, EM28XX_PREFIX "LINE_IN_AC97", 1}, - {0x14, EM28XX_PREFIX "VIDEO_AC97", 1}, + {0x45, EM28XX_PREFIX "IR", 1}, + + {0x50, EM2874_PREFIX "IR_CONFIG", 1}, + {0x51, EM2874_PREFIX "IR", 1}, + {0x5f, EM2874_PREFIX "TS_ENABLE", 1}, + {0x80, EM2874_PREFIX "GPIO", 1}, }; static struct board_regs em28xx_alt_regs[] = { {0x08, EM2800_PREFIX "AUDIOSRC", 1}, - {0x04, EM2880_PREFIX "GPO", 1}, -};
\ No newline at end of file +}; diff --git a/v4l2-apps/util/v4l2-dbg-tvp5150.h b/v4l2-apps/util/v4l2-dbg-tvp5150.h new file mode 100644 index 000000000..ed5793b72 --- /dev/null +++ b/v4l2-apps/util/v4l2-dbg-tvp5150.h @@ -0,0 +1,97 @@ +/* + Copyright (C) 2008 Mauro Carvalho Chehab <mchehab@infradead.org> + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "v4l2-dbg.h" + +#define TVP5150_IDENT "tvp5150" + +/* Register name prefix */ +#define TVP5150_PREFIX "TVP5150_" + +static struct board_regs tvp5150_regs[] = { + {0x00, TVP5150_PREFIX "VD_IN_SRC_SEL_1", 1}, + {0x01, TVP5150_PREFIX "ANAL_CHL_CTL", 1}, + {0x02, TVP5150_PREFIX "OP_MODE_CTL", 1}, + {0x03, TVP5150_PREFIX "MISC_CTL", 1}, + {0x04, TVP5150_PREFIX "AUTOSW_MSK", 1}, + {0x06, TVP5150_PREFIX "COLOR_KIL_THSH_CTL", 1}, + {0x07, TVP5150_PREFIX "LUMA_PROC_CTL_1", 1}, + {0x08, TVP5150_PREFIX "LUMA_PROC_CTL_2", 1}, + {0x09, TVP5150_PREFIX "BRIGHT_CTL", 1}, + {0x0a, TVP5150_PREFIX "SATURATION_CTL", 1}, + {0x0b, TVP5150_PREFIX "HUE_CTL", 1}, + {0x0c, TVP5150_PREFIX "CONTRAST_CTL", 1}, + {0x0d, TVP5150_PREFIX "DATA_RATE_SEL", 1}, + {0x0e, TVP5150_PREFIX "LUMA_PROC_CTL_3", 1}, + {0x0f, TVP5150_PREFIX "CONF_SHARED_PIN", 1}, + {0x11, TVP5150_PREFIX "ACT_VD_CROP_ST_MSB", 1}, + {0x12, TVP5150_PREFIX "ACT_VD_CROP_ST_LSB", 1}, + {0x13, TVP5150_PREFIX "ACT_VD_CROP_STP_MSB", 1}, + {0x14, TVP5150_PREFIX "ACT_VD_CROP_STP_LSB", 1}, + {0x15, TVP5150_PREFIX "GENLOCK", 1}, + {0x16, TVP5150_PREFIX "HORIZ_SYNC_START", 1}, + {0x18, TVP5150_PREFIX "VERT_BLANKING_START", 1}, + {0x19, TVP5150_PREFIX "VERT_BLANKING_STOP", 1}, + {0x1a, TVP5150_PREFIX "CHROMA_PROC_CTL_1", 1}, + {0x1b, TVP5150_PREFIX "CHROMA_PROC_CTL_2", 1}, + {0x1c, TVP5150_PREFIX "INT_RESET_REG_B", 1}, + {0x1d, TVP5150_PREFIX "INT_ENABLE_REG_B", 1}, + {0x1e, TVP5150_PREFIX "INTT_CONFIG_REG_B", 1}, + {0x28, TVP5150_PREFIX "VIDEO_STD", 1}, + {0x2c, TVP5150_PREFIX "CB_GAIN_FACT", 1}, + {0x2d, TVP5150_PREFIX "CR_GAIN_FACTOR", 1}, + {0x2e, TVP5150_PREFIX "MACROVISION_ON_CTR", 1}, + {0x2f, TVP5150_PREFIX "MACROVISION_OFF_CTR", 1}, + {0x30, TVP5150_PREFIX "REV_SELECT", 1}, + {0x80, TVP5150_PREFIX "MSB_DEV_ID", 1}, + {0x81, TVP5150_PREFIX "LSB_DEV_ID", 1}, + {0x82, TVP5150_PREFIX "ROM_MAJOR_VER", 1}, + {0x83, TVP5150_PREFIX "ROM_MINOR_VER", 1}, + {0x84, TVP5150_PREFIX "VERT_LN_COUNT_MSB", 1}, + {0x85, TVP5150_PREFIX "VERT_LN_COUNT_LSB", 1}, + {0x86, TVP5150_PREFIX "INT_STATUS_REG_B", 1}, + {0x87, TVP5150_PREFIX "INT_ACTIVE_REG_B", 1}, + {0x88, TVP5150_PREFIX "STATUS_REG_1", 1}, + {0x89, TVP5150_PREFIX "STATUS_REG_2", 1}, + {0x8a, TVP5150_PREFIX "STATUS_REG_3", 1}, + {0x8b, TVP5150_PREFIX "STATUS_REG_4", 1}, + {0x8c, TVP5150_PREFIX "STATUS_REG_5", 1}, + {0x90, TVP5150_PREFIX "CC_DATA", 4}, + {0x94, TVP5150_PREFIX "WSS_DATA", 6}, + {0x9a, TVP5150_PREFIX "VPS_DATA", 13}, + {0xa7, TVP5150_PREFIX "VITC_DATA", 9}, + {0xb0, TVP5150_PREFIX "VBI_FIFO_READ_DATA", 1}, + {0xb1, TVP5150_PREFIX "TELETEXT_FIL1", 5}, + {0xb6, TVP5150_PREFIX "TELETEXT_FIL2", 5}, + {0xbb, TVP5150_PREFIX "TELETEXT_FIL_ENA", 1}, + {0xc0, TVP5150_PREFIX "INT_STATUS_REG_A", 1}, + {0xc1, TVP5150_PREFIX "INT_ENABLE_REG_A", 1}, + {0xc2, TVP5150_PREFIX "INT_CONF", 1}, + {0xc3, TVP5150_PREFIX "VDP_CONF_RAM_DATA", 1}, + {0xc4, TVP5150_PREFIX "CONF_RAM_ADDR_LOW", 1}, + {0xc5, TVP5150_PREFIX "CONF_RAM_ADDR_HIGH", 1}, + {0xc6, TVP5150_PREFIX "VDP_STATUS_REG", 1}, + {0xc7, TVP5150_PREFIX "FIFO_WORD_COUNT", 1}, + {0xc8, TVP5150_PREFIX "FIFO_INT_THRESHOLD", 1}, + {0xc9, TVP5150_PREFIX "FIFO_RESET", 1}, + {0xca, TVP5150_PREFIX "LINE_NUMBER_INT", 1}, + {0xcb, TVP5150_PREFIX "PIX_ALIGN_REG_LOW", 1}, + {0xcc, TVP5150_PREFIX "PIX_ALIGN_REG_HIGH", 1}, + {0xcd, TVP5150_PREFIX "FIFO_OUT_CTRL", 1}, + {0xcf, TVP5150_PREFIX "FULL_FIELD_ENA", 1}, + {0xd0, TVP5150_PREFIX "LINE_MODE", 43}, + {0xfc, TVP5150_PREFIX "FULL_FIELD_MODE_REG", 1}, +}; diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index dfeae8cea..577c8585e 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -45,6 +45,8 @@ #include "v4l2-dbg-bttv.h" #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]))) @@ -58,6 +60,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, @@ -82,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 { @@ -158,6 +177,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<num>: host chip number <num>\n" " host (default): same as host0\n" " -l, --list-registers[=min=<addr>[,max=<addr>]]\n" @@ -395,6 +415,7 @@ int main(int argc, char **argv) std::vector<std::string> 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)); @@ -448,7 +469,12 @@ int main(int argc, char **argv) match_chip = strtoul(optarg + 4, NULL, 0); break; } + if (!strcasecmp(optarg, "ac97")) { + match_type = V4L2_CHIP_MATCH_AC97; + 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); @@ -472,6 +498,7 @@ int main(int argc, char **argv) subs = optarg; if (subs == NULL) break; + while (*subs != '\0') { static const char * const subopts[] = { "min", @@ -531,10 +558,21 @@ 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 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; + } } } @@ -631,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 { @@ -639,6 +678,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()) @@ -649,6 +725,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: |