From patchwork Thu Nov 17 08:42:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 21505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp284989wrr; Thu, 17 Nov 2022 00:45:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf782epz0SjDsCfvwPBTUeWQ9is1aNLNvMIGBG5W+8EJLTxwVvugIodW+yDqbxKH3ZW7GUg8 X-Received: by 2002:aa7:8d8f:0:b0:56b:b112:4a16 with SMTP id i15-20020aa78d8f000000b0056bb1124a16mr1984676pfr.66.1668674747136; Thu, 17 Nov 2022 00:45:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668674747; cv=none; d=google.com; s=arc-20160816; b=QTZAY07D+XlZxHFCjp/AElslwBnt3n8KCSNdgF6IvUAUJefEe2L36uh0aj4iWZhVhu DbZdV5cfuqKfH4/sxMxiJRLzWiaM+gkQlGnO+hg1esH2WppvG22Zsf15md7PMyjMZXQR xVTFn6xEgZCpdgA/nOH4SGewIxz0fUKfTL1Nfgx3dxGbBNF31St7+8zibwL0YB4kXeNn UM/olvGzW9+oyeGR91YimmMzJhiLLPe4poM9MDbTbxd2qNIo6bHcAivF6ylzNpgVKvzp khjK5FPlonl2fQ/p0/xgaPtmuIAFbRyOLUk1CXYwsV3GP+cKA5hjiIMRvQcOHi5M/HJO yUqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EnhX8RvtCDxuAyqt2ZOcZp3qJnbTYau3QfB909afEz8=; b=JOkgEjYskmbK0nCCbFczGIfvk/ezzEeXBawC448+aj6DOAJ4uxMWiSKDvv3nr4rVD8 /yBt4B1Lx8mejHNcHuCSEgYrlK/8wrr2SIQSUKA3TvaVmTcXSvGY0uZIRc1bvgVSwsxe OLXfD9Goh3wj1A5h2qXwZvktT/tEL+RjOOYMcLuvncxgumcMjNrFVNhg/JPF+NdkUhf7 3jnspzwdOey7ZtiCxs5mUzuXow3V7Xanlx7TYlImwgKwodJv/vsNM4m1+D8++MoU5ZTE Q1ftcZ4HKOzRRVSbIaNo5VZ9zNrDgwk9FFYmTvHYhtPejMyz9cuPAdhfzWb5JApqTP3V srTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jlv+ep3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a17090a644c00b0020db7d975ecsi4012446pjm.176.2022.11.17.00.45.34; Thu, 17 Nov 2022 00:45:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jlv+ep3R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239649AbiKQInI (ORCPT + 99 others); Thu, 17 Nov 2022 03:43:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239637AbiKQImv (ORCPT ); Thu, 17 Nov 2022 03:42:51 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2FF742D4; Thu, 17 Nov 2022 00:42:44 -0800 (PST) Received: from pyrite.tail37cf.ts.net (h175-177-042-159.catv02.itscom.jp [175.177.42.159]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 92E3A105A; Thu, 17 Nov 2022 09:42:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1668674563; bh=i2asfCX+IMDeAysoWEUZxtuevcn/m7RupGOVGq+pXtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jlv+ep3R1ziV8qxaw1h/r1QAhnBwVi+NfM8FGGSVchGYr9WJmR7yJYtwomropQ5eg +49QNybsChYss3y1Ul4tcElyM/JxogoMJ+EDToDQxxZQm7Pg0J1kHtSETdkFI1Im5L rYnN3Z2cW5g4gtYnAeXyAcyz+5YrVtyz0ULCpRpQ= From: Paul Elder To: linux-media@vger.kernel.org Cc: Paul Elder , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , Laurent Pinchart , linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] media: rkisp1: Implement ENUM_FRAMESIZES Date: Thu, 17 Nov 2022 17:42:17 +0900 Message-Id: <20221117084217.3892680-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117084217.3892680-1-paul.elder@ideasonboard.com> References: <20221117084217.3892680-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749732291414133790?= X-GMAIL-MSGID: =?utf-8?q?1749732291414133790?= Implement VIDIOC_ENUM_FRAMESIZES for the rkisp1 capture devices. Signed-off-by: Paul Elder Signed-off-by: Laurent Pinchart Reviewed-by: Dafna Hirschfeld --- .../platform/rockchip/rkisp1/rkisp1-capture.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c index 91e685fdbbe9..03c2922bfbed 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c @@ -1236,6 +1236,35 @@ static int rkisp1_enum_fmt_vid_cap_mplane(struct file *file, void *priv, return -EINVAL; } +static int rkisp1_enum_framesizes(struct file *file, void *fh, + struct v4l2_frmsizeenum *fsize) +{ + static const unsigned int max_widths[] = { + RKISP1_RSZ_MP_SRC_MAX_WIDTH, + RKISP1_RSZ_SP_SRC_MAX_WIDTH, + }; + static const unsigned int max_heights[] = { + RKISP1_RSZ_MP_SRC_MAX_HEIGHT, + RKISP1_RSZ_SP_SRC_MAX_HEIGHT, + }; + struct rkisp1_capture *cap = video_drvdata(file); + + if (fsize->index != 0) + return -EINVAL; + + fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; + + fsize->stepwise.min_width = RKISP1_RSZ_SRC_MIN_WIDTH; + fsize->stepwise.max_width = max_widths[cap->id]; + fsize->stepwise.step_width = 2; + + fsize->stepwise.min_height = RKISP1_RSZ_SRC_MIN_HEIGHT; + fsize->stepwise.max_height = max_heights[cap->id]; + fsize->stepwise.step_height = 2; + + return 0; +} + static int rkisp1_s_fmt_vid_cap_mplane(struct file *file, void *priv, struct v4l2_format *f) { @@ -1285,6 +1314,7 @@ static const struct v4l2_ioctl_ops rkisp1_v4l2_ioctl_ops = { .vidioc_s_fmt_vid_cap_mplane = rkisp1_s_fmt_vid_cap_mplane, .vidioc_g_fmt_vid_cap_mplane = rkisp1_g_fmt_vid_cap_mplane, .vidioc_enum_fmt_vid_cap = rkisp1_enum_fmt_vid_cap_mplane, + .vidioc_enum_framesizes = rkisp1_enum_framesizes, .vidioc_querycap = rkisp1_querycap, .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, .vidioc_unsubscribe_event = v4l2_event_unsubscribe,