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: 9724397 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 ECE1E60382 for ; Fri, 12 May 2017 15:05:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1F9C2882F for ; Fri, 12 May 2017 15:05:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D676128837; Fri, 12 May 2017 15:05:57 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 91F332882F for ; Fri, 12 May 2017 15:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uaCCNYFPBPwZNxgzjszzp0U6Gf2TC1Hv13CGDdD9Ato=; b=YAshCmtQ7bQ0A3uyslb9OBbg3 Nn6Dm1oTraLHL5fX8fn6ItF3ukYaLIjRwSxB+oX/VtJgkJ+v6nxogw7RGRAdU1jrgj5qpOsUeROgx eNXuTNPHTIKOV1gHy95g75ByKMOHVeHld8UCLU9TlJsO9i1CgUzZew7F9NomwvDOk+/GoY7rk8ybb eVpSwKeypxIy42ynMg0S2uXQ0VSMevxiwftOKS3swul4FDCYD+9ABZxIYqyxIezXo0YrDq9+7bnQp nmKmDwOZtCr2c+trSqnbeH3Xx74sQX19/S8nn4UauVld69CpMryqKp1iqsQDQJoYbvAETVC2NB1De FSGxwauGA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d9C8i-0004iu-L4; Fri, 12 May 2017 15:05:56 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d9C8e-0004gg-DU; Fri, 12 May 2017 15:05:54 +0000 Received: by mail-wr0-x243.google.com with SMTP id 6so7926802wrb.1; Fri, 12 May 2017 08:05:31 -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=Xwm+q9ZPP/rAkbB9wyy2Ji4XHJZLQSt7y2CKhmij5DK0dVUn9oCqyRK/UOD8eSZ1YP 6N3mghQIDEeU/4LW/Wm9nKmP73gQUH37InJS557UKChc+UOwhYQplK1/mqfN2/fHnHYP WA1sCEj0Db7EV9B5ubxap8s7PuQwjRGTZVicHi6Swyp4AE44tW+wL73QVJ3mC6i8FkIB xLPetut94LaeHCNZHRDcnMS1Cvn/59ky2e8ziGA+q1Owx6kvvZbfVpLF1viOFmha3n2h lij7MI+jM2PRh6MgDixpG23Q8/WlVvJOUnCD1XzzJsSpzccWCnIE14zGGVSbwdO0jOLv 66tw== X-Gm-Message-State: AODbwcDMNU44xHlN/t3dQ8edhuZOTFcqa7yYXllqKP2EbSCmsJJMmD+f G/DFs3I2ifcg4w== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170512_080552_618045_7C035548 X-CRM114-Status: GOOD ( 19.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, srv_heupstream@mediatek.com, Wu-Cheng Li , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Yingjoe Chen , Eddie Huang , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;