diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-22 15:06:33 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-22 15:06:33 -0200 |
commit | 5b8cbae207001dd7cd7e4a4f09a987b4194d0a8f (patch) | |
tree | 8fcb32bdc6f1fbb48bf4a7f59e4d27f82176c8e5 /v4l2-apps/util | |
parent | 1d183a32a6fbcd8812f35d0eeca02347de4223bf (diff) | |
download | mediapointer-dvb-s2-5b8cbae207001dd7cd7e4a4f09a987b4194d0a8f.tar.gz mediapointer-dvb-s2-5b8cbae207001dd7cd7e4a4f09a987b4194d0a8f.tar.bz2 |
v4l2-dbg: Add support for get/set ac97 registers
From: Mauro Carvalho Chehab <mchehab@redhat.com>
em28xx devices can have an ac97 anciliary chip. This patch allows
get/set ac97 registers
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'v4l2-apps/util')
-rw-r--r-- | v4l2-apps/util/v4l2-dbg-ac97.h | 67 | ||||
-rw-r--r-- | v4l2-apps/util/v4l2-dbg.cpp | 23 |
2 files changed, 85 insertions, 5 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.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; + } } } |