Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp128327ybs; Tue, 26 May 2020 05:27:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0YzCPqcBa7pUKS105LJlKWYu+Xq1WW+5JmWcr0tdAEkOqrkhmmNpxWYlUGnXoMRG948E7 X-Received: by 2002:a50:9317:: with SMTP id m23mr20349522eda.65.1590496049240; Tue, 26 May 2020 05:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590496049; cv=none; d=google.com; s=arc-20160816; b=erh1rmw9txWU6FaI7opfsIpniIwdTw63CFX8lESyOHabJLwMtwVvhp7wEDV7E1PfsE SfOhJMjmwqSIxqEjyFfm1nZUqbcY9JkncYOucFVkyyPDIqRcw3LhS65ADvXPdWISRAuz /Fm4r1pRJzbKzX96fAqQlIGiaPw6MM7k1pYXd2VCq0YezPktn8ycztSH+ejdyi+n7RTB +IImTjtH9DjlTJodmTyrwycWDBtK9tH1bFOcxNyLeRXb4JG1zM84T9yxb8Nlz7gVGW8F Jsl5jNE9PORCnH+pHb9u4Ph0iIptys6urS1XEUD/H+gDV6+S03JhyZRWCNs7rOml3y3A 8nIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Lbz6iR3EvTd9hUWcCwLY5bxGkok9291ra4qSab+auxQ=; b=tNKOvcu4pvm+WliT69n1xoUdDhKaeVWxa7kNHAqPa9KBSE2fZ3cLu9gMGb4yfuDYOw NeVwSxcKyKXRizyvuZbZDJSgvpW60W2XB7l7IoxYTL1oOCcwrotZWsK1VMryk2m+94SL y7sEW9mPbLDisKajKzkY1FZVH5VI9k80qzgHTcExZQBtZkTdFwwH1ZV6B42ysTS8tHF4 i46NWWsb1apiZ0HAiOAyFcDx0Tm84x93KytJpZ+L13tXI40KOLLjrAXjobmjT9o0gksX mNykFoNMidBYgfVquI0C0E6eNRRO+zj+d2n/wdDv0zoBjnK52T/KfriOY6+Lz+cLz78/ ufTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oq12si10828582ejb.443.2020.05.26.05.27.06; Tue, 26 May 2020 05:27:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731757AbgEZJSE (ORCPT + 99 others); Tue, 26 May 2020 05:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725771AbgEZJSD (ORCPT ); Tue, 26 May 2020 05:18:03 -0400 Received: from hillosipuli.retiisi.org.uk (hillosipuli.retiisi.org.uk [IPv6:2a01:4f9:c010:4572::81:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33F13C03E97E; Tue, 26 May 2020 02:18:03 -0700 (PDT) Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2a01:4f9:c010:4572::80:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id A14B4634C87; Tue, 26 May 2020 12:17:16 +0300 (EEST) Received: from sailus by valkosipuli.localdomain with local (Exim 4.92) (envelope-from ) id 1jdVi0-0002Rz-M8; Tue, 26 May 2020 12:17:16 +0300 Date: Tue, 26 May 2020 12:17:16 +0300 From: Sakari Ailus To: Andrey Konovalov Cc: mchehab@kernel.org, manivannan.sadhasivam@linaro.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, c.barrett@framos.com, a.brela@framos.com, peter.griffin@linaro.org Subject: Re: [PATCH v3 08/10] media: i2c: imx290: Add support to enumerate all frame sizes Message-ID: <20200526091716.GJ8214@valkosipuli.retiisi.org.uk> References: <20200524192505.20682-1-andrey.konovalov@linaro.org> <20200524192505.20682-9-andrey.konovalov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200524192505.20682-9-andrey.konovalov@linaro.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrey, On Sun, May 24, 2020 at 10:25:03PM +0300, Andrey Konovalov wrote: > From: Manivannan Sadhasivam > > Add support to enumerate all frame sizes supported by IMX290. This is > required for using with userspace tools such as libcamera. > > Signed-off-by: Manivannan Sadhasivam > Signed-off-by: Andrey Konovalov > --- > drivers/media/i2c/imx290.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c > index 6e70ff22bc5f..88850f3b1427 100644 > --- a/drivers/media/i2c/imx290.c > +++ b/drivers/media/i2c/imx290.c > @@ -471,6 +471,25 @@ static int imx290_enum_mbus_code(struct v4l2_subdev *sd, > return 0; > } > > +static int imx290_enum_frame_size(struct v4l2_subdev *subdev, > + struct v4l2_subdev_pad_config *cfg, > + struct v4l2_subdev_frame_size_enum *fse) > +{ > + if ((fse->code != imx290_formats[0].code) && > + (fse->code != imx290_formats[1].code)) > + return -EINVAL; Please skip the modes that do not have the code specified by the user. They should not be enumerated here. > + > + if (fse->index >= ARRAY_SIZE(imx290_modes)) > + return -EINVAL; > + > + fse->min_width = imx290_modes[fse->index].width; > + fse->max_width = imx290_modes[fse->index].width; > + fse->min_height = imx290_modes[fse->index].height; > + fse->max_height = imx290_modes[fse->index].height; > + > + return 0; > +} > + > static int imx290_get_fmt(struct v4l2_subdev *sd, > struct v4l2_subdev_pad_config *cfg, > struct v4l2_subdev_format *fmt) > @@ -850,6 +869,7 @@ static const struct v4l2_subdev_video_ops imx290_video_ops = { > static const struct v4l2_subdev_pad_ops imx290_pad_ops = { > .init_cfg = imx290_entity_init_cfg, > .enum_mbus_code = imx290_enum_mbus_code, > + .enum_frame_size = imx290_enum_frame_size, > .get_fmt = imx290_get_fmt, > .set_fmt = imx290_set_fmt, > }; -- Regards, Sakari Ailus