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: 13046325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D46BC43217 for ; Thu, 17 Nov 2022 08:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lSXxkYhEZF6EpQ3/ImXkYBgI/rYbDt6gCiNDIb2Pr18=; b=MPX2U5hdtp3xMY gL/fD50G5YUNwyTDoavddobO4JYpwNm7UeALcZrXqEiE5s0PSjdKcY7RPe4CMgQCYAnn73D7jIoAI bFPP/0y4hVWdVXpG9vDETSaCsF9Q2CuD0U3Z/IsvPjElzR/PK4l6j7hVMxxwFUxjNb4+Vrpa9qAO6 vxOm7ObTUtcjmxrUkvDUd6CrBYN79udzK2uCcMNbeS8BNDcgjLtbFauVv9HcjmCvFPs3hq/kKZDl3 cODopR7+16GFNa/PpDJFGdrwJ0pz0Uyt9BVH/fv7A7fB+YHqpCd8+nI9SlR22JoU6lEj6/m/tejxX 3UU8gf5RDo2GajsxuFQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovaVK-00Blea-Tn; Thu, 17 Nov 2022 08:44:15 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovaTu-00Bkme-86; Thu, 17 Nov 2022 08:42:47 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_004246_451918_C210241E X-CRM114-Status: GOOD ( 12.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: 13046326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 758FEC433FE for ; Thu, 17 Nov 2022 08:45:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WptNpO+jE0YH3Z8QLQKaoDoHmNvxkS4p4lSPnU+U80g=; b=Uv7I5n5R6Uh7qw hrMNDj0/yRgG9xkCGjlXqokMMNEYIMlkS/JayFuB8cSYHkrYEY6foHcvX7tnABqna3+UwhE43Rk33 /ANr6FiKgkAgmw9dxyn6QWEEOfqQkW3ppwjC3L3R/gmOE6zXjPYplxRu48kkGeCwDzHR3ZIbESadh 6Qyrd6Bxeo4urd3EOnrczh7lvHfKl9zGDY8vm4sZzhS5ADqQ6zc/pk/sY4fyaEC/W05rn548EtmqN xtpeS+hzLP+oSC1ZOpFybCEZ8cnVoum/6hv658NF2oC5DIiUCarTAzPHLyjrMV16QNwbO83XLw5jg 7rDlfo4JvSxzODeLIfUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovaVi-00Blpp-O2; Thu, 17 Nov 2022 08:44:39 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovaTv-00Bkox-AS; Thu, 17 Nov 2022 08:42:49 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_004247_529588_6A0C4E1F X-CRM114-Status: GOOD ( 11.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: 13046327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C36FDC433FE for ; Thu, 17 Nov 2022 08:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DT+GMon0h96dw2rpQi678WfV/DrAQHN7qIcV7tngINk=; b=QnDWD5NolUk7O+ bETrfek2WCQs6VKbqOvZZgqrL7agLNDH5/8ChCogfwmz1HeCGDOMPYjO+1+2e2mS79Pf4GeFVF1E8 dbqhK5Etml68pEgoM86RcOu+YZjVbkhplJF0hd9cDqajo++w2sJnWepfhK5Vc/s+BuRsAiB73OKEk V/8zXMAoKRhUk2R7ENVB4XVIW4Fv4CQ4vMd3FyVFUlSTauTS6D06s3uBVphR6BzdJjHdSbpq9FEX3 zxkBf460039hB3ATx5yep2+8WzgCfkZUAMHjqc8ai6kcRLd8579HB8m7QgcnVDBZ8R2rP4t9tG9PL mfnqdNv5x/l89iYKMeQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovaWX-00BmM8-Hs; Thu, 17 Nov 2022 08:45:29 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovaTy-00BkqQ-8Z; Thu, 17 Nov 2022 08:42:51 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_004250_460743_A509E66C X-CRM114-Status: GOOD ( 11.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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,