From nobody Wed Jun 10 14:02:44 2026 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BC8739EF3F for ; Mon, 11 May 2026 07:46:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778485572; cv=none; b=sBM0Hd+Nn17I3lQE1XpZDtPL0ln7mcd/eW5HNd56MmmPry9PGn7girG0dPy6vFlUDqkDlcoflMsp0DorYbOdWPEinTV+F3fdL859DSw3HnuYmEls52TfIXNgiay30Y/doSfYD46QG+F+clnZokDiRXQeMPdQ1rU5NZqO07YAneE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778485572; c=relaxed/simple; bh=4lX3jmn6eJjVM3dmJR5K+haSPmZg31vbVjKpyCUuGBU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZprnXDsA3/4hwIlZN+27C8DHrEalwkaAUT7usjXf98gqs1d9mAgj16hn/4y2nMIhGBY/YQX7V/WiTXUNfsKOsyodkMBt+CjbUY4KCMiCc7zMKu4pWsUay9N0WXetZ0qiz8YibYot9MFEH74iB5dvcyVu09BEn6fg60h5Q+tCGOM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N4pei5jS; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N4pei5jS" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5a8891febd2so4556113e87.1 for ; Mon, 11 May 2026 00:46:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778485558; x=1779090358; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3opfryHfhilZL8PpB6M82lqXji5/jphiotiKFxgDVQo=; b=N4pei5jSxXiIrNb9t2/y5sKFtTm5+g/EFTaNYCEaLuzV9Ae9wulurK5+xOHBCaS6vg Qe+nmenIUjcYkB14fspEeeAZIA8gnJx2Fz0wA34JaHXyVQgP/vUwcw8A8WOHjZ/MaRjg rVS0KboQgr0rHE0VQzlKiuJNxZo5f8lNyO2o1wdCgAeRWOk9pbEnIC4rYpCVgMrFyKUp yZrEKgkZQ8/IMuDp4Z3K6uKTiKo0wKufNyLfBPGiiCZf+4RvTnN4VO3w3hOvmcKWasTs gWmdtiPDknL9b8AWT5XEKMPlykUrY3vF6/DUyZiYgLJ6uu9uHJfdyV3yOWGlNBUMuhYy xXgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778485558; x=1779090358; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3opfryHfhilZL8PpB6M82lqXji5/jphiotiKFxgDVQo=; b=e87WzTnmu6cAv4JMIWRpf1k5w4+DpFm0F4VHZEZJt/7F4LBLCaG/9wokk9tzQe511A g0ecfLYVvet3A0smtNWdjdV/llbL3O8LMmvE0A+YRKIQrSn2y8bgSysFAnVr1lK+eiki 5dBzD5KMyg7N19dBCaLrE/eKYP8ZNDf/0E+aAnAQZ0IpjvtO+bmbiIvXYS0Nvv+hWKWo ZGkmtXGY3lfCoU5dBCZgNemk+138U6k9uRzGnejWUxH9bgTRJShnlPOWLbZXSsggaybZ qurPUU3fEs/6a7ZPc710c98g/vF3q7YDNkMnVOk8MKkPvvx+lpFXRnUsyoSFfSrAB2kb l2hA== X-Forwarded-Encrypted: i=1; AFNElJ9lw/eRqPyAB10Q+Cbk3fjeHLsf5BtKpBr/bkcKHDRNN6/VQteI7aq2KgX/vuBDwE0Fp48ntUW3grzMC1c=@vger.kernel.org X-Gm-Message-State: AOJu0YzYBlY/za3HH30TR243skdjbo2px6m6hZdIQQcv8grCxGO18W0z lSyre59OLi1DSGkOzkWPjf2Ei4UQH45gWYICPnZ3kNuqG+umNmzev3bN X-Gm-Gg: Acq92OG1ogcn4nvibYx3N7g10PeYSxR1uCQaDiqCO36KQtUyFdxEzua0Esf7YVLLeHF aiX+EkgS7NCIiDrdyed0U7Ssi6jgOtbtr8UuQqkp2kFoktcPJ6pcXJoZbbkZB0rcEUOAwbUp3KP 5AS9NpLBWnE7eSY2BY6/xoRVIj3HjZQ8dQcXtMioTmr24bX7rPtrPo0qvV14i0v1hE3yi55/8/t NcQtcpnO/7v6nF1Urlmi28gTB654kEZulK/hMFi1Hw5GFoaBhzbXLwTE4IShpqp2m40ppHwJQe0 HBl0ASRAn+dh6NM9RjqpILSAUxn5ZBHqqLTV6jIZkBRO1GEyIZ5su3wr0wBcatykpCWImBNrsNC K1s8kQJiXg98HgvXxBAOKvpwOHFtO+ZlGjbrWGgw4OL+lnC82WZlTO5ekSv+6BVj1IfLSJ9k4xV AsNDADS/t6e/XWBxIIc5EZFE4= X-Received: by 2002:a05:6512:692:b0:5a8:707f:904 with SMTP id 2adb3069b0e04-5a887a9a8abmr8010872e87.0.1778485557391; Mon, 11 May 2026 00:45:57 -0700 (PDT) Received: from xeon ([188.163.112.56]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a8a952705asm2404394e87.32.2026.05.11.00.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 00:45:56 -0700 (PDT) From: Svyatoslav Ryhel To: Thierry Reding , Mikko Perttunen , David Airlie , Simona Vetter , Jonathan Hunter , Diogo Ivo , Svyatoslav Ryhel Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/2 RESEND] drm/tegra: dsi: add support for Tegra20/Tegra30 Date: Mon, 11 May 2026 10:45:36 +0300 Message-ID: <20260511074538.24563-2-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260511074538.24563-1-clamor95@gmail.com> References: <20260511074538.24563-1-clamor95@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Tegra20 and Tegra30 are fully compatible with existing Tegra DSI driver apart from clock configuration and pad calibration which are addressed by this patch. Signed-off-by: Svyatoslav Ryhel Reviewed-by: Mikko Perttunen --- drivers/gpu/drm/tegra/drm.c | 2 + drivers/gpu/drm/tegra/dsi.c | 117 ++++++++++++++++++++++++++---------- drivers/gpu/drm/tegra/dsi.h | 10 +++ 3 files changed, 98 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 1dcef4e7d104..b73d65cd0ac6 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1358,10 +1358,12 @@ static SIMPLE_DEV_PM_OPS(host1x_drm_pm_ops, host1x_= drm_suspend, =20 static const struct of_device_id host1x_drm_subdevs[] =3D { { .compatible =3D "nvidia,tegra20-dc", }, + { .compatible =3D "nvidia,tegra20-dsi", }, { .compatible =3D "nvidia,tegra20-hdmi", }, { .compatible =3D "nvidia,tegra20-gr2d", }, { .compatible =3D "nvidia,tegra20-gr3d", }, { .compatible =3D "nvidia,tegra30-dc", }, + { .compatible =3D "nvidia,tegra30-dsi", }, { .compatible =3D "nvidia,tegra30-hdmi", }, { .compatible =3D "nvidia,tegra30-gr2d", }, { .compatible =3D "nvidia,tegra30-gr3d", }, diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 7f25c50621c9..fbab10bc5c41 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -54,6 +54,11 @@ to_dsi_state(struct drm_connector_state *state) return container_of(state, struct tegra_dsi_state, base); } =20 +struct tegra_dsi_config { + bool has_multiple_pad_controls; + bool has_mux_parent_clk; +}; + struct tegra_dsi { struct host1x_client client; struct tegra_output output; @@ -83,6 +88,8 @@ struct tegra_dsi { /* for ganged-mode support */ struct tegra_dsi *master; struct tegra_dsi *slave; + + const struct tegra_dsi_config *config; }; =20 static inline struct tegra_dsi * @@ -665,39 +672,46 @@ static int tegra_dsi_pad_enable(struct tegra_dsi *dsi) { u32 value; =20 - value =3D DSI_PAD_CONTROL_VS1_PULLDN(0) | DSI_PAD_CONTROL_VS1_PDIO(0); - tegra_dsi_writel(dsi, value, DSI_PAD_CONTROL_0); + if (dsi->config->has_multiple_pad_controls) { + /* + * XXX Is this still needed? The module reset is deasserted right + * before this function is called. + */ + tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_0); + tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_1); + tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_2); + tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_3); + tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_4); + + value =3D DSI_PAD_CONTROL_VS1_PULLDN(0) | DSI_PAD_CONTROL_VS1_PDIO(0); + tegra_dsi_writel(dsi, value, DSI_PAD_CONTROL_0); + + value =3D DSI_PAD_SLEW_UP(0x7) | DSI_PAD_SLEW_DN(0x7) | + DSI_PAD_LP_UP(0x1) | DSI_PAD_LP_DN(0x1) | + DSI_PAD_OUT_CLK(0x0); + tegra_dsi_writel(dsi, value, DSI_PAD_CONTROL_2); + + value =3D DSI_PAD_PREEMP_PD_CLK(0x3) | DSI_PAD_PREEMP_PU_CLK(0x3) | + DSI_PAD_PREEMP_PD(0x03) | DSI_PAD_PREEMP_PU(0x3); + tegra_dsi_writel(dsi, value, DSI_PAD_CONTROL_3); + } else { + value =3D DSI_PAD_CONTROL_LPUPADJ(0x1) | DSI_PAD_CONTROL_LPDNADJ(0x1) | + DSI_PAD_CONTROL_PREEMP_EN(0x1) | DSI_PAD_CONTROL_SLEWDNADJ(0x6) | + DSI_PAD_CONTROL_SLEWUPADJ(0x6) | DSI_PAD_CONTROL_PDIO(0) | + DSI_PAD_CONTROL_PDIO_CLK(0) | DSI_PAD_CONTROL_PULLDN_ENAB(0); + tegra_dsi_writel(dsi, value, DSI_PAD_CONTROL_0); + } =20 return 0; } =20 static int tegra_dsi_pad_calibrate(struct tegra_dsi *dsi) { - u32 value; int err; =20 - /* - * XXX Is this still needed? The module reset is deasserted right - * before this function is called. - */ - tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_0); - tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_1); - tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_2); - tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_3); - tegra_dsi_writel(dsi, 0, DSI_PAD_CONTROL_4); - /* start calibration */ tegra_dsi_pad_enable(dsi); =20 - value =3D DSI_PAD_SLEW_UP(0x7) | DSI_PAD_SLEW_DN(0x7) | - DSI_PAD_LP_UP(0x1) | DSI_PAD_LP_DN(0x1) | - DSI_PAD_OUT_CLK(0x0); - tegra_dsi_writel(dsi, value, DSI_PAD_CONTROL_2); - - value =3D DSI_PAD_PREEMP_PD_CLK(0x3) | DSI_PAD_PREEMP_PU_CLK(0x3) | - DSI_PAD_PREEMP_PD(0x03) | DSI_PAD_PREEMP_PU(0x3); - tegra_dsi_writel(dsi, value, DSI_PAD_CONTROL_3); - err =3D tegra_mipi_start_calibration(dsi->mipi); if (err < 0) return err; @@ -1174,6 +1188,12 @@ static int tegra_dsi_setup_clocks(struct tegra_dsi *= dsi) struct clk *parent; int err; =20 + /* + * Tegra124+ uses a clock gate, not a mux, so this step + * should be redundant for configuration; yet, DSI refuses + * to work without it. + */ + parent =3D clk_get_parent(dsi->clk); if (!parent) return -EINVAL; @@ -1562,6 +1582,10 @@ static int tegra_dsi_probe(struct platform_device *p= dev) if (!dsi) return -ENOMEM; =20 + dsi->config =3D device_get_match_data(&pdev->dev); + if (!dsi->config) + return -ENODEV; + dsi->output.dev =3D dsi->dev =3D &pdev->dev; dsi->video_fifo_depth =3D 1920; dsi->host_fifo_depth =3D 64; @@ -1600,7 +1624,7 @@ static int tegra_dsi_probe(struct platform_device *pd= ev) goto remove; } =20 - dsi->clk_lp =3D devm_clk_get(&pdev->dev, "lp"); + dsi->clk_lp =3D devm_clk_get_optional(&pdev->dev, "lp"); if (IS_ERR(dsi->clk_lp)) { err =3D dev_err_probe(&pdev->dev, PTR_ERR(dsi->clk_lp), "cannot get low-power clock\n"); @@ -1621,10 +1645,12 @@ static int tegra_dsi_probe(struct platform_device *= pdev) goto remove; } =20 - err =3D tegra_dsi_setup_clocks(dsi); - if (err < 0) { - dev_err(&pdev->dev, "cannot setup clocks\n"); - goto remove; + if (dsi->config->has_mux_parent_clk) { + err =3D tegra_dsi_setup_clocks(dsi); + if (err < 0) { + dev_err(&pdev->dev, "cannot setup clocks\n"); + goto remove; + } } =20 dsi->regs =3D devm_platform_ioremap_resource(pdev, 0); @@ -1688,11 +1714,40 @@ static void tegra_dsi_remove(struct platform_device= *pdev) tegra_mipi_free(dsi->mipi); } =20 +static const struct tegra_dsi_config tegra20_dsi_config =3D { + .has_multiple_pad_controls =3D false, + .has_mux_parent_clk =3D false, +}; + +/* + * Tegra30 allows DSIA/DSIB to be muxed to either PLL_D or PLL_D2; this is + * simply not modeled in the clock driver yet. If this functionality is + * required, the has_mux_parent_clk flag can be set to true once the clock + * driver is patched. + */ +static const struct tegra_dsi_config tegra30_dsi_config =3D { + .has_multiple_pad_controls =3D false, + .has_mux_parent_clk =3D false, +}; + +static const struct tegra_dsi_config tegra114_dsi_config =3D { + .has_multiple_pad_controls =3D true, + .has_mux_parent_clk =3D true, +}; + +/* TODO: figure out why has_mux_parent_clk =3D true is necessary on Tegra1= 24+ */ +static const struct tegra_dsi_config tegra124_dsi_config =3D { + .has_multiple_pad_controls =3D true, + .has_mux_parent_clk =3D true, +}; + static const struct of_device_id tegra_dsi_of_match[] =3D { - { .compatible =3D "nvidia,tegra210-dsi", }, - { .compatible =3D "nvidia,tegra132-dsi", }, - { .compatible =3D "nvidia,tegra124-dsi", }, - { .compatible =3D "nvidia,tegra114-dsi", }, + { .compatible =3D "nvidia,tegra210-dsi", .data =3D &tegra124_dsi_config }, + { .compatible =3D "nvidia,tegra132-dsi", .data =3D &tegra124_dsi_config }, + { .compatible =3D "nvidia,tegra124-dsi", .data =3D &tegra124_dsi_config }, + { .compatible =3D "nvidia,tegra114-dsi", .data =3D &tegra114_dsi_config }, + { .compatible =3D "nvidia,tegra30-dsi", .data =3D &tegra30_dsi_config }, + { .compatible =3D "nvidia,tegra20-dsi", .data =3D &tegra20_dsi_config }, { }, }; MODULE_DEVICE_TABLE(of, tegra_dsi_of_match); diff --git a/drivers/gpu/drm/tegra/dsi.h b/drivers/gpu/drm/tegra/dsi.h index f39594e65e97..d834ac0c47ab 100644 --- a/drivers/gpu/drm/tegra/dsi.h +++ b/drivers/gpu/drm/tegra/dsi.h @@ -95,6 +95,16 @@ #define DSI_TALLY_LRX(x) (((x) & 0xff) << 8) #define DSI_TALLY_HTX(x) (((x) & 0xff) << 0) #define DSI_PAD_CONTROL_0 0x4b +/* Tegra20/Tegra30 */ +#define DSI_PAD_CONTROL_PULLDN_ENAB(x) (((x) & 0x1) << 28) +#define DSI_PAD_CONTROL_SLEWUPADJ(x) (((x) & 0x7) << 24) +#define DSI_PAD_CONTROL_SLEWDNADJ(x) (((x) & 0x7) << 20) +#define DSI_PAD_CONTROL_PREEMP_EN(x) (((x) & 0x1) << 19) +#define DSI_PAD_CONTROL_PDIO_CLK(x) (((x) & 0x1) << 18) +#define DSI_PAD_CONTROL_PDIO(x) (((x) & 0x3) << 16) +#define DSI_PAD_CONTROL_LPUPADJ(x) (((x) & 0x3) << 14) +#define DSI_PAD_CONTROL_LPDNADJ(x) (((x) & 0x3) << 12) +/* Tegra114+ */ #define DSI_PAD_CONTROL_VS1_PDIO(x) (((x) & 0xf) << 0) #define DSI_PAD_CONTROL_VS1_PDIO_CLK (1 << 8) #define DSI_PAD_CONTROL_VS1_PULLDN(x) (((x) & 0xf) << 16) --=20 2.51.0 From nobody Wed Jun 10 14:02:44 2026 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E37593A1A4D for ; Mon, 11 May 2026 07:46:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778485568; cv=none; b=oye8hBTI+CnXAGoQSlxt/sIllZSNXZsF1Jhj0rWO8tD+4OPoS2S8faSD7LJsledM1kuPQMggEKAD7rT/v9z8hkHVyV+e0OdUxlGBcULlAkSE9I10FOsYzRMkHUGdaZH+GAfqHYcQO6WaMk7cL8T9cS4rLB4SYmD6juJfr7CnhZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778485568; c=relaxed/simple; bh=BfCGLduhY9yG7QLq78Hh4dR6ZPzK4zm1QeyS8EzRSxY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sl+IHnEIv0wES8ZYu0atbpvHQqe2vJlPDEwHzWUl/SC+Q6LydmubMJ7AvaSVrWzdRGGzUzQN0BjFFPIfp+k/4Ym0hR7BXLLOmcXoddb2ScGAs4hJeYUax8Wd2dnfWG1J8f6ui4TR3c9D2fOiOVDya2AKeJ5UpD6cVnIFnLyB9rQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aO3hKW45; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aO3hKW45" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5a8c6fc5fd3so826191e87.0 for ; Mon, 11 May 2026 00:46:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778485559; x=1779090359; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4/vo+yztL0AmH8P24goXzbtezovr3DoQGmWB3EtlnhE=; b=aO3hKW45Fn84MTLwS5chnFAYR97siQkzudd+X3vXRyqRwUH+B9e4Ce1/bl4I8UURrM p7E+qc7dKC4jCiBjOQ8NMz+VB5ZOEydbC5AZ3wgE41EIQCXe3i8MFisA3szAjb0KgAiV YMAx93Obi3/ieseDmSS0e5cwEJaI5/qqvkpg7C4RVKnzMwEphBqdv28g5huqG55vj1vq B0dLlENy3MYDW+RHJef74W0YRvzCccqudT+PKQxE2XHEKsmZmNETqKqu8sq+HGxMtkDB 5sGPfPp1QmTL7cUGkfCIXPI4VYfm7JNJnrnyyuycSRln3kkoc15tikWp668OY35IQ9Uz D1fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778485559; x=1779090359; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4/vo+yztL0AmH8P24goXzbtezovr3DoQGmWB3EtlnhE=; b=JkCS2TYWhjRxy3Tz64t9w4NfIK9CqJJ8fDv6ltgwfgE/3sjp/cchXOZQtWBTHdpvMH BRf4od6FNlQ2IUuJGfKZ1gS5KIzP4SuC0/vuE8zkkBe8eGkUKstMY5qEU1D2NyaYiAsy +iA48aF32o0gzT/iVvwSINeSd8M4zApHgbKCPpfgOE2dg/ORdVzBT02zQGnDYJONK6g8 IgOYZAxaSsi/pxPaybwcoBXKSc7XPrDT4Jr2uuP1dsKRXjdp8mGO8s5KYlzl/8KYUtAX PuUf51w4rr9VfpMIFnpSMgdNVG7uOGEooXFrmo93ZtUdDecOv9kaYenJ6mNp/2xz3qSN 7/OQ== X-Forwarded-Encrypted: i=1; AFNElJ9uNPR1+1paaxcmagPs2PlmVi9FtZl70IbwOqggdh9ig++RA+bZHSy3EIY+zbvUHj+tF+gM05kUTM8Kps4=@vger.kernel.org X-Gm-Message-State: AOJu0YzE4Hs7Wk1E/qo9ixKX8OA9bZqyz+TYLrLLcU9iRc3FcQVT/347 2Vqna8ipZaiWYJ8kMomHLkHeyxSeY2R/9xc0DBRDButDS/NkNnR2V5qFl37fDw== X-Gm-Gg: Acq92OECv8Uu7petKbyUrGSFdHIIfzQX2KDDiDB3Fpv+OVIMZH9F5VGUUTjF6BAF/Ax VEXLJ682DUSSb/qrwCNq04H4m+tBEW930AP9IhZ0jL87bbCl1UZFgbg+Nkw+DNexr5ce/Ti1kku QkxZXzezoW3hGEc9pZfqHet5mQoTL3id01jDRX1QYv1eTyMMmgy5uNDJmFFrSMyzwxIrVa9D9Er 4exYUE1XfpDy4ecYdKcmPUXmB+eGtt03enxPGPUi/3K51bZ+q7bADHH89Y2EK38vTi+2+eY1Scc I4FHYTxeV1ghGUBiK1dPY9fh+Oy0I3ZzIdE+PumwF/WGHNCKPfbc6J+S4/d7ngwdoZXAkAUTXRN x/9lZFFTpjB1+ClCF1Eo9WTLjfu02Nyt6HZ+wYhxSecwxlbmOfA1JCqI7BtMGwIZZtOkGhAiQ9J +B23HsQxpfztSk X-Received: by 2002:a05:6512:114f:b0:5a8:6cd7:3203 with SMTP id 2adb3069b0e04-5a899b90511mr5387467e87.3.1778485558513; Mon, 11 May 2026 00:45:58 -0700 (PDT) Received: from xeon ([188.163.112.56]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a8a952705asm2404394e87.32.2026.05.11.00.45.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 00:45:58 -0700 (PDT) From: Svyatoslav Ryhel To: Thierry Reding , Mikko Perttunen , David Airlie , Simona Vetter , Jonathan Hunter , Diogo Ivo , Svyatoslav Ryhel Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/2 RESEND] drm/tegra: dsi: re-add clear enable register if DSI was powered by bootloader Date: Mon, 11 May 2026 10:45:37 +0300 Message-ID: <20260511074538.24563-3-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260511074538.24563-1-clamor95@gmail.com> References: <20260511074538.24563-1-clamor95@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Original commit b22fd0b9639e ("drm/tegra: dsi: Clear enable register if powered by bootloader") was added to address the issue of DSI being in an unknown state after the bootloader, ensuring correct panel configuration. This worked fairly well under the assumption that the bootloader had set up DSI; however, in cases where it did not, the device would hang because a DSI read was called before the DSI hardware was ready. Removing this workaround results in the issue described in the original fix: the panel initialization sequence fails and the panel gets stuck in an undefined state. This is especially noticeable with command mode panels In order to properly address this issue, the original workaround is restored and placed after the DSI hardware is prepared for R/W operations. This fixes behavior for both cases: where DSI is set by the bootloader and where DSI is untouched. I have tested this change on Tegra20 (Motorola Atrix 4G), Tegra114 (NVIDIA Tegra Note 7 and ASUS Transformer Pad TF701T), and Tegra124 (Xiaomi Mi Pad) with U-Boot, using both bootloader-initialized DSI and untouched DSI. Fixes: b22fd0b9639e ("drm/tegra: dsi: Clear enable register if powered by b= ootloader") Fixes: 660b299bed2a ("Revert "drm/tegra: dsi: Clear enable register if powe= red by bootloader"") Signed-off-by: Svyatoslav Ryhel Reviewed-by: Mikko Perttunen --- drivers/gpu/drm/tegra/dsi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index fbab10bc5c41..e7fdd8c7ac12 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -936,6 +936,15 @@ static void tegra_dsi_encoder_enable(struct drm_encode= r *encoder) return; } =20 + /* If the bootloader enabled DSI it needs to be disabled + * in order for the panel initialization commands to be + * properly sent. + */ + value =3D tegra_dsi_readl(dsi, DSI_POWER_CONTROL); + + if (value & DSI_POWER_CONTROL_ENABLE) + tegra_dsi_disable(dsi); + state =3D tegra_dsi_get_state(dsi); =20 tegra_dsi_set_timeout(dsi, state->bclk, state->vrefresh); --=20 2.51.0