Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1257846pxx; Tue, 27 Oct 2020 12:02:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt31LVbWQVtUr+tpkYvP/oWaUnHIGXVsXBUbbIoC8JuObgzz5IGy0ayOpmeIGqWKGVUQZz X-Received: by 2002:a17:906:6d04:: with SMTP id m4mr4118827ejr.68.1603825325807; Tue, 27 Oct 2020 12:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603825325; cv=none; d=google.com; s=arc-20160816; b=ppCfAguKwg47/UbhTJJHbuoyzNHzq1dc0HE4z/4H8V2Ybl4CoGGLe7JcNm5/Yu/fSL vGf47887+O2KkRiqW9lEOcCpZgJH75LDhavAqKP+qvg21WrNYGhhAFWDgER+uBQ7hXqM PVCMUyWsaEh8r8LkRb4NvjoUOtdQyO1qcIWHVRr/esfzWcvRtwnZSSGIGEOAhkU82W1C Ty9U37mzPoDoXIFNCsxEKKToiO2TjP7OZsRf+Qmb9VUCcWEAgRecpt0eP77TrbN0/opY j8CR5QdCYBty87a/fgZSDqQHaYyLPziaCHxOxxsj++WtL+Kpzqw2/Uhb7II4uHp3sKmT jxMQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Qs2sArr6loD05OB2WPKOBon/nDjugKPBUPO7fyFXGwA=; b=rF71gWyw2xV8gj4Uo25divuQCwW0YcXG3kj/vHW2kIG+hFCpppcXfl7Wdwxv45xgIR aq0HzYbSlqmmCRXJ+IlpTAEWNwE1weYgAX6lX3zEWcGMjKC8Ei6cWkBpeJKIVJLGI37E MzNjaSaIKWysZm7Z/uJ5Z+VRw2QygTF+ITgrOJdjbSFio1C8nTHn9c/QAo4QTUyTrJ// hxbXlfOVQnWxMGAErd2euV7z8tA04rI2PzCqqJyuIX5j4uQ+XXpvLyz60PExayK+rBjf rQb1f1H9mcjCj4v/qLUAj5HmHfBn0DxJIwUBYdzT+/0aRR9G0Lx91eYTyde8zs/gq17g wAEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UzmZsZ6s; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si1725187edi.413.2020.10.27.12.01.40; Tue, 27 Oct 2020 12:02:05 -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=@kernel.org header.s=default header.b=UzmZsZ6s; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2444502AbgJ0Aix (ORCPT + 99 others); Mon, 26 Oct 2020 20:38:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:49152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408771AbgJZXuJ (ORCPT ); Mon, 26 Oct 2020 19:50:09 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB26B216FD; Mon, 26 Oct 2020 23:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756208; bh=SK9zudvrywtJq/m9EgjmbBefuNPDXV6s1teD0suvgyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UzmZsZ6s86NaTvL1SO/REsuPvcWqA4U5MWMJH/quYpj4OFrFo9QV7tb5EsHt2V/wc wbHisav7LHISYLc6xl9AREllX/i3Dv4mvL9BnSDPx22w13Jsc3gzOgXOvmeN/MZAbp +Amltw22o0WjIABwT+yVxcNbxCDcgif7HO0KeWiw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans Verkuil , Hans Verkuil , Luca Ceresoli , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.9 050/147] media: imx274: fix frame interval handling Date: Mon, 26 Oct 2020 19:47:28 -0400 Message-Id: <20201026234905.1022767-50-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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.25.1