From patchwork Fri Jan 28 00:18:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 513461 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0S0KGFj024226 for ; Fri, 28 Jan 2011 00:20:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753563Ab1A1AUN (ORCPT ); Thu, 27 Jan 2011 19:20:13 -0500 Received: from na3sys009aog105.obsmtp.com ([74.125.149.75]:44938 "EHLO na3sys009aog105.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752780Ab1A1AUM (ORCPT ); Thu, 27 Jan 2011 19:20:12 -0500 Received: from source ([209.85.160.171]) (using TLSv1) by na3sys009aob105.postini.com ([74.125.148.12]) with SMTP ID DSNKTUILuy6HHEKGIx7rLT3pV4y/gxBDyyQJ@postini.com; Thu, 27 Jan 2011 16:20:12 PST Received: by gyg13 with SMTP id 13so1015430gyg.2 for ; Thu, 27 Jan 2011 16:20:11 -0800 (PST) Received: by 10.151.106.2 with SMTP id i2mr3587883ybm.124.1296174010392; Thu, 27 Jan 2011 16:20:10 -0800 (PST) Received: from localhost (c-24-18-179-55.hsd1.wa.comcast.net [24.18.179.55]) by mx.google.com with ESMTPS id v6sm1352839ybk.20.2011.01.27.16.20.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 27 Jan 2011 16:20:09 -0800 (PST) From: Kevin Hilman To: Ben Dooks , Rajendra Nayak , linux-i2c@vger.kernel.org Cc: linux-omap@vger.kernel.org, linux-pm@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] i2c: OMAP: fix static suspend vs. runtime suspend Date: Thu, 27 Jan 2011 16:18:41 -0800 Message-Id: <1296173921-4832-1-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.3.5 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 28 Jan 2011 00:20:16 +0000 (UTC) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index b605ff3..0541df9 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -1137,12 +1137,40 @@ omap_i2c_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_SUSPEND +static int omap_i2c_suspend(struct device *dev) +{ + if (!pm_runtime_suspended(dev)) + if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_suspend) + dev->bus->pm->runtime_suspend(dev); + + return 0; +} + +static int omap_i2c_resume(struct device *dev) +{ + if (!pm_runtime_suspended(dev)) + if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_resume) + dev->bus->pm->runtime_resume(dev); + + return 0; +} + +static struct dev_pm_ops omap_i2c_pm_ops = { + .suspend = omap_i2c_suspend, + .resume = omap_i2c_resume, +}; +#else +#define omap_i2c_pm_ops NULL +#endif + static struct platform_driver omap_i2c_driver = { .probe = omap_i2c_probe, .remove = omap_i2c_remove, .driver = { .name = "omap_i2c", .owner = THIS_MODULE, + .pm = &omap_i2c_pm_ops, }, };