From patchwork Tue Apr 17 07:30:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 7883 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 3E83823E4C for ; Tue, 17 Apr 2012 07:30:39 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 06DF8A1876B for ; Tue, 17 Apr 2012 07:30:38 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so11751811iag.11 for ; Tue, 17 Apr 2012 00:30:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=9DDPDXqgZF+ZocylK38vLv4avx2vwtSoMfSCADvX/C4=; b=fA2j2mzx1Ss65rclQg+1xfAsaQK5eoP45N2FtJ67oSP0jSrxveZxayfbyLtHYiT6WK 9IclYfeDOm4sY3j6zv8wVJ0XczjUF8QkC4j4G2lMmnpung6flm9fdVqeXBtVvsQ4QaXy crnvHczpJj0LVFC/UZ+j8dSSCDMYmXsujBpfmYWi1T3BdzUqF1qdUXEkmmpR/0TyeR1o 5n7TVHUd6He4k6fwWNZgC9RhJ6DNl4gnpUb6E0EfamQvXTO0VGHyJpc6q0MObTAG4LOM sUTWE7iuPBiLbZtERG+CYEuxRP6kA2aH0Nryd7ERGX91BxjVUui3/e6fseMiQ6QmhvXl OhxA== Received: by 10.50.185.233 with SMTP id ff9mr8251124igc.55.1334647838771; Tue, 17 Apr 2012 00:30:38 -0700 (PDT) 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.231.137.198 with SMTP id x6csp129999ibt; Tue, 17 Apr 2012 00:30:38 -0700 (PDT) Received: by 10.213.102.12 with SMTP id e12mr1030985ebo.15.1334647837420; Tue, 17 Apr 2012 00:30:37 -0700 (PDT) Received: from eu1sys200aog116.obsmtp.com (eu1sys200aog116.obsmtp.com. [207.126.144.141]) by mx.google.com with SMTP id v8si5732739een.14.2012.04.17.00.30.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Apr 2012 00:30:37 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.141 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.141; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.141 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob116.postini.com ([207.126.147.11]) with SMTP ID DSNKT40cGE9kFqPt7Rvh8arcOp6rsgt7v3UH@postini.com; Tue, 17 Apr 2012 07:30:37 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 9FC3EAB; Tue, 17 Apr 2012 07:22:07 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 0CC48B63; Tue, 17 Apr 2012 07:30:29 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id EB4B5A8095; Tue, 17 Apr 2012 09:30:24 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 17 Apr 2012 09:30:27 +0200 From: Linus Walleij To: Samuel Ortiz , Cc: Rabin Vincent , Linus Walleij Subject: [PATCH 2/6] mfd/ab8500: handle the irq for suspend/resume Date: Tue, 17 Apr 2012 09:30:24 +0200 Message-ID: <1334647824-1663-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnkNjstuCqoCMFxrdSy/qOHdb59vHfxuhWSpg/c+x/ViGLeuyCtMFwVPR8nDWwje50nFFum From: Rabin Vincent Ensure that the AB interrupt is only handled at a time when all core drivers are resumed. Ensure that the AB interrupt is marked as a wakeup interrupt. Signed-off-by: Rabin Vincent Reviewed-by: Jonas Aberg Reviewed-by: Mattias Wallin Signed-off-by: Linus Walleij --- drivers/mfd/ab8500-i2c.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/mfd/ab8500-i2c.c b/drivers/mfd/ab8500-i2c.c index b83045f..89b31a3 100644 --- a/drivers/mfd/ab8500-i2c.c +++ b/drivers/mfd/ab8500-i2c.c @@ -101,10 +101,42 @@ static const struct platform_device_id ab8500_id[] = { { } }; +#ifdef CONFIG_PM +static int ab8500_i2c_suspend(struct device *dev) +{ + struct ab8500 *ab = dev_get_drvdata(dev); + + disable_irq(ab->irq); + enable_irq_wake(ab->irq); + + return 0; +} + +static int ab8500_i2c_resume(struct device *dev) +{ + struct ab8500 *ab = dev_get_drvdata(dev); + + disable_irq_wake(ab->irq); + enable_irq(ab->irq); + + return 0; +} + +static const struct dev_pm_ops ab8500_i2c_pm_ops = { + .suspend = ab8500_i2c_suspend, + .resume = ab8500_i2c_resume, +}; + +#define AB8500_I2C_PM_OPS (&ab8500_i2c_pm_ops) +#else +#define AB8500_I2C_PM_OPS NULL +#endif + static struct platform_driver ab8500_i2c_driver = { .driver = { .name = "ab8500-i2c", .owner = THIS_MODULE, + .pm = AB8500_I2C_PM_OPS, }, .probe = ab8500_i2c_probe, .remove = __devexit_p(ab8500_i2c_remove),