[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241008-jz-test-sim-panel-v2-2-d60046470e6c@quicinc.com>
Date: Tue, 8 Oct 2024 07:17:39 -0700
From: Jessica Zhang <quic_jesszhan@...cinc.com>
To: Neil Armstrong <neil.armstrong@...aro.org>,
Sam Ravnborg
<sam@...nborg.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Jessica Zhang <quic_jesszhan@...cinc.com>,
Simona Vetter <simona@...ll.ch>,
Andrzej Hajda <andrzej.hajda@...el.com>,
Robert Foss <rfoss@...nel.org>,
Laurent Pinchart
<Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
"Jernej
Skrabec" <jernej.skrabec@...il.com>,
Simona Vetter <simona.vetter@...ll.ch>
CC: <quic_abhinavk@...cinc.com>, <linux-kernel@...r.kernel.org>,
<dri-devel@...ts.freedesktop.org>
Subject: [PATCH RFC v2 2/3] drm/dsi: Add API to register simulated DSI
panel
Add new APIs to register a simulated DSI panel.
If the panel_simulation module is enabled, the DSI host will register
the sim panel instead of the physical panel.
Signed-off-by: Jessica Zhang <quic_jesszhan@...cinc.com>
---
drivers/gpu/drm/drm_mipi_dsi.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 2bc3973d35a19fc7dff7d578636821a1059bb7f9..95498b9bb8953066b0b1e9cfaa99d0b5b53e6cc8 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -153,6 +153,24 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
return device_add(&dsi->dev);
}
+#if IS_ENABLED(CONFIG_DRM_PANEL_SIMULATION)
+static struct mipi_dsi_device *mipi_dsi_device_add_sim_panel(struct mipi_dsi_host *host)
+{
+ struct mipi_dsi_device_info info = { };
+
+ info.channel = 0;
+ info.node = NULL;
+ strscpy(info.type, "panel_simulation", sizeof(info.type));
+
+ return mipi_dsi_device_register_full(host, &info);
+}
+#else
+static struct mipi_dsi_device *mipi_dsi_device_add_sim_panel(struct mipi_dsi_host *host)
+{
+ return ERR_PTR(-ENODEV);
+}
+#endif
+
#if IS_ENABLED(CONFIG_OF)
static struct mipi_dsi_device *
of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
@@ -324,10 +342,28 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
}
EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
+static int mipi_dsi_host_register_sim_panel(struct mipi_dsi_host *host)
+{
+ struct mipi_dsi_device *ret;
+
+ ret = mipi_dsi_device_add_sim_panel(host);
+ if (IS_ERR(ret))
+ return -EPROBE_DEFER;
+
+ mutex_lock(&host_lock);
+ list_add_tail(&host->list, &host_list);
+ mutex_unlock(&host_lock);
+
+ return 0;
+}
+
int mipi_dsi_host_register(struct mipi_dsi_host *host)
{
struct device_node *node;
+ if (!mipi_dsi_host_register_sim_panel(host))
+ return 0;
+
for_each_available_child_of_node(host->dev->of_node, node) {
/* skip nodes without reg property */
if (!of_property_present(node, "reg"))
--
2.34.1
Powered by blists - more mailing lists