From patchwork Thu Nov 17 08:42:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 21506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp285163wrr; Thu, 17 Nov 2022 00:46:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf4UXFDSuy+aAZEjsh+vPbA78ITOpc++1E6JipjyMal4SA4zG95nbbXCI8Ebx9WNlrIJpVyM X-Received: by 2002:a17:903:11c5:b0:188:8dc6:4eae with SMTP id q5-20020a17090311c500b001888dc64eaemr1884808plh.2.1668674784318; Thu, 17 Nov 2022 00:46:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668674784; cv=none; d=google.com; s=arc-20160816; b=X7pISoNHs7NXUaKSuv2C39y2fkk2a9mhj70VJ2joSJnpKT9y6Yjn29AvZ/SFhK4RtI pjoGpgQ47N2lWbJ7anB5g2rola9OmmGDKr2jH9nfMsN/hnOcCFxvmkjdwx2z2fi1szDJ S3WIA9TdjnlVUZYIph+FN+QGFPisB8Q9MYFm2aCbSFp016JILm08JdfeqklaFagmgZi6 topdC6hwdjDK1wehCwyl6DI8z3yGklz/mW3SASJq5J3rVXc2KfH5j4ZrMMaRjgNiWSZ4 KJ0HI7iTJNLv1tMnJix6HuBsri4+CALp49h15KlPNPyP265jvczB4wscv2luGj9nD480 aXlw== 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=KvcPwMxJh99UHnx4aqPf20qy1tH/1ZRezGaRMDSZALM=; b=dBfocl9pJyEVg4vPzf/oVTSSZD912owY+yZ6aPkwo8XoU4qsm8Ydn9wVZhfFOIRxJ4 oIpsN+I1FUiq5Lp6ZU4525fzRK+ciLP44IKaJhiyQEQxgBFykXF3QAdGVgnU4TshZ7tr YJPGIR2E/AK1rF08leqfvbe3LzQXwGJF5SpnS+wXaui5sObRKRQ0fEFM87IixwSurGLx p/N3pBRDy0AKnvaZI6wUSMyhLneHoMKvuB2NrDTnw+Vwb7xS6zfuo8yIgboFeMdc8h00 NTbnUucpDZixQa6v7zDFcUpvgpn4VyfgNOX4G28fSZzMflteapBqBftzpj1Apka6F/Vk bCsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=TDzTqsj6; 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 z21-20020a63e555000000b00476e94ad180si503153pgj.127.2022.11.17.00.46.11; Thu, 17 Nov 2022 00:46:24 -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=TDzTqsj6; 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 S239647AbiKQInC (ORCPT + 99 others); Thu, 17 Nov 2022 03:43:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239125AbiKQImk (ORCPT ); Thu, 17 Nov 2022 03:42:40 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF9B071F2B; Thu, 17 Nov 2022 00:42:39 -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 0EF48E86; Thu, 17 Nov 2022 09:42:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1668674556; bh=FRk1HlQxJCg/bMBCI0emDkc9se4S4LTHyPJceYD/tbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TDzTqsj63t6K/a/B4DMs5kSyJXF3EcecH0lSSATrtir5oC+kSwDXVlYcqHjI4vTd4 ilx19LRZ6IgMjw0gucOqzf2J4rMnoJn6biezg75wBvlYQSqHmVDhtfFqBT+7IM1uRP I2UigdVHCbTciydjJrN4d8k7ALpXqdNQn1+Y/N5M= 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 1/3] media: rkisp1: Add NV16M and NV61M to output formats Date: Thu, 17 Nov 2022 17:42:15 +0900 Message-Id: <20221117084217.3892680-2-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?1749732331034294932?= X-GMAIL-MSGID: =?utf-8?q?1749732331034294932?= Add support for NV16M and NV61M as output formats. As NV16, NV61, NV12M and NV21M are already supported, the infrastructure is already in place to support NV16M and NV61M, so it is sufficient to simply add relevant entries to the list of output formats. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart Reviewed-by: Dafna Hirschfeld --- .../platform/rockchip/rkisp1/rkisp1-capture.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c index d4540684ea9a..7695ef134908 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c @@ -110,6 +110,16 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_mp_fmts[] = { .uv_swap = 1, .write_format = RKISP1_MI_CTRL_MP_WRITE_YUV_SPLA, .mbus = MEDIA_BUS_FMT_YUYV8_2X8, + }, { + .fourcc = V4L2_PIX_FMT_NV16M, + .uv_swap = 0, + .write_format = RKISP1_MI_CTRL_MP_WRITE_YUV_SPLA, + .mbus = MEDIA_BUS_FMT_YUYV8_2X8, + }, { + .fourcc = V4L2_PIX_FMT_NV61M, + .uv_swap = 1, + .write_format = RKISP1_MI_CTRL_MP_WRITE_YUV_SPLA, + .mbus = MEDIA_BUS_FMT_YUYV8_2X8, }, { .fourcc = V4L2_PIX_FMT_YVU422M, .uv_swap = 1, @@ -237,6 +247,18 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_sp_fmts[] = { .write_format = RKISP1_MI_CTRL_SP_WRITE_SPLA, .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422, .mbus = MEDIA_BUS_FMT_YUYV8_2X8, + }, { + .fourcc = V4L2_PIX_FMT_NV16M, + .uv_swap = 0, + .write_format = RKISP1_MI_CTRL_SP_WRITE_SPLA, + .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422, + .mbus = MEDIA_BUS_FMT_YUYV8_2X8, + }, { + .fourcc = V4L2_PIX_FMT_NV61M, + .uv_swap = 1, + .write_format = RKISP1_MI_CTRL_SP_WRITE_SPLA, + .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422, + .mbus = MEDIA_BUS_FMT_YUYV8_2X8, }, { .fourcc = V4L2_PIX_FMT_YVU422M, .uv_swap = 1, From patchwork Thu Nov 17 08:42:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 21504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp284977wrr; Thu, 17 Nov 2022 00:45:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf4bn/kcjHy0MDYFzXjX32tjMMhPuk2YS86GpcTh31m3z1tGe8+hgO1dT+MO8L2XcEx1eo7g X-Received: by 2002:a17:90b:3549:b0:212:fa9a:3c47 with SMTP id lt9-20020a17090b354900b00212fa9a3c47mr1821797pjb.41.1668674744492; Thu, 17 Nov 2022 00:45:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668674744; cv=none; d=google.com; s=arc-20160816; b=fVLqCYgOlu+t3NHfQ91sEicpdMu5WI3kjTjJGtp/X1B5LUVn20C80QmieMXp5xQjjJ NnEz7gcU3vRZ/Na8qya46JUCYyaG4yudVSrBeHGfbuxjy71dXvfmGteeHOT3gqeLizOD qQ8VDauz9p7GP6VyzLATxD5pdzs9zW8pD6TUd3nxjR/wZRISCHWEUfSwN1NlxC7QeRYg npzVO0wWZ3L/kCz3uopkG9Mb6diywK6XErzYtzqbr+h++y1f09ylETxjQ8co1J/Pq3XN Q7YuV/VY144ED8pBxDkoEtVKekawKIPo8W5fLux5xM7Dnyey+qSI4oUQZzlItMPwPfJB 6Klw== 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=rnh9gOr05Dy78gNCBT1CMvjyeQ/F6wXvtpeRzjaiqKo=; b=hmPIzbZRrFC84+Jfl5REAVHAP07o66cxxFX4U1ftkkJdrvyvxipxMGG68iZQPfdgGL WUfFlRDTj/jdQ73VfFcB8rt/SixfKZ7UBfazFOwN052Tg2Qjz61nMq3mUnGeLuzJxwsp q5eUjEZ5ghdFQfa4pBILgiseYjAshaglJaC3DIqUyl/AH1sPjjE9Cc/ikezdAy+Lh2Nu /pDABh6i5+dmyJuv3/dNdRUIrSycQ1Uct8SBAnQBBXg8ZPIbps55eQGDDU5mYvJ+hvpq Rao1OoQ/Xo1/vSStRGSKqp/T09DHmQkenCWuzHOvk/GvX2aPx7N7mJ00VX5gFIhDUTT/ JO6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=qIqpC4iq; 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 b16-20020a170902d51000b0018666611f85si465323plg.508.2022.11.17.00.45.32; Thu, 17 Nov 2022 00:45:44 -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=qIqpC4iq; 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 S239684AbiKQInF (ORCPT + 99 others); Thu, 17 Nov 2022 03:43:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239616AbiKQImm (ORCPT ); Thu, 17 Nov 2022 03:42:42 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9210373437; Thu, 17 Nov 2022 00:42:41 -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 52BF3929; Thu, 17 Nov 2022 09:42:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1668674560; bh=6nANnb2tFZVVVLtK7LKX6bWvaoeBArVUuO1Oxpluxjw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qIqpC4iqosbPtJ42CZ0+8TDCR/xAc5Bg9iIbqjt6rDSt9L0NYTuDgKsbozKFZa1oW h30+EW4tqG0NkHlE+TIghUNVV57nYgEmQHaV46ua/S+OygY6mN9M03y8OPPk5Lwwap 4w7k9MZriguUkJouFkUB+PD9Kdno9kgbLogvrbLI= From: Paul Elder To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paul Elder Subject: [PATCH v2 2/3] media: rkisp1: Make local immutable array variables static const Date: Thu, 17 Nov 2022 17:42:16 +0900 Message-Id: <20221117084217.3892680-3-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?1749732288896226849?= X-GMAIL-MSGID: =?utf-8?q?1749732288896226849?= From: Laurent Pinchart The max_widths and max_heights variables in rkisp1_try_fmt() are immutable and don't need to be allocated on the stack every time the function is called. Make them static. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder --- .../media/platform/rockchip/rkisp1/rkisp1-capture.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c index 7695ef134908..91e685fdbbe9 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c @@ -1150,13 +1150,17 @@ static void rkisp1_try_fmt(const struct rkisp1_capture *cap, const struct rkisp1_capture_fmt_cfg **fmt_cfg, const struct v4l2_format_info **fmt_info) { + 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, + }; const struct rkisp1_capture_config *config = cap->config; const struct rkisp1_capture_fmt_cfg *fmt; const struct v4l2_format_info *info; - const unsigned int max_widths[] = { RKISP1_RSZ_MP_SRC_MAX_WIDTH, - RKISP1_RSZ_SP_SRC_MAX_WIDTH }; - const unsigned int max_heights[] = { RKISP1_RSZ_MP_SRC_MAX_HEIGHT, - RKISP1_RSZ_SP_SRC_MAX_HEIGHT}; fmt = rkisp1_find_fmt_cfg(cap, pixm->pixelformat); if (!fmt) { 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,