Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp197805pxv; Wed, 14 Jul 2021 01:45:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHFomhPRxDPtNJYxq+2rnuRUWw/LQR+2yxe73zmo6V5fZjlE+fpEpxDlM68kqprgrO3UkD X-Received: by 2002:a92:700b:: with SMTP id l11mr5939490ilc.48.1626252302430; Wed, 14 Jul 2021 01:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626252302; cv=none; d=google.com; s=arc-20160816; b=IhlTghd9bGTtjHx/GmhfOMjkhtIPFJMNqZA4pl0QxdSiA9XnTrwMjKPNaQEaQGuC3w eV2//KGqiEUXqPoKlP6fNR3mzrx9XCBC2YTbrUNISJAUBbmphNk/LMIJYfaTUjiqMYR8 EOyibv6uzOkcCWEkXLbSM7EjixAhyTsbJtei/OuFFDpGX/x6lZw21dU0TpoSuMiAwRdP fdJkCMOr3/I632jP34xNPrDNEHuV6esekqFMGEGWQYGCv2ujvtnc7M27xryO7SzljB99 Icd+/PcneZEGrl8J+M2pI8TEtPUj16rhZawB7Gbw2njqgMkNxvh5iKYlJimk0+Q8ntx0 4sJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=qD07IdEgE1mWk1+p2M/PEyQosz9zl6NjMMSAD/BkJo4=; b=aBTjsK51yNHHE9Yz3i83KlB5c0cuCVteHCUYra2EtnmXtveMgaplLaCJJ7fwQ6XWyL 64BD6uWs5sw7P9f59x4HjQ0RKU3ZGvFwfHJ2r3dCWLqojdtfDRjEEmyJyaHl/8oDsa1/ UNFH1YGuExw7XYLpuhG0QxOFyeSpRCwctoFyZVlqAORfMOl8yBkwvjomYf+DF5B1aUyl YukIiyU/LKS0uurOi6ODXA6ifkmmw72H5M/KurOdsdI8WP7gD6dH9Dj+Kr9rANnrQbET g5KKWyaE8QPpbJ8DSNhpaA37C2V0IE9tXLXj6+RfOS9T44IJLVL9t/wUsDgf4uCFnyZm BU8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si1716562ilq.82.2021.07.14.01.44.50; Wed, 14 Jul 2021 01:45:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238655AbhGNIq7 (ORCPT + 99 others); Wed, 14 Jul 2021 04:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238582AbhGNIq6 (ORCPT ); Wed, 14 Jul 2021 04:46:58 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D886C06175F; Wed, 14 Jul 2021 01:44:07 -0700 (PDT) Received: from [IPv6:2a02:810a:880:f54:e49e:3ed0:1a77:5623] (unknown [IPv6:2a02:810a:880:f54:e49e:3ed0:1a77:5623]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dafna) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 42F781F42B41; Wed, 14 Jul 2021 09:44:04 +0100 (BST) Subject: Re: [PATCH v6 06/11] drm/mediatek: Add pm runtime support for ovl and rdma To: Yong Wu , Matthias Brugger , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , David Airlie , Mauro Carvalho Chehab Cc: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , Matthias Kaehlcke , anan.sun@mediatek.com, ming-fan.chen@mediatek.com, yi.kuo@mediatek.com, acourbot@chromium.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, Daniel Vetter , Chun-Kuang Hu , Philipp Zabel , Xia Jiang , Tiffany Lin , Hsin-Yi Wang , Eizan Miyamoto , anthony.huang@mediatek.com, Yongqiang Niu , CK Hu References: <20210714025626.5528-1-yong.wu@mediatek.com> <20210714025626.5528-7-yong.wu@mediatek.com> From: Dafna Hirschfeld Message-ID: <61aa5aa9-5bd2-e99c-02ef-f5d13526eb43@collabora.com> Date: Wed, 14 Jul 2021 10:44:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210714025626.5528-7-yong.wu@mediatek.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.07.21 04:56, Yong Wu wrote: > From: Yongqiang Niu > > Prepare for smi cleaning up "mediatek,larb". > > Display use the dispsys device to call pm_rumtime_get_sync before. > This patch add pm_runtime_xx with ovl and rdma device whose nodes has > "iommus" property, then display could help pm_runtime_get for smi via > ovl or rdma device. > > CC: CK Hu > Signed-off-by: Yongqiang Niu > Signed-off-by: Yong Wu > (Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync) > Acked-by: Chun-Kuang Hu > --- > drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 9 ++++++++- > drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 9 ++++++++- > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 12 +++++++++++- > 3 files changed, 27 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > index fa9d79963cd3..ea5760f856ec 100644 > --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > > #include "mtk_disp_drv.h" > @@ -414,15 +415,21 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) > return ret; > } > > + pm_runtime_enable(dev); > + > ret = component_add(dev, &mtk_disp_ovl_component_ops); > - if (ret) > + if (ret) { > + pm_runtime_disable(dev); > dev_err(dev, "Failed to add component: %d\n", ret); > + } > > return ret; > } > > static int mtk_disp_ovl_remove(struct platform_device *pdev) > { > + pm_runtime_disable(&pdev->dev); > + > return 0; > } > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c > index 705f28ceb4dd..0f31d1c8e37c 100644 > --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c > +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > > #include "mtk_disp_drv.h" > @@ -327,9 +328,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, priv); > > + pm_runtime_enable(dev); > + > ret = component_add(dev, &mtk_disp_rdma_component_ops); > - if (ret) > + if (ret) { > + pm_runtime_disable(dev); > dev_err(dev, "Failed to add component: %d\n", ret); > + } > > return ret; > } > @@ -338,6 +343,8 @@ static int mtk_disp_rdma_remove(struct platform_device *pdev) > { > component_del(&pdev->dev, &mtk_disp_rdma_component_ops); > > + pm_runtime_disable(&pdev->dev); > + > return 0; > } > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > index 474efb844249..08e3f352377d 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c > @@ -557,9 +557,15 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc, > return; > } > > + ret = pm_runtime_resume_and_get(comp->dev); > + if (ret < 0) > + DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n", > + ret); shouldn't the code return in case of failure here? Thanks, Dafna > + > ret = mtk_crtc_ddp_hw_init(mtk_crtc); > if (ret) { > mtk_smi_larb_put(comp->larb_dev); > + pm_runtime_put(comp->dev); > return; > } > > @@ -572,7 +578,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc, > { > struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); > struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0]; > - int i; > + int i, ret; > > DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id); > if (!mtk_crtc->enabled) > @@ -596,6 +602,10 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc, > drm_crtc_vblank_off(crtc); > mtk_crtc_ddp_hw_fini(mtk_crtc); > mtk_smi_larb_put(comp->larb_dev); > + ret = pm_runtime_put(comp->dev); > + if (ret < 0) > + DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n", > + ret); > > mtk_crtc->enabled = false; > } >