Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp3753709ybg; Sun, 7 Jun 2020 09:31:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMisj/OSVErvGkCDE6JrJTEstT2LselzwVhIZWcyeuw3jArfq7mMZ+8kVKv3/pzJveFiBW X-Received: by 2002:a17:906:d93c:: with SMTP id rn28mr18475372ejb.190.1591547482432; Sun, 07 Jun 2020 09:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591547482; cv=none; d=google.com; s=arc-20160816; b=x7Z1oFw9MAF5j4wgHKmEy+wAJfyOtfbCiHfhua412zJgFsOpQCnxK8ZL4vdEzgoj+Z a4pFxjLgqu2qcXJMCs2XgoSG+8O1MRSAXzpldf+7a6Er1DXbOEGpoqD0FXO51roe4eSc vYf8NqzSHxAdvpe7KvAE05O/U5sOdJsTS6eMUbV9gZYUHkIfweCVeT+uyrbpGR1zerS9 xBHBfLtL2+aOePx/xiOOK74JLR3O46tOCRLazUPaj4p717UyVNEMU5FGf4LeNVjJFtQP SMxNOnIt6+YNlIPvGLT3b7YfpJ55c5oebMNVJmJCYWGe1QzKgEibxhwqA9j1mv8GYoyT qVaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=SDnYXucB/LSHUufMk2Ofpom5Zz/vAp/Zvuags38mkj0=; b=b/V15h2aXFazJIyjRRU159F6uVSAbsXtQPFZnn379WstKUBX61p0zHHwW7CdPiBQVe uMCLyXDEqwZZjDRCGDGnw7WQCvHCjrTJRyTevK9FDaf50KZ1S1onjskdsmqTSAsTkLyL zIPnUbP/Sdar8RjUZ5ws4UVBlvcW0z6KEXvkHH4B2p4mgg2BMj2fIcXUIAJlUz4TnthD +YZ8nT2gx8NvBuG0a1vVXMcKFRPG8jtv5Nu9AaOFriAEiva9ytIDi30By5Pe8aEJMVPA HMqv2kcMfHH379HWzGxOyAN6kZSBXE2fkLCJfselU1YcZow8NSOP0NW61Ea2urQnnoct jijw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LUXGwL3l; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s3si7109355ejq.532.2020.06.07.09.30.58; Sun, 07 Jun 2020 09:31:22 -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; dkim=pass header.i=@linaro.org header.s=google header.b=LUXGwL3l; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726823AbgFGQ3C (ORCPT + 99 others); Sun, 7 Jun 2020 12:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726571AbgFGQ3B (ORCPT ); Sun, 7 Jun 2020 12:29:01 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E6EDC08C5C3 for ; Sun, 7 Jun 2020 09:29:01 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id x18so1019400lji.1 for ; Sun, 07 Jun 2020 09:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SDnYXucB/LSHUufMk2Ofpom5Zz/vAp/Zvuags38mkj0=; b=LUXGwL3l/HX8TeZThQeEY+13PnXuHCDIzawEBI6FI/0zIedKDScQO+7/2cJAr9HEg8 EvixNwHhauJGQ5uCzq5BOCa4l0cTICCsahpSdZwMVkHyGOLlpDEqO0zWM76ITextJ7ls f9Jsg5dCQ1m3QB0yTCZjEM82l/x3msou677n0K4af49n2LSBXVASO5JmUsTsmLiyiyRn m+YipNV+zGNqiw7APctRfeIxLWbmAwrax5c4B3jGtbs16wBTqb/c7RsjALLHhnsv55DI gjs8ms7uFZK3T6dQ1nF836z1SSKP85fZOsq9Vl8T5t3+5gVAAPkwZ5NgWYS8khYQvu3N AIJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SDnYXucB/LSHUufMk2Ofpom5Zz/vAp/Zvuags38mkj0=; b=guwuJOCcRe88flzcm2bkIOQTKjO+KlgNxRpXZ9J8WKEP7SpwGMQ/o4giM1YMR5QJ8S 0ACPjOQZ82RGAZO2rUBTrAtO0ZW9QSAvc8oWFgkJVnqzPi11bew6btMUVTtBDlo2n7q2 dHP6PMyLmGlHBrlSf7eHJqJmDo7ooGH/pkICsMOG6Cis8Biwlqz1dQaZfVA3SMDSxyGa sOSLIUb2NImgwj+YMeDPwqr5mEcEKCouPb3CmtNTkWer9o5YgnasQU0Y/0vy5mbVBlVZ 5fFaHVtwTYXcEvzDkorXvQBAPrMFrwdaQoeE33KNmJ6EA3+G3WmaszSmQVQq5EgxgLTH YLFw== X-Gm-Message-State: AOAM532QrL5WVKM5e1AF4kWiu1EVD3o20BTPiZLOu65BQgMYGZHinfhF ebgfdvBIj+a+fHMdhOYyhYwUOw== X-Received: by 2002:a2e:97d8:: with SMTP id m24mr4215270ljj.166.1591547339856; Sun, 07 Jun 2020 09:28:59 -0700 (PDT) Received: from [192.168.118.216] (37-144-159-139.broadband.corbina.ru. [37.144.159.139]) by smtp.gmail.com with ESMTPSA id y16sm3046383ljm.19.2020.06.07.09.28.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jun 2020 09:28:58 -0700 (PDT) Subject: Re: [PATCH v3 08/10] media: i2c: imx290: Add support to enumerate all frame sizes To: Sakari Ailus 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 References: <20200524192505.20682-1-andrey.konovalov@linaro.org> <20200524192505.20682-9-andrey.konovalov@linaro.org> <20200526091716.GJ8214@valkosipuli.retiisi.org.uk> From: Andrey Konovalov Message-ID: Date: Sun, 7 Jun 2020 19:28:56 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200526091716.GJ8214@valkosipuli.retiisi.org.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sakari, Thank you for the review! On 26.05.2020 12:17, Sakari Ailus wrote: > 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. I've double checked this part of the code, and it doesn't seem to need changes. The reason is that for the both codes the set of the modes and the frame sizes is exactly the same. And the fse->code check above just guards against the codes not supported by the driver at all. Thanks, Andrey >> + >> + 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, >> }; >