From patchwork Wed Sep 12 19:45:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Ramirez Luna X-Patchwork-Id: 1446481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (unknown [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 2F067DF238 for ; Wed, 12 Sep 2012 20:03:27 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TBsu5-0007hz-RS; Wed, 12 Sep 2012 19:47:17 +0000 Received: from mail-oa0-f49.google.com ([209.85.219.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TBst3-0007VZ-6s for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2012 19:46:13 +0000 Received: by mail-oa0-f49.google.com with SMTP id h1so1327113oag.36 for ; Wed, 12 Sep 2012 12:46:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=7iyEBJ2CMcLpfHxdg3Oe2qGqiwnjQo66eYL5gWmWgr0=; b=MOU2OihWVyUMWAtysDLmtF2tmEgUIS1R88nMerQ8hoea5PRo5xAgF3W0zXKUUv2RMc icqL4rrLOaPOgXELWbbYzZprcMjiQvpnNoAntj2QwwR4Z32o3A6Eltf9a4rLuvTu55kI G2BVG6VO9+KcRyup09/xBpaQ1OqDvSUYldh4/+VjYMJqpL5aHedtjol4d0y2Ld9HRZTM Wfj6eCp9vea9EEhhgiiBkrbE9AwwxJg66KjLl7u1rpk2JcfLJs1+T6IxWiE0/TY7/Qyg 39kFTzm34thDuKQVq1ZIVL/DImO096Fm0N7Fb2amlpSazI0CHwYXV0AhKwlawUOSd4TG rEQw== Received: by 10.60.171.69 with SMTP id as5mr24455751oec.100.1347479172974; Wed, 12 Sep 2012 12:46:12 -0700 (PDT) Received: from uda0273944.am.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id a6sm17041227oeh.1.2012.09.12.12.46.11 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 12:46:12 -0700 (PDT) From: Omar Ramirez Luna To: Tony Lindgren , Benoit Cousson , Ohad Ben-Cohen , Joerg Roedel Subject: [PATCH v2 6/9] ARM: OMAP: iommu: pm runtime save and restore context Date: Wed, 12 Sep 2012 14:45:49 -0500 Message-Id: <1347479152-588-7-git-send-email-omar.luna@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347479152-588-1-git-send-email-omar.luna@linaro.org> References: <1347479152-588-1-git-send-email-omar.luna@linaro.org> X-Gm-Message-State: ALoCoQkW6IVmGZAjB2wE1MJJ+aCOPfb7etVTBwhUWooJt/TsjH6TVCOlDgTELxD9EwDA2a7en3tS X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.219.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Russell King , linux-doc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, Rajendra Nayak , linux-kernel@vger.kernel.org, Peter Ujfalusi , Laurent Pinchart , Omar Ramirez Luna , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Save and restore context during pm runtime transitions. For now, the previous API for this purpose will trigger pm runtime functions, and will be left as exported symbol for compatibility with it's only user. Signed-off-by: Omar Ramirez Luna --- drivers/iommu/omap-iommu.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 20ae946..c4de9a9 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -97,7 +97,7 @@ void omap_iommu_save_ctx(struct device *dev) { struct omap_iommu *obj = dev_to_omap_iommu(dev); - arch_iommu->save_ctx(obj); + pm_runtime_put_sync(obj->dev); } EXPORT_SYMBOL_GPL(omap_iommu_save_ctx); @@ -109,7 +109,7 @@ void omap_iommu_restore_ctx(struct device *dev) { struct omap_iommu *obj = dev_to_omap_iommu(dev); - arch_iommu->restore_ctx(obj); + pm_runtime_get_sync(obj->dev); } EXPORT_SYMBOL_GPL(omap_iommu_restore_ctx); @@ -1001,11 +1001,36 @@ static int __devexit omap_iommu_remove(struct platform_device *pdev) return 0; } +static int omap_iommu_runtime_suspend(struct device *dev) +{ + struct omap_iommu *obj = to_iommu(dev); + + arch_iommu->save_ctx(obj); + + return 0; +} + +static int omap_iommu_runtime_resume(struct device *dev) +{ + struct omap_iommu *obj = to_iommu(dev); + + arch_iommu->restore_ctx(obj); + + return 0; +} + +static const struct dev_pm_ops iommu_pm_ops = { + SET_RUNTIME_PM_OPS(omap_iommu_runtime_suspend, + omap_iommu_runtime_resume, + NULL) +}; + static struct platform_driver omap_iommu_driver = { .probe = omap_iommu_probe, .remove = __devexit_p(omap_iommu_remove), .driver = { .name = "omap-iommu", + .pm = &iommu_pm_ops, }, };