diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-06-28 23:17:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 13:24:28 -0400 |
commit | 55c0d1005a0e5f590f71f918e49bdc81362f93a6 (patch) | |
tree | 36e073b5a65aa7bab934ff19c68fecb4c77b955d /drivers | |
parent | 8c2c0dfe4da28a152c0de2c2ca3a66c1bc2fef7c (diff) |
V4L/DVB (5807): Bttv: Add support for DBG_[SG]_REGISTER ioctls
Adds the advanced debugging register read/write ioctl support to the bttv
driver.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 284bdf2d2432..cb555f2c40f9 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2259,6 +2259,24 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | |||
2259 | printk(KERN_INFO "bttv%d: ================== END STATUS CARD #%d ==================\n", btv->c.nr, btv->c.nr); | 2259 | printk(KERN_INFO "bttv%d: ================== END STATUS CARD #%d ==================\n", btv->c.nr, btv->c.nr); |
2260 | return 0; | 2260 | return 0; |
2261 | } | 2261 | } |
2262 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
2263 | case VIDIOC_DBG_G_REGISTER: | ||
2264 | case VIDIOC_DBG_S_REGISTER: | ||
2265 | { | ||
2266 | struct v4l2_register *reg = arg; | ||
2267 | if (!capable(CAP_SYS_ADMIN)) | ||
2268 | return -EPERM; | ||
2269 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) | ||
2270 | return -EINVAL; | ||
2271 | /* bt848 has a 12-bit register space */ | ||
2272 | reg->reg &= 0xfff; | ||
2273 | if (cmd == VIDIOC_DBG_G_REGISTER) | ||
2274 | reg->val = btread(reg->reg); | ||
2275 | else | ||
2276 | btwrite(reg->val, reg->reg); | ||
2277 | return 0; | ||
2278 | } | ||
2279 | #endif | ||
2262 | 2280 | ||
2263 | default: | 2281 | default: |
2264 | return -ENOIOCTLCMD; | 2282 | return -ENOIOCTLCMD; |
@@ -3569,6 +3587,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
3569 | case VIDIOC_G_FREQUENCY: | 3587 | case VIDIOC_G_FREQUENCY: |
3570 | case VIDIOC_S_FREQUENCY: | 3588 | case VIDIOC_S_FREQUENCY: |
3571 | case VIDIOC_LOG_STATUS: | 3589 | case VIDIOC_LOG_STATUS: |
3590 | case VIDIOC_DBG_G_REGISTER: | ||
3591 | case VIDIOC_DBG_S_REGISTER: | ||
3572 | return bttv_common_ioctls(btv,cmd,arg); | 3592 | return bttv_common_ioctls(btv,cmd,arg); |
3573 | 3593 | ||
3574 | default: | 3594 | default: |
@@ -3951,6 +3971,8 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
3951 | case VIDIOCGAUDIO: | 3971 | case VIDIOCGAUDIO: |
3952 | case VIDIOCSAUDIO: | 3972 | case VIDIOCSAUDIO: |
3953 | case VIDIOC_LOG_STATUS: | 3973 | case VIDIOC_LOG_STATUS: |
3974 | case VIDIOC_DBG_G_REGISTER: | ||
3975 | case VIDIOC_DBG_S_REGISTER: | ||
3954 | return bttv_common_ioctls(btv,cmd,arg); | 3976 | return bttv_common_ioctls(btv,cmd,arg); |
3955 | 3977 | ||
3956 | default: | 3978 | default: |