Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1221782rwr; Fri, 5 May 2023 10:45:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6vTcvbbFevfUG7mcRw/W/Sw34nB3HTh5jL0VttREOhCGWjYTTXryoVDEPaH/ixSvK4Udn5 X-Received: by 2002:a17:902:d485:b0:1aa:f612:cdf with SMTP id c5-20020a170902d48500b001aaf6120cdfmr2945049plg.37.1683308707183; Fri, 05 May 2023 10:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683308707; cv=none; d=google.com; s=arc-20160816; b=CBlvI5nDIGvZ2d9u0VeshK3ku3my967gCzb068awQXjqTSXntgige6jDYS+pSHrlbT DOcopWLUOgzZthJ4Wg1/L7w7MDOQwuF2ZsmfmdJ+hVEsBdccocmZojUfG0WZcdf8e2R1 T/dwGSOc2vW2rUDzopjZTdeLNLAk58o9F7nIzrRSbCNUI8fJUmsLu1Ez64tHI4TdaZzV OFGdPJEwLH2RV9CdcqmBEzkct17STbtKoIcFV6u9IzSER+Gj/RmPhUxBco2kyEO5xIqn B5c/4/JSHypO+v/s7qEhNTUwuRkArKP56Yf/vIhIodBNTbJ93HOHI2f0Tw5o4Rg89R/A t9eA== 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=h8+PqGqknRSGXtZL0fy39BR7VNMc6NmsuZN3MfYbgkE=; b=CG3/WxWODsXe7TMhj6cgSS1pjnOVxT7Wh8AvWJj3sRHyYdu4MLxDMITcJB3Y36P9Zx 17a+s7BMzZ258uOFBY9iEve6scxAyyYZOc5f7P5nwbM6vwCepjn0GScOEU4RWXyJ1SqS 9UFQnouRhnY5MXQ29Jkb0Uxw+8MFPiPe4koKDDrGsUewMuBJBnsFD9KV9YVOHMtv+BHD gpqCdV+AFWvDbIUNMgfalGmobQ9XxgXpa/EQeznqvDO/p56/2pTzKlNf/guwgDbzQeW9 nok52rNnA9Pvcj4EA8PXD2PYW1Xdjd5R0BBKkU8ylEJLEW6pSQKrV3tAhevG+r9G2C8p tRKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eQYJY2iF; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a170902d50c00b001a669006139si2212644plg.248.2023.05.05.10.44.52; Fri, 05 May 2023 10:45:07 -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=@kernel.org header.s=k20201202 header.b=eQYJY2iF; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232011AbjEERjR (ORCPT + 99 others); Fri, 5 May 2023 13:39:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231415AbjEERjP (ORCPT ); Fri, 5 May 2023 13:39:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4563B559E for ; Fri, 5 May 2023 10:39:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CEF19614A0 for ; Fri, 5 May 2023 17:39:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33356C4339E for ; Fri, 5 May 2023 17:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683308352; bh=He2VD5WDJqObFt05b2FpAEZOvPVyPfhb6478Y3/8MxY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=eQYJY2iF5yjQC7rU1s/b490L/utwiGhyxd+4mDES2GFaugkxpHqeRv5PaEJRitgXc xVswx8FbPQorgmnLl+ReF5FFefbX+yeRR/jMEbhmWVwtCVtkpGxxiSr+Kpm3cI6jsT 8SEzZFk6CG4t//A8Z4tqO02jj9ZXVv4dBpwHOqySvQFLonXHn2alAaOgjK0E4Vl3YO JfQT8QeAp+yqtySUfwI9AehFyJj2lcdKzeim29E4DFcngvKy7KrXtwZat/cra7I96U LcWjd5t+Gu+qlRWy8VYvEBdS+n3HVaAIOt6j8BXHj64aaJhzskp4ZlOxCLrLsdfrQQ 7Kr7nQc0KEnBg== Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-24e25e2808fso1898138a91.0 for ; Fri, 05 May 2023 10:39:12 -0700 (PDT) X-Gm-Message-State: AC+VfDwqm+Vl9RTDusdy+uEWEL8QTi+dcD/Qy46qy3ekI5GVC7urgPlP wHdwOa/+bGh1FWeLjoo7uXZNEzWZ9wAY7kdSY6C2mA== X-Received: by 2002:a17:90a:8e83:b0:250:3e1e:acd with SMTP id f3-20020a17090a8e8300b002503e1e0acdmr985112pjo.7.1683308351652; Fri, 05 May 2023 10:39:11 -0700 (PDT) MIME-Version: 1.0 References: <20230427142934.55435-1-francesco@dolcini.it> <20230427142934.55435-4-francesco@dolcini.it> In-Reply-To: <20230427142934.55435-4-francesco@dolcini.it> From: Robert Foss Date: Fri, 5 May 2023 19:39:00 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 3/9] drm/bridge: tc358768: fix PLL target frequency To: Francesco Dolcini Cc: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , tomi.valkeinen@ideasonboard.com, dri-devel@lists.freedesktop.org, Francesco Dolcini , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 Thu, Apr 27, 2023 at 4:32=E2=80=AFPM Francesco Dolcini wrote: > > From: Francesco Dolcini > > Correctly compute the PLL target frequency, the current formula works > correctly only when the input bus width is 24bit, actually to properly > compute the PLL target frequency what is relevant is the bits-per-pixel > on the DSI link. > > No regression expected since the DSI format is currently hard-coded as > MIPI_DSI_FMT_RGB888. > > Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver") > Signed-off-by: Francesco Dolcini > --- > drivers/gpu/drm/bridge/tc358768.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/t= c358768.c > index e9e3f9e02bba..dba1bf3912f1 100644 > --- a/drivers/gpu/drm/bridge/tc358768.c > +++ b/drivers/gpu/drm/bridge/tc358768.c > @@ -146,6 +146,7 @@ struct tc358768_priv { > > u32 pd_lines; /* number of Parallel Port Input Data Lines */ > u32 dsi_lanes; /* number of DSI Lanes */ > + u32 dsi_bpp; /* number of Bits Per Pixel over DSI */ > > /* Parameters for PLL programming */ > u32 fbd; /* PLL feedback divider */ > @@ -284,12 +285,12 @@ static void tc358768_hw_disable(struct tc358768_pri= v *priv) > > static u32 tc358768_pll_to_pclk(struct tc358768_priv *priv, u32 pll_clk) > { > - return (u32)div_u64((u64)pll_clk * priv->dsi_lanes, priv->pd_line= s); > + return (u32)div_u64((u64)pll_clk * priv->dsi_lanes, priv->dsi_bpp= ); > } > > static u32 tc358768_pclk_to_pll(struct tc358768_priv *priv, u32 pclk) > { > - return (u32)div_u64((u64)pclk * priv->pd_lines, priv->dsi_lanes); > + return (u32)div_u64((u64)pclk * priv->dsi_bpp, priv->dsi_lanes); > } > > static int tc358768_calc_pll(struct tc358768_priv *priv, > @@ -426,6 +427,7 @@ static int tc358768_dsi_host_attach(struct mipi_dsi_h= ost *host, > priv->output.panel =3D panel; > > priv->dsi_lanes =3D dev->lanes; > + priv->dsi_bpp =3D mipi_dsi_pixel_format_to_bpp(dev->format); > > /* get input ep (port0/endpoint0) */ > ret =3D -EINVAL; > @@ -437,7 +439,7 @@ static int tc358768_dsi_host_attach(struct mipi_dsi_h= ost *host, > } > > if (ret) > - priv->pd_lines =3D mipi_dsi_pixel_format_to_bpp(dev->form= at); > + priv->pd_lines =3D priv->dsi_bpp; > > drm_bridge_add(&priv->bridge); > > -- > 2.25.1 > Reviewed-by: Robert Foss