The patch number 9955 was added via Mauro Carvalho Chehab <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [email protected]

------

From: Mauro Carvalho Chehab  <[email protected]>
v4l2-dbg: Add support for get/set ac97 registers


em28xx devices can have an ac97 anciliary chip. This patch allows
get/set ac97 registers

Signed-off-by: Mauro Carvalho Chehab <[email protected]>


---

 v4l2-apps/util/v4l2-dbg-ac97.h |   67 +++++++++++++++++++++++++++++++++
 v4l2-apps/util/v4l2-dbg.cpp    |   23 ++++++++---
 2 files changed, 85 insertions(+), 5 deletions(-)

diff -r be3eef47aced -r 24fbe483b42c v4l2-apps/util/v4l2-dbg-ac97.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/v4l2-apps/util/v4l2-dbg-ac97.h    Mon Dec 22 15:06:33 2008 -0200
@@ -0,0 +1,67 @@
+/*
+    Copyright (C) 2008 Mauro Carvalho Chehab <[email protected]>
+    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 -r be3eef47aced -r 24fbe483b42c v4l2-apps/util/v4l2-dbg.cpp
--- a/v4l2-apps/util/v4l2-dbg.cpp       Mon Dec 22 14:49:07 2008 -0200
+++ b/v4l2-apps/util/v4l2-dbg.cpp       Mon Dec 22 15:06:33 2008 -0200
@@ -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;
+                       }
                }
        }
 


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/24fbe483b42c3059b9ed39701fb0e9ea79f3a39c

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to