From: Vladimir Zapolskiy <vz@kernel.org>
To: Neil Armstrong <neil.armstrong@linaro.org>,
Jessica Zhang <jesszhan0024@gmail.com>,
Ritesh Kumar <quic_riteshk@quicinc.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>
Cc: 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>,
dri-devel@lists.freedesktop.org,
Conor Dooley <conor+dt@kernel.org>,
devicetree@vger.kernel.org, Abel Vesa <abelvesa@kernel.org>,
linux-arm-msm@vger.kernel.org
Subject: [PATCH 5/8] drm/panel: novatek-nt36672e: Verify the number of D-PHY data lanes
Date: Wed, 28 Oct 2026 11:51:48 +0200 [thread overview]
Message-ID: <20261028095151.1682096-6-vz@kernel.org> (raw)
In-Reply-To: <20261028095151.1682096-1-vz@kernel.org>
The NT36672E panel in the MIPI D-PHY mode is connected over 4 data lanes,
a mismatching device tree description results in a panel, which won't work.
Get the PHY type of the DSI link from the PHY of the DSI host, and get
the number of data lanes from the DSI host endpoint to check the match.
Signed-off-by: Vladimir Zapolskiy <vz@kernel.org>
---
.../gpu/drm/panel/panel-novatek-nt36672e.c | 37 +++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
index 0a2d54ee8069..33676e334b9f 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
@@ -5,14 +5,18 @@
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_graph.h>
#include <linux/regulator/consumer.h>
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_modes.h>
+#include <drm/drm_of.h>
#include <drm/drm_panel.h>
#include <video/mipi_display.h>
+#include <dt-bindings/phy/phy.h>
+
static const struct regulator_bulk_data nt36672e_supplies[] = {
{ .supply = "vddi", .init_load_uA = 62000 },
};
@@ -536,6 +540,30 @@ static const struct drm_panel_funcs nt36672e_drm_funcs = {
.get_modes = nt36672e_panel_get_modes,
};
+/*
+ * Get the PHY type of the DSI link from the PHY of the DSI host, MIPI D-PHY
+ * is the default, if the PHY type is not specified.
+ */
+static u32 nt36672e_get_dsi_phy_type(struct device *dev)
+{
+ struct device_node *host, *phy;
+ u32 phy_type = PHY_TYPE_DPHY;
+
+ host = of_graph_get_remote_node(dev->of_node, 0, 0);
+ if (!host)
+ return phy_type;
+
+ phy = of_parse_phandle(host, "phys", 0);
+ of_node_put(host);
+ if (!phy)
+ return phy_type;
+
+ of_property_read_u32(phy, "phy-type", &phy_type);
+ of_node_put(phy);
+
+ return phy_type;
+}
+
static int nt36672e_panel_probe(struct mipi_dsi_device *dsi)
{
struct device *dev = &dsi->dev;
@@ -598,6 +626,15 @@ static int nt36672e_panel_probe(struct mipi_dsi_device *dsi)
dsi->format = ctx->desc->format;
dsi->mode_flags = ctx->desc->mode_flags;
+ /* A MIPI D-PHY link to the panel shall have exactly 4 data lanes */
+ if (nt36672e_get_dsi_phy_type(dev) == PHY_TYPE_DPHY) {
+ ret = drm_of_get_data_lanes_count_remote(dev->of_node, 0, -1, 1, 4);
+ if (ret > 0 && ret != 4)
+ return dev_err_probe(dev, -EINVAL,
+ "%d D-PHY data lanes described, 4 required\n",
+ ret);
+ }
+
ret = drm_panel_of_backlight(&ctx->panel);
if (ret)
return dev_err_probe(dev, ret, "Failed to get backlight\n");
--
2.51.0
next prev parent reply other threads:[~2026-10-28 9:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 9:51 [PATCH 0/8] drm/panel: novatek-nt36672e: Add SM8450 HDK display card Vladimir Zapolskiy
2026-10-28 9:51 ` [PATCH 1/8] dt-bindings: display: panel: novatek,nt36672e: Document the reset GPIO polarity Vladimir Zapolskiy
2026-10-28 9:51 ` [PATCH 1/8] dt-bindings: display: panel: novatek, nt36672e: " Vladimir Zapolskiy
2026-10-28 13:56 ` [PATCH 1/8] dt-bindings: display: panel: novatek,nt36672e: " Krzysztof Kozlowski
2026-10-28 14:56 ` Vladimir Zapolskiy
2026-10-28 14:59 ` Krzysztof Kozlowski
2026-10-28 20:27 ` Vladimir Zapolskiy
2026-10-29 9:49 ` Krzysztof Kozlowski
2026-10-29 10:30 ` Vladimir Zapolskiy
2026-10-28 9:51 ` [PATCH 2/8] dt-bindings: display: panel: novatek,nt36672e: Add bias enable GPIO Vladimir Zapolskiy
2026-10-28 9:51 ` [PATCH 2/8] dt-bindings: display: panel: novatek, nt36672e: " Vladimir Zapolskiy
2026-10-28 13:57 ` [PATCH 2/8] dt-bindings: display: panel: novatek,nt36672e: " Krzysztof Kozlowski
2026-10-28 9:51 ` [PATCH 3/8] drm/panel: novatek-nt36672e: Make the AVDD and AVEE supplies optional Vladimir Zapolskiy
2026-10-28 9:51 ` [PATCH 4/8] drm/panel: novatek-nt36672e: Support the bias enable GPIO Vladimir Zapolskiy
2026-10-28 9:51 ` Vladimir Zapolskiy [this message]
2026-10-28 9:51 ` [PATCH 6/8] drm/panel: novatek-nt36672e: Add support of the C-PHY panel module Vladimir Zapolskiy
2026-10-28 9:51 ` [PATCH 7/8] arm64: dts: qcom: sm8450-hdk: Add display card overlay Vladimir Zapolskiy
2026-10-28 12:53 ` Konrad Dybcio
2026-10-28 9:51 ` [PATCH 8/8] arm64: dts: qcom: qcm6490-idp: Describe the panel bias enable GPIO Vladimir Zapolskiy
2026-10-28 12:54 ` Konrad Dybcio
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=20261028095151.1682096-6-vz@kernel.org \
--to=vz@kernel.org \
--cc=abelvesa@kernel.org \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=quic_riteshk@quicinc.com \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--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 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.