* [PATCH] TI DaVinci EMAC: Add suspend/resume capability
@ 2009-11-04 12:49 Ranjith Lohithakshan
2009-11-04 13:22 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ranjith Lohithakshan @ 2009-11-04 12:49 UTC (permalink / raw)
To: netdev
Cc: davem, davinci-linux-open-source, Ranjith Lohithakshan,
Chaithrika U S
Add suspend/resume capability to TI DaVinci EMAC driver.
Signed-off-by: Ranjith Lohithakshan <ranjithl@ti.com>
Signed-off-by: Chaithrika U S <chaithrika@ti.com>
---
Applies to net-next-2.6
drivers/net/davinci_emac.c | 35 ++++++++++++++++++++++++++++++++---
1 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index a876dce..cace49f 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2806,11 +2806,38 @@ static int __devexit davinci_emac_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static
+int davinci_emac_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct net_device *dev = platform_get_drvdata(pdev);
+
+ if (netif_running(dev))
+ emac_dev_stop(dev);
+
+ clk_disable(emac_clk);
+
+ return 0;
+}
+
+static int davinci_emac_resume(struct platform_device *pdev)
+{
+ struct net_device *dev = platform_get_drvdata(pdev);
+
+ clk_enable(emac_clk);
+
+ if (netif_running(dev))
+ emac_dev_open(dev);
+
+ return 0;
+}
+#else
+#define davinci_emac_suspend NULL
+#define davinci_emac_resume NULL
+#endif
+
/**
* davinci_emac_driver: EMAC platform driver structure
- *
- * We implement only probe and remove functions - suspend/resume and
- * others not supported by this module
*/
static struct platform_driver davinci_emac_driver = {
.driver = {
@@ -2819,6 +2846,8 @@ static struct platform_driver davinci_emac_driver = {
},
.probe = davinci_emac_probe,
.remove = __devexit_p(davinci_emac_remove),
+ .suspend = davinci_emac_suspend,
+ .resume = davinci_emac_resume,
};
/**
--
1.5.6
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] TI DaVinci EMAC: Add suspend/resume capability
2009-11-04 12:49 [PATCH] TI DaVinci EMAC: Add suspend/resume capability Ranjith Lohithakshan
@ 2009-11-04 13:22 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-11-04 13:22 UTC (permalink / raw)
To: ranjithl; +Cc: netdev, davinci-linux-open-source, chaithrika
From: Ranjith Lohithakshan <ranjithl@ti.com>
Date: Wed, 4 Nov 2009 18:19:51 +0530
> Add suspend/resume capability to TI DaVinci EMAC driver.
>
> Signed-off-by: Ranjith Lohithakshan <ranjithl@ti.com>
> Signed-off-by: Chaithrika U S <chaithrika@ti.com>
> ---
> Applies to net-next-2.6
I don't think the CONFIG_PM CPP ifdefs are necessary.
Drivers generally don't do this, and they build just fine
on sparc64 which never sets CONFIG_PM ;-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-04 13:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 12:49 [PATCH] TI DaVinci EMAC: Add suspend/resume capability Ranjith Lohithakshan
2009-11-04 13:22 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox