From patchwork Tue Dec 8 10:13:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chaithrika@ti.com X-Patchwork-Id: 65671 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB8AYqEk004799 for ; Tue, 8 Dec 2009 10:34:53 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id nB8AXYjR011017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 8 Dec 2009 04:33:34 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id nB8AXW6H007641; Tue, 8 Dec 2009 04:33:33 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 8AAFF806C2; Tue, 8 Dec 2009 04:33:16 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 542EA8062A for ; Tue, 8 Dec 2009 04:32:34 -0600 (CST) Received: from tidmzi-ftp.india.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with SMTP id nB8AWV7F029488; Tue, 8 Dec 2009 04:32:32 -0600 (CST) Received: from symphonyindia.ti.com (symphony-ftp [192.168.247.11]) by tidmzi-ftp.india.ext.ti.com (Postfix) with SMTP id BABEE38874; Tue, 8 Dec 2009 15:59:18 +0530 (IST) Received: from localhost.localdomain ([192.168.247.76]) by symphonyindia.ti.com (8.13.1/8.12.10) with ESMTP id nB8ANrwH011329; Tue, 8 Dec 2009 15:53:53 +0530 From: Chaithrika U S To: linux-i2c@vger.kernel.org Subject: [PATCH v2 3/4] i2c: davinci: Add suspend/resume support Date: Tue, 8 Dec 2009 15:43:37 +0530 Message-Id: <1260267218-19406-4-git-send-email-chaithrika@ti.com> X-Mailer: git-send-email 1.5.6 In-Reply-To: <1260267218-19406-3-git-send-email-chaithrika@ti.com> References: <1260267218-19406-1-git-send-email-chaithrika@ti.com> <1260267218-19406-2-git-send-email-chaithrika@ti.com> <1260267218-19406-3-git-send-email-chaithrika@ti.com> Cc: davinci-linux-open-source@linux.davincidsp.com X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 81c1049..c1c2909 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -622,6 +622,36 @@ static int davinci_i2c_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static int davinci_i2c_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct davinci_i2c_dev *dev = platform_get_drvdata(pdev); + + /* put I2C into reset */ + davinci_i2c_reset_ctrl(dev, 0); + + clk_disable(dev->clk); + + return 0; +} + +static int davinci_i2c_resume(struct platform_device *pdev) +{ + struct davinci_i2c_dev *dev = platform_get_drvdata(pdev); + + clk_enable(dev->clk); + + /* take I2C out of reset */ + davinci_i2c_reset_ctrl(dev, 1); + + return 0; +} + +#else +#define davinci_i2c_suspend NULL +#define davinci_i2c_resume NULL +#endif + /* work with hotplug and coldplug */ MODULE_ALIAS("platform:i2c_davinci"); @@ -632,6 +662,8 @@ static struct platform_driver davinci_i2c_driver = { .name = "i2c_davinci", .owner = THIS_MODULE, }, + .suspend = davinci_i2c_suspend, + .resume = davinci_i2c_resume, }; /* I2C may be needed to bring up other drivers */