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: 1584621 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A7EA2DFFCF for ; Fri, 12 Oct 2012 01:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752567Ab2JLBGm (ORCPT ); Thu, 11 Oct 2012 21:06:42 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:51729 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754746Ab2JLBGk (ORCPT ); Thu, 11 Oct 2012 21:06:40 -0400 Received: by mail-ob0-f174.google.com with SMTP id uo13so2384903obb.19 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=QFEiYoIbFc5qFbHHZCUCjuowfZh9s1TIP+ciDoP4XfC9oFrERSS5bx8ysh/kmsJ0gF yUAU2wvwEvUjvf1E07IkPKGdgIrStvbDmIwia1CNCMC/7jKyshTHtZxq3nqGs9TzULEg Pwh6glK7SK1IVcDU+ayakPPJOQOC1UJSZAH/wtsBMFWyX3TQ4SuW44A1jIEioh1XYQ3s 0X/0GflEGzgT7hDASVg7TZJhdppoRE2l2ZPUqo/BU+F+6kcErgfKLSurS9L8cK9+QWUF sE2Sw7jxLskHc3NxrL8KjWSkiWk6w7ODk/hL4SewG/miOAhBH+8HDRbnXwQCbcvtb7P+ JF7A== 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 Cc: Russell King , Omar Ramirez Luna , Benoit Cousson , Ohad Ben-Cohen , Paul Walmsley , Laurent Pinchart , devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, iommu@lists.linux-foundation.org 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: ALoCoQlTaNlVWHSaNrixDIozaaB/oZfQ7Bq3F+xmR4G1KQAkn1NeWptg+o3q5ZsTrOq3lqMZhOZl Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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, }, };