From patchwork Thu Oct 11 09:21:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10636331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0434933 for ; Thu, 11 Oct 2018 09:21:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C50882B1EA for ; Thu, 11 Oct 2018 09:21:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B99D32B207; Thu, 11 Oct 2018 09:21:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6096D2B1EA for ; Thu, 11 Oct 2018 09:21:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728388AbeJKQr4 (ORCPT ); Thu, 11 Oct 2018 12:47:56 -0400 Received: from mail.bootlin.com ([62.4.15.54]:46742 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728373AbeJKQr4 (ORCPT ); Thu, 11 Oct 2018 12:47:56 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 83848208B7; Thu, 11 Oct 2018 11:21:29 +0200 (CEST) Received: from localhost (AAubervilliers-681-1-7-245.w90-88.abo.wanadoo.fr [90.88.129.245]) by mail.bootlin.com (Postfix) with ESMTPSA id 0E9A9208C2; Thu, 11 Oct 2018 11:21:12 +0200 (CEST) From: Maxime Ripard To: Mauro Carvalho Chehab Cc: Laurent Pinchart , linux-media@vger.kernel.org, Thomas Petazzoni , Mylene Josserand , Hans Verkuil , Sakari Ailus , Hugues Fruchet , Loic Poulain , Samuel Bobrowicz , Steve Longerbeam , Daniel Mack , Jacopo Mondi , Maxime Ripard Subject: [PATCH v4 12/12] ov5640: Enforce a mode change when changing the framerate Date: Thu, 11 Oct 2018 11:21:07 +0200 Message-Id: <20181011092107.30715-13-maxime.ripard@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181011092107.30715-1-maxime.ripard@bootlin.com> References: <20181011092107.30715-1-maxime.ripard@bootlin.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current logic only requires to call ov5640_set_mode, which will in turn change the clock rates according to the mode and frame interval, when a new mode is set up. However, when only the frame interval is changed but the mode isn't, ov5640_set_mode is never called and the resulting frame rate will be old or default one. Fix this by requiring that ov5640_set_mode is called when the frame interval is changed as well. Signed-off-by: Maxime Ripard --- drivers/media/i2c/ov5640.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 818411400ef6..e01d2cb93c67 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -2638,8 +2638,12 @@ static int ov5640_s_frame_interval(struct v4l2_subdev *sd, goto out; } - sensor->current_fr = frame_rate; - sensor->frame_interval = fi->interval; + if (frame_rate != sensor->current_fr) { + sensor->current_fr = frame_rate; + sensor->frame_interval = fi->interval; + sensor->pending_mode_change = true; + } + mode = ov5640_find_mode(sensor, frame_rate, mode->hact, mode->vact, true); if (!mode) {