From: Mikko Perttunen <mperttunen@nvidia.com>
To: devicetree@vger.kernel.org
Cc: devicetree@vger.kernel.org,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Jessica Zhang <jesszhan0024@gmail.com>,
dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org,
Svyatoslav Ryhel <clamor95@gmail.com>
Subject: Re: [PATCH v8 10/12] drm/tegra: rgb: Parameterize configuration based on bus flags
Date: Mon, 30 Nov 2026 11:37:33 +0900 [thread overview]
Message-ID: <eMAR05mrTpCF41Mm8fdXbA@nvidia.com> (raw)
In-Reply-To: <CAPVz0n2no09Dkf_+wBf_f0dejHxCkLtnjB-Tu-PKjn5PMQHuTg@mail.gmail.com>
On Saturday, November 28, 2026 4:53 PM Svyatoslav Ryhel wrote:
> сб, 28 лист. 2026 р. о 03:28 Mikko Perttunen <mperttunen@nvidia.com> пише:
> >
> > On Friday, November 27, 2026 10:21 PM Svyatoslav Ryhel wrote:
> > > пт, 27 лист. 2026 р. о 14:35 Mikko Perttunen <mperttunen@nvidia.com> пише:
> > > >
> > > > On Friday, November 27, 2026 6:21 PM Svyatoslav Ryhel wrote:
> > > > > пт, 27 лист. 2026 р. о 08:22 Mikko Perttunen <mperttunen@nvidia.com> пише:
> > > > > >
> > > > > > On Sunday, November 22, 2026 5:18 PM Svyatoslav Ryhel wrote:
> > > > > > > Parameterize configuration based on bus flags passed from the bridge or
> > > > > > > panel. The list of supported flags includes now pixel clock polarity,
> > > > > > > display enable (DE) polarity, and data alignment.
> > > > > > >
> > > > > > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > > > > > ---
> > > > > > > drivers/gpu/drm/tegra/rgb.c | 39 +++++++++++++++++++++++++++++++++----
> > > > > > > 1 file changed, 35 insertions(+), 4 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
> > > > > > > index d48d498068ac8..faecd6f94359f 100644
> > > > > > > --- a/drivers/gpu/drm/tegra/rgb.c
> > > > > > > +++ b/drivers/gpu/drm/tegra/rgb.c
> > > > > > > @@ -5,6 +5,7 @@
> > > > > > > */
> > > > > > >
> > > > > > > #include <linux/clk.h>
> > > > > > > +#include <linux/media-bus-format.h>
> > > > > > > #include <linux/of.h>
> > > > > > >
> > > > > > > #include <drm/drm_atomic_helper.h>
> > > > > > > @@ -106,6 +107,7 @@ static void tegra_rgb_encoder_enable(struct drm_encoder *encoder,
> > > > > > > struct tegra_output *output = encoder_to_output(encoder);
> > > > > > > struct tegra_rgb *rgb = to_rgb(output);
> > > > > > > struct drm_connector_state *conn_state;
> > > > > > > + struct drm_bridge_state *bridge_state;
> > > > > > > struct drm_crtc_state *crtc_state;
> > > > > > > struct drm_connector *connector;
> > > > > > > struct drm_display_mode *mode;
> > > > > > > @@ -117,12 +119,21 @@ static void tegra_rgb_encoder_enable(struct drm_encoder *encoder,
> > > > > > > crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
> > > > > > > mode = &crtc_state->adjusted_mode;
> > > > > > >
> > > > > > > + /* Get but flags from the bridge state. */
> > > > > >
> > > > > > s/but/bus/
> > > > > >
> > > > > > > + bridge_state = drm_atomic_get_new_bridge_state(state, output->bridge);
> > > > > > > + if (bridge_state)
> > > > > > > + bus_flags = bridge_state->input_bus_cfg.flags;
> > > > > > > + else
> > > > > > > + bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
> > > > > > > + DRM_BUS_FLAG_DE_HIGH |
> > > > > > > + DRM_BUS_FLAG_DATA_MSB_TO_LSB;
> > > > > > > +
> > > > > > > tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable));
> > > > > > >
> > > > > > > value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL;
> > > > > > > tegra_dc_writel(rgb->dc, value, DC_DISP_DATA_ENABLE_OPTIONS);
> > > > > > >
> > > > > > > - /* configure H- and V-sync signal polarities */
> > > > > > > + /* configure H- and V-sync and pixel clock signal polarities */
> > > > > > > value = tegra_dc_readl(rgb->dc, DC_COM_PIN_OUTPUT_POLARITY(1));
> > > > > > >
> > > > > > > if (mode->flags & DRM_MODE_FLAG_NHSYNC)
> > > > > > > @@ -135,11 +146,31 @@ static void tegra_rgb_encoder_enable(struct drm_encoder *encoder,
> > > > > > > else
> > > > > > > value &= ~LVS_OUTPUT_POLARITY_LOW;
> > > > > > >
> > > > > > > + if (bus_flags & DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE)
> > > > > > > + value &= ~BIT(PIN_LSC0);
> > > > > > > + else
> > > > > > > + value |= BIT(PIN_LSC0);
> > > > > >
> > > > > > I think this is the wrong way around: SAMPLE_POSEDGE means that the
> > > > > > pixel data is sampled on a rising edge. That is, it should be driven on
> > > > > > the low edge so it's ready for sampling in time for the rising edge.
> > > > > >
> > > > > > LSC0_OUTPUT_POLARITY says that the value "LOW" (a bit confusingly, 1)
> > > > > > corresponds to a data transition on the falling edge, i.e. sampling on
> > > > > > the rising edge.
> > > > > >
> > > > > > Section 31.9.6 states this a bit more clearly: "an active low pixel
> > > > > > clock means that the data changes on the falling edge of the clock, to
> > > > > > be latched on the rising edge".
> > > > > >
> > > > >
> > > > > DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE
> > > > >
> > > > > Should I replace with DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE?
> > > >
> > > > No -- with the current code, let's say
> > > > DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE is set. I.e. the panel tells us that
> > > > it will be sampling pixel data on the positive (rising) edge.
> > > >
> > > > LSC0_OUTPUT_POLARITY will be set to 0. The TRM documents the value 0 as
> > > > "active high", and "means that rising edge coincides with data
> > > > transition". That is, the display controller will change the output pin
> > > > state to color data on the rising edge. So the SoC pins will change
> > > > state at the rising edge, and the panel will sample at the rising edge.
> > > >
> > > > But the pins will take some time to take their new values, so this might
> > > > not work or could be unreliable depending on all kinds of timing
> > > > factors. So if the panel is sampling as the rising edge, the SoC should
> > > > be driving the pins at the falling edge, that way there is time for the
> > > > pins to settle before the panel samples them.
> > > >
> > > > So the value written to LSC0_OUTPUT_POLARITY should be the opposite of
> > > > what it's now. If that breaks the panel, either it's reporting the
> > > > incorrect DRM_BUS_FLAG_PIXDATA_SAMPLE_* value or something else is
> > > > incorrect.
> > > >
> > >
> > > This may/will cause regressions across multiple panels and devices.
> >
> > Looking at the panels we have, if we retain the previous behavior when
> > neither PIXDATA_SAMPLE_POSEDGE nor PIXDATA_SAMPLE_NEGEDGE is set, then
> > we'll retain the same programming as we've had before.
> >
> > Actually, from what I can tell, the change in this patch will change the
> > programmed polarity compared to before the patch for the panels/bridges
> > on the Colibri/Apalis/TF700T boards, which do specify SAMPLE_POSEDGE.
> >
> > So if we flip the logic around, and default to SAMPLE_POSEDGE if neither
> > is specified, we should retain previous programming for existing panels.
> >
>
> so default to
>
> + bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE |
> + DRM_BUS_FLAG_DE_HIGH |
> + DRM_BUS_FLAG_DATA_MSB_TO_LSB;
Yes
>
> and this remains same?
>
> + if (bus_flags & DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE)
> + value &= ~BIT(PIN_LSC0);
> + else
> + value |= BIT(PIN_LSC0);
No, the branches on this have to be swapped.
TF700T uses a toshiba,tc358768 bridge. drivers/gpu/drm/bridge/tc358768.c
sets input_bus_flags to DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE. This patch
thus sets the LSC0 polarity bit to 0. Before this patch the value for
the bit would have come from the rgb_enable register entry table, which
sets the bit to 1. So this patch changes behavior for TF700T. The same
applies to some Colibri and Apalis boards.
If we look at panels/bridges on supported Tegra boards before this DBI
series, TF700T and those Colibri/Apalis boards are the only ones with
bridges/panels that specify the PIXDATA_SAMPLE_* bus flag in the bridge
state. So to avoid changes to existing boards, we need to:
- If no PIXDATA_SAMPLE_* (or equivalently PIXDATA_DRIVE_*) flag is
specified, continue to set the LSC0 polarity bit to 1.
- If the
PIXDATA_SAMPLE_POSEDGE flag is specified, continue to set the LSC0
polarity bit to 1.
It would follow then, that:
- If no PIXDATA_SAMPLE_* flag is set or there is no available bridge
state, assume PIXDATA_SAMPLE_POSEDGE
- If PIXDATA_SAMPLE_POSEDGE is set, set the polarity bit to 1
- If PIXDATA_SAMPLE_NEGEDGE is set, set the polarity bit to 0
Mikko
next prev parent reply other threads:[~2026-11-30 2:40 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 8:18 [PATCH v8 00/12] drm/tegra: Add support for Tegra20/Tegra30 8-bit CPU interface Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 01/12] drm: Add MIPI DBI bus support for MIPI DBI Type A and B Svyatoslav Ryhel
2026-11-27 4:16 ` Mikko Perttunen
2026-11-27 9:06 ` Svyatoslav Ryhel
2026-11-27 12:14 ` Mikko Perttunen
2026-11-27 13:05 ` Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 02/12] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-27 4:23 ` Mikko Perttunen
2026-11-27 9:10 ` Svyatoslav Ryhel
2026-11-27 12:16 ` Mikko Perttunen
2026-11-27 13:08 ` Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 03/12] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-27 4:40 ` Mikko Perttunen
2026-11-22 8:18 ` [PATCH v8 04/12] drm/panel: panel-lg-lh400wv3: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 05/12] drm/panel: panel-lg-lh400wv3: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-27 4:40 ` Mikko Perttunen
2026-11-22 8:18 ` [PATCH v8 06/12] drm/tegra: dc: Add elements required by Tegra MIPI DBI Svyatoslav Ryhel
2026-11-27 4:56 ` Mikko Perttunen
2026-11-27 9:16 ` Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 07/12] dt-bindings: display: tegra: Document Tegra20 DSI port Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 08/12] drm/tegra: output: Make panel parsing configurable Svyatoslav Ryhel
2026-11-27 5:01 ` Mikko Perttunen
2026-11-22 8:18 ` [PATCH v8 09/12] drm/tegra: Convert to use atomic versions of drm_encoder_helper_funcs Svyatoslav Ryhel
2026-11-27 5:24 ` Mikko Perttunen
2026-11-27 9:17 ` Svyatoslav Ryhel
2026-11-27 13:47 ` Svyatoslav Ryhel
2026-11-30 3:00 ` Mikko Perttunen
2026-11-22 8:18 ` [PATCH v8 10/12] drm/tegra: rgb: Parameterize configuration based on bus flags Svyatoslav Ryhel
2026-11-27 6:22 ` Mikko Perttunen
2026-11-27 9:21 ` Svyatoslav Ryhel
2026-11-27 9:41 ` Svyatoslav Ryhel
2026-11-27 12:26 ` Mikko Perttunen
2026-11-28 7:55 ` Svyatoslav Ryhel
2026-11-30 2:49 ` Mikko Perttunen
2026-11-27 12:35 ` Mikko Perttunen
2026-11-27 13:21 ` Svyatoslav Ryhel
2026-11-28 1:28 ` Mikko Perttunen
2026-11-28 7:53 ` Svyatoslav Ryhel
2026-11-30 2:37 ` Mikko Perttunen [this message]
2026-11-22 8:18 ` [PATCH v8 11/12] dt-bindings: display: tegra: Document 8-bit CPU parallel interface Svyatoslav Ryhel
2026-11-22 8:18 ` [PATCH v8 12/12] drm/tegra: Add support for 8-bit CPU interface Svyatoslav Ryhel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eMAR05mrTpCF41Mm8fdXbA@nvidia.com \
--to=mperttunen@nvidia.com \
--cc=airlied@gmail.com \
--cc=clamor95@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=thierry.reding@kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox