summaryrefslogtreecommitdiff
path: root/drivers/media/video/em28xx/em28xx-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-12-22 13:18:27 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 09:39:27 -0200
commit531c98e71805b32e9ea35a218119100bbd2b7615 (patch)
tree548f878b2d4abd66bee8d0fa0b19eeb9cf3182c9 /drivers/media/video/em28xx/em28xx-video.c
parent4b00eb25340c1a9b9eedaf0bc5b0f0d18eddb028 (diff)
V4L/DVB (9953): em28xx: Add suport for debugging AC97 anciliary chips
The em28xx driver can be coupled to an anciliary AC97 chip. This patch allows read/write AC97 registers directly. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 4701b6589b10..4ea4920c927a 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1221,6 +1221,17 @@ static int vidioc_g_register(struct file *file, void *priv,
struct em28xx *dev = fh->dev;
int ret;
+ if (reg->match_type == V4L2_CHIP_MATCH_AC97) {
+ mutex_lock(&dev->lock);
+ ret = em28xx_read_ac97(dev, reg->reg);
+ mutex_unlock(&dev->lock);
+ if (ret < 0)
+ return ret;
+
+ reg->val = ret;
+ return 0;
+ }
+
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
return -EINVAL;
@@ -1256,6 +1267,14 @@ static int vidioc_s_register(struct file *file, void *priv,
__le64 buf;
int rc;
+ if (reg->match_type == V4L2_CHIP_MATCH_AC97) {
+ mutex_lock(&dev->lock);
+ rc = em28xx_write_ac97(dev, reg->reg, reg->val);
+ mutex_unlock(&dev->lock);
+
+ return rc;
+ }
+
buf = cpu_to_le64(reg->val);
mutex_lock(&dev->lock);