diff mbox

drm: Add support to find drm_panel by name

Message ID 1423048452-13309-1-git-send-email-shobhit.kumar@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kumar, Shobhit Feb. 4, 2015, 11:14 a.m. UTC
For scenarios where OF is not available, we can use panel identification by
name.

v2: Use const char *name instead of name[NAME_MAX] (Thierry)

CC: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
---
 drivers/gpu/drm/drm_panel.c | 18 ++++++++++++++++++
 include/drm/drm_panel.h     |  3 +++
 2 files changed, 21 insertions(+)

Comments

Shuang He Feb. 4, 2015, 2:01 p.m. UTC | #1
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 5711
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV              +1                 282/283              283/283
ILK                 -1              316/319              315/319
SNB                                  322/346              322/346
IVB                 -2              382/384              380/384
BYT                                  296/296              296/296
HSW                                  425/428              425/428
BDW                                  318/333              318/333
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
 PNV  igt_gen3_render_linear_blits      CRASH(1, M23)PASS(2, M25M23)      PASS(1, M23)
*ILK  igt_kms_flip_rcs-flip-vs-panning-interruptible      PASS(2, M26)      DMESG_WARN(1, M26)
 IVB  igt_gem_pwrite_pread_snooped-pwrite-blt-cpu_mmap-performance      DMESG_WARN(2, M34)PASS(1, M21)      DMESG_WARN(1, M34)
*IVB  igt_gem_storedw_batches_loop_secure-dispatch      PASS(3, M21M34)      DMESG_WARN(1, M34)
Note: You need to pay more attention to line start with '*'
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 2ef988e..7b4f559 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -95,6 +95,24 @@  struct drm_panel *of_drm_find_panel(struct device_node *np)
 EXPORT_SYMBOL(of_drm_find_panel);
 #endif
 
+struct drm_panel *drm_find_panel_by_name(const char *name)
+{
+	struct drm_panel *panel;
+
+	mutex_lock(&panel_lock);
+
+	list_for_each_entry(panel, &panel_list, list) {
+		if (panel->name && strcmp(panel->name, name) == 0) {
+			mutex_unlock(&panel_lock);
+			return panel;
+		}
+	}
+
+	mutex_unlock(&panel_lock);
+	return NULL;
+}
+EXPORT_SYMBOL(drm_find_panel_by_name);
+
 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
 MODULE_DESCRIPTION("DRM panel infrastructure");
 MODULE_LICENSE("GPL and additional rights");
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 1fbcc96..43b9004 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -74,6 +74,7 @@  struct drm_panel {
 	struct drm_device *drm;
 	struct drm_connector *connector;
 	struct device *dev;
+	const char *name;
 
 	const struct drm_panel_funcs *funcs;
 
@@ -137,4 +138,6 @@  static inline struct drm_panel *of_drm_find_panel(struct device_node *np)
 }
 #endif
 
+struct drm_panel *drm_find_panel_by_name(const char *name);
+
 #endif