Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1256832rwr; Fri, 5 May 2023 11:15:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6v73UVcVrEL9lR3pG/FzA1enyRVhlWZjoy9UziQtYLMhz+JgWi8mu9wgHGvZ8RpYoFAe2I X-Received: by 2002:a17:902:d304:b0:1a9:21bc:65f8 with SMTP id b4-20020a170902d30400b001a921bc65f8mr2350968plc.11.1683310530269; Fri, 05 May 2023 11:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683310530; cv=none; d=google.com; s=arc-20160816; b=0WUwWgMCaZNHTH6gCIokbupTW/aPx63vM9MAeW2N2IJ1wdR90PkJabAd2Hz5jHoUnU bhIvu0pbrugtN9/ASWxYC4c9IRLh1RZKungRLHyzovANhycJk2uNSy/3KPd/c/O90Cw+ nsVksUWqYzhkV7Io8Q1Niomjlw3XsDsVRqiX1DGE02rrGejWGcsefUxsQL4C5JAs9tko p6KHfLzuacNr2HJ0dNSnh+5VbNfYAKSQRJEqLj7myKJFqtOWRMsBGNxipqaTmAVp8AeC 7Vg3tL9pOgHqv0Vok79qcLFlRc4bf4uchTTBlwJ+vY8aYnpmxo0+1hEw+ATyH8cMdwNx 1FcQ== 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=idLudYwf8GW9pF0p+ZS+UBylbjdT04HfxyUiVFdFYa0=; b=HQ9jsNfqqciGajA5Ql7K1ZreM2ci9m43wcb1h81KPU9VifAHrTOFOCAj6M/0Gu0EA2 q1JwfcoKYqGxeKTzKcxb9RJzlBkKjS/engpYy+gNnRB+lZacuZTeyeNXEUsua2+3cZru wp/QQrYinxaZoqneNl4G8JcpCiM5fv0X/lPXctPgqAFVE0+EqGwgP1CLfoEXZm05kpmB WnSj6azA0ksxMIDj+UAioearV6e0KQdvzZeDi9Vse2yL6BreCDxcUHGLbpe8GEAdfUQL nZ6Y6SgCwfbiHAo+M8pm6twBGMuq3LKmdV1orS8mRt/KMVmQB2n+qd/WMZg8e4+4rCjv +Lnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kzt08nxP; 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 d6-20020a170902cec600b001ab10e58308si2379413plg.400.2023.05.05.11.15.16; Fri, 05 May 2023 11:15:30 -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=kzt08nxP; 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 S232149AbjEESHP (ORCPT + 99 others); Fri, 5 May 2023 14:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231580AbjEESHO (ORCPT ); Fri, 5 May 2023 14:07:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E1781161B for ; Fri, 5 May 2023 11:07:12 -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 AD4F363FC3 for ; Fri, 5 May 2023 18:07:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11467C433AC for ; Fri, 5 May 2023 18:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683310031; bh=SLXLVsRKiID4HTKaDJ18JTOztvB3O778HpU6t3fR1U4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kzt08nxPFS8hKFeBDEXS9DAuBEmSltfclRtK0OxvFmPD/vAt0YysnDZF5U7q4n7Vi /73HIALD8NRSOAkkw+hnHm40mShBnw6XgD7HRlitLogv7z6T3r4cU9LUyKucZ6PlEs ieNwKSW7bmawpk8n0cvzhpa2ss8U01/jYXiSKKxvxTQwCBkHWeK1x2BKE0kUcgeGh7 a7QiDYcOFX61Yfy1+i2ljRR40fjh/tamqRX4dwOSZYjGF6AB2jpFKnjsJtiIrtvVYZ aSPfacCO4iLE4zunbv5EO4mcHGcP+BVVD9pRjPtbcYvT4+TMm49x1jJzEnUbnHgNxj HpflT6o3BT9cw== Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-643557840e4so2397484b3a.2 for ; Fri, 05 May 2023 11:07:11 -0700 (PDT) X-Gm-Message-State: AC+VfDwNNzUrMt/6/yCqXHXTijgm+YHaccB1BUcEXAA5RgALda7M4b5p dF3mJ2EwrjPBHmivMFtweP+Plcz+Dwy1+IU885fLLw== X-Received: by 2002:a05:6a20:748d:b0:f4:24e6:1065 with SMTP id p13-20020a056a20748d00b000f424e61065mr3044424pzd.39.1683310030576; Fri, 05 May 2023 11:07:10 -0700 (PDT) MIME-Version: 1.0 References: <20230427142934.55435-1-francesco@dolcini.it> <20230427142934.55435-9-francesco@dolcini.it> In-Reply-To: <20230427142934.55435-9-francesco@dolcini.it> From: Robert Foss Date: Fri, 5 May 2023 20:06:59 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 8/9] drm/bridge: tc358768: fix THS_TRAILCNT computation 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=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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:34=E2=80=AFPM Francesco Dolcini wrote: > > From: Francesco Dolcini > > Correct computation of THS_TRAILCNT register. > > This register must be set to a value that ensure that > THS_TRAIL > 60 ns + 4 x UI > and > THS_TRAIL > 8 x UI > and > THS_TRAIL < TEOT > with > TEOT =3D 105 ns + (12 x UI) > > with the actual value of THS_TRAIL being > > (1 + THS_TRAILCNT) x ByteClk cycle + ((1 to 2) + 2) xHSBYTECLK cycle + > - (PHY output delay) > > with PHY output delay being about > > (8 + (5 to 6)) x MIPIBitClk cycle in the BitClk conversion. > > Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver") > Signed-off-by: Francesco Dolcini > --- > drivers/gpu/drm/bridge/tc358768.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/t= c358768.c > index 854fc04f08d0..947c7dca567a 100644 > --- a/drivers/gpu/drm/bridge/tc358768.c > +++ b/drivers/gpu/drm/bridge/tc358768.c > @@ -779,9 +779,10 @@ static void tc358768_bridge_pre_enable(struct drm_br= idge *bridge) > dev_dbg(priv->dev, "TCLK_POSTCNT: 0x%x\n", val); > tc358768_write(priv, TC358768_TCLK_POSTCNT, val); > > - /* 60ns + 4*UI < THS_PREPARE < 105ns + 12*UI */ > - val =3D tc358768_ns_to_cnt(60 + tc358768_to_ns(15 * ui_nsk), > - dsibclk_nsk) - 5; > + /* max(60ns + 4*UI, 8*UI) < THS_TRAILCNT < 105ns + 12*UI */ > + raw_val =3D tc358768_ns_to_cnt(60 + tc358768_to_ns(18 * ui_nsk), > + dsibclk_nsk) - 4; > + val =3D clamp(raw_val, 0, 15); > dev_dbg(priv->dev, "THS_TRAILCNT: 0x%x\n", val); > tc358768_write(priv, TC358768_THS_TRAILCNT, val); > > -- > 2.25.1 > Reviewed-by: Robert Foss