Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp736712rwr; Thu, 27 Apr 2023 07:33:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BNXGwsOkNK285nTZXSYS7by+usjtslF74fpoyfVHQLNew1bJFj1G5xT9xZWPEux+uTTdf X-Received: by 2002:a05:6a20:7491:b0:f6:d60d:dbfc with SMTP id p17-20020a056a20749100b000f6d60ddbfcmr2316824pzd.5.1682606036247; Thu, 27 Apr 2023 07:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682606036; cv=none; d=google.com; s=arc-20160816; b=uc11omf1kg6TDVirVokvhoGuZJ8bOo4CXooL2V24V2wPHu0o3dWH8NQJjNKdK9JizE 0tbF0t7KTyM4H981qABIr/9mi3yovFe483sbSTPbZle4q59dlYstsMm20LAAdCySqVH9 zGJWFVYXdJmUFuitx71mTDF1xCoPutzemLSIJRyCo5ovVCezSE5E0S1JcVmvjOszMQkh 6sAev4WCy8wZJw8EVs4Sxmoa4S0rrbo6/I2lxfDaYBnxs5o+78En3bIHcOTv8BAeuVgw iFp/pifYIS0SXnKZ8OJpOk0zXnmVKM9voHPgssn/YaOr6zBq2wS7YGvWWBtEBEvGwIMg O8ug== 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; bh=BcZawSlRTUe3EEm2H5Abe9LXuKrbNun3jXgsY5x6Fdg=; b=ujy8BneihImR2ElCrvmjyJGpoX3pDRqufrrmfCGjRmhCt556/EFBdQ9LffjNAiv98U HO/AQOF6tGYvnWXSfdyaB8jIoLQK84fs1ljPAfXalzc2C/zY+xEgO9szs3hZutIonGhA /Yu5lC9EDsgKM7tItb8peDJ7FH0Z3GDdicVWx9o+0+9ndz2Uu6tG0CH8PITnZFARO41f GOjRm0E5T+Me6dBfBx89oaHbmzsC39+etMDRPdajhBCb4XC5z4Z5pEu3IO3vSfdKtbsv DafpIRSpK7xn8MI+5tobFIl1zvF4R8qv8L8CTPZcB+lBLzwDGgnWIZjdAeRND/jTf99u ILKg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a63f507000000b0051fe610ae34si17832515pgh.451.2023.04.27.07.33.42; Thu, 27 Apr 2023 07:33:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244093AbjD0OaV (ORCPT + 99 others); Thu, 27 Apr 2023 10:30:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243468AbjD0OaT (ORCPT ); Thu, 27 Apr 2023 10:30:19 -0400 Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B2CA5BAC for ; Thu, 27 Apr 2023 07:29:44 -0700 (PDT) Received: from francesco-nb.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 5073420B52; Thu, 27 Apr 2023 16:29:40 +0200 (CEST) From: Francesco Dolcini To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , tomi.valkeinen@ideasonboard.com, dri-devel@lists.freedesktop.org Cc: Francesco Dolcini , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org Subject: [PATCH v1 2/9] drm/bridge: tc358768: fix PLL parameters computation Date: Thu, 27 Apr 2023 16:29:27 +0200 Message-Id: <20230427142934.55435-3-francesco@dolcini.it> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230427142934.55435-1-francesco@dolcini.it> References: <20230427142934.55435-1-francesco@dolcini.it> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 From: Francesco Dolcini According to Toshiba documentation the PLL input clock after the divider should be not less than 4MHz, fix the PLL parameters computation accordingly. Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver") Signed-off-by: Francesco Dolcini --- drivers/gpu/drm/bridge/tc358768.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c index 8f349bf4fc32..e9e3f9e02bba 100644 --- a/drivers/gpu/drm/bridge/tc358768.c +++ b/drivers/gpu/drm/bridge/tc358768.c @@ -334,13 +334,17 @@ static int tc358768_calc_pll(struct tc358768_priv *priv, u32 fbd; for (fbd = 0; fbd < 512; ++fbd) { - u32 pll, diff; + u32 pll, diff, pll_in; pll = (u32)div_u64((u64)refclk * (fbd + 1), divisor); if (pll >= max_pll || pll < min_pll) continue; + pll_in = (u32)div_u64((u64)refclk, prd + 1); + if (pll_in < 4000000) + continue; + diff = max(pll, target_pll) - min(pll, target_pll); if (diff < best_diff) { -- 2.25.1