Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp47094rwd; Mon, 12 Jun 2023 09:56:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ76wfDqknfhIHjlUKZtTDX9+ggsz9VgmtXY8W/C7Lv+/cAgtkSiVpEbyqkNOQmEMmftK0F9 X-Received: by 2002:a05:6a00:c8f:b0:65b:351a:e70a with SMTP id a15-20020a056a000c8f00b0065b351ae70amr12520975pfv.29.1686588983445; Mon, 12 Jun 2023 09:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686588983; cv=none; d=google.com; s=arc-20160816; b=YJ7feAclj/T8BN+2MgpTFNqhPZPTP7i1nPRCGw45iO5l2IDRknmUmzBXI0bdH8TVbU l11Z5UqRkgBzSyPSHae718THlwJrJ3Qex20HzhlsfUlqsuwve8XW8ELZDtPoD3OBF7CR kslRGZGQ7jHkszFLtU9+LkIvZAgKpxVhGnI5VkY0pug3ZDj6DDMPzSDWi0BR4GvKhh2s mUWd3So1RRW+fG749RU5k3pFPk4yEvJ2XrshQKiRdt+KzbIICitTSsFVSKhYb18vPI09 j/Vjqtydxn0v6x5XPEEiMFW0pzX8HFQLrM4m97imz822BmjuLPPZj7oOQx/NUVfmw96C RCTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=qIiNp/+XnyYlFBhx16pJwnV+pMJsdKM6JDpF0smN2gs=; b=ivLq+yL6uidDoTeJkUr34Q4jhG/yiMERFAs52JSAJKdQIGR992vQTPEVXmXwI8zblG NuJcmTKjMYyAOXi/FnwQHUCXPG0hOkqmeYz6ah3t1p+PFwx+0f+hjgS+HUD/3rs3X9Xj SJqXr1FgMwwRE2dZ3qrVSid6HiwqwZUwi3rCLR58mNswCLOTz7Igrn8dqtuV90Z0xl1b E04cOVsx0QfD+74aeVGbhPuTprq0gafKU8OGbFFCosaQwL7vkEY3G99GMFJBZvbzR0S6 gpFY6WGv+RthyqzD0OEKkFhI1imZS7ApibfPTGKTo2PbLZVwF7fg7PbWGONm78jJAE9X Edcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=F44Q+3WT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z7-20020aa79907000000b00640f330a547si3518012pff.236.2023.06.12.09.56.11; Mon, 12 Jun 2023 09:56:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=F44Q+3WT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232154AbjFLQLg (ORCPT + 99 others); Mon, 12 Jun 2023 12:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbjFLQLe (ORCPT ); Mon, 12 Jun 2023 12:11:34 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11ADB1A5; Mon, 12 Jun 2023 09:11:33 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-543ae674f37so2359785a12.1; Mon, 12 Jun 2023 09:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686586292; x=1689178292; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qIiNp/+XnyYlFBhx16pJwnV+pMJsdKM6JDpF0smN2gs=; b=F44Q+3WTqR3Bl1u8BnHfFuJt+/g9Jsl4jsZOGfD1UgeN9naLB1TcSqIyOT9ZUm4lEy V1MFxJk04D7y3h5G+xUO0TV13T6bQE07WcnGtJydU3G36ErmxevlXF7oa1PPiLJ9pSJZ dIwr5wtozJ3mkxO+GY0qPF4bNe+hR4Jql/pw4gnVkIHsS/KfCk2p37yOd7tKoY7rTVoj xaeQbwaOj6KQpeKm3VIQwBL0+paQWbmIADJLL3kBqA+tuK3+ibIJD+WTPz1/Tmv0fIJN d7k8CcwRn5QO8kJEslBrQ24Z0Y1oh1ts2nOFEI23qddUni7p94gNRanxAC5rzxvrMGO1 iwVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686586292; x=1689178292; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qIiNp/+XnyYlFBhx16pJwnV+pMJsdKM6JDpF0smN2gs=; b=E/NUGSoFtJk+UOcikGW/rXwHeAgf6TUxGiWIEEelA5CRS1S09fAPOB+Yhl6yCF9q6Q xdE+mDFOpXa04vr7/0OlTNA3j4AHAJsPC25l+9eG0xb3gk55/5I9CdYzOQGYrRsUstTy x4AuIGKWG8es8fDsXDvnl9kJIXdejhjLoYnPGfp6BPAeMbCfp+DxiEiTxfCC4/wNi6RN jHrWRaXw8OF23kaquQEjyAtPuXbxoDLG8dNuCnexR6D7iXBHnO1MfO9MHfEOao77XuxL 8M4Ak+eNoKnNidEAiH1KsoUzbXDp2M3grVNHXgTyY1VNhroEXAzl58A1wLTOpn/8j0vk 7fKg== X-Gm-Message-State: AC+VfDybqOYNFe+onoJLqs/iRityWTNfdBM8ydvrkmLJ5+RBAChzjECZ wYpktuzGJM7eVOoMYJHvDUtmPdlFwlFuep1aVis= X-Received: by 2002:a17:90b:4b91:b0:258:c780:479e with SMTP id lr17-20020a17090b4b9100b00258c780479emr8073092pjb.13.1686586292374; Mon, 12 Jun 2023 09:11:32 -0700 (PDT) MIME-Version: 1.0 References: <20230506195325.876871-1-aford173@gmail.com> In-Reply-To: From: Adam Ford Date: Mon, 12 Jun 2023 11:11:21 -0500 Message-ID: Subject: Re: [PATCH] clk: imx: composite-8m: Add imx8m_divider_determine_rate To: Maxime Ripard Cc: Fabio Estevam , linux-clk@vger.kernel.org, aford@beaconembedded.com, Abel Vesa , Peng Fan , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 12, 2023 at 11:08=E2=80=AFAM Maxime Ripard = wrote: > > On Sun, Jun 11, 2023 at 12:02:42PM -0500, Adam Ford wrote: > > On Tue, Jun 6, 2023 at 1:45=E2=80=AFPM Fabio Estevam wrote: > > > > > > On Sat, May 6, 2023 at 4:53=E2=80=AFPM Adam Ford = wrote: > > > > > > > > Currently, certain clocks are derrived as a divider from their > > > > parent clock. For some clocks, even when CLK_SET_RATE_PARENT > > > > is set, the parent clock is not properly set which can lead > > > > to some relatively inaccurate clock values. > > > > > > > > + Maxime > > > > > > Unlike imx/clk-composite-93 and imx/clk-divider-gate, it > > > > cannot rely on calling a standard determine_rate function, > > > > because the 8m composite clocks have a pre-divider and > > > > post-divider. Because of this, a custom determine_rate > > > > function is necessary to determine the maximum clock > > > > division which is equivalent to pre-divider * the > > > > post-divider. > > > > > > > > With this added, the system can attempt to adjust the parent rate > > > > when the proper flags are set which can lead to a more precise cloc= k > > > > value. > > > > > > > > On the imx8mplus, no clock changes are present. > > > > On the Mini and Nano, this can help achieve more accurate > > > > lcdif clocks. When trying to get a pixel clock of 31.500MHz > > > > on an imx8m Nano, the clocks divided the 594MHz down, but > > > > left the parent rate untouched which caused a calulation error. > > > > > > > > Before: > > > > video_pll 594000000 > > > > video_pll_bypass 594000000 > > > > video_pll_out 594000000 > > > > disp_pixel 31263158 > > > > disp_pixel_clk 31263158 > > > > > > > > Variance =3D -236842 Hz > > > > > > > > After this patch: > > > > video_pll 31500000 > > > > video_pll_bypass 31500000 > > > > video_pll_out 31500000 > > > > disp_pixel 31500000 > > > > disp_pixel_clk 31500000 > > > > > > > > Variance =3D 0 Hz > > > > > > > > All other clocks rates and parent were the same. > > > > Similar results on imx8mm were found. > > > > > > > > Fixes: 690dccc4a0bf ("Revert "clk: imx: composite-8m: Add support t= o determine_rate"") > > > > Signed-off-by: Adam Ford > > > > > > > Peng / Abel, > > > > Any suggestions on how we can move this forward? Looking at the > > clk-composite-8m driver, imx8m_clk_composite_compute_dividers uses the > > max values which is basically what my patch does. There was some > > discussion about making determine_rate mandatory for muxes[1] and this > > patch should help with this in addition to making it easier to sync > > more video resolutions on the 8m Mini and Nano. > > Those patches have been queued by Stephen for 6.6 :) One of the patches in the older series was reverted, but this was to address the patch that was reverted. adam > > Maxime