Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1779284rwb; Thu, 17 Nov 2022 01:42:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf7uuPogRmonTUwhsLexY5I/3HYBmq5rsd6tx5hnWYciL/N1r214Hs0gaqqoPMh/AT+hlAAi X-Received: by 2002:aa7:dd4d:0:b0:45c:98a9:7bbf with SMTP id o13-20020aa7dd4d000000b0045c98a97bbfmr1417690edw.372.1668678161018; Thu, 17 Nov 2022 01:42:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668678161; cv=none; d=google.com; s=arc-20160816; b=sNVqCDPu8MbalSgVdL2cxWoY4GJrH4FoGej0H6n6XRkALlaT08MHDE+47qGXFDP38w 0Rkj4EhQX6cqV5ieCz+NxFzcMz2Vc0vQCFkNM5mQlnSwAFwR8m19+vK97cVNJbDKr10d oyEu5DdqEatDghfa/hs3n/xc56Yf+hLEbFvWG1FdA5dBs6Yy2gFeq7OvHY+gJK3NlV0Q dHR6wo+3RsL7M9S7Z7RJM+/GBkc6rFe8Ye5zzwzzr2otrk+Mllufb4U3Q9ZxS5LlLiNN PrNX7PeXBS0vr8NB1SKnQ2O4Z1Ombwdt7ZpLcx90WvvaRoOoOpRAMBalHpbe+Hmm9FIZ d/Qg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a056402524a00b004634dd8b6edsi559721edd.296.2022.11.17.01.42.19; Thu, 17 Nov 2022 01:42:41 -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 + 92 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 Content-Transfer-Encoding: 8bit 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 Implement VIDIOC_ENUM_FRAMESIZES for the rkisp1 capture devices. Signed-off-by: Paul Elder Signed-off-by: Laurent Pinchart --- .../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, -- 2.35.1