From patchwork Fri Mar 24 15:12:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 13186902 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 27287C6FD1C for ; Fri, 24 Mar 2023 15:19:07 +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=fOZcI+cneOAQXaa8dhZZFKUlitI5H2ic/5ZNUS0Pllo=; b=yLhLML//Ibq1dy R+mur97DwoGd+kbWMnjebEkJmi0Nje84OLtGGnZP1dqHqsv3PX55foEA3Ed434Id4J1fHzLwftbp4 d5ewIjIECPSfFOxClIOSbt6OgekMVAqfg7gRZ+aA+sP9Gl2EW+0mBdx4cQJzsRwibGtmlWjOROEyO mTezEiFEzgVmeZzgabB54BOrmjxbO85SBDzDEIohByZJaUTj8Jm31JS/y5+Rvd4Inf0Ka+oCt7Ui8 xFjFl4+Bp48OG1gjH62cCOfjBB92iYxyGFEVNtZlyPX2kVnwFPSBUsw83KjXYMt3eGD//mW2R23Yv x83UeTLiWTT6kdmdKnbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pfj6K-004mRq-2j; Fri, 24 Mar 2023 15:13:08 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pfj64-004mFV-18 for linux-arm-kernel@lists.infradead.org; Fri, 24 Mar 2023 15:12:54 +0000 Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id E3D4FE001B; Fri, 24 Mar 2023 15:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1679670771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1pmURX5WiQgok7667LNCdKhn4LBPmmToQ7P/mWQBXOQ=; b=kSIc7RsqSmQa+l+Wc/6gZkQKyA2eHwyjnSctaczCtZ/53kUxIZ4X8JtFlaNszeAzTuXE/u Z6d5OfG01Q6aakLjKQ8wkgsizTuz7BK5BH0Xxi1A7BPtd8tZW3fKgdKShaWPW1B20cpyGu v4ZQCgC/XJbyR9iN403ta3N49XowLYEbpvaBpdW2dbtl0FGWJ0HZK9ZBDthm57t2VvAubX lAaiJsWGXWSV5UGSI/f75Wh0NskUANgqksOqWAt5LAIF+9xbtVucdFUzFZICzLtNg4dmSX Bo75LHPxRbEbSK0TAxDBkcYs7NVWIAiAzl8sF+hXaY3LpFUQm23SK/qUR6XTwA== From: Paul Kocialkowski To: linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Cc: Paul Kocialkowski , Mauro Carvalho Chehab , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Laurent Pinchart , Adam Pigg , Thomas Petazzoni Subject: [PATCH 7/9] media: sun6i-csi: capture: Implement enum_framesizes Date: Fri, 24 Mar 2023 16:12:26 +0100 Message-Id: <20230324151228.2778112-8-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230324151228.2778112-1-paul.kocialkowski@bootlin.com> References: <20230324151228.2778112-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230324_081252_552728_C9D3C1C8 X-CRM114-Status: GOOD ( 10.86 ) 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 Report available frame sizes as a continuous range between the hardware min/max limits. Signed-off-by: Paul Kocialkowski Co-authored-by: Adam Pigg Signed-off-by: Adam Pigg Reviewed-by: Jernej Skrabec Reviewed-by: Laurent Pinchart --- .../sunxi/sun6i-csi/sun6i_csi_capture.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c index 9627030ff060..31ba83014086 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_capture.c @@ -847,6 +847,30 @@ static int sun6i_csi_capture_try_fmt(struct file *file, void *private, return 0; } +static int +sun6i_csi_capture_enum_framesizes(struct file *file, void *fh, + struct v4l2_frmsizeenum *frmsizeenum) +{ + const struct sun6i_csi_capture_format *format; + + if (frmsizeenum->index > 0) + return -EINVAL; + + format = sun6i_csi_capture_format_find(frmsizeenum->pixel_format); + if (!format) + return -EINVAL; + + frmsizeenum->type = V4L2_FRMSIZE_TYPE_CONTINUOUS; + frmsizeenum->stepwise.min_width = SUN6I_CSI_CAPTURE_WIDTH_MIN; + frmsizeenum->stepwise.max_width = SUN6I_CSI_CAPTURE_WIDTH_MAX; + frmsizeenum->stepwise.min_height = SUN6I_CSI_CAPTURE_HEIGHT_MIN; + frmsizeenum->stepwise.max_height = SUN6I_CSI_CAPTURE_HEIGHT_MAX; + frmsizeenum->stepwise.step_width = 1; + frmsizeenum->stepwise.step_height = 1; + + return 0; +} + static int sun6i_csi_capture_enum_input(struct file *file, void *private, struct v4l2_input *input) { @@ -884,6 +908,8 @@ static const struct v4l2_ioctl_ops sun6i_csi_capture_ioctl_ops = { .vidioc_s_fmt_vid_cap = sun6i_csi_capture_s_fmt, .vidioc_try_fmt_vid_cap = sun6i_csi_capture_try_fmt, + .vidioc_enum_framesizes = sun6i_csi_capture_enum_framesizes, + .vidioc_enum_input = sun6i_csi_capture_enum_input, .vidioc_g_input = sun6i_csi_capture_g_input, .vidioc_s_input = sun6i_csi_capture_s_input,