[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250625-drm-panel-simple-fixes-v1-5-c428494a86b8@kernel.org>
Date: Wed, 25 Jun 2025 08:48:42 +0200
From: Maxime Ripard <mripard@...nel.org>
To: Neil Armstrong <neil.armstrong@...aro.org>,
Jessica Zhang <quic_jesszhan@...cinc.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Luca Ceresoli <luca.ceresoli@...tlin.com>,
Anusha Srivatsa <asrivats@...hat.com>,
Francesco Dolcini <francesco@...cini.it>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Maxime Ripard <mripard@...nel.org>
Subject: [PATCH 5/5] drm/panel: panel-simple: get rid of panel_dpi hack
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@...nel.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 d3390ba4ecec5a5aa531c12f51eebdf1ed9d5545..d19170a4531dff7b6e522b6d58e72d0dadc70680 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;
@@ -590,15 +588,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);
@@ -648,11 +652,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 */
@@ -5397,11 +5401,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
Powered by blists - more mailing lists