From patchwork Fri Aug 23 12:37:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11111579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 522B71395 for ; Fri, 23 Aug 2019 12:37:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D65F22CE3 for ; Fri, 23 Aug 2019 12:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566563864; bh=/nwSoT5YkvJjEQlNT9mK/oEdbhGqNqP9uOLLL84vito=; h=From:To:Cc:Subject:Date:List-ID:From; b=g0F0fuA1NV0VhrnLfN11biWBnmj6RoBB/y5Qp1YAnfO+4Ah6yZo3aPDzWUTj/MTQF HBhR8QyvBWML6JDPjYRDL9WauEVjYgdOvOlEwdG/2ZskWtSLC+jrPyQa49ZzLAwo9O jLS909SkTul7b8F2tWN/tQh4kRTJO9gyVpqT2fpY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393284AbfHWMhn (ORCPT ); Fri, 23 Aug 2019 08:37:43 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:41378 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393115AbfHWMhn (ORCPT ); Fri, 23 Aug 2019 08:37:43 -0400 Received: by mail-ed1-f68.google.com with SMTP id w5so13243806edl.8; Fri, 23 Aug 2019 05:37:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OWIHsEFxbd6viy1HzbThnjNeOnGIj8nhcWEYFUF/scg=; b=KJ2NxrsV/cjaOrJ4xLetP6Fwh2neXBoyeU7qV8I9ZIFDyGfhi/fq01kfKm0aazqlL5 gGbZqJU1GgyNldIc4M+1FLA2oQltr5YJ3VygWlkduAIVDtmfZkKBDSS8XbgwiIO6gW5G oqf0A/NnmJt2shx/FC+syjT4ErFz05QpsORBjVZdxFX+zSEvALVB7IN3rLS8oLEKs+Ik fEr+2QHhWDX85mH9xz9DIKGhI3RXjk3FRedOZ03QlEqERiFt4Ei4mTvZ1GxsAfc171Jr Q7zyGKdSXEOG1B76AaSyiUmKuo1Ov2/baGMkcegf+x4lE4pLbkDMmdTWCegDOm9r4ujz AEvQ== X-Gm-Message-State: APjAAAWTlhBtuMoDuGTMfyM0yxSp+IJwn5OnfSgmXeuBq7H5uwjRrneV fdkf5k25nWRCiz9awA4rzgA= X-Google-Smtp-Source: APXvYqzChGaBPdJNhLF8XpfCj9Dnucp8Q5qr8sUtSIPTucdjdpLROsF6a/y7uM7lDqJCzi03uxfpSQ== X-Received: by 2002:a17:906:841a:: with SMTP id n26mr4030872ejx.181.1566563860258; Fri, 23 Aug 2019 05:37:40 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id 9sm389687ejw.63.2019.08.23.05.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 05:37:39 -0700 (PDT) From: Ricardo Ribalda Delgado To: Philipp Zabel , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi Cc: Ricardo Ribalda Delgado Subject: [PATCH v3 1/7] media: add V4L2_CID_UNIT_CELL_SIZE control Date: Fri, 23 Aug 2019 14:37:31 +0200 Message-Id: <20190823123737.7774-1-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This control returns the unit cell size in nanometres. The struct provides the width and the height in separated fields to take into consideration asymmetric pixels and/or hardware binning. This control is required for automatic calibration of sensors/cameras. Signed-off-by: Ricardo Ribalda Delgado Reviewed-by: Jacopo Mondi --- v3: -Put together all actions on ctrl_fill -Move the control to IMAGE_SOURCE drivers/media/v4l2-core/v4l2-ctrls.c | 11 +++++++++++ include/media/v4l2-ctrls.h | 2 ++ include/uapi/linux/v4l2-controls.h | 1 + include/uapi/linux/videodev2.h | 11 +++++++++++ 4 files changed, 25 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 1d8f38824631..b3bf458df7f7 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -994,6 +994,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_AUTO_FOCUS_RANGE: return "Auto Focus, Range"; case V4L2_CID_PAN_SPEED: return "Pan, Speed"; case V4L2_CID_TILT_SPEED: return "Tilt, Speed"; + case V4L2_CID_UNIT_CELL_SIZE: return "Unit Cell Size"; /* FM Radio Modulator controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1375,6 +1376,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER: *type = V4L2_CTRL_TYPE_VP8_FRAME_HEADER; break; + case V4L2_CID_UNIT_CELL_SIZE: + *type = V4L2_CTRL_TYPE_AREA; + *flags |= V4L2_CTRL_FLAG_READ_ONLY; + break; default: *type = V4L2_CTRL_TYPE_INTEGER; break; @@ -1723,6 +1728,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, case V4L2_CTRL_TYPE_FWHT_PARAMS: break; + case V4L2_CTRL_TYPE_AREA: + break; + case V4L2_CTRL_TYPE_H264_SPS: case V4L2_CTRL_TYPE_H264_PPS: case V4L2_CTRL_TYPE_H264_SCALING_MATRIX: @@ -2421,6 +2429,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_VP8_FRAME_HEADER: elem_size = sizeof(struct v4l2_ctrl_vp8_frame_header); break; + case V4L2_CTRL_TYPE_AREA: + elem_size = sizeof(struct v4l2_area); + break; default: if (type < V4L2_CTRL_COMPOUND_TYPES) elem_size = sizeof(s32); diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 570ff4b0205a..9a3d11350e67 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -50,6 +50,7 @@ struct poll_table_struct; * @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params. * @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params. * @p_vp8_frame_header: Pointer to a VP8 frame header structure. + * @p_area: Pointer to an area. * @p: Pointer to a compound value. */ union v4l2_ctrl_ptr { @@ -68,6 +69,7 @@ union v4l2_ctrl_ptr { struct v4l2_ctrl_h264_slice_params *p_h264_slice_params; struct v4l2_ctrl_h264_decode_params *p_h264_decode_params; struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; + struct v4l2_area *p_area; void *p; }; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index a2669b79b294..5a7bedee2b0e 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1034,6 +1034,7 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_CID_TEST_PATTERN_GREENR (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 5) #define V4L2_CID_TEST_PATTERN_BLUE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6) #define V4L2_CID_TEST_PATTERN_GREENB (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7) +#define V4L2_CID_UNIT_CELL_SIZE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 8) /* Image processing controls */ diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 530638dffd93..05cfc69d7ed6 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -422,6 +422,11 @@ struct v4l2_fract { __u32 denominator; }; +struct v4l2_area { + __u32 width; + __u32 height; +}; + /** * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP * @@ -1720,6 +1725,12 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_U8 = 0x0100, V4L2_CTRL_TYPE_U16 = 0x0101, V4L2_CTRL_TYPE_U32 = 0x0102, + /* + * V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS = 0x0103, + * V4L2_CTRL_TYPE_MPEG2_QUANTIZATION = 0x0104, + * V4L2_CTRL_TYPE_FWHT_PARAMS = 0x0105, + */ + V4L2_CTRL_TYPE_AREA = 0x0106, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ From patchwork Fri Aug 23 12:37:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11111581 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8892F112C for ; Fri, 23 Aug 2019 12:37:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66AC92173E for ; Fri, 23 Aug 2019 12:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566563867; bh=aP9woZEoPR7FvIVcgsFzJy05ExhBzCwde8grlba9kVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NBq+fjLjW7/xeUhV/pHdbvm0xn+J3vweBnmOFYLO4LXOOK4v19m3jWH3bqexH7UGu ie+2Jds+pVjjWO7vOraPVNPd8ELYZ/d5zwSLUk44IkhixcYVtsisSPm8umED2aEh19 N1vlDLfXKSDUUNtnbKDTkTR9xjO0Mz8tQh/8iRh0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394775AbfHWMhq (ORCPT ); Fri, 23 Aug 2019 08:37:46 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43520 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393138AbfHWMhn (ORCPT ); Fri, 23 Aug 2019 08:37:43 -0400 Received: by mail-ed1-f66.google.com with SMTP id h13so13220691edq.10; Fri, 23 Aug 2019 05:37:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p40xZMYAGYpetJdqBVpyW48sl5czw5pPkLwRvzd6Eo0=; b=g5rAUfXvWCrQsGEI2z5cyJXJrxVqgHfEuTpSF2Y7wZdUdYwWn3csN8vkahPHoqXYrH GdC7J9ZOfl8jDba1Am74pX+cB13jdb0/i7762S9qK1rKyDEJ0fnFw+lX4XtZAYMDkDuS uHTkPqS9tTNk9pxJb1ZlZUHNL0WGZEvYL/QFYCZuPxcY/zNM+YOYvdZmkOppcC3BO0g/ BrdrHzizS3Yb4uD8rYtO41U/H/gHZOYRpjUW11JByANvLdK0H90qNGUt/dWOl8CHEPKe XjF1LWeQnIsLt5Zh+UduogIzIkTzxIsmbWIGd6HehbTOk5wLww7lKqPDiQvDOZI3LQWq htRQ== X-Gm-Message-State: APjAAAWkLCt7OesQhalpXhoPQ0UWWcrfz2eFCVWmiMjZgcTUZXJEfwuY 6JG2nJSUTYx4YK/Mji/Xp0kmddnWnYI= X-Google-Smtp-Source: APXvYqzNQyPgUGP6zQrCxQ/Iq3KBmyKIyrEE4w272s0y3u8FHY/6I54q/+Lb4Z2Fae9kLys4A066ug== X-Received: by 2002:a17:906:6d5a:: with SMTP id a26mr3942766ejt.97.1566563862119; Fri, 23 Aug 2019 05:37:42 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id 9sm389687ejw.63.2019.08.23.05.37.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 05:37:40 -0700 (PDT) From: Ricardo Ribalda Delgado To: Philipp Zabel , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi Cc: Ricardo Ribalda Delgado Subject: [PATCH v3 2/7] Documentation: media: Describe V4L2_CID_UNIT_CELL_SIZE Date: Fri, 23 Aug 2019 14:37:32 +0200 Message-Id: <20190823123737.7774-2-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190823123737.7774-1-ribalda@kernel.org> References: <20190823123737.7774-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org New control to pass to userspace the width/height of a pixel. Which is needed for calibration and lens selection. Signed-off-by: Ricardo Ribalda Delgado --- Documentation/media/uapi/v4l/ext-ctrls-image-source.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/media/uapi/v4l/ext-ctrls-image-source.rst b/Documentation/media/uapi/v4l/ext-ctrls-image-source.rst index 2c3ab5796d76..6e728accf67b 100644 --- a/Documentation/media/uapi/v4l/ext-ctrls-image-source.rst +++ b/Documentation/media/uapi/v4l/ext-ctrls-image-source.rst @@ -55,3 +55,11 @@ Image Source Control IDs ``V4L2_CID_TEST_PATTERN_GREENB (integer)`` Test pattern green (next to blue) colour component. + +``V4L2_CID_UNIT_CELL_SIZE (struct)`` + This control returns the unit cell size in nanometres. The struct provides + the width and the height in separated fields to take into consideration + asymmetric pixels and/or hardware binning. + The unit cell consists of the whole area of the pixel, sensitive and + non-sensitive. + This control is required for automatic calibration sensors/cameras. From patchwork Fri Aug 23 12:37:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11111595 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80684112C for ; Fri, 23 Aug 2019 12:38:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DCB22173E for ; Fri, 23 Aug 2019 12:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566563900; bh=M6s7Kh+FCW1xFY18pObgGWDhfbn3Y4+TQL2ToNtjFWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rshSV2KBQ8firrqh+vJQU8GZCDgCPI1pWeZACjJbd7h7DzNhCxlufngtkQPch5yXe 95Y14HADDZlfJPxSk0/71j1o4llh7pOxCeUA4sBR6j0MW3YP4JyAogO4YjuGvGhfvr bulL4pJalzsUgUzKZ3wf9AdwuHC7PVwU+B3iC/CQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394826AbfHWMiQ (ORCPT ); Fri, 23 Aug 2019 08:38:16 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:37123 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393115AbfHWMhp (ORCPT ); Fri, 23 Aug 2019 08:37:45 -0400 Received: by mail-ed1-f65.google.com with SMTP id f22so13261381edt.4; Fri, 23 Aug 2019 05:37:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TQDKuRwKWXsE4cqCDj1O7R1+PybASpMYa+6ozs2PYn0=; b=e+ek23PECyqBD1bW7FHYyiLQQAQiYSuSfQ/lqQ9dCi72Wq7HpSVW85ePNxr8ReQCkY OPpwxIH+ojCwmIIZOKp3KoP+kn9NN9EflNOKN8e4B0DiNoQGby+k4HRnKX/pRJPejwaC qkTnl31qbgkPH851H5TB04VQ75T2/p7SYZIH6xvzP4XAwHYye1tUxKzO2vzCEK6wCOkb mc5kyq4oQLUYVahrEWrerYyL+hwOSGVVEmsNLMfuzoVIXJ7lLhGwZLiRyn6ngm96bH8N ypw2hxFF/wNfHhVcJR1RSi6mMfqsRRIE/BVWioWyjvWCKMzt7rD5CVWhBJMysz7TP2Ly ZkcA== X-Gm-Message-State: APjAAAV8RGuc8m8LE4dxboVpQKEKERkr9m9Vnr8qPPN3fEZKCFzFM79y f6kwZGoybeMZFS6QI62m2CM= X-Google-Smtp-Source: APXvYqyhg+pbF2r8JVvzlfziGDuaIUOwdnhvJneGPjM77WmKPH/8Unv6pAwYfE123Sfva7Jm0QuqSA== X-Received: by 2002:aa7:d397:: with SMTP id x23mr4100673edq.11.1566563863837; Fri, 23 Aug 2019 05:37:43 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id 9sm389687ejw.63.2019.08.23.05.37.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 05:37:42 -0700 (PDT) From: Ricardo Ribalda Delgado To: Philipp Zabel , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi Cc: Ricardo Ribalda Delgado Subject: [PATCH v3 3/7] Documentation: media: Document V4L2_CTRL_TYPE_AREA Date: Fri, 23 Aug 2019 14:37:33 +0200 Message-Id: <20190823123737.7774-3-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190823123737.7774-1-ribalda@kernel.org> References: <20190823123737.7774-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org A struct v4l2_area containing the width and the height of a rectangular area. Signed-off-by: Ricardo Ribalda Delgado Suggested-by: Hans Verkuil --- Documentation/media/uapi/v4l/vidioc-queryctrl.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index a3d56ffbf4cc..c09d06ef2b08 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -443,6 +443,12 @@ See also the examples in :ref:`control`. - n/a - A struct :c:type:`v4l2_ctrl_mpeg2_quantization`, containing MPEG-2 quantization matrices for stateless video decoders. + * - ``V4L2_CTRL_TYPE_AREA`` + - n/a + - n/a + - n/a + - A struct :c:type:`v4l2_area`, containing the width and the height + of a rectangular area. * - ``V4L2_CTRL_TYPE_H264_SPS`` - n/a - n/a From patchwork Fri Aug 23 12:37:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11111591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62DCD1395 for ; Fri, 23 Aug 2019 12:38:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4092721848 for ; Fri, 23 Aug 2019 12:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566563891; bh=8F1t8oqfj5gxhAo6yR6MvajYWf9rB2vs+sJzzlrxfZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sjDYWIknGOT6iGl5jPYO0/rv8WR1eDIxUdrySFo89oOEjnuyVC1F4NRKwq12A1GIG PMR4W7n/ujMVTvBS8tf5qDndqgrCjuF7WPhWxXT4JmtFDIJvlU0A5bn9JqwYtA83Eo R4eTYoTN5NquNFz3no3DC5OOE813M43X6Cog9gFw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394786AbfHWMht (ORCPT ); Fri, 23 Aug 2019 08:37:49 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:43530 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394773AbfHWMhr (ORCPT ); Fri, 23 Aug 2019 08:37:47 -0400 Received: by mail-ed1-f68.google.com with SMTP id h13so13220923edq.10; Fri, 23 Aug 2019 05:37:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F4LOpR2+qDGG/nyT8CDQzwfIkNx8dPONyLIfkWrwXb0=; b=VZolX3HOVaZtnd8rm0lG/PVVSirbjHDNSa+wtQmYvbCMhiDFdOPWFMUvs4xoocHBGA 3ZPHMhtwa486dNQnSdJXlFlgll8OT61AjH0eJ8DijNF8OiUUxaYpnaZwAem1j7gEN7Ca waRk7eCYp7Ea03g4lQcVgeym0fEj6XFs3MFV8j3nf0Tt5EFfPRia33ErPqpv+2tMZuk5 +BBu34377+LwiQI785oMCN8ZLgAvwZ0a3VkXunvwjfEHh9JkZ4Tg0FYeFBljxT4CZ9y9 Ei15HgWYz1lnts8ODveP1WSJ62cb0uymD9felMikweZSe9zRblzWYxSssElKgXZQKaKW iKHQ== X-Gm-Message-State: APjAAAUT9O1MFt0IzFgBGmsiJQ+s78sr0r4X3zPDuLmSTvZQkupaXa3F 3/2KhLDeWjWc/ENV1b+e4qs= X-Google-Smtp-Source: APXvYqyQcg0tQkqTfgr4NABXJXIB9EaBGO/TqQaLu/B1uyEWgDHoR+PkcD+hocVgEafBcowrUGQBSg== X-Received: by 2002:a17:906:161b:: with SMTP id m27mr3925225ejd.203.1566563865377; Fri, 23 Aug 2019 05:37:45 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id 9sm389687ejw.63.2019.08.23.05.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 05:37:44 -0700 (PDT) From: Ricardo Ribalda Delgado To: Philipp Zabel , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi Cc: Ricardo Ribalda Delgado Subject: [PATCH v3 4/7] media: imx214: Add new control with V4L2_CID_UNIT_CELL_SIZE Date: Fri, 23 Aug 2019 14:37:34 +0200 Message-Id: <20190823123737.7774-4-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190823123737.7774-1-ribalda@kernel.org> References: <20190823123737.7774-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org According to the product brief, the unit cell size is 1120 nanometers^2. https://www.sony-semicon.co.jp/products_en/IS/sensor1/img/products/ProductBrief_IMX214_20150428.pdf Signed-off-by: Ricardo Ribalda Delgado --- drivers/media/i2c/imx214.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index 159a3a604f0e..cc0a013ba7da 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -47,6 +47,7 @@ struct imx214 { struct v4l2_ctrl *pixel_rate; struct v4l2_ctrl *link_freq; struct v4l2_ctrl *exposure; + struct v4l2_ctrl *unit_size; struct regulator_bulk_data supplies[IMX214_NUM_SUPPLIES]; @@ -941,6 +942,26 @@ static int __maybe_unused imx214_resume(struct device *dev) return ret; } +static void unit_size_init(const struct v4l2_ctrl *ctrl, u32 idx, + union v4l2_ctrl_ptr ptr) +{ + ptr.p_area->width = 1120; + ptr.p_area->height = 1120; +} + +static const struct v4l2_ctrl_type_ops unit_size_ops = { + .init = unit_size_init, +}; + +static struct v4l2_ctrl *new_unit_size_ctrl(struct v4l2_ctrl_handler *handler) +{ + static struct v4l2_ctrl_config ctrl = { + .id = V4L2_CID_UNIT_CELL_SIZE, + .type_ops = &unit_size_ops, + }; + + return v4l2_ctrl_new_custom(handler, &ctrl, NULL); +} static int imx214_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -1029,6 +1050,8 @@ static int imx214_probe(struct i2c_client *client) V4L2_CID_EXPOSURE, 0, 3184, 1, 0x0c70); + imx214->unit_size = new_unit_size_ctrl(&imx214->ctrls); + ret = imx214->ctrls.error; if (ret) { dev_err(&client->dev, "%s control init failed (%d)\n", From patchwork Fri Aug 23 12:37:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11111585 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69AA41813 for ; Fri, 23 Aug 2019 12:37:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47A8A2173E for ; Fri, 23 Aug 2019 12:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566563872; bh=Rn7CuP888E1SCMdbmHFNYxD3EGmOLS/JH4UHYMO1e9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=aK3SNdyrYTwersXwlqgC0u9wDsqu8729p0SFJ4MiSQajaPAvKJf+Jf6VwW5rY9vjq pcXQ6OfjHzEXmMVV61RxU9RiCeRDF57iMO9vSya2zxwiFtVl0VAN8Z+CwJ4CkjdkuJ +/kHu4Kt+gpZP2Gt9WtCKsYOJfkod431LgTlNJWQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394789AbfHWMhu (ORCPT ); Fri, 23 Aug 2019 08:37:50 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:41397 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394779AbfHWMht (ORCPT ); Fri, 23 Aug 2019 08:37:49 -0400 Received: by mail-ed1-f67.google.com with SMTP id w5so13244265edl.8; Fri, 23 Aug 2019 05:37:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xw4AZk4fykI6qkAZg1PCh0T3vV4z+/PeKUb/Xrhl7f0=; b=UY0PvlQrCVVjWfqF66V374i6Y/zkovX2ezvWIMKfZDOTI1JcehA9UBp6PuIYKgMf/Y I1AFuhMZLr48dHgeJ8+1Bh6ld95aznWIYR2RAw62iZNUlJyecz7cSzMWQdsDWXwGBKJP jKo79wnbJfVjpJkCTIoYFk4Ct2GTiGpiDRg1KpQ8YSlS2ngWOWJXfmwsFz/IWWmaDU40 QONNFv8rJuEqARQD/xzdJz71udHeTOIrI276LDTZMfaH0ci84+vVNauvexAUcnRnxP6Z wGqFFYuqmIUMRDj/nlA6WKm49k4SaeSxIlKdn2qH7vOMiffLBu2gZRQZ12ibM1TBVr/5 4ZFQ== X-Gm-Message-State: APjAAAWOPtTHqURyIpWYUA/5MFoXdfulhyaGjwIirIYNpxHvHKtIpB2a +p1V/kVFOYU1dinJoPnUbgg= X-Google-Smtp-Source: APXvYqw598HsSm5ntWSZXKJyQtF6NFe8bZoiCnH5oIXVzpYLmyf6KfXHQcXllJn5xNPC4BJquRG2gg== X-Received: by 2002:a50:c19a:: with SMTP id m26mr4122805edf.184.1566563867089; Fri, 23 Aug 2019 05:37:47 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id 9sm389687ejw.63.2019.08.23.05.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 05:37:46 -0700 (PDT) From: Ricardo Ribalda Delgado To: Philipp Zabel , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi Cc: Ricardo Ribalda Delgado Subject: [PATCH v3 5/7] media: v4l2-core: Add new helper for area controls Date: Fri, 23 Aug 2019 14:37:35 +0200 Message-Id: <20190823123737.7774-5-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190823123737.7774-1-ribalda@kernel.org> References: <20190823123737.7774-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Adding a V4L2_CID_UNIT_CELL_SIZE control requires a lot of boilerplate, try to minimize it by adding a new helper. Suggested-by: Philipp Zabel Signed-off-by: Ricardo Ribalda Delgado Reviewed-by: Philipp Zabel Reviewed-by: Jacopo Mondi --- drivers/media/v4l2-core/v4l2-ctrls.c | 25 ++++++++++++++++++++++++- include/media/v4l2-ctrls.h | 16 ++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index b3bf458df7f7..33e48f0aec1a 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -2660,7 +2660,6 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl, } EXPORT_SYMBOL(v4l2_ctrl_new_std_menu_items); -/* Helper function for standard integer menu controls */ struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, const struct v4l2_ctrl_ops *ops, u32 id, u8 _max, u8 _def, const s64 *qmenu_int) @@ -2684,6 +2683,30 @@ struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, } EXPORT_SYMBOL(v4l2_ctrl_new_int_menu); +static void area_init(const struct v4l2_ctrl *ctrl, u32 idx, + union v4l2_ctrl_ptr ptr) +{ + memcpy(ptr.p_area, ctrl->priv, sizeof(*ptr.p_area)); +} + +static const struct v4l2_ctrl_type_ops area_ops = { + .init = area_init, +}; + +struct v4l2_ctrl *v4l2_ctrl_new_area(struct v4l2_ctrl_handler *hdl, + const struct v4l2_ctrl_ops *ops, + u32 id, const struct v4l2_area *area) +{ + static struct v4l2_ctrl_config ctrl = { + .id = V4L2_CID_UNIT_CELL_SIZE, + .type_ops = &area_ops, + }; + + return v4l2_ctrl_new_custom(hdl, &ctrl, (void *)area); +} +EXPORT_SYMBOL(v4l2_ctrl_new_area); + +/* Helper function for standard integer menu controls */ /* Add the controls from another handler to our own. */ int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl_handler *add, diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 9a3d11350e67..36f0712ea6dd 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -669,6 +669,22 @@ struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, u32 id, u8 max, u8 def, const s64 *qmenu_int); +/** + * v4l2_ctrl_new_area() - Allocate and initialize a V4L2_CTRL_TYPE_AREA control. + * + * @hdl: The control handler. + * @ops: The control ops. + * @id: The control ID. + * @area: The width and height of the area in a struct v4l2_area. + * + * If the &v4l2_ctrl struct could not be allocated then NULL is returned + * and @hdl->error is set to the error code (if it wasn't set already). + */ + +struct v4l2_ctrl *v4l2_ctrl_new_area(struct v4l2_ctrl_handler *hdl, + const struct v4l2_ctrl_ops *ops, + u32 id, const struct v4l2_area *area); + /** * typedef v4l2_ctrl_filter - Typedef to define the filter function to be * used when adding a control handler. From patchwork Fri Aug 23 12:37:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11111589 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2AA33112C for ; Fri, 23 Aug 2019 12:37:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3D542173E for ; Fri, 23 Aug 2019 12:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566563879; bh=+u+nxbkI9gC1Xu+dl2ELI9Ve8tzdgvQjE0Rx5IUcP1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pK3QLHjIIukKao5Br8XiSOOjvqmuxhkMXk2l0AzBfSKAjYLH4zsoawSZjGbG+sxSI uXY8N2bcxk7xUUPnfwOfVZYPxk2E678xx7EWdxCf05WFgnE2wGwsclfiq1uUrazzB1 pQjZBWnDPHsB/GUw3+n+Ewnptc7wHMh4fEgaZjwU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394796AbfHWMhx (ORCPT ); Fri, 23 Aug 2019 08:37:53 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:45061 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394781AbfHWMhu (ORCPT ); Fri, 23 Aug 2019 08:37:50 -0400 Received: by mail-ed1-f65.google.com with SMTP id x19so13207378eda.12; Fri, 23 Aug 2019 05:37:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y8r+eWz5qGFdQwglnaA6qcRMWI4/EQdR6uEwrrJmWAw=; b=e2iVUzBrbD9sy43NjXtSAobf5oGbPlneBZCuR004OSDfnKCYF8uLhUXi9qbVf1VX5G oKWrNeW3WzjmQvTB5A6KMtkr799v/mHjZaf/HLtS06JJoxaAEQSrULHWKoe8MqCLTTrx 2QAFQSmJ+XvXHJLSyYXX76KhdgEbSnRzhQY2oi+rvxLtT1ZN6WOMt3Uie0E/Y3tQhC3F 9xr0BemQoidWVAad4jnGg7iPF3Wfm3H5H6uOMUrmnTPXuzvCJfuTxWLhIpa8pfMJR7rS 3q3/3VugfA80bT6wxGI40U0RSk1fuxa2n8OeDQgB4NzC9rNZaSh/m4t6PydnHtnyHtFZ EcNA== X-Gm-Message-State: APjAAAW82vijAybontW6tl6499qkMhuUMCPkIq0Tin3Vq5249+kbxCu1 6iq6EU9xjupMofCjKceh48HpB8LLel0= X-Google-Smtp-Source: APXvYqxx5IN+ml83ka93/qGxNp8Om+mK7ycCRdrY6L9j4x6/UdpYjbgAmMheycYvYWbdXvk5ggMacQ== X-Received: by 2002:a50:f4c3:: with SMTP id v3mr4155153edm.115.1566563868453; Fri, 23 Aug 2019 05:37:48 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id 9sm389687ejw.63.2019.08.23.05.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 05:37:47 -0700 (PDT) From: Ricardo Ribalda Delgado To: Philipp Zabel , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi Cc: Ricardo Ribalda Delgado Subject: [PATCH v3 6/7] Documentation: Document v4l2_ctrl_new area Date: Fri, 23 Aug 2019 14:37:36 +0200 Message-Id: <20190823123737.7774-6-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190823123737.7774-1-ribalda@kernel.org> References: <20190823123737.7774-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Helper for creating area controls. Signed-off-by: Ricardo Ribalda Delgado Reviewed-by: Jacopo Mondi --- Documentation/media/kapi/v4l2-controls.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/media/kapi/v4l2-controls.rst b/Documentation/media/kapi/v4l2-controls.rst index ebe2a55908be..656e9428f6a6 100644 --- a/Documentation/media/kapi/v4l2-controls.rst +++ b/Documentation/media/kapi/v4l2-controls.rst @@ -149,6 +149,15 @@ Integer menu controls with a driver specific menu can be added by calling const struct v4l2_ctrl_ops *ops, u32 id, s32 max, s32 def, const s64 *qmenu_int); +Area controls can be added by calling +:c:func:`v4l2_ctrl_new_area`: + +.. code-block:: c + + struct v4l2_ctrl *v4l2_ctrl_new_area(struct v4l2_ctrl_handler *hdl, + const struct v4l2_ctrl_ops *ops, + u32 id, const struct v4l2_area *area); + These functions are typically called right after the :c:func:`v4l2_ctrl_handler_init`: From patchwork Fri Aug 23 12:37:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11111593 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBA851813 for ; Fri, 23 Aug 2019 12:38:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9697C22CEC for ; Fri, 23 Aug 2019 12:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566563891; bh=u1fFAltv70/gK8oZNeOJaa/VCeBDrBEdaCNPc9Klrxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qMUBA9EPY6ZpYKLk5TmPa9/tRIj8oGmbkwq57AxUITmp4G1++39KYdTwf1R0WfSFm Mi4lY7P0bGWma9hw2Joz88nh7ie6CCMNreNU7NvDNT48qDh90u7re0Ve+sfOz0L6gP Vp725lyaqa9pOuBjnNlkn4+j4V8FBs5zR2cv6XgU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394816AbfHWMiJ (ORCPT ); Fri, 23 Aug 2019 08:38:09 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:40794 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394791AbfHWMhv (ORCPT ); Fri, 23 Aug 2019 08:37:51 -0400 Received: by mail-ed1-f65.google.com with SMTP id h8so13260446edv.7; Fri, 23 Aug 2019 05:37:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G8GHc1gsebr19dOVRPy+WGuFpKv95AVuhTZoYxXuGp4=; b=N8Mw3bcE6Uz9tdbA+i9zC40nYruDHrRGaqv8SOa1ygE+nCesxhTotS7tSuBGgwIXSD nnl8la43zyHyb9J2zfULJYJHazU2Y1nHJht0r2QzveEEXquzjkuwi57WXeqGo6IUjiaq XQIXw2WeqgunQZxsQru5cI+R78dHIcfB36MGlJIM6kBd/ZzID6ena0aBLSsBWJ4WJX3y POvHrs6Q3s94wHS5w/AjMZuT8Ax9IlV1o+Oa49hlAQKbpix16u7727hOCVT56LFkh1K7 Xnkyzwrw2kN8Sg3C/3K+/PJGst94i9Sk7Td2I6CIuje3H1CwhShcGUDO92cWrZBrZeI0 q5Kg== X-Gm-Message-State: APjAAAVttimHxzZ1KBo9EhDTMQMSkMm7ykww/8Dqph9SJ7459L0jthVQ vEMzDhPBPprYY7QPKaGZeKg= X-Google-Smtp-Source: APXvYqxJl9WqCxbu3k+xan6VXrMOyl0gKP0Kc5twQ2SoQfORvdIdUGEqxjk2XVWSKGEj1FV6aimmQQ== X-Received: by 2002:a50:e68d:: with SMTP id z13mr4182976edm.142.1566563869950; Fri, 23 Aug 2019 05:37:49 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id 9sm389687ejw.63.2019.08.23.05.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 05:37:48 -0700 (PDT) From: Ricardo Ribalda Delgado To: Philipp Zabel , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jacopo Mondi Cc: Ricardo Ribalda Delgado Subject: [PATCH v3 7/7] imx214: Use v4l2_ctrl_new_area helper Date: Fri, 23 Aug 2019 14:37:37 +0200 Message-Id: <20190823123737.7774-7-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: <20190823123737.7774-1-ribalda@kernel.org> References: <20190823123737.7774-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Instead of creating manually the V4L2_CID_UNIT_CELL_SIZE control, lets use the helper. Signed-off-by: Ricardo Ribalda Delgado --- drivers/media/i2c/imx214.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index cc0a013ba7da..625617d4c81a 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -942,26 +942,6 @@ static int __maybe_unused imx214_resume(struct device *dev) return ret; } -static void unit_size_init(const struct v4l2_ctrl *ctrl, u32 idx, - union v4l2_ctrl_ptr ptr) -{ - ptr.p_area->width = 1120; - ptr.p_area->height = 1120; -} - -static const struct v4l2_ctrl_type_ops unit_size_ops = { - .init = unit_size_init, -}; - -static struct v4l2_ctrl *new_unit_size_ctrl(struct v4l2_ctrl_handler *handler) -{ - static struct v4l2_ctrl_config ctrl = { - .id = V4L2_CID_UNIT_CELL_SIZE, - .type_ops = &unit_size_ops, - }; - - return v4l2_ctrl_new_custom(handler, &ctrl, NULL); -} static int imx214_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -969,6 +949,10 @@ static int imx214_probe(struct i2c_client *client) static const s64 link_freq[] = { IMX214_DEFAULT_LINK_FREQ, }; + struct v4l2_area unit_size = { + .width = 1120, + .height = 1120, + }; int ret; ret = imx214_parse_fwnode(dev); @@ -1050,7 +1034,10 @@ static int imx214_probe(struct i2c_client *client) V4L2_CID_EXPOSURE, 0, 3184, 1, 0x0c70); - imx214->unit_size = new_unit_size_ctrl(&imx214->ctrls); + imx214->unit_size = v4l2_ctrl_new_area(&imx214->ctrls, + &imx214_ctrl_ops, + V4L2_CID_UNIT_CELL_SIZE, + &unit_size); ret = imx214->ctrls.error; if (ret) {