From patchwork Thu Sep 17 14:57:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 7208361 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 43F7A9F39B for ; Thu, 17 Sep 2015 14:59:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3FA8C207E4 for ; Thu, 17 Sep 2015 14:59:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F907207EA for ; Thu, 17 Sep 2015 14:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751973AbbIQO6G (ORCPT ); Thu, 17 Sep 2015 10:58:06 -0400 Received: from gabe.freedesktop.org ([131.252.210.177]:41619 "EHLO gabe.freedesktop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751702AbbIQO6E (ORCPT ); Thu, 17 Sep 2015 10:58:04 -0400 Received: from annarchy.freedesktop.org (annarchy.freedesktop.org [131.252.210.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E1A67215A; Thu, 17 Sep 2015 07:58:03 -0700 (PDT) Received: from eliezer.anholt.net (annarchy.freedesktop.org [127.0.0.1]) by annarchy.freedesktop.org (Postfix) with ESMTP id 0E8A1182DF; Thu, 17 Sep 2015 07:58:03 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 83315F003C4; Thu, 17 Sep 2015 07:57:58 -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 v2 4/4] drm/msm: Use exynos's model for handling component driver matching. Date: Thu, 17 Sep 2015 10:57:58 -0400 Message-Id: <1442501878-9037-4-git-send-email-eric@anholt.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1442501878-9037-1-git-send-email-eric@anholt.net> References: <1442501878-9037-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 */