Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2189056pxb; Mon, 11 Jan 2021 03:26:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1XrSmpGOeoGb+spWwsQyfJQ1q6f1X8y05yAmzHTXcf/bpJKxZX3zxZjie0S2J8zvR2ZpM X-Received: by 2002:a17:906:a008:: with SMTP id p8mr10556504ejy.117.1610364383849; Mon, 11 Jan 2021 03:26:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610364383; cv=none; d=google.com; s=arc-20160816; b=irOfUJjjSWACoTLBY0lAewk+6msZnwAHs3P2+43S2wkFaU8VwNct/h2uowWU08xEuD lCUHPMWxIe4KfZ4Dqz68bIzmzkDDBWxBE2q3EEU5h0q8lCw445udj2ZMvEMdjtfq+pBM P6H/IjxdLhrscoGot1OCVIAObOkBn6SZ8RJKV0UQB5Ki+P/O9RCoAmH2qtwXRRA/nkol ibx20EBjHg8x1XGhTFQE0pLJQnlHfAfiWuG5ZcGUGIR0D/8kqSKF4GENPvZWN51hVc0h TCu9DA9/bT2iPyJfNgmboFOJ3YwW3dWKN/axLFJr0XPJoCqIYVnESlv3mPWsGuWsuAfT 9r6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=wozS9nJVftrYy6jQUvrJ4ur9vS7vPeM2liUo7gdBic4=; b=sDHxDigjXBat0gbjAQAOGDmheBIFEhVZ/8P+hW9A9etSti8Ywi0JuoQ4M16UvKtQDo 50votPhG5mBXC6GarK/8hux4bRT26S+0e1pDwKjhU7wH7yqSGy0c0xh+YJb4/fAdOLXi Hjsw2vOJsYsr19SrTFCGoZAkPQOc6+ONs3Ci5/C5d97QvMFJHGyVGOwBjqUDOop/Yvzo k4MeVyx6K4OumMg0muizzRgkBhwoHao60tv905pX56JFNd6nWYegLy+imWT2qURYC4t4 L9OFIEkQg/Uksy7QKga4B4p2nMIlWi6YtubLOcj4+G2Rbf1oQhyPoO4MMvXUTb2WVg0b tLzQ== 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=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si6826327edv.542.2021.01.11.03.26.00; Mon, 11 Jan 2021 03:26:23 -0800 (PST) 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=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728874AbhAKLXH (ORCPT + 99 others); Mon, 11 Jan 2021 06:23:07 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:60479 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729893AbhAKLXF (ORCPT ); Mon, 11 Jan 2021 06:23:05 -0500 X-UUID: 197d6e364b974d7789057ffcc1bb796a-20210111 X-UUID: 197d6e364b974d7789057ffcc1bb796a-20210111 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1073604778; Mon, 11 Jan 2021 19:22:32 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 11 Jan 2021 19:22:31 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 11 Jan 2021 19:22:30 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v6 19/33] iommu/mediatek: Add pm runtime callback Date: Mon, 11 Jan 2021 19:19:00 +0800 Message-ID: <20210111111914.22211-20-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210111111914.22211-1-yong.wu@mediatek.com> References: <20210111111914.22211-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In pm runtime case, all the registers backup/restore and bclk are controlled in the pm_runtime callback, Rename the original suspend/resume to the runtime_suspend/resume. Use pm_runtime_force_suspend/resume as the normal suspend/resume. iommu should suspend after iommu consumer devices, thus use _LATE_. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 0fe7c1617dc3..3682137b789a 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -802,7 +802,7 @@ static int mtk_iommu_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused mtk_iommu_suspend(struct device *dev) +static int __maybe_unused mtk_iommu_runtime_suspend(struct device *dev) { struct mtk_iommu_data *data = dev_get_drvdata(dev); struct mtk_iommu_suspend_reg *reg = &data->reg; @@ -820,7 +820,7 @@ static int __maybe_unused mtk_iommu_suspend(struct device *dev) return 0; } -static int __maybe_unused mtk_iommu_resume(struct device *dev) +static int __maybe_unused mtk_iommu_runtime_resume(struct device *dev) { struct mtk_iommu_data *data = dev_get_drvdata(dev); struct mtk_iommu_suspend_reg *reg = &data->reg; @@ -848,7 +848,9 @@ static int __maybe_unused mtk_iommu_resume(struct device *dev) } static const struct dev_pm_ops mtk_iommu_pm_ops = { - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mtk_iommu_suspend, mtk_iommu_resume) + SET_RUNTIME_PM_OPS(mtk_iommu_runtime_suspend, mtk_iommu_runtime_resume, NULL) + SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static const struct mtk_iommu_plat_data mt2712_data = { -- 2.18.0