devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: AnilKumar Ch <anilkumar@ti.com>
To: wg@grandegger.com, mkl@pengutronix.de, linux-can@vger.kernel.org
Cc: devicetree-discuss@lists.ozlabs.org, grant.likely@secretlab.ca,
	anantgole@ti.com, nsekhar@ti.com, AnilKumar Ch <anilkumar@ti.com>
Subject: [PATCH v3 3/3] can: c_can: Add runtime PM support to Bosch C_CAN/D_CAN controller
Date: Thu, 2 Aug 2012 16:32:19 +0530	[thread overview]
Message-ID: <1343905339-4642-4-git-send-email-anilkumar@ti.com> (raw)
In-Reply-To: <1343905339-4642-1-git-send-email-anilkumar@ti.com>

Add Runtime PM support to C_CAN/D_CAN controller. The runtime PM
APIs control clocks for C_CAN/D_CAN IP and prevent access to the
register of C_CAN/D_CAN IP when clock is turned off.

Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
---
 drivers/net/can/c_can/c_can_platform.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index d0a66cf..83a1e17 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -32,6 +32,7 @@
 #include <linux/clk.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/pm_runtime.h>
 
 #include <linux/can/dev.h>
 
@@ -177,6 +178,9 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
 		goto exit_free_device;
 	}
 
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_sync(&pdev->dev);
+
 	dev->irq = irq;
 	priv->base = addr;
 	priv->can.clock.freq = clk_get_rate(clk);
@@ -198,6 +202,8 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
 
 exit_free_device:
 	platform_set_drvdata(pdev, NULL);
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 	free_c_can_dev(dev);
 exit_iounmap:
 	iounmap(addr);
@@ -226,6 +232,8 @@ static int __devexit c_can_plat_remove(struct platform_device *pdev)
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(mem->start, resource_size(mem));
 
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 	clk_put(priv->priv);
 
 	return 0;
-- 
1.7.9.5


  parent reply	other threads:[~2012-08-02 11:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02 11:02 [PATCH v3 0/3] Add DT support to C_CAN/D_CAN controller AnilKumar Ch
2012-08-02 11:02 ` [PATCH v3 1/3] can: c_can: Add device tree support to Bosch " AnilKumar Ch
2012-08-02 11:33   ` Arnd Bergmann
2012-08-02 12:01     ` AnilKumar, Chimata
     [not found] ` <1343905339-4642-1-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-08-02 11:02   ` [PATCH v3 2/3] can: c_can: Modify c_can device names in c_can_pci driver AnilKumar Ch
2012-08-02 11:02 ` AnilKumar Ch [this message]
2012-08-02 11:13 ` [PATCH v3 0/3] Add DT support to C_CAN/D_CAN controller Marc Kleine-Budde
     [not found]   ` <501A60C0.1040504-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-08-02 11:21     ` AnilKumar, Chimata
2012-08-02 11:23       ` Marc Kleine-Budde
     [not found]         ` <501A633A.5000100-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-08-02 11:39           ` AnilKumar, Chimata
     [not found]             ` <331ABD5ECB02734CA317220B2BBEABC13EA081FB-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-08-02 11:45               ` Marc Kleine-Budde

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=1343905339-4642-4-git-send-email-anilkumar@ti.com \
    --to=anilkumar@ti.com \
    --cc=anantgole@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=nsekhar@ti.com \
    --cc=wg@grandegger.com \
    /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).