[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240116-jz-test-sim-panel-v1-2-f9511f46c9c7@quicinc.com>
Date: Tue, 16 Jan 2024 14:22:05 -0800
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>, Daniel Vetter <daniel@...ll.ch>
CC: <quic_abhinavk@...cinc.com>, <linux-kernel@...r.kernel.org>,
<dri-devel@...ts.freedesktop.org>,
Jessica Zhang <quic_jesszhan@...cinc.com>
Subject: [PATCH RFC 2/4] drm/dsi: Add API to register simulated DSI panel
Add new APIs to register a simulated panel.
For drivers that want to support a simulated panel, they must call
mipi_dsi_host_register_sim_panel().
Signed-off-by: Jessica Zhang <quic_jesszhan@...cinc.com>
---
drivers/gpu/drm/drm_mipi_dsi.c | 30 ++++++++++++++++++++++++++++++
include/drm/drm_mipi_dsi.h | 1 +
2 files changed, 31 insertions(+)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 843a6dbda93a0..6996014990979 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,6 +342,18 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
}
EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
+int mipi_dsi_host_register_sim_panel(struct mipi_dsi_host *host)
+{
+ mipi_dsi_device_add_sim_panel(host);
+
+ mutex_lock(&host_lock);
+ list_add_tail(&host->list, &host_list);
+ mutex_unlock(&host_lock);
+
+ return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_host_register_sim_panel);
+
int mipi_dsi_host_register(struct mipi_dsi_host *host)
{
struct device_node *node;
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index c0aec0d4d664e..4ca44b7b3efdb 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -107,6 +107,7 @@ struct mipi_dsi_host {
struct list_head list;
};
+int mipi_dsi_host_register_sim_panel(struct mipi_dsi_host *host);
int mipi_dsi_host_register(struct mipi_dsi_host *host);
void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
--
2.43.0
Powered by blists - more mailing lists