From: Maxime Ripard <mripard@kernel.org>
To: Neil Armstrong <neil.armstrong@linaro.org>,
Jessica Zhang <quic_jesszhan@quicinc.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Anusha Srivatsa <asrivats@redhat.com>,
Francesco Dolcini <francesco@dolcini.it>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Maxime Ripard <mripard@kernel.org>
Subject: [PATCH v2 5/5] drm/panel: panel-simple: get rid of panel_dpi hack
Date: Thu, 26 Jun 2025 12:05:03 +0200 [thread overview]
Message-ID: <20250626-drm-panel-simple-fixes-v2-5-5afcaa608bdc@kernel.org> (raw)
In-Reply-To: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org>
The empty panel_dpi struct was only ever used as a discriminant, but
it's kind of a hack, and with the reworks done in the previous patches,
we shouldn't need it anymore.
Let's get rid of it.
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
drivers/gpu/drm/panel/panel-simple.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4c831af86414aba6a6b44dbc6020c0268dbd78b7..9f81fa960b460290759f5f9eba97045ab55fe5b8 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -437,12 +437,10 @@ static const struct drm_panel_funcs panel_simple_funcs = {
.get_modes = panel_simple_get_modes,
.get_orientation = panel_simple_get_orientation,
.get_timings = panel_simple_get_timings,
};
-static struct panel_desc panel_dpi;
-
static struct panel_desc *panel_dpi_probe(struct device *dev)
{
struct display_timing *timing;
const struct device_node *np;
struct panel_desc *desc;
@@ -591,15 +589,21 @@ static const struct panel_desc *panel_simple_get_desc(struct device *dev)
if (dev_is_platform(dev)) {
const struct panel_desc *desc;
desc = of_device_get_match_data(dev);
- if (!desc)
- return ERR_PTR(-ENODEV);
-
- if (desc == &panel_dpi)
- return panel_dpi_probe(dev);
+ if (!desc) {
+ /*
+ * panel-dpi probes without a descriptor and
+ * panel_dpi_probe() will initialize one for us
+ * based on the device tree.
+ */
+ if (of_device_is_compatible(dev->of_node, "panel-dpi"))
+ return panel_dpi_probe(dev);
+ else
+ return ERR_PTR(-ENODEV);
+ }
return desc;
}
return ERR_PTR(-ENODEV);
@@ -649,11 +653,11 @@ static struct panel_simple *panel_simple_probe(struct device *dev)
if (!panel->ddc)
return ERR_PTR(-EPROBE_DEFER);
}
- if ((desc != &panel_dpi) &&
+ if (!of_device_is_compatible(dev->of_node, "panel-dpi") &&
!of_get_display_timing(dev->of_node, "panel-timing", &dt))
panel_simple_parse_panel_timing_node(dev, panel, &dt);
if (desc->connector_type == DRM_MODE_CONNECTOR_LVDS) {
/* Optional data-mapping property for overriding bus format */
@@ -5398,11 +5402,16 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "microchip,ac69t88a",
.data = &mchp_ac69t88a,
}, {
/* Must be the last entry */
.compatible = "panel-dpi",
- .data = &panel_dpi,
+
+ /*
+ * Explicitly NULL, the panel_desc structure will be
+ * allocated by panel_dpi_probe().
+ */
+ .data = NULL,
}, {
/* sentinel */
}
};
MODULE_DEVICE_TABLE(of, platform_of_match);
--
2.49.0
next prev parent reply other threads:[~2025-06-26 10:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 10:04 [PATCH v2 0/5] drm/panel: panel-simple: Fix panel-dpi probe error Maxime Ripard
2025-06-26 10:04 ` [PATCH v2 1/5] drm/mipi-dsi: Add dev_is_mipi_dsi function Maxime Ripard
2025-06-27 9:04 ` Javier Martinez Canillas
2025-06-27 9:25 ` Maxime Ripard
2025-06-27 9:34 ` Javier Martinez Canillas
2025-06-26 10:05 ` [PATCH v2 2/5] drm/panel: panel-simple: make panel_dpi_probe return a panel_desc Maxime Ripard
2025-06-27 9:06 ` Javier Martinez Canillas
2025-06-26 10:05 ` [PATCH v2 3/5] drm/panel: panel-simple: Make panel_simple_probe return its panel Maxime Ripard
2025-06-27 9:10 ` Javier Martinez Canillas
2025-06-26 10:05 ` [PATCH v2 4/5] drm/panel: panel-simple: Add function to look panel data up Maxime Ripard
2025-06-27 9:12 ` Javier Martinez Canillas
2025-06-26 10:05 ` Maxime Ripard [this message]
2025-06-27 9:13 ` [PATCH v2 5/5] drm/panel: panel-simple: get rid of panel_dpi hack Javier Martinez Canillas
2025-06-26 10:21 ` [PATCH v2 0/5] drm/panel: panel-simple: Fix panel-dpi probe error Francesco Dolcini
2025-06-27 9:24 ` Maxime Ripard
2025-06-27 9:24 ` Maxime Ripard
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=20250626-drm-panel-simple-fixes-v2-5-5afcaa608bdc@kernel.org \
--to=mripard@kernel.org \
--cc=airlied@gmail.com \
--cc=asrivats@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=francesco@dolcini.it \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=neil.armstrong@linaro.org \
--cc=quic_jesszhan@quicinc.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).