From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-i2c@vger.kernel.org
Cc: Wolfram Sang <w.sang@pengutronix.de>,
"Ben Dooks (embedded platforms)" <ben-linux@fluff.org>,
Jean Delvare <khali@linux-fr.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
dirk.brandewie@gmail.com, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] i2c-designware: add minimal support for runtime PM
Date: Thu, 17 Jan 2013 12:31:06 +0200 [thread overview]
Message-ID: <1358418667-4533-4-git-send-email-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <1358418667-4533-1-git-send-email-mika.westerberg@linux.intel.com>
In order to save power the device should be put to low power states
whenever it is not being used. We implement this by enabling minimal
runtime PM support.
There isn't much to do for the device itself as it is disabled once the
last transfer is completed but subsystem/domain runtime PM hooks can save
more power by power gating the device etc.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/i2c/busses/i2c-designware-platdrv.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 343357a..d8afc85 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -37,6 +37,7 @@
#include <linux/of_i2c.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
+#include <linux/pm_runtime.h>
#include <linux/io.h>
#include <linux/slab.h>
#include "i2c-designware-core.h"
@@ -149,6 +150,10 @@ static int dw_i2c_probe(struct platform_device *pdev)
}
of_i2c_register_devices(adap);
+ pm_runtime_set_active(&pdev->dev);
+ pm_runtime_enable(&pdev->dev);
+ pm_runtime_put(&pdev->dev);
+
return 0;
err_free_irq:
@@ -175,6 +180,8 @@ static int dw_i2c_remove(struct platform_device *pdev)
struct resource *mem;
platform_set_drvdata(pdev, NULL);
+ pm_runtime_get_sync(&pdev->dev);
+
i2c_del_adapter(&dev->adapter);
put_device(&pdev->dev);
@@ -186,6 +193,9 @@ static int dw_i2c_remove(struct platform_device *pdev)
free_irq(dev->irq, dev);
kfree(dev);
+ pm_runtime_put(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, resource_size(mem));
return 0;
--
1.7.10.4
next prev parent reply other threads:[~2013-01-17 10:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-17 10:31 [PATCH 0/4] i2c-designware: add Intel Lynxpoint support Mika Westerberg
2013-01-17 10:31 ` [PATCH 2/4] i2c-designware: always set the STOP bit after last byte Mika Westerberg
2013-01-17 10:32 ` Felipe Balbi
2013-01-17 10:42 ` Mika Westerberg
[not found] ` <20130117104247.GU2239-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-17 10:43 ` Felipe Balbi
2013-01-17 10:31 ` Mika Westerberg [this message]
2013-01-17 10:31 ` [PATCH 4/4] i2c-designware: add support for Intel Lynxpoint Mika Westerberg
[not found] ` <1358418667-4533-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-01-17 10:31 ` [PATCH 1/4] i2c-designware: add missing MODULE_LICENSE Mika Westerberg
2013-01-24 7:28 ` [PATCH 0/4] i2c-designware: add Intel Lynxpoint support Wolfram Sang
[not found] ` <20130124072846.GO8364-8EAEigeeuNG034pCzgS/Qg7AFbiQbgqx@public.gmane.org>
2013-01-24 9:18 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358418667-4533-4-git-send-email-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=ben-linux@fluff.org \
--cc=dirk.brandewie@gmail.com \
--cc=khali@linux-fr.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=w.sang@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).