From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC500C54EBD for ; Thu, 12 Jan 2023 14:20:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236361AbjALOU2 (ORCPT ); Thu, 12 Jan 2023 09:20:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234394AbjALOTn (ORCPT ); Thu, 12 Jan 2023 09:19:43 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFEC35D8B9 for ; Thu, 12 Jan 2023 06:11:35 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFyIo-0005lM-06; Thu, 12 Jan 2023 15:11:34 +0100 Received: from mtr by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1pFyIn-0000Pj-LL; Thu, 12 Jan 2023 15:11:33 +0100 Date: Thu, 12 Jan 2023 15:11:33 +0100 From: Michael Tretter To: Laurent Pinchart Cc: linux-media@vger.kernel.org, Philipp Zabel , kernel@pengutronix.de, linux-imx@nxp.com Subject: Re: [PATCH v1 4/6] media: imx-pxp: Implement frame size enumeration Message-ID: <20230112141133.GP24101@pengutronix.de> Mail-Followup-To: Michael Tretter , Laurent Pinchart , linux-media@vger.kernel.org, Philipp Zabel , kernel@pengutronix.de, linux-imx@nxp.com References: <20230106133227.13685-1-laurent.pinchart@ideasonboard.com> <20230106133227.13685-5-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230106133227.13685-5-laurent.pinchart@ideasonboard.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: mtr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Fri, 06 Jan 2023 15:32:25 +0200, Laurent Pinchart wrote: > Implement support for the VIDIOC_ENUM_FRAMESIZES ioctl. > > Signed-off-by: Laurent Pinchart > --- > drivers/media/platform/nxp/imx-pxp.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c > index fd4c055c01eb..68f838e3069d 100644 > --- a/drivers/media/platform/nxp/imx-pxp.c > +++ b/drivers/media/platform/nxp/imx-pxp.c > @@ -1391,6 +1391,26 @@ static int pxp_s_fmt_vid_out(struct file *file, void *priv, > return 0; > } > > +static int pxp_enum_framesizes(struct file *file, void *fh, > + struct v4l2_frmsizeenum *fsize) > +{ > + if (fsize->index > 0) > + return -EINVAL; > + > + if (!find_format(fsize->pixel_format)) > + return -EINVAL; > + > + fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; > + fsize->stepwise.min_width = MIN_W; > + fsize->stepwise.max_width = MAX_W; > + fsize->stepwise.step_width = ALIGN_W; fsize->stepwise.step_width = 1 << ALIGN_W; ALIGN_W isn't the steps in pixels, but the exponent for a 2^align alignment. > + fsize->stepwise.min_height = MIN_H; > + fsize->stepwise.max_height = MAX_H; > + fsize->stepwise.step_height = ALIGN_H; fsize->stepwise.step_height = 1 << ALIGN_H; Michael > + > + return 0; > +} > + > static u8 pxp_degrees_to_rot_mode(u32 degrees) > { > switch (degrees) { > @@ -1459,6 +1479,8 @@ static const struct v4l2_ioctl_ops pxp_ioctl_ops = { > .vidioc_try_fmt_vid_out = pxp_try_fmt_vid_out, > .vidioc_s_fmt_vid_out = pxp_s_fmt_vid_out, > > + .vidioc_enum_framesizes = pxp_enum_framesizes, > + > .vidioc_reqbufs = v4l2_m2m_ioctl_reqbufs, > .vidioc_querybuf = v4l2_m2m_ioctl_querybuf, > .vidioc_qbuf = v4l2_m2m_ioctl_qbuf, > -- > Regards, > > Laurent Pinchart > >