From patchwork Wed Aug 16 11:25:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 136097 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp1939692vqi; Sat, 19 Aug 2023 03:07:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkzV4jKsIoMnAAqVAQKYyOiE8045bIaOcMAiZkVBx+L+3w4VH8NEotMSqtDgmrUwTUo3bE X-Received: by 2002:a17:902:e842:b0:1b8:63c6:84ab with SMTP id t2-20020a170902e84200b001b863c684abmr1262393plg.61.1692439626695; Sat, 19 Aug 2023 03:07:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692439626; cv=none; d=google.com; s=arc-20160816; b=PJC/hVZ0B+Qj+ebRcoKC28hy0xdY8olWsm+HHo1+10kp2ppC7dLjoOeQMuOfdQgJuT H1/PTfzsBVfcUHxPOEJVF0Bg9dytmGmnMBbCMMKgD/hpg7T42eRdXOCgeUfRTkSyF6k9 7kdQbd9fljGpFuMt/kYWadQ2kLcBzm+7QffskZK43NqaRFR3IHz6P3SZVVGeFSRimMaO yetzDxPJpW9zjX29INQG+tIYYlOuPxs3PlPk8mD0VB0Nckt+WJJKzGWFk/bWCIXVCJfp GW+FZSxMNlD6u/ZqF157ZVuCOyCLl2XtWLOZwePF/XXVxApa8k4pXoGy0iXavDrSFjgb mpEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=g3lT3rHInnuiE2J1EkX8+K3Na3EpFrT8uIMc3sBdEro=; fh=lPlKf1PhZKgmDKmNHoLwviSf3cvO+AJgrT68RUEi/pE=; b=gny2BtRQK3FOjCsPlckuweBMirQdPRa/gC0d/nEA55A5ShfK0JgTwKd4XoD7qL6luq Ac9hQKVDuIzGHPESdNEFiBCN9570/pdKWCC1DsH8iDNAHgZhpPOffu3QIMeFbHJ/3X+p R+rJeDNNOkiKiBDwkEJg/bVxvQpTrEeBkb/u9PSEKKbBK+Cw6RpCS+py3JvE5I5fxMrq ACe6N/8kguKPf6B2W3XRxLriUROaHG+9OimcuR6QG85ITDLaYygAawYqbHZnj6mDoJmF mSOHlz/2QwBvrfRGavJR1efqL82t2Xt1NV4Xit1CrgPBq2XHGvaYIAmlKjKHpeYFyLF0 apyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PwyClJyG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n19-20020a170903405300b001b89bfd0c34si2971909pla.18.2023.08.19.03.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 03:07:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PwyClJyG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3262C3BDA0; Sat, 19 Aug 2023 01:29:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244501AbjHPL0Y (ORCPT + 99 others); Wed, 16 Aug 2023 07:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244487AbjHPLZv (ORCPT ); Wed, 16 Aug 2023 07:25:51 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FFEC2121 for ; Wed, 16 Aug 2023 04:25:50 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 29871D92; Wed, 16 Aug 2023 13:24:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1692185075; bh=3BEyrzp4IUiLGe9w3xtacn7Yy6nvFBbT4HOk9yd56NA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PwyClJyGiTaBplHC3RSEylTjB+qWvimMlOWACblDqNfEWk1Joqc7n17EtCH5vj5WA uF/awlU+fQ1pVaZrPyJy03XgPZNMUyfiZlI5Hnf33maF7LM49qYS/ZKTXxujHM7i7B h98qiem4VwpLm5JUEGj+hhGykvYB3fapNWWhwudg= From: Tomi Valkeinen Date: Wed, 16 Aug 2023 14:25:05 +0300 Subject: [PATCH v2 02/12] drm/bridge: tc358768: Fix use of uninitialized variable MIME-Version: 1.0 Message-Id: <20230816-tc358768-v2-2-242b9d5f703a@ideasonboard.com> References: <20230816-tc358768-v2-0-242b9d5f703a@ideasonboard.com> In-Reply-To: <20230816-tc358768-v2-0-242b9d5f703a@ideasonboard.com> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Maxim Schwalm , Francesco Dolcini Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Aradhya Bhatia , Tomi Valkeinen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=909; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=3BEyrzp4IUiLGe9w3xtacn7Yy6nvFBbT4HOk9yd56NA=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBk3LI0/EHCNZvMIu3aVBbp1Z7MswxNqg10WZwwQ FOTnz2j426JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZNyyNAAKCRD6PaqMvJYe 9So7D/0YzkazixpuRfx6fd/gk7EGJztOFzgzCcSqp3qnbeg4nYfTnHY9GOgLWumkR6aqGbbM9+n 13LWMb4iJt8rQZ5wz+kH3HdvN6GuxbiB5sjvtzlcir+QMcZd8yfyIXq1jnv9F+X2O3V4WA754Z8 OE8sDEhOUhUW0lhu++q8sB4YmiZmov+lXlXCdSvwSo5nfSHx8WUY09hYuGnCP76QXKBz0NUJSCi SrVVrAO4GUPcn1KhXXd96/iSHXmbiCFel5SYGiqu9eSvXSLpVnuCCwEyBW2WJfLPhWGQBVMYGUx klN2QcoSwnVPMXGwjYGyyY9aDSOkFMT+3k0OhuNEeWfRXsdgLG9eNqrYOvPFs2bZI3oHLLOxVA2 zPHsORvsUUtntFuei9ifb48Eb24aXq3Q8KDKWGSE/tOud6CP+QxeXyRClTJ5cejo0fE/LkgIBPA e2TC2XQ2R5bkIO5fx2vqF+qyHtnCWPWCaxVjdSUEl+RYjJjUSBtnM9A7XEKUYBXKl2z7CUZd7jm VvAc17epEkb6m5Lb1b5+mgK73DYsBuJKPd3jTaex3Tr4+93IQUGWHUewZjU9mHFYGl6mscAsaOU OlA0GrzvCoxOeMxf9y3P1tXNpnaVwO0hX5HVY/8NH6a+yxrGqbMDGV39TNxn5t8m2G4uCiBpgKg rerq44LQJOBdJuw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774651573998759349 X-GMAIL-MSGID: 1774651573998759349 smatch reports: drivers/gpu/drm/bridge/tc358768.c:223 tc358768_update_bits() error: uninitialized symbol 'orig'. Fix this by bailing out from tc358768_update_bits() if the tc358768_read() produces an error. Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver") Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/tc358768.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c index 819a4b6ec2a0..bc97a837955b 100644 --- a/drivers/gpu/drm/bridge/tc358768.c +++ b/drivers/gpu/drm/bridge/tc358768.c @@ -216,6 +216,10 @@ static void tc358768_update_bits(struct tc358768_priv *priv, u32 reg, u32 mask, u32 tmp, orig; tc358768_read(priv, reg, &orig); + + if (priv->error) + return; + tmp = orig & ~mask; tmp |= val & mask; if (tmp != orig) From patchwork Wed Aug 16 11:25:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 136191 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp2169946vqi; Sat, 19 Aug 2023 12:38:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE79bcNXt8M3ieetga2ADiQBy0B2LT7XNhz+yad88QCGD5cLyqeM0Q5Gt66fzwRcjM6cmUt X-Received: by 2002:a05:6a00:1406:b0:688:48be:50b4 with SMTP id l6-20020a056a00140600b0068848be50b4mr2381991pfu.16.1692473908238; Sat, 19 Aug 2023 12:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692473908; cv=none; d=google.com; s=arc-20160816; b=LdJvWv7YrA0G9Go+Xbx/4d0I+5LEiSSSZ7EFIgVn2ZNDf3ElzV5DxrdNywsHsZjtfa 2kzg4RNglX2Gzt46scuqvY7Qy/DkOSrACNjpd2Ht9/yo0alFfh3RuYb59SDUmwLtEsGJ P/ZKvyBY4w0UeL+HIU5sNHOQLvxxDb1AhcvJo3Li6yF1+em27Br1UEiwHoOOAOh/sPaZ +ab7R4BqLlU/5g7acz9aeL0Jan0FjghAiT66BU74JzxsoPQ5acQLRVuYXAu4OsWBQ3tt ENplk628aYZf5f6i3WfbxuViBTaZBRbAhA7HOgc8C8YiAe1PMtLXKnUyupxo8+Yi+7UF a6Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=ga1xoWtVPptjcKlrN9JW8m7d+GPeaevb80VCU6lv8wY=; fh=lPlKf1PhZKgmDKmNHoLwviSf3cvO+AJgrT68RUEi/pE=; b=LZRyfEyaIwdc2OCSMTvudukpQaAfHXOZWKLMuTr2PWWmshyufdTYpYa5pcnyRHN9n0 vmJLnwhWE/GVuCAnXSoPctJzdHe68QPV0K91mCWaewOzUZsrhQ1/IA8HP1M/GwzINNNo +joH1LmcqSCUQEjm8U0IOgYvA3o1aZKIld63zSXoeiy69VkIkP5EeFsUvZD8/Z5TMoSO QaPpCe6EzgJRxdTnSh96+jlGdeJW6DBXHKde4UL7HLn8QtoCSQXaLpFZP9REz8nwnTUu bQoefip3LtIeGJUYZ1vXZX1Cx4zbO5L5X1d4VbfEZSJVuG9ul3LKaBSc1YCoXm9JVK3K rwpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Pobx7GRE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u7-20020a654c07000000b00565f37c5472si3908710pgq.781.2023.08.19.12.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 12:38:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Pobx7GRE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2F3768D82E; Sat, 19 Aug 2023 01:38:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244532AbjHPL01 (ORCPT + 99 others); Wed, 16 Aug 2023 07:26:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244504AbjHPLZz (ORCPT ); Wed, 16 Aug 2023 07:25:55 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE0D212B for ; Wed, 16 Aug 2023 04:25:52 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8960F2FB2; Wed, 16 Aug 2023 13:24:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1692185078; bh=WCGNIXcGcdl4nJn+dx6lcBvQUFqQ55HfWTEz54MJwVw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Pobx7GREq+jxP2D5S9cwrkgVYulAKHsDT35rrBRDgNucTIoQu9HbsG842iTqIO1A4 t/3TLHbRgRNmJMsYgQyI1R8cskIOXJfPTmBkvBk2Lr/IkJe5wqRw1j3TFoCieG5Ivb PQb6UIuNTYahbl42b3FioXAarBVPiy6RVlfhzb1I= From: Tomi Valkeinen Date: Wed, 16 Aug 2023 14:25:08 +0300 Subject: [PATCH v2 05/12] drm/bridge: tc358768: Use struct videomode MIME-Version: 1.0 Message-Id: <20230816-tc358768-v2-5-242b9d5f703a@ideasonboard.com> References: <20230816-tc358768-v2-0-242b9d5f703a@ideasonboard.com> In-Reply-To: <20230816-tc358768-v2-0-242b9d5f703a@ideasonboard.com> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Maxim Schwalm , Francesco Dolcini Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Aradhya Bhatia , Tomi Valkeinen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4738; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=WCGNIXcGcdl4nJn+dx6lcBvQUFqQ55HfWTEz54MJwVw=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBk3LI1cyiU52QNWyrMoqwKywZcdpedX3eMKPmwu 4irGh3r+BqJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZNyyNQAKCRD6PaqMvJYe 9URSD/9d/CWhuuFgasgn/wBnjZOa9QJezas5p4Mq+uKptu+IRpybFzC6w1Sf8TQJG2XZ5bC1AGO wK1P2zL4Tyrm2RI6Ky+FNwbkRt0YjaQaFrX1cw7blftTmvmlgCfOQZszCKX/wVOQ9+rZnICQrTS Kof4rXhlPL3D02EikOOo60SFIzbzckq5tFWt4F7I6x2LEFDDph5iRQtc1bnIJlVRsZ7//0xipqH phgbpxWPopwUua5wFnogl+H9YXxZIrp3DZCVVGC//RudSCqDWZbPvtMkBNmkaigpQr2HX5ZlmON xo5o3WYuWpVxUNvPW6NBlKKBKRaOVwAnX0qYmDF37UGKLgCRGGToNLY0LMFeGXn0+BwJ3HDL7zq +aWTqZfigv+wGMcBsCvkE4XIm7zkVR+WzR4yfKRzwCjaVggbeppkLRI1em1+mKTNNFBosF7ayOQ jx96eZX8qbAATzsQ+mN2py3gboMC7Z9Rqwz+/b9M44JktRU6+WeCqlrkAAfrjvSDL9zmFqcrLuV SbNE93YWe3lAowDTHsQKgx9ql31Lck7ca5V3mFh/8iNZlUnKvHF9jd0KwDqJjo8OqHSiehD6WMB EdofYdnyQ5zysa9FRuvG+3R0BfLsgyEvFkj9C7xXTp31yt+s4ZOyIxbjlyXErdDGfbNfkqvRE/I pMfkbVgY4kaW12w== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774687520699557567 X-GMAIL-MSGID: 1774687520699557567 The TC358768 documentation uses HFP, HBP, etc. values to deal with the video mode, while the driver currently uses the DRM display mode (htotal, hsync_start, etc). Change the driver to convert the DRM display mode to struct videomode, which then allows us to use the same units the documentation uses. This makes it much easier to work on the code when using the TC358768 documentation as a reference. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/bridge/tc358768.c | 45 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c index d5831a1236e9..9b633038af33 100644 --- a/drivers/gpu/drm/bridge/tc358768.c +++ b/drivers/gpu/drm/bridge/tc358768.c @@ -650,6 +650,7 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) u32 dsiclk, dsibclk, video_start; const u32 internal_delay = 40; int ret, i; + struct videomode vm; if (mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) { dev_warn_once(priv->dev, "Non-continuous mode unimplemented, falling back to continuous\n"); @@ -673,6 +674,8 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) return; } + drm_display_mode_to_videomode(mode, &vm); + dsiclk = priv->dsiclk; dsibclk = dsiclk / 4; @@ -681,28 +684,28 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) switch (dsi_dev->format) { case MIPI_DSI_FMT_RGB888: val |= (0x3 << 4); - hact = mode->hdisplay * 3; - video_start = (mode->htotal - mode->hsync_start) * 3; + hact = vm.hactive * 3; + video_start = (vm.hsync_len + vm.hback_porch) * 3; data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24; break; case MIPI_DSI_FMT_RGB666: val |= (0x4 << 4); - hact = mode->hdisplay * 3; - video_start = (mode->htotal - mode->hsync_start) * 3; + hact = vm.hactive * 3; + video_start = (vm.hsync_len + vm.hback_porch) * 3; data_type = MIPI_DSI_PACKED_PIXEL_STREAM_18; break; case MIPI_DSI_FMT_RGB666_PACKED: val |= (0x4 << 4) | BIT(3); - hact = mode->hdisplay * 18 / 8; - video_start = (mode->htotal - mode->hsync_start) * 18 / 8; + hact = vm.hactive * 18 / 8; + video_start = (vm.hsync_len + vm.hback_porch) * 18 / 8; data_type = MIPI_DSI_PIXEL_STREAM_3BYTE_18; break; case MIPI_DSI_FMT_RGB565: val |= (0x5 << 4); - hact = mode->hdisplay * 2; - video_start = (mode->htotal - mode->hsync_start) * 2; + hact = vm.hactive * 2; + video_start = (vm.hsync_len + vm.hback_porch) * 2; data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16; break; default: @@ -814,43 +817,43 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) tc358768_write(priv, TC358768_DSI_EVENT, 0); /* vact */ - tc358768_write(priv, TC358768_DSI_VACT, mode->vdisplay); + tc358768_write(priv, TC358768_DSI_VACT, vm.vactive); /* vsw */ - tc358768_write(priv, TC358768_DSI_VSW, - mode->vsync_end - mode->vsync_start); + tc358768_write(priv, TC358768_DSI_VSW, vm.vsync_len); + /* vbp */ - tc358768_write(priv, TC358768_DSI_VBPR, - mode->vtotal - mode->vsync_end); + tc358768_write(priv, TC358768_DSI_VBPR, vm.vback_porch); /* hsw * byteclk * ndl / pclk */ - val = (u32)div_u64((mode->hsync_end - mode->hsync_start) * + val = (u32)div_u64(vm.hsync_len * ((u64)priv->dsiclk / 4) * priv->dsi_lanes, - mode->clock * 1000); + vm.pixelclock); tc358768_write(priv, TC358768_DSI_HSW, val); /* hbp * byteclk * ndl / pclk */ - val = (u32)div_u64((mode->htotal - mode->hsync_end) * + val = (u32)div_u64(vm.hback_porch * ((u64)priv->dsiclk / 4) * priv->dsi_lanes, - mode->clock * 1000); + vm.pixelclock); tc358768_write(priv, TC358768_DSI_HBPR, val); } else { /* Set event mode */ tc358768_write(priv, TC358768_DSI_EVENT, 1); /* vact */ - tc358768_write(priv, TC358768_DSI_VACT, mode->vdisplay); + tc358768_write(priv, TC358768_DSI_VACT, vm.vactive); /* vsw (+ vbp) */ tc358768_write(priv, TC358768_DSI_VSW, - mode->vtotal - mode->vsync_start); + vm.vsync_len + vm.vback_porch); + /* vbp (not used in event mode) */ tc358768_write(priv, TC358768_DSI_VBPR, 0); /* (hsw + hbp) * byteclk * ndl / pclk */ - val = (u32)div_u64((mode->htotal - mode->hsync_start) * + val = (u32)div_u64((vm.hsync_len + vm.hback_porch) * ((u64)priv->dsiclk / 4) * priv->dsi_lanes, - mode->clock * 1000); + vm.pixelclock); tc358768_write(priv, TC358768_DSI_HSW, val); /* hbp (not used in event mode) */