From patchwork Wed Aug 22 16:59:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 10573093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4A425A4 for ; Wed, 22 Aug 2018 17:00:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2B792BA51 for ; Wed, 22 Aug 2018 17:00:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6E282BA57; Wed, 22 Aug 2018 17:00:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4FE812BA51 for ; Wed, 22 Aug 2018 17:00:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=sx8G4v9rd3xHL9aaFZSDeo/8LNSovYIkr78pSEnhAJo=; b=MhQwoxLXWnXcBFh0nRG0+p9J+G 72OszZAgF8JALSHJ3CIzHFjirhCdZb+ldV3q26i+bCf1IX4tubutnDUUCUwc85twFTpwolWjMBi0o lTP5558Y9Ag1m2R0ezGvPu+okTb9K9GhxdgXATmhHYD8nHqgsdLOGU7L2iYFA6qCEjwhbLGNA8ZUv 6xN+crJAmRXPDnuY7tgMmPf0EKasbGNPr+ZvOTUAxU8tNPA3yhu8OGcTYOVNq6xWcON9FRC/SSWsz GfJQMbFGDyQsowP3mCa0PiGY85qoOd021TwoGyavP1LHlcouxLsF0sJ1X2e7oCQ1oGHEKf5Y6nBy2 GTbwg9eQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsWUd-00030W-8Z; Wed, 22 Aug 2018 17:00:27 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsWUW-0002of-BW for linux-rockchip@lists.infradead.org; Wed, 22 Aug 2018 17:00:23 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id B982627E1A7 From: Ezequiel Garcia To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: [PATCH v3 4/7] v4l2-ctrls: Support dimensions override for standard controls Date: Wed, 22 Aug 2018 13:59:34 -0300 Message-Id: <20180822165937.8700-5-ezequiel@collabora.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180822165937.8700-1-ezequiel@collabora.com> References: <20180822165937.8700-1-ezequiel@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180822_100020_686426_91D372A4 X-CRM114-Status: GOOD ( 10.16 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Nicolas Dufresne , Heiko Stuebner , Tomasz Figa , Rob Herring , Hans Verkuil , Miouyouyou , kernel@collabora.com, Ezequiel Garcia MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Pass the v4l2_ctrl_config->dims array to v4l2_ctrl_fill, so the dimensions can be overridden for standard controls. This will be used to fill V4L2_CID_JPEG_LUMA_QUANTIZATION and V4L2_CID_JPEG_CHROMA_QUANTIZATION. Signed-off-by: Ezequiel Garcia --- drivers/media/v4l2-core/v4l2-common.c | 2 +- drivers/media/v4l2-core/v4l2-ctrls.c | 17 ++++++++++------- include/media/v4l2-ctrls.h | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index b518b92d6d96..7b6353dab8a5 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -90,7 +90,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 _min, s32 _max, s32 _ s64 def = _def; v4l2_ctrl_fill(qctrl->id, &name, &qctrl->type, - &min, &max, &step, &def, &qctrl->flags); + &min, &max, &step, &def, NULL, &qctrl->flags); if (name == NULL) return -EINVAL; diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 599c1cbff3b9..6ab15f4a0fea 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1068,7 +1068,7 @@ const char *v4l2_ctrl_get_name(u32 id) EXPORT_SYMBOL(v4l2_ctrl_get_name); void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, - s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags) + s64 *min, s64 *max, u64 *step, s64 *def, u32 *dims, u32 *flags) { *name = v4l2_ctrl_get_name(id); *flags = 0; @@ -2244,10 +2244,13 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, s64 max = cfg->max; u64 step = cfg->step; s64 def = cfg->def; + u32 dims[V4L2_CTRL_MAX_DIMS]; + + memcpy(dims, cfg->dims, sizeof(dims)); if (name == NULL) v4l2_ctrl_fill(cfg->id, &name, &type, &min, &max, &step, - &def, &flags); + &def, dims, &flags); is_menu = (cfg->type == V4L2_CTRL_TYPE_MENU || cfg->type == V4L2_CTRL_TYPE_INTEGER_MENU); @@ -2266,7 +2269,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, ctrl = v4l2_ctrl_new(hdl, cfg->ops, cfg->type_ops, cfg->id, name, type, min, max, is_menu ? cfg->menu_skip_mask : step, def, - cfg->dims, cfg->elem_size, + dims, cfg->elem_size, flags, qmenu, qmenu_int, priv); if (ctrl) ctrl->is_private = cfg->is_private; @@ -2283,7 +2286,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, enum v4l2_ctrl_type type; u32 flags; - v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags); + v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, NULL, &flags); if (type == V4L2_CTRL_TYPE_MENU || type == V4L2_CTRL_TYPE_INTEGER_MENU || type >= V4L2_CTRL_COMPOUND_TYPES) { @@ -2312,7 +2315,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, u64 step; u32 flags; - v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags); + v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, NULL, &flags); if (type == V4L2_CTRL_TYPE_MENU) qmenu = v4l2_ctrl_get_menu(id); @@ -2350,7 +2353,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl, return NULL; } - v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags); + v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, NULL, &flags); if (type != V4L2_CTRL_TYPE_MENU || qmenu == NULL) { handler_set_err(hdl, -EINVAL); return NULL; @@ -2375,7 +2378,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, s64 def = _def; u32 flags; - v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags); + v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, NULL, &flags); if (type != V4L2_CTRL_TYPE_INTEGER_MENU) { handler_set_err(hdl, -EINVAL); return NULL; diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index f615ba1b29dd..55ab01d97c12 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -370,7 +370,7 @@ struct v4l2_ctrl_config { * control framework this function will no longer be exported. */ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, - s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags); + s64 *min, s64 *max, u64 *step, s64 *def, u32 *dims, u32 *flags); /**