From patchwork Fri Nov 26 10:15:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 12640351 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ABBB8C433F5 for ; Fri, 26 Nov 2021 10:15:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4AA9A6EB2E; Fri, 26 Nov 2021 10:15:28 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 05E406EB2E for ; Fri, 26 Nov 2021 10:15:25 +0000 (UTC) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 65D5D1269; Fri, 26 Nov 2021 11:15:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1637921723; bh=sHtu4YZjz1duGU3+mxBG0gSBUA7LlDf0Si/PgC3rKYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPJe0VExl9vnJC/1txZPwDwwcwu9Ku4mPlx1l1giIS2YgUNvSRcKIs8zkxFn6X7J4 AlDrMO7TIGIqrIseVDPqgwTPdyxO6KnH7Ar31Syoxr8TsVTpPItuTq95zqzsZzu0ho +8UB0hG0NWdSKuNV8Nkm+C9KOhABEm0xU9LhOpS8= From: Kieran Bingham To: Laurent Pinchart , linux-renesas-soc@vger.kernel.org Subject: [PATCH 3/4] drm: rcar-du: mipi-dsi: Ensure correct fout is reported Date: Fri, 26 Nov 2021 10:15:17 +0000 Message-Id: <20211126101518.938783-4-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> References: <20211126101518.938783-1-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kieran Bingham , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The debug reporting for the clock calculations was erroneously reporting the last calculation of fout, rather than the fout that was determined to have the least error, and therefore be the values chosen to operate with. Fix the reporting to show the correct output by storing the determined fout, along with the error value. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- I spent /way/ too long confused why my clock values didn't make sense before I noticed this.. :-( drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c index e94245029f95..833f4480bdf3 100644 --- a/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c +++ b/drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c @@ -168,6 +168,7 @@ static int rcar_mipi_dsi_phtw_test(struct rcar_mipi_dsi *dsi, u32 phtw) */ struct dsi_setup_info { + unsigned long fout; unsigned int err; u16 vco_cntrl; u16 prop_cntrl; @@ -247,6 +248,7 @@ static void rcar_mipi_dsi_parameters_calc(struct rcar_mipi_dsi *dsi, setup_info->m = m - 2; setup_info->n = n - 1; setup_info->err = err; + setup_info->fout = fout; if (err == 0) goto done; } @@ -256,7 +258,7 @@ static void rcar_mipi_dsi_parameters_calc(struct rcar_mipi_dsi *dsi, done: dev_dbg(dsi->dev, "%pC %lu Hz -> Fout %lu Hz (target %lu Hz, error %d.%02u%%), PLL M/N/DIV %u/%u/%u\n", - clk, fin, fout, fout_target, setup_info->err / 100, + clk, fin, setup_info->fout, fout_target, setup_info->err / 100, setup_info->err % 100, setup_info->m, setup_info->n, setup_info->div); dev_dbg(dsi->dev,