Add support for V4L2_CTRL_WHICH_MIN/MAX_VAL in uvc driver. It is useful for the V4L2_CID_UVC_REGION_OF_INTEREST_RECT control. Signed-off-by: Yunke Cao <yunkec@xxxxxxxxxx> --- drivers/media/usb/uvc/uvc_ctrl.c | 10 ++++++++++ drivers/media/usb/uvc/uvc_v4l2.c | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index c470861e408a..add82db4f6f8 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -1784,6 +1784,16 @@ int uvc_ctrl_get(struct uvc_video_chain *chain, id = UVC_CTRL_DATA_DEF; query = UVC_GET_DEF; break; + case V4L2_CTRL_WHICH_MIN_VAL: + flag = UVC_CTRL_FLAG_GET_MIN; + id = UVC_CTRL_DATA_MIN; + query = UVC_GET_MIN; + break; + case V4L2_CTRL_WHICH_MAX_VAL: + flag = UVC_CTRL_FLAG_GET_MAX; + id = UVC_CTRL_DATA_MAX; + query = UVC_GET_MAX; + break; case V4L2_CTRL_WHICH_CUR_VAL: default: return __uvc_ctrl_get(chain, ctrl, mapping, xctrl); diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 040511da1005..a88d3fe6de93 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -1038,7 +1038,9 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, if (ret < 0) return ret; - if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) { + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL || + ctrls->which == V4L2_CTRL_WHICH_MIN_VAL || + ctrls->which == V4L2_CTRL_WHICH_MAX_VAL) { for (i = 0; i < ctrls->count; ++ctrl, ++i) { ret = uvc_ctrl_get(chain, ctrl, ctrls->which); if (ret < 0) { -- 2.36.1.124.g0e6072fb45-goog