diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-05-16 08:24:06 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-08 22:43:04 -0400 |
commit | 11bbc1cadb638aaccb4764c6e16807b36b53cf19 (patch) | |
tree | 101be79d45abd28e30f5cc3ee6372004bf7880b9 /drivers/media/video/v4l2-ioctl.c | |
parent | a42b57f5aacf2b43f3e7931e8b9c609051839aa8 (diff) |
V4L/DVB: v4l2: hook up the new control framework into the core framework
Add the calls needed to automatically merge subdev controls into a bridge
control handler.
Hook up the control framework in __video_ioctl2 and video_register_device.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-ioctl.c')
-rw-r--r-- | drivers/media/video/v4l2-ioctl.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 0eeceae50329..dd9283fcb564 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #endif | 26 | #endif |
27 | #include <media/v4l2-common.h> | 27 | #include <media/v4l2-common.h> |
28 | #include <media/v4l2-ioctl.h> | 28 | #include <media/v4l2-ioctl.h> |
29 | #include <media/v4l2-ctrls.h> | ||
29 | #include <media/v4l2-fh.h> | 30 | #include <media/v4l2-fh.h> |
30 | #include <media/v4l2-event.h> | 31 | #include <media/v4l2-event.h> |
31 | #include <media/v4l2-chip-ident.h> | 32 | #include <media/v4l2-chip-ident.h> |
@@ -1259,9 +1260,12 @@ static long __video_do_ioctl(struct file *file, | |||
1259 | { | 1260 | { |
1260 | struct v4l2_queryctrl *p = arg; | 1261 | struct v4l2_queryctrl *p = arg; |
1261 | 1262 | ||
1262 | if (!ops->vidioc_queryctrl) | 1263 | if (vfd->ctrl_handler) |
1264 | ret = v4l2_queryctrl(vfd->ctrl_handler, p); | ||
1265 | else if (ops->vidioc_queryctrl) | ||
1266 | ret = ops->vidioc_queryctrl(file, fh, p); | ||
1267 | else | ||
1263 | break; | 1268 | break; |
1264 | ret = ops->vidioc_queryctrl(file, fh, p); | ||
1265 | if (!ret) | 1269 | if (!ret) |
1266 | dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, " | 1270 | dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, " |
1267 | "step=%d, default=%d, flags=0x%08x\n", | 1271 | "step=%d, default=%d, flags=0x%08x\n", |
@@ -1276,7 +1280,9 @@ static long __video_do_ioctl(struct file *file, | |||
1276 | { | 1280 | { |
1277 | struct v4l2_control *p = arg; | 1281 | struct v4l2_control *p = arg; |
1278 | 1282 | ||
1279 | if (ops->vidioc_g_ctrl) | 1283 | if (vfd->ctrl_handler) |
1284 | ret = v4l2_g_ctrl(vfd->ctrl_handler, p); | ||
1285 | else if (ops->vidioc_g_ctrl) | ||
1280 | ret = ops->vidioc_g_ctrl(file, fh, p); | 1286 | ret = ops->vidioc_g_ctrl(file, fh, p); |
1281 | else if (ops->vidioc_g_ext_ctrls) { | 1287 | else if (ops->vidioc_g_ext_ctrls) { |
1282 | struct v4l2_ext_controls ctrls; | 1288 | struct v4l2_ext_controls ctrls; |
@@ -1306,11 +1312,16 @@ static long __video_do_ioctl(struct file *file, | |||
1306 | struct v4l2_ext_controls ctrls; | 1312 | struct v4l2_ext_controls ctrls; |
1307 | struct v4l2_ext_control ctrl; | 1313 | struct v4l2_ext_control ctrl; |
1308 | 1314 | ||
1309 | if (!ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls) | 1315 | if (!vfd->ctrl_handler && |
1316 | !ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls) | ||
1310 | break; | 1317 | break; |
1311 | 1318 | ||
1312 | dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value); | 1319 | dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value); |
1313 | 1320 | ||
1321 | if (vfd->ctrl_handler) { | ||
1322 | ret = v4l2_s_ctrl(vfd->ctrl_handler, p); | ||
1323 | break; | ||
1324 | } | ||
1314 | if (ops->vidioc_s_ctrl) { | 1325 | if (ops->vidioc_s_ctrl) { |
1315 | ret = ops->vidioc_s_ctrl(file, fh, p); | 1326 | ret = ops->vidioc_s_ctrl(file, fh, p); |
1316 | break; | 1327 | break; |
@@ -1332,10 +1343,12 @@ static long __video_do_ioctl(struct file *file, | |||
1332 | struct v4l2_ext_controls *p = arg; | 1343 | struct v4l2_ext_controls *p = arg; |
1333 | 1344 | ||
1334 | p->error_idx = p->count; | 1345 | p->error_idx = p->count; |
1335 | if (!ops->vidioc_g_ext_ctrls) | 1346 | if (vfd->ctrl_handler) |
1336 | break; | 1347 | ret = v4l2_g_ext_ctrls(vfd->ctrl_handler, p); |
1337 | if (check_ext_ctrls(p, 0)) | 1348 | else if (ops->vidioc_g_ext_ctrls && check_ext_ctrls(p, 0)) |
1338 | ret = ops->vidioc_g_ext_ctrls(file, fh, p); | 1349 | ret = ops->vidioc_g_ext_ctrls(file, fh, p); |
1350 | else | ||
1351 | break; | ||
1339 | v4l_print_ext_ctrls(cmd, vfd, p, !ret); | 1352 | v4l_print_ext_ctrls(cmd, vfd, p, !ret); |
1340 | break; | 1353 | break; |
1341 | } | 1354 | } |
@@ -1344,10 +1357,12 @@ static long __video_do_ioctl(struct file *file, | |||
1344 | struct v4l2_ext_controls *p = arg; | 1357 | struct v4l2_ext_controls *p = arg; |
1345 | 1358 | ||
1346 | p->error_idx = p->count; | 1359 | p->error_idx = p->count; |
1347 | if (!ops->vidioc_s_ext_ctrls) | 1360 | if (!vfd->ctrl_handler && !ops->vidioc_s_ext_ctrls) |
1348 | break; | 1361 | break; |
1349 | v4l_print_ext_ctrls(cmd, vfd, p, 1); | 1362 | v4l_print_ext_ctrls(cmd, vfd, p, 1); |
1350 | if (check_ext_ctrls(p, 0)) | 1363 | if (vfd->ctrl_handler) |
1364 | ret = v4l2_s_ext_ctrls(vfd->ctrl_handler, p); | ||
1365 | else if (check_ext_ctrls(p, 0)) | ||
1351 | ret = ops->vidioc_s_ext_ctrls(file, fh, p); | 1366 | ret = ops->vidioc_s_ext_ctrls(file, fh, p); |
1352 | break; | 1367 | break; |
1353 | } | 1368 | } |
@@ -1356,10 +1371,12 @@ static long __video_do_ioctl(struct file *file, | |||
1356 | struct v4l2_ext_controls *p = arg; | 1371 | struct v4l2_ext_controls *p = arg; |
1357 | 1372 | ||
1358 | p->error_idx = p->count; | 1373 | p->error_idx = p->count; |
1359 | if (!ops->vidioc_try_ext_ctrls) | 1374 | if (!vfd->ctrl_handler && !ops->vidioc_try_ext_ctrls) |
1360 | break; | 1375 | break; |
1361 | v4l_print_ext_ctrls(cmd, vfd, p, 1); | 1376 | v4l_print_ext_ctrls(cmd, vfd, p, 1); |
1362 | if (check_ext_ctrls(p, 0)) | 1377 | if (vfd->ctrl_handler) |
1378 | ret = v4l2_try_ext_ctrls(vfd->ctrl_handler, p); | ||
1379 | else if (check_ext_ctrls(p, 0)) | ||
1363 | ret = ops->vidioc_try_ext_ctrls(file, fh, p); | 1380 | ret = ops->vidioc_try_ext_ctrls(file, fh, p); |
1364 | break; | 1381 | break; |
1365 | } | 1382 | } |
@@ -1367,9 +1384,12 @@ static long __video_do_ioctl(struct file *file, | |||
1367 | { | 1384 | { |
1368 | struct v4l2_querymenu *p = arg; | 1385 | struct v4l2_querymenu *p = arg; |
1369 | 1386 | ||
1370 | if (!ops->vidioc_querymenu) | 1387 | if (vfd->ctrl_handler) |
1388 | ret = v4l2_querymenu(vfd->ctrl_handler, p); | ||
1389 | else if (ops->vidioc_querymenu) | ||
1390 | ret = ops->vidioc_querymenu(file, fh, p); | ||
1391 | else | ||
1371 | break; | 1392 | break; |
1372 | ret = ops->vidioc_querymenu(file, fh, p); | ||
1373 | if (!ret) | 1393 | if (!ret) |
1374 | dbgarg(cmd, "id=0x%x, index=%d, name=%s\n", | 1394 | dbgarg(cmd, "id=0x%x, index=%d, name=%s\n", |
1375 | p->id, p->index, p->name); | 1395 | p->id, p->index, p->name); |