From: Kory Maincent <kory.maincent@bootlin.com>
To: Neil Armstrong <neil.armstrong@linaro.org>,
Jessica Zhang <quic_jesszhan@quicinc.com>,
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@gmail.com>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org,
Kory Maincent <kory.maincent@bootlin.com>
Subject: [PATCH RFC v2 3/5] drm/panel: ilitek-ili9881c: Add support for two-lane configuration
Date: Thu, 24 Apr 2025 17:07:41 +0200 [thread overview]
Message-ID: <20250424-feature_sfto340xc-v2-3-ff7da6192df2@bootlin.com> (raw)
In-Reply-To: <20250424-feature_sfto340xc-v2-0-ff7da6192df2@bootlin.com>
Enable support for two-lane configuration which is done by setting the
LANSEL_SW_EN and LANSEL_SW bits in the Pad Control register.
Use the data-lanes device tree parameter to configure the number of lanes.
The default configuration remains set to four lanes.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Change in v2:
- Read the data-lanes parameter from the port endpoint and use
drm_of_get_data_lanes_count instead of of_property_read_u32.
---
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 33 +++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 28cd7560e5db1d5734b10babdb4e4e553c6e07d0..2e38dea28336f445cb6a074dbbec006f0659287a 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -16,6 +16,7 @@
#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>
@@ -1263,6 +1264,21 @@ static int ili9881c_send_cmd_data(struct ili9881c *ctx, u8 cmd, u8 data)
return 0;
}
+static int ili9881c_set_lanes_cfg(struct ili9881c *ctx)
+{
+ int ret;
+
+ if (ctx->dsi->lanes != 2)
+ /* Nothing to do */
+ return 0;
+
+ ret = ili9881c_switch_page(ctx, 1);
+ if (ret)
+ return ret;
+
+ return ili9881c_send_cmd_data(ctx, 0xB7, 0x3);
+}
+
static int ili9881c_prepare(struct drm_panel *panel)
{
struct ili9881c *ctx = panel_to_ili9881c(panel);
@@ -1295,6 +1311,10 @@ static int ili9881c_prepare(struct drm_panel *panel)
return ret;
}
+ ret = ili9881c_set_lanes_cfg(ctx);
+ if (ret)
+ return ret;
+
ret = ili9881c_switch_page(ctx, 0);
if (ret)
return ret;
@@ -1503,8 +1523,9 @@ static const struct drm_panel_funcs ili9881c_funcs = {
static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
{
+ struct device_node *endpoint;
struct ili9881c *ctx;
- int ret;
+ int ret, lanes;
ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
@@ -1545,11 +1566,19 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
if (ret)
return ret;
+ endpoint = of_graph_get_endpoint_by_regs(dsi->dev.of_node, -1, -1);
+ lanes = drm_of_get_data_lanes_count(endpoint, 2, 4);
+ of_node_put(endpoint);
+ if (lanes == -EINVAL)
+ lanes = 4;
+ else if (lanes < 0)
+ return lanes;
+
drm_panel_add(&ctx->panel);
dsi->mode_flags = ctx->desc->mode_flags;
dsi->format = MIPI_DSI_FMT_RGB888;
- dsi->lanes = 4;
+ dsi->lanes = lanes;
return mipi_dsi_attach(dsi);
}
--
2.34.1
next prev parent reply other threads:[~2025-04-24 15:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 15:07 [PATCH RFC v2 0/5] Add support for Saef SFTO340XC panel Kory Maincent
2025-04-24 15:07 ` [PATCH RFC v2 1/5] dt-bindings: display: panel: Fix port binding Kory Maincent
2025-04-28 7:32 ` Krzysztof Kozlowski
2025-04-28 10:16 ` Kory Maincent
2025-04-24 15:07 ` [PATCH RFC v2 2/5] dt-bindings: display: panel: ili9881c: Add data-lanes property Kory Maincent
2025-04-28 7:33 ` Krzysztof Kozlowski
2025-04-24 15:07 ` Kory Maincent [this message]
2025-04-26 3:31 ` [PATCH RFC v2 3/5] drm/panel: ilitek-ili9881c: Add support for two-lane configuration Dmitry Baryshkov
2025-04-24 15:07 ` [PATCH RFC v2 4/5] dt-bindings: ili9881c: Add Saef SFTO340XC support Kory Maincent
2025-04-24 15:07 ` [PATCH RFC v2 5/5] drm: panel: Add Saef SFTO340XC LCD panel Kory Maincent
2025-04-26 3:32 ` Dmitry Baryshkov
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=20250424-feature_sfto340xc-v2-3-ff7da6192df2@bootlin.com \
--to=kory.maincent@bootlin.com \
--cc=airlied@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=miquel.raynal@bootlin.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=quic_jesszhan@quicinc.com \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=thierry.reding@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
--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
all inboxes | Powered by JetHome®