All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Walle" <mwalle@kernel.org>
To: "Aradhya Bhatia" <aradhya.bhatia@linux.dev>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
	"Jyri Sarha" <jyri.sarha@iki.fi>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Maxime Ripard" <mripard@kernel.org>,
	"David Airlie" <airlied@gmail.com>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Simona Vetter" <simona@ffwll.ch>, "Nishanth Menon" <nm@ti.com>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Devarsh Thakkar" <devarsht@ti.com>,
	"Praneeth Bajjuri" <praneeth@ti.com>,
	"Udit Kumar" <u-kumar1@ti.com>,
	"Jayesh Choudhary" <j-choudhary@ti.com>,
	"Francesco Dolcini" <francesco@dolcini.it>,
	"Alexander Sverdlin" <alexander.sverdlin@siemens.com>,
	"DRI Development List" <dri-devel@lists.freedesktop.org>,
	"Devicetree List" <devicetree@vger.kernel.org>,
	"Linux Kernel List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v8 4/4] drm/tidss: Add OLDI bridge support
Date: Mon, 26 May 2025 11:35:04 +0200	[thread overview]
Message-ID: <DA5ZNDCHXC6M.1CDYDG6KKMAP0@kernel.org> (raw)
In-Reply-To: <20250525151721.567042-5-aradhya.bhatia@linux.dev>

[-- Attachment #1: Type: text/plain, Size: 2789 bytes --]

Hi Aradhya,

> +static int get_oldi_mode(struct device_node *oldi_tx, int *companion_instance)
> +{
> +	struct device_node *companion;
> +	struct device_node *port0, *port1;
> +	u32 companion_reg;
> +	bool secondary_oldi = false;
> +	int pixel_order;
> +
> +	/*
> +	 * Find if the OLDI is paired with another OLDI for combined OLDI
> +	 * operation (dual-link or clone).
> +	 */
> +	companion = of_parse_phandle(oldi_tx, "ti,companion-oldi", 0);
> +	if (!companion)
> +		/*
> +		 * The OLDI TX does not have a companion, nor is it a
> +		 * secondary OLDI. It will operate independently.
> +		 */
> +		return OLDI_MODE_SINGLE_LINK;

How is this supposed to work? If I read this code correctly, the
second (companion) port is always reported as SINGLE_LINK if its
device tree node doesn't have a ti,companion-oldi property. But
reading the device tree binding, the companion-old property is only
for the first OLDI port.

FWIW, I've tested this series and I get twice the clock rate as
expected and the second link is reported as "OLDI_MODE_SINGLE_LINK".
I'll dig deeper into this tomorrow.

-michael

> +
> +	if (of_property_read_u32(companion, "reg", &companion_reg))
> +		return OLDI_MODE_UNSUPPORTED;
> +
> +	if (companion_reg > (TIDSS_MAX_OLDI_TXES - 1))
> +		/* Invalid companion OLDI reg value. */
> +		return OLDI_MODE_UNSUPPORTED;
> +
> +	*companion_instance = (int)companion_reg;
> +
> +	if (of_property_read_bool(oldi_tx, "ti,secondary-oldi"))
> +		secondary_oldi = true;
> +
> +	/*
> +	 * We need to work out if the sink is expecting us to function in
> +	 * dual-link mode. We do this by looking at the DT port nodes, the
> +	 * OLDI TX ports are connected to. If they are marked as expecting
> +	 * even pixels and odd pixels, then we need to enable dual-link.
> +	 */
> +	port0 = of_graph_get_port_by_id(oldi_tx, 1);
> +	port1 = of_graph_get_port_by_id(companion, 1);
> +	pixel_order = drm_of_lvds_get_dual_link_pixel_order(port0, port1);
> +	of_node_put(port0);
> +	of_node_put(port1);
> +	of_node_put(companion);
> +
> +	switch (pixel_order) {
> +	case -EINVAL:
> +		/*
> +		 * The dual-link properties were not found in at least
> +		 * one of the sink nodes. Since 2 OLDI ports are present
> +		 * in the DT, it can be safely assumed that the required
> +		 * configuration is Clone Mode.
> +		 */
> +		return (secondary_oldi ? OLDI_MODE_CLONE_SECONDARY_SINGLE_LINK :
> +					 OLDI_MODE_CLONE_SINGLE_LINK);
> +
> +	case DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS:
> +		return (secondary_oldi ? OLDI_MODE_SECONDARY_DUAL_LINK :
> +					 OLDI_MODE_DUAL_LINK);
> +
> +	/* Unsupported OLDI Modes */
> +	case DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS:
> +	default:
> +		return OLDI_MODE_UNSUPPORTED;
> +	}
> +}

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]

  reply	other threads:[~2025-05-26  9:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-25 15:17 [PATCH v8 0/4] drm/tidss: Add OLDI bridge support Aradhya Bhatia
2025-05-25 15:17 ` [PATCH v8 1/4] dt-bindings: display: ti,am65x-dss: Re-indent the example Aradhya Bhatia
2025-05-25 15:17   ` [PATCH v8 1/4] dt-bindings: display: ti, am65x-dss: " Aradhya Bhatia
2025-05-25 15:17 ` [PATCH v8 2/4] dt-bindings: display: ti: Add schema for AM625 OLDI Transmitter Aradhya Bhatia
2025-05-27  6:06   ` Michael Walle
2025-05-25 15:17 ` [PATCH v8 3/4] drm/tidss: Mark AM65x OLDI code separately Aradhya Bhatia
2025-05-25 15:17 ` [PATCH v8 4/4] drm/tidss: Add OLDI bridge support Aradhya Bhatia
2025-05-26  9:35   ` Michael Walle [this message]
2025-05-26 14:17     ` Aradhya Bhatia
2025-05-27  6:02       ` Michael Walle
2025-05-27 14:45         ` Aradhya Bhatia
2025-05-28  8:27           ` Michael Walle
2025-05-28 11:56             ` Aradhya Bhatia

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=DA5ZNDCHXC6M.1CDYDG6KKMAP0@kernel.org \
    --to=mwalle@kernel.org \
    --cc=airlied@gmail.com \
    --cc=alexander.sverdlin@siemens.com \
    --cc=aradhya.bhatia@linux.dev \
    --cc=conor+dt@kernel.org \
    --cc=devarsht@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=francesco@dolcini.it \
    --cc=j-choudhary@ti.com \
    --cc=jyri.sarha@iki.fi \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=nm@ti.com \
    --cc=praneeth@ti.com \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tzimmermann@suse.de \
    --cc=u-kumar1@ti.com \
    --cc=vigneshr@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.