Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp637615pxx; Mon, 26 Oct 2020 17:41:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiqjN+UNc6EvH7Hc8nGmjelSLdH55wLwFnZSjaeyih9/MovvLC7Gc100Py43M/jacDtdXM X-Received: by 2002:a17:907:11d0:: with SMTP id va16mr17378690ejb.22.1603759315251; Mon, 26 Oct 2020 17:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603759315; cv=none; d=google.com; s=arc-20160816; b=aU/9umdJ8Z6r+WzMXEDWUeQvwJbVQ2sIN67RBH7VIJqGr6AriJqJ+2ikiy/SngWlZN fAfea16MIRSwJXEMUWV6xRaHFbaCFEvR3YoQv4XQwWJ+OvafZV2Gc3RIe1Ya9Ypbta0D rSzMRVlkeIN2Lr0IinGAI4w79QtL3pZIOk3AJVBbdkB8WnCA61JvQWfjZBCR3PuJ5ukw 6B4JJtuL1gEfoGn9uwO9DUDbJ30b5r10AZd3ep/qWLRSTQYQAw07k8xrG0rbPjmMg+a4 U5E4Vpf/IZM5V/N/QgHIJWQgohnWwuyBPUAJjhYfUxS6WWi4ocdrLfRB0poqi3EHRMwk 0eCA== 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=sk+PqQTek/HqEDBKYjCBlWoVTxHotnMUmZvYmzXsh0raz+ekyB3eQThUamlCUyYuWp Jb369Q5LdMi5NugYuUIK9ksrF8DfrqOKuTjP+aj0xK7IjLbC2l/o+e/bPayhlOS4nfON sECdMe7WBdLeACgwQtsOlf1MfhdZpNtqZGnfRa+czTiuslJIdYBj3FaiiN6iTB+JxyN+ 0xVdWdpMwD7Ldt22l7Wehrv1DjBGrKSprOQfiopaC1K0s5szAZfjR9h0NwWJ92lSdhlW sPnK0wotO/G2OOfAbEgLy/Oyvf2gBRo614UY7GVkb+9rtniCOpd6b5I51UEM5JDLeZvU 32NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vhBXAvSj; 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 l20si8198348edv.312.2020.10.26.17.41.33; Mon, 26 Oct 2020 17:41:55 -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=vhBXAvSj; 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 S2441270AbgJ0AWD (ORCPT + 99 others); Mon, 26 Oct 2020 20:22:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:34364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410965AbgJZXzs (ORCPT ); Mon, 26 Oct 2020 19:55:48 -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 3090C20882; Mon, 26 Oct 2020 23:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756548; bh=SK9zudvrywtJq/m9EgjmbBefuNPDXV6s1teD0suvgyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhBXAvSj1Bl2unVZWv60bT0ZMdKs96Df0nV+DemjLpyQmPoNUjckv+jUrMjQASek+ nBwLT8oD4hvGByNrORz50vALz/J5f1XTghnor9dmzBlxgvBiOjzqBk8h37sf1obrZH CUSMbjamzrSiekuiSMTipJQv7uBajr82lT2noeAo= 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.4 25/80] media: imx274: fix frame interval handling Date: Mon, 26 Oct 2020 19:54:21 -0400 Message-Id: <20201026235516.1025100-25-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235516.1025100-1-sashal@kernel.org> References: <20201026235516.1025100-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