From cb4f52e1565b476714e6e7b63cba0e2bd1eff29d Mon Sep 17 00:00:00 2001 From: Mark Yao Date: Thu, 6 Jul 2017 15:43:10 +0800 Subject: [PATCH] drm/panel: support drm_find_panel_by_connector Change-Id: Iee970e013ff8b1558a060f334c700dea36c38d0f Signed-off-by: Mark Yao --- drivers/gpu/drm/drm_panel.c | 18 ++++++++++++++++++ include/drm/drm_panel.h | 1 + 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 2ef988e037b7..8cc1507a4b09 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -75,6 +75,24 @@ int drm_panel_detach(struct drm_panel *panel) } EXPORT_SYMBOL(drm_panel_detach); +struct drm_panel *drm_find_panel_by_connector(struct drm_connector *connector) +{ + struct drm_panel *panel; + + mutex_lock(&panel_lock); + + list_for_each_entry(panel, &panel_list, list) { + if (panel->connector == connector) { + mutex_unlock(&panel_lock); + return panel; + } + } + + mutex_unlock(&panel_lock); + return NULL; +} +EXPORT_SYMBOL(drm_find_panel_by_connector); + #ifdef CONFIG_OF struct drm_panel *of_drm_find_panel(struct device_node *np) { diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 083dedde7a03..0e1da22da939 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -143,6 +143,7 @@ void drm_panel_remove(struct drm_panel *panel); int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector); int drm_panel_detach(struct drm_panel *panel); +struct drm_panel *drm_find_panel_by_connector(struct drm_connector *connector); #ifdef CONFIG_OF struct drm_panel *of_drm_find_panel(struct device_node *np); #else -- 2.34.1