Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3962981pxv; Tue, 13 Jul 2021 07:50:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZ6c8UkAuCLxvTBSK5fPxgeLKRV9Z31g4wsl0Fqs68KGWFsm9Y8uOVN71MF/q5ol6Om99G X-Received: by 2002:a5d:8986:: with SMTP id m6mr3430555iol.87.1626187856205; Tue, 13 Jul 2021 07:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626187856; cv=none; d=google.com; s=arc-20160816; b=Yb5pOFwqAaE2ccDZk6C8N74yrvOpy2Xs5dHJXzbMQaXhamsaufqyHvReDhFo/lQvVZ NupdRuo4R2by8rOIoZu9GsEauQWRgxrj0zlrA/qWxVcPgiyPyJG1O740TAWxbdHC9Brn +3p7K0fX/ge83QND+0y/GasN9AsYcxJzN1ssMa8gcWT7SqL723pZpL22FmSnPaG5eiMB Dxrn3illfC6PUKIboI7Whs905kvcOdW0IEvk8l17aNzU5a61aAIngUzSZfGnOgP8hRLR nKSgGgJcd9nbuMwrP7/HVm6FTe32IjiRJdql/Y95UanvTIe1FbOO3ejlDJioilTVoXMf nGgw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=7iogho2MPvmeERAslTdZvt0AwKrPJiklnLgTcqL++t4=; b=qX9vRAL8kCkgfBioCj0rR1w90BnYYNNYLSagxNj8ndQi3eeNICrlov+/ISiEZYvvon 9pTo2aRKqQ+51aJgcea31AMIbIW3SULW6LLBeEgdQKlW4VFVeaDcIKGL/WfTH97JlmL+ BQ2PZxIm7q8Xc8sj4SZtblsAyjmnE5Rw14+ufspKAndH5Wb40CB31ZeEoAbFz5dH5oLi +DMyml9M4VsWx8kTvwkCU2XHJCuKutTX3Z4HlXoT63dtB8ADhcLxOszYajpLA63BtMTh 95DZQcJvBbiGMIa4n11M8TJmGyIOvB3yqvclhq+wREYf9LjMeaHJASiTSvwCID8GHwB1 UOoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=CdFhfAHZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si27559963ioo.75.2021.07.13.07.50.43; Tue, 13 Jul 2021 07:50:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=CdFhfAHZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236800AbhGMOxA (ORCPT + 99 others); Tue, 13 Jul 2021 10:53:00 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:10204 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236763AbhGMOxA (ORCPT ); Tue, 13 Jul 2021 10:53:00 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16DEhi08026083; Tue, 13 Jul 2021 16:49:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=7iogho2MPvmeERAslTdZvt0AwKrPJiklnLgTcqL++t4=; b=CdFhfAHZ96LBfujeF5x+52cXoKRn8LNQVASe402H+6akQ391PamDYFxr1fyS58guiHLt 20JYVMn3K4GpeXeug/gMV+RCith/1zNKczjiZHbp9DH3kPY3WigZWWHWjEWS2mefiBYI FnSk9ctjVqNQjKpHyZkr24phFQpGfK4Fk2XGpziBcr7k3j60hs6O8UT9+oocAQzmJ2iK dXO75e2gxh8WH2MwwlsJD9sjyQICBwhV7eoCJYxGDrrI6hWlpc4fhdAQ/sBXpnbs1e5i gGW6Eet83LZbpbd5CPkAecJYgaSaae4cLQHIEVnVnMBnMW8ZfdRjn3lmYy+on/kP1eAP UQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 39s6csth38-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Jul 2021 16:49:49 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A00C610002A; Tue, 13 Jul 2021 16:49:47 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 78C7A22AD4A; Tue, 13 Jul 2021 16:49:47 +0200 (CEST) Received: from localhost (10.75.127.48) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Jul 2021 16:49:47 +0200 From: Antonio Borneo To: Yannick Fertre , Philippe Cornu , Benjamin Gaignard , David Airlie , Daniel Vetter , Maxime Coquelin , Alexandre Torgue , Raphael Gallais-Pou , , , CC: Antonio Borneo , Subject: [PATCH] drm/stm: dsi: compute the transition time from LP to HS and back Date: Tue, 13 Jul 2021 16:49:41 +0200 Message-ID: <20210713144941.3599-1-antonio.borneo@foss.st.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-13_07:2021-07-13,2021-07-13 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver uses a conservative set of hardcoded values for the maximum time delay of the transitions between LP and HS, either for data and clock lanes. By using the info in STM32MP157 datasheet, valid also for other ST devices, compute the actual delay from the lane's bps. Signed-off-by: Antonio Borneo --- To: Yannick Fertre To: Philippe Cornu To: Benjamin Gaignard To: David Airlie To: Daniel Vetter To: Maxime Coquelin To: Alexandre Torgue To: Raphael Gallais-Pou To: dri-devel@lists.freedesktop.org To: linux-stm32@st-md-mailman.stormreply.com To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index 8399d337589d..32cb41b2202f 100644 --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c @@ -309,14 +309,23 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode, return 0; } +#define DSI_PHY_DELAY(fp, vp, mbps) DIV_ROUND_UP((fp) * (mbps) + 1000 * (vp), 8000) + static int dw_mipi_dsi_phy_get_timing(void *priv_data, unsigned int lane_mbps, struct dw_mipi_dsi_dphy_timing *timing) { - timing->clk_hs2lp = 0x40; - timing->clk_lp2hs = 0x40; - timing->data_hs2lp = 0x40; - timing->data_lp2hs = 0x40; + /* + * From STM32MP157 datasheet, valid for STM32F469, STM32F7x9, STM32H747 + * phy_clkhs2lp_time = (272+136*UI)/(8*UI) + * phy_clklp2hs_time = (512+40*UI)/(8*UI) + * phy_hs2lp_time = (192+64*UI)/(8*UI) + * phy_lp2hs_time = (256+32*UI)/(8*UI) + */ + timing->clk_hs2lp = DSI_PHY_DELAY(272, 136, lane_mbps); + timing->clk_lp2hs = DSI_PHY_DELAY(512, 40, lane_mbps); + timing->data_hs2lp = DSI_PHY_DELAY(192, 64, lane_mbps); + timing->data_lp2hs = DSI_PHY_DELAY(256, 32, lane_mbps); return 0; } base-commit: 35d283658a6196b2057be562096610c6793e1219 -- 2.32.0