Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp831235pxb; Tue, 3 Nov 2020 13:48:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbnvAQOlpCDxpC4UKnEh8i6riGqob1JQSJMSqYCS+Rq7sYhbtAg3o9SRO5IJt7gJVvNpGl X-Received: by 2002:a17:906:804:: with SMTP id e4mr21398348ejd.420.1604440114081; Tue, 03 Nov 2020 13:48:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604440114; cv=none; d=google.com; s=arc-20160816; b=TvtZyKwQsh51DxATWaECiDxfTobQaxt+JMw0nfI1/alY4PTFbpTNU3SHMVP/WHBOBr mOBHPi6YcDZZL6E6DTsVK0p89q6X8lj6Lxl1BNIGjWaToA0xK5IThgehwqt51AG0pf+K 5kltswk/5gorIRIF4NyOSM1k2MyFXGpxFOxG90g/FUYvU+L2MS3ndJNrCgAI6BV2Uijm nSxdBqZAhMX48HV3wa4sXzWdApp4CMi9JFnmA7xGiWYq29pCn13+ahrlXXIC7U9QNcJF R3otvUEXjPdkmDo6vV/NQi19aa5f+SUuh+NMDAEiQKDJotwATOTgO6+IRueNTLCRZun1 VhoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=juYuMcMPXnTknMiWULq+ntEV4fTdq3fcZR4hIM3lxw0=; b=iYKVYCcIX0n1D+jW6Yd+n6cDS34SmZdPAkh0BovrO3QSSQYOXumfjUbQm8DvB392ue C5W/qxd/f1Su2QJHYvpAc5H0qkWjGz34hjSe9BaLUawf06aA1mS1I4D/U8k+UDx0s//x SQyUP5THdAuz3ALZk0kGs2uXFrbGLi33Fcrc3ztnYH3buCPoYKF75WC2lCIN8ITjdIbk zrWXIEdpemT3erJQTZ+TZLcZm4xu/YiUpVzD0mg7FRNSLOQC2mHKw1VZiT34yQroqrs1 Rs0eVcEbLnzP6PpAOpqIoL6KXToSGvweizbYGKnW9htUEGcx1jO/C88lHuBOFl9XF34H shfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BPfERlYO; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zc3si17895ejb.158.2020.11.03.13.48.10; Tue, 03 Nov 2020 13:48:34 -0800 (PST) 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=@kernel.org header.s=default header.b=BPfERlYO; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732815AbgKCVnx (ORCPT + 99 others); Tue, 3 Nov 2020 16:43:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:53342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731912AbgKCUyX (ORCPT ); Tue, 3 Nov 2020 15:54:23 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5A802053B; Tue, 3 Nov 2020 20:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436862; bh=6D9VE4v3ufIQL1YLkBfnxzjUVIA3Z4NKpkz5j8Xkx+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BPfERlYO5A7rhq7aiw2mjZQXsT3wbA86DizT38tG4U65bGAyPyPAVLlZWrPTACtHt JYU1xvokUCMTO7cQBsyrxLytWlo86GUMKbCUSMsSWvZPD3ManyEA/RNdEbpifbvcZ0 0054eObMdKPn/ABpcpwHel5w6MgqTKVHmParoJSc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Luca Ceresoli , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 044/214] media: imx274: fix frame interval handling Date: Tue, 3 Nov 2020 21:34:52 +0100 Message-Id: <20201103203254.229577432@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Verkuil [ Upstream commit 49b20d981d723fae5a93843c617af2b2c23611ec ] 1) the numerator and/or denominator might be 0, in that case fall back to the default frame interval. This is per the spec and this caused a v4l2-compliance failure. 2) the updated frame interval wasn't returned in the s_frame_interval subdev op. Signed-off-by: Hans Verkuil Reviewed-by: Luca Ceresoli Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/imx274.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c index 6011cec5e351d..e6aa9f32b6a83 100644 --- a/drivers/media/i2c/imx274.c +++ b/drivers/media/i2c/imx274.c @@ -1235,6 +1235,8 @@ static int imx274_s_frame_interval(struct v4l2_subdev *sd, ret = imx274_set_frame_interval(imx274, fi->interval); if (!ret) { + fi->interval = imx274->frame_interval; + /* * exposure time range is decided by frame interval * need to update it after frame interval changes @@ -1730,9 +1732,9 @@ static int imx274_set_frame_interval(struct stimx274 *priv, __func__, frame_interval.numerator, frame_interval.denominator); - if (frame_interval.numerator == 0) { - err = -EINVAL; - goto fail; + if (frame_interval.numerator == 0 || frame_interval.denominator == 0) { + frame_interval.denominator = IMX274_DEF_FRAME_RATE; + frame_interval.numerator = 1; } req_frame_rate = (u32)(frame_interval.denominator -- 2.27.0