From patchwork Thu Oct 15 16:11:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 55051 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f70.google.com (mail-lf0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 7BAB722FFA for ; Thu, 15 Oct 2015 16:12:39 +0000 (UTC) Received: by lffv3 with SMTP id v3sf4881096lff.1 for ; Thu, 15 Oct 2015 09:12:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=Bh3I/h8AzsPH0/oD6skVcB95Ep15bYkU5PX8QRPdVCg=; b=Oh/PSfT+uxgHgOrxGg/tsLMTbNgpRW40gTaj5BYnGPNSBQYqQR47lLAxmhliR5BhNr e/PZfN/mRn32vC1rpzyybKV8KPLfUhoDwnvHxBGq2YBLG7h3cqPre+udb0oDiKgWuB8A 1FfZOja3MiNvt/Gx3ua2OVaBILXJRU/Xoez/B4e12VgDNnWQ37oPskDEfyNXj+DM4Jd5 UkSaAK11vmmyaY+/+vBhhJ8hOX3K3yqFpya4lOoQP9mdcmec5R4IPdySD6pLuFrlKUd1 eam77tsREy7e7kFZ632MNtz0oExwoMoJXQjffHbhM3VxWd1h7oMxRvsqX0L2HHobg1dn Y5og== X-Gm-Message-State: ALoCoQlo1AUaD9N2Bu3QtqzLXJeNfj0aljCbQsxW7oRkjvOnfioXJBtXD3wjvu8x7j5aGNrQZZQt X-Received: by 10.194.109.233 with SMTP id hv9mr2361005wjb.1.1444925558446; Thu, 15 Oct 2015 09:12:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.163.194 with SMTP id m185ls164991lfe.66.gmail; Thu, 15 Oct 2015 09:12:38 -0700 (PDT) X-Received: by 10.112.132.74 with SMTP id os10mr5117195lbb.40.1444925558251; Thu, 15 Oct 2015 09:12:38 -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 k1si9594832lbd.96.2015.10.15.09.12.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 09:12:38 -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 lbwr8 with SMTP id r8so74728581lbw.2 for ; Thu, 15 Oct 2015 09:12:38 -0700 (PDT) X-Received: by 10.112.135.9 with SMTP id po9mr5224136lbb.56.1444925558057; Thu, 15 Oct 2015 09:12:38 -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 w3csp725836lbq; Thu, 15 Oct 2015 09:12:37 -0700 (PDT) X-Received: by 10.50.88.105 with SMTP id bf9mr11486419igb.39.1444925557040; Thu, 15 Oct 2015 09:12:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 195si5607933iof.3.2015.10.15.09.12.36; Thu, 15 Oct 2015 09:12:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753627AbbJOQML (ORCPT + 30 others); Thu, 15 Oct 2015 12:12:11 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:28867 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752426AbbJOQMI (ORCPT ); Thu, 15 Oct 2015 12:12:08 -0400 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 t9FGBBSN020260; Thu, 15 Oct 2015 17:11:12 +0100 From: Liviu Dudau To: David Airlie , Daniel Vetter , Philipp Zabel , Mark Yao , Heiko Stuebner , Russell King Cc: dri-devel , linux-rockchip , LAKML , LKML Subject: [RFC PATCH 3/4] drm/rockchip: Convert the probe function to the generic drm_of_component_probe() Date: Thu, 15 Oct 2015 17:11:09 +0100 Message-Id: <1444925470-9963-4-git-send-email-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.6.0 In-Reply-To: <1444925470-9963-1-git-send-email-Liviu.Dudau@arm.com> References: <1444925470-9963-1-git-send-email-Liviu.Dudau@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 | 84 ++--------------------------- 1 file changed, 5 insertions(+), 79 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 9a0c291..8cd6397 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -47,10 +47,6 @@ int rockchip_drm_dma_attach_device(struct drm_device *drm_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)); return arm_iommu_attach_device(dev, mapping); @@ -416,29 +412,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; @@ -481,61 +454,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; - - if (!np) - 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; - } + int ret = drm_of_component_probe(&pdev->dev, compare_of, + &rockchip_drm_ops); - component_match_add(dev, &match, compare_of, port->parent); - of_node_put(port); - } - - if (i == 0) { - dev_err(dev, "missing 'ports' property\n"); + /* keep compatibility with old code that was returning -ENODEV */ + if (ret == -EINVAL) 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)