aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-04-08 11:59:52 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-07 15:40:31 -0400
commit55afeb8a4d3ffdf8de546d5de37aca5b229ca9a4 (patch)
treec2faa161e1265e81e57c9ba66360005869d43699 /drivers
parentb4012002f3a3983ba2797fde1613691d7f287048 (diff)
[media] uvcvideo: Properly report the inactive flag for inactive controls
Note the unused in this patch slave_ids addition to the mappings will get used in a follow up patch to generate control change events for the slave ctrls when their flags change due to the master control changing value. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/uvc/uvc_ctrl.c33
-rw-r--r--drivers/media/video/uvc/uvcvideo.h4
2 files changed, 37 insertions, 0 deletions
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
index f15a437e5861..ae7371f3a39e 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -421,6 +421,8 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
421 .offset = 0, 421 .offset = 0,
422 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 422 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
423 .data_type = UVC_CTRL_DATA_TYPE_SIGNED, 423 .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
424 .master_id = V4L2_CID_HUE_AUTO,
425 .master_manual = 0,
424 }, 426 },
425 { 427 {
426 .id = V4L2_CID_SATURATION, 428 .id = V4L2_CID_SATURATION,
@@ -493,6 +495,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
493 .offset = 0, 495 .offset = 0,
494 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 496 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
495 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN, 497 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
498 .slave_ids = { V4L2_CID_HUE, },
496 }, 499 },
497 { 500 {
498 .id = V4L2_CID_EXPOSURE_AUTO, 501 .id = V4L2_CID_EXPOSURE_AUTO,
@@ -505,6 +508,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
505 .data_type = UVC_CTRL_DATA_TYPE_BITMASK, 508 .data_type = UVC_CTRL_DATA_TYPE_BITMASK,
506 .menu_info = exposure_auto_controls, 509 .menu_info = exposure_auto_controls,
507 .menu_count = ARRAY_SIZE(exposure_auto_controls), 510 .menu_count = ARRAY_SIZE(exposure_auto_controls),
511 .slave_ids = { V4L2_CID_EXPOSURE_ABSOLUTE, },
508 }, 512 },
509 { 513 {
510 .id = V4L2_CID_EXPOSURE_AUTO_PRIORITY, 514 .id = V4L2_CID_EXPOSURE_AUTO_PRIORITY,
@@ -525,6 +529,8 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
525 .offset = 0, 529 .offset = 0,
526 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 530 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
527 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, 531 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
532 .master_id = V4L2_CID_EXPOSURE_AUTO,
533 .master_manual = V4L2_EXPOSURE_MANUAL,
528 }, 534 },
529 { 535 {
530 .id = V4L2_CID_AUTO_WHITE_BALANCE, 536 .id = V4L2_CID_AUTO_WHITE_BALANCE,
@@ -535,6 +541,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
535 .offset = 0, 541 .offset = 0,
536 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 542 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
537 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN, 543 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
544 .slave_ids = { V4L2_CID_WHITE_BALANCE_TEMPERATURE, },
538 }, 545 },
539 { 546 {
540 .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE, 547 .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE,
@@ -545,6 +552,8 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
545 .offset = 0, 552 .offset = 0,
546 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 553 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
547 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, 554 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
555 .master_id = V4L2_CID_AUTO_WHITE_BALANCE,
556 .master_manual = 0,
548 }, 557 },
549 { 558 {
550 .id = V4L2_CID_AUTO_WHITE_BALANCE, 559 .id = V4L2_CID_AUTO_WHITE_BALANCE,
@@ -555,6 +564,8 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
555 .offset = 0, 564 .offset = 0,
556 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 565 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
557 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN, 566 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
567 .slave_ids = { V4L2_CID_BLUE_BALANCE,
568 V4L2_CID_RED_BALANCE },
558 }, 569 },
559 { 570 {
560 .id = V4L2_CID_BLUE_BALANCE, 571 .id = V4L2_CID_BLUE_BALANCE,
@@ -565,6 +576,8 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
565 .offset = 0, 576 .offset = 0,
566 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 577 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
567 .data_type = UVC_CTRL_DATA_TYPE_SIGNED, 578 .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
579 .master_id = V4L2_CID_AUTO_WHITE_BALANCE,
580 .master_manual = 0,
568 }, 581 },
569 { 582 {
570 .id = V4L2_CID_RED_BALANCE, 583 .id = V4L2_CID_RED_BALANCE,
@@ -575,6 +588,8 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
575 .offset = 16, 588 .offset = 16,
576 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 589 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
577 .data_type = UVC_CTRL_DATA_TYPE_SIGNED, 590 .data_type = UVC_CTRL_DATA_TYPE_SIGNED,
591 .master_id = V4L2_CID_AUTO_WHITE_BALANCE,
592 .master_manual = 0,
578 }, 593 },
579 { 594 {
580 .id = V4L2_CID_FOCUS_ABSOLUTE, 595 .id = V4L2_CID_FOCUS_ABSOLUTE,
@@ -585,6 +600,8 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
585 .offset = 0, 600 .offset = 0,
586 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 601 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
587 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, 602 .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED,
603 .master_id = V4L2_CID_FOCUS_AUTO,
604 .master_manual = 0,
588 }, 605 },
589 { 606 {
590 .id = V4L2_CID_FOCUS_AUTO, 607 .id = V4L2_CID_FOCUS_AUTO,
@@ -595,6 +612,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
595 .offset = 0, 612 .offset = 0,
596 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 613 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
597 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN, 614 .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN,
615 .slave_ids = { V4L2_CID_FOCUS_ABSOLUTE, },
598 }, 616 },
599 { 617 {
600 .id = V4L2_CID_IRIS_ABSOLUTE, 618 .id = V4L2_CID_IRIS_ABSOLUTE,
@@ -943,6 +961,8 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
943 struct uvc_control_mapping *mapping, 961 struct uvc_control_mapping *mapping,
944 struct v4l2_queryctrl *v4l2_ctrl) 962 struct v4l2_queryctrl *v4l2_ctrl)
945{ 963{
964 struct uvc_control_mapping *master_map = NULL;
965 struct uvc_control *master_ctrl = NULL;
946 struct uvc_menu_info *menu; 966 struct uvc_menu_info *menu;
947 unsigned int i; 967 unsigned int i;
948 968
@@ -957,6 +977,19 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
957 if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR)) 977 if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR))
958 v4l2_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; 978 v4l2_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
959 979
980 if (mapping->master_id)
981 __uvc_find_control(ctrl->entity, mapping->master_id,
982 &master_map, &master_ctrl, 0);
983 if (master_ctrl && (master_ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR)) {
984 s32 val;
985 int ret = __uvc_ctrl_get(chain, master_ctrl, master_map, &val);
986 if (ret < 0)
987 return ret;
988
989 if (val != mapping->master_manual)
990 v4l2_ctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
991 }
992
960 if (!ctrl->cached) { 993 if (!ctrl->cached) {
961 int ret = uvc_ctrl_populate_cache(chain, ctrl); 994 int ret = uvc_ctrl_populate_cache(chain, ctrl);
962 if (ret < 0) 995 if (ret < 0)
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
index e43deb715d98..777bb7505f8d 100644
--- a/drivers/media/video/uvc/uvcvideo.h
+++ b/drivers/media/video/uvc/uvcvideo.h
@@ -172,6 +172,10 @@ struct uvc_control_mapping {
172 struct uvc_menu_info *menu_info; 172 struct uvc_menu_info *menu_info;
173 __u32 menu_count; 173 __u32 menu_count;
174 174
175 __u32 master_id;
176 __s32 master_manual;
177 __u32 slave_ids[2];
178
175 __s32 (*get) (struct uvc_control_mapping *mapping, __u8 query, 179 __s32 (*get) (struct uvc_control_mapping *mapping, __u8 query,
176 const __u8 *data); 180 const __u8 *data);
177 void (*set) (struct uvc_control_mapping *mapping, __s32 value, 181 void (*set) (struct uvc_control_mapping *mapping, __s32 value,