From patchwork Wed Jul 7 07:34:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 12361981 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=-18.2 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 05E3AC07E9B for ; Wed, 7 Jul 2021 07:38:02 +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 CC8CD61C88 for ; Wed, 7 Jul 2021 07:38:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC8CD61C88 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=/HoMa1DSYoTzu9eIZNiU2Pewv52SpwWOb0eEevdxrlM=; b=Zwc1XRuBSy31gE UN7+Y18CCnb6mtx4ZhOhv3cT4cFZ1L1FdkQtH2mYugJn4fShquD1stsKiB/mrYlRcvHOSC/m+BWOH KFMImZ56XzduYDAH2cPFKI5j7dcACbbBv/OmECCJFtMAT0Eo3q+Vx16VLp0Abv+SREOqZZPiEIjP+ KEGjuB63esYGSfTyhBVKjLqSyRCbqYqIaCOQRKQ4FIYC5K524CZuxQ32fEkbBzg6mXzde9pcF1WhA bpm45fAUpTaqMxCfrYyIO8fdcKDD1AQxaSAFPrh9F5V/eLlQOITaO+KVETUokw5GBotZJXuQMfFcC ZJvNUq0L6aqMfJtwSkvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m1269-00Dr5Y-Pa; Wed, 07 Jul 2021 07:35:58 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m125O-00Dqd4-De for linux-arm-kernel@lists.infradead.org; Wed, 07 Jul 2021 07:35:11 +0000 Received: by mail-pj1-x102b.google.com with SMTP id b14-20020a17090a7aceb029017261c7d206so3145860pjl.5 for ; Wed, 07 Jul 2021 00:35:08 -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=cz5Yf26hS0mQEs4OKDDFPHwtGleZDBuXb5hOWYwdOV4=; b=cf/lds2uXZML++gxAnlsKaNN9m0W9hvYqI8NMIfH7HW/ri1D+YjOSJ8H8329TEDwCM f0EPCHqhkbD0TD/R7ETL+mS9V0EUq/8uJQM59sU8wqqG9ZB2lWxEA8Aqi++WraUAKdh/ 1DwfBbbfvdpYzYXxTAZeEhSDFBGaFTP6Zwq6M= 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=cz5Yf26hS0mQEs4OKDDFPHwtGleZDBuXb5hOWYwdOV4=; b=G8Sh/R2aRYLAmbvc2cyt1BJpf0n5Mq05sfpUQ/pvAnk3qKdF3qW6W2ZcffP3LKFopl qCAvbSLvdiqEiu1kM05w/PLC0LuetdImhdN2tev14cfFwZ73+AAt1EoF7qRAx3AgAsG+ ve9jO3uYOVz5HDQ6OHuaKRtDIK7HxIl+1kY+YaKWQwoYiVhGOJyMHdynkF9fjYHuFhOm jQ0wh1eoFKOyB6Xdx6ANjT0V1v/YbXwBjRB/Asx/7qKJgjnV2uCC5xwX9nAX1Du2m6RU 1/nE2v9COImQpLayk+wElJjzvJdS7PqsssERe2AOUVjbAwyRWjcupVnOL80sOcVTtrDQ fTEQ== X-Gm-Message-State: AOAM531QC7I3S1MLial1GCdJoO331hWxIl7fTfPoo0fzZ9PIw4AR0MXo IHG2qRuDal4XWE8HZ69cWjpJfA== X-Google-Smtp-Source: ABdhPJwgYAgzSOqCb9aR3c1XJWh5okmVPcJwiT7+q7wrJLwi8pWgTbku9wDoDhB2jXjVxJc29ywabw== X-Received: by 2002:a17:90b:4b82:: with SMTP id lr2mr16752540pjb.111.1625643307806; Wed, 07 Jul 2021 00:35:07 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:ccb9:d95f:4dac:dbc4]) by smtp.gmail.com with UTF8SMTPSA id m10sm19087343pff.215.2021.07.07.00.35.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Jul 2021 00:35:07 -0700 (PDT) From: Eizan Miyamoto To: linux-kernel@vger.kernel.org Cc: houlong.wei@mediatek.com, enric.balletbo@collabora.com, wenst@chromium.org, 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 v4 5/8] media: mtk-mdp: search for vpu node instead of linking it to a property Date: Wed, 7 Jul 2021 17:34:07 +1000 Message-Id: <20210707173108.v4.5.I0cbd6691d3edfa2757bd6f5de7acfce94b101480@changeid> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210707073410.999625-1-eizan@chromium.org> References: <20210707073410.999625-1-eizan@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210707_003510_484081_71245A99 X-CRM114-Status: GOOD ( 16.36 ) 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 fdbb46a5330a..3d9bb7265159 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c @@ -117,12 +117,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 267e4cb4bf32..48e9a557c446 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -113,6 +113,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); @@ -121,15 +122,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);