From patchwork Fri Feb 15 12:56:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14886 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 476E923E01 for ; Fri, 15 Feb 2013 12:57:25 +0000 (UTC) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by fiordland.canonical.com (Postfix) with ESMTP id 00A8DA1844A for ; Fri, 15 Feb 2013 12:57:24 +0000 (UTC) Received: by mail-ve0-f174.google.com with SMTP id pb11so3027027veb.33 for ; Fri, 15 Feb 2013 04:57:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=jIFJeKrAknPsH0q6RvJM9mXVjtiSur10dZdwmzIwTFg=; b=LiiO1se38in/7WEQLQd/FUlQrbrv8w9U+JBbIXTKwCq6dVybGVoYF7bOOkvAL+Eu9D asbWYLz5Imr9S9TEHe9dpOM6qSZwGt3uxYnYbbLlEK9a8df2dFOhFVf+Vqeg+PPR+9J+ z4fn8SX0h10ii8gGNXtYKx+Bsw/RaN2QH/JexGGSSAm6eXigMZ+SMDzB/sZjBFOp93mu Oui3foqVhpEMkalJcVTRYM+Z6ytPeW+QFAqzMimZgQ9V9z30X+OsdIzP30+wHj9CzwAw KHzlg7ewlIwi8dUIU+sGZ5MLipKsAe52T5sFIDihymr3akhWXRSG0xbFFSxgIimIY2nO vjHQ== X-Received: by 10.58.186.241 with SMTP id fn17mr3058976vec.8.1360933044502; Fri, 15 Feb 2013 04:57:24 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.221.4.5 with SMTP id oa5csp11351vcb; Fri, 15 Feb 2013 04:57:23 -0800 (PST) X-Received: by 10.180.95.66 with SMTP id di2mr5788160wib.18.1360933043272; Fri, 15 Feb 2013 04:57:23 -0800 (PST) Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]) by mx.google.com with ESMTPS id q18si2759443wjr.99.2013.02.15.04.57.22 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:57:23 -0800 (PST) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22e is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22e; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::22e is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f174.google.com with SMTP id r6so2838190wey.5 for ; Fri, 15 Feb 2013 04:57:22 -0800 (PST) X-Received: by 10.194.109.102 with SMTP id hr6mr4050980wjb.24.1360933042524; Fri, 15 Feb 2013 04:57:22 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id j4sm2852410wiz.10.2013.02.15.04.57.20 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:57:21 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: arnd@arndb.de, linus.walleij@stericsson.com, Daniel WILLERUD , Lee Jones Subject: [PATCH 01/35] mfd: ab8500-gpadc: Implemented suspend/resume Date: Fri, 15 Feb 2013 12:56:32 +0000 Message-Id: <1360933026-30325-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> References: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmjvCOqk/yq9ctBTbOpMXxH36PLbRpnxyjr7+9l1OFQNTNgDapHJV2CR0QzMuMUM4OOblV5 From: Daniel WILLERUD suspend/resume methods implemented to prevent suspend while the gpadc driver is busy. Signed-off-by: Daniel WILLERUD Signed-off-by: Lee Jones Reviewed-by: Jonas ABERG Reviewed-by: Ulf HANSSON --- drivers/mfd/ab8500-gpadc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c index b1f3561..9ed3afc 100644 --- a/drivers/mfd/ab8500-gpadc.c +++ b/drivers/mfd/ab8500-gpadc.c @@ -605,6 +605,31 @@ static int ab8500_gpadc_runtime_idle(struct device *dev) return 0; } +static int ab8500_gpadc_suspend(struct device *dev) +{ + struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); + + mutex_lock(&gpadc->ab8500_gpadc_lock); + + pm_runtime_get_sync(dev); + + regulator_disable(gpadc->regu); + return 0; +} + +static int ab8500_gpadc_resume(struct device *dev) +{ + struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); + + regulator_enable(gpadc->regu); + + pm_runtime_mark_last_busy(gpadc->dev); + pm_runtime_put_autosuspend(gpadc->dev); + + mutex_unlock(&gpadc->ab8500_gpadc_lock); + return 0; +} + static int ab8500_gpadc_probe(struct platform_device *pdev) { int ret = 0; @@ -698,6 +723,9 @@ static const struct dev_pm_ops ab8500_gpadc_pm_ops = { SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend, ab8500_gpadc_runtime_resume, ab8500_gpadc_runtime_idle) + SET_SYSTEM_SLEEP_PM_OPS(ab8500_gpadc_suspend, + ab8500_gpadc_resume) + }; static struct platform_driver ab8500_gpadc_driver = {