From mboxrd@z Thu Jan 1 00:00:00 1970 From: AnilKumar Ch 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 Message-ID: <1343905339-4642-4-git-send-email-anilkumar@ti.com> References: <1343905339-4642-1-git-send-email-anilkumar@ti.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <1343905339-4642-1-git-send-email-anilkumar@ti.com> Sender: linux-can-owner@vger.kernel.org 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 List-Id: devicetree@vger.kernel.org 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 --- 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 #include #include +#include #include @@ -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