From patchwork Fri Oct 12 01:06:11 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: 1584721 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 0295A40135 for ; Fri, 12 Oct 2012 01:10:09 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMTjQ-0000q9-Rd; Fri, 12 Oct 2012 01:08:05 +0000 Received: from mail-ob0-f177.google.com ([209.85.214.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TMTi4-0000O8-42 for linux-arm-kernel@lists.infradead.org; Fri, 12 Oct 2012 01:06:41 +0000 Received: by mail-ob0-f177.google.com with SMTP id wd20so2491619obb.36 for ; Thu, 11 Oct 2012 18:06:39 -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=BPVqxoAaazfyWrHgDwymWZL4ebFV7aFDIvqv+dzoFRI=; b=mWjqKpnJbhtAV0W0RoJ8dEvcfq+gv3BKhPMrK/EKHJ51tQHE6EIK2hK8Zr6GBbBsZh SW29SZKBzaInYt7SQjET5dKclO9JFnvN+QRSbBznsTDvmrYAuXyNydz7W130aRd1SF1/ +fIk/ek9g5tnFT8NFJe9jRa5na0IXDSRZgpqNvfW+hPffap+T3WnrXKPYSQFjls0qMpT z9rJjrtEU7aFs9Nuq71Se1QAzmJ3YTIvFNODEDZzcTltTfltNTJweTKc5fqYQBK7z3Ss p/XrKaz4XBimemF6GSZjF+2vphxSZqOIQwliy7pBVgaeqEpalld/HnqZMGV8DunrZxJh 20pw== Received: by 10.60.32.137 with SMTP id j9mr2266677oei.133.1350003999714; Thu, 11 Oct 2012 18:06:39 -0700 (PDT) Received: from uda0273944.am.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id b7sm4291259oef.12.2012.10.11.18.06.38 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Oct 2012 18:06:39 -0700 (PDT) From: Omar Ramirez Luna To: Tony Lindgren , Joerg Roedel Subject: [PATCH 3/6] ARM: OMAP: iommu: pm runtime save and restore context Date: Thu, 11 Oct 2012 20:06:11 -0500 Message-Id: <1350003977-32744-7-git-send-email-omar.luna@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350003977-32744-1-git-send-email-omar.luna@linaro.org> References: <1350003977-32744-1-git-send-email-omar.luna@linaro.org> X-Gm-Message-State: ALoCoQnZE5o3iFtOeC6xIXe2I981bs24NXNMTEUSFero3ToiNgarNqULGtOANwKuQTvcvp+tAuDX 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.214.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Ohad Ben-Cohen , Paul Walmsley , Russell King , Benoit Cousson , linux-doc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, iommu@lists.linux-foundation.org, 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 37644c4..875e894 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); @@ -1008,11 +1008,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, }, };