From patchwork Thu Mar 30 11:15:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 9653931 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 32ACC60113 for ; Thu, 30 Mar 2017 11:16:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2743828584 for ; Thu, 30 Mar 2017 11:16:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AA3128588; Thu, 30 Mar 2017 11:16:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9AD5928584 for ; Thu, 30 Mar 2017 11:16:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE35B6E8B3; Thu, 30 Mar 2017 11:16:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id E9BAE6E8B2 for ; Thu, 30 Mar 2017 11:16:07 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v2UBG5qB009169; Thu, 30 Mar 2017 06:16:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1490872565; bh=GHpFFNoJ9uPezFes2tAaTsug5X1Rv6atBaVEP+V+w/g=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tO+uk6ekE52TBYAwCISNvUhyrwSco2kuPikRq32SmqkACqpm3XeUCzlk5USTaK3hR 8dMElfvzPXOd2m4Q8o3ycdgwj1Ntx7zzP6V8D0CdlrzLVOPfkiaWFlyr9OBIz1bo02 hGMGHyE04UWRe0wow3CA01rzWSBcnUAd+L/KxwMM= Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2UBG5A5004241; Thu, 30 Mar 2017 06:16:05 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Thu, 30 Mar 2017 06:16:04 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2UBFV8E016391; Thu, 30 Mar 2017 06:16:03 -0500 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv4 20/29] drm/omap: dss: Functions to check components in the display/output list Date: Thu, 30 Mar 2017 14:15:20 +0300 Message-ID: <1490872529-23084-21-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490872529-23084-1-git-send-email-tomi.valkeinen@ti.com> References: <1490872529-23084-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Ujfalusi The functions can be used to check a component (by it's of_node) if it is part of the omapdss display or output list. If the component is found, it means that the driver is loaded. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/display.c | 18 ++++++++++++++++++ drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 +++ drivers/gpu/drm/omapdrm/dss/output.c | 13 +++++++++++++ 3 files changed, 34 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c index e567ff68b216..94c012e0584b 100644 --- a/drivers/gpu/drm/omapdrm/dss/display.c +++ b/drivers/gpu/drm/omapdrm/dss/display.c @@ -132,6 +132,24 @@ void omapdss_unregister_display(struct omap_dss_device *dssdev) } EXPORT_SYMBOL(omapdss_unregister_display); +bool omapdss_component_is_display(struct device_node *node) +{ + struct omap_dss_device *dssdev; + bool found = false; + + mutex_lock(&panel_list_mutex); + list_for_each_entry(dssdev, &panel_list, panel_list) { + if (dssdev->dev->of_node == node) { + found = true; + goto out; + } + } +out: + mutex_unlock(&panel_list_mutex); + return found; +} +EXPORT_SYMBOL(omapdss_component_is_display); + struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev) { if (!try_module_get(dssdev->owner)) diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 4545f1824e66..7e1feb935137 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -936,4 +936,7 @@ struct dispc_ops { void dispc_set_ops(const struct dispc_ops *o); const struct dispc_ops *dispc_get_ops(void); +bool omapdss_component_is_display(struct device_node *node); +bool omapdss_component_is_output(struct device_node *node); + #endif /* __OMAP_DRM_DSS_H */ diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c index 2b999dc48621..655c5d73eac9 100644 --- a/drivers/gpu/drm/omapdrm/dss/output.c +++ b/drivers/gpu/drm/omapdrm/dss/output.c @@ -107,6 +107,19 @@ void omapdss_unregister_output(struct omap_dss_device *out) } EXPORT_SYMBOL(omapdss_unregister_output); +bool omapdss_component_is_output(struct device_node *node) +{ + struct omap_dss_device *out; + + list_for_each_entry(out, &output_list, list) { + if (out->dev->of_node == node) + return true; + } + + return false; +} +EXPORT_SYMBOL(omapdss_component_is_output); + struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id) { struct omap_dss_device *out;