From patchwork Fri Jul 9 02:23:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 12366513 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=-17.4 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 E958CC07E96 for ; Fri, 9 Jul 2021 02:27:27 +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 B18F86145C for ; Fri, 9 Jul 2021 02:27:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B18F86145C 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=QKZAAroX3KW6wFeaspAyfdQgCctZFnBgJbuAEMFywgg=; b=oh72Q8VP3IiMil R8dyK+DP3GUKU/dy4uOFfYh12bII7ulmTpl7PavvEe28wvsaoJxmBqmvi+t0A8U41Nn43/TkyL9xn YQomqAsH0PZyqEJ/LX+DyWrXytaTN9inBb5NitH6yqrpH64FzAtaAjCeqkZ+UllcmNKFtPR/jj0+K FBLuAFI/6xeNKa53QQ3dqd/nOnR5K0qM1CDjTNKaLdhLtXTAZn1QJv4St+rDZTmRCqqn7xmhMgNla uaK/e+kqcjzpNsH0I2eSlnQjY4mFalyj+edqw0UCHdeith8wslgslrXOk4o51Xxt2RcJEV0x8omUN avjhgQBDFQmM0386z8+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m1gDG-000aFx-3L; Fri, 09 Jul 2021 02:25:58 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m1gBa-000ZKx-JW for linux-arm-kernel@lists.infradead.org; Fri, 09 Jul 2021 02:24:17 +0000 Received: by mail-pj1-x1032.google.com with SMTP id i16-20020a17090acf90b02901736d9d2218so228710pju.1 for ; Thu, 08 Jul 2021 19:24:14 -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=rYIiMjbCmn43Rbsp7mN8fJ7VxPLz2wz8aV49oHF0Izc=; b=i1W29XOJ/AORywSkCdaZRa5IuPXvzW6EDR2EQaXxNIbVo5w1NppVS1U6RavsQXP2F2 8LR9Y4VCXnsWgBpD+/+LpQgE0bkFZRUZA/zdKDYWVYN2EvnU6sFsDR/OE9bayH0FTliU 91UAht22nwAHXs/rG+Z5brFgo0YnmEvUtpI4k= 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=rYIiMjbCmn43Rbsp7mN8fJ7VxPLz2wz8aV49oHF0Izc=; b=s+z8Eag9AlD0ofAHJbHI2RfSZT2SJH98uK3OEY3i26B2BW97AwJw9ZbZccpsbFDvQh ca+IwBvdiKgVXo9UTrpMEUdZj/hrV4nCNz6oXZ5OrJgve0HyPl6qIAWRk3w7R5IQJDNf 2JatabWb/UnuvOCrWwWjUOXKPKTVR2T48Y8A9DiiyqW1q15LJz03Xm0U5C9FZIEgDCf2 c8NgpV0qS6CHe40QuLB2XjzIZz8vFluVEurPE9VQfVZxk7KooJaKLD3wuBb3O7i26hGQ mPwjcL6ZywSQQdZtBiYxGZPstrsp/hGW837R0IzUn6p5BVhKkVA7/D6PnOV7nOeFNuHl iiIA== X-Gm-Message-State: AOAM530NyqbYJUDJdl3a45HBW/L0vlj1zlVShyHB4ruZalS8N2wxGAwF Ul2vM/pC+93vDF299McU0J2Mnw== X-Google-Smtp-Source: ABdhPJxx+2zh5ok23idoYfWplSj2eD0UhpNEeZkKeWCpitflaqJX/xgHdimutf+wQ0oa/4kekFVOew== X-Received: by 2002:a17:902:9006:b029:107:394a:387 with SMTP id a6-20020a1709029006b0290107394a0387mr28492430plp.35.1625797453759; Thu, 08 Jul 2021 19:24:13 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:d956:2966:7910:2bd2]) by smtp.gmail.com with UTF8SMTPSA id y17sm4046053pfl.189.2021.07.08.19.24.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Jul 2021 19:24:13 -0700 (PDT) From: Eizan Miyamoto To: linux-kernel@vger.kernel.org Cc: wenst@chromium.org, chunkuang.hu@kernel.org, yong.wu@mediatek.com, enric.balletbo@collabora.com, houlong.wei@mediatek.com, 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 v5 5/8] media: mtk-mdp: search for vpu node instead of linking it to a property Date: Fri, 9 Jul 2021 12:23:21 +1000 Message-Id: <20210709122040.v5.5.I0cbd6691d3edfa2757bd6f5de7acfce94b101480@changeid> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210709022324.1607884-1-eizan@chromium.org> References: <20210709022324.1607884-1-eizan@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210708_192414_692733_A6CAA8B1 X-CRM114-Status: GOOD ( 15.68 ) 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 Since there is only one vpu node, it suffices to search for it instead of having a link coded into the primary mdp device node. Signed-off-by: Eizan Miyamoto --- (no changes since v1) drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 6 ---- drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 28 +++++++++++++------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c index 0ee6c7d65664..8a9267d0da1e 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c @@ -127,12 +127,6 @@ static int mtk_mdp_comp_bind(struct device *dev, struct device *master, if (vpu_node) { int ret; - mdp->vpu_dev = of_find_device_by_node(vpu_node); - if (WARN_ON(!mdp->vpu_dev)) { - dev_err(dev, "vpu pdev failed\n"); - of_node_put(vpu_node); - } - ret = v4l2_device_register(dev, &mdp->v4l2_dev); if (ret) { dev_err(dev, "Failed to register v4l2 device\n"); diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c index 9af3dc0e204a..74ef37eb50bd 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -114,6 +114,7 @@ static void release_of(struct device *dev, void *data) static int mtk_mdp_master_bind(struct device *dev) { int status; + struct device_node *vpu_node; struct mtk_mdp_dev *mdp = dev_get_drvdata(dev); status = component_bind_all(dev, mdp); @@ -122,15 +123,24 @@ static int mtk_mdp_master_bind(struct device *dev) goto err_component_bind_all; } - if (mdp->vpu_dev) { - int ret = vpu_wdt_reg_handler(mdp->vpu_dev, mtk_mdp_reset_handler, mdp, - VPU_RST_MDP); - if (ret) { - dev_err(dev, "Failed to register reset handler\n"); - goto err_wdt_reg; - } - } else { - dev_err(dev, "no vpu_dev found\n"); + vpu_node = of_find_node_by_name(NULL, "vpu"); + if (!vpu_node) { + dev_err(dev, "unable to find vpu node"); + status = -ENODEV; + goto err_wdt_reg; + } + + mdp->vpu_dev = of_find_device_by_node(vpu_node); + if (!mdp->vpu_dev) { + dev_err(dev, "unable to find vpu device"); + status = -ENODEV; + goto err_wdt_reg; + } + + status = vpu_wdt_reg_handler(mdp->vpu_dev, mtk_mdp_reset_handler, mdp, VPU_RST_MDP); + if (status) { + dev_err(dev, "Failed to register reset handler\n"); + goto err_wdt_reg; } status = mtk_mdp_register_m2m_device(mdp);