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: 5723801 Return-Path: X-Original-To: patchwork-dri-devel@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 E28EC9F302 for ; Wed, 28 Jan 2015 02:37:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1504D20270 for ; Wed, 28 Jan 2015 02:37:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B381F2025A for ; Wed, 28 Jan 2015 02:37:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9093D6E5F2; Tue, 27 Jan 2015 18:37:34 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@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 Subject: [RFC v3 1/4] drm: Add support to find drm_panel by name 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> X-Mailman-Approved-At: Tue, 27 Jan 2015 18:37:33 -0800 Cc: Samuel Ortiz , Jani Nikula , Shobhit Kumar , dri-devel , Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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