From patchwork Fri May 12 15:05:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Brugger X-Patchwork-Id: 9724393 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 DE8BE60382 for ; Fri, 12 May 2017 15:05:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3A312882F for ; Fri, 12 May 2017 15:05:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C743628837; Fri, 12 May 2017 15:05:53 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DD9A2882F for ; Fri, 12 May 2017 15:05:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932548AbdELPFd (ORCPT ); Fri, 12 May 2017 11:05:33 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33365 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932315AbdELPFb (ORCPT ); Fri, 12 May 2017 11:05:31 -0400 Received: by mail-wr0-f195.google.com with SMTP id w50so7916324wrc.0; Fri, 12 May 2017 08:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bTn0tVHzw4SiQbuo0dUjR239CNpuChn6XIYygfOXllk=; b=r01OmwggYQYUoLlmtlMn6uJeJV4WEvPJ4fdqrEsbb/kGLpuksxqIp9o4FWELCgjMUf 2JMByuaqe0kehQ9E0cU1Qk9IqqpEMF+2RBuIQ6Bb/RjgxBBhns5MGd43sUVNQI5DbYQh Ba5gYNMQnYz8dTO0J299RRAClROYuLcda+7yTJ1VfPHFGRrF0O5pacSS8SrhZFum2tyN klk1P1QUiLbGylNCroE19+i86/evMuWyr1jR0EDPHNIBroUMyEANwGmN6TQfpqdPk7y7 QArsFbbctT2g09iu+X2oOAQ2ssaQ9+u0hvTnbUSHOEXSUt78WQT3hXkgRcfby3S45LfX CJmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bTn0tVHzw4SiQbuo0dUjR239CNpuChn6XIYygfOXllk=; b=mivcLMnowZlQCNYrP3lUXYK6tLjGHckVDBBj4iNHPjAomrCaafegbIZpEpi4eW31Do kTIhqdxeqadB+sHUIYfJrM5ofr2LVuh8FhhRxK5+DP9k3CbUxpjmNK0vj83Ds9eWydRC 7BHxdSX3AApgbc9Xa/zWRNFQ7RQKHXjJp9FAjYaJrSZBQY0VazKSqMMXHdw6uo3hSOwG mdhGc/frUi09ia6S4dwHXrnS/KZPmXr1KvdY2isxQzd7E+YgiB/SwPfAe+u6IrZyIvfI 3cjqiUDUYEumV8VIKUbCjUk/OAONl8+mckI5+JREQaxDG00hRz2zcmWZF8UaR4zZfqH3 oFJQ== X-Gm-Message-State: AODbwcCxuxZlw9Gk0K0r+/co38RW6rgSLCz2D/gUhMWdMrikN6QRcVhP nfqCfGi2NqslRg== X-Received: by 10.223.133.216 with SMTP id 24mr3985828wru.194.1494601529902; Fri, 12 May 2017 08:05:29 -0700 (PDT) Received: from linux-gy6r.site ([92.57.80.122]) by smtp.gmail.com with ESMTPSA id a73sm4110908wrc.58.2017.05.12.08.05.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 May 2017 08:05:29 -0700 (PDT) Subject: Re: [PATCH v3 3/3] media: mtk-mdp: Fix mdp device tree To: Minghsiu Tsai , Hans Verkuil , daniel.thompson@linaro.org, Rob Herring , Mauro Carvalho Chehab , Daniel Kurtz , Pawel Osciak , Houlong Wei Cc: srv_heupstream@mediatek.com, Eddie Huang , Yingjoe Chen , Wu-Cheng Li , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org References: <1494559361-42835-1-git-send-email-minghsiu.tsai@mediatek.com> <1494559361-42835-4-git-send-email-minghsiu.tsai@mediatek.com> From: Matthias Brugger Message-ID: <60f89b9a-f068-25a7-3f8b-d13b19357361@gmail.com> Date: Fri, 12 May 2017 17:05:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <1494559361-42835-4-git-send-email-minghsiu.tsai@mediatek.com> Content-Language: en-US Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 12/05/17 05:22, Minghsiu Tsai wrote: > From: Daniel Kurtz > > If the mdp_* nodes are under an mdp sub-node, their corresponding > platform device does not automatically get its iommu assigned properly. > > Fix this by moving the mdp component nodes up a level such that they are > siblings of mdp and all other SoC subsystems. This also simplifies the > device tree. > > Although it fixes iommu assignment issue, it also break compatibility > with old device tree. So, the patch in driver is needed to iterate over > sibling mdp device nodes, not child ones, to keep driver work properly. > Couldn't we preserve backwards compatibility by doing something like this: Maybe even by putting a warning in the if branch to make sure, people are aware of their out-of-date device tree blobs. Regards, Matthias > Signed-off-by: Daniel Kurtz > Signed-off-by: Minghsiu Tsai > > --- > drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c > index 9e4eb7d..a5ad586 100644 > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c > @@ -118,7 +118,7 @@ static int mtk_mdp_probe(struct platform_device *pdev) > mutex_init(&mdp->vpulock); > > /* Iterate over sibling MDP function blocks */ > - for_each_child_of_node(dev->of_node, node) { > + for_each_child_of_node(dev->of_node->parent, node) { > const struct of_device_id *of_id; > enum mtk_mdp_comp_type comp_type; > int comp_id; > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c index 9e4eb7dcc424..277d8fe6eb76 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -103,7 +103,7 @@ static int mtk_mdp_probe(struct platform_device *pdev) { struct mtk_mdp_dev *mdp; struct device *dev = &pdev->dev; - struct device_node *node; + struct device_node *node, *parent; int i, ret = 0; mdp = devm_kzalloc(dev, sizeof(*mdp), GFP_KERNEL); @@ -117,8 +117,14 @@ static int mtk_mdp_probe(struct platform_device *pdev) mutex_init(&mdp->lock); mutex_init(&mdp->vpulock); + /* Old dts had the components as child nodes */ + if (of_get_next_child(dev->of_node, NULL)) + parent = dev->of_node; + else + parent = dev->of_node->parent; + /* Iterate over sibling MDP function blocks */ - for_each_child_of_node(dev->of_node, node) { + for_each_child_of_node(parent, node) { const struct of_device_id *of_id; enum mtk_mdp_comp_type comp_type; int comp_id;