From patchwork Mon Oct 19 12:21:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 55225 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 8713722EA2 for ; Mon, 19 Oct 2015 12:22:35 +0000 (UTC) Received: by lffv3 with SMTP id v3sf40044679lff.1 for ; Mon, 19 Oct 2015 05:22:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:subject:date :message-id:in-reply-to:references:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=GmtgeTV9/66rQNnpBzvX4u8Gd7ckN5noNIjNCPEiVSI=; b=UCppvMn3NoQmGRbK8zLbjjeiyukirEPd03xmlsGAwsjYGojkqQRTbMiFAWWXmEXgIA QPk4fy1QDVUXgSG+OOrZgA9yjdsasKhiIPjWlMIeyDu8gL6ERdLPyw8UJqg7+IVXiTpo nl3C4b5vXbNSJsjMsLbSg2TZC+t16YIoEdsx9KNbXpLjZQPw7YQylYhC20QNPMvME1/Q BvaRUGfb5JpNiMqOetaryH4I/RZ2oOrdwXdEegLPkmf6hR6cpzY3a/2EtUEWH3tb7/4r hYb1dwVeddUFrCT0H5mAXUOeVq/hySRE749/aJREsd73AM66j8rhxcf4e10r5KMPWNcb Y4MQ== X-Gm-Message-State: ALoCoQmFq8f8zpxwHG6wySJa1PHIGrGaQ2HobMG2C7luLAguSt5+ow/0Yl+MYn0mgr5l4a5XZ1F7 X-Received: by 10.180.82.41 with SMTP id f9mr51116wiy.0.1445257354446; Mon, 19 Oct 2015 05:22:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.26.140 with SMTP id a134ls588555lfa.30.gmail; Mon, 19 Oct 2015 05:22:34 -0700 (PDT) X-Received: by 10.112.78.100 with SMTP id a4mr14466940lbx.115.1445257354196; Mon, 19 Oct 2015 05:22:34 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id rc10si22635287lbb.160.2015.10.19.05.22.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 05:22:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbes7 with SMTP id es7so52813242lbb.2 for ; Mon, 19 Oct 2015 05:22:34 -0700 (PDT) X-Received: by 10.112.132.7 with SMTP id oq7mr14836471lbb.32.1445257354085; Mon, 19 Oct 2015 05:22:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1437859lbq; Mon, 19 Oct 2015 05:22:33 -0700 (PDT) X-Received: by 10.50.3.40 with SMTP id 8mr19324196igz.26.1445257347233; Mon, 19 Oct 2015 05:22:27 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id z135si25992997iod.78.2015.10.19.05.22.26; Mon, 19 Oct 2015 05:22:27 -0700 (PDT) Received-SPF: pass (google.com: domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 249686E8E8; Mon, 19 Oct 2015 05:22:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id C33FC6E8D7 for ; Mon, 19 Oct 2015 05:22:19 -0700 (PDT) Received: from e106497-lin.cambridge.arm.com (e106497-lin.cambridge.arm.com [10.2.131.158]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id t9JCLrEF003452; Mon, 19 Oct 2015 13:21:54 +0100 From: Liviu Dudau To: David Airlie , Daniel Vetter , Philipp Zabel , Mark Yao , Heiko Stuebner , Russell King Subject: [RFC PATCH v2 3/4] drm/rockchip: Convert the probe function to the generic drm_of_component_probe() Date: Mon, 19 Oct 2015 13:21:52 +0100 Message-Id: <1445257313-7147-4-git-send-email-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.6.0 In-Reply-To: <1445257313-7147-1-git-send-email-Liviu.Dudau@arm.com> References: <1445257313-7147-1-git-send-email-Liviu.Dudau@arm.com> Cc: linux-rockchip , LAKML , dri-devel , LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: liviu.dudau@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Use the generic drm_of_component_probe() function to probe for components. Signed-off-by: Liviu Dudau --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 86 ++--------------------------- 1 file changed, 6 insertions(+), 80 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index f22e1e1..a32b596 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -45,11 +46,6 @@ int rockchip_drm_dma_attach_device(struct drm_device *drm_dev, struct device *dev) { struct dma_iommu_mapping *mapping = drm_dev->dev->archdata.mapping; - int ret; - - ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); - if (ret) - return ret; dma_set_max_seg_size(dev, DMA_BIT_MASK(32)); @@ -418,29 +414,6 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == np; } -static void rockchip_add_endpoints(struct device *dev, - struct component_match **match, - struct device_node *port) -{ - struct device_node *ep, *remote; - - for_each_child_of_node(port, ep) { - remote = of_graph_get_remote_port_parent(ep); - if (!remote || !of_device_is_available(remote)) { - of_node_put(remote); - continue; - } else if (!of_device_is_available(remote->parent)) { - dev_warn(dev, "parent device of %s is not available\n", - remote->full_name); - of_node_put(remote); - continue; - } - - component_match_add(dev, match, compare_of, remote); - of_node_put(remote); - } -} - static int rockchip_drm_bind(struct device *dev) { struct drm_device *drm; @@ -483,61 +456,14 @@ static const struct component_master_ops rockchip_drm_ops = { static int rockchip_drm_platform_probe(struct platform_device *pdev) { - struct device *dev = &pdev->dev; - struct component_match *match = NULL; - struct device_node *np = dev->of_node; - struct device_node *port; - int i; + int ret = drm_of_component_probe(&pdev->dev, compare_of, + &rockchip_drm_ops); - if (!np) + /* keep compatibility with old code that was returning -ENODEV */ + if (ret == -EINVAL) return -ENODEV; - /* - * Bind the crtc ports first, so that - * drm_of_find_possible_crtcs called from encoder .bind callbacks - * works as expected. - */ - for (i = 0;; i++) { - port = of_parse_phandle(np, "ports", i); - if (!port) - break; - - if (!of_device_is_available(port->parent)) { - of_node_put(port); - continue; - } - component_match_add(dev, &match, compare_of, port->parent); - of_node_put(port); - } - - if (i == 0) { - dev_err(dev, "missing 'ports' property\n"); - return -ENODEV; - } - - if (!match) { - dev_err(dev, "No available vop found for display-subsystem.\n"); - return -ENODEV; - } - /* - * For each bound crtc, bind the encoders attached to its - * remote endpoint. - */ - for (i = 0;; i++) { - port = of_parse_phandle(np, "ports", i); - if (!port) - break; - - if (!of_device_is_available(port->parent)) { - of_node_put(port); - continue; - } - - rockchip_add_endpoints(dev, &match, port); - of_node_put(port); - } - - return component_master_add_with_match(dev, &rockchip_drm_ops, match); + return ret; } static int rockchip_drm_platform_remove(struct platform_device *pdev)