Signed-off-by: Pawel Osciak <posc...@chromium.org>
---
 drivers/media/usb/uvc/uvc_ctrl.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index b0a19b9..a0493d6 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1550,6 +1550,24 @@ int uvc_ctrl_set(struct uvc_video_chain *chain, struct 
v4l2_ext_control *xctrl,
 
                break;
 
+       case V4L2_CTRL_TYPE_BITMASK:
+               value = xctrl->value;
+
+               /* If GET_RES is supported, it will return a bitmask of bits
+                * that can be set. If it isn't, allow any value.
+                */
+               if (ctrl->info.flags & UVC_CTRL_FLAG_GET_RES) {
+                       if (!ctrl->cached) {
+                               ret = uvc_ctrl_populate_cache(chain, ctrl);
+                               if (ret < 0)
+                                       return ret;
+                       }
+                       step = mapping->get(mapping, UVC_GET_RES,
+                                       uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES));
+                       if (value & ~step)
+                               return -ERANGE;
+               }
+
        default:
                value = xctrl->value;
                break;
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to