From patchwork Wed Sep 16 18:14:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 7198491 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: X-Original-To: patchwork-linux-arm-msm@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 5DB499F65E for ; Wed, 16 Sep 2015 18:19:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 548E020862 for ; Wed, 16 Sep 2015 18:19:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 443DF20851 for ; Wed, 16 Sep 2015 18:19:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753874AbbIPST1 (ORCPT ); Wed, 16 Sep 2015 14:19:27 -0400 Received: from gabe.freedesktop.org ([131.252.210.177]:37615 "EHLO gabe.freedesktop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752728AbbIPSSi (ORCPT ); Wed, 16 Sep 2015 14:18:38 -0400 Received: from annarchy.freedesktop.org (annarchy.freedesktop.org [131.252.210.176]) by gabe.freedesktop.org (Postfix) with ESMTP id D9F276E14A; Wed, 16 Sep 2015 11:18:36 -0700 (PDT) Received: from eliezer.anholt.net (annarchy.freedesktop.org [127.0.0.1]) by annarchy.freedesktop.org (Postfix) with ESMTP id BD428182BA; Wed, 16 Sep 2015 11:18:36 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id CDD75F009A3; Wed, 16 Sep 2015 11:14:12 -0700 (PDT) From: Eric Anholt To: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, David Airlie , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , linux-arm-msm@vger.kernel.org, Rob Clark , Eric Anholt Subject: [PATCH 4/4] drm/msm: Use exynos's model for handling component driver matching. Date: Wed, 16 Sep 2015 14:14:10 -0400 Message-Id: <1442427250-9833-5-git-send-email-eric@anholt.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1442427250-9833-1-git-send-email-eric@anholt.net> References: <1442427250-9833-1-git-send-email-eric@anholt.net> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 This eliminates the need for the "connectors" and "gpus" nodes in the devicetree, which we were doing nothing connector- or gpu-specific with. Signed-off-by: Eric Anholt --- drivers/gpu/drm/msm/msm_drv.c | 65 +++++++++++++++++-------------------------- include/drm/drmP.h | 2 +- 2 files changed, 27 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index a9b0573..4e1263b 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1039,34 +1039,7 @@ static const struct dev_pm_ops msm_pm_ops = { * Componentized driver support: */ -#ifdef CONFIG_OF -/* NOTE: the CONFIG_OF case duplicates the same code as exynos or imx - * (or probably any other).. so probably some room for some helpers - */ -static int compare_of(struct device *dev, void *data) -{ - return dev->of_node == data; -} - -static int add_components(struct device *dev, struct component_match **matchptr, - const char *name) -{ - struct device_node *np = dev->of_node; - unsigned i; - - for (i = 0; ; i++) { - struct device_node *node; - - node = of_parse_phandle(np, name, i); - if (!node) - break; - - component_match_add(dev, matchptr, compare_of, node); - } - - return 0; -} -#else +#ifndef CONFIG_OF static int compare_dev(struct device *dev, void *data) { return dev == data; @@ -1088,6 +1061,20 @@ static const struct component_master_ops msm_drm_ops = { .unbind = msm_drm_unbind, }; +static struct platform_driver *const noncomponent_drivers[] = { +#if IS_ENABLED(CONFIG_DRM_MSM_DSI) + &msm_dsi_phy_driver, +#endif +}; + +static struct platform_driver *const component_drivers[] = { +#if IS_ENABLED(CONFIG_DRM_MSM_DSI) + &msm_dsi_driver, +#endif + &msm_hdmi_driver, + &adreno_driver, +}; + /* * Platform driver: */ @@ -1096,8 +1083,9 @@ static int msm_pdev_probe(struct platform_device *pdev) { struct component_match *match = NULL; #ifdef CONFIG_OF - add_components(&pdev->dev, &match, "connectors"); - add_components(&pdev->dev, &match, "gpus"); + drm_platform_component_match_add_drivers(&pdev->dev, &match, + component_drivers, + ARRAY_SIZE(component_drivers)); #else /* For non-DT case, it kinda sucks. We don't actually have a way * to know whether or not we are waiting for certain devices (or if @@ -1159,20 +1147,17 @@ static struct platform_driver msm_platform_driver = { .id_table = msm_id, }; -static struct platform_driver *const component_drivers[] = { -#if IS_ENABLED(CONFIG_DRM_MSM_DSI) - &msm_dsi_phy_driver, - &msm_dsi_driver, -#endif - &msm_hdmi_driver, - &adreno_driver, -}; - static int __init msm_drm_register(void) { int ret; DBG("init"); + + ret = drm_platform_register_drivers(noncomponent_drivers, + ARRAY_SIZE(noncomponent_drivers)); + if (ret) + return ret; + ret = drm_platform_register_drivers(component_drivers, ARRAY_SIZE(component_drivers)); if (ret) @@ -1187,6 +1172,8 @@ static void __exit msm_drm_unregister(void) platform_driver_unregister(&msm_platform_driver); drm_platform_unregister_drivers(component_drivers, ARRAY_SIZE(component_drivers)); + drm_platform_unregister_drivers(noncomponent_drivers, + ARRAY_SIZE(noncomponent_drivers)); } module_init(msm_drm_register); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index b65d886..0da8599 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1094,7 +1094,7 @@ void drm_platform_unregister_drivers(struct platform_driver *const *drv, int count); void drm_platform_component_match_add_drivers(struct device *dev, struct component_match **match, - struct platform_driver **drivers, + struct platform_driver *const *drivers, int count); /* returns true if currently okay to sleep */