]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (4722): Cx88: Add support for VIDIOC_INT_[SR]_REGISTER ioctls
authorTrent Piepho <xyzzy@speakeasy.org>
Wed, 4 Oct 2006 23:33:51 +0000 (20:33 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 10 Dec 2006 10:50:45 +0000 (08:50 -0200)
Add support for the advanced debugging ioctls, to allow access to the
cx88 registers from userspace.  Only i2c_id == 0 is supported, for access
to the cx88 adapter itself.  There isn't any support for access to I2C
clients of the adapter.  Most of them don't have R/W registers anyway,
and its necessary to use i2c-dev to talk to them from userspace.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/cx88/cx88-video.c

index 90e298d074d11f688f825bb9986426569546586a..f27312189d79273d477a406f8b4724fbcde7771b 100644 (file)
@@ -1490,6 +1490,30 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio,
                mutex_unlock(&core->lock);
                return 0;
        }
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+       /* ioctls to allow direct acces to the cx2388x registers */
+       case VIDIOC_INT_G_REGISTER:
+       {
+               struct v4l2_register *reg = arg;
+
+               if (reg->i2c_id != 0)
+                       return -EINVAL;
+               /* cx2388x has a 24-bit register space */
+               reg->val = cx_read(reg->reg&0xffffff);
+               return 0;
+       }
+       case VIDIOC_INT_S_REGISTER:
+       {
+               struct v4l2_register *reg = arg;
+
+               if (reg->i2c_id != 0)
+                       return -EINVAL;
+               if (!capable(CAP_SYS_ADMIN))
+                       return -EPERM;
+               cx_write(reg->reg&0xffffff, reg->val);
+               return 0;
+       }
+#endif
 
        default:
                return v4l_compat_translate_ioctl(inode,file,cmd,arg,