From patchwork Fri May 5 07:16:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 679480 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 924FDC77B7C for ; Fri, 5 May 2023 07:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230486AbjEEHQx (ORCPT ); Fri, 5 May 2023 03:16:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230317AbjEEHQw (ORCPT ); Fri, 5 May 2023 03:16:52 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5F281609B for ; Fri, 5 May 2023 00:16:50 -0700 (PDT) Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7B2247FC; Fri, 5 May 2023 09:16:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1683271005; bh=Z0DLyAQeWXzkOj8s0UWteNNulJvyxlF5ckKLl8Mnk20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CpF3RXTHan0MOZUuYCVVmf7+GkH8wadxm5dOu49v0DSjI2g2vdUIFeqlvVvqDQAJO ZLhkosdya+apvm3GUH3PCL0Vbif47iz/VlmqwnG01RYvzj42mDVqyTWMdHIKnDbn5v ZFMs0jq1IwwMMS2sSG+CsTKKgL2ey6YRGmBqEebE= From: Jacopo Mondi To: "Guoniu . zhou" Cc: Jacopo Mondi , slongerbeam@gmail.com, linux-media@vger.kernel.org, mchehab@kernel.org Subject: [PATCH 1/2] media: ov5640: Remove unused 'framerate' parameter Date: Fri, 5 May 2023 09:16:18 +0200 Message-Id: <20230505071619.63229-2-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230505071619.63229-1-jacopo.mondi@ideasonboard.com> References: <20230505071619.63229-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The 'current framerate' parameter passed to ov5640_try_fmt_internal() is unsued. Drop it. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/ov5640.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 1536649b9e90..9bba3b0f8981 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -2815,7 +2815,6 @@ static int ov5640_get_fmt(struct v4l2_subdev *sd, static int ov5640_try_fmt_internal(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt, - enum ov5640_frame_rate fr, const struct ov5640_mode_info **new_mode) { struct ov5640_dev *sensor = to_ov5640_dev(sd); @@ -2975,8 +2974,7 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd, goto out; } - ret = ov5640_try_fmt_internal(sd, mbus_fmt, - sensor->current_fr, &new_mode); + ret = ov5640_try_fmt_internal(sd, mbus_fmt, &new_mode); if (ret) goto out; From patchwork Fri May 5 07:16:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 679479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC4D5C7EE22 for ; Fri, 5 May 2023 07:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbjEEHQz (ORCPT ); Fri, 5 May 2023 03:16:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230496AbjEEHQy (ORCPT ); Fri, 5 May 2023 03:16:54 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 611557EF8 for ; Fri, 5 May 2023 00:16:53 -0700 (PDT) Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0F53B82F; Fri, 5 May 2023 09:16:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1683271006; bh=cXusvt5AIJTLDcjoDyduzXVqzuJBFOlCyyG5n66V+R0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HTTX1JHqP8ViWQScbTkX7+TKudfnVmw3fY3/RzyhzZlHNEO1xx9mZ8jFRlShquu/D XwurSP6nkw5won3buNDBicDXfst72Ih/eb+KQuGKZyDoI7lDbgjJZ1yPpwkNY7omyi XXahdisTtLb+5iP7k9gxgfq4lUDUsLyfLuOhYWdY= From: Jacopo Mondi To: "Guoniu . zhou" Cc: Jacopo Mondi , slongerbeam@gmail.com, linux-media@vger.kernel.org, mchehab@kernel.org Subject: [PATCH 2/2] media: ov5640: Drop dead code using frame_interval Date: Fri, 5 May 2023 09:16:19 +0200 Message-Id: <20230505071619.63229-3-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230505071619.63229-1-jacopo.mondi@ideasonboard.com> References: <20230505071619.63229-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The ov5640_update_pixel_rate() function handles the parallel and MIPI CSI-2 cases separately. When running on a parallel setup the V4L2_CID_PIXEL_RATE value is calculated at the beginning of the function using the values configured with the frame_interval operations, and then the function immediately returns. The remaining of the function handles the MIPI CSI-2 configuration and should not use the 'current_fr' and 'def_fps' fields as those are only relevant for parallel mode. Drop a small section of dead code that updates vblank using frame_interval on a MIPI CSI-2 setup. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/ov5640.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 9bba3b0f8981..fd3ea44a95e9 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -2926,19 +2926,6 @@ static int ov5640_update_pixel_rate(struct ov5640_dev *sensor) hblank, hblank, 1, hblank); vblank = timings->vblank_def; - - if (sensor->current_fr != mode->def_fps) { - /* - * Compute the vertical blanking according to the framerate - * configured with s_frame_interval. - */ - int fie_num = sensor->frame_interval.numerator; - int fie_denom = sensor->frame_interval.denominator; - - vblank = ((fie_num * pixel_rate / fie_denom) / timings->htot) - - mode->height; - } - __v4l2_ctrl_modify_range(sensor->ctrls.vblank, OV5640_MIN_VBLANK, OV5640_MAX_VTS - mode->height, 1, vblank); __v4l2_ctrl_s_ctrl(sensor->ctrls.vblank, vblank);