From patchwork Fri Jun 11 04:01:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 12314665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3CBCC4743D for ; Fri, 11 Jun 2021 04:05:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C19D61285 for ; Fri, 11 Jun 2021 04:05:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C19D61285 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/kKLAA0jKeXmiwTXuGdCoddFQuOMvhsKDF+gtaKPet8=; b=qD3RDqb4UdR4HP WHQEBmNEw+DXkBlYSAYtGgqz94zqCDs/9+UeJNBirfKNiRdSjBuAtobkwiuo/IX2y8bYkF0Y8BUvg nCq7z/DWCPpNWjbBtcmgUCZcBFg9f10ul1bVxdicvz8yTK27VonZEI0ZTKq0+X9cr4McHwmCnzxYo O9+mXueHOyKnoN3tm697au5fstnUGmmY8QUjzLyRQhNvGEhCfee1v6xWC14hEbPLNO/PYH6/4WHpC lB32Hy43sPy3+pavpjO7IWYTjbWoTDb26qgUSk01+V3U4qYiClnZF36ijgNZXoGs4/UsPITCZkpMK ntXxe9L3+v1IFgikrcOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrYOD-003S0S-20; Fri, 11 Jun 2021 04:03:25 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrYNl-003Rhd-9e for linux-arm-kernel@lists.infradead.org; Fri, 11 Jun 2021 04:02:58 +0000 Received: by mail-pl1-x629.google.com with SMTP id b12so2154058plg.11 for ; Thu, 10 Jun 2021 21:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8XFKmXX+Z8zBE+LvKxlcbsoweak/MaB5nJN3HXAfDUI=; b=TjO2rbze6Hl1C/ma0Cxmypa4hqczGAiGrDGeahbZ8pF58o9czM7knR42g1jTT3WYfW 5T3rnHte+PlaVAmU9+BSjRwleCx7bY6Ti5WZv/JWrQnPuFSsjOSBtGZ+ZlC4HDYL9w8W 4B1ZPHiXZRyxGxo9l5zn7GsnlhoPgFKQgxEEQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8XFKmXX+Z8zBE+LvKxlcbsoweak/MaB5nJN3HXAfDUI=; b=TL+KbffsLRigEG5dskioYd0YKk+MS0GgkDUpQ0S39QoZO5BSjDJLvjwYPNEZ9mlC+H qYPEZmqJJn3myswXjnZwR97MoNoh/5y7+nqxQbpKqaXpHEkpcPcOmG+lok5DHkNajVwv eEstaVu13i0c2v7W6w1dZfjtMsQOFrIHWvEfGTGwcJkUt0+jrq4SMe3JGWzxYMWWdnCF HVYanVZQeTTZpa2dSAKsM8YM+BDRLqSR0iwUdQ9ZjLMOTHrNJFQ//r3p3pRbD/S3Cwyh jU2BJbTDvBhkGe+NT9K8i7EGVSPFfj8rbscufixo9H7TJH8XoOFetW0Nr85T7D+kQgQy /I0Q== X-Gm-Message-State: AOAM5315SpWUSD2joS8n6VZefA1B4AZE6x3UIBrDt7Y3Fx1V9+5DD37A wVgqyxtfZkx4xVJPdYIULRoceA== X-Google-Smtp-Source: ABdhPJw6JBRfw+XnBfj0SsNQjSFAjC9f3KJYRasmUse4UZLoDYVydM7J7wSRvsMMDZcHIslDqOI+hg== X-Received: by 2002:a17:90b:d81:: with SMTP id bg1mr1055411pjb.112.1623384176460; Thu, 10 Jun 2021 21:02:56 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:db52:e918:e5f9:9e14]) by smtp.gmail.com with UTF8SMTPSA id o9sm3945251pfh.217.2021.06.10.21.02.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Jun 2021 21:02:56 -0700 (PDT) From: Eizan Miyamoto To: linux-kernel@vger.kernel.org Cc: houlong.wei@mediatek.com, enric.balletbo@collabora.com, yong.wu@mediatek.com, chunkuang.hu@kernel.org, Eizan Miyamoto , Andrew-CT Chen , Matthias Brugger , Mauro Carvalho Chehab , Minghsiu Tsai , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 7/8] media: mtk-mdp: treat rdma@14001000 specially when probing Date: Fri, 11 Jun 2021 14:01:44 +1000 Message-Id: <20210611140124.v2.7.I2049e180dca12e0d1b3178bfc7292dcf9e05ac28@changeid> X-Mailer: git-send-email 2.32.0.272.g935e593368-goog In-Reply-To: <20210611040145.2085329-1-eizan@chromium.org> References: <20210611040145.2085329-1-eizan@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210610_210257_366701_20A37C63 X-CRM114-Status: GOOD ( 25.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ... Instead of depending on the presence of a mediatek,vpu property in the device node. This property was originally added to link to the vpu node so that the mtk_mdp_core driver could pass the right device to vpu_wdt_reg_handler(). However in a previous patch in this series, the driver has been modified to search the device tree for that node instead. This property was also used to indicate the primary MDP device, so that it can be passed to the V4L2 subsystem as well as register it to be used when setting up queues in the open() callback for the filesystem device node that is created. In this case, assuming that the primary MDP device is the one with a specific name at a specific address seems useable because the alternative is to add a property to the device tree which doesn't actually represent any facet of hardware (i.e., this being the primary MDP device is a software decision). In other words, this solution is equally as arbitrary, but doesn't add a property to a device node which is unrelated to the hardware present. Signed-off-by: Eizan Miyamoto --- (no changes since v1) drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 15 ++++----------- drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 6 ++++++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c index 59911ee063c1..77ddc18c90e2 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c @@ -146,17 +146,11 @@ static int mtk_mdp_comp_bind(struct device *dev, struct device *master, { struct mtk_mdp_comp *comp = dev_get_drvdata(dev); struct mtk_mdp_dev *mdp = data; - struct device_node *vpu_node; mtk_mdp_register_component(mdp, comp); - /* - * If this component has a "mediatek-vpu" property, it is responsible for - * notifying the mdp master driver about it so it can be further initialized - * later. - */ - vpu_node = of_parse_phandle(dev->of_node, "mediatek,vpu", 0); - if (vpu_node) { + if (strcmp(dev->of_node->full_name, "rdma@14001000") == 0) { + /* This is the primary MDP device node. */ int ret; ret = v4l2_device_register(dev, &mdp->v4l2_dev); @@ -172,9 +166,8 @@ static int mtk_mdp_comp_bind(struct device *dev, struct device *master, } /* - * presence of the "mediatek,vpu" property in a device node - * indicates that it is the primary MDP rdma device and MDP DMA - * ops should be handled by its DMA callbacks. + * MDP DMA ops will be handled by the DMA callbacks associated with this + * device; */ mdp->rdma_dev = dev; } diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c index 523e3c2798e1..be7d35b3e3ff 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -157,6 +157,12 @@ static int mtk_mdp_master_bind(struct device *dev) goto err_component_bind_all; } + if (mdp->rdma_dev == NULL) { + dev_err(dev, "Primary MDP device not found"); + status = -ENODEV; + goto err_component_bind_all; + } + vpu_node = of_find_node_by_name(NULL, "vpu"); if (!vpu_node) { dev_err(dev, "unable to find vpu node");