diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-03-18 12:24:05 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:30 -0400 |
commit | b794aabff01a704df5c0bcf6537e6a7343a08465 (patch) | |
tree | 41d8e60b09f33017bde5f5b4847688ec7caadc19 /drivers/media/video/ov7670.c | |
parent | ca07561ac70b00b5c2b5af727b3d0b6a4f91bee2 (diff) |
V4L/DVB (11117): ov7670: add support to get/set registers
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ov7670.c')
-rw-r--r-- | drivers/media/video/ov7670.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index ab245f71b195..0e2184ec994e 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c | |||
@@ -1180,6 +1180,36 @@ static int ov7670_g_chip_ident(struct v4l2_subdev *sd, | |||
1180 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_OV7670, 0); | 1180 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_OV7670, 0); |
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1184 | static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) | ||
1185 | { | ||
1186 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
1187 | unsigned char val = 0; | ||
1188 | int ret; | ||
1189 | |||
1190 | if (!v4l2_chip_match_i2c_client(client, ®->match)) | ||
1191 | return -EINVAL; | ||
1192 | if (!capable(CAP_SYS_ADMIN)) | ||
1193 | return -EPERM; | ||
1194 | ret = ov7670_read(sd, reg->reg & 0xff, &val); | ||
1195 | reg->val = val; | ||
1196 | reg->size = 1; | ||
1197 | return ret; | ||
1198 | } | ||
1199 | |||
1200 | static int ov7670_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) | ||
1201 | { | ||
1202 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
1203 | |||
1204 | if (!v4l2_chip_match_i2c_client(client, ®->match)) | ||
1205 | return -EINVAL; | ||
1206 | if (!capable(CAP_SYS_ADMIN)) | ||
1207 | return -EPERM; | ||
1208 | ov7670_write(sd, reg->reg & 0xff, reg->val & 0xff); | ||
1209 | return 0; | ||
1210 | } | ||
1211 | #endif | ||
1212 | |||
1183 | /* ----------------------------------------------------------------------- */ | 1213 | /* ----------------------------------------------------------------------- */ |
1184 | 1214 | ||
1185 | static const struct v4l2_subdev_core_ops ov7670_core_ops = { | 1215 | static const struct v4l2_subdev_core_ops ov7670_core_ops = { |
@@ -1189,6 +1219,10 @@ static const struct v4l2_subdev_core_ops ov7670_core_ops = { | |||
1189 | .queryctrl = ov7670_queryctrl, | 1219 | .queryctrl = ov7670_queryctrl, |
1190 | .reset = ov7670_reset, | 1220 | .reset = ov7670_reset, |
1191 | .init = ov7670_init, | 1221 | .init = ov7670_init, |
1222 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1223 | .g_register = ov7670_g_register, | ||
1224 | .s_register = ov7670_s_register, | ||
1225 | #endif | ||
1192 | }; | 1226 | }; |
1193 | 1227 | ||
1194 | static const struct v4l2_subdev_video_ops ov7670_video_ops = { | 1228 | static const struct v4l2_subdev_video_ops ov7670_video_ops = { |