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: 2147561 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 F0D953FCF6 for ; Fri, 15 Feb 2013 13:13:47 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U6L4D-0003DJ-6B; Fri, 15 Feb 2013 13:11:05 +0000 Received: from mail-wg0-f51.google.com ([74.125.82.51]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U6Kqy-0007h2-EQ for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2013 12:57:25 +0000 Received: by mail-wg0-f51.google.com with SMTP id 8so2716109wgl.6 for ; Fri, 15 Feb 2013 04:57:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=jIFJeKrAknPsH0q6RvJM9mXVjtiSur10dZdwmzIwTFg=; b=k6YdohOJ4+LQ0cLI0a198VbxnJPcLuMIbTEkY15Yk3ieFoOFQCSvUg07iT+1LDyx3i EFCe4jW7unf//B4OKJtbuwM408qn4GnBKrg/QqZK1gMFSh+1sTgTPIfdnEqlUvWtIHZo PFc2t3/MQDN9HSrFJ8r2oBPh4nsGfnW2O72Sgta3230Dl7LSEktXWHP8QQs21sj6+2nq x7vtDNPNzkjs/cjhF/D8zE0SyqWRSlg+i6PnwKRHKB5MOu9+w3GwxQluZroryYI40DFR cbl9b99LAsqtpDq2tX0GWF134g/yqGv4JOtwvGjxs0ywJdECXULJrr5bXY47sPtLL4GS QcBA== 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 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: ALoCoQnvkRkHH54WutPB1bN1d6EDp6+uF6pfh7wFvxvpt+yAdXQt0nsmFWFXIL3DmgBsw9mTACqx X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130215_075724_605215_012F8AF2 X-CRM114-Status: GOOD ( 11.71 ) 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 [74.125.82.51 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Daniel WILLERUD , Lee Jones , linus.walleij@stericsson.com, arnd@arndb.de 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 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 = {