diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2006-10-04 19:33:51 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-10 05:50:45 -0500 |
commit | 902fc997adb7b917e1bd06ad6f2f0d38aa482578 (patch) | |
tree | a9381a0bda3996fa5631c659b7c87d8c2ea45f1b /drivers/media/video | |
parent | 45a9b83fe4cf91b13900dc665f526f7fd94d484c (diff) |
V4L/DVB (4722): Cx88: Add support for VIDIOC_INT_[SR]_REGISTER ioctls
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>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 90e298d074d1..f27312189d79 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1490,6 +1490,30 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1490 | mutex_unlock(&core->lock); | 1490 | mutex_unlock(&core->lock); |
1491 | return 0; | 1491 | return 0; |
1492 | } | 1492 | } |
1493 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1494 | /* ioctls to allow direct acces to the cx2388x registers */ | ||
1495 | case VIDIOC_INT_G_REGISTER: | ||
1496 | { | ||
1497 | struct v4l2_register *reg = arg; | ||
1498 | |||
1499 | if (reg->i2c_id != 0) | ||
1500 | return -EINVAL; | ||
1501 | /* cx2388x has a 24-bit register space */ | ||
1502 | reg->val = cx_read(reg->reg&0xffffff); | ||
1503 | return 0; | ||
1504 | } | ||
1505 | case VIDIOC_INT_S_REGISTER: | ||
1506 | { | ||
1507 | struct v4l2_register *reg = arg; | ||
1508 | |||
1509 | if (reg->i2c_id != 0) | ||
1510 | return -EINVAL; | ||
1511 | if (!capable(CAP_SYS_ADMIN)) | ||
1512 | return -EPERM; | ||
1513 | cx_write(reg->reg&0xffffff, reg->val); | ||
1514 | return 0; | ||
1515 | } | ||
1516 | #endif | ||
1493 | 1517 | ||
1494 | default: | 1518 | default: |
1495 | return v4l_compat_translate_ioctl(inode,file,cmd,arg, | 1519 | return v4l_compat_translate_ioctl(inode,file,cmd,arg, |