From patchwork Tue Jan 27 09:31:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, Shobhit" X-Patchwork-Id: 5715741 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D27D79F2ED for ; Tue, 27 Jan 2015 09:28:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F2326201FE for ; Tue, 27 Jan 2015 09:28:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 244BC201FB for ; Tue, 27 Jan 2015 09:28:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 765E36E50F; Tue, 27 Jan 2015 01:28:52 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 6456C6E50D; Tue, 27 Jan 2015 01:28:49 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 27 Jan 2015 01:22:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,473,1418112000"; d="scan'208";a="657186521" Received: from shobhit-desk.iind.intel.com ([10.223.25.24]) by fmsmga001.fm.intel.com with ESMTP; 27 Jan 2015 01:28:31 -0800 From: Shobhit Kumar To: intel-gfx Date: Tue, 27 Jan 2015 15:01:34 +0530 Message-Id: <1422351097-25027-2-git-send-email-shobhit.kumar@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422351097-25027-1-git-send-email-shobhit.kumar@intel.com> References: <1422351097-25027-1-git-send-email-shobhit.kumar@intel.com> Cc: Samuel Ortiz , Jani Nikula , Shobhit Kumar , dri-devel , Thierry Reding , Daniel Vetter Subject: [Intel-gfx] [RFC v3 1/4] drm: Add support to find drm_panel by name X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For scenarios where OF is not available, we can use panel identification by name. Signed-off-by: Shobhit Kumar --- drivers/gpu/drm/drm_panel.c | 18 ++++++++++++++++++ include/drm/drm_panel.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 2ef988e..e1cb8cf 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 (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 "); 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..1ef9ff3 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; + char name[NAME_MAX]; 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